Difference between revisions of "MediaWiki:Common.js"

From Beyond Social
Line 7: Line 7:
  
 
var allarticles = $('label[class*=issue_]'); //label elements with class contains issue_*
 
var allarticles = $('label[class*=issue_]'); //label elements with class contains issue_*
var checkboxesSpan =$('.checkboxesSpan');
+
var checkboxesSpan =$('.checkboxesSpan'); // TODO: make specific for articles NOT issues
  
 
$(document).ready(  
 
$(document).ready(  
 
function(){  
 
function(){  
checkboxesSpan.css('display','none'); //hide on load
+
// checkboxesSpan.css('display','none'); //hide on load
 
allarticles.css('display','none');
 
allarticles.css('display','none');
 
}
 
}
Line 31: Line 31:
 
checked = clickedbox.prop('checked');
 
checked = clickedbox.prop('checked');
 
boxval = clickedbox.val();
 
boxval = clickedbox.val();
 +
 +
var issue_articles = $('label[class*=issue_'+ boxval +']');
  
 
console.log( clickedbox, checked, boxval );
 
console.log( clickedbox, checked, boxval );
 
+
console.log('Addressing', issue_articles);
 
// if checked == true -> show articles within baxval category
 
// if checked == true -> show articles within baxval category
 
// if checked == false -> hide articles within baxval category
 
// if checked == false -> hide articles within baxval category

Revision as of 15:49, 17 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 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 +']');

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

}
)