MediaWiki:Common.js

From Beyond Social
Revision as of 19:42, 9 February 2017 by Andre (talk | contribs) (Undo revision 8649 by Andre (talk))

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for all users on every page load. */



/* for edit pages */

if ( (mw.config.get('wgAction')).indexOf('edit') !== -1 ){  

$(document).ready(
function(){
//hide BS from categories list
$('a[title=\"Category\:BS\"]').parent().css('display','none', 'important');   
$('[title*="page does not exist"]').parent().css('display','none', 'important');
})

}

/* for Editorial_selection Form */

if ( (mw.config.get('wgPageName') ).indexOf('Special:FormEdit/Editorial_selection/') !== -1 ){  

var allarticles = $('label[class*=issue_]'); //label elements with class contains issue_*
var checkboxesSpan =$('.checkboxesSpan'); // TODO: make specific for articles NOT issues



$(document).ready(
    function(){
        allarticles.css('display','none');
        $('td').css('vertical-align', 'top');
        $('.checkboxSwitches').css('color','red', 'important');
    }
)


//get issue check boxes
var issueboxes = $('input.createboxInput[value*="Issue"]');
var clickedbox ;
var checked;
var boxval

issueboxes.click(
    function(){
        console.log('click');
        clickedbox = $(this);
        checked = clickedbox.prop('checked');
        issuenum = clickedbox.val();
        var issue_articles = $('label[class*=issue_'+ ( issuenum.replace('Issue_','')) +']');

        if (checked == true){
            issue_articles.css('display','block');
        }else {
            $('.issue_' + (issuenum.replace('Issue_','')) + ' > input.createboxInput').prop('checked',false);  // parent .issue_2
            issue_articles.css('display','none');
        }
    } )

}