1/* ì ì íì´ì§ 본문ì ì´ë¯¸ì§ íë 보기. 2 ë ê±°ì 본문ì onclick="image_popup('...')" ì´ ë¨ì ìì´(ì°í íì´ì§) ê°ì ì´ë¦ì¼ë¡ ë ¸ì¶íë¤. 3 본문 ë´ ì´ë¯¸ì§ë í´ë¦ë§ì¼ë¡ë ì´ë¦¬ëë¡ í¨ê» ì²ë¦¬. */ 4(function () { 5 var box = null, img = null; 6 7 function build() { 8 if (box) return; 9 box = document.createElement('div'); 10 box.className = 'lightbox'; 11 box.innerHTML = 12 '<button class="lb-btn lb-close" type="button" aria-label="ë«ê¸°">â</button>' + 13 '<figure class="lb-stage"><img class="lb-img" alt=""></figure>'; 14 img = box.querySelector('.lb-img'); 15 16 box.addEventListener('click', function (e) { if (e.target === box || e.target.closest('.lb-close')) close(); }); 17 document.addEventListener('keydown', function (e) { if (e.key === 'Escape') close(); }); 18 document.body.appendChild(box); 19 } 20 21 function close() { 22 if (!box) return; 23 box.classList.remove('on'); 24 document.body.style.overflow = ''; 25 } 26 27 window.image_popup = function (url) { 28 if (!url) return; 29 build(); 30 img.src = url; 31 box.classList.add('on'); 32 document.body.style.overflow = 'hidden'; 33 }; 34 35 /* ë ê±°ì íë ì íì´ ê³ ì ë ê²ì´ ë§ì ì¢ì íë©´ìì íì´ì§ë¥¼ ë°ì´ë¸ë¤. 36 ë°ê¹¥ íë§ ê°ë¡ ì¤í¬ë¡¤ ììë¡ ê°ì¸ 본문 í ììì ì¤í¬ë¡¤ëê² íë¤. */ 37 document.addEventListener('DOMContentLoaded', function () { 38 document.querySelectorAll('.page-body table').forEach(function (t) { 39 if (t.parentElement.closest('table')) return; // ì¤ì²© íë ë°ê¹¥ ê²ë§ 40 if (t.parentElement.classList.contains('table-scroll')) return; 41 var wrap = document.createElement('div'); 42 wrap.className = 'table-scroll'; 43 t.parentElement.insertBefore(wrap, t); 44 wrap.appendChild(t); 45 }); 46 }); 47 48 document.addEventListener('DOMContentLoaded', function () { 49 document.querySelectorAll('.page-body img').forEach(function (el) { 50 if (el.closest('a')) return; // ì´ë¯¸ ë§í¬ê° 걸린 ì´ë¯¸ì§ë ê·¸ëë¡ 51 if (el.hasAttribute('data-nozoom')) return; // ìë³¸ì´ ìì íëí´ë ì»ì ê²ì´ ìë ì¬ì§ 52 if (el.naturalWidth && el.naturalWidth < 200) return; 53 el.style.cursor = 'zoom-in'; 54 if (el.hasAttribute('onclick')) return; // ë ê±°ì onclick ì´ ìì¼ë©´ ì¤ë³µ ë°©ì§ 55 el.addEventListener('click', function () { window.image_popup(el.currentSrc || el.src); }); 56 }); 57 }); 58 59 /* ë³µì¬ ë²í¼ â ì¤ìë 길ì 주ì, íì ìë´ì íìê³ì¢ì²ë¼ 60 "ìì¼ë¡ ì®ê²¨ ì 기 ë²ê±°ë¡ì´ ê°" ìì ë¶ëë¤. 61 ìë map.js ìì ìë ê²ì [data-copy] ê³µíµ ì²ë¦¬ë¡ ì®ê²¼ë¤. */ 62 function legacyCopy(text) { 63 var ta = document.createElement('textarea'); 64 ta.value = text; ta.style.cssText = 'position:fixed;left:-9999px;top:0'; 65 document.body.appendChild(ta); ta.focus(); ta.select(); 66 var ok = false; 67 try { ok = document.execCommand('copy'); } catch (e) {} 68 ta.remove(); 69 return ok; 70 } 71 72 // ë²í¼ìì ê°ì¥ ê°ê¹ì´ ì¤ìê° ììì ì°¾ëë¤(ë§í¬ì ë§ë¤ ê°ì¸ë ê¹ì´ê° ë¬ë¼ 3ë¨ê³ê¹ì§ ê±°ì¬ë¬ 본ë¤) 73 function findStatus(btn) { 74 var n = btn.parentElement, i = 0; 75 while (n && i++ < 3) { 76 var s = n.querySelector('[role="status"]'); 77 if (s) return s; 78 n = n.parentElement; 79 } 80 return null; 81 } 82 83 document.addEventListener('DOMContentLoaded', function () { 84 document.querySelectorAll('[data-copy]').forEach(function (btn) { 85 var baseLabel = btn.textContent; // ìµì´ ë¼ë²¨ì í ë²ë§ ì¡ëë¤(ì°í ì ììë¼ë²¨ ì¤ì¼ ë°©ì§) 86 var statusBox = findStatus(btn); 87 var doneMsg = btn.dataset.copyMsg || 'ë³µì¬íìµëë¤.'; 88 var restoreTimer = null; 89 90 function flash(ok) { 91 if (restoreTimer) clearTimeout(restoreTimer); // ì´ì ë³µì ìì½ì ì·¨ìí´ ìíê° ì¼ì§ ìê² íë¤
92 btn.textContent = ok ? 'ë³µì¬ë¨' : 'ë³µì¬ ì¤í¨'; 93 btn.classList.toggle('done', ok); 94 if (statusBox) statusBox.textContent = ok ? doneMsg : 'ë³µì¬íì§ ëª»íìµëë¤.'; 95 restoreTimer = setTimeout(function () { 96 btn.textContent = baseLabel; 97 btn.classList.remove('done'); 98 if (statusBox) statusBox.textContent = ''; 99 }, 1500); 100 } 101 102 btn.addEventListener('click', function () { 103 var text = btn.dataset.copy || ''; 104 // clipboard API ê° ê±°ë¶ë¼ë execCommand ë¡ ë°ëì í´ë°±íë¤ 105 if (navigator.clipboard && navigator.clipboard.writeText) { 106 navigator.clipboard.writeText(text).then( 107 function () { flash(true); }, 108 function () { flash(legacyCopy(text)); } 109 ); 110 } else { 111 flash(legacyCopy(text)); 112 } 113 }); 114 }); 115 }); 116})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.