Difference between revisions of "MediaWiki:Common.js"
From ISLAB/CAISR
(9 intermediate revisions by one user not shown) | |||
Line 5: | Line 5: | ||
jQuery(function($){ | jQuery(function($){ | ||
console.info("all"); //gives an info message with an 'i' in front of the message | console.info("all"); //gives an info message with an 'i' in front of the message | ||
− | if ( mw. | + | console.info(mw.config.get( 'wgUserId' )); //gives an info message with an 'i' in front of the message |
+ | |||
+ | if ( mw.config.get( 'wgUserId' ) == null) { | ||
var str = mw.config.get( 'wgTitle' ); | var str = mw.config.get( 'wgTitle' ); | ||
var patt1=/Internal/gi; | var patt1=/Internal/gi; | ||
console.info("anon"); //gives an info message with an 'i' in front of the message | console.info("anon"); //gives an info message with an 'i' in front of the message | ||
if (str.match(patt1)) { | if (str.match(patt1)) { | ||
− | + | document.location.href="http://islab.hh.se/mediawiki/"; | |
console.info("anon+internal"); //gives an info message with an 'i' in front of the message | console.info("anon+internal"); //gives an info message with an 'i' in front of the message | ||
$jq(window).attr("location","http://islab.hh.se/mediawiki/"); | $jq(window).attr("location","http://islab.hh.se/mediawiki/"); | ||
+ | var url = "http://islab.hh.se/mediawiki/"; | ||
+ | $(location).attr('href',url); | ||
} | } | ||
mw.util.addCSS( 'div.hidden_not_loggedin{display:none!important; }' ); | mw.util.addCSS( 'div.hidden_not_loggedin{display:none!important; }' ); |
Latest revision as of 09:24, 5 June 2014
/* Any JavaScript here will be loaded for all users on every page load. */ jQuery(function($){ console.info("all"); //gives an info message with an 'i' in front of the message console.info(mw.config.get( 'wgUserId' )); //gives an info message with an 'i' in front of the message if ( mw.config.get( 'wgUserId' ) == null) { var str = mw.config.get( 'wgTitle' ); var patt1=/Internal/gi; console.info("anon"); //gives an info message with an 'i' in front of the message if (str.match(patt1)) { document.location.href="http://islab.hh.se/mediawiki/"; console.info("anon+internal"); //gives an info message with an 'i' in front of the message $jq(window).attr("location","http://islab.hh.se/mediawiki/"); var url = "http://islab.hh.se/mediawiki/"; $(location).attr('href',url); } mw.util.addCSS( 'div.hidden_not_loggedin{display:none!important; }' ); mw.util.addCSS( '#p-tb { display: none!important; }' ); mw.util.addCSS( '#contentSub { display: none!important; }' ); mw.util.addCSS( '#ca-protect{ display:none!important; }' ); mw.util.addCSS( '#ca-watch{ display:none!important; }' ); mw.util.addCSS( '#ca-purge{ display:none!important; }' ); mw.util.addCSS( '#ca-history{ display:none!important; }' ); mw.util.addCSS( '#ca-delete{ display:none!important; }' ); mw.util.addCSS( '#ca-move{ display:none!important; }' ); mw.util.addCSS( '#ca-edit{ display:none!important; }' ); mw.util.addCSS( '#ca-talk{ display:none!important; }' ); mw.util.addCSS( '#ca-nstab-main{ display:none!important; }' ); mw.util.addCSS( '.editsection{ display:none!important; }' ); mw.util.addCSS( 'div#footer{ display:none!important; }' ); mw.util.addCSS( '#p-Internal { display: none!important; }' ); mw.util.addCSS( '#ca-viewsource { display: none!important;}' ); mw.util.addCSS( '#ca-form_edit { display: none!important;}' ); mw.util.addCSS( '#jump-to-nav { display: none!important;}' ); mw.util.addCSS( '#mw-editsection-bracket { display: none!important;}' ); mw.util.addCSS( '.printfooter { display: none!important;}' ); mw.util.addCSS( '.mw-jump { display: none!important;}' ); } } );