|
Tags: Blanking Manual revert |
| (41 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| {| class="wikitable"
| |
| ! Item
| |
| ! Done
| |
| ! Time
| |
| |-
| |
| | Example task 1
| |
| | <htmltag tagname="input" type="checkbox" class="mw-checkbox-ts"></htmltag>
| |
| | <span class="mw-ts-box"></span>
| |
| |-
| |
| | Example task 2
| |
| | <htmltag tagname="input" type="checkbox" class="mw-checkbox-ts"></htmltag>
| |
| | <span class="mw-ts-box"></span>
| |
| |-
| |
| | Example task 3
| |
| | <htmltag tagname="input" type="checkbox" class="mw-checkbox-ts"></htmltag>
| |
| | <span class="mw-ts-box"></span>
| |
| |}
| |
|
| |
|
| <script>
| |
| (function () {
| |
| 'use strict';
| |
|
| |
| 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')) {
| |
| var tsBox = findTsBox(cb);
| |
| if (tsBox) tsBox.textContent = cb.checked ? formatTime(new Date()) : '';
| |
| }
| |
| }, false);
| |
| })();
| |
| </script>
| |