diff --git a/about.html b/about.html index cf7a130..c3ead99 100755 --- a/about.html +++ b/about.html @@ -19,6 +19,19 @@ + + + + + + - - - - @@ -82,17 +82,15 @@ - - - - - + diff --git a/assets/js/lozad.min.js b/assets/js/lozad.min.js new file mode 100644 index 0000000..7effbca --- /dev/null +++ b/assets/js/lozad.min.js @@ -0,0 +1,10 @@ +/*! lozad.js - v1.16.0 - 2020-09-06 +* https://github.com/ApoorvSaxena/lozad.js +* Copyright (c) 2020 Apoorv Saxena; Licensed MIT */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.lozad=e()}(this,function(){"use strict"; +/** + * Detect IE browser + * @const {boolean} + * @private + */var g="undefined"!=typeof document&&document.documentMode,f={rootMargin:"0px",threshold:0,load:function(t){if("picture"===t.nodeName.toLowerCase()){var e=t.querySelector("img"),r=!1;null===e&&(e=document.createElement("img"),r=!0),g&&t.getAttribute("data-iesrc")&&(e.src=t.getAttribute("data-iesrc")),t.getAttribute("data-alt")&&(e.alt=t.getAttribute("data-alt")),r&&t.append(e)}if("video"===t.nodeName.toLowerCase()&&!t.getAttribute("data-src")&&t.children){for(var a=t.children,o=void 0,i=0;i<=a.length-1;i++)(o=a[i].getAttribute("data-src"))&&(a[i].src=o);t.load()}t.getAttribute("data-poster")&&(t.poster=t.getAttribute("data-poster")),t.getAttribute("data-src")&&(t.src=t.getAttribute("data-src")),t.getAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"));var n=",";if(t.getAttribute("data-background-delimiter")&&(n=t.getAttribute("data-background-delimiter")),t.getAttribute("data-background-image"))t.style.backgroundImage="url('"+t.getAttribute("data-background-image").split(n).join("'),url('")+"')";else if(t.getAttribute("data-background-image-set")){var d=t.getAttribute("data-background-image-set").split(n),u=d[0].substr(0,d[0].indexOf(" "))||d[0];// Substring before ... 1x +u=-1===u.indexOf("url(")?"url("+u+")":u,1===d.length?t.style.backgroundImage=u:t.setAttribute("style",(t.getAttribute("style")||"")+"background-image: "+u+"; background-image: -webkit-image-set("+d+"); background-image: image-set("+d+")")}t.getAttribute("data-toggle-class")&&t.classList.toggle(t.getAttribute("data-toggle-class"))},loaded:function(){}};function A(t){t.setAttribute("data-loaded",!0)}var m=function(t){return"true"===t.getAttribute("data-loaded")},v=function(t){var e=1 + + + + + + - - - - @@ -90,19 +90,17 @@ - + - - - - - + diff --git a/index.html b/index.html index 878a2fa..4e03ea2 100755 --- a/index.html +++ b/index.html @@ -19,6 +19,19 @@ + + + + + + - - - - @@ -86,17 +86,15 @@ - - - - + + diff --git a/s1.html b/s1.html index 924f4c7..b1c0b34 100755 --- a/s1.html +++ b/s1.html @@ -19,6 +19,19 @@ + + + + + + - - - - @@ -90,19 +90,17 @@ - + - - - - - + diff --git a/s2.html b/s2.html index c61a1f2..dd5907a 100755 --- a/s2.html +++ b/s2.html @@ -19,6 +19,19 @@ + + + + + + - - - - @@ -90,19 +90,17 @@ - + - - - - - + diff --git a/s3.html b/s3.html index ca8797d..5e1d0e4 100755 --- a/s3.html +++ b/s3.html @@ -19,6 +19,19 @@ + + + + + + - - - - @@ -90,19 +90,17 @@ - + - - - - - + diff --git a/sp1.html b/sp1.html index 953c2b7..4678753 100755 --- a/sp1.html +++ b/sp1.html @@ -19,6 +19,19 @@ + + + + + + - - - - - @@ -91,19 +90,17 @@ - + - - - - - + diff --git a/sw.js b/sw.js index 56d5e31..853e3e0 100644 --- a/sw.js +++ b/sw.js @@ -1,4 +1,4 @@ -const CACHE_VERSION = '1.2.0'; +const CACHE_VERSION = '1.2.1'; const BASE_CACHE_FILES = [ '/favicon.ico', @@ -44,6 +44,7 @@ const BASE_CACHE_FILES = [ '/assets/js/modernizr-2.6.2.min.js', '/assets/js/respond.min.js', '/assets/js/sweetalert.min.js', + '/assets/js/lozad.min.js', '/assets/images/loader.svg', '/assets/images/cattalk-banner.png', ]; @@ -101,14 +102,16 @@ const CACHE_STRATEGY = { const CACHE_BLACKLIST = [ '/sw.js', - '/download/', - '/\.mp4$', + '/preview=true/', + '/music/', + '/\.mp3$', ]; const neverCacheUrls = [ '/sw.js', '/preview=true/', - '/api/', + '/music/', + '/\.mp3$', ]; const SUPPORTED_METHODS = [ @@ -476,27 +479,36 @@ self.addEventListener('activate', event => { }); // This fetch handler serves responses for same-origin resources from a cache. -self.addEventListener('fetch', event => { - // If this is a range request, let fetchRengeData handle it - if (cachingStrategy.handleRangeRequest(event) === false) return; - +self.addEventListener('fetch', (event) => { + const requestUrl = new URL(event.request.url); + + // Check if the request is for an .mp3 file + if (requestUrl.pathname.endsWith('.mp3')) { + event.respondWith(fetch(event.request)); + return; + } + // Handle non-GET requests if (cachingStrategy.notGetMethods(event) === false) return; - + + // If this is a range request, let fetchRengeData handle it + if (cachingStrategy.handleRangeRequest(event) === false) return; + // Use cache-first strategy for images if (event.request.url.match(/\.(?:png|jpg|jpeg|svg|gif)$/)) { - event.respondWith( - caches.match(event.request) - .then(response => { - return response || fetch(event.request); - }) - ); - return; + event.respondWith( + caches.match(event.request) + .then(response => { + return response || fetch(event.request); + }) + ); + return; } - + // Use network-first strategy for all other requests event.respondWith( - cachingStrategy.fetchFromNetwork(event) - .catch(() => cachingStrategy.fetchFromCache(event)) + cachingStrategy.fetchFromNetwork(event) + .catch(() => cachingStrategy.fetchFromCache(event)) ); -}); + }); +