refactor: remove jQuery
This commit is contained in:
@@ -24,8 +24,7 @@ const STATIC_ASSETS = [
|
||||
'/img/favicon.ico',
|
||||
'/img/play-icon.svg',
|
||||
'/site.webmanifest',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js'
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css'
|
||||
];
|
||||
|
||||
// Pages à mettre en cache
|
||||
@@ -40,7 +39,7 @@ const PAGES_TO_CACHE = [
|
||||
// Installation du Service Worker
|
||||
self.addEventListener('install', event => {
|
||||
console.log('Service Worker: Installation');
|
||||
|
||||
|
||||
event.waitUntil(
|
||||
caches.open(STATIC_CACHE_NAME)
|
||||
.then(cache => {
|
||||
@@ -59,7 +58,7 @@ self.addEventListener('install', event => {
|
||||
// Activation du Service Worker
|
||||
self.addEventListener('activate', event => {
|
||||
console.log('Service Worker: Activation');
|
||||
|
||||
|
||||
event.waitUntil(
|
||||
caches.keys()
|
||||
.then(cacheNames => {
|
||||
@@ -89,7 +88,7 @@ self.addEventListener('fetch', event => {
|
||||
}
|
||||
|
||||
// Ignorer les requêtes vers des domaines externes (sauf CDN)
|
||||
if (url.origin !== location.origin &&
|
||||
if (url.origin !== location.origin &&
|
||||
!url.hostname.includes('cdnjs.cloudflare.com')) {
|
||||
return;
|
||||
}
|
||||
@@ -173,8 +172,8 @@ self.addEventListener('fetch', event => {
|
||||
|
||||
// Fonctions utilitaires
|
||||
function isStaticAsset(url) {
|
||||
return url.includes('/css/') ||
|
||||
url.includes('/js/') ||
|
||||
return url.includes('/css/') ||
|
||||
url.includes('/js/') ||
|
||||
url.includes('/img/') ||
|
||||
url.includes('cdnjs.cloudflare.com') ||
|
||||
url.endsWith('.css') ||
|
||||
@@ -188,7 +187,7 @@ function isStaticAsset(url) {
|
||||
}
|
||||
|
||||
function isPageRequest(url) {
|
||||
return url.endsWith('/') ||
|
||||
return url.endsWith('/') ||
|
||||
url.endsWith('.php') ||
|
||||
url.includes('index.php') ||
|
||||
url.includes('categories.php') ||
|
||||
@@ -198,7 +197,7 @@ function isPageRequest(url) {
|
||||
}
|
||||
|
||||
function isApiRequest(url) {
|
||||
return url.includes('/ajax/') ||
|
||||
return url.includes('/ajax/') ||
|
||||
url.includes('api') ||
|
||||
url.includes('mastodon-config.php');
|
||||
}
|
||||
@@ -219,4 +218,4 @@ self.addEventListener('message', event => {
|
||||
version: CACHE_NAME
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user