1/** 2 * Owner-only Moderation desktop icon â appears when logged in as puppy. 3 */ 4(function (global) { 5 'use strict'; 6 7 var OWNER_NAME = 'puppy'; 8 var STORAGE_KEY = 'puppy_shared_username'; 9 var lastOwnerState = null; 10 11 function isOwner() { 12 try { 13 var username = localStorage.getItem(STORAGE_KEY) || ''; 14 return username.trim().toLowerCase() === OWNER_NAME; 15 } catch (e) { 16 return false; 17 } 18 } 19 20 function refreshDesktopIconsIfNeeded() { 21 var owner = isOwner(); 22 if (lastOwnerState === owner) return; 23 lastOwnerState = owner; 24 if (global.CitrusDesktop && typeof global.CitrusDesktop.refreshDesktopIcons === 'function') { 25 global.CitrusDesktop.refreshDesktopIcons(); 26 } 27 } 28 29 function bindStorageWatch() { 30 global.addEventListener('storage', function (ev) { 31 if (ev.key === STORAGE_KEY) refreshDesktopIconsIfNeeded(); 32 }); 33 34 global.addEventListener('usernameSet', refreshDesktopIconsIfNeeded); 35 36 setInterval(refreshDesktopIconsIfNeeded, 4000); 37 } 38 39 function init() { 40 if (!document.body || !document.body.classList.contains('page-citrusos')) return; 41 lastOwnerState = isOwner(); 42 bindStorageWatch(); 43 } 44 45 if (document.readyState === 'loading') { 46 document.addEventListener('DOMContentLoaded', init); 47 } else { 48 init(); 49 } 50})(typeof window !== 'undefined' ? window : this);
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.