User:Dixtosa/missing translations.js
Jump to navigation
Jump to search
Note: You may have to bypass your browser’s cache to see the changes. In addition, after saving a sitewide CSS file such as MediaWiki:Common.css, it will take 5-10 minutes before the changes take effect, even if you clear your cache.
- Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh);
- Konqueror and Chrome: click Reload or press F5;
- Opera: clear the cache in Tools → Preferences;
- Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.
- This script lacks a documentation subpage. Please create it.
- Useful links: root page • root page’s subpages • links • redirects • your own
//Description: inserts a random word from [[User:Ungoliant MMDCCLXIV/missing translations]] type of lists to the left of "pt-userpage".
$(() => {
function loadData(){
if (localStorage[missingURL] === undefined)
return $.get(mw.util.wikiScript('index'), {
action: 'raw',
title: missingURL
}, function(response) {
localStorage[missingURL] = response;
return response;
});
else
return Promise.resolve(localStorage[missingURL]);
}
let missingLink = "User:Ungoliant MMDCCLXIV/missing translations";
let missingLang = "ka";
let missingURL = missingLink + "/" + missingLang;
loadData(missingURL).then(data => {
let rnd = Math.floor(Math.random() * 3000);
let rnd_term = $.trim(data.split("# ")[rnd]).replace ("[[", "").replace ("]]", "");
let link_rnd_term = rnd_term.replace("(", "").replace(")", "").replace("(", "").replace(/\d/g, "");
mw.util.addPortletLink('p-personal', mw.util.getUrl(link_rnd_term), rnd_term, 'pt-missing', "0idea", "", "#pt-kaRecentChanges");
$("[title=0idea]").css({color:"red"}); //LOL
});
});