Template:CheckboxWithTimestamp: Difference between revisions

From Hidden Mickey Wiki

(Created page with "<div class="checkbox-with-timestamp"> <input type="checkbox" onclick="setTimestamp(this)" /> <span class="timestamp-box" style="border:1px solid #ccc; padding:2px 6px; margin-left:8px; min-width:120px; display:inline-block;"></span> </div> <script> function setTimestamp(checkbox) { const box = checkbox.nextElementSibling; if (checkbox.checked) { const now = new Date(); const timestamp = now.toLocaleString(); // local date + time box.textContent = tim...")
 
No edit summary
Line 1: Line 1:
<div class="checkbox-with-timestamp">
| {{{land}}}
   <input type="checkbox" onclick="setTimestamp(this)" />
| {{{attr}}}
   <span class="timestamp-box" style="border:1px solid #ccc; padding:2px 6px; margin-left:8px; min-width:120px; display:inline-block;"></span>
| style="text-align: center;" |
</div>
   <htmltag tagname="input" type="checkbox" id="{{{id}}}" class="timestamp-checkbox"></htmltag>
 
   <span id="{{{id}}}-ts" class="timestamp-box"></span>
<script>
| [[{{{url}}}#{{{id}}}|{{{descr}}}]]
function setTimestamp(checkbox) {
|-
  const box = checkbox.nextElementSibling;
  if (checkbox.checked) {
    const now = new Date();
    const timestamp = now.toLocaleString(); // local date + time
    box.textContent = timestamp;
  } else {
    box.textContent = "";
  }
}
</script>

Revision as of 13:48, 29 September 2025

| {{{land}}} | {{{attr}}} | style="text-align: center;" |

 
 

| [[{{{url}}}#{{{id}}}|{{{descr}}}]] |-