diff --git a/icons/android-icon-144x144.png b/icons/android-icon-144x144.png
new file mode 100644
index 0000000..dbc3939
Binary files /dev/null and b/icons/android-icon-144x144.png differ
diff --git a/index.html b/index.html
index 2a53ff1..da79a67 100644
--- a/index.html
+++ b/index.html
@@ -1 +1 @@
-
tether!
\ No newline at end of file
+tether!
\ No newline at end of file
diff --git a/offline/index.html b/offline/index.html
new file mode 100644
index 0000000..8d3d8f0
--- /dev/null
+++ b/offline/index.html
@@ -0,0 +1 @@
+tether!
\ No newline at end of file
diff --git a/service-worker.js b/service-worker.js
new file mode 100644
index 0000000..58fe24e
--- /dev/null
+++ b/service-worker.js
@@ -0,0 +1,34 @@
+const cacheName = 'tether_cache_v1';
+const precacheResources = [
+ '/',
+ '/offline.html',
+ '/fonts/Quantico400.woff2',
+ '/fonts/Quantico700.woff2',
+ '/fonts/Tulpen-One400.woff2',
+ '/favicon.ico',
+ '/libs/font-awesome.min.css',
+ '/libs/fontawesome-webfont.woff'
+];
+
+// When the service worker is installing, open the cache and add the precache resources to it
+self.addEventListener('install', (event) => {
+ console.log('Service worker install event!');
+ event.waitUntil(caches.open(cacheName).then((cache) => cache.addAll(precacheResources)));
+});
+
+self.addEventListener('activate', (event) => {
+ console.log('Service worker activate event!');
+});
+
+// When there's an incoming fetch request, try and respond with a precached resource, otherwise fall back to the network
+self.addEventListener('fetch', (event) => {
+ console.log('Fetch intercepted for:', event.request.url);
+ event.respondWith(
+ caches.match(event.request).then((cachedResponse) => {
+ if (cachedResponse) {
+ return cachedResponse;
+ }
+ return fetch(event.request);
+ }),
+ );
+});
\ No newline at end of file
diff --git a/source/source.js b/source/game.js
similarity index 98%
rename from source/source.js
rename to source/game.js
index 3045b5c..7538cc1 100644
--- a/source/source.js
+++ b/source/game.js
@@ -20,6 +20,7 @@ var DEBUG = window.location.hash === '#DEBUG',
lastDayCookieKey = 'tetherLastDate',
streakCountCookieKey = 'tetherStreakCount',
streakCount = localStorage.getItem(streakCountCookieKey) ?? 0,
+ subtitleText = "",
lastDate = new Date(Number(localStorage.getItem(lastDayCookieKey))),
lastTouchStart,
uidCookieKey = 'tetherId',
@@ -30,6 +31,9 @@ var DEBUG = window.location.hash === '#DEBUG',
shouldUnmuteImmediately = false,
cookieExpiryDate = new Date();
+if(window.location.pathname === '/source/') subtitleText = 'Source Development Mode. #OpenSource';
+else subtitleText = 'Swing around a ball and cause pure destruction.';
+
cookieExpiryDate.setFullYear(cookieExpiryDate.getFullYear() + 50);
var cookieSuffix = '; expires=' + cookieExpiryDate.toUTCString();
@@ -541,8 +545,8 @@ function Music() {
var self = this,
path;
- if (INFO) path = 'bgm.mp3';
- else path = 'bgm.mp3';
+ if (INFO) path = '../tether_theme.mp3';
+ else path = '../tether_theme.mp3';
self.element = new Audio(path);
@@ -563,7 +567,7 @@ function Music() {
Music.prototype = {
bpm: 90,
- url: 'bgm.mp3',
+ url: 'tether_theme.mp3',
delayCompensation: 0.03,
totalBeat: function () {
@@ -1911,7 +1915,7 @@ function Game() {
draw({
type: 'text',
- text: 'Swing around a ball and cause pure destruction.',
+ text: subtitleText ?? 'Swing around a ball and cause pure destruction.',
fillStyle: rgbWithOpacity([0, 0, 0], opacity),
fontSize: 30,
textPosition: {
@@ -2371,7 +2375,21 @@ function handleClick(e) {
}
}
+var konamiLength = 0;
+var konamiSequence = ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'KeyB', 'KeyA', 'Space'];
+
+function konamiSeq(requiredKey, givenKey) {
+ if(requiredKey === givenKey) konamiLength++;
+ else konamiLength = 0;
+
+ if(konamiLength === 11) {
+ subtitleText = 'Special Cheats Activated. Have fun!';
+ playerRGB = 'Rainbow';
+ }
+}
+
function handleKey(e) {
+ konamiSeq(konamiSequence[konamiLength], e.code);
if (e.code === 'KeyP') paused = !paused;
}
@@ -2445,4 +2463,4 @@ window.addEventListener('scroll', function (e) {
});
window.scrollTo(0, 0);
-animate();
+animate();
\ No newline at end of file
diff --git a/source/index.html b/source/index.html
index ce65a86..a552cc9 100644
--- a/source/index.html
+++ b/source/index.html
@@ -142,7 +142,7 @@
-
+
@@ -168,8 +168,20 @@
});
})();
+
-
+
diff --git a/source/source-service-worker.js b/source/source-service-worker.js
new file mode 100644
index 0000000..7733a55
--- /dev/null
+++ b/source/source-service-worker.js
@@ -0,0 +1,34 @@
+const cacheName = 'tether_source_cache-v2';
+const precacheResources = [
+ '/',
+ '/offline.html',
+ '/fonts/Quantico400.woff2',
+ '/fonts/Quantico700.woff2',
+ '/fonts/Tulpen-One400.woff2',
+ '/icons/favicon.ico',
+ '/libs/font-awesome.min.css',
+ '/libs/fontawesome-webfont.woff'
+];
+
+// When the service worker is installing, open the cache and add the precache resources to it
+self.addEventListener('install', (event) => {
+ console.log('Service worker install event!');
+ event.waitUntil(caches.open(cacheName).then((cache) => cache.addAll(precacheResources)));
+});
+
+self.addEventListener('activate', (event) => {
+ console.log('Service worker activate event!');
+});
+
+// When there's an incoming fetch request, try and respond with a precached resource, otherwise fall back to the network
+self.addEventListener('fetch', (event) => {
+ console.log('Fetch intercepted for:', event.request.url);
+ event.respondWith(
+ caches.match(event.request).then((cachedResponse) => {
+ if (cachedResponse) {
+ return cachedResponse;
+ }
+ return fetch(event.request);
+ }),
+ );
+});
\ No newline at end of file
diff --git a/bgm.mp3 b/tether_theme.mp3
similarity index 100%
rename from bgm.mp3
rename to tether_theme.mp3