Changed the zoom input to utilize a pre-populated combo box.
This commit is contained in:
parent
9477df21ce
commit
cf0e22ffaf
5 changed files with 106 additions and 7 deletions
|
@ -8,9 +8,10 @@ var PDFViewer = {
|
|||
|
||||
element: null,
|
||||
|
||||
pageNumberInput: null,
|
||||
previousPageButton: null,
|
||||
nextPageButton: null,
|
||||
pageNumberInput: null,
|
||||
scaleInput: null,
|
||||
|
||||
willJumpToPage: false,
|
||||
|
||||
|
@ -158,6 +159,8 @@ var PDFViewer = {
|
|||
PDFViewer.drawPage(1);
|
||||
}
|
||||
}
|
||||
|
||||
PDFViewer.scaleInput.value = Math.floor(PDFViewer.scale * 100) + '%';
|
||||
},
|
||||
|
||||
goToPage: function(num) {
|
||||
|
@ -317,13 +320,40 @@ window.onload = function() {
|
|||
this.className = (this.className.indexOf('disabled') !== -1) ? 'disabled' : '';
|
||||
};
|
||||
|
||||
var scaleInput = document.getElementById('scale');
|
||||
scaleInput.onchange = function(evt) {
|
||||
PDFViewer.changeScale(this.value);
|
||||
PDFViewer.scaleInput = document.getElementById('scale');
|
||||
PDFViewer.scaleInput.buttonElement = document.getElementById('scaleComboBoxButton');
|
||||
PDFViewer.scaleInput.buttonElement.listElement = document.getElementById('scaleComboBoxList');
|
||||
PDFViewer.scaleInput.onchange = function(evt) {
|
||||
PDFViewer.changeScale(parseInt(this.value));
|
||||
};
|
||||
|
||||
PDFViewer.scaleInput.buttonElement.onclick = function(evt) {
|
||||
this.listElement.style.display = (this.listElement.style.display === 'block') ? 'none' : 'block';
|
||||
};
|
||||
PDFViewer.scaleInput.buttonElement.onmousedown = function(evt) {
|
||||
if (this.className.indexOf('disabled') === -1) {
|
||||
this.className = 'down';
|
||||
}
|
||||
};
|
||||
PDFViewer.scaleInput.buttonElement.onmouseup = function(evt) {
|
||||
this.className = (this.className.indexOf('disabled') !== -1) ? 'disabled' : '';
|
||||
};
|
||||
PDFViewer.scaleInput.buttonElement.onmouseout = function(evt) {
|
||||
this.className = (this.className.indexOf('disabled') !== -1) ? 'disabled' : '';
|
||||
};
|
||||
|
||||
var listItems = PDFViewer.scaleInput.buttonElement.listElement.getElementsByTagName('LI');
|
||||
|
||||
for (var i = 0; i < listItems.length; i++) {
|
||||
var listItem = listItems[i];
|
||||
listItem.onclick = function(evt) {
|
||||
PDFViewer.changeScale(parseInt(this.innerHTML));
|
||||
PDFViewer.scaleInput.buttonElement.listElement.style.display = 'none';
|
||||
};
|
||||
}
|
||||
|
||||
PDFViewer.pageNumber = parseInt(PDFViewer.queryParams.page) || PDFViewer.pageNumber;
|
||||
PDFViewer.scale = parseInt(scaleInput.value) / 100 || 1.0;
|
||||
PDFViewer.scale = parseInt(PDFViewer.scaleInput.value) / 100 || 1.0;
|
||||
PDFViewer.open(PDFViewer.queryParams.file || PDFViewer.url);
|
||||
|
||||
window.onscroll = function(evt) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue