|
|
| Line 18: |
Line 18: |
|
| |
|
| <div id="mw-debug-msg" style="color:red; font-weight:bold;"></div> | | <div id="mw-debug-msg" style="color:red; font-weight:bold;"></div> |
|
| |
| <htmltag tagname="script"><![CDATA[
| |
| (function () {
| |
| 'use strict';
| |
|
| |
| // Debug start
| |
| console.log("✅ Timestamp script loaded");
| |
| var dbg = document.getElementById("mw-debug-msg");
| |
| if (dbg) dbg.textContent = "✅ Timestamp script loaded (check console for details)";
| |
|
| |
| function formatTime(d) {
| |
| return d.toLocaleTimeString('en-US', {
| |
| hour: 'numeric',
| |
| minute: '2-digit',
| |
| second: '2-digit'
| |
| });
| |
| }
| |
|
| |
| function findTsBox(cb) {
| |
| var tr = cb.closest('tr');
| |
| return tr ? tr.querySelector('.mw-ts-box') : null;
| |
| }
| |
|
| |
| document.addEventListener('change', function (ev) {
| |
| var cb = ev.target;
| |
| if (cb.matches && cb.matches('.mw-checkbox-ts')) {
| |
| console.log("Checkbox toggled:", cb, "Checked?", cb.checked);
| |
| var tsBox = findTsBox(cb);
| |
| if (tsBox) {
| |
| tsBox.textContent = cb.checked ? formatTime(new Date()) : '';
| |
| }
| |
| }
| |
| }, false);
| |
| })();
| |
| ]]></htmltag>
| |