Changes

m
no edit summary
Line 1: Line 1: −
  −
/**
  −
Filterable Function
  −
*/
  −
$(function() {
  −
    $(".showExtra").click(function() {
  −
    $(this).closest("table").find(".extraRow").fadeIn("slow");$(this).closest("tr").remove();
  −
    });
  −
    filterTable();
  −
});
  −
  −
// FilterTable
   
function filterTable(){
 
function filterTable(){
 
$("table.filterable").each(function(){
 
$("table.filterable").each(function(){
Line 61: Line 49:  
cond=Number(cond)+chg;
 
cond=Number(cond)+chg;
 
$(this).attr("condition", cond);
 
$(this).attr("condition", cond);
if (cond==0) $(this).show();
+
if (cond===0) $(this).show();
 
else $(this).hide();
 
else $(this).hide();
 
}
 
}
Line 95: Line 83:  
     /* if shown now */
 
     /* if shown now */
 
     if ( NavToggle.firstChild.data === NavigationBarHide ) {
 
     if ( NavToggle.firstChild.data === NavigationBarHide ) {
         for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
+
         for ( NavChild = NavFrame.firstChild; NavChild !== null; NavChild = NavChild.nextSibling ) {
 
             if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
 
             if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
 
                 NavChild.style.display = 'none';
 
                 NavChild.style.display = 'none';
Line 104: Line 92:  
     /* if hidden now */
 
     /* if hidden now */
 
     } else if ( NavToggle.firstChild.data === NavigationBarShow ) {
 
     } else if ( NavToggle.firstChild.data === NavigationBarShow ) {
         for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
+
         for ( NavChild = NavFrame.firstChild; NavChild !== null; NavChild = NavChild.nextSibling ) {
 
             if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
 
             if ( $( NavChild ).hasClass( 'NavContent' ) || $( NavChild ).hasClass( 'NavPic' ) ) {
 
                 NavChild.style.display = 'block';
 
                 NavChild.style.display = 'block';
Line 139: Line 127:  
             * "collapsed" to the NavFrame itself, just like with collapsible tables.
 
             * "collapsed" to the NavFrame itself, just like with collapsible tables.
 
             */
 
             */
             for ( NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling ) {
+
             for ( NavChild = NavFrame.firstChild; NavChild !== null && !isCollapsed; NavChild = NavChild.nextSibling ) {
 
                 if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
 
                 if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
 
                     if ( NavChild.style.display === 'none' ) {
 
                     if ( NavChild.style.display === 'none' ) {
Line 147: Line 135:  
             }
 
             }
 
             if ( isCollapsed ) {
 
             if ( isCollapsed ) {
                 for ( NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling ) {
+
                 for ( NavChild = NavFrame.firstChild; NavChild !== null; NavChild = NavChild.nextSibling ) {
 
                     if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
 
                     if ( $( NavChild ).hasClass( 'NavPic' ) || $( NavChild ).hasClass( 'NavContent' ) ) {
 
                         NavChild.style.display = 'none';
 
                         NavChild.style.display = 'none';
Line 188: Line 176:  
   
 
   
 
     this.check = function () {
 
     this.check = function () {
         if($table.size() == 0){
+
         if($table.size() === 0){
 
             return;
 
             return;
 
         }
 
         }
Line 213: Line 201:  
         this.check();
 
         this.check();
 
     };
 
     };
}
+
};
+
 
$(function () {
+
$(function() {
    //Set table
+
 
 +
// Table things
 +
 
 +
    $(".showExtra").click(function() {
 +
    $(this).closest("table").find(".extraRow").fadeIn("slow");$(this).closest("tr").remove();
 +
    });
 +
 
 +
    filterTable();
 +
 
 
     $('.fixtable').each(function(){
 
     $('.fixtable').each(function(){
 
     var tableHeadFix = new TableHeadFix();
 
     var tableHeadFix = new TableHeadFix();
 
     tableHeadFix.init(this);
 
     tableHeadFix.init(this);
 
     });
 
     });
 +
 +
    // Template:Map/ImageNode
 +
 +
    function supportTemplateMapImageNode() {
 +
    $('.map-node a').off('click');
 +
    $('.map-node a').click(function (e) {
 +
        e.preventDefault();
 +
    var $element = $($(this).attr('href'));
 +
    var $container = $element.parent();
 +
    $container.scrollTop($container.scrollTop() - $container.offset().top + $element.offset().top);
 +
    });
 +
}
 +
supportTemplateMapImageNode();
 +
mw.hook('wikipage.content').add(supportTemplateMapImageNode);
 +
 
});
 
});
  −
/*
  −
Provides JS functions to classes in Template:Map/ImageNode
  −
Author: gaka
  −
*/
  −
$(function () {
  −
  function supportTemplateMapImageNode() {
  −
    $('.map-node a').off('click')
  −
    $('.map-node a').click(function (e) {
  −
      e.preventDefault()
  −
      var $element = $($(this).attr('href'))
  −
      var $container = $element.parent()
  −
      $container.scrollTop($container.scrollTop() - $container.offset().top + $element.offset().top)
  −
    })
  −
  }
  −
  supportTemplateMapImageNode()
  −
  mw.hook('wikipage.content').add(supportTemplateMapImageNode)
  −
})
 
cssedit, gkautomate
6,928

edits