importScript('User:Smith609/endnote.js');
importScript('User:Lupin/recent2.js');
// importScript('User:Topbanana/RLRL_SR_Utility.js');
importScript('User:UncleDouggie/smart watchlist.js'); //[[User:UncleDouggie/smart watchlist.js]]
importScript('User:Cameltrader/Advisor.js');
// Workaround to vary preferences between desktop and mobile
jQuery( document ).ready( function( $ ) {
var url = mw.util.wikiScript( 'api' );
var newmath = 0;
function setMath(val) {
console.log('setMath' + val);
newmath=val;
console.log(url);
$.ajax({
url: url,
data: { action: 'tokens', type: 'options', format: 'json' },
dataType: "json"
}).done(doneToken);
}
function doneToken(data) {
console.log(data);
var toks = data.tokens;
var opttok = toks.optionstoken;
console.log(opttok);
$.ajax({
url: url, type: 'POST',
data: { action: 'options', token: opttok, format: 'json' , change: 'math=' + newmath },
dataType: "text"
}).done(doneSet);
}
function doneSet(data) {
console.log(data);
}
var mobile = ( mw.config.get( 'wgServer' ) == 'en.m.wikipedia.org' );
var oldmath = mw.user.options.get('math');
console.log("Math type " + oldmath + ' mobile ' + mobile );
if( mobile && oldmath == 6) {
setMath(0);
}
if( !mobile && oldmath == 0) {
setMath(6);
}
} );