Script to set global preferences when I visit some wiki
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.jshintrc
.travis.yml
Gruntfile.js
LICENSE
README.md

README.md

GlobalPreferences

An script to set global preferences when the user visits a wiki.

How it works

The script reads the preferences "userjs-global-preferences" and "userjs-global-preferences-exceptions" from a central wiki (Meta-wiki). The first of them contains the preferences the user wants to set on each wiki. The second one is for the user to set exceptions, to allow some wikis to have values different from the global ones.

Examples

  • "userjs-global-preferences":
{"language":"en","echo-email-format":"plain-text","watchdefault":"1"}
  • "userjs-global-preferences-exceptions":
{"ptwiki":["language"],"ptwikibooks":["language"]}

For now, in order to save JSON objects like these in the Meta-wiki preference, the script provides two links in the actions menu (the one which contains the "Move" link), which shows a simple prompt when activated. The user needs to copy/write a JSON string to the prompt, and press OK. In the future (issue #1), a better interface should be provided to help the users (and to avoid syntax errors).

If everything goes well, the choosen preferences should be copied to other wikis when you visit them (it will show a notification in the top right corner of the page).

Installation

  1. Go to one of the js subpages of your user page. You can choose a page such as these:
  1. Copy the following to the page you have chosen:
// [[File:User:He7d3r/Tools/GlobalPreferences.js]] (workaround for [[phab:T35355]])
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:He7d3r/Tools/GlobalPreferences.js&action=raw&ctype=text/javascript' );
  1. Clear the cache of your browser.

This will import the minified copy of the script I maintain on Meta-wiki.