From 3ed576b5c8dbcad72ed7ba71d122a30add2e400e Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Fri, 1 Mar 2013 14:02:11 +0800 Subject: [PATCH] disable backgruond image selection and dragging --- share/base.css.in | 4 ++++ share/pdf2htmlEX.js.in | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/share/base.css.in b/share/base.css.in index ff64b02..d7ad8c4 100644 --- a/share/base.css.in +++ b/share/base.css.in @@ -122,6 +122,10 @@ top:0; width:100%; height:100%; + -ms-user-select:none; + -moz-user-select:none; + -webkit-user-select:none; + user-select:none; } @media print { .@CSS_PAGE_DECORATION_CN@ { diff --git a/share/pdf2htmlEX.js.in b/share/pdf2htmlEX.js.in index 283dd99..900a080 100644 --- a/share/pdf2htmlEX.js.in +++ b/share/pdf2htmlEX.js.in @@ -15,6 +15,7 @@ var pdf2htmlEX = (function(){ page_decoration : '@CSS_PAGE_DECORATION_CN@', page_content_box : '@CSS_PAGE_CONTENT_BOX_CN@', page_data : '@CSS_PAGE_DATA_CN@', + background_image : '@CSS_BACKGROUND_IMAGE_CN@', link : '@CSS_LINK_CN@', __dummy__ : 'no comma' }; @@ -126,11 +127,12 @@ var pdf2htmlEX = (function(){ this.outline = $('#'+this.outline_id); this.container = $('#'+this.container_id); - // need a better design + // Open the outline if nonempty if(this.outline.children().length > 0) { this.outline.addClass('opened'); } + // collect pages var new_pages = new Array(); var pl= $('.'+CSS_CLASS_NAMES['page_frame'], this.container); /* don't use for(..in..) */ @@ -140,14 +142,18 @@ var pdf2htmlEX = (function(){ } this.pages = new_pages; + // register schedule rendering var _ = this; this.container.scroll(function(){ _.schedule_render(); }); //this.zoom_fixer(); - // used by outline/annot_link etc + // handle links this.container.add(this.outline).on('click', '.'+CSS_CLASS_NAMES['link'], this, this.link_handler); + // disable background image draging + $('.'+CSS_CLASS_NAMES['background_image'], this.container).on('dragstart', function(e){return false;}); + this.render(); }, pre_hide_pages : function() {