Test-page updated to allow the user open local PDFs
This commit is contained in:
parent
7fb6c434c5
commit
327e36b347
10
test.html
10
test.html
@ -46,13 +46,16 @@ function queryParams() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var canvas, numPages, pageDisplay, pageNum;
|
var canvas, numPages, pageDisplay, pageNum;
|
||||||
function load() {
|
function load(userInput) {
|
||||||
canvas = document.getElementById("canvas");
|
canvas = document.getElementById("canvas");
|
||||||
canvas.mozOpaque = true;
|
canvas.mozOpaque = true;
|
||||||
pageDisplay = document.getElementById("pageNumber");
|
pageDisplay = document.getElementById("pageNumber");
|
||||||
infoDisplay = document.getElementById("info");
|
infoDisplay = document.getElementById("info");
|
||||||
pageNum = parseInt(queryParams().page) || 1;
|
pageNum = parseInt(queryParams().page) || 1;
|
||||||
fileName = queryParams().file || "compressed.tracemonkey-pldi-09.pdf";
|
fileName = userInput;
|
||||||
|
if(!userInput){
|
||||||
|
fileName = queryParams().file || "compressed.tracemonkey-pldi-09.pdf";
|
||||||
|
}
|
||||||
open(fileName);
|
open(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,6 +135,9 @@ function gotoPage(num) {
|
|||||||
|
|
||||||
<body onload="load();">
|
<body onload="load();">
|
||||||
<div id="controls">
|
<div id="controls">
|
||||||
|
<input type="file" style="float: right; margin: auto 32px;" onChange="load(this.value.toString());"></input>
|
||||||
|
<!-- This only opens supported PDFs from the source path...
|
||||||
|
-- Can we use JSONP to overcome the same-origin restrictions? -->
|
||||||
<button onclick="prevPage();">Previous</button>
|
<button onclick="prevPage();">Previous</button>
|
||||||
<button onclick="nextPage();">Next</button>
|
<button onclick="nextPage();">Next</button>
|
||||||
<input type="text" id="pageNumber" onchange="gotoPage(this.value);"
|
<input type="text" id="pageNumber" onchange="gotoPage(this.value);"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user