Remove ids from viewer page and thumbnail divs

The id, and parsing it for the page number, is replaced by the
data-page-number attribute (added here for thumbnails).
This commit is contained in:
Dave House 2017-01-18 17:02:11 -07:00
parent a917443ae6
commit 52360694b0
No known key found for this signature in database
GPG Key ID: 28734DBB852AB21D
3 changed files with 3 additions and 3 deletions

View File

@ -112,7 +112,6 @@ var PDFPageView = (function PDFPageViewClosure() {
this.annotationLayer = null;
var div = document.createElement('div');
div.id = 'pageContainer' + this.id;
div.className = 'page';
div.style.width = Math.floor(this.viewport.width) + 'px';
div.style.height = Math.floor(this.viewport.height) + 'px';

View File

@ -124,8 +124,8 @@ var PDFThumbnailView = (function PDFThumbnailViewClosure() {
this.anchor = anchor;
var div = document.createElement('div');
div.id = 'thumbnailContainer' + id;
div.className = 'thumbnail';
div.setAttribute('data-page-number', this.id);
this.div = div;
if (id === 1) {

View File

@ -87,7 +87,8 @@ var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() {
if (selected) {
selected.classList.remove('selected');
}
var thumbnail = document.getElementById('thumbnailContainer' + page);
var thumbnail = document.querySelector(
'div.thumbnail[data-page-number="' + page + '"]');
if (thumbnail) {
thumbnail.classList.add('selected');
}