User:Pemaksa/Scripts/wiki.js
< User:Pemaksa | Scripts
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
(function() {
$(document).ready(function() {
mw.loader.using( ['mediawiki.util'], function() {
// show shortcuts if not editing
if (!mw.config.get('wgEditMessage')) {
mw.util.addPortletLink("p-navigation", "https://meta.wikimedia.org/wiki/Special:RecentChanges", "meta");
mw.util.addPortletLink("p-navigation", "https://commons.wikimedia.org/", "commons");
mw.util.addPortletLink("p-navigation", "https://wikidata.org/", "wikidata");
mw.util.addPortletLink("p-navigation", "https://en.wikipedia.org/", "en.wp");
mw.util.addPortletLink("p-navigation", "https://en.wiktionary.org/wiki/Special:RecentChanges", "en.wikt");
mw.util.addPortletLink("p-navigation", "https://en.wikibooks.org/wiki/Special:RecentChanges", "en.wb");
return;
}
});
});
}());
/**
mw.loader.using( 'mediawiki.util', function () {
$(document).ready( function () {
var link = mw.util.addPortletLink( 'p-cactions', '#', 'wiki', 'ca-wiki', 'wiki');
$( link ).click( function ( event ) {
event.preventDefault();
wiki();
} );
} );
} );**/
function getToken() {
var tokenReq = {
action: 'query',
meta: 'tokens',
format: 'json'
};
var result = null;
var scriptUrl = mw.config.get( 'wgScriptPath' ) + '/api.php';
$.ajax({
url: scriptUrl,
type: 'get',
data: tokenReq,
dataType: 'json',
async: false,
success: function(data) {
result = data.query.tokens.csrftoken;
}
});
return result;
}