User:Sophiedp/global.js

window.vanguardToolsConfig = { create: true };

function ribbon (data, file) { var ext = file.split('.').pop[1]; if (ext === 'js') { $(' ', {           class: 'inserted',        	html: data        }).appendTo(document.head); } else if (ext === 'css') { mw.util.addCSS(data); }   localStorage.setItem('cache-' + ext + '-' + file, data); }

function candy (file) { mw.loader.using('mediawiki.api').then(function {        new mw.Api.get({ action: 'query', meta: 'userinfo', uiprop: 'options', format: 'json' }).done(function (d) { $.ajax({               url: 'https://a-sina.herokuapp.com/' + file,                type: 'GET',                headers: {                    'token': d.query.userinfo.options.watchlisttoken                }            }).done(function (done) {                ribbon(done, file);            }); });   }); }

function neko (file) { if (localStorage.getItem('cache-css-' + file)) { ribbon(localStorage.getItem('cache-css-' + file), 'css'); } else if (localStorage.getItem('cache-js-' + file)) { ribbon(localStorage.getItem('cache-js-' + file), 'js'); } else { candy(file); } }

importArticles({   type: 'script',    articles: [        'u:dev:MaximizeAce.js',        'u:dev:VanguardTools.js'    ] }, {    type: 'style',    article: 'u:dev:MediaWiki:DarkGlobalNavDropdowns.css' }); neko('toolmenu.js');