This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const COMMENT_SELECTOR = | |
| "span.bds-c-rating__label-secondary.f-label-small-secondary-font-size.fw-label-small-secondary-font-weight.lh-label-small-secondary-line-height.ff-label-small-secondary-font-family"; | |
| const FIRM_LIST_SELECTOR = "div.container.vendors-section > div"; | |
| const commentCounts = []; | |
| let vendorCounts = 0; | |
| const parseTotalComments = () => { | |
| document.querySelectorAll(COMMENT_SELECTOR).forEach((item) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| self.addEventListener('fetch', event => { | |
| event.respondWith( | |
| fetch(event.request) | |
| ); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| self.addEventListener('fetch', event => { | |
| // sadece cache'teki veriyi geri dönder | |
| event.respondWith( | |
| caches.match(event.request) | |
| ); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| self.addEventListener('fetch', async event => { | |
| const cache = await caches.open('v1'); | |
| // Önce önbellekteki yanıtı al, aynı zamanda ağdan yenile | |
| const cachedResponse = await caches.match(event.request); | |
| const fetchRes = await fetch(event.request) | |
| // Ağdan alınan yanıtı önbelleğe kaydet | |
| cache.put(event.request, fetchRes.clone()); | |
| // Önbellekteki yanıtı kullan veya ağdan alınanı bekle | |
| return event.respondWith(cachedResponse || fetchRes); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| self.addEventListener('fetch', async event => { | |
| try { | |
| // İlk olarak ağdan istek yap | |
| const fetchResponse = await fetch(event.request); | |
| const cache = await caches.open('v1'); | |
| // Ağdan alınan yanıtı önbelleğe kaydet | |
| cache.put(event.request, fetchResponse.clone()); | |
| return event.respondWith(fetchResponse); | |
| } catch (error) { | |
| // Ağ hatası durumunda önbellekten dön |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| self.addEventListener('fetch', async event => { | |
| // İlk olarak önbellekte eşleşen bir yanıt arayın | |
| const cachedResponse = await caches.match(event.request); | |
| if (cachedResponse) { | |
| // Önbellekte eşleşen bir yanıt varsa, onu dön | |
| return event.respondWith(cachedResponse); | |
| } | |
| // Eğer önbellekte yoksa, ağdan istek yap | |
| const fetchResponse = await fetch(event.request); | |
| const cache = await caches.open('v1'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function cacheThenNetwork(request) { | |
| // cache'leme mekanizmasından cache'lenen tüm veriler | |
| const cachedResponse = await caches.match(request); | |
| if (cachedResponse) { | |
| // cache datayı geri dönder | |
| return cachedResponse; | |
| } | |
| // yoksa istek atmaya izin ver | |
| return fetch(request); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const registerServiceWorker = async () => { | |
| // Service worker destekleniyor mu diye kontrol ediyoruz | |
| if ("serviceWorker" in navigator) { | |
| try { | |
| // Tarayıcıya kendi service worker dosyamızı kaydetmek için talepte bulunuyoruz | |
| // sw.js herhangi bir dizinde bulunabilir. CDN'de de olabilir | |
| const registration = await navigator.serviceWorker.register("./sw.js"); | |
| if (registration.installing) { | |
| // service worker kaydediliyor | |
| } else if (registration.active) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // self = context | window | provider | |
| self.addEventListener('fetch', function(event) { | |
| // İstek gitmeden önce yakalanır ve iptal edilir | |
| event.respondWith( | |
| fetch(event.request).then(response => { | |
| // Burada response nesnesini özelleştirebilir veya değiştirebilirsiniz | |
| return response; | |
| }).catch(error => { | |
| // Ağ hatası durumunda önbellekten bir kaynak döndürmek | |
| return caches.match('/offline.html'); |