mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 04:50:09 +00:00
clean js
This commit is contained in:
parent
c57085f600
commit
8d2b6d0308
@ -5,6 +5,8 @@ Developing v0.11
|
|||||||
* Remove jQuery
|
* Remove jQuery
|
||||||
* Lots of JS code cleaning
|
* Lots of JS code cleaning
|
||||||
* Enable global key handler by default
|
* Enable global key handler by default
|
||||||
|
* Use WOFF by default
|
||||||
|
* Always generate TTF before the final output
|
||||||
|
|
||||||
v0.10
|
v0.10
|
||||||
2013.10.17
|
2013.10.17
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* configurations of Viewer
|
||||||
* @const
|
* @const
|
||||||
* @dict
|
* @dict
|
||||||
*/
|
*/
|
||||||
@ -219,7 +220,7 @@
|
|||||||
var p = this.p;
|
var p = this.p;
|
||||||
var c = p.parentNode;
|
var c = p.parentNode;
|
||||||
return [ c.scrollLeft - p.offsetLeft - p.clientLeft
|
return [ c.scrollLeft - p.offsetLeft - p.clientLeft
|
||||||
, c.scrollTop - p.offsetTop - p.clientTop];
|
, c.scrollTop - p.offsetTop - p.clientTop ];
|
||||||
},
|
},
|
||||||
height : function () {
|
height : function () {
|
||||||
return this.p.clientHeight;
|
return this.p.clientHeight;
|
||||||
@ -358,9 +359,6 @@
|
|||||||
xhr.open('GET', url, true);
|
xhr.open('GET', url, true);
|
||||||
xhr.onreadystatechange = function(){
|
xhr.onreadystatechange = function(){
|
||||||
if(xhr.readyState != 4) return;
|
if(xhr.readyState != 4) return;
|
||||||
// Reset loading token
|
|
||||||
delete _.pages_loading[_idx];
|
|
||||||
|
|
||||||
if(xhr.status == 200) {
|
if(xhr.status == 200) {
|
||||||
// find the page element in the data
|
// find the page element in the data
|
||||||
var div = document.createElement('div');
|
var div = document.createElement('div');
|
||||||
@ -394,6 +392,9 @@
|
|||||||
|
|
||||||
if(callback){ callback(p); }
|
if(callback){ callback(p); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset loading token
|
||||||
|
delete _.pages_loading[_idx];
|
||||||
};
|
};
|
||||||
xhr.send(null);
|
xhr.send(null);
|
||||||
}
|
}
|
||||||
@ -406,19 +407,26 @@
|
|||||||
this.load_page(idx+1, pages_to_preload);
|
this.load_page(idx+1, pages_to_preload);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hide all pages that have no 'opened' class
|
||||||
|
* The 'opened' class will be added to visible pages by JavaScript
|
||||||
|
* We cannot add this in the default CSS because JavaScript may be disabled
|
||||||
|
*/
|
||||||
pre_hide_pages : function() {
|
pre_hide_pages : function() {
|
||||||
/* pages might have not been loaded yet, so add a CSS rule */
|
/* pages might have not been loaded yet, so add a CSS rule */
|
||||||
var s = '@media screen{.'+CSS_CLASS_NAMES.page_content_box+'{display:none;}}';
|
var s = '@media screen{.'+CSS_CLASS_NAMES.page_content_box+'{display:none;}}';
|
||||||
var n = document.createElement('style');
|
var n = document.createElement('style');
|
||||||
n.type = 'text/css';
|
|
||||||
if (n.styleSheet) {
|
if (n.styleSheet) {
|
||||||
n.styleSheet.cssText = s;
|
n.styleSheet.cssText = s;
|
||||||
} else {
|
} else {
|
||||||
n.appendChild(document.createTextNode(s));
|
n.appendChild(document.createTextNode(s));
|
||||||
}
|
}
|
||||||
document.getElementsByTagName('head')[0].appendChild(n);
|
document.head.appendChild(n);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/*
|
||||||
|
* show visible pages and hide invisible pages
|
||||||
|
*/
|
||||||
render : function () {
|
render : function () {
|
||||||
/* hide (positional) invisible pages */
|
/* hide (positional) invisible pages */
|
||||||
var pl = this.pages;
|
var pl = this.pages;
|
||||||
|
Loading…
Reference in New Issue
Block a user