Compare commits
	
		
			2 Commits 
		
	
	
		
			e8fda7c930
			...
			51eb210125
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								 | 
						51eb210125 | |
| 
							
							
								 | 
						5f36a22e65 | 
											
												
													File diff suppressed because one or more lines are too long
												
											
										
									
								
								
									
									
										
											65
										
									
									index.html
									
									
									
									
								
								
							
							
										
											65
										
									
									index.html
									
									
									
									
								| 
						 | 
					@ -1,8 +1,9 @@
 | 
				
			||||||
<!DOCTYPE html>
 | 
					<!DOCTYPE html>
 | 
				
			||||||
<html lang="en">
 | 
					<html lang="en">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<head>
 | 
					<head>
 | 
				
			||||||
  <!-- Google tag (gtag.js) -->
 | 
					  <!-- Google tag (gtag.js) -->
 | 
				
			||||||
<!--<script async src="https://www.googletagmanager.com/gtag/js?id=G-WYYDMY13BG"></script>
 | 
					  <!--<script async src="https://www.googletagmanager.com/gtag/js?id=G-WYYDMY13BG"></script>
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
  window.dataLayer = window.dataLayer || [];
 | 
					  window.dataLayer = window.dataLayer || [];
 | 
				
			||||||
  function gtag(){dataLayer.push(arguments);}
 | 
					  function gtag(){dataLayer.push(arguments);}
 | 
				
			||||||
| 
						 | 
					@ -35,7 +36,7 @@
 | 
				
			||||||
  <meta itemprop="image" content="https://fxclient.github.io/FXclient/assets/logo.png">
 | 
					  <meta itemprop="image" content="https://fxclient.github.io/FXclient/assets/logo.png">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <!-- FX Client CSS -->
 | 
					  <!-- FX Client CSS -->
 | 
				
			||||||
    <link rel="stylesheet" href="main.css?1752485839738">
 | 
					  <link rel="stylesheet" href="main.css?1752610801048">
 | 
				
			||||||
  <!-- Game CSS -->
 | 
					  <!-- Game CSS -->
 | 
				
			||||||
  <style>
 | 
					  <style>
 | 
				
			||||||
    html,
 | 
					    html,
 | 
				
			||||||
