/* A-LINE v2.0. Local-only printable checklist: no network, cookies or storage. */ (function (w,d) { 'use strict'; var fields=Array.prototype.slice.call(d.querySelectorAll('[data-print-field]')); function update(field){ var value=field.value.trim() || field.getAttribute('placeholder') || '\u672a\u78ba\u8a8d'; var target=field.nextElementSibling; if(target && target.classList.contains('print-value')) target.textContent=value; if(field.dataset.shared){ d.querySelectorAll('[data-mirror="'+field.dataset.shared+'"]').forEach(function(node){node.textContent=value;}); } } fields.forEach(function(field){ field.addEventListener('input',function(){update(field);}); field.addEventListener('change',function(){update(field);}); update(field); }); w.addEventListener('beforeprint',function(){fields.forEach(update);}); d.getElementById('print-sheet').addEventListener('click',function(){ fields.forEach(update); w.print(); }); d.getElementById('reset-sheet').addEventListener('click',function(){ fields.forEach(function(field){if(field.tagName==='SELECT')field.selectedIndex=0;else field.value='';update(field);}); d.getElementById('sheet-status').textContent='\u5165\u529b\u3092\u30ea\u30bb\u30c3\u30c8\u3057\u307e\u3057\u305f\u3002\u5370\u5237\u30fb\u4fdd\u5b58\u6e08\u307f\u306ePDF\u306f\u524a\u9664\u3055\u308c\u307e\u305b\u3093\u3002'; fields[0].focus(); }); })(window,document);