1/* 2 * sk-free-ordbog-gate.js â SITE-OWNED (free/public Skrivsikkert deployment). 3 * 4 * "Din ordbog" (the learning-words panel, .ss-learn-entry) needs an account: 5 * learned words are saved per user, and the public deployment has no user to 6 * save them to. The entry is VISIBLE (app parity, user decision 20/8 â it was 7 * previously display:none'd) but a click shows the calm login gate instead of 8 * opening a panel whose data can never load. 9 * 10 * Same pattern as sk-tone-byot-gate.js: CAPTURE-phase document listener beats 11 * the bundle's own data-learn-entry delegation; bundle untouched, no rebuild. 12 * Styles: /assets/css/ss-tpl-login-gate.css (.ss-tpl-login-gate family). 13 */ 14(function () { 15 'use strict'; 16 if (window.__skFreeOrdbogGate) return; 17 window.__skFreeOrdbogGate = true; 18 19 function needsGate() { 20 if (window.__SS_PUBLIC_MODE) return true; 21 try { 22 return !(window.currentUser && window.currentUser.id); 23 } catch (e) { 24 return true; 25 } 26 } 27 28 var LOGIN_URL = 'https://app.skrivsikkert.dk/'; 29 var GATE_ID = 'ordbog-login-gate'; 30 var TITLE_ID = 'ordbog-login-gate-title'; 31 32 // [title, body, login, dismiss] per UI language â same shape as the BYOT gate. 33 // 20/8: the popup itself is now the UNIVERSAL login gate 34 // (assets/js/ss-public-login-gate.js) â one calm, recognizable message 35 // everywhere. This module keeps only the trigger interception; the old 36 // anchored card, its i18n strings and close handling are retired. 37 function openGate(btn) { 38 if (window.SSPublicLoginGate && typeof window.SSPublicLoginGate.show === 'function') { 39 window.SSPublicLoginGate.show({ trigger: btn || null, source: 'skrivebord-ordbog' }); 40 } else { 41 window.location.href = LOGIN_URL; 42 } 43 } 44 45 // Capture + stop: the bundle's data-learn-entry delegation must never open 46 // the real panel for a visitor without an account. 47 document.addEventListener('click', function (e) { 48 var btn = e.target && e.target.closest ? e.target.closest('.ss-learn-entry, [data-learn-entry]') : null; 49 if (!btn) return; 50 if (!needsGate()) return; 51 e.preventDefault(); 52 e.stopPropagation(); 53 if (e.stopImmediatePropagation) e.stopImmediatePropagation(); 54 openGate(btn); 55 }, true); 56})();
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.