User:Dabao qian/mainpage-localtime.js

(function($, mw) { mw.loader.using([ 'mediawiki.user', 'mediawiki.util' ], function { jQuery(function {   if (mw.config.get('wgAction') !== 'view') {        return;    }    if (!mw.config.get('wgIsMainPage')) {        return;    }    var timecorrection = mw.user.options.get('timecorrection');    if (timecorrection) {        timecorrection = timecorrection.split('|')[1];    } else {        timecorrection = -(new Date.getTimezoneOffset);    }    timecorrection = parseInt(timecorrection);    if (timecorrection > 0) {        timecorrection = '+' + timecorrection;    } else if (timecorrection == 0) {        return;    }    var content = $('#mw-content-text', mw.util.$content);    var text = '';    // content.text(text);    $.post( mw.util.wikiScript('api'), {           'action': 'parse', 'title': mw.config.get('wgPageName'), 'text': text, 'prop': 'text', 'disablepp': '', 'format': 'json' },       function(data) { content.html(data.parse.text['*']); }   ); }); }); })(jQuery, mediaWiki);