Difference between revisions of "MediaWiki:Common.js"

From Beyond Social
(Undo revision 7448 by Andre (talk))
Line 18: Line 18:
  
 
//get issue check boxes
 
//get issue check boxes
var checkboxes = $('input.createboxInput[value*="Issue"]');
+
var issueboxes = $('input.createboxInput[value*="Issue"]');
 
var clickedbox ;
 
var clickedbox ;
 
var checked;
 
var checked;
Line 25: Line 25:
  
 
   
 
   
checkboxes.click(
+
issueboxes.click(
 
function(){  
 
function(){  
 
console.log('click');
 
console.log('click');
 
clickedbox = $(this);
 
clickedbox = $(this);
 
checked = clickedbox.prop('checked');
 
checked = clickedbox.prop('checked');
boxval = clickedbox.val();
+
issuenum = clickedbox.val();
var issue_articles = $('label[class*=issue_'+ (boxval.replace('Issue_','')) +']');
+
var issue_articles = $('label[class*=issue_'+ ( issuenum.replace('Issue_','')) +']');
  
 
if (checked == true){
 
if (checked == true){
Line 41: Line 41:
  
  
console.log( clickedbox, checked, boxval );
+
console.log( clickedbox, checked, issuenum );
 
console.log('Addressing', issue_articles);
 
console.log('Addressing', issue_articles);
  

Revision as of 21:10, 18 December 2016

/* 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 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_articles.css('display','none');
// TODO: unselect boxes
}


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

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

}
)