Difference between revisions of "MediaWiki:Common.js"
From Game Detectives Wiki
Line 1: | Line 1: | ||
− | + | $(function () { | |
− | for( | + | var cnt = 0; |
+ | |||
+ | for(var n = 1; n < 100; n++) { | ||
if(document.getElementById('tableRow' + n)) { | if(document.getElementById('tableRow' + n)) { | ||
− | + | var row = document.getElementById('tableRow' + n); | |
row.addEventListener('click', function(){ | row.addEventListener('click', function(){ | ||
console.log('working'); | console.log('working'); | ||
− | + | var dialog = 'dialog' + n; | |
$( function() { | $( function() { | ||
$( '#' + dialog ).dialog(); | $( '#' + dialog ).dialog(); | ||
} ); | } ); | ||
}); | }); | ||
+ | |||
+ | var 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; | ||
+ | } | ||
+ | } | ||
+ | }()); |
Revision as of 00:12, 15 August 2018
$(function () { var cnt = 0; for(var n = 1; n < 100; n++) { if(document.getElementById('tableRow' + n)) { var row = document.getElementById('tableRow' + n); row.addEventListener('click', function(){ console.log('working'); var dialog = 'dialog' + n; $( function() { $( '#' + dialog ).dialog(); } ); }); var 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; } } }());