PageSourceSearch

https://s.gamblergames.com/sphere/v/2026-10-09/js/mods/hint.js

js gamblergames.com collected 2026-10-09 23:23:39 UTC 4,761 bytes, 6 lines download raw bytes

1window.JSBUILD='2026-10-08 21:45';Promise.withResolvers??=function(){let a,b;return{promise:new Promise((x,y)=>{a=x,b=y}),resolve:a,reject:b}};
2import{a}from"../chunk-HI4LWL6W.js";cssInject("hint");var f=new Map,b,w,g,c=!LOCALTEST&&typeof indexedDB<"u"&&indexedDB.open("hints",3);function s(){w=!0,g&&delay(window.hint.update)}a(s,"dbLoaded");c?(c.onsuccess=()=>{b=c.result,y()},c.onupgradeneeded=e=>{let t=e.target.result;if(t.onerror=()=>{window.log?.("hints:db: error creating db hints"),s()},e.oldVersion>0)try{t.deleteObjectStore("hints")}catch{}try{t.createObjectStore("hints",{keyPath:["id"]})}catch(n){window.log?.("hints:db: error while upgrading table hints "+JSON.stringify(n)),s()}}):s();function y(){let e;try{e=b.transaction("hints","readonly",{durability:"relaxed"}).objectStore("hints")}catch{window.log?.("hints:db: failed to load local hints");return}let t=e.getAll();t.onerror=()=>{window.log?.("hints:db: getAll failed"),s()},t.onsuccess=n=>{for(let i of n.target.result)f.set(i.id,i);fire("hintsloaded"),s()}}a(y,"dbLoad");function u(e){UIN&&b?.transaction("hints","readwrite").objectStore("hints").put({id:`${UIN}_${e.id}`,next:e.next})}a(u,"storeHintDB");var l=class e{static{a(this,"Hint")}static#t=new Map;static#n=[];static#e={};static#i;static#o;static clear(){e.#n=[],e.#e={},e.#i=null}static loggedout(){e.#t.clear()}static update(t){if(!w){g||log("hints: update before db completed"),g=!0;return}e.#o!==t&&(e.#o=t,e.clear(),fire("fillhints",e),e.show())}static gotit(t){t.element?.hide(),t.next="done",u(t),e.update()}static async showBig(t,n){if(typeof t=="string"&&(t=e.#t.get(t)),!t||n&&t.showed)return;log("hint: show big "+t.biginfo);let i=makeBigWindow({repeatid:"bighint",title:"💡 "+(t.text||t.title||"{Information}"),html:`<PRE style='overflow-y: auto; padding: 0 1em; margin: 0'>${t.biginfo||""}</PRE>
3					<button class='default importantsize' data-closeselect='gotit' style='margin-top: 1rem'>${t.button?.text||"{Gotit}"}</button>`});if(t.showed=!0,t.type==="click"&&e.gotit(t),t.next==="done"){i.show();return}if(await i.promiseShow()==="gotit"){if(t.button?.action){t.button.action();return}e.gotit(t)}}static showOne(t,n){let i=$("#hint_"+t.id);if(!i){let o=t.button?"":"💡 ",r=`<div id='hint_${t.id}' style='order: ${t.order}' class='display_none hint flexline wrapinportrait' data-hint='${t.id}'>
4			<span style='white-space: initial; flex-shrink: 10'>${o}${t.text||t.title}</span>`;if(t.biginfo){let d=t.action?`data-popupinfo='${t.biginfo}'`:"";r+=`<span class='flexline control details' style='border-bottom: 1px dashed; margin: 0 0.5em' ${d}>${t.details||"{Details}"}</span>`}if(t.button){let d="";if(t.button.data)for(let p in t.button.data)d+=` data-${p}='${t.button.data[p]}'`;r+=`<button class='flexline' ${d}>${t.button.text}</button>`,n!==!1&&(r+=`<span style='flex-grow: 1'></span>
5					<span data-hideclosest='.hint' class='w32 icon closebutton control' 
6						style=''></span></div>`)}else t.biginfo||(r+="<button class='flexline'>{Gotit}</button>");i=html(r,e.holder),i.onHide=e.onHideHint,i.onclick=e.onClick,t.element=i}i.show()}static async onClick(t){let n=t.target.closest("[data-hint]"),i=e.#t.get(n.dataset.hint);if(i){if(t.target.classList.contains("details")){e.showBig(i);return}t.target.tagName==="BUTTON"&&i.button?.action&&i.button.action()}}static async show(){let t=e.#e.big;if(t&&!t.showed&&!$(".bigwindow.visible"))return e.showBig(t);if(e.holder||=document.querySelector("#hints"),!e.holder)return;let n=new Set;e.holder.innerHTML="";for(let[i,o]of e.#t)o.element=null;for(let i of["big","action","hint"]){let o=e.#e[i];if(o){if(e.showOne(o),n.add(o),i==="big")break;break}}!n.size&&e.#i&&e.showOne(e.#i,!1)}static check(t){!t?.id||e.#t.get(t.id)||e.add(t)}static add(t){if(!t?.id)return;let n=t.id,i=e.#t.get(n);if(i||(i={...f.get(`${UIN}_${n}`),...t},e.#t.set(n,i)),i.text=t.text,i.title=t.title,i.biginfo=t.biginfo,i.next==="done"||(!e.#i&&i.keeplast&&(this.#i=i),+i.next>Date.now()))return;i.order=k[i.priority]||+i.priority||0,i.frequency&&(i.interval=m(i.frequency));let o=i.type||(i.button?"action":"hint");e.#e[o]?.order<=i.order||(e.#e[o]=i,e.#n.push(i))}static onHideHint(t,n){if(!t)return;let i=n.id?.replace("hint_","")||n.dataset.hint,o=e.#t.get(i);
6o&&(o.next=Date.now()+(o.interval||h),u(o),window.hint.update())}static isDone(t){return e.#t.get(t)?.next==="done"||f.get(`${UIN}_${t}`)?.next==="done"}static done(t){if(!t)return;let n=e.#t.get(t);n&&(n.next="done"),u({id:t,next:"done"})}},x={s:1,m:60,h:60*60,d:60*60*24};function m(e){if(e==="day")return h;let t=/^(\d)(.)$/.exec(e);return t&&+t[1]*x[t[2]]*1e3||0}a(m,"getmsbyperiod");var h=60*60*24*1e3,k={high:-100,normal:0,low:100};window.hint=l;var S=l;dispatch("loggedout",l.loggedout);export{S as default};

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.