This commit is contained in:
Kovid Goyal 2012-01-06 14:35:29 +05:30
parent a3cbcfb6a4
commit 3eb93282f6
2 changed files with 11 additions and 11 deletions

View File

@ -47,7 +47,6 @@ mark_and_reload = (evt) ->
ypos = window_ypos() ypos = window_ypos()
newloc = window.location.href.replace(/#.*$/, '') + "#" + ypos + epubcfi newloc = window.location.href.replace(/#.*$/, '') + "#" + ypos + epubcfi
window.location.replace(newloc) window.location.replace(newloc)
document.getElementById('current-cfi').innerHTML = window.current_cfi
window.location.reload() window.location.reload()
setTimeout(fn, 1) setTimeout(fn, 1)
@ -64,10 +63,11 @@ window.onload = ->
if r if r
window.current_cfi = r[2] window.current_cfi = r[2]
ypos = if r[1] then 0+r[1] else 0 ypos = if r[1] then 0+r[1] else 0
document.getElementById('current-cfi').innerHTML = window.current_cfi base = document.getElementById('first-h1').innerHTML
document.title = base + ": " + window.current_cfi
fn = () -> fn = () ->
show_cfi()
window_ypos(ypos) window_ypos(ypos)
setTimeout(show_cfi, 1)
setTimeout(fn, 100) setTimeout(fn, 100)
null null

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Testing CFI functionality</title> <title>Testing EPUB CFI</title>
<script type="text/javascript" src="cfi.coffee"></script> <script type="text/javascript" src="cfi.coffee"></script>
<script type="text/javascript" src="cfi-test.coffee"></script> <script type="text/javascript" src="cfi-test.coffee"></script>
<style type="text/css"> <style type="text/css">
@ -22,29 +22,29 @@
position:relative; position:relative;
} }
#current-cfi {
font-family: monospace;
border: solid 1px blue;
padding: 1em;
}
#overflow { #overflow {
max-height: 100px; max-height: 100px;
overflow: scroll; overflow: scroll;
border: solid 1px black; border: solid 1px black;
padding: 2em; padding: 2em;
} }
#whitespace { #whitespace {
border: 20px solid gray; border: 20px solid gray;
margin: 20px; margin: 20px;
padding: 20px; padding: 20px;
} }
#reset {
color: blue;
text-decoration: none
}
</style> </style>
</head> </head>
<body> <body>
<div id="container"> <div id="container">
<h1 id="first-h1">Testing EPUB CFI</h1> <h1 id="first-h1">Testing EPUB CFI</h1>
<div id="current-cfi">Current CFI:&nbsp;None</div> <p><a id="reset" href="/">Reset CFI to None</a></p>
<p><a href="/">Reset</a></p>
<h2>A div with scrollbars</h2> <h2>A div with scrollbars</h2>
<p>Scroll down and click on some elements. Make sure to hit both bold and not bold text</p> <p>Scroll down and click on some elements. Make sure to hit both bold and not bold text</p>
<div id="overflow">But I must explain to you how all this mistaken <div id="overflow">But I must explain to you how all this mistaken