MediaWiki:Common.js

From Beyond Social
Revision as of 14:55, 17 December 2016 by Andre (talk | contribs)

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 Editorial_selection Form */

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

$(document).ready( 
function(){ 
// checkboxesSpan.css('display','none'); //hide on load
allarticles.css('display','none');
}
)


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


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

if (checked == true){
issue_articles.css('display','block');
}else {
issue_articles.css('display','none');
clickedbox.prop('checked','false');// unselect boxes
}


console.log( clickedbox, checked, boxval );
console.log('Addressing', issue_articles);

// if checked == true -> show articles within baxval category
// if checked == false -> hide articles within baxval category

}
)