This commit is contained in:
Lu Wang 2013-10-21 23:08:48 +08:00
commit 028d71393c
12 changed files with 2234 additions and 18 deletions

2182
3rdparty/closure-compiler/jquery-1.9.js vendored Normal file

File diff suppressed because it is too large Load Diff

21
3rdparty/jQuery/MIT-LICENSE.txt vendored Normal file
View File

@ -0,0 +1,21 @@
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.

5
3rdparty/jQuery/jquery-1.9.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -241,9 +241,9 @@ add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.js
install (TARGETS pdf2htmlEX DESTINATION bin)
set(PDF2HTMLEX_RESOURCE
${CMAKE_SOURCE_DIR}/3rdparty/jQuery/jquery-1.9.1.min.js
${CMAKE_SOURCE_DIR}/share/base.css
${CMAKE_SOURCE_DIR}/share/fancy.css
${CMAKE_SOURCE_DIR}/share/jquery.js
${CMAKE_SOURCE_DIR}/share/LICENSE
${CMAKE_SOURCE_DIR}/share/manifest
${CMAKE_SOURCE_DIR}/share/pdf2htmlEX.js

View File

@ -1,4 +1,5 @@
Developing v0.11
* Compress JS with closure-compiler
v0.10

3
TODO
View File

@ -1,7 +1,6 @@
packaging for 13.10
merge js into one
annot for closure-compiler:https://developers.google.com/closure/compiler/docs/js-for-compiler#generics
update jquery -> CDN
remove default type declaration: text/javascript text/css
minimize css
pdf:mobile device
pdf:miui

View File

@ -3,9 +3,6 @@ All files in this directory are licensed under MIT License
Files: *
Copyright (c) 2012,2013 Lu Wang <coolwanglu@gmail.com> and other contributors
File: jquery.js
Copyright 2012 jQuery Foundation and other contributors
SVG patterns used in fancy.css
Copyright (c) 2011 Lea Verou, http://lea.verou.me/

2
share/jquery.js vendored

File diff suppressed because one or more lines are too long

View File

@ -7,13 +7,14 @@
BASEDIR=$(dirname $0)
CLOSURE_COMPILER_DIR="$BASEDIR/../../3rdparty/closure-compiler"
OUTPUT="$BASEDIR/../pdf2htmlEX.js"
(echo 'Building pdf2htmlEX.js with closure-compiler...' && \
java -jar "$BASEDIR/../../3rdparty/closure-compiler/compiler.jar" \
java -jar "$CLOSURE_COMPILER_DIR/compiler.jar" \
--compilation_level ADVANCED_OPTIMIZATIONS \
--process_jquery_primitives \
--externs "$BASEDIR/../jquery.js" \
--externs "$CLOSURE_COMPILER_DIR/jquery-1.9.js" \
--js "$BASEDIR/header.js" \
--js "$BASEDIR/css_class_names.js" \
--js "$BASEDIR/viewer.js" \

View File

@ -169,6 +169,9 @@
/* export pdf2htmlEX.Viewer */
var Viewer = pdf2htmlEX['Viewer'] = function(config) {
/* do nothing if jQuery is not ready */
if(!window.jQuery) return;
this.config = $.extend({}, DEFAULT_CONFIG, config);
this.pages_loading = {};
this.init_before_loading_content();

View File

@ -36,14 +36,23 @@ $css
#############
# UI stuffs, optional
# It'll be better to include a static jquery.js on your server
@jquery.js
@pdf2htmlEX.js
# entry point
# jQuery, required by pdf2htmlEX.js
# By default a local copy is embedded or linked to.
#
# You can also link to a static file from your server or a CDN such that
# - the size of output HTML is reduced
# - users can be benefited from the static URL (e.g. caching)
# Example:
# <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
@jquery-1.9.1.min.js
# entry point of pdf2htmlEX.Viewer
# You can override default configuration by passing an object to the constructor of Viewer
# Refer to DEFAULT_CONFIG in viewer.js for possible keys
@pdf2htmlEX.js
"""
<script type="text/javascript">
<script>
try{
pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer();
}catch(e){}

View File

@ -26,12 +26,12 @@ const std::map<std::string, EmbedStringEntry> EMBED_STRING_MAP({
{".css", {&Param::embed_css,
"<style type=\"text/css\">",
"</style>", false,
"<link rel=\"stylesheet\" type=\"text/css\" href=\"",
"<link rel=\"stylesheet\" href=\"",
"\"/>" }},
{".js", {&Param::embed_javascript,
"<script type=\"text/javascript\">",
"<script>",
"</script>", false,
"<script type=\"text/javascript\" src=\"",
"<script src=\"",
"\"></script>" }},
{".png", {&Param::embed_image,
"<img alt=\"\" src=\"data:image/png;base64,",