/
a19x9y7
/
SolarScrap2
Обзор
Документация
Войти
/
a19x9y7
/
SolarScrap2
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
scripts/main.js
23 строки
54 KB
a19x9y7
Create: new_file, c3main.js, c3runtime.js, dispatchworker.js, jobworker.js, main.js, modernjscheck.js, objRefTable.js, offlineclient.js, register-sw.js, supportcheck.js
20 июл 2026, 07:35
Верифицирован
20 июл 2026, 07:35
b8bac69
Код
Авторство
О чём код?
// Generated by Construct, the game and animation creation tool // Visit: https://www.construct.net // workers/domHandler.js "use strict";window.DOMHandler=class{constructor(t,i){this._iRuntime=t,this._componentId=i,this._hasTickCallback=!1,this._tickCallback=()=>this.Tick()}Attach(){}PostToRuntime(t,i,e,s){this._iRuntime.PostToRuntimeComponent(this._componentId,t,i,e,s)}PostToRuntimeAsync(t,i,e,s){return this._iRuntime.PostToRuntimeComponentAsync(this._componentId,t,i,e,s)}_PostToRuntimeMaybeSync(t,i,e){this._iRuntime.UsesWorker()?this.PostToRuntime(t,i,e):this._iRuntime._OnLocalRuntimeMessageFromDOM({"type":"event","component":this._componentId,"handler":t,"dispatchOpts":e||null,"data":i,"responseId":null})}AddRuntimeMessageHandler(t,i){this._iRuntime.AddRuntimeComponentMessageHandler(this._componentId,t,i)}AddRuntimeMessageHandlers(t){for(const[i,e]of t)this.AddRuntimeMessageHandler(i,e)}GetRuntimeInterface(){return this._iRuntime}GetComponentID(){return this._componentId}_StartTicking(){this._hasTickCallback||(this._iRuntime._AddRAFCallback(this._tickCallback),this._hasTickCallback=!0)}_StopTicking(){this._hasTickCallback&&(this._iRuntime._RemoveRAFCallback(this._tickCallback),this._hasTickCallback=!1)}Tick(){}},window.RateLimiter=class{constructor(t,i){this._callback=t,this._interval=i,this._timerId=-1,this._lastCallTime=-1/0,this._timerCallFunc=()=>this._OnTimer(),this._ignoreReset=!1,this._canRunImmediate=!1}SetCanRunImmediate(t){this._canRunImmediate=!!t}Call(){if(-1!==this._timerId)return;const t=Date.now(),i=t-this._lastCallTime,e=this._interval;i>=e&&this._canRunImmediate?(this._lastCallTime=t,this._RunCallback()):this._timerId=self.setTimeout(this._timerCallFunc,Math.max(e-i,4))}_RunCallback(){this._ignoreReset=!0,this._callback(),this._ignoreReset=!1}Reset(){this._ignoreReset||(this._CancelTimer(),this._lastCallTime=Date.now())}_OnTimer(){this._timerId=-1,this._lastCallTime=Date.now(),this._RunCallback()}_CancelTimer(){-1!==this._timerId&&(self.clearTimeout(this._timerId),this._timerId=-1)}Release(){this._CancelTimer(),this._callback=null,this._timerCallFunc=null}}; // workers/domElementHandler.js "use strict";{class e{constructor(e){this._elem=e,this._hadFirstUpdate=!1,this._isVisibleFlag=!0,this._wantHtmlIndex=-1,this._actualHtmlIndex=-1,this._htmlZIndex=-1}SetVisibleFlag(e){this._isVisibleFlag=!!e}GetVisibleFlag(){return this._isVisibleFlag}HadFirstUpdate(){return this._hadFirstUpdate}SetHadFirstUpdate(){this._hadFirstUpdate=!0}GetWantHTMLIndex(){return this._wantHtmlIndex}SetWantHTMLIndex(e){this._wantHtmlIndex=e}GetActualHTMLIndex(){return this._actualHtmlIndex}SetActualHTMLIndex(e){this._actualHtmlIndex=e}SetHTMLZIndex(e){this._htmlZIndex=e}GetHTMLZIndex(){return this._htmlZIndex}GetElement(){return this._elem}}window.DOMElementHandler=class extends self.DOMHandler{constructor(e,t){super(e,t),this._elementMap=new Map,this._autoAttach=!0,this.AddRuntimeMessageHandlers([["create",e=>this._OnCreate(e)],["destroy",e=>this._OnDestroy(e)],["set-visible",e=>this._OnSetVisible(e)],["update-position",e=>this._OnUpdatePosition(e)],["update-state",e=>this._OnUpdateState(e)],["focus",e=>this._OnSetFocus(e)],["set-css-style",e=>this._OnSetCssStyle(e)],["set-attribute",e=>this._OnSetAttribute(e)],["remove-attribute",e=>this._OnRemoveAttribute(e)]]),this.AddDOMElementMessageHandler("get-element",e=>e)}SetAutoAttach(e){this._autoAttach=!!e}AddDOMElementMessageHandler(e,t){this.AddRuntimeMessageHandler(e,e=>{const n=e["elementId"],s=this.GetElementById(n);return t(s,e)})}AddDOMElementMessageHandlers(e){for(const[t,n]of e)this.AddDOMElementMessageHandler(t,n)}_OnCreate(t){const n=t["elementId"],s=this.CreateElement(n,t),i=new e(s);this._elementMap.set(n,i),s.style.boxSizing="border-box",s.style.display="none",i.SetVisibleFlag(t["isVisible"]);const l=this._GetFocusElement(s);l.addEventListener("focus",e=>this._OnFocus(n)),l.addEventListener("blur",e=>this._OnBlur(n));const a=t["htmlIndex"];if(i.SetWantHTMLIndex(a),i.SetHTMLZIndex(t["htmlZIndex"]),this._autoAttach){const e=this.GetRuntimeInterface().GetAvailableHTMLIndex(a);i.SetActualHTMLIndex(e);this.GetRuntimeInterface().GetHTMLWrapElement(e).appendChild(s)}}CreateElement(e,t){throw new Error("required override")}DestroyElement(e){}_OnDestroy(e){const t=e["elementId"],n=this.GetElementById(t);this.DestroyElement(n),this._autoAttach&&n.parentElement.removeChild(n),this._elementMap.delete(t)}PostToRuntimeElement(e,t,n){n||(n={}),n["elementId"]=t,this.PostToRuntime(e,n)}_PostToRuntimeElementMaybeSync(e,t,n){n||(n={}),n["elementId"]=t,this._PostToRuntimeMaybeSync(e,n)}_OnSetVisible(e){if(!this._autoAttach)return;const t=this._elementMap.get(e["elementId"]),n=t.GetElement();t.HadFirstUpdate()?n.style.display=e["isVisible"]?"":"none":t.SetVisibleFlag(e["isVisible"])}_OnUpdatePosition(e){if(!this._autoAttach)return;const t=this._elementMap.get(e["elementId"]),n=t.GetElement(),s=this.GetRuntimeInterface();n.style.left=e["left"]+"px",n.style.top=e["top"]+"px",n.style.width=e["width"]+"px",n.style.height=e["height"]+"px";const i=e["fontSize"];null!==i&&(n.style.fontSize=i+"em");const l=e["htmlIndex"];t.SetWantHTMLIndex(l);const a=s.GetAvailableHTMLIndex(l);if(a!==t.GetActualHTMLIndex()){n.remove();s.GetHTMLWrapElement(a).appendChild(n),t.SetActualHTMLIndex(a),s._UpdateHTMLElementsZOrder()}const d=e["htmlZIndex"];d!==t.GetHTMLZIndex()&&(t.SetHTMLZIndex(d),s._UpdateHTMLElementsZOrder()),t.HadFirstUpdate()||(t.SetHadFirstUpdate(),t.GetVisibleFlag()&&(n.style.display=""))}_OnHTMLLayersChanged(){if(this._autoAttach)for(const e of this._elementMap.values()){const t=this.GetRuntimeInterface().GetAvailableHTMLIndex(e.GetWantHTMLIndex()),n=e.GetActualHTMLIndex();if(-1!==t&&-1!==n&&t!==n){const n=e.GetElement();n.remove();this.GetRuntimeInterface().GetHTMLWrapElement(t).appendChild(n),e.SetActualHTMLIndex(t)}}}_GetAllElementStatesForZOrderUpdate(){return this._autoAttach?[...this._elementMap.values()]:null}_OnUpdateState(e){const t=this.GetElementById(e["elementId"]);this.UpdateState(t,e)}UpdateState(e,t){throw new Error("required override")}_GetFocusElement(e){return e}_OnFocus(e){this.PostToRuntimeElement("elem-focused",e)}_OnBlur(e){this.PostToRuntimeElement("elem-blurred",e)}_OnSetFocus(e){const t=this._GetFocusElement(this.GetElementById(e["elementId"]));e["focus"]?t.focus():t.blur()}_OnSetCssStyle(e){const t=this.GetElementById(e["elementId"]),n=e["prop"],s=e["val"];n.startsWith("--")?t.style.setProperty(n,s):t.style[n]=s}_OnSetAttribute(e){this.GetElementById(e["elementId"]).setAttribute(e["name"],e["val"])}_OnRemoveAttribute(e){this.GetElementById(e["elementId"]).removeAttribute(e["name"])}GetElementById(e){const t=this._elementMap.get(e);if(!t)throw new Error(`no element with id ${e}`);return t.GetElement()}}} // workers/domSide.js "use strict";{const e=/(iphone|ipod|ipad|macos|macintosh|mac os x)/i.test(navigator.userAgent),t=/android/i.test(navigator.userAgent),n=/safari/i.test(navigator.userAgent)&&!/(chrome|chromium|edg\/|OP … [Строка слишком длинная. Вы можете скачать файл] // workers/runtimeDomEvents.js "use strict";{const e=self.RuntimeInterface;/firefox/i.test(navigator.userAgent);function t(e){return e["sourceCapabilities"]&&e["sourceCapabilities"]["firesTouchEvents"]||e["originalEvent"]&&e["origi … [Строка слишком длинная. Вы можете скачать файл] // workers/jobSchedulerDom.js "use strict";{const t="dispatchworker.js",r="jobworker.js";self.JobSchedulerDOM=class{constructor(t){this._runtimeInterface=t,this._maxNumWorkers=Math.min(navigator.hardwareConcurrency||2,16),this._dispatchWorker=null,this._jobWorkers=[],this._inputPort=null,this._outputPort=null}async Init(){if(this._hasInitialised)throw new Error("already initialised");this._hasInitialised=!0;const r=this._runtimeInterface.GetScriptFolder()+t;this._dispatchWorker=await this._runtimeInterface.CreateWorker(r,{name:"DispatchWorker"});const e=new MessageChannel;this._inputPort=e.port1,this._dispatchWorker.postMessage({"type":"_init","in-port":e.port2},[e.port2]),this._outputPort=await this._CreateJobWorker()}async _CreateJobWorker(){const t=this._jobWorkers.length,e=this._runtimeInterface.GetScriptFolder()+r,o=await this._runtimeInterface.CreateWorker(e,{name:"JobWorker"+t}),s=new MessageChannel,i=new MessageChannel;return this._dispatchWorker.postMessage({"type":"_addJobWorker","port":s.port1},[s.port1]),o.postMessage({"type":"init","number":t,"dispatch-port":s.port2,"output-port":i.port2},[s.port2,i.port2]),this._jobWorkers.push(o),i.port1}GetPortData(){return{"inputPort":this._inputPort,"outputPort":this._outputPort,"maxNumWorkers":this._maxNumWorkers}}GetPortTransferables(){return[this._inputPort,this._outputPort]}}} // scripts/plugins/Keyboard/dom/domSide.js "use strict";{const r="keyboard",o=class extends self.DOMHandler{constructor(o){super(o,r),this._isKeyboardLockSupported=!(!navigator["keyboard"]||!navigator["keyboard"]["lock"]),this.AddRuntimeMessageHandlers([["init",()=>this._OnInit()],["lock-keyboard",r=>this._OnLockKeyboard(r)],["unlock-keyboard",()=>this._OnUnlockKeyboard()]])}_OnInit(){return{"isKeyboardLockSupported":this._isKeyboardLockSupported}}async _OnLockKeyboard(r){const o=r["keysArr"];try{return 0===o.length?await navigator["keyboard"]["lock"]():await navigator["keyboard"]["lock"](o),{"isOk":!0}}catch(r){return console.error("Error locking keyboard:",r),{"isOk":!1}}}_OnUnlockKeyboard(){try{navigator["keyboard"]["unlock"]()}catch(r){console.error("Error unlocking keyboard:",r)}}};self.RuntimeInterface.AddDOMHandlerClass(o)} // start-export.js "use strict";if(window["C3_IsSupported"]){const e=true;window["c3_runtimeInterface"]=new self.RuntimeInterface({useWorker:e,workerMainUrl:"workermain.js",runtimeMainScript:"scripts/c3main.js",scriptFolder:"scripts/",exportType:"html5"})}