Created
November 19, 2012 08:57
-
-
Save shunito/4109674 to your computer and use it in GitHub Desktop.
EPUB Event Logger
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
<?xml version="1.0" encoding="utf-8"?> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="ja" class="hltr"> | |
<head> | |
<meta charset="UTF-8" /> | |
<link rel="stylesheet" type="text/css" href="../style/book-style.css" /> | |
<title>Event Logger</title> | |
<script type="text/javascript"> | |
<![CDATA[ | |
window.onload = function(){ | |
var result = document.getElementById("result"), | |
exclude = [], | |
obj; | |
// 除外イベント | |
exclude.push("deviceorientation"); | |
exclude.push("devicemotion"); | |
function eventDamp(e){ | |
var line = "Fire: "; | |
var t = new Date(); | |
var p = document.createElement('p'); | |
// console.log( e ); | |
if ( e.timeStamp && exclude.indexOf( e.type ) < 0 ) { | |
t.setTime( e.timeStamp ); | |
line += [ t.getHours(),t.getMinutes(), t.getSeconds(), t.getMilliseconds() ].join(":"); | |
line += [ " - ", e.type ,"<br />" ].join(""); | |
p.innerHTML = line; | |
result.insertBefore(p, result.firstChild); | |
} | |
} | |
for ( obj in window ) { | |
if(obj.substr(0,2) === "on" ) { | |
window[ obj ] = function(obj){ | |
eventDamp( obj ); | |
} | |
} | |
} | |
// window.onload | |
var line = "Fire: "; | |
var t = new Date(); | |
var p = document.createElement('p'); | |
line += [ t.getHours(),t.getMinutes(), t.getSeconds(), t.getMilliseconds() ].join(":"); | |
line += [ " - window.onload<br />" ].join(""); | |
p.innerHTML = line; | |
result.insertBefore(p, result.firstChild); | |
} | |
]]> | |
</script> | |
</head> | |
<body class="p-text"> | |
<div class="main"> | |
<h1 id="toc-001">Event Logger page 1</h1> | |
<div id="result"></div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment