MediaWiki:Common.js: Difference between revisions

From Bose Portable PA Encyclopedia
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */


$(document).ready(function () {
/* Expand/Collapse all for FAQList */
mw.hook('wikipage.content').add(function ($content) {


     console.log("UserName =" + mw.config.get('wgUserName')) ;
     // Expand all
    console.log(jQuery.inArray("sysop", mw.config.get('wgUserGroups')));
    $content.on('click', '.faq-expand-all', function () {
    console.log(jQuery.inArray("sysop", mw.config.get('wgUserGroups') ) == -1 );
        $('.faq-list details').attr('open', true);
 
    });
//if (mw.config.get('wgUserName') != "ST") {
 
if (jQuery.inArray("sysop", mw.config.get('wgUserGroups') ) == -1 ) {


 
    // Collapse all
    //Disable cut copy paste
     $content.on('click', '.faq-collapse-all', function () {
     $('body').bind('cut copy paste', function (e) {
         $('.faq-list details').removeAttr('open');
         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')) ;


};


});
/* MediaWiki:Common.js - test if it's loading */
// alert("Common.js is running");

Latest revision as of 19:48, 10 February 2026

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

/* Expand/Collapse all for FAQList */
mw.hook('wikipage.content').add(function ($content) {

    // Expand all
    $content.on('click', '.faq-expand-all', function () {
        $('.faq-list details').attr('open', true);
    });

    // Collapse all
    $content.on('click', '.faq-collapse-all', function () {
        $('.faq-list details').removeAttr('open');
    });

});


/* MediaWiki:Common.js - test if it's loading */
// alert("Common.js is running");