Stacey Williams
+Certified Service Technician
+Mercedes Benz Of Collierville
+ +Scan to Save Contact
+From 0035d94c66bdcecf93b23f4073f786b958296491 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 16:13:01 +0000 Subject: [PATCH 1/7] Initial plan From 04fea6a5aa0611338fc1403290a0a1203ab04ca9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 16:16:00 +0000 Subject: [PATCH 2/7] Optimize service worker and CSS for better performance Co-authored-by: Stacey77 <54900383+Stacey77@users.noreply.github.com> --- style.css | 4 ++++ sw.js | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/style.css b/style.css index 181b0e8..90441ce 100644 --- a/style.css +++ b/style.css @@ -28,6 +28,8 @@ body { 0 0 0 1px rgba(192, 192, 192, 0.1); overflow: hidden; transition: transform 0.3s ease, box-shadow 0.3s ease; + will-change: transform; /* Optimize hover animation */ + contain: layout style paint; /* Optimize rendering performance */ } .business-card:hover { @@ -47,6 +49,7 @@ body { .logo svg { filter: drop-shadow(0 4px 8px rgba(192, 192, 192, 0.3)); animation: pulse 2s ease-in-out infinite; + will-change: opacity; /* Optimize animation performance */ } @keyframes pulse { @@ -151,6 +154,7 @@ body { cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(192, 192, 192, 0.3); + will-change: transform; /* Optimize hover animation */ } .install-btn:hover { diff --git a/sw.js b/sw.js index 31aa6d7..20d84d3 100644 --- a/sw.js +++ b/sw.js @@ -6,16 +6,68 @@ const urlsToCache = [ '/rag7/manifest.json' ]; +// Install event - cache resources and activate immediately self.addEventListener('install', event => { event.waitUntil( caches.open(CACHE_NAME) .then(cache => cache.addAll(urlsToCache)) + .then(() => self.skipWaiting()) // Activate immediately + .catch(error => console.error('Cache installation failed:', error)) ); }); +// Activate event - clean up old caches +self.addEventListener('activate', event => { + event.waitUntil( + caches.keys() + .then(cacheNames => { + return Promise.all( + cacheNames + .filter(cacheName => cacheName !== CACHE_NAME) + .map(cacheName => caches.delete(cacheName)) + ); + }) + .then(() => self.clients.claim()) // Take control immediately + .catch(error => console.error('Cache cleanup failed:', error)) + ); +}); + +// Fetch event - cache-first with network fallback and timeout self.addEventListener('fetch', event => { event.respondWith( caches.match(event.request) - .then(response => response || fetch(event.request)) + .then(response => { + if (response) { + return response; + } + + // Clone the request for fetch + const fetchRequest = event.request.clone(); + + return fetch(fetchRequest, { + // Add timeout to prevent hanging requests + signal: AbortSignal.timeout ? AbortSignal.timeout(5000) : undefined + }) + .then(response => { + // Check if valid response + if (!response || response.status !== 200 || response.type !== 'basic') { + return response; + } + + // Clone response for cache + const responseToCache = response.clone(); + + caches.open(CACHE_NAME) + .then(cache => cache.put(event.request, responseToCache)) + .catch(error => console.error('Failed to update cache:', error)); + + return response; + }) + .catch(error => { + console.error('Fetch failed:', error); + // Could return a custom offline page here + throw error; + }); + }) ); }); \ No newline at end of file From cb934bfc61f9ccac327e7f3a33baddbb6849c955 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 16:17:46 +0000 Subject: [PATCH 3/7] Fix timeout compatibility and CORS response handling Co-authored-by: Stacey77 <54900383+Stacey77@users.noreply.github.com> --- sw.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/sw.js b/sw.js index 20d84d3..ab76950 100644 --- a/sw.js +++ b/sw.js @@ -44,13 +44,16 @@ self.addEventListener('fetch', event => { // Clone the request for fetch const fetchRequest = event.request.clone(); - return fetch(fetchRequest, { - // Add timeout to prevent hanging requests - signal: AbortSignal.timeout ? AbortSignal.timeout(5000) : undefined - }) + // Create timeout promise for better browser compatibility + const timeoutPromise = new Promise((_, reject) => { + setTimeout(() => reject(new Error('Request timeout')), 5000); + }); + + const fetchPromise = fetch(fetchRequest) .then(response => { - // Check if valid response - if (!response || response.status !== 200 || response.type !== 'basic') { + // Check if valid response (allow both basic and cors types) + if (!response || response.status !== 200 || + (response.type !== 'basic' && response.type !== 'cors')) { return response; } @@ -62,7 +65,9 @@ self.addEventListener('fetch', event => { .catch(error => console.error('Failed to update cache:', error)); return response; - }) + }); + + return Promise.race([fetchPromise, timeoutPromise]) .catch(error => { console.error('Fetch failed:', error); // Could return a custom offline page here From c5a98d1625532306a6393d04c4f2fec3be73da72 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 16:18:56 +0000 Subject: [PATCH 4/7] Improve timeout cleanup and cache update handling Co-authored-by: Stacey77 <54900383+Stacey77@users.noreply.github.com> --- sw.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/sw.js b/sw.js index ab76950..6a3119a 100644 --- a/sw.js +++ b/sw.js @@ -44,31 +44,32 @@ self.addEventListener('fetch', event => { // Clone the request for fetch const fetchRequest = event.request.clone(); - // Create timeout promise for better browser compatibility - const timeoutPromise = new Promise((_, reject) => { - setTimeout(() => reject(new Error('Request timeout')), 5000); - }); + // Create AbortController for timeout cleanup + const controller = new AbortController(); + const timeoutId = setTimeout(() => controller.abort(), 5000); - const fetchPromise = fetch(fetchRequest) + return fetch(fetchRequest, { signal: controller.signal }) .then(response => { + clearTimeout(timeoutId); // Clean up timeout + // Check if valid response (allow both basic and cors types) if (!response || response.status !== 200 || (response.type !== 'basic' && response.type !== 'cors')) { return response; } - // Clone response for cache + // Clone response for cache and update cache asynchronously const responseToCache = response.clone(); - - caches.open(CACHE_NAME) - .then(cache => cache.put(event.request, responseToCache)) - .catch(error => console.error('Failed to update cache:', error)); + event.waitUntil( + caches.open(CACHE_NAME) + .then(cache => cache.put(event.request, responseToCache)) + .catch(error => console.error('Failed to update cache:', error)) + ); return response; - }); - - return Promise.race([fetchPromise, timeoutPromise]) + }) .catch(error => { + clearTimeout(timeoutId); // Clean up timeout on error console.error('Fetch failed:', error); // Could return a custom offline page here throw error; From 944ed314994f433190132fa16837969e5742ae0a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 16:20:06 +0000 Subject: [PATCH 5/7] Refactor service worker for better code quality and maintainability Co-authored-by: Stacey77 <54900383+Stacey77@users.noreply.github.com> --- sw.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sw.js b/sw.js index 6a3119a..5bb36f5 100644 --- a/sw.js +++ b/sw.js @@ -1,4 +1,5 @@ const CACHE_NAME = 'stacey-card-v1'; +const FETCH_TIMEOUT = 5000; // 5 seconds timeout for network requests const urlsToCache = [ '/rag7/', '/rag7/index.html', @@ -6,6 +7,13 @@ const urlsToCache = [ '/rag7/manifest.json' ]; +// Helper function to validate response for caching +function isValidResponse(response) { + return response && + response.status === 200 && + (response.type === 'basic' || response.type === 'cors'); +} + // Install event - cache resources and activate immediately self.addEventListener('install', event => { event.waitUntil( @@ -46,15 +54,14 @@ self.addEventListener('fetch', event => { // Create AbortController for timeout cleanup const controller = new AbortController(); - const timeoutId = setTimeout(() => controller.abort(), 5000); + const timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT); return fetch(fetchRequest, { signal: controller.signal }) .then(response => { clearTimeout(timeoutId); // Clean up timeout // Check if valid response (allow both basic and cors types) - if (!response || response.status !== 200 || - (response.type !== 'basic' && response.type !== 'cors')) { + if (!isValidResponse(response)) { return response; } From 02251717ad1414a213bf0e6433dc22e9c3e5ee5d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 16:21:12 +0000 Subject: [PATCH 6/7] Add clarifying comment for response handling Co-authored-by: Stacey77 <54900383+Stacey77@users.noreply.github.com> --- sw.js | 1 + 1 file changed, 1 insertion(+) diff --git a/sw.js b/sw.js index 5bb36f5..4b4aea9 100644 --- a/sw.js +++ b/sw.js @@ -61,6 +61,7 @@ self.addEventListener('fetch', event => { clearTimeout(timeoutId); // Clean up timeout // Check if valid response (allow both basic and cors types) + // Return invalid responses without caching to preserve server behavior if (!isValidResponse(response)) { return response; } From 26613f5d417e65422f576c0846a61e4296044485 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 16:41:48 +0000 Subject: [PATCH 7/7] Add index.html for testing and update paths for local development Co-authored-by: Stacey77 <54900383+Stacey77@users.noreply.github.com> --- index.html | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++ manifest.json | 2 +- sw.js | 8 +-- 3 files changed, 139 insertions(+), 5 deletions(-) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..a79f024 --- /dev/null +++ b/index.html @@ -0,0 +1,134 @@ + + +
+ + + + +Certified Service Technician
+Mercedes Benz Of Collierville
+ +Scan to Save Contact
+