Skip to content

Instantly share code, notes, and snippets.

@HAYASAKA-Ryosuke
Created September 20, 2015 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HAYASAKA-Ryosuke/f5ce6d9f743067e64c59 to your computer and use it in GitHub Desktop.
Save HAYASAKA-Ryosuke/f5ce6d9f743067e64c59 to your computer and use it in GitHub Desktop.
<html>
<head>
<meta charset="UTF-8">
<title>ラーメンタイマ</title>
<style>
body {
-webkit-app-region: drag;
-webkit-user-select: none;
}
</style>
</head>
<body>
<div id="notification"></div>
<div id="complete"></div>
<h1><div id="output"></div></h1>
</body>
<script src="ramen.js"></script>
</html>
'use strict';
var app = require('app');
var BrowserWindow = require('browser-window');
require('crash-reporter').start();
var mainWindow = null;
app.on('window-all-closed', function(){
if(process.platform != 'darwin'){
app.quit();
}
});
app.on('ready', function(){
mainWindow = new BrowserWindow({width: 120, height: 80, transparent: true, frame: false});
mainWindow.loadUrl('file://' + __dirname + '/index.html');
mainWindow.on('closed', function(){
mainWindow = null;
});
});
{
"name": "ramentimer",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
"use strict";
function complete_notification() {
var n = new Notification('Electron!!', {
body: '3分経ちました!'
});
}
var i = 180; //3分固定
function count(){
if(i <= 0){
document.getElementById("output").innerHTML = "完成!";
document.getElementById("complete").innerHTML = "<audio src='./media/complete.mp3' autoplay loop></audio>"
complete_notification();
}else{
document.getElementById("output").innerHTML = i + "s";
}
i -= 1;
}
window.onload = function(){
setInterval("count()", 1000);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment