updated build process
This commit is contained in:
parent
417c7b0300
commit
6c98b89cae
22 changed files with 71 additions and 596 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -3,3 +3,6 @@
|
|||
.DS_Store
|
||||
.project
|
||||
.settings
|
||||
|
||||
comicbook
|
||||
node_modules
|
||||
|
|
47
Makefile
47
Makefile
|
@ -1,26 +1,27 @@
|
|||
|
||||
SOURCES = lib/pixastic/pixastic.core.js \
|
||||
lib/pixastic/actions/brightness.js \
|
||||
lib/pixastic/actions/desaturate.js \
|
||||
lib/pixastic/actions/sharpen.js \
|
||||
lib/vendor/handlebars.runtime-1.0.rc.1.min.js \
|
||||
lib/templates.js \
|
||||
lib/ComicBook.js
|
||||
|
||||
all: reset lib/ComicBook.combined.js lib/ComicBook.min.js clean
|
||||
|
||||
lib/templates.js: templates/*.handlebars
|
||||
handlebars $< -f $@
|
||||
|
||||
lib/ComicBook.combined.js: ${SOURCES}
|
||||
cat > $@ $^
|
||||
|
||||
lib/ComicBook.min.js: lib/ComicBook.combined.js
|
||||
java -jar bin/closure-complier/compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --js $< --js_output_file $@
|
||||
|
||||
reset:
|
||||
touch lib/ComicBook.min.js
|
||||
rm lib/ComicBook.min.js
|
||||
build:
|
||||
@echo "Compiling Handlebars templates..."
|
||||
@./node_modules/.bin/handlebars templates/*.handlebars -f lib/templates.js
|
||||
@echo "Compiling and minifying javascript..."
|
||||
@mkdir -p comicbook/js/pixastic
|
||||
@cat lib/vendor/pixastic/pixastic.js lib/vendor/pixastic/pixastic.effects.js lib/vendor/pixastic/pixastic.worker.js lib/vendor/handlebars.runtime-1.0.rc.1.min.js lib/templates.js lib/ComicBook.js > comicbook/js/comicbook.js
|
||||
@cp lib/vendor/pixastic/pixastic.js comicbook/js/pixastic
|
||||
@cp lib/vendor/pixastic/pixastic.effects.js comicbook/js/pixastic
|
||||
@cp lib/vendor/pixastic/pixastic.worker.js comicbook/js/pixastic
|
||||
@cp lib/vendor/pixastic/pixastic.worker.control.js comicbook/js/pixastic
|
||||
@cp lib/vendor/pixastic/license-gpl-3.0.txt comicbook/js/pixastic
|
||||
@cp lib/vendor/pixastic/license-mpl.txt comicbook/js/pixastic
|
||||
@./node_modules/.bin/uglifyjs -nc comicbook/js/comicbook.js > comicbook/js/comicbook.min.js
|
||||
@echo "Compiling CSS..."
|
||||
@cat fonts/icomoon-toolbar/style.css css/reset.css css/styles.css css/toolbar.css > comicbook/comicbook.css
|
||||
@echo "Copying assets..."
|
||||
@cp -r css/img comicbook/img
|
||||
@cp -r fonts/icomoon-toolbar/fonts comicbook
|
||||
@cp -r fonts/icomoon-toolbar/license.txt comicbook/fonts
|
||||
@echo "Updating examples"
|
||||
cp -r comicbook examples
|
||||
@echo "Done"
|
||||
|
||||
clean:
|
||||
rm lib/ComicBook.combined.js
|
||||
rm -r comicbook
|
||||
rm -r examples/comicbook
|
||||
|
|
0
README.md
Executable file
0
README.md
Executable file
|
@ -1,202 +0,0 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -1,292 +0,0 @@
|
|||
/*
|
||||
* Copyright 2009 The Closure Compiler Authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// Contents
|
||||
//
|
||||
|
||||
The Closure Compiler performs checking, instrumentation, and
|
||||
optimizations on JavaScript code. The purpose of this README is to
|
||||
explain how to build and run the Closure Compiler.
|
||||
|
||||
The Closure Compiler requires Java 6 or higher.
|
||||
http://www.java.com/
|
||||
|
||||
|
||||
//
|
||||
// Building The Closure Compiler
|
||||
//
|
||||
|
||||
There are three ways to get a Closure Compiler executable.
|
||||
|
||||
1) Use one we built for you.
|
||||
|
||||
Pre-built Closure binaries can be found at
|
||||
http://code.google.com/p/closure-compiler/downloads/list
|
||||
|
||||
|
||||
2) Check out the source and build it with Apache Ant.
|
||||
|
||||
First, check out the full source tree of the Closure Compiler. There
|
||||
are instructions on how to do this at the project site.
|
||||
http://code.google.com/p/closure-compiler/source/checkout
|
||||
|
||||
Apache Ant is a cross-platform build tool.
|
||||
http://ant.apache.org/
|
||||
|
||||
At the root of the source tree, there is an Ant file named
|
||||
build.xml. To use it, navigate to the same directory and type the
|
||||
command
|
||||
|
||||
ant jar
|
||||
|
||||
This will produce a jar file called "build/compiler.jar".
|
||||
|
||||
|
||||
3) Check out the source and build it with Eclipse.
|
||||
|
||||
Eclipse is a cross-platform IDE.
|
||||
http://www.eclipse.org/
|
||||
|
||||
Under Eclipse's File menu, click "New > Project ..." and create a
|
||||
"Java Project." You will see an options screen. Give the project a
|
||||
name, select "Create project from existing source," and choose the
|
||||
root of the checked-out source tree as the existing directory. Verify
|
||||
that you are using JRE version 6 or higher.
|
||||
|
||||
Eclipse can use the build.xml file to discover rules. When you
|
||||
navigate to the build.xml file, you will see all the build rules in
|
||||
the "Outline" pane. Run the "jar" rule to build the compiler in
|
||||
build/compiler.jar.
|
||||
|
||||
|
||||
//
|
||||
// Running The Closure Compiler
|
||||
//
|
||||
|
||||
Once you have the jar binary, running the Closure Compiler is straightforward.
|
||||
|
||||
On the command line, type
|
||||
|
||||
java -jar compiler.jar
|
||||
|
||||
This starts the compiler in interactive mode. Type
|
||||
|
||||
var x = 17 + 25;
|
||||
|
||||
then hit "Enter", then hit "Ctrl-Z" (on Windows) or "Ctrl-D" (on Mac or Linux)
|
||||
and "Enter" again. The Compiler will respond:
|
||||
|
||||
var x=42;
|
||||
|
||||
The Closure Compiler has many options for reading input from a file,
|
||||
writing output to a file, checking your code, and running
|
||||
optimizations. To learn more, type
|
||||
|
||||
java -jar compiler.jar --help
|
||||
|
||||
You can read more detailed documentation about the many flags at
|
||||
http://code.google.com/closure/compiler/docs/gettingstarted_app.html
|
||||
|
||||
|
||||
//
|
||||
// Compiling Multiple Scripts
|
||||
//
|
||||
|
||||
If you have multiple scripts, you should compile them all together with
|
||||
one compile command.
|
||||
|
||||
java -jar compiler.jar --js=in1.js --js=in2.js ... --js_output_file=out.js
|
||||
|
||||
The Closure Compiler will concatenate the files in the order they're
|
||||
passed at the command line.
|
||||
|
||||
If you need to compile many, many scripts together, you may start to
|
||||
run into problems with managing dependencies between scripts. You
|
||||
should check out the Closure Library. It contains functions for
|
||||
enforcing dependencies between scripts, and a tool called calcdeps.py
|
||||
that knows how to give scripts to the Closure Compiler in the right
|
||||
order.
|
||||
|
||||
http://code.google.com/p/closure-library/
|
||||
|
||||
//
|
||||
// Licensing
|
||||
//
|
||||
|
||||
Unless otherwise stated, all source files are licensed under
|
||||
the Apache License, Version 2.0.
|
||||
|
||||
|
||||
-----
|
||||
Code under:
|
||||
src/com/google/javascript/rhino
|
||||
test/com/google/javascript/rhino
|
||||
|
||||
URL: http://www.mozilla.org/rhino
|
||||
Version: 1.5R3, with heavy modifications
|
||||
License: Netscape Public License and MPL / GPL dual license
|
||||
|
||||
Description: A partial copy of Mozilla Rhino. Mozilla Rhino is an
|
||||
implementation of JavaScript for the JVM. The JavaScript parser and
|
||||
the parse tree data structures were extracted and modified
|
||||
significantly for use by Google's JavaScript compiler.
|
||||
|
||||
Local Modifications: The packages have been renamespaced. All code not
|
||||
relavant to parsing has been removed. A JSDoc parser and static typing
|
||||
system have been added.
|
||||
|
||||
|
||||
-----
|
||||
Code in:
|
||||
lib/rhino
|
||||
|
||||
Rhino
|
||||
URL: http://www.mozilla.org/rhino
|
||||
Version: Trunk
|
||||
License: Netscape Public License and MPL / GPL dual license
|
||||
|
||||
Description: Mozilla Rhino is an implementation of JavaScript for the JVM.
|
||||
|
||||
Local Modifications: Minor changes to parsing JSDoc that usually get pushed
|
||||
up-stream to Rhino trunk.
|
||||
|
||||
|
||||
-----
|
||||
Code in:
|
||||
lib/args4j.jar
|
||||
|
||||
Args4j
|
||||
URL: https://args4j.dev.java.net/
|
||||
Version: 2.0.12
|
||||
License: MIT
|
||||
|
||||
Description:
|
||||
args4j is a small Java class library that makes it easy to parse command line
|
||||
options/arguments in your CUI application.
|
||||
|
||||
Local Modifications: None.
|
||||
|
||||
|
||||
-----
|
||||
Code in:
|
||||
lib/guava.jar
|
||||
|
||||
Guava Libraries
|
||||
URL: http://code.google.com/p/guava-libraries/
|
||||
Version: r08
|
||||
License: Apache License 2.0
|
||||
|
||||
Description: Google's core Java libraries.
|
||||
|
||||
Local Modifications: None.
|
||||
|
||||
|
||||
-----
|
||||
Code in:
|
||||
lib/jsr305.jar
|
||||
|
||||
Annotations for software defect detection
|
||||
URL: http://code.google.com/p/jsr-305/
|
||||
Version: svn revision 47
|
||||
License: BSD License
|
||||
|
||||
Description: Annotations for software defect detection.
|
||||
|
||||
Local Modifications: None.
|
||||
|
||||
|
||||
-----
|
||||
Code in:
|
||||
lib/jarjar.jar
|
||||
|
||||
Jar Jar Links
|
||||
URL: http://jarjar.googlecode.com/
|
||||
Version: 1.1
|
||||
License: Apache License 2.0
|
||||
|
||||
Description:
|
||||
A utility for repackaging Java libraries.
|
||||
|
||||
Local Modifications: None.
|
||||
|
||||
|
||||
----
|
||||
Code in:
|
||||
lib/junit.jar
|
||||
|
||||
JUnit
|
||||
URL: http://sourceforge.net/projects/junit/
|
||||
Version: 4.8.2
|
||||
License: Common Public License 1.0
|
||||
|
||||
Description: A framework for writing and running automated tests in Java.
|
||||
|
||||
Local Modifications: None.
|
||||
|
||||
|
||||
---
|
||||
Code in:
|
||||
lib/protobuf-java.jar
|
||||
|
||||
Protocol Buffers
|
||||
URL: http://code.google.com/p/protobuf/
|
||||
Version: 2.3.0
|
||||
License: New BSD License
|
||||
|
||||
Description: Supporting libraries for protocol buffers,
|
||||
an encoding of structured data.
|
||||
|
||||
Local Modifications: None
|
||||
|
||||
|
||||
---
|
||||
Code in:
|
||||
lib/ant.jar
|
||||
lib/ant-launcher.jar
|
||||
|
||||
URL: http://ant.apache.org/bindownload.cgi
|
||||
Version: 1.8.1
|
||||
License: Apache License 2.0
|
||||
Description:
|
||||
Ant is a Java based build tool. In theory it is kind of like "make"
|
||||
without make's wrinkles and with the full portability of pure java code.
|
||||
|
||||
Local Modifications: None
|
||||
|
||||
|
||||
---
|
||||
Code in:
|
||||
lib/json.jar
|
||||
URL: http://json.org/java/index.html
|
||||
Version: JSON version 20090211
|
||||
License: MIT license
|
||||
Description:
|
||||
JSON is a set of java files for use in transmitting data in JSON format.
|
||||
|
||||
Local Modifications: None
|
||||
|
||||
---
|
||||
Code in:
|
||||
tools/maven-ant-tasks-2.1.1.jar
|
||||
URL: http://maven.apache.org
|
||||
Version 2.1.1
|
||||
License: Apache License 2.0
|
||||
Description:
|
||||
Maven Ant tasks are used to manage dependencies and to install/deploy to
|
||||
maven repositories.
|
||||
|
||||
Local Modifications: None
|
Binary file not shown.
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
@ -47,7 +47,7 @@
|
|||
#cb-loading-overlay {
|
||||
z-index: 100;
|
||||
opacity: 0.8;
|
||||
background: #000 url("../img/loading.gif") no-repeat center;
|
||||
background: #000 url("img/loading.gif") no-repeat center;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,13 +3,9 @@
|
|||
<head>
|
||||
<meta charset="utf8">
|
||||
<title>Basic</title>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
|
||||
<script src="../lib/ComicBook.min.js"></script>
|
||||
<link rel="stylesheet" href="../css/reset.css">
|
||||
<link rel="stylesheet" href="../css/Aristo/css/Aristo/Aristo.css">
|
||||
<link rel="stylesheet" href="../css/styles.css">
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
|
||||
<script src="comicbook/js/comicbook.min.js"></script>
|
||||
<link rel="stylesheet" href="comicbook/comicbook.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
@ -43,10 +39,13 @@
|
|||
'goldenboy/goldenboy_23.jpg',
|
||||
'goldenboy/goldenboy_24.jpg',
|
||||
'goldenboy/goldenboy_25.jpg'
|
||||
]);
|
||||
], {
|
||||
libPath: "/reader/examples/comicbook/js/"
|
||||
});
|
||||
|
||||
book.draw();
|
||||
|
||||
$(window).resize(function(event) {
|
||||
$(window).on('resize', function(event) {
|
||||
book.draw();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="utf8">
|
||||
<title>Dev</title>
|
||||
|
||||
<script src="../lib/vendor/jquery-2.0.0.min.js"></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
|
||||
<script src="../lib/vendor/pixastic/pixastic.js"></script>
|
||||
<script src="../lib/vendor/pixastic/pixastic.effects.js"></script>
|
||||
<script src="../lib/vendor/pixastic/pixastic.worker.js"></script>
|
||||
|
@ -50,7 +50,7 @@
|
|||
'goldenboy/goldenboy_24.jpg',
|
||||
'goldenboy/goldenboy_25.jpg'
|
||||
], {
|
||||
libPath: "/reader/lib/"
|
||||
libPath: "/reader/examples/comicbook/js/"
|
||||
});
|
||||
|
||||
book.draw();
|
||||
|
|
|
@ -9,16 +9,11 @@
|
|||
<head>
|
||||
<meta charset="utf8">
|
||||
<title>App</title>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
|
||||
|
||||
<script src="../lib/bitjs/io.js"></script>
|
||||
<script src="../lib/bitjs/archive.js"></script>
|
||||
<script src="../lib/ComicBook.js"></script>
|
||||
<link rel="stylesheet" href="../css/reset.css">
|
||||
<link rel="stylesheet" href="../css/Aristo/css/Aristo/Aristo.css">
|
||||
<link rel="stylesheet" href="../css/styles.css">
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
|
||||
<script src="bitjs/io.js"></script>
|
||||
<script src="bitjs/archive.js"></script>
|
||||
<script src="comicbook/js/comicbook.min.js"></script>
|
||||
<link rel="stylesheet" href="comicbook/comicbook.css">
|
||||
<style>
|
||||
#filepicker {
|
||||
margin: 10px;
|
||||
|
@ -170,7 +165,7 @@
|
|||
|
||||
var name = this.file.name.replace(/\.[a-z]+$/, '');
|
||||
var id = encodeURIComponent(name.toLowerCase());
|
||||
var book = new ComicBook('comic', pages);
|
||||
var book = new ComicBook('comic', pages, { libPath: '/reader/examples/comicbook/js/'});
|
||||
|
||||
document.title = name;
|
||||
|
||||
|
@ -179,7 +174,7 @@
|
|||
|
||||
book.draw();
|
||||
|
||||
$(window).resize(function () {
|
||||
$(window).on('resize', function () {
|
||||
book.draw();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
TODOs:
|
||||
|
||||
Fo sho:
|
||||
- README with build instructions
|
||||
- fix manga mode
|
||||
- trigger preload if requesting valid but not loaded images (can happen if network was interupted)
|
||||
- loading and generally hackiness of pointer is buggy, fix.
|
||||
- check for html5 feature support where used: diveintohtml5.org/everything.html or www.modernizr.com
|
||||
- full browser test - IE9 / FF3.6+ / Chrome / Safari / Opera
|
||||
- fix Makefile (handlebars is not compiling properly..)
|
||||
|
||||
Nice 2 have:
|
||||
- lint
|
||||
|
@ -23,7 +23,6 @@
|
|||
- properly bind "this" so we don't have to keep using "self"
|
||||
- allow toolbar to be sticky
|
||||
- unit test / integrate with travis CI
|
||||
- use less instead of plain css
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -517,7 +516,7 @@ function ComicBook(id, srcs, opts) {
|
|||
context.drawImage(page2, page_width + offsetW, offsetH, page_width, page_height);
|
||||
}
|
||||
|
||||
this.pixastic = new Pixastic(context, options.libPath + "vendor/pixastic/");
|
||||
this.pixastic = new Pixastic(context, options.libPath + "pixastic/");
|
||||
|
||||
// apply any image enhancements previously defined
|
||||
$.each(options.enhance, function(action, options) {
|
||||
|
|
44
lib/ComicBook.min.js
vendored
44
lib/ComicBook.min.js
vendored
|
@ -1,44 +0,0 @@
|
|||
var Pixastic=function(){function c(g,f,b){g.addEventListener?g.addEventListener(f,b,!1):g.attachEvent&&g.attachEvent("on"+f,b)}function d(g){var b=!1,a=function(){b||(b=!0,g())};document.write('<script defer src="//:" id="__onload_ie_pixastic__"><\/script>');var d=document.getElementById("__onload_ie_pixastic__");d.onreadystatechange=function(){d.readyState=="complete"&&(d.parentNode.removeChild(d),a())};document.addEventListener&&document.addEventListener("DOMContentLoaded",a,!1);c(window,"load",
|
||||
a)}function a(){for(var g=b("pixastic",null,"img"),a=b("pixastic",null,"canvas"),c=g.concat(a),d=0;d<c.length;d++)(function(){for(var g=c[d],b=[],a=g.className.split(" "),f=0;f<a.length;f++){var h=a[f];h.substring(0,9)=="pixastic-"&&(h=h.substring(9),h!=""&&b.push(h))}if(b.length)if(g.tagName.toLowerCase()=="img")if(a=new Image,a.src=g.src,a.complete)for(a=0;a<b.length;a++)(f=Pixastic.applyAction(g,g,b[a],null))&&(g=f);else a.onload=function(){for(var a=0;a<b.length;a++){var f=Pixastic.applyAction(g,
|
||||
g,b[a],null);f&&(g=f)}};else setTimeout(function(){for(var a=0;a<b.length;a++){var f=Pixastic.applyAction(g,g,b[a],null);f&&(g=f)}},1)})()}function b(g,a,b){var c=[];a==null&&(a=document);b==null&&(b="*");a=a.getElementsByTagName(b);b=a.length;g=RegExp("(^|\\s)"+g+"(\\s|$)");for(i=0,j=0;i<b;i++)g.test(a[i].className)&&(c[j]=a[i],j++);return c}function h(g,a){if(Pixastic.debug)try{switch(a){case "warn":console.warn("Pixastic:",g);break;case "error":console.error("Pixastic:",g);break;default:console.log("Pixastic:",
|
||||
g)}}catch(b){}}typeof pixastic_parseonload!="undefined"&&pixastic_parseonload&&d(a);var m=function(){var a=document.createElement("canvas"),b=!1;try{b=!!(typeof a.getContext=="function"&&a.getContext("2d"))}catch(c){}return function(){return b}}(),l=function(){var a=document.createElement("canvas"),b=!1,c;try{if(typeof a.getContext=="function"&&(c=a.getContext("2d")))b=typeof c.getImageData=="function"}catch(d){}return function(){return b}}(),e=function(){var a=!1,b=document.createElement("canvas");
|
||||
if(m()&&l()){b.width=b.height=1;b=b.getContext("2d");b.fillStyle="rgb(255,0,0)";b.fillRect(0,0,1,1);var c=document.createElement("canvas");c.width=c.height=1;var d=c.getContext("2d");d.fillStyle="rgb(0,0,255)";d.fillRect(0,0,1,1);b.globalAlpha=0.5;b.drawImage(c,0,0);a=b.getImageData(0,0,1,1).data[2]!=255}return function(){return a}}();return{parseOnLoad:!1,debug:!1,applyAction:function(a,b,c,d){var d=d||{},e=a.tagName.toLowerCase()=="canvas";if(e&&Pixastic.Client.isIE())return Pixastic.debug&&h("Tried to process a canvas element but browser is IE."),
|
||||
!1;var k,m,l=!1;Pixastic.Client.hasCanvas()&&(l=!!d.resultCanvas,k=d.resultCanvas||document.createElement("canvas"),m=k.getContext("2d"));var s=a.offsetWidth,q=a.offsetHeight;if(e)s=a.width,q=a.height;if(s==0||q==0)if(a.parentNode==null){var r=a.style.position,t=a.style.left;a.style.position="absolute";a.style.left="-9999px";document.body.appendChild(a);s=a.offsetWidth;q=a.offsetHeight;document.body.removeChild(a);a.style.position=r;a.style.left=t}else{Pixastic.debug&&h("Image has 0 width and/or height.");
|
||||
return}if(c.indexOf("(")>-1&&(r=c,c=r.substr(0,r.indexOf("(")),r=r.match(/\((.*?)\)/),r[1])){r=r[1].split(";");for(t=0;t<r.length;t++)if(thisArg=r[t].split("="),thisArg.length==2)if(thisArg[0]=="rect"){var n=thisArg[1].split(",");d[thisArg[0]]={left:parseInt(n[0],10)||0,top:parseInt(n[1],10)||0,width:parseInt(n[2],10)||0,height:parseInt(n[3],10)||0}}else d[thisArg[0]]=thisArg[1]}d.rect?(d.rect.left=Math.round(d.rect.left),d.rect.top=Math.round(d.rect.top),d.rect.width=Math.round(d.rect.width),d.rect.height=
|
||||
Math.round(d.rect.height)):d.rect={left:0,top:0,width:s,height:q};r=!1;Pixastic.Actions[c]&&typeof Pixastic.Actions[c].process=="function"&&(r=!0);if(!r)return Pixastic.debug&&h('Invalid action "'+c+'". Maybe file not included?'),!1;if(!Pixastic.Actions[c].checkSupport())return Pixastic.debug&&h('Action "'+c+'" not supported by this browser.'),!1;if(Pixastic.Client.hasCanvas()){if(k!==a)k.width=s,k.height=q;if(!l)k.style.width=s+"px",k.style.height=q+"px";m.drawImage(b,0,0,s,q);a.__pixastic_org_image?
|
||||
(k.__pixastic_org_image=a.__pixastic_org_image,k.__pixastic_org_width=a.__pixastic_org_width,k.__pixastic_org_height=a.__pixastic_org_height):(k.__pixastic_org_image=a,k.__pixastic_org_width=s,k.__pixastic_org_height=q)}else if(Pixastic.Client.isIE()&&typeof a.__pixastic_org_style=="undefined")a.__pixastic_org_style=a.style.cssText;b={image:a,canvas:k,width:s,height:q,useData:!0,options:d};if(!Pixastic.Actions[c].process(b))return!1;if(Pixastic.Client.hasCanvas()){b.useData&&Pixastic.Client.hasCanvasImageData()&&
|
||||
(k.getContext("2d").putImageData(b.canvasData,d.rect.left,d.rect.top),k.getContext("2d").fillRect(0,0,0,0));if(!d.leaveDOM){k.title=a.title;k.imgsrc=a.imgsrc;if(!e)k.alt=a.alt;if(!e)k.imgsrc=a.src;k.className=a.className;k.style.cssText=a.style.cssText;k.name=a.name;k.tabIndex=a.tabIndex;k.id=a.id;a.parentNode&&a.parentNode.replaceChild&&a.parentNode.replaceChild(k,a)}return d.resultCanvas=k}return a},prepareData:function(a,b){var c=a.canvas.getContext("2d"),d=a.options.rect,c=c.getImageData(d.left,
|
||||
d.top,d.width,d.height),d=c.data;if(!b)a.canvasData=c;return d},process:function(a,b,c,d){if(a.tagName.toLowerCase()=="img"){var h=new Image;h.src=a.src;if(h.complete){var e=Pixastic.applyAction(a,h,b,c);d&&d(e);return e}else h.onload=function(){var e=Pixastic.applyAction(a,h,b,c);d&&d(e)}}if(a.tagName.toLowerCase()=="canvas")return e=Pixastic.applyAction(a,a,b,c),d&&d(e),e},revert:function(a){if(Pixastic.Client.hasCanvas()){if(a.tagName.toLowerCase()=="canvas"&&a.__pixastic_org_image)return a.width=
|
||||
a.__pixastic_org_width,a.height=a.__pixastic_org_height,a.getContext("2d").drawImage(a.__pixastic_org_image,0,0),a.parentNode&&a.parentNode.replaceChild&&a.parentNode.replaceChild(a.__pixastic_org_image,a),a}else if(Pixastic.Client.isIE()&&typeof a.__pixastic_org_style!="undefined")a.style.cssText=a.__pixastic_org_style},Client:{hasCanvas:m,hasCanvasImageData:l,hasGlobalAlpha:e,isIE:function(){return!!document.all&&!!window.attachEvent&&!window.opera}},Actions:{}}}();
|
||||
Pixastic.Actions.brightness={process:function(c){var d=parseInt(c.options.brightness,10)||0,a=parseFloat(c.options.contrast)||0,b=!!(c.options.legacy&&c.options.legacy!="false");if(b)d=Math.min(150,Math.max(-150,d));else var h=1+Math.min(150,Math.max(-150,d))/150;a=Math.max(0,a+1);if(Pixastic.Client.hasCanvasImageData()){var m=Pixastic.prepareData(c),c=c.options.rect,c=c.width*c.height,l=c*4,e,g;a!=1?b?(b=a,d=(d-128)*a+128):(b=h*a,d=-a*128+128):b?b=1:(b=h,d=0);for(var f,x,o;c--;)m[l]=(f=m[l-=4]*b+
|
||||
d)>255?255:f<0?0:f,m[e]=(x=m[e=l+1]*b+d)>255?255:x<0?0:x,m[g]=(o=m[g=l+2]*b+d)>255?255:o<0?0:o;return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}};
|
||||
Pixastic.Actions.desaturate={process:function(c){var d=!!(c.options.average&&c.options.average!="false");if(Pixastic.Client.hasCanvasImageData()){var a=Pixastic.prepareData(c),c=c.options.rect,c=c.width*c.height,b=c*4,h,m;if(d)for(;c--;)a[b-=4]=a[h=b+1]=a[m=b+2]=(a[b]+a[h]+a[m])/3;else for(;c--;)a[b-=4]=a[h=b+1]=a[m=b+2]=a[b]*0.3+a[h]*0.59+a[m]*0.11;return!0}else if(Pixastic.Client.isIE())return c.image.style.filter+=" gray",!0},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()||
|
||||
Pixastic.Client.isIE()}};
|
||||
Pixastic.Actions.sharpen={process:function(c){var d=0;typeof c.options.amount!="undefined"&&(d=parseFloat(c.options.amount)||0);d<0&&(d=0);d>1&&(d=1);if(Pixastic.Client.hasCanvasImageData()){for(var a=Pixastic.prepareData(c),b=Pixastic.prepareData(c,!0),h=15,d=1+3*d,m=[[0,-d,0],[-d,h,-d],[0,-d,0]],l=0,e=0;e<3;e++)for(var g=0;g<3;g++)l+=m[e][g];l=1/l;m=c.options.rect;c=m.width;m=m.height;h*=l;d*=l;l=c*4;e=m;do{var g=(e-1)*l,f=(e==1?0:e-2)*l,x=(e==m?e-1:e)*l,o=c;do{var p=g+(o*4-4),k=f+(o==1?0:o-2)*
|
||||
4,u=x+(o==c?o-1:o)*4,v=(-b[k]-b[p-4]-b[p+4]-b[u])*d+b[p]*h,s=(-b[k+1]-b[p-3]-b[p+5]-b[u+1])*d+b[p+1]*h,k=(-b[k+2]-b[p-2]-b[p+6]-b[u+2])*d+b[p+2]*h;v<0&&(v=0);s<0&&(s=0);k<0&&(k=0);v>255&&(v=255);s>255&&(s=255);k>255&&(k=255);a[p]=v;a[p+1]=s;a[p+2]=k}while(--o)}while(--e);return!0}},checkSupport:function(){return Pixastic.Client.hasCanvasImageData()}};this.Handlebars={};
|
||||
(function(c){c.VERSION="1.0.rc.1";c.helpers={};c.partials={};c.registerHelper=function(a,b,c){c&&(b.not=c);this.helpers[a]=b};c.registerPartial=function(a,b){this.partials[a]=b};c.registerHelper("helperMissing",function(a){if(arguments.length!==2)throw Error("Could not find property '"+a+"'");});var d=Object.prototype.toString;c.registerHelper("blockHelperMissing",function(a,b){var h=b.inverse||function(){},m=b.fn,l=d.call(a);return l==="[object Function]"&&(a=a.call(this)),a===!0?m(this):a===!1||
|
||||
a==null?h(this):l==="[object Array]"?a.length>0?c.helpers.each(a,b):h(this):m(a)});c.K=function(){};c.createFrame=Object.create||function(a){c.K.prototype=a;a=new c.K;return c.K.prototype=null,a};c.registerHelper("each",function(a,b){var d=b.fn,m=b.inverse,l=0,e="",g;b.data&&(g=c.createFrame(b.data));if(a&&typeof a=="object")if(a instanceof Array)for(var f=a.length;l<f;l++)g&&(g.index=l),e+=d(a[l],{data:g});else for(f in a)a.hasOwnProperty(f)&&(g&&(g.key=f),e+=d(a[f],{data:g}),l++);return l===0&&
|
||||
(e=m(this)),e});c.registerHelper("if",function(a,b){return d.call(a)==="[object Function]"&&(a=a.call(this)),!a||c.Utils.isEmpty(a)?b.inverse(this):b.fn(this)});c.registerHelper("unless",function(a,b){var d=b.fn;return b.fn=b.inverse,b.inverse=d,c.helpers["if"].call(this,a,b)});c.registerHelper("with",function(a,b){return b.fn(a)});c.registerHelper("log",function(a){c.log(a)})})(this.Handlebars);var errorProps="description,fileName,lineNumber,message,name,number,stack".split(",");
|
||||
Handlebars.Exception=function(c){for(var d=Error.prototype.constructor.apply(this,arguments),a=0;a<errorProps.length;a++)this[errorProps[a]]=d[errorProps[a]]};Handlebars.Exception.prototype=Error();Handlebars.SafeString=function(c){this.string=c};Handlebars.SafeString.prototype.toString=function(){return this.string.toString()};
|
||||
(function(){var c={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},d=/[&<>"'`]/g,a=/[&<>"'`]/,b=function(a){return c[a]||"&"};Handlebars.Utils={escapeExpression:function(c){return c instanceof Handlebars.SafeString?c.toString():c==null||c===!1?"":a.test(c)?c.replace(d,b):c},isEmpty:function(a){return typeof a=="undefined"?!0:a===null?!0:a===!1?!0:Object.prototype.toString.call(a)==="[object Array]"&&a.length===0?!0:!1}}})();
|
||||
Handlebars.VM={template:function(c){var d={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(a,b,c){var d=this.programs[a];return c?Handlebars.VM.program(b,c):d?d:(d=this.programs[a]=Handlebars.VM.program(b),d)},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(a,b){return b=b||{},c.call(d,Handlebars,a,b.helpers,b.partials,b.data)}},programWithDepth:function(c,d,a){var b=Array.prototype.slice.call(arguments,
|
||||
2);return function(a,m){return m=m||{},c.apply(this,[a,m.data||d].concat(b))}},program:function(c,d){return function(a,b){return b=b||{},c(a,b.data||d)}},noop:function(){return""},invokePartial:function(c,d,a,b,h,m){b={helpers:b,partials:h,data:m};if(c===void 0)throw new Handlebars.Exception("The partial "+d+" could not be found");if(c instanceof Function)return c(a,b);if(!Handlebars.compile)throw new Handlebars.Exception("The partial "+d+" could not be compiled when running in runtime-only mode");
|
||||
return h[d]=Handlebars.compile(c,{data:m!==void 0}),h[d](a,b)}};Handlebars.template=Handlebars.VM.template;
|
||||
(function(){var c=Handlebars.template,d=Handlebars.templates=Handlebars.templates||{};d.loadingOverlay=c(function(){this.compilerInfo=[2,">= 1.0.0-rc.3"];return'\n<div id="cb-loading-overlay" class="cb-control"></div>\n'});d.navigateLeft=c(function(){this.compilerInfo=[2,">= 1.0.0-rc.3"];return'\n<div data-trigger="click" data-action="drawPrevPage" class="cb-control navigate navigate-left ">\n\t<span class="icon-arrow-left"></span>\n</div>\n'});d.navigateRight=c(function(){this.compilerInfo=[2,">= 1.0.0-rc.3"];
|
||||
return'\n<div data-trigger="click" data-action="drawNextPage" class="cb-control navigate navigate-right">\n\t<span class="icon-arrow-right"></span>\n</div>\n'});d.progressbar=c(function(){this.compilerInfo=[2,">= 1.0.0-rc.3"];return'<div id="cb-status" class="cb-control">\n\t<div id="cb-progress-bar">\n\t\t<div class="progressbar-value"></div>\n\t</div>\n</div>\n'});d.toolbar=c(function(){this.compilerInfo=[2,">= 1.0.0-rc.3"];return'\n<div class="toolbar">\n\n\t<ul class="pull-left">\n\t\t<li>\n\t\t\t<button data-trigger="click" data-action="close" title="close" class="icon-remove-sign"></button>\n\t\t</li>\n\t\t<li class="separator"></li>\n\t\t<li>\n\t\t\t<button title="image settings" class="icon-settings"></button>\n\t\t\t<div class="dropdown">\n\t\t\t\t<form name="image-enhancements" data-trigger="reset" data-action="resetEnhancements">\n\t\t\t\t\t<div class="sliders">\n\t\t\t\t\t\t<div class="control-group">\n\t\t\t\t\t\t\t<label title="adjust brightness" class="icon-sun"></label>\n\t\t\t\t\t\t\t<input data-trigger="change" data-action="brightness" type="range" min="-100" max="100" step="1" value="0">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="control-group">\n\t\t\t\t\t\t\t<label title="adjust contrast" class="icon-adjust"></label>\n\t\t\t\t\t\t\t<input data-trigger="change" data-action="contrast" type="range" min="-1" max="1" step="0.1" value="0">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="control-group">\n\t\t\t\t\t\t\t<label title="sharpen" class="icon-droplet"></label>\n\t\t\t\t\t\t\t<input data-trigger="change" data-action="sharpen" type="range" min="0" max="1" step="0.1" value="0">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="control-group pull-left">\n\t\t\t\t\t\t<input id="image-desaturate" type="checkbox" data-trigger="change" data-action="desaturate">\n\t\t\t\t\t\t<label for="image-desaturate">desaturate</label>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="control-group pull-right">\n\t\t\t\t\t\t<input type="reset" value="reset">\n\t\t\t\t\t</div>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t</li>\n\t\t<li>\n\t\t\t<button data-trigger="click" data-action="toggleLayout" title="toggle one/two pages at a time" class="icon-file"></button>\n\t\t</li>\n\t\t<li>\n\t\t\t<button data-trigger="click" data-action="zoomOut" title="zoom out" class="icon-zoom-out"></button>\n\t\t</li>\n\t\t<li>\n\t\t\t<button data-trigger="click" data-action="zoomIn" title="zoom in" class="icon-zoom-in"></button>\n\t\t</li>\n\t\t<li>\n\t\t\t<button data-trigger="click" data-action="fitWidth" title="fit page to window width" class="icon-expand"></button>\n\t\t</li>\n\t</ul>\n\n\t<ul class="pull-right">\n\t\t<li><span id="current-page"></span> / <span id="page-count"></span></li>\n\t</ul>\n\n</div>\n'})})();
|
||||
function merge(c,d){var a;typeof d==="undefined"&&(d={});for(a in c)c.hasOwnProperty(a)&&!(a in d)&&(d[a]=c[a]);return d}var ComicBookException={INVALID_ACTION:"invalid action",INVALID_PAGE:"invalid page",INVALID_PAGE_TYPE:"invalid page type",UNDEFINED_CONTROL:"undefined control",INVALID_ZOOM_MODE:"invalid zoom mode",INVALID_NAVIGATION_EVENT:"invalid navigation event"};
|
||||
function ComicBook(c,d,a){function b(){var a=window.innerHeight+1;t===!1&&(t=$(document.createElement("div")).attr("id","cb-width-shiv").css({width:"100%",position:"absolute",top:0,zIndex:"-1000"}),$("body").append(t));t.height(a);return t.innerWidth()}function h(){var a=m();a!==n&&u.indexOf(a)>-1&&(n=a,e.draw())}function m(){var a=parseInt(location.hash.substring(1),10)-1||0;if(a<0)a=location.hash=0;return a}function l(){p=document.getElementById(g);k=p.getContext("2d");q===!1&&(e.renderControls(),
|
||||
q=!0);window.addEventListener("keydown",e.navigation,!1);window.addEventListener("hashchange",h,!1)}var e=this,g=c;this.srcs=d;var f=merge({displayMode:"double",zoomMode:"fitWidth",manga:!1,enhance:{},keyboard:{next:78,previous:80,toolbar:84,toggleLayout:76}},a),x=d.length,o=[],p,k,u=[],v=1,s=!1,q=!1,r=!1,t=!1,c=m(),n=c<d.length?c:0;ComicBook.prototype.renderControls=function(){var a={};$.each(Handlebars.templates,function(b,c){var d=$(c().trim());a[b]=d;d.find("*").andSelf().filter("[data-action][data-trigger]").each(function(){var a=
|
||||
$(this),b=a.data("trigger"),c=a.data("action");if(typeof e[a.data("action")]==="function")a.on(b,e[c]);a.on(b,function(a){$(e).trigger(b,a)})});$(p).before(d)});this.controls=a};ComicBook.prototype.getControl=function(a){if(typeof this.controls[a]!=="object")throw ComicBookException.UNDEFINED_CONTROL+" "+a;return this.controls[a]};ComicBook.prototype.showControl=function(a){this.getControl(a).show().addClass("open")};ComicBook.prototype.hideControl=function(a){this.getControl(a).removeClass("open").hide()};
|
||||
ComicBook.prototype.toggleControl=function(a){this.getControl(a).toggle().toggleClass("open")};ComicBook.prototype.toggleLayout=function(){var a=e.getControl("toolbar").find("[data-action=toggleLayout]"),b=f.displayMode==="single"?"double":"single";a.removeClass(f.displayMode);a.addClass(b);f.displayMode=b;e.drawPage()};ComicBook.prototype.getPage=function(a){if(a<0||a>d.length-1)throw ComicBookException.INVALID_PAGE+" "+a;if(typeof o[a]==="object")return o[a];else r=a,this.showControl("loadingOverlay")};
|
||||
ComicBook.prototype.draw=function(){l();$(".navigate").outerHeight(window.innerHeight);$("#cb-loading-overlay").outerWidth(b()).height(window.innerHeight);o.length!==x?this.preload():this.drawPage()};ComicBook.prototype.zoom=function(a){f.zoomMode="manual";v=a;typeof this.getPage(n)==="object"&&this.drawPage()};ComicBook.prototype.zoomIn=function(){e.zoom(v+0.1)};ComicBook.prototype.zoomOut=function(){e.zoom(v-0.1)};ComicBook.prototype.fitWidth=function(){f.zoomMode="fitWidth";ComicBook.prototype.drawPage()};
|
||||
ComicBook.prototype.preload=function(){function a(b){var k=new Image;k.src=d[b];k.onload=function(){o[b]=this;u.push(b);$("#cb-progress-bar .progressbar-value").css("width",Math.floor(u.length/x*100)+"%");var k=f.displayMode==="double"&&n<d.length-1?1:0;if(c===!1&&$.inArray(n+k,u)!==-1||typeof r==="number"&&$.inArray(r,u)!==-1)typeof r==="number"&&(n=r-1,r=!1),e.drawPage(),e.hideControl("loadingOverlay"),c=!0;g.length?(a(g[0]),g.splice(0,1)):$("#cb-status").delay(500).fadeOut()}}var b=n,c=!1,g=[];
|
||||
this.showControl("loadingOverlay");(function(b,c){for(var d=1,e=b,f=b-1;e<=c;)d>3&&f>-1?(g.push(f),f--,d=0):(g.push(e),e++),d++;for(;f>-1;)g.push(f),f--;a(g[0])})(b,d.length-1)};ComicBook.prototype.pageLoaded=function(a){return typeof u[a-1]!=="undefined"};ComicBook.prototype.drawPage=function(a,c){var g=(typeof c!=="undefined"?c:1)?0:window.scrollY;if(typeof a==="number"&&a<d.length&&a>0&&(n=a-1,!this.pageLoaded(a))){this.showControl("loadingOverlay");return}n<0&&(n=0);var h,l=0,r=0,o=e.getPage(n),
|
||||
q=!1;f.displayMode==="double"&&n<d.length-1&&(q=e.getPage(n+1));if(typeof o!=="object")throw ComicBookException.INVALID_PAGE_TYPE+" "+typeof o;var w=o.width;p.width=0;p.height=0;if(s=typeof q==="object"&&(o.width>o.height||q.width>q.height)&&f.displayMode==="double")f.displayMode="single";f.displayMode==="double"&&(w+=typeof q==="object"?q.width:w);switch(f.zoomMode){case "manual":document.body.style.overflowX="auto";h=f.displayMode==="double"?v*2:v;break;case "fitWidth":document.body.style.overflowX=
|
||||
"hidden";v=h=b()>w?(b()-w)/b()+1:b()/w;break;default:throw ComicBookException.INVALID_ZOOM_MODE+" "+f.zoomMode;}var w=o.width*h,t=o.height*h;h=f.zoomMode==="manual"?o.width*v:w;var u=f.zoomMode==="manual"?o.height*v:t,t=u;p.width=w<b()?b():w;p.height=t<window.innerHeight?window.innerHeight:t;w<b()&&f.zoomMode==="manual"&&(l=(b()-h)/2,f.displayMode==="double"&&(l-=h/2));t<window.innerHeight&&f.zoomMode==="manual"&&(r=(window.innerHeight-u)/2);f.manga&&f.displayMode==="double"&&typeof q==="object"&&
|
||||
(w=o,o=q,q=w);k.drawImage(o,l,r,h,u);f.displayMode==="double"&&typeof q==="object"&&k.drawImage(q,h+l,r,h,u);$.each(f.enhance,function(a,b){e.enhance[a](b)});l=f.displayMode==="double"&&n+2<=d.length?n+1+"-"+(n+2):n+1;this.getControl("toolbar").find("#current-page").text(l).end().find("#page-count").text(d.length);if(s)f.displayMode="double";$("button.cb-fit-width").attr("disabled",f.zoomMode==="fitWidth");$(".navigate").show();n===0&&($(".navigate-left").hide(),$(".navigate-right").show());if(n===
|
||||
d.length-1||typeof q==="object"&&n===d.length-2)$(".navigate-left").show(),$(".navigate-right").hide();$(this).trigger("navigate");if(m()!==n)location.hash=n+1;window.scroll(0,g)};ComicBook.prototype.drawNextPage=function(){var a;try{a=e.getPage(n+1)}catch(b){}if(!a)return!1;if(n+1<o.length){n+=f.displayMode==="single"||s?1:2;try{e.drawPage()}catch(c){}}};ComicBook.prototype.drawPrevPage=function(){var a;try{a=e.getPage(n-1)}catch(b){}if(!a)return!1;s=a.width>a.height;n>0&&(n-=f.displayMode==="single"||
|
||||
s?1:2,e.drawPage())};ComicBook.prototype.brightness=function(){e.enhance.brightness({brightness:$(this).val()})};ComicBook.prototype.contrast=function(){e.enhance.brightness({contrast:$(this).val()})};ComicBook.prototype.sharpen=function(){e.enhance.sharpen({amount:$(this).val()})};ComicBook.prototype.desaturate=function(){$(this).is(":checked")?e.enhance.desaturate():e.enhance.resaturate()};ComicBook.prototype.resetEnhancements=function(){e.enhance.reset()};ComicBook.prototype.enhance={reset:function(a){a?
|
||||
delete f.enhance[a]:f.enhance={};e.drawPage(null,!1)},brightness:function(a,b){b!==!1&&this.reset("brightness");var c=merge({brightness:0,contrast:0},a);f.enhance.brightness=c;Pixastic.process(p,"brightness",{brightness:c.brightness,contrast:c.contrast,legacy:!0});l()},desaturate:function(){f.enhance.desaturate={};Pixastic.process(p,"desaturate",{average:!1});l()},resaturate:function(){delete f.enhance.desaturate;e.drawPage(null,!1)},sharpen:function(a){this.desharpen();a=merge({amount:0},a);f.enhance.sharpen=
|
||||
a;Pixastic.process(p,"sharpen",{amount:a.amount});l()},desharpen:function(){delete f.enhance.sharpen;e.drawPage(null,!1)}};ComicBook.prototype.navigation=function(a){if($("#cb-loading-overlay").is(":visible"))return!1;var b=!1;switch(a.type){case "keydown":a.keyCode===f.keyboard.previous&&(b="left");a.keyCode===f.keyboard.next&&(b="right");a.keyCode===f.keyboard.toolbar&&e.toggleToolbar();a.keyCode===f.keyboard.toggleLayout&&e.toggleLayout();break;default:throw ComicBookException.INVALID_NAVIGATION_EVENT+
|
||||
" "+a.type;}if(b)return a.stopPropagation(),f.manga?(b==="left"&&e.drawNextPage(),b==="right"&&e.drawPrevPage()):(b==="left"&&e.drawPrevPage(),b==="right"&&e.drawNextPage()),!1};ComicBook.prototype.destroy=function(){$("#cb-loading-overlay, #cb-status, #cb-color, .cb-control, .cb-toolbar, #cb-width-shiv").remove();p.width=0;p.height=0;window.removeEventListener("keydown",e.navigation,!1);window.removeEventListener("hashchange",h,!1);location.hash="";$(this).trigger("destroy")}};
|
6
lib/vendor/jquery-2.0.0.min.js
vendored
6
lib/vendor/jquery-2.0.0.min.js
vendored
File diff suppressed because one or more lines are too long
22
package.json
Executable file
22
package.json
Executable file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "comic-reader",
|
||||
"description": "A HTML5 comic book reader.",
|
||||
"version": "0.5.0",
|
||||
"keywords": ["comic", "book", "reader"],
|
||||
"homepage": "http://reader.justforcomics.com",
|
||||
"author": "Bala Clark",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/balaclark/HTML5-Comic-Book-Reader.git"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "Apache-2.0",
|
||||
"url": "http://www.apache.org/licenses/LICENSE-2.0"
|
||||
}
|
||||
],
|
||||
"devDependencies": {
|
||||
"handlebars": "1.0.10",
|
||||
"uglify-js": "1.3.4"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue