Difference between revisions of "MediaWiki:Common.js"

From Game Detectives Wiki
Jump to: navigation, search
(matty table test)
(remove console logs)
Line 9: Line 9:
 
     let row = document.getElementById("tableRow" + n);
 
     let row = document.getElementById("tableRow" + n);
 
     row.addEventListener("click", function(){
 
     row.addEventListener("click", function(){
      console.log("function working.");
 
 
       let dialog = "dialog" + n;
 
       let dialog = "dialog" + n;
 
       $( function() {
 
       $( function() {
Line 23: Line 22:
  
 
     cnt = 0;
 
     cnt = 0;
    console.log(n);
 
 
   }
 
   }
 
   else {
 
   else {
 
     cnt++;
 
     cnt++;
    console.log(cnt);
 
 
   }
 
   }
 
   if(cnt > 1) {
 
   if(cnt > 1) {

Revision as of 22:28, 14 August 2018

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

/* main */

let cnt = 0;

for(let n = 1; n < 100; n++) {
  if(document.getElementById("tableRow" + n)) {
    let row = document.getElementById("tableRow" + n);
    row.addEventListener("click", function(){
      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>";

    cnt = 0;
  }
  else {
    cnt++;
  }
  if(cnt > 1) {
    break;
  }
}