Difference between revisions of "MediaWiki:Common.js"

From Game Detectives Wiki
Jump to: navigation, search
Line 1: Line 1:
$(function () {
+
$(function(){
   let count = 0;
+
   let count=0;
   for(let n = 1; n < 100; n++) {
+
   for(let n=1; n<100; n++) {
 
     if(document.getElementById("tableRow" + n)) {
 
     if(document.getElementById("tableRow" + n)) {
 
       let row = document.getElementById("tableRow" + n);
 
       let row = document.getElementById("tableRow" + n);
Line 8: Line 8:
 
         let dialog = "dialog" + n;
 
         let dialog = "dialog" + n;
 
         $( function() {
 
         $( function() {
           $( "#" + dialog ).dialog();
+
           $("#" + dialog).dialog();
 
         } );
 
         } );
 
       });
 
       });
Line 18: Line 18:
 
       count++;
 
       count++;
 
     }
 
     }
     if(count > 0) {
+
     if(count>0) {
 
       break;
 
       break;
 
     }
 
     }
 
   }
 
   }
 
}());
 
}());

Revision as of 23:33, 14 August 2018

$(function(){
  let count=0;
  for(let n=1; n<100; n++) {
    if(document.getElementById("tableRow" + n)) {
      let row = document.getElementById("tableRow" + n);
      row.addEventListener("click", function(){
        console.log("working");
        let dialog = "dialog" + n;
        $( function() {
          $("#" + dialog).dialog();
        } );
      });
      let nameCol = document.getElementById("tableCol1-" + n).innerText;
      row.innerHTML += "<div style=\"display:none\" id=\"dialog" + n + "\"" + " title=\"" + nameCol + "\"" + n + "\">" + "\n" + "<p>Table Row {{argbox}} " + n + "</p>\n" + "</div>";
      count = 0;
    }
    else {
      count++;
    }
    if(count>0) {
      break;
    }
  }
}());