Skip to content

Commit

Permalink
updated & optimized
Browse files Browse the repository at this point in the history
  • Loading branch information
RoderickQiu committed Feb 18, 2020
1 parent 29c247e commit 2a3fca1
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 71 deletions.
54 changes: 0 additions & 54 deletions loader.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/*** REST theme ***/

/* loading */

#loader-wrapper {
Expand Down Expand Up @@ -99,56 +97,4 @@
.loaded #loader-wrapper .loader-section.section-right {
transform: translateX(100%);
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
}

/*** WORK theme ***/

/* loading */

#loader-work {
display: block;
position: relative;
left: 50%;
top: 50%;
width: 150px;
height: 150px;
margin: -75px 0 0 -75px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #ea5454;
animation: spin 2s linear infinite;
z-index: 999;
}

#loader-work:before {
content: "";
position: absolute;
top: 5px;
left: 5px;
right: 5px;
bottom: 5px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #ea5454;
animation: spin 3s linear infinite;
}

#loader-work:after {
content: "";
position: absolute;
top: 15px;
left: 15px;
right: 15px;
bottom: 15px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #ea5454;
animation: spin 1.5s linear infinite;
}

/* loaded */

.loaded #loader-work {
opacity: 0;
transition: all 0.3s ease-out;
}
9 changes: 6 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ function createWindow() {
//to load without sparking
win.once('ready-to-show', () => {
win.show();
//win.webContents.openDevTools()
});

//triggers when the main windows is closed
Expand Down Expand Up @@ -153,6 +152,11 @@ app.on('ready', () => {
}//prevent using hotkeys to quit
})

globalShortcut.register('CommandOrControl+Shift+L', () => {
let focusWin = BrowserWindow.getFocusedWindow()
focusWin && focusWin.toggleDevTools()
})//toggle devtools

if (store.get('islocked')) {//locked mode
//if (process.platform == "win32") win.setSkipTaskbar(true);
win.closable = false;
Expand Down Expand Up @@ -199,7 +203,7 @@ app.on('ready', () => {
focusWhenResting: false
});
store.set("predefined-tasks", predefinedTasks);
store.set("default-task", 0);//0 -> wnr recommended
store.set("default-task", -1);//-1: not set yet
} else predefinedTasks = store.get("predefined-tasks", predefinedTasks);//init predefined tasks
if (store.get("worktime")) {
predefinedTasks.push({
Expand Down Expand Up @@ -700,7 +704,6 @@ function settings(mode) {
if (store.get("top") == true) settingsWin.setAlwaysOnTop(true);
settingsWin.once('ready-to-show', () => {
settingsWin.show();
//settingsWin.webContents.openDevTools()
})
settingsWin.on('closed', () => {
win.reload();
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wnr",
"version": "1.11.1",
"version": "1.11.2",
"description": "It's a timer app with strong expansibility for computers. The name is an abbr of \"Work and Rest\".",
"main": "main.js",
"scripts": {
Expand Down Expand Up @@ -32,7 +32,7 @@
"winreg": "1.2.4"
},
"devDependencies": {
"electron": "7.1.11",
"electron": "7.1.12",
"electron-builder": "22.3.2"
}
}
4 changes: 2 additions & 2 deletions settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<body>
<!-- loader -->
<div id="loader-wrapper">
<div id="loader-work"></div>
<div id="loader"></div>
<div class="loader-section section-left"></div>
<div class="loader-section section-right"></div>
</div>
Expand Down Expand Up @@ -310,7 +310,7 @@
<div id="locker">
<div class="align-content-center form-text">
<script>
document.write(i18n.__('locker-settings-tip-part-1') + i18n.__('locker-settings-tip-part-2') + '<span class="font-weight-bold text-muted">'
document.write(i18n.__('locker-settings-tip-part-1') + i18n.__('locker-settings-tip-part-2') + '<span class="font-weight-bold work">'
+ (store.get('islocked') ? i18n.__('on') : i18n.__('off')) + '</span>' + i18n.__('period-symbol'));
</script>
<br />
Expand Down
24 changes: 18 additions & 6 deletions timer.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ <h3>
else {
if (isend == 1) ipc.send('warning-giver-workend');
else ipc.send('warning-giver-restend');
var tempVariable = setTimeout(stopper, 500);
let stopperTimeout = setTimeout(stopper, 500);
ipc.once('warning-closed', function () {
player.loop = false;
player.pause();
Expand Down Expand Up @@ -294,11 +294,23 @@ <h3>
$("#skipper").css("display", "none");
$("#skipper-space").css("display", "none");
times++;
if (times < loop * 2) {
startTime = new Date().getTime();
themeChanger();
} else if (times == loop * 2) {
ender();
if (isClockWorking) {
if (times < loop * 2) {
startTime = new Date().getTime();
themeChanger();
} else if (times == loop * 2) {
ender();
}
} else {
stopper();
setTimeout(function () {
if (times < loop * 2) {
startTime = new Date().getTime();
themeChanger();
} else if (times == loop * 2) {
ender();
}
}, 250);
}
}

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -754,10 +754,10 @@ [email protected]:
conf "^6.2.0"
type-fest "^0.7.1"

[email protected].11:
version "7.1.11"
resolved "https://registry.npm.taobao.org/electron/download/electron-7.1.11.tgz#3a95e35804af083d58b590513afea5e2290c4b66"
integrity sha1-OpXjWASvCD1YtZBROv6l4ikMS2Y=
[email protected].12:
version "7.1.12"
resolved "https://registry.npm.taobao.org/electron/download/electron-7.1.12.tgz?cache=0&sync_timestamp=1581822947442&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Felectron%2Fdownload%2Felectron-7.1.12.tgz#7a9a416975f466b941c8ef1a48c5a50aefad494f"
integrity sha1-eppBaXX0ZrlByO8aSMWlCu+tSU8=
dependencies:
"@electron/get" "^1.0.1"
"@types/node" "^12.0.12"
Expand Down

0 comments on commit 2a3fca1

Please sign in to comment.