1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-21 20:50:07 +00:00
This commit is contained in:
Lu Wang 2013-11-15 22:27:53 +08:00
parent 237559e808
commit 32366bf580
3 changed files with 36 additions and 34 deletions

4
TODO
View File

@ -10,8 +10,7 @@ more information on demo page:
pdf:miui pdf:miui
tmp dir: use pid tmp dir: use pid
view hash view hash
- store a separate map/dict for 'original' page number position history stack (popstate)
- OR adjust all destinations
- dots issue - dots issue
- AdobeXML*.pdf - AdobeXML*.pdf
@ -33,7 +32,6 @@ Not enough motivation/Lazy
- detect duplicate base fonts when embedding - detect duplicate base fonts when embedding
- disable selection if we know unicode is wrong - disable selection if we know unicode is wrong
- check if we can add information to the font, and let browsers show ligatures automatically - check if we can add information to the font, and let browsers show ligatures automatically
- position history stack (popstate)
- draw non-orthogonal lines with CSS - draw non-orthogonal lines with CSS
- precise link destination: zoom - precise link destination: zoom
- multiple charcode mapped to a same glyph - multiple charcode mapped to a same glyph

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
pdf2htmlex (0.11-1~git201311150048r23755-0ubuntu1) saucy; urgency=low
* Fix packaging
-- WANG Lu <coolwanglu@gmail.com> Fri, 15 Nov 2013 00:48:06 +0800
pdf2htmlex (0.11-1~git201311042119refddc-0ubuntu1) saucy; urgency=low pdf2htmlex (0.11-1~git201311042119refddc-0ubuntu1) saucy; urgency=low
* Packaging for 13.10 * Packaging for 13.10

View File

@ -235,9 +235,9 @@ function Viewer(config) {
this.pages_loading = []; this.pages_loading = [];
this.init_before_loading_content(); this.init_before_loading_content();
var _ = this; var self = this;
document.addEventListener('DOMContentLoaded', function(){ document.addEventListener('DOMContentLoaded', function(){
_.init_after_loading_content(); self.init_after_loading_content();
}, false); }, false);
}; };
@ -282,14 +282,14 @@ Viewer.prototype = {
// register schedule rendering // register schedule rendering
// renew old schedules since scroll() may be called frequently // renew old schedules since scroll() may be called frequently
var _ = this; var self = this;
this.container.addEventListener('scroll', function() { this.container.addEventListener('scroll', function() {
_.schedule_render(true); self.schedule_render(true);
}, false); }, false);
// handle links // handle links
[this.container, this.outline].forEach(function(ele) { [this.container, this.outline].forEach(function(ele) {
ele.addEventListener('click', _.link_handler.bind(_), false); ele.addEventListener('click', self.link_handler.bind(self), false);
}); });
this.render(); this.render();
@ -346,12 +346,10 @@ Viewer.prototype = {
if (url) { if (url) {
this.pages_loading[idx] = true; // set semaphore this.pages_loading[idx] = true; // set semaphore
/* closure variables */
var _ = this;
var _idx = idx;
// load data // load data
{ {
var self = this;
var _idx = idx;
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open('GET', url, true); xhr.open('GET', url, true);
xhr.onreadystatechange = function(){ xhr.onreadystatechange = function(){
@ -374,24 +372,24 @@ Viewer.prototype = {
// replace the old page with loaded data // replace the old page with loaded data
// the loading indicator on this page should also be destroyed // the loading indicator on this page should also be destroyed
var p = _.pages[_idx]; var p = self.pages[_idx];
_.container.replaceChild(new_page, p.page); self.container.replaceChild(new_page, p.page);
p = new Page(new_page); p = new Page(new_page);
_.pages[_idx] = p; self.pages[_idx] = p;
p.hide(); p.hide();
p.rescale(_.scale); p.rescale(self.scale);
// disable background image dragging // disable background image dragging
disable_dragstart(new_page.getElementsByClassName(CSS_CLASS_NAMES.background_image)); disable_dragstart(new_page.getElementsByClassName(CSS_CLASS_NAMES.background_image));
_.schedule_render(false); self.schedule_render(false);
if (callback){ callback(p); } if (callback){ callback(p); }
} }
// Reset loading token // Reset loading token
delete _.pages_loading[_idx]; delete self.pages_loading[_idx];
}; };
xhr.send(null); xhr.send(null);
} }
@ -490,14 +488,14 @@ Viewer.prototype = {
clearTimeout(this.render_timer); clearTimeout(this.render_timer);
} }
var _ = this; var self = this;
this.render_timer = setTimeout(function () { this.render_timer = setTimeout(function () {
/* /*
* render() may trigger load_page(), which may in turn trigger another render() * render() may trigger load_page(), which may in turn trigger another render()
* so delete render_timer first * so delete render_timer first
*/ */
delete _.render_timer; delete self.render_timer;
_.render(); self.render();
}, this.config['render_timeout']); }, this.config['render_timeout']);
}, },
@ -511,12 +509,12 @@ Viewer.prototype = {
* *
* Code credit to PDF.js * Code credit to PDF.js
*/ */
var _ = this; var self = this;
// Firefox specific event, so that we can prevent browser from zooming // Firefox specific event, so that we can prevent browser from zooming
window.addEventListener('DOMMouseScroll', function(e) { window.addEventListener('DOMMouseScroll', function(e) {
if (e.ctrlKey) { if (e.ctrlKey) {
e.preventDefault(); e.preventDefault();
_.rescale(Math.pow(_.config['scale_step'], e.detail), true); self.rescale(Math.pow(self.config['scale_step'], e.detail), true);
} }
}, false); }, false);
@ -536,7 +534,7 @@ Viewer.prototype = {
case 107: // FF '+' and '=' case 107: // FF '+' and '='
case 187: // Chrome '+' case 187: // Chrome '+'
if (with_ctrl){ if (with_ctrl){
_.rescale(1.0 / _.config['scale_step'], true); self.rescale(1.0 / self.config['scale_step'], true);
handled = true; handled = true;
} }
break; break;
@ -544,38 +542,38 @@ Viewer.prototype = {
case 109: // FF '-' case 109: // FF '-'
case 189: // Chrome '-' case 189: // Chrome '-'
if (with_ctrl){ if (with_ctrl){
_.rescale(_.config['scale_step'], true); self.rescale(self.config['scale_step'], true);
handled = true; handled = true;
} }
break; break;
case 48: // '0' case 48: // '0'
if (with_ctrl){ if (with_ctrl){
_.rescale(0, false); self.rescale(0, false);
handled = true; handled = true;
} }
break; break;
case 33: // Page UP: case 33: // Page UP:
if (with_alt) { // alt-pageup -> scroll one page up if (with_alt) { // alt-pageup -> scroll one page up
_.scroll_to(_.cur_page_idx - 1); self.scroll_to(self.cur_page_idx - 1);
} else { // pageup -> scroll one screen up } else { // pageup -> scroll one screen up
_.container.scrollTop -= _.container.clientHeight; self.container.scrollTop -= self.container.clientHeight;
} }
handled = true; handled = true;
break; break;
case 34: // Page DOWN case 34: // Page DOWN
if (with_alt) { // alt-pagedown -> scroll one page down if (with_alt) { // alt-pagedown -> scroll one page down
_.scroll_to(_.cur_page_idx + 1); self.scroll_to(self.cur_page_idx + 1);
} else { // pagedown -> scroll one screen down } else { // pagedown -> scroll one screen down
_.container.scrollTop += _.container.clientHeight; self.container.scrollTop += self.container.clientHeight;
} }
handled = true; handled = true;
break; break;
case 35: // End case 35: // End
_.container.scrollTop = _.container.scrollHeight; self.container.scrollTop = self.container.scrollHeight;
handled = true; handled = true;
break; break;
case 36: // Home case 36: // Home
_.container.scrollTop = 0; self.container.scrollTop = 0;
handled = true; handled = true;
break; break;
} }
@ -747,7 +745,7 @@ Viewer.prototype = {
if (ok) { if (ok) {
this.rescale(zoom, false); this.rescale(zoom, false);
var _ = this; var self = this;
/** /**
* page should of type Page * page should of type Page
* @param{Page} page * @param{Page} page
@ -757,7 +755,7 @@ Viewer.prototype = {
if (upside_down) { if (upside_down) {
pos[1] = page.original_height - pos[1]; pos[1] = page.original_height - pos[1];
} }
_.scroll_to(target_page_idx, pos); self.scroll_to(target_page_idx, pos);
}; };
if (target_page.loaded) { if (target_page.loaded) {