| 
						 | 
					@ -55,11 +56,49 @@
 | 
				
			||||||
      color: rgb(225, 225, 255);
 | 
					      color: rgb(225, 225, 255);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  </style>
 | 
					  </style>
 | 
				
			||||||
 | 
					  <script>
 | 
				
			||||||
 | 
					    // adapted from https://stackoverflow.com/a/44593894 and https://stackoverflow.com/a/40446448
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function showUpdatePrompt(/** @type {ServiceWorker} */ sw) {
 | 
				
			||||||
 | 
					      console.log("showing update prompt")
 | 
				
			||||||
 | 
					      document.getElementById("updateNotification").style.display = "block";
 | 
				
			||||||
 | 
					      document.getElementById("swUpdateButton").addEventListener("click", () => {
 | 
				
			||||||
 | 
					        sw.postMessage({ update: true });
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    document.addEventListener("DOMContentLoaded", function () {
 | 
				
			||||||
 | 
					      if (!("serviceWorker" in navigator)) return;
 | 
				
			||||||
 | 
					      navigator.serviceWorker.addEventListener("controllerchange", () => {
 | 
				
			||||||
 | 
					        console.log("Controlling service worker changed, refreshing page");
 | 
				
			||||||
 | 
					        window.location.reload();
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      navigator.serviceWorker.register("./sw2.js").then(function (registration) {
 | 
				
			||||||
 | 
					        if (!navigator.serviceWorker.controller) return;
 | 
				
			||||||
 | 
					        // if there's an updated worker already waiting, update
 | 
				
			||||||
 | 
					        if (registration.waiting) return showUpdatePrompt(registration.waiting);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // if a worker in the "installing" state becomes "installed", update
 | 
				
			||||||
 | 
					        function handleInstalling() {
 | 
				
			||||||
 | 
					          var sw = registration.installing;
 | 
				
			||||||
 | 
					          sw.addEventListener("statechange", function () {
 | 
				
			||||||
 | 
					            if (sw.state === "installed") showUpdatePrompt(sw);
 | 
				
			||||||
 | 
					          })
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        // if there's an updated worker installing, track its progress
 | 
				
			||||||
 | 
					        if (registration.installing) handleInstalling();
 | 
				
			||||||
 | 
					        // otherwise, listen for new workers arriving
 | 
				
			||||||
 | 
					        registration.addEventListener('updatefound', handleInstalling);
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					  </script>
 | 
				
			||||||
</head>
 | 
					</head>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<body onload="aiCommand746(0);">
 | 
					<body onload="aiCommand746(0);">
 | 
				
			||||||
  <canvas id="canvasA" width="128" height="128"></canvas>
 | 
					  <canvas id="canvasA" width="128" height="128"></canvas>
 | 
				
			||||||
    <span id="windowContainer"><div class="window flex-column settings" style="display:none">
 | 
					  <span id="windowContainer">
 | 
				
			||||||
 | 
					    <div class="window flex-column settings" style="display:none">
 | 
				
			||||||
      <h1>Settings</h1>
 | 
					      <h1>Settings</h1>
 | 
				
			||||||
      <div class="scrollable"></div>
 | 
					      <div class="scrollable"></div>
 | 
				
			||||||
      <hr>
 | 
					      <hr>
 | 
				
			||||||
| 
						 | 
					@ -77,20 +116,26 @@
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <div class="window scrollable selectable" id="playerlist" style="display: none;">
 | 
					    <div class="window scrollable selectable" id="playerlist" style="display: none;">
 | 
				
			||||||
      <h1>Player List</h1>
 | 
					      <h1>Player List</h1>
 | 
				
			||||||
        <table><tbody id="playerlist_content"></tbody></table>
 | 
					      <table>
 | 
				
			||||||
 | 
					        <tbody id="playerlist_content"></tbody>
 | 
				
			||||||
 | 
					      </table>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <div class="window scrollable selectable" id="donationhistory" style="display:none">
 | 
					    <div class="window scrollable selectable" id="donationhistory" style="display:none">
 | 
				
			||||||
      <h1>Donation history for </h1>
 | 
					      <h1>Donation history for </h1>
 | 
				
			||||||
      <p id="donationhistory_note">Note: donations from bots are not shown here</p>
 | 
					      <p id="donationhistory_note">Note: donations from bots are not shown here</p>
 | 
				
			||||||
        <table><tbody id="donationhistory_content"></tbody></table>
 | 
					      <table>
 | 
				
			||||||
 | 
					        <tbody id="donationhistory_content"></tbody>
 | 
				
			||||||
 | 
					      </table>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <div class="window" style="display: none" id="updateNotification">
 | 
					    <div class="window" style="display: none" id="updateNotification">
 | 
				
			||||||
      <h3>A new version of FX is available! Reload to update</h3>
 | 
					      <h3>A new version of FX is available! Reload to update</h3>
 | 
				
			||||||
      <button onclick="window.location.reload()">Reload</button>
 | 
					      <button id="swUpdateButton">Reload</button>
 | 
				
			||||||
      <button onclick="document.getElementById('updateNotification').style.display = 'none'">Dismiss</button>
 | 
					      <button onclick="document.getElementById('updateNotification').style.display = 'none'">Dismiss</button>
 | 
				
			||||||
    </div></span>
 | 
					    </div>
 | 
				
			||||||
    <script src="variables.js?1752485839738"></script>
 | 
					  </span>
 | 
				
			||||||
    <script src="fx.bundle.js?1752485839738"></script>
 | 
					  <script src="variables.js?1752610801048"></script>
 | 
				
			||||||
    <script src="game.js?1752485839738"></script>
 | 
					  <script src="fx.bundle.js?1752610801048"></script>
 | 
				
			||||||
 | 
					  <script src="game.js?1752610801048"></script>
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
								
									
									
										
											48
										
									
									sw.js
									
									
									
									
								
								
							
							
										
											48
										
									
									sw.js
									
									
									
									
								| 
						 | 
					@ -1,47 +1 @@
 | 
				
			||||||
const cacheName = "1752485839738"; // this gets replaced by the build script
 | 
					// removed
 | 
				
			||||||
 | 
					 | 
				
			||||||
self.addEventListener("install", (e) => {
 | 
					 | 
				
			||||||
  console.log("[Service Worker] Install");
 | 
					 | 
				
			||||||
  self.skipWaiting();
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
self.addEventListener("fetch", (e) => {
 | 
					 | 
				
			||||||
  const url = e.request.url;
 | 
					 | 
				
			||||||
  // Cache http and https only, skip unsupported chrome-extension:// and file://...
 | 
					 | 
				
			||||||
  if (!(url.startsWith('http:') || url.startsWith('https:'))) {
 | 
					 | 
				
			||||||
    return;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  e.respondWith(
 | 
					 | 
				
			||||||
    (async () => {
 | 
					 | 
				
			||||||
      const r = await caches.match(e.request);
 | 
					 | 
				
			||||||
      console.log(`[Service Worker] Fetching resource: ${url}`);
 | 
					 | 
				
			||||||
      if (r) {
 | 
					 | 
				
			||||||
        return r;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      const response = await fetch(e.request);
 | 
					 | 
				
			||||||
      const cache = await caches.open(cacheName);
 | 
					 | 
				
			||||||
      console.log(`[Service Worker] Caching new resource: ${url}`);
 | 
					 | 
				
			||||||
      cache.put(e.request, response.clone());
 | 
					 | 
				
			||||||
      return response;
 | 
					 | 
				
			||||||
    })(),
 | 
					 | 
				
			||||||
  );
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
self.addEventListener("activate", (e) => {
 | 
					 | 
				
			||||||
  console.log("[Service Worker] Activated", cacheName);
 | 
					 | 
				
			||||||
  self.clients.matchAll().then(clients => {
 | 
					 | 
				
			||||||
    clients.forEach(client => client.postMessage({ event: "activate", version: cacheName }));
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
  e.waitUntil(
 | 
					 | 
				
			||||||
    caches.keys().then((keyList) => {
 | 
					 | 
				
			||||||
      return Promise.all(
 | 
					 | 
				
			||||||
        keyList.map((key) => {
 | 
					 | 
				
			||||||
          if (key === cacheName) {
 | 
					 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          return caches.delete(key);
 | 
					 | 
				
			||||||
        }),
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
    }),
 | 
					 | 
				
			||||||
  );
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,51 @@
 | 
				
			||||||
 | 
					const cacheName = "1752610801048"; // this gets replaced by the build script
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					self.addEventListener("install", (e) => {
 | 
				
			||||||
 | 
					  console.log("[Service Worker] Install", cacheName);
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					self.addEventListener('message', function (e) {
 | 
				
			||||||
 | 
					  if (e.data.update) {
 | 
				
			||||||
 | 
					    self.skipWaiting();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					self.addEventListener("fetch", (e) => {
 | 
				
			||||||
 | 
					  const url = e.request.url;
 | 
				
			||||||
 | 
					  // Cache http and https only, skip unsupported chrome-extension:// and file://...
 | 
				
			||||||
 | 
					  if (!(url.startsWith('http:') || url.startsWith('https:'))) {
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  e.respondWith(
 | 
				
			||||||
 | 
					    (async () => {
 | 
				
			||||||
 | 
					      const cache = await caches.open(cacheName);
 | 
				
			||||||
 | 
					      const r = await cache.match(e.request);
 | 
				
			||||||
 | 
					      console.log(`[Service Worker] Fetching resource: ${url}`);
 | 
				
			||||||
 | 
					      if (r) {
 | 
				
			||||||
 | 
					        return r;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      const response = await fetch(e.request);
 | 
				
			||||||
 | 
					      console.log(`[Service Worker] Caching new resource: ${url}`);
 | 
				
			||||||
 | 
					      cache.put(e.request, response.clone());
 | 
				
			||||||
 | 
					      return response;
 | 
				
			||||||
 | 
					    })(),
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					  self.clients.matchAll().then(clients => {
 | 
				
			||||||
 | 
					    clients.forEach(client => client.postMessage({ event: "activate", version: cacheName }));
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					self.addEventListener("activate", (e) => {
 | 
				
			||||||
 | 
					  console.log("[Service Worker] Activated", cacheName);
 | 
				
			||||||
 | 
					  e.waitUntil(
 | 
				
			||||||
 | 
					    caches.keys().then((keyList) => {
 | 
				
			||||||
 | 
					      return Promise.all(
 | 
				
			||||||
 | 
					        keyList.map((key) => {
 | 
				
			||||||
 | 
					          if (key === cacheName) {
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					          return caches.delete(key);
 | 
				
			||||||
 | 
					        }),
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					    }),
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
		Loading…
	
		Reference in New Issue