Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<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