-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* load kcs_const.js from kc server * basic timer layout * uglify js and reload browser on change * countdown timer during maintenance Timer will appear during maintenance calculated by the current client time - Maintenance.EndDateTime from kc server * setup browser-side javascript to be compatible with modcolle linting rules - use babel to deal with browser js compatibility when build js - lint kc-maintainance to comply with linting rules - ignore file type *.min.js from linting * support countdown before maintenance starts * message notification before and during maintenance message shown on the right before maintenance: begins in during maintenance: ends in * disable launcher button during Kancolle maintenance - grayscale button - remove #login link - shake effect when hover or click Once maintenance is over, launcher button will return to normal * delete unused kc-maintenace.js left over from rebasing
- Loading branch information
Showing
6 changed files
with
153 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
*.min.js | ||
*.min.js |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
"env": { | ||
"es6": true, | ||
"node": true, | ||
"browser": true, | ||
"mocha": true | ||
}, | ||
"extends": "modcolle", | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
'use strict' | ||
|
||
require('./lib-fallback') | ||
require('./kc-maintenance') |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* Depends on http://203.104.209.7/gadget/js/kcs_const.js */ | ||
/* global MaintenanceInfo */ | ||
|
||
'use strict' | ||
|
||
const timer = { | ||
day: document.getElementById('day'), | ||
hour: document.getElementById('hour'), | ||
minute: document.getElementById('minute'), | ||
second: document.getElementById('second') | ||
} | ||
const maintenanceNotice = document.getElementById('maintenance-timer') | ||
const state = document.getElementById('maintenance-state') | ||
const loginModal = document.getElementById('login') | ||
const launcher = document.getElementById('launcher') | ||
const launcherAchor = launcher.parentNode | ||
const launcherLink = launcherAchor.href | ||
|
||
maintenanceCheck() | ||
|
||
function maintenanceCheck() { | ||
const now = Date.now() | ||
const willMaintenacne = now <= MaintenanceInfo.StartDateTime | ||
const onMaintenance = now > MaintenanceInfo.StartDateTime && now < MaintenanceInfo.EndDateTime | ||
let remaining = 0 | ||
|
||
if(willMaintenacne) { | ||
remaining = MaintenanceInfo.StartDateTime - now | ||
state.innerHTML = 'begins' | ||
} else if(onMaintenance) { | ||
remaining = MaintenanceInfo.EndDateTime - now | ||
state.innerHTML = 'ends' | ||
disableLauncher() | ||
} else { | ||
maintenanceNotice.style.display = 'none' | ||
enableLauncher() | ||
return | ||
} | ||
|
||
maintenanceNotice.style.display = 'block' | ||
tick(remaining) | ||
setTimeout(maintenanceCheck, 1000) | ||
} | ||
|
||
function tick(timeRemaining) { | ||
timer.day.innerHTML = Math.floor(timeRemaining / (1000 * 60 * 60 * 24)) | ||
timer.hour.innerHTML = Math.floor((timeRemaining % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)) | ||
timer.minute.innerHTML = Math.floor((timeRemaining % (1000 * 60 * 60)) / (1000 * 60)) | ||
timer.second.innerHTML = Math.floor((timeRemaining % (1000 * 60)) / 1000) | ||
} | ||
|
||
function disableLauncher() { | ||
loginModal.style.display = 'none' | ||
launcherAchor.removeAttribute('href') | ||
launcherAchor.title = 'Kancolle is in maintenance. Please wait' | ||
launcher.id = 'launcher-deny' | ||
} | ||
|
||
function enableLauncher() { | ||
loginModal.style.display = 'inherit' | ||
launcherAchor.title = 'Launch Kancolle' | ||
launcherAchor.href = launcherLink | ||
launcher.id = 'launcher' | ||
} |
This file contains 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
This file contains 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