update jquery; include jquery from google cdn

This commit is contained in:
Lu Wang 2013-10-21 15:04:34 +08:00
parent 1d42f31fee
commit 8ba0ce3e25
10 changed files with 57 additions and 15 deletions

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,5 +1,7 @@
Developing v0.11
* Compress JS with closure-compiler
* Link to jQuery from Google CDN by default
v0.10
2013.10.17

2
TODO
View File

@ -1,6 +1,4 @@
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

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,28 @@ $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
# - the file from Google CDN is included, in order to reduce the size of output HTML
# - HTTP is always used in case the file is accessed locally
#
# You may embed the file (provided in pdf2htmlEX) into HTML:
# @jquery-1.9.1.min.js
#
# Or you may remove "http:" to match the protocol of the published HTML:
# <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
#
"""
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
"""
# 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,",