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