www.playkidevents.com Open in urlscan Pro
45.207.91.216  Public Scan

URL: http://www.playkidevents.com/wp-content/plugins/download-monitor/assets/js/dlm-xhr.min.js
Submission: On August 30 via api from US — Scanned from GB

Form analysis 0 forms found in the DOM

Text Content

  jQuery(function(e){new DLM_XHR_Download});class DLM_XHR_Download{xhrNonce=!1;constructor(){(dlmXHRinstance=this).init()}init(){dlmXHRinstance.attachButtonEvent()}attachButtonEvent(){jQuery("html, body").on("click",".dlm-no-access-modal-overlay, .dlm-no-access-modal-close",function(e){jQuery("#dlm-no-access-modal").remove()}),jQuery("html, body").on("click","a",function(e){const d=jQuery(this).attr("href");if(jQuery(this).hasClass("dlm-no-xhr-download"))return!0;void 0!==d&&0<=d.indexOf(dlmXHRGlobalLinks)&&dlmXHRinstance.handleDownloadClick(this,e)})}handleDownloadClick(e,d){d.stopPropagation();var o=e.getAttribute("href");let t={button:e,href:o,buttonObj:jQuery(e)};-1===t.href.indexOf("blob:http")&&"#"!==t.href&&(d.preventDefault(),dlmXHRinstance.retrieveBlob(t))}retrieveBlob(e){const x=this;let{button:h,href:w,buttonObj:f}=e,g;const b=new XMLHttpRequest,R=dlmXHR.prevent_duplicates,y=f.attr("target");let H=f.attr("class");H=void 0!==H&&""!==H?H.replace("dlm-download-started","").replace("dlm-download-completed",""):"",f.addClass("dlm-download-started"),h.setAttribute("href","#"),h.removeAttribute("download"),h.setAttribute("disabled","disabled");e='<img src="'+dlmXHRgif+'" class="dlm-xhr-loading-gif" style="display:inline-block; vertical-align: middle; margin-left:15px;">';h.innerHTML+=e,jQuery(document).trigger("dlm_download_triggered",[this,h,f,g]),b.responseType="blob",b.onreadystatechange=function(){var{status:e,readyState:d,statusText:o}=b;let t=b.getAllResponseHeaders().split("\r\n").reduce((e,d)=>{var[d,o]=d.split(": ");return e[d]=o,e},{}),l=(x.xhrNonce=t["x-dlm-nonce"],"download"),r=!1,n=!1,a=!1,s=!1,i=null,m=!1,c=!1,v=!1,u=!1,p=!1;if(void 0!==t["dlm-file-name"]&&(r=t["dlm-file-name"]),void 0!==t["dlm-no-waypoints"]&&(n=!0),void 0!==t["dlm-redirect"]&&(a=t["dlm-redirect"]),void 0!==t["dlm-external-download"]&&(s=!0),void 0!==t["dlm-no-access"]&&(i=t["dlm-no-access"]),void 0!==t["dlm-no-access-modal"]&&(m=t["dlm-no-access-modal"]),void 0!==t["dlm-error"]&&(c=t["dlm-error"]),void 0!==t["dlm-download-id"]&&(v=t["dlm-download-id"]),void 0!==t["dlm-version-id"]&&(u=t["dlm-version-id"]),void 0!==t["dlm-no-access-modal-text"]&&(p=t["dlm-no-access-modal-text"]),void 0!==t["x-dlm-file-name"]&&(r=t["x-dlm-file-name"]),void 0!==t["x-dlm-no-waypoints"]&&(n=!0),void 0!==t["x-dlm-redirect"]&&(a=t["x-dlm-redirect"]),void 0!==t["x-dlm-external-download"]&&(s=!0),void 0!==t["x-dlm-no-access"]&&(i=t["x-dlm-no-access"]),void 0!==t["x-dlm-no-access-modal"]&&(m=t["x-dlm-no-access-modal"]),void 0!==t["x-dlm-error"]&&(c=t["x-dlm-error"]),void 0!==t["x-dlm-download-id"]&&(v=t["x-dlm-download-id"]),void 0!==t["x-dlm-version-id"]&&(u=t["x-dlm-version-id"]),void 0!==t["x-dlm-no-access-modal-text"]&&(p=t["x-dlm-no-access-modal-text"]),r?(l=r.replace(/\"/g,"").replace(";",""),l=decodeURI(l)):void 0!==t["content-disposition"]&&(l=(l=t["content-disposition"].split("filename=")[1]).replace(/\"/g,"").replace(";",""),l=decodeURI(l)),2===b.readyState){if(n)return b.abort(),a?void(window.location.href=a):void(window.location.href=w);if(s)return b.abort(),void dlmXHRinstance.dlmExternalDownload(t,h,f,l,w);if(0===Object.keys(t).filter(e=>-1!==e.indexOf("dlm-")).length)return b.abort(),void(window.location.href=w);if(i&&"true"===i&&m&&0!=m)return dlmXHRinstance.dlmNoAccessModal(t),h.removeAttribute("download"),h.setAttribute("href",w),f.removeClass().addClass(H).find("span.dlm-xhr-progress").remove(),f.find(".dlm-xhr-loading-gif").remove(),void b.abort();if(c&&""!==c&&null!==c)return dlmXHRinstance.dlmLogDownload(t,"failed",!1),h.removeAttribute("download"),h.setAttribute("href",w),f.removeClass().addClass(H).find("span.dlm-xhr-progress").remove(),f.find(".dlm-xhr-loading-gif").remove(),b.abort(),void(m&&0!=m?dlmXHRinstance.dlmNoAccessModal(v,u,p):(f.find(".dlm-xhr-error").remove(),f.append('<span class="dlm-xhr-error">'+c+"</span>")));if(a&&""!==a&&null!==a)return dlmXHRinstance.dlmLogDownload(t,"redirected",!1,a,i,y),h.removeAttribute("download"),h.setAttribute("href",w),f.removeClass().addClass(H).find("span.dlm-xhr-progress").remove(),f.find(".dlm-xhr-loading-gif").remove(),void b.abort()}if(404==e&&2==d){let e=document.createElement("p");e.innerHTML=o,h.parentNode.appendChild(e)}if(401==e&&2==d)window.location.href=o;else{if(403==e&&2==d){let e=document.createElement("p");e.innerHTML=o,h.parentNode.appendChild(e)}200==e&&4==d&&(o=b.response,g=URL.createObjectURL(o),h.removeEventListener("click",dlmXHRinstance.handleDownloadClick),h.setAttribute("download",""+l),h.setAttribute("href",g),h.click(),f.removeClass().addClass(H+" dlm-download-complete"),dlmXHRinstance.attachButtonEvent(),jQuery(document).trigger("dlm_download_complete",[this,h,f,g]),dlmXHRinstance.dlmLogDownload(t,"completed",R),window.URL.revokeObjectURL(g),h.removeAttribute("download"),h.setAttribute("href",w),f.find(".dlm-xhr-loading-gif").remove(),setTimeout(function(){f.removeClass().addClass(H).find("span.dlm-xhr-progress").remove()},4e3))}},b.addEventListener("progress",function(e){let d=e.loaded/e.total*100;d=d.toFixed();var o;f.find("span.dlm-xhr-progress").remove(),o="dlm-download-started download-"+10*Math.ceil(d/10),1/0!=d&&f.append('<span class="dlm-xhr-progress">&nbsp;'+d+"%</span>"),f.removeClass().addClass(H+" "+o),jQuery(document).trigger("dlm_download_progress",[this,h,f,g,e,d])}),b.onerror=function(){h.removeAttribute("download"),h.setAttribute("href",w),f.removeClass().addClass(H+" dlm-no-xhr-download").find("span.dlm-xhr-progress").remove(),f.find(".dlm-xhr-error").remove(),f.append('<span class="dlm-xhr-error">'+dlmXHRtranslations.error+"</span>"),console.log("** An error occurred during the transaction")},b.open("GET",w,!0),b.setRequestHeader("dlm-xhr-request","dlm_XMLHttpRequest"),b.send()}dlmLogDownload(e,d,o,t=null,l=null,r="_self"){null!==l?window.location.href=t:(l=window.location.href,d={download_id:void 0!==e["x-dlm-download-id"]?e["x-dlm-download-id"]:e["dlm-download-id"],version_id:void 0!==e["x-dlm-version-id"]?e["x-dlm-version-id"]:e["dlm-version-id"],status:d,cookie:o,currentURL:l,action:"log_dlm_xhr_download",responseHeaders:e,nonce:this.xhrNonce},jQuery.post(dlmXHR.ajaxUrl,d,function(e){null!==t&&(null==r&&(r="_self"),window.open(t,r))}))}dlmNoAccessModal(e){let d="empty-download",o="empty-version",t="empty-restriction",l="",r=(void 0!==e["dlm-download-id"]&&(d=e["dlm-download-id"]),void 0!==e["dlm-version-id"]&&(o=e["dlm-version-id"]),void 0!==e["dlm-no-access-modal-text"]&&(l=e["dlm-no-access-modal-text"]),void 0!==e["dlm-no-access-restriction"]&&(t=e["dlm-no-access-restriction"]),void 0!==e["x-dlm-download-id"]&&(d=e["x-dlm-download-id"]),void 0!==e["x-dlm-version-id"]&&(o=e["x-dlm-version-id"]),void 0!==e["x-dlm-no-access-modal-text"]&&(l=e["x-dlm-no-access-modal-text"]),void 0!==e["x-dlm-no-access-restriction"]&&(t=e["x-dlm-no-access-restriction"]),{download_id:d,version_id:o,modal_text:l,restriction:t,action:"no_access_dlm_xhr_download",nonce:this.xhrNonce});jQuery(document).trigger("dlm-xhr-modal-data",[r,e]),jQuery.post(dlmXHR.ajaxUrl,r,function(e){jQuery("#dlm-no-access-modal").remove(),jQuery("body").append(e),jQuery(document).trigger(r.action,[e,r])})}dlmExternalDownload(e,t,l,r,n){const a=new XMLHttpRequest;l.attr("target");let s=l.attr("class"),i,d="";void 0!==e["dlm-external-download"]&&(d=e["dlm-external-download"]),void 0!==e["x-dlm-external-download"]&&(d=e["x-dlm-external-download"]),s=void 0!==s&&""!==s?s.replace("dlm-download-started","").replace("dlm-download-completed",""):"",l.addClass("dlm-download-started"),t.setAttribute("href","#"),t.removeAttribute("download"),t.setAttribute("disabled","disabled"),jQuery(document).trigger("dlm_download_triggered",[this,t,l,i]),a.responseType="blob",a.onreadystatechange=function(){var{status:e,readyState:d}=a,o=a.getAllResponseHeaders().split("\r\n").reduce((e,d)=>{var[d,o]=d.split(": ");return e[d]=o,e},{});if(403===e)return dlmXHRinstance.dlmLogDownload(o,"failed",!1),a.abort(),l.find(".dlm-xhr-error").remove(),void l.append('<span class="dlm-xhr-error">Acces Denied to file.</span>');200==e&&4==d&&(e=a.response,i=URL.createObjectURL(e),t.removeEventListener("click",dlmXHRinstance.handleDownloadClick),t.setAttribute("download",""+r),t.setAttribute("href",i),t.click(),l.removeClass().addClass(s+" dlm-download-complete"),dlmXHRinstance.attachButtonEvent(),jQuery(document).trigger("dlm_download_complete",[this,t,l,i]),dlmXHRinstance.dlmLogDownload(o,"completed",!1),window.URL.revokeObjectURL(i),t.removeAttribute("download"),t.setAttribute("href",n),l.find(".dlm-xhr-loading-gif").remove(),setTimeout(function(){l.removeClass().addClass(s).find("span.dlm-xhr-progress").remove()},1e3))},a.addEventListener("progress",function(e){let d=e.loaded/e.total*100;d=d.toFixed();var o;l.find("span.dlm-xhr-progress").remove(),o="dlm-download-started download-"+10*Math.ceil(d/10),1/0!=d&&l.append('<span class="dlm-xhr-progress">&nbsp;'+d+"%</span>"),l.removeClass().addClass(s+" "+o),jQuery(document).trigger("dlm_download_progress",[this,t,l,i,e,d])}),a.onerror=function(){t.removeAttribute("download"),t.setAttribute("href",n),l.removeClass().addClass(s+" .dlm-no-xhr-download").find("span.dlm-xhr-progress").remove(),l.find(".dlm-xhr-error").remove(),l.append('<span class="dlm-xhr-error">'+dlmXHRtranslations.error+"</span>"),console.log("** An error occurred during the transaction")},a.open("GET",d,!0),a.setRequestHeader("dlm-xhr-request","dlm_XMLHttpRequest"),a.send()}}