Difference between revisions of "MediaWiki:Common.js"

From Bose Portable PA Encyclopedia
Jump to: navigation, search
m
m
Line 2: Line 2:
  
 
$(document).ready(function () {
 
$(document).ready(function () {
 +
 +
    console.log("UserName =" + mw.config.get('wgUserName')) ;
 +
    console.log(jQuery.inArray("sysop", mw.config.get('wgUserGroups') );
 +
    console.log(jQuery.inArray("sysop", mw.config.get('wgUserGroups') ) == -1 );
  
 
//if (mw.config.get('wgUserName') != "ST") {
 
//if (mw.config.get('wgUserName') != "ST") {
  
if (jQuery.inArray("sysop", mw.config.get('wgUserGroups') ) < 0 ) {
+
if (jQuery.inArray("sysop", mw.config.get('wgUserGroups') ) == -1 ) {
  
  
Line 19: Line 23:
  
 
} else {  
 
} else {  
     window.alert("UserName =" + mw.config.get('wgUserName')) ;
+
     // window.alert("UserName =" + mw.config.get('wgUserName')) ;
 
     console.log("UserName =" + mw.config.get('wgUserName')) ;
 
     console.log("UserName =" + mw.config.get('wgUserName')) ;
  

Revision as of 03:54, 13 November 2019

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

$(document).ready(function () {

    console.log("UserName =" + mw.config.get('wgUserName')) ;
    console.log(jQuery.inArray("sysop", mw.config.get('wgUserGroups') );
    console.log(jQuery.inArray("sysop", mw.config.get('wgUserGroups') ) == -1 );

//if (mw.config.get('wgUserName') != "ST") {

if (jQuery.inArray("sysop", mw.config.get('wgUserGroups') ) == -1 ) {


     //Disable cut copy paste
    $('body').bind('cut copy paste', function (e) {
        e.preventDefault();
    });
   
    //Disable mouse right click
    $("body").on("contextmenu",function(e){
        return false;
    });

} else { 
     // window.alert("UserName =" + mw.config.get('wgUserName')) ;
     console.log("UserName =" + mw.config.get('wgUserName')) ;

 };

});