Skip to content

Commit

Permalink
css
Browse files Browse the repository at this point in the history
  • Loading branch information
micr0dust committed Sep 30, 2020
1 parent d44e063 commit 9630b16
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 32 deletions.
36 changes: 26 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=0.5, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
<link rel="manifest" href="manifest.json">
<title>SuperTNT Classic Mode</title>
</head>
Expand Down Expand Up @@ -37,7 +38,7 @@
-webkit-align-items: center;
-ms-flex-align: center;
align-items: flex-start;
background-color: #70c4ce;
background-color: #000000;
}

canvas {
Expand Down Expand Up @@ -99,12 +100,18 @@
width: 98px;
height: 100px;
font-size: 50px;
color: #ffffff;
background-color: rgb(0, 0, 0);
border: 2px #ffffff solid;
}

.y-way input {
width: 200px;
height: 100px;
font-size: 50px;
color: #ffffff;
background-color: rgb(0, 0, 0);
border: 2px #ffffff solid;
}
</style>
<div class="content">
Expand All @@ -119,24 +126,24 @@
<br>
</div>
<div class="y-way">
<input class="tnt2" type="button" value="">
<br>
<br>
<input class="up2" type="button" value="">
<br>
<br>
<input class="down2" type="button" value="">
<br>
<br>
<input class="tnt2" type="button" value="">
</div>
</div>
<div id="p1ctrl" class="btn">
<div class="y-way">
<input class="up1" type="button" value="">
<input class="tnt1" type="button" value="">
<br>
<br>
<input class="down1" type="button" value="">
<input class="up1" type="button" value="">
<br>
<br>
<input class="tnt1" type="button" value="">
<input class="down1" type="button" value="">
</div>
<div class="x-way">
<br>
Expand All @@ -151,8 +158,8 @@

</div>
<a id="gamePlayBtn" class="gamePlayBtn" style="display: none;"><img src="./images/4YtokZ.png" alt=""></a>
<h1 id="reload_back" class="reload_back">第一次載入可能較久...</h1>
<h1 id="reload" class="reload">第一次載入可能較久...</h1>
<h1 id="reload_back" class="reload_back">載入中...</h1>
<h1 id="reload" class="reload">載入中...</h1>
<div id="animation_container" style="background-color:rgba(255, 204, 153, 1.00); width:640px; height:480px">
<canvas id="canvas" width="640" height="480"
style="position: absolute; display: block; background-color:rgba(255, 204, 153, 1.00);"></canvas>
Expand All @@ -172,7 +179,11 @@ <h1 id="reload" class="reload">第一次載入可能較久...</h1>
|| navigator.userAgent.match(/Windows Phone/i)
) {
if (window.DeviceOrientationEvent) {
alert("請轉為橫屏!");
Swal.fire(
'請轉為橫屏!',
'',
'info'
)
}
return true;
}
Expand All @@ -183,6 +194,11 @@ <h1 id="reload" class="reload">第一次載入可能較久...</h1>
if (!detectmob()) {
document.querySelector(".ctrl").style.display = 'none';
}
if (!localStorage.getItem('seted')) {
document.getElementById("reload_back").innerHTML = "請重啟遊戲以加載資源";
document.getElementById("reload").innerHTML = "請重啟遊戲以加載資源";
localStorage.setItem('seted', "true");
}
</script>
</body>

Expand Down
117 changes: 95 additions & 22 deletions service-worker.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,103 @@
const filesToCache = [
'./',
'./index.html',
'./createjs-2015.11.26.min.js',
'./vb.js',
'./index.js',
'./images/4YtokZ.png',
'./images/vb_atlas_.png',
'./images/vb_atlas_2.png',
'./images/vb_atlas_3.png',
'./images/vb_atlas_4.png',
'./images/vb_atlas_5.png',
'./assets/bgm1.mp3',
'./assets/bgm4.mp3',
'./assets/bgm6.mp3',
'./assets/bgm8.mp3',
'./assets/explode1.mp3',
'./assets/explode2.mp3',
'./assets/explode3.mp3',
'./assets/explode4.mp3',
'./assets/fuse.mp3',
'./assets/point.mp3',
'./assets/dead.mp3',
'https://cdn.jsdelivr.net/npm/sweetalert2@10'
];

const cacheName = 'static';

self.addEventListener('activate', event => {
console.log('now ready to handle fetches!');
event.waitUntil(
caches.keys().then(function(cacheName) {
var promiseArr = cacheName.map(function(item) {
if (item !== cacheName) {
// Delete that cached file
return caches.delete(item);
}
})
return Promise.all(promiseArr);
})
); // end e.waitUntil
});

// install
self.addEventListener('install', event => {
console.log('installing…');
event.waitUntil(
caches.open(cacheName).then(cache => {
console.log('Caching app ok');
return cache.addAll(filesToCache);
})
);
});

self.addEventListener('fetch', event => {
const dataUrl = 'https://wuilliam104286.github.io/SuperTNT_web_version/';
event.respondWith(
caches.match(event.request).then(function (response) {
return response || fetch(event.request).then(res =>
// 存 caches 之前,要先打開 caches.open(cacheName)
caches.open(cacheName)
.then(function(cache) {
// cache.put(key, value)
// 下一次 caches.match 會對應到 event.request
cache.put(event.request, res.clone());
return res;
})
);
})
);
});
/*
self.addEventListener('install', function(event){
console.log('[SW] 安裝(Install) Service Worker!',event);
event.waitUntil(
caches.open('static')
.then(function (cache) {
cache.addAll([
'./',
'./index.html',
'./createjs-2015.11.26.min.js',
'./vb.js',
'./index.js',
'./images/4YtokZ.png',
'./images/vb_atlas_.png',
'./images/vb_atlas_2.png',
'./images/vb_atlas_3.png',
'./images/vb_atlas_4.png',
'./images/vb_atlas_5.png',
'./assets/bgm1.mp3',
'./assets/bgm4.mp3',
'./assets/bgm6.mp3',
'./assets/bgm8.mp3',
'./assets/explode1.mp3',
'./assets/explode2.mp3',
'./assets/explode3.mp3',
'./assets/explode4.mp3',
'./assets/fuse.mp3',
'./assets/point.mp3',
'./assets/dead.mp3'
'/',
'/index.html',
'/createjs-2015.11.26.min.js',
'/vb.js',
'/index.js',
'/images/4YtokZ.png',
'/images/vb_atlas_.png',
'/images/vb_atlas_2.png',
'/images/vb_atlas_3.png',
'/images/vb_atlas_4.png',
'/images/vb_atlas_5.png',
'/assets/bgm1.mp3',
'/assets/bgm4.mp3',
'/assets/bgm6.mp3',
'/assets/bgm8.mp3',
'/assets/explode1.mp3',
'/assets/explode2.mp3',
'/assets/explode3.mp3',
'/assets/explode4.mp3',
'/assets/fuse.mp3',
'/assets/point.mp3',
'/assets/dead.mp3'
]);
})
);
Expand Down Expand Up @@ -74,3 +146,4 @@ self.addEventListener('fetch', function(event) {
})
);
});
*/

0 comments on commit 9630b16

Please sign in to comment.