Difference between revisions of "MediaWiki:Common.js"

From Game Detectives Wiki
Jump to: navigation, search
(testagain)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
+
$(function () {
  
/* main */
+
  let cnt = 0;
  
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(){
 +
        console.log("working");
 +
        let dialog = "dialog" + n;
 +
        $( function() {
 +
          $( "#" + dialog ).dialog();
 +
        } );
 +
      });
  
for(let n = 1; n < 100; n++) {
+
      let nameCol = document.getElementById("tableCol1-" + n).innerText;
  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>";
  
    row.innerHTML += "<div style=\"display:none\" id=\"dialog" + n + "\"" + " title=\"" + nameCol + "\"" + n + "\">" + "\n" +
+
       cnt = 0;
      "<p>Table Row {{argbox}} " + n + "</p>\n" +
+
    }
       "</div>";
+
    else {
 
+
      cnt++;
    cnt = 0;
+
    }
  }
+
    if(cnt > 1) {
  else {
+
      break;
    cnt++;
+
    }
  }
 
  if(cnt > 1) {
 
    break;
 
 
   }
 
   }
}
+
}());

Revision as of 22:41, 14 August 2018

$(function () {

  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(){
        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>";

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