User:Cacycle/wikEd installation#Ultra-simple version
Installation
wikEd can be used on every language Wikipedia as well as on any MediaWiki wiki installation. There are several different ways to install wikEd:
class="wikitable"
! Type ! Scope ! Installation ! Remarks |
Gadget
| Local Wikipedia language or wiki only | Select wikEd under Gadgets in your wiki preferences | The easiest option on the English Wikipedia. Not available on all wikis. |
---|
rowspan=2 | User script
| Local Wikipedia language or wiki only | Paste a small code snippet to your User:YourUsername/common.js page | |
Every Wikipedia language and MediaWiki installation
| Paste a small code snippet to your meta:User:YourUsername/global.js page | |
Site wide
| Local wiki only | A wiki administrator has to paste a code snippet to the MediaWiki:Common.js page | Site wide installation for all users |
Greasemonkey/Tampermonkey
| Every Wikipedia language and MediaWiki installation | Install the Greasemonkey/Tampermonkey add-on for your browser, then install wikEd by clicking [//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Cacycle/wikEd.user.js here] | Also works for anonymous users that are not logged in |
See below for more details, including how to install wikEd on non-Wikipedia wikis and on wikis without internet connection.
= Gadget =
wikEd can be enabled simply by selecting it in the Gadget section in your Wikipedia preferences. This works on Wikipedia as well as on other wikis if they have the Gadgets extension installed. If you want to add wikEd as a gadget option on your wiki, please see below. If running wikEd as a gadget, the version information (hover over the wikEd logo on top of the page) has a "G" added.
= Greasemonkey/Tampermonkey =
wikEd runs automatically on every MediaWiki wiki when installed locally as a Greasemonkey (Firefox) or Tampermonkey (Chrome) userscript.
- Install [https://addons.mozilla.org/en-US/firefox/addon/748 Greasemonkey for Firefox] or [https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo Tampermonkey for Chrome]
- Install wikEd by clicking [//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Cacycle/wikEd.user.js this link] and completing the installation popup window
- Optional: wikEd can be customized by adding user settings to the code, but these settings will be overwritten by updates
- The version information (hover over the wikEd logo on top of the page) has a "GM" added when wikEd runs as a Greasemonkey/Tampermonkey userscript.
= On-wiki installation code =
Simply add one of the following code snippets to your User:YourUsername/common.js page. You need a user account and you have to be logged in in order to install and use wikEd. Both installation versions give identical results. After saving, you have to refresh your browser's cache to see the changes: hold down Shift while clicking Reload (or press Ctrl-Shift-R).
- Please do not copy the complete wikEd program code to your page in order to get the frequent updates and bug fixes and to save disk space (but see wikis without internet connection).
- Please do not use the
importScript(), importScriptURI(), or mw.loader.load()
functions as these interfere with the script's own installation mechanism and will delay the startup.
== Ultra-simple version ==
This works only for installations on the English Wikipedia and for global installation:
- Log in under your username
- Click the following link to edit your User:YourUsername/common.js page (where YourUsername is your wiki username): [{{fullurl:Special:Mypage/common.js|action=edit}} Special:Mypage/common.js]
- Alternatively, for installing wikEd on every Wikipedia language and MediaWiki installation, open your meta:User:YourUsername/global.js page (where YourUsername is your wiki username) by hand or click [{{fullurl:meta:Special:Mypage/global.js|action=edit}} meta:Special:Mypage/global.js]
- Add the following code to that edit page:
Remember that you must include the{{subst:wikEd}} subst:
keyword, as the Javascript interpreter does not understand the {{}} wiki syntax. If there is already code on your User:YourUsername/common.js page, please make sure not to paste the wikEd line between , <...
nowiki>... >, or /*...*/ tags. - The ultra-simple version expands to the complete version (see below) upon previewing or saving the page
- Save the page
- Refresh your browser's cache: hold down Shift while clicking Reload (or press Ctrl-Shift-R)
- The wikEd logo Image:wikEd_logo.png should now be displayed on top of every page next to the log out link
== Complete version ==
This is the real installation code that works for all MediaWiki installations:
: 1. Log in under your username
: 2. If you are on the English Wikipedia, open your User:YourUsername/common.js page (where YourUsername is your wiki username) by hand or click [{{fullurl:Special:Mypage/common.js|action=edit}} Special:Mypage/common.js]
: 3. Alternatively, for installing wikEd on every Wikipedia language and MediaWiki installation, open your meta:User:YourUsername/global.js page (where YourUsername is your wiki username) by hand or click [{{fullurl:meta:Special:Mypage/global.js|action=edit}} meta:Special:Mypage/global.js]
: 4. Add the following code to that edit page:
// install :Wikipedia:User:Cacycle/wikEd in-browser text editor
(function ()
{
var script = document.createElement('script');
script.src = 'https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript';
script.async = true;
document.getElementsByTagName('head')[0].appendChild(script);
}
) ();
:: If there is already code on your User:YourUsername/common.js (or meta:User:YourUsername/global.js) page, please make sure not to paste the installation code between /*...*/ tags.
: 5. Save the page
: 6. Refresh your browser's cache: hold down Shift while clicking Reload (or press Ctrl-Shift-R)
: 7. The wikEd logo Image:wikEd_logo.png should now be displayed on top of every page next to the log out link
= Non-Wikimedia wikis =
In order for user scripts like wikEd to function as a wiki user script (common.js installation), the following line has to be added to the MediaWiki configuration file LocalSettings.php by a server administrator (a site-wide installation does not need this setting):
$wgAllowUserJs = true;
If you get an error message similar to
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 279876 bytes)
in /server-path-to-your-wiki/includes/Parser.php on line 496
then the following value in php.ini has to be increased from its default value to at least 32 MB by a server administrator:
memory_limit = 32M
Use the "complete version" of the installation code from below — the ultra-simple version works only on Wikipedia because it uses a template. If you have problems to get it to work because of JavaScript errors (check the JavaScript Error Console in the Options menu of your browser), please post a message to the wikEd discussion page.
= Site-wide installation =
wikEd can also be installed site-wide and can then also be used by not logged-in users. A wiki sysop (admin) or bureaucrat has to add the "complete version" of the installation code from above to the MediaWiki:Common.js page of their wiki. The script can then be used without allowing the users to run their own common.js JavaScript code. The $wgAllowUserJs = true;
is not required for a site-wide installation.
For a logged-in user-only alternative, see above under Gadget.
Creating a gadget
Administrators can create a wikEd gadget option in the user preferences of a wiki (see also Wikipedia:Gadget). This requires write permissions for the interface messages in the MediaWiki namespace.
: 1. The wiki must have the Gadgets extension installed (check Special:Version)
: 2. Add the following code to MediaWiki:Gadget-wikEd.js:
// install Wikipedia:User:Cacycle/wikEd in-browser text editor
( function () { var script = document.createElement( 'script' ); script.src = '//en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript'; script.async = true; document.getElementsByTagName( 'head' )[ 0 ].appendChild( script ); } ) ();
: Translations are automatically loaded and should not be added here, see wikEd international. Only on wikis without internet connection should the whole code from User:Cacycle/wikEd.js be pasted instead (see also below). In that case also add the following line:
var wikEdAutoUpdateUrl = '//en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd_current_version&action=raw&maxage=0';
: and change the link to your own wikEd version page. Please update these pages regularly for bug fixes and new features
: 3. Additionally, add any site- or language-specific customization code to this page
: 4. Add a description to MediaWiki:Gadget-wikEd. Please link to the wikEd home page and state that wikEd works under all browsers except Internet Explorer
: 5. Add the following line to MediaWiki:Gadgets-definition:
* wikEd[ResourceLoader]|wikEd.js
: 6. wikEd should now appear on Special:Gadgets and under Special:Preferences:Gadgets
= Wikis without internet connection =
If your wiki users do not have internet access, e.g., in an intranet, you can still use wikEd. This is the only case where it makes sense to copy the whole wikEd program code to another page.
- Make sure that a server administrator has made the following settings (as described above):
$wgAllowUserJs = true;
(per-user installation) and/or$wgUseSiteJs = true;
(for all installation) in LocalSettings.phpmemory_limit = 32M
in php.ini- Copy the whole wikEd program code from the page wikEd.js to the page wikEd.js on your wiki
- Copy the wikEd version page from wikEd current version to the page wikEd current version on your wiki
- Copy the wikEd help page from wikEd help to the page wikEd help on your wiki
- Copy the whole diff program code from the page diff.js to the page diff.js on your wiki
- Optionally, copy the wikEd version page from Wikipedia:AutoWikiBrowser/Typos to the page AutoWikiBrowser typos on your wiki
- Copy the respective translation page (see User:Cacycle/wikEd_international) to the page wikEd_translation.js on your wiki if needed
- Download all wikEd images (~100). This can be done by attaching "&wiked=iconpage" to the address of an wikEd-enabled page with internet connection. The resulting page contains all icons and images used by the program and can be saved into one folder as "web page, complete". The original images are deposited on the Commons.
- Upload the images (do not change the image names):
- Either into one directory on a server accessible on your intranet (easier, but needs FTP access to that server)
- Or upload all images manually onto your wiki using the Upload file page (more work)
- Decide where to save the installation code on your wiki:
- If you want to load wikEd by default for everybody, then save the installation code to the page MediaWiki:Common.js on your wiki
- If you want to load wikEd on a per-user basis, then save the installation code to the template Template:wikEd — users can then install wikEd simply by adding
to their User:USERNAME/common.js page.{{subst:wikEd}} - Save one of the two following installation codes to that place, depending on how you have uploaded the images:
:: This installation code is for images in one single directory:
// path to images
var wikEdUseLocalImages = true;
var wikEdImagePathLocal = '//YOUR-DOMAIN.WHATEVER/PATH-TO-YOUR-IMAGES/';
// diff script URL
var wikEdDiffScriptSrc = '//YOUR-DOMAIN.WHATEVER/PATH-TO-YOUR-WIKI/index.php?title=diff.js&action=raw&ctype=text/javascript';
// wikEdDiff script URL
var wikEdDiffSrc = '//YOUR-DOMAIN.WHATEVER/PATH-TO-YOUR-WIKI/index.php?title=wikEdDiff.js&action=raw&ctype=text/javascript';
// InstaView script URL
var wikEdInstaViewSrc = '//YOUR-DOMAIN.WHATEVER/PATH-TO-YOUR-WIKI/index.php?title=instaview.js&action=raw&ctype=text/javascript';
// help page link (if you do not host your own translation)
var wikEdText = {
'wikEdHelpPageLink': ' | wikEd help';
}
// auto update: set to false or create a wiki version page
// var wikEdAutoUpdate = false;
// auto update: version url (Ajax)
var wikEdAutoUpdateUrl = '//YOUR-DOMAIN.WHATEVER/PATH-TO-YOUR-WIKI/index.php?title=wikEd_current_version&action=raw&maxage=0';
// RegExTypoFix rules page, the address must have the exact same domain name as the used wiki
var wikEdRegExTypoFixURL = '//YOUR-DOMAIN.WHATEVER/PATH-TO-YOUR-WIKI/index.php?title=AutoWikiBrowser_typos&action=raw';
// install the wikEd translation (omit if no translation needed)
document.write('