user-changes to pageNumber are working

This commit is contained in:
Artur Adib 2012-04-12 17:57:52 -07:00
parent d94709c2f0
commit d5f296e404
3 changed files with 16 additions and 17 deletions

View File

@ -44,7 +44,6 @@ body {
width: 100%; width: 100%;
height: 32px; height: 32px;
z-index: 9999; z-index: 9999;
-moz-user-select:none;
cursor: default; cursor: default;
} }
@ -309,8 +308,6 @@ body {
line-height: 14px; line-height: 14px;
text-align: right; text-align: right;
outline-style: none; outline-style: none;
-moz-user-select:none;
cursor: default;
-moz-transition-property: background-color, border-color, box-shadow; -moz-transition-property: background-color, border-color, box-shadow;
-moz-transition-duration: 150ms; -moz-transition-duration: 150ms;
-moz-transition-timing-function: ease; -moz-transition-timing-function: ease;
@ -550,6 +547,12 @@ canvas {
line-height:1.3; line-height:1.3;
} }
/* TODO: file FF bug to support ::-moz-selection:window-inactive
so we can override the opaque grey background when the window is inactive;
see https://bugzilla.mozilla.org/show_bug.cgi?id=706209 */
::selection { background:rgba(0,0,255,0.3); }
::-moz-selection { background:rgba(0,0,255,0.3); }
.annotComment > div { .annotComment > div {
position: absolute; position: absolute;
} }
@ -578,9 +581,3 @@ canvas {
border-bottom: 1px solid #000000; border-bottom: 1px solid #000000;
margin: 0px; margin: 0px;
} }
/* TODO: file FF bug to support ::-moz-selection:window-inactive
so we can override the opaque grey background when the window is inactive;
see https://bugzilla.mozilla.org/show_bug.cgi?id=706209 */
::selection { background:rgba(0,0,255,0.3); }
::-moz-selection { background:rgba(0,0,255,0.3); }

View File

@ -56,13 +56,14 @@
<div class="splitToolbarButtonSeparator"></div> <div class="splitToolbarButtonSeparator"></div>
<div class="toolbarButton pageDown" title="Next Page" onclick="PDFView.page++"></div> <div class="toolbarButton pageDown" title="Next Page" onclick="PDFView.page++"></div>
</div> </div>
<div id="pageNumber" class="toolbarField" contentEditable="true"></div> <input type="number" id="pageNumber" class="toolbarField" onchange="PDFView.page = this.value;" value="1" size="4" min="1">
</input>
<div id="numPages" class="toolbarLabel"></div> <div id="numPages" class="toolbarLabel"></div>
<div class="toolbarButtonFlexibleSpacer"></div> <div class="toolbarButtonFlexibleSpacer"></div>
<div class="splitToolbarButton"> <div class="splitToolbarButton">
<div class="toolbarButton zoomOut" title="Zoom Out"></div> <div class="toolbarButton zoomOut" title="Zoom Out" onclick="PDFView.zoomOut();"></div>
<div class="splitToolbarButtonSeparator"></div> <div class="splitToolbarButtonSeparator"></div>
<div class="toolbarButton zoomIn" title="Zoom In"></div> <div class="toolbarButton zoomIn" title="Zoom In" onclick="PDFView.zoomIn();"></div>
</div> </div>
<div class="dropdownToolbarButton">Auto</div> <div class="dropdownToolbarButton">Auto</div>
<div class="toolbarButtonFlexibleSpacer"></div> <div class="toolbarButtonFlexibleSpacer"></div>
@ -121,13 +122,13 @@
<div class="separator"></div> <div class="separator"></div>
<button id="zoomOut" title="Zoom Out" onclick="PDFView.zoomOut();" oncontextmenu="return false;"> <!-- <button id="zoomOut" title="Zoom Out" onclick="PDFView.zoomOut();" oncontextmenu="return false;">
<img src="images/zoom-out.svg" align="top" height="16"/> <img src="images/zoom-out.svg" align="top" height="16"/>
</button> </button>
<button id="zoomIn" title="Zoom In" onclick="PDFView.zoomIn();" oncontextmenu="return false;"> <button id="zoomIn" title="Zoom In" onclick="PDFView.zoomIn();" oncontextmenu="return false;">
<img src="images/zoom-in.svg" align="top" height="16"/> <img src="images/zoom-in.svg" align="top" height="16"/>
</button> </button>
-->
<div class="separator"></div> <div class="separator"></div>
<select id="scaleSelect" onchange="PDFView.parseScale(this.value);" oncontextmenu="return false;"> <select id="scaleSelect" onchange="PDFView.parseScale(this.value);" oncontextmenu="return false;">

View File

@ -276,7 +276,7 @@ var PDFView = {
set page(val) { set page(val) {
var pages = this.pages; var pages = this.pages;
var input = parseInt(document.getElementById('pageNumber')); var input = document.getElementById('pageNumber');
if (!(0 < val && val <= pages.length)) { if (!(0 < val && val <= pages.length)) {
var event = document.createEvent('UIEvents'); var event = document.createEvent('UIEvents');
event.initUIEvent('pagechange', false, false, window, 0); event.initUIEvent('pagechange', false, false, window, 0);
@ -499,6 +499,7 @@ var PDFView = {
var id = pdf.fingerprint; var id = pdf.fingerprint;
var storedHash = null; var storedHash = null;
document.getElementById('numPages').textContent = '/ '+pagesCount; document.getElementById('numPages').textContent = '/ '+pagesCount;
document.getElementById('pageNumber').max = pagesCount;
PDFView.documentFingerprint = id; PDFView.documentFingerprint = id;
var store = PDFView.store = new Settings(id); var store = PDFView.store = new Settings(id);
if (store.get('exists', false)) { if (store.get('exists', false)) {
@ -1451,8 +1452,8 @@ window.addEventListener('scalechange', function scalechange(evt) {
window.addEventListener('pagechange', function pagechange(evt) { window.addEventListener('pagechange', function pagechange(evt) {
var page = evt.pageNumber; var page = evt.pageNumber;
if (parseInt(document.getElementById('pageNumber').textContent) != page) if (document.getElementById('pageNumber').value != page)
document.getElementById('pageNumber').textContent = page; document.getElementById('pageNumber').value = page;
document.getElementById('previous').disabled = (page <= 1); document.getElementById('previous').disabled = (page <= 1);
document.getElementById('next').disabled = (page >= PDFView.pages.length); document.getElementById('next').disabled = (page >= PDFView.pages.length);
}, true); }, true);