Sandbox: Difference between revisions

From Hidden Mickey Wiki

No edit summary
No edit summary
Line 1: Line 1:
<htmltag tagname="script" type="text/javascript">
<htmltag tagname="script" type="text/javascript">
(function() {
document.addEventListener('DOMContentLoaded', function() {
   // IDs to check
   console.log('Debug: JS script is running!'); // This confirms the JS is executing
  var ids = ['Sandbox1','Sandbox2','Sandbox3'];


   // Create a table
   // Optional visible confirmation on the page
   var table = document.createElement('table');
   var debugNotice = document.createElement('div');
   table.style.borderCollapse = 'collapse';
   debugNotice.innerText = 'Debug: JS script is running!';
   table.style.margin = '10px 0';
   debugNotice.style.color = 'red';
   table.style.width = '300px';
   debugNotice.style.fontWeight = 'bold';
    
   debugNotice.style.margin = '10px 0';
  // Table header
   document.body.appendChild(debugNotice);
  var header = table.insertRow();
  header.insertCell().innerText = 'ID';
   header.insertCell().innerText = 'Checkbox State';
  header.insertCell().innerText = 'Timestamp';
 
  // Style header
  for (var i=0;i<header.cells.length;i++) {
    header.cells[i].style.border = '1px solid black';
    header.cells[i].style.padding = '4px';
    header.cells[i].style.fontWeight = 'bold';
    header.cells[i].style.textAlign = 'center';
  }


   // Fill rows
   (function() {
  ids.forEach(function(id) {
     var ids = ['Sandbox1','Sandbox2','Sandbox3'];
     var row = table.insertRow();
 
    // Create table
    var table = document.createElement('table');
    table.style.borderCollapse = 'collapse';
    table.style.margin = '10px 0';
    table.style.width = '300px';
      
      
     // ID column
     // Table header
     var cellId = row.insertCell();
     var header = table.insertRow();
     cellId.innerText = id;
     ['ID','Checkbox State','Timestamp'].forEach(function(text) {
    cellId.style.border = '1px solid black';
      var th = document.createElement('th');
    cellId.style.padding = '4px';
      th.innerText = text;
   
      th.style.border = '1px solid black';
    // Checkbox column
      th.style.padding = '4px';
    var cellCheckbox = row.insertCell();
      th.style.textAlign = 'center';
    cellCheckbox.innerText = localStorage.getItem(id) || '(none)';
      th.style.fontWeight = 'bold';
    cellCheckbox.style.border = '1px solid black';
      header.appendChild(th);
    cellCheckbox.style.padding = '4px';
     });
    cellCheckbox.style.textAlign = 'center';
 
   
     // Fill rows
    // Timestamp column
     ids.forEach(function(id) {
    var cellTs = row.insertCell();
      var row = table.insertRow();
    cellTs.innerText = localStorage.getItem(id + '-ts') || '(none)';
     cellTs.style.border = '1px solid black';
     cellTs.style.padding = '4px';
     cellTs.style.textAlign = 'center';
  });


  // Append table to body
      // ID
  document.body.appendChild(table);
      var cellId = row.insertCell();
})();
      cellId.innerText = id;
</htmltag>

Revision as of 10:18, 1 October 2025

<htmltag tagname="script" type="text/javascript"> document.addEventListener('DOMContentLoaded', function() {

 console.log('Debug: JS script is running!'); // This confirms the JS is executing
 // Optional visible confirmation on the page
 var debugNotice = document.createElement('div');
 debugNotice.innerText = 'Debug: JS script is running!';
 debugNotice.style.color = 'red';
 debugNotice.style.fontWeight = 'bold';
 debugNotice.style.margin = '10px 0';
 document.body.appendChild(debugNotice);
 (function() {
   var ids = ['Sandbox1','Sandbox2','Sandbox3'];
   // Create table
   var table = document.createElement('table');
   table.style.borderCollapse = 'collapse';
   table.style.margin = '10px 0';
   table.style.width = '300px';
   
   // Table header
   var header = table.insertRow();
   ['ID','Checkbox State','Timestamp'].forEach(function(text) {
     var th = document.createElement('th');
     th.innerText = text;
     th.style.border = '1px solid black';
     th.style.padding = '4px';
     th.style.textAlign = 'center';
     th.style.fontWeight = 'bold';
     header.appendChild(th);
   });
   // Fill rows
   ids.forEach(function(id) {
     var row = table.insertRow();
     // ID
     var cellId = row.insertCell();
     cellId.innerText = id;