1/** 2 * Persist language choice from JP/EN toggle (sessionStorage). 3 */ 4(function () { 5 var STORAGE_KEY = 'futsutsuka_lang'; 6 7 function resolveLang(link) { 8 var lang = link.getAttribute('data-futsutsuka-lang'); 9 if (lang === 'ja' || lang === 'en') { 10 return lang; 11 } 12 var label = (link.textContent || '').replace(/\s+/g, '').trim().toUpperCase(); 13 if (label === 'EN') { 14 return 'en'; 15 } 16 if (label === 'JP' || label === 'JA') { 17 return 'ja'; 18 } 19 var href = link.getAttribute('href') || ''; 20 if (/\/en\/?$|\/en\/|\/en\.html/i.test(href)) { 21 return 'en'; 22 } 23 return 'ja'; 24 } 25 26 document.addEventListener('click', function (e) { 27 var link = e.target.closest('.header__langLink'); 28 if (!link) { 29 return; 30 } 31 var lang = resolveLang(link); 32 try { 33 sessionStorage.setItem(STORAGE_KEY, lang); 34 } catch (err) {} 35 }, true); 36})();
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.