Difference between revisions of "MediaWiki:Common.js"

From ISLAB/CAISR
(Created page with "/* Any JavaScript here will be loaded for all users on every page load. */ hide certain page elements based on if user is logged in: if ( !mw.user.anonymous() ) { mw.uti...")
 
Line 2: Line 2:
  
 
/* hide certain page elements based on if user is logged in */
 
/* hide certain page elements based on if user is logged in */
if ( !mw.user.anonymous() ) {
+
if ( !mw.user.isAnon()) {
 
mw.util.addCSS( 'div.hidden_not_loggedin{display:inline!important; }' );
 
mw.util.addCSS( 'div.hidden_not_loggedin{display:inline!important; }' );
 
} else {
 
} else {

Revision as of 20:50, 11 March 2014

/* Any JavaScript here will be loaded for all users on every page load. */

/* hide certain page elements based on if user is logged in */
if ( !mw.user.isAnon()) {
mw.util.addCSS( 'div.hidden_not_loggedin{display:inline!important; }' );
} else {
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;}' );
}


/* redirect access to pages with internal in page name if user is not logged in */
/* in no way safe method to protect secret content */
if ( mw.user.anonymous() ) {
var str = mw.config.get( 'wgTitle' );
var patt1=/Internal/gi;
if (str.match(patt1)) {
document.location.href="http://islab.hh.se/mediawiki/";
}
}