PageSourceSearch

https://gewerbepark-dessau.de/wp-content/cache/min/1/wp-content/pl…/js/request-queue.js?ver=1791059592

js gewerbepark-dessau.de collected 2026-10-06 05:20:16 UTC 5,931 bytes, 23 lines download raw bytes

1H5P.RequestQueue=(function($,EventDispatcher){const RequestQueue=function(options){EventDispatcher.call(this);this.processingQueue=!1;options=options||{};this.showToast=options.showToast;this.itemName='requestQueue'};RequestQueue.prototype.add=function(url,data){if(!window.localStorage){return!1}
2let storedStatements=this.getStoredRequests();if(!storedStatements){storedStatements=[]}
3storedStatements.push({url:url,data:data,});window.localStorage.setItem(this.itemName,JSON.stringify(storedStatements));this.trigger('requestQueued',{storedStatements:storedStatements,processingQueue:this.processingQueue,});return!0};RequestQueue.prototype.getStoredRequests=function(){if(!window.localStorage){return!1}
4const item=window.localStorage.getItem(this.itemName);if(!item){return[]}
5return JSON.parse(item)};RequestQueue.prototype.clearQueue=function(){if(!window.localStorage){return!1}
6window.localStorage.removeItem(this.itemName);return!0};RequestQueue.prototype.resumeQueue=function(){if(!H5PIntegration||!window.navigator||!window.localStorage){return!1}
7if(this.processingQueue){return!1}
8const queue=this.getStoredRequests();const queueLength=queue.length;this.clearQueue();if(!queueLength){this.trigger('emptiedQueue',queue);return!0}
9this.processingQueue=!0;this.processQueue(queue);return!0};RequestQueue.prototype.processQueue=function(queue){if(!queue.length){return}
10this.trigger('processingQueue');const request=queue.shift();const self=this;$.post(request.url,request.data).fail(self.onQueuedRequestFail.bind(self,request)).always(self.onQueuedRequestProcessed.bind(self,queue))};RequestQueue.prototype.onQueuedRequestFail=function(request){if(!window.navigator.onLine){this.add(request.url,request.data)}};RequestQueue.prototype.onQueuedRequestProcessed=function(queue){if(queue.length){this.processQueue(queue);return}
11this.processingQueue=!1;const requestQueue=this.getStoredRequests();this.trigger('queueEmptied',requestQueue)};RequestQueue.prototype.displayToastMessage=function(msg,forceShow,configOverride){if(!this.showToast&&!forceShow){return}
12const config=H5P.jQuery.extend(!0,{},{position:{horizontal:'centered',vertical:'centered',noOverflowX:!0,}},configOverride);H5P.attachToastTo(H5P.jQuery('.h5p-content:first')[0],msg,config)};return RequestQueue})(H5P.jQuery,H5P.EventDispatcher);H5P.OfflineRequestQueue=(function(RequestQueue,Dialog){const offlineRequestQueue=function(options){const requestQueue=new RequestQueue();requestQueue.clearQueue();let startTime=null;const retryIntervals=[10,20,40,60,120,300,600];let intervalIndex=-1;let currentInterval=null;let isAttached=!1;let isShowing=!1;let isLoading=!1;const instance=options.instance;const offlineDialog=new Dialog({headerText:H5P.t('offlineDialogHeader'),dialogText:H5P.t('offlineDialogBody'),confirmText:H5P.t('offlineDialogRetryButtonLabel'),hideCancel:!0,hideExit:!0,classes:['offline'],instance:instance,skipRestoreFocus:!0,});const dialog=offlineDialog.getElement();const countDownText=document.createElement('div');countDownText.classList.add('count-down');countDownText.innerHTML=H5P.t('offlineDialogRetryMessage').replace(':num','<span class="count-down-num">0</span>');dialog.querySelector('.h5p-confirmation-dialog-text').appendChild(countDownText);const countDownNum=countDownText.querySelector('.count-down-num');const throbberWrapper=document.createElement('div');throbberWrapper.classList.add('throbber-wrapper');const throbber=document.createElement('div');throbber.classList.add('sending-requests-throbber');throbberWrapper.appendChild(throbber);requestQueue.on('requestQueued',function(e){if(e.data&&e.data.processingQueue){return}
13if(!isAttached){const rootContent=document.body.querySelector('.h5p-content');if(!rootContent){return}
14offlineDialog.appendTo(rootContent);rootContent.appendChild(throbberWrapper);isAttached=!0}
15startCountDown()}.bind(this));requestQueue.on('queueEmptied',function(e){if(e.data&&e.data.length){startCountDown(!0);return}
16clearInterval(currentInterval);toggleThrobber(!1);intervalIndex=-1;if(isShowing){offlineDialog.hide();isShowing=!1}
17requestQueue.displayToastMessage(H5P.t('offlineSuccessfulSubmit'),!0,{position:{vertical:'top',offsetVertical:'100',}})}.bind(this));offlineDialog.on('confirmed',function(){isShowing=!1;setTimeout(function(){retryRequests()},100)}.bind(this));window.addEventListener('online',function(){retryRequests()}.bind(this));window.addEventListener('message',function(event){const isValidQueueEvent=window.parent===event.source&&event.data.context==='h5p'&&event.data.action==='queueRequest';if(!isValidQueueEvent){return}
18this.add(event.data.url,event.data.data)}.bind(this));const toggleThrobber=function(forceShow){isLoading=!isLoading;
18if(forceShow!==undefined){isLoading=forceShow}
19if(isLoading&&isShowing){offlineDialog.hide();isShowing=!1}
20if(isLoading){throbberWrapper.classList.add('show')}else{throbberWrapper.classList.remove('show')}};const retryRequests=function(){clearInterval(currentInterval);toggleThrobber(!0);requestQueue.resumeQueue()};const incrementRetryInterval=function(){intervalIndex+=1;if(intervalIndex>=retryIntervals.length){intervalIndex=retryIntervals.length-1}};const startCountDown=function(forceDelayedShow){if(isShowing){return}
21toggleThrobber(!1);if(!isShowing){if(forceDelayedShow){setTimeout(function(){offlineDialog.show(0)},100)}else{offlineDialog.show(0)}}
22isShowing=!0;startTime=new Date().getTime();incrementRetryInterval();clearInterval(currentInterval);currentInterval=setInterval(updateCountDown,100)};const updateCountDown=function(){const time=new Date().getTime();const timeElapsed=Math.floor((time-startTime)/1000);const timeLeft=retryIntervals[intervalIndex]-timeElapsed;countDownNum.textContent=timeLeft.toString();if(timeLeft<=0){retryRequests()}};this.add=function(url,data){if(window.navigator.onLine){return!1}
23requestQueue.add(url,data)}};return offlineRequestQueue})(H5P.RequestQueue,H5P.ConfirmationDialog)

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.