Difference between revisions of "MediaWiki:Common.js"

From Beyond Social
Line 10: Line 10:
 
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'); // TODO: make specific for articles NOT issues
 
var checkboxesSpan =$('.checkboxesSpan'); // TODO: make specific for articles NOT issues
 +
 +
        $('.checkboxSwitches').css('display','none');
  
 
$(document).ready(
 
$(document).ready(
Line 15: Line 17:
 
         allarticles.css('display','none');
 
         allarticles.css('display','none');
 
         $('td').css('vertical-align', 'top');
 
         $('td').css('vertical-align', 'top');
        $('.checkboxSwitches').css('display','none');
+
 
 
      
 
      
 
     }
 
     }

Revision as of 17:38, 19 December 2016

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




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

        $('.checkboxSwitches').css('display','none');

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

    
    }
)


//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');
        }
    } )
}