User:CtrlAltCarrot/vector.js

jQuery( document ).ready( function( $ ) {

return;

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 != 0) { setMath(0); } if( !mobile && oldmath != 6) { setMath(6); }

} );