1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-02 16:25:41 +00:00

remove jquery

This commit is contained in:
Lu Wang 2013-11-06 04:08:39 +08:00
parent 06ed27011c
commit b177bf634d
6 changed files with 43 additions and 2258 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +0,0 @@
Copyright 2013 jQuery Foundation and other contributors
http://jquery.com/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

File diff suppressed because one or more lines are too long

View File

@ -253,7 +253,6 @@ add_custom_command(OUTPUT
install (TARGETS pdf2htmlEX DESTINATION bin)
set(PDF2HTMLEX_RESOURCE
${CMAKE_SOURCE_DIR}/3rdparty/jQuery/jquery-1.9.1.min.js
${CMAKE_SOURCE_DIR}/3rdparty/PDF.js/compatibility.min.js
${CMAKE_SOURCE_DIR}/share/base.css
${CMAKE_SOURCE_DIR}/share/fancy.css

View File

@ -9,7 +9,6 @@
BASEDIR=$(dirname $0)
CLOSURE_COMPILER_DIR="$BASEDIR/../3rdparty/closure-compiler"
CLOSURE_COMPILER_JAR="$CLOSURE_COMPILER_DIR/compiler.jar"
EXTERNS="$CLOSURE_COMPILER_DIR/jquery-1.9.js"
INPUT="$BASEDIR/pdf2htmlEX.js"
OUTPUT_FN="pdf2htmlEX.min.js"
OUTPUT="$BASEDIR/$OUTPUT_FN"
@ -19,7 +18,6 @@ OUTPUT="$BASEDIR/$OUTPUT_FN"
--compilation_level ADVANCED_OPTIMIZATIONS \
--warning_level VERBOSE \
--process_jquery_primitives \
--externs "$EXTERNS" \
--js "$INPUT" \
--js_output_file "$OUTPUT" && \
echo 'Done.') || \

View File

@ -6,11 +6,6 @@
* https://github.com/coolwanglu/pdf2htmlEX/blob/master/share/LICENSE
*/
/*
* Dependencies:
* jQuery - use it only when necessary
*/
/*
* Attention:
* This files is to be optimized by closure-compiler,
@ -239,9 +234,6 @@
* @constructor
*/
function Viewer(config) {
/* do nothing if jQuery is not ready */
if(!jQuery) return;
this.config = clone_and_extend_objs(DEFAULT_CONFIG, config);
this.pages_loading = [];
this.init_before_loading_content();
@ -364,48 +356,51 @@
var _ = this;
var _idx = idx;
$.ajax({
url: url,
dataType: 'text'
}).done(function(data){
// find the page element in the data
var div = document.createElement('div');
div.innerHTML = data;
// load data
{
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onreadystatechange = function(){
if(xhr.readyState != 4) return;
// Reset loading token
delete _.pages_loading[idx];
var new_page = null;
var nodes = div.childNodes;
for(var i = 0, l = nodes.length; i < l; ++i) {
var cur_node = nodes[i];
if((cur_node.nodeType == Node.ELEMENT_NODE)
&& cur_node.classList.contains(CSS_CLASS_NAMES.page_frame)) {
new_page = cur_node;
break;
if(xhr.status == 200) {
// find the page element in the data
var div = document.createElement('div');
div.innerHTML = xhr.responseText;
var new_page = null;
var nodes = div.childNodes;
for(var i = 0, l = nodes.length; i < l; ++i) {
var cur_node = nodes[i];
if((cur_node.nodeType == Node.ELEMENT_NODE)
&& cur_node.classList.contains(CSS_CLASS_NAMES.page_frame)) {
new_page = cur_node;
break;
}
}
// replace the old page with loaded data
// the loading indicator on this page should also be destroyed
var p = _.pages[_idx];
_.container.replaceChild(new_page, p.p);
p = new Page(new_page);
_.pages[_idx] = p;
p.hide();
p.rescale(_.scale);
// disable background image dragging
disable_dragstart(new_page.getElementsByClassName(CSS_CLASS_NAMES.background_image));
_.schedule_render(false);
if(callback){ callback(p); }
}
}
// replace the old page with loaded data
// the loading indicator on this page should also be destroyed
var p = _.pages[_idx];
_.container.replaceChild(new_page, p.p);
p = new Page(new_page);
_.pages[_idx] = p;
p.hide();
p.rescale(_.scale);
// disable background image dragging
disable_dragstart(new_page.getElementsByClassName(CSS_CLASS_NAMES.background_image));
_.schedule_render(false);
// Reset loading token
delete _.pages_loading[idx];
if(callback){ callback(p); }
}).fail(function(jqXHR, textStatus, errorThrown){
// Reset loading token
delete _.pages_loading[_idx];
});
};
xhr.send(null);
}
}
// Concurrent prefetch of the next pages
if (pages_to_preload === undefined)