PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.2
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.2
1.1.10 1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 0.8.8 0.8.7 All 34 releases
desktop-mode / assets / js / sw.min.js

sw.min.js in OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin 1.1.2, at assets/js/sw.min.js

2 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function(){"use strict";const n=globalThis,h="0.8.0-pwa-5",c=`os-static-${h}`,l=`os-runtime-${h}`,p="/openstation/?offline=1",f=["assets/css/desktop.css","assets/css/variables.css","assets/css/dock.css","assets/css/windows.css","assets/js/desktop.min.js","assets/js/window-system.min.js","assets/js/shell-overlays.min.js","assets/images/wp-logo.png"];n.addEventListener("install",t=>{t.waitUntil(d()),n.skipWaiting()}),n.addEventListener("activate",t=>{t.waitUntil((async()=>{const e=await caches.keys();await Promise.all(e.filter(s=>!s.endsWith(h)).map(s=>caches.delete(s))),await n.clients.claim()})())}),n.addEventListener("fetch",t=>{const e=t.request;if(e.method!=="GET")return;const s=new URL(e.url);if(s.origin!==n.location.origin)return;const i=s.pathname.startsWith("/openstation/"),a=s.pathname.startsWith("/wp-admin/"),o=s.pathname.includes("/wp-content/plugins/desktop-mode/");if(!(!i&&!a&&!o)){if(o&&g(s.pathname)){t.respondWith(y(e));return}if(o&&m(s.pathname)){t.respondWith(k(e));return}e.mode==="navigate"&&e.destination==="document"&&t.respondWith(A(e))}}),n.addEventListener("push",t=>{t.waitUntil(Promise.resolve())}),n.addEventListener("notificationclick",t=>{t.notification.close(),t.waitUntil((async()=>{const e=t.notification.data?.url??"/openstation/",i=(await n.clients.matchAll({type:"window",includeUncontrolled:!0})).find(a=>a.url.includes("/openstation/"));if(i){typeof i.focus=="function"&&await i.focus();return}n.clients.openWindow&&await n.clients.openWindow(e)})())});async function d(){try{const t=await caches.open(c),e=w();await t.addAll(f.map(s=>e+s))}catch{}}function w(){return n.location.origin+"/wp-content/plugins/desktop-mode/"}function m(t){return/\.(css|png|jpg|jpeg|svg|webp|woff2?|ttf|gif|ico)$/i.test(t)}function g(t){return/\.js$/i.test(t)}async function y(t){const e=await caches.open(l);try{const s=await fetch(t.url,{cache:"reload"});return s&&s.status===200&&e.put(t,s.clone()).catch(()=>{}),s}catch{const s=await e.match(t);if(s)return s;const a=await(await caches.open(c)).match(t,{ignoreSearch:!0});return a||new Response("",{status:504})}}async function k(t){const e=await caches.open(l),s=await e.match(t),i=fetch(t).then(r=>(r&&r.status===200&&e.put(t,r.clone()).catch(()=>{}),r)).catch(()=>{});if(s)return s;const a=await i;if(a)return a;const u=await(await caches.open(c)).match(t,{ignoreSearch:!0});return u||new Response("",{status:504})}async function A(t){try{return await fetch(t)}catch{const s=await(await caches.open(c)).match(p);return s||new Response('<!doctype html><meta charset="utf-8"><title>Offline</title><p>You appear to be offline. The app will work again as soon as the connection returns.</p>',{status:503,headers:{"Content-Type":"text/html; charset=utf-8"}})}}})();
2