1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-03 14:59:18 +02:00

added annotator

This commit is contained in:
Fred Chasen 2013-03-04 12:10:03 -08:00
parent f70ccc1aa9
commit f55fb69008
23 changed files with 4397 additions and 25 deletions

92
annotator.html Executable file
View file

@ -0,0 +1,92 @@
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/annotator.css">
<!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="fpjs/libs/jquery-1.9.0.min.js"><\/script>')</script>
-->
<script src="fpjs/libs/jquery-1.9.0.js"></script>
<script src="fpjs/libs/modernizr-2.6.2.min.js"></script>
<script>
"use strict";
document.onreadystatechange = function () {
if (document.readyState == "complete") {
FPR.app.init();
}
};
</script>
<!--<script async src="fpjs/libs/jquery.touchy.min.js"></script>-->
<!-- Render -->
<script src="fpjs/render/base.js"></script>
<script src="fpjs/render/core.js"></script>
<script src="fpjs/render/queue.js"></script>
<script src="fpjs/render/unarchiver.js"></script>
<script src="fpjs/render/storage.js"></script>
<script src="fpjs/render/storage_ram.js"></script>
<script src="fpjs/render/storage_websql.js"></script>
<script src="fpjs/render/storage_indexeddb.js"></script>
<script src="fpjs/render/storage_filesystem.js"></script>
<script src="fpjs/render/events.js"></script>
<script src="fpjs/render/hooks.js"></script>
<script src="fpjs/render/book.js"></script>
<script src="fpjs/render/chapter.js"></script>
<!-- Plugins -->
<script async src="fpjs/hooks/transculsions.js"></script>
<script async src="fpjs/hooks/annotate.js"></script>
<!-- Reader -->
<script async src="fpjs/reader/utils.js"></script>
<script async src="fpjs/reader/app.js"></script>
</head>
<body>
<div id="sidebar">
<div id="controls">
<input id="search" placeholder="search">
<a id="network"><img id="store" src="img/save.png"></a>
<a id="setting"><img id="settings" src="img/settings.png"></a>
<a id="bookmark"><img id="bookmarks" src="img/star.png"></a>
</div>
<div id="toc">
</div>
<div id="settingsPanel">
</div>
</div>
<div id="main">
<div id="opener">
<a id="open"><img src="img/menu-icon.png"></a>
</div>
<div id="titlebar">
<span id="book-title"></span>
<span id="title-seperator">&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span id="chapter-title"> </span>
</div>
<div id="prev" class="arrow"></div>
<div id="area"></div>
<div id="next" class="arrow"></div>
<div id="divider"></div>
<div id="loader"><img src="img/loader.gif"></div>
</div>
</body>
</html>

897
css/annotator.css Normal file
View file

@ -0,0 +1,897 @@
/* Base Reset
-------------------------------------------------------------------- */
.annotator-notice,
.annotator-filter *,
.annotator-widget * {
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
font-weight: normal;
text-align: left;
margin: 0;
padding: 0;
background: none;
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
transition: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
-o-box-shadow: none;
box-shadow: none;
color: rgb(144, 144, 144);
}
/* Images
-------------------------------------------------------------------- */
.annotator-adder {
background-image: url(../img/annotator-icon-sprite.png);
background-repeat: no-repeat;
}
.annotator-resize,
.annotator-widget::after,
.annotator-editor a::after,
.annotator-viewer .annotator-controls button,
.annotator-viewer .annotator-controls a,
.annotator-filter .annotator-filter-navigation button::after,
.annotator-filter .annotator-filter-property .annotator-filter-clear {
background-image: url(../img/annotator-glyph-sprite.png);
background-repeat: no-repeat;
}
/* Annotator Highlight
-------------------------------------------------------------------- */
.annotator-hl {
background: rgba(255, 255, 10, 0.3);
}
.annotator-hl-temporary {
background: rgba(0, 124, 255, 0.3);
}
/* Annotator Wrapper
-------------------------------------------------------------------- */
.annotator-wrapper {
position: relative;
}
/* NB: If you change the list of classes for which z-index is set,
you should update Annotator._setupDynamicStyle() */
.annotator-adder,
.annotator-outer,
.annotator-notice {
z-index: 1020;
}
.annotator-filter {
z-index: 1010;
}
.annotator-adder,
.annotator-outer,
.annotator-widget,
.annotator-notice {
position: absolute;
font-size: 10px;
line-height: 1;
}
.annotator-hide {
display: none;
visibility: hidden;
}
/* Annotator Adder
-------------------------------------------------------------------- */
.annotator-adder {
margin-top: -48px;
margin-left: -24px;
width: 48px;
height: 48px;
background-position: left top;
}
.annotator-adder:hover {
background-position: center top;
}
.annotator-adder:active {
background-position: center right;
}
.annotator-adder button {
display: block;
width: 36px;
height: 41px;
margin: 0 auto;
border: none;
background: none;
text-indent: -999em;
cursor: pointer;
}
/* Annotator Widget
This applies to both the Viewer and the Editor
-------------------------------------------------------------------- */
.annotator-outer {
width: 0;
height: 0;
}
.annotator-widget {
margin: 0;
padding: 0;
bottom: 15px;
left: -18px;
min-width: 265px;
background-color: rgba(251, 251, 251, 0.98);
border: 1px solid rgba(122, 122, 122, 0.6);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
-o-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}
/* FRED - removed for fixed pos
.annotator-invert-x .annotator-widget {
left: auto;
right: -18px;
}
.annotator-invert-y .annotator-widget {
bottom: auto;
top: 8px;
} */
.annotator-widget strong {
font-weight: bold;
}
.annotator-widget .annotator-listing,
.annotator-widget .annotator-item {
padding: 0;
margin: 0;
list-style: none;
}
.annotator-widget::after {
content: "";
display: block;
width: 18px;
height: 10px;
background-position: 0 0;
position: absolute;
bottom: -10px;
left: 8px;
}
.annotator-invert-x .annotator-widget::after {
left: auto;
right: 8px;
}
.annotator-invert-y .annotator-widget::after {
background-position: 0 -15px;
bottom: auto;
top: -9px;
}
.annotator-widget .annotator-item,
.annotator-editor .annotator-item input,
.annotator-editor .annotator-item textarea {
position: relative;
font-size: 12px;
}
.annotator-viewer .annotator-item {
border-top: 2px solid rgba(122, 122, 122, 0.2);
}
.annotator-widget .annotator-item:first-child {
border-top: none;
}
.annotator-editor .annotator-item,
.annotator-viewer div {
border-top: 1px solid rgba(133, 133, 133, 0.11);
}
/* Annotator Viewer
-------------------------------------------------------------------- */
.annotator-viewer div {
padding: 6px 6px;
}
.annotator-viewer .annotator-item ol,
.annotator-viewer .annotator-item ul {
padding: 4px 16px;
}
.annotator-viewer .annotator-item li {
}
.annotator-viewer div:first-of-type,
.annotator-editor .annotator-item:first-child textarea {
padding-top: 12px;
padding-bottom: 12px;
color: rgb(60, 60, 60);
font-size: 13px;
font-style: italic;
line-height: 1.3;
border-top: none;
}
.annotator-viewer .annotator-controls {
position: relative;
top: 5px;
right: 5px;
padding-left: 5px;
opacity: 0;
-webkit-transition: opacity 0.2s ease-in;
-moz-transition: opacity 0.2s ease-in;
-o-transition: opacity 0.2s ease-in;
transition: opacity 0.2s ease-in;
float: right;
}
.annotator-viewer li:hover .annotator-controls,
.annotator-viewer li .annotator-controls.annotator-visible {
opacity: 1;
}
.annotator-viewer .annotator-controls button,
.annotator-viewer .annotator-controls a {
cursor: pointer;
display: inline-block;
width: 13px;
height: 13px;
margin-left: 2px;
border: none;
opacity: 0.2;
text-indent: -900em;
background-color: transparent;
outline: none;
}
.annotator-viewer .annotator-controls button:hover,
.annotator-viewer .annotator-controls button:focus,
.annotator-viewer .annotator-controls a:hover,
.annotator-viewer .annotator-controls a:focus {
opacity: 0.9;
}
.annotator-viewer .annotator-controls button:active,
.annotator-viewer .annotator-controls a:active {
opacity: 1;
}
.annotator-viewer .annotator-controls button[disabled] {
display: none;
}
.annotator-viewer .annotator-controls .annotator-edit {
background-position: 0 -60px;
}
.annotator-viewer .annotator-controls .annotator-delete {
background-position: 0 -75px;
}
.annotator-viewer .annotator-controls .annotator-link {
background-position: 0 -270px;
}
/* Annotator Editor
-------------------------------------------------------------------- */
.annotator-editor .annotator-item {
position: relative;
}
.annotator-editor .annotator-item label {
top: 0;
display: inline;
cursor: pointer;
font-size: 12px;
}
.annotator-editor .annotator-item input,
.annotator-editor .annotator-item textarea {
display: block;
min-width: 100%;
padding: 10px 8px;
border: none;
margin: 0;
color: rgb(60, 60, 60);
background: none;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
resize: none;
}
.annotator-editor .annotator-item textarea::-webkit-scrollbar {
height: 8px;
width: 8px;
}
.annotator-editor .annotator-item textarea::-webkit-scrollbar-track-piece {
margin: 13px 0 3px;
background-color: #e5e5e5;
-webkit-border-radius: 4px;
}
.annotator-editor .annotator-item textarea::-webkit-scrollbar-thumb:vertical {
height: 25px;
background-color: #ccc;
-webkit-border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}
.annotator-editor .annotator-item textarea::-webkit-scrollbar-thumb:horizontal {
width: 25px;
background-color: #ccc;
-webkit-border-radius: 4px;
}
.annotator-editor .annotator-item:first-child textarea {
min-height: 5.5em;
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-o-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
.annotator-editor .annotator-item input:focus,
.annotator-editor .annotator-item textarea:focus{
background-color: rgb(243, 243, 243);
outline: none;
}
.annotator-editor .annotator-item input[type=radio],
.annotator-editor .annotator-item input[type=checkbox] {
width: auto;
min-width: 0;
padding: 0;
display: inline;
margin: 0 4px 0 0;
cursor: pointer;
}
.annotator-editor .annotator-checkbox {
padding: 8px 6px;
}
.annotator-filter,
.annotator-filter .annotator-filter-navigation button,
.annotator-editor .annotator-controls {
text-align: right;
padding: 3px;
border-top: 1px solid rgb(212,212,212);
background-color: rgb(212, 212, 212);
background-image: -webkit-gradient(
linear, left top, left bottom,
from(rgb(245, 245, 245)),
color-stop(0.6, rgb(220, 220, 220)),
to(rgb(210, 210, 210))
);
background-image: -moz-linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(220, 220, 220) 60%,
rgb(210, 210, 210)
);
background-image: -webkit-linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(220, 220, 220) 60%,
rgb(210, 210, 210)
);
background-image: linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(220, 220, 220) 60%,
rgb(210, 210, 210)
);
-webkit-box-shadow:
inset 1px 0 0 rgba(255, 255, 255, 0.7),
inset -1px 0 0 rgba(255, 255, 255, 0.7),
inset 0 1px 0 rgba(255, 255, 255, 0.7);
-moz-box-shadow:
inset 1px 0 0 rgba(255, 255, 255, 0.7),
inset -1px 0 0 rgba(255, 255, 255, 0.7),
inset 0 1px 0 rgba(255, 255, 255, 0.7);
-o-box-shadow:
inset 1px 0 0 rgba(255, 255, 255, 0.7),
inset -1px 0 0 rgba(255, 255, 255, 0.7),
inset 0 1px 0 rgba(255, 255, 255, 0.7);
box-shadow:
inset 1px 0 0 rgba(255, 255, 255, 0.7),
inset -1px 0 0 rgba(255, 255, 255, 0.7),
inset 0 1px 0 rgba(255, 255, 255, 0.7);
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-o-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
.annotator-editor.annotator-invert-y .annotator-controls {
border-top: none;
border-bottom: 1px solid rgb(180, 180, 180);
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-o-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
.annotator-editor a,
.annotator-filter .annotator-filter-property label {
position: relative;
display: inline-block;
padding: 0 6px 0 22px;
color: rgb(54, 54, 54);
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
text-decoration: none;
line-height: 24px;
font-size: 12px;
font-weight: bold;
border: 1px solid rgb(162, 162, 162);
background-color: rgb(212, 212, 212);
background-image: -webkit-gradient(
linear, left top, left bottom,
from(rgb(245, 245, 245)),
color-stop(0.5, rgb(210, 210, 210)),
color-stop(0.5, rgb(190, 190, 190)),
to(rgb(210, 210, 210))
);
background-image: -moz-linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(210, 210, 210) 50%,
rgb(190, 190, 190) 50%,
rgb(210, 210, 210)
);
background-image: -webkit-linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(210, 210, 210) 50%,
rgb(190, 190, 190) 50%,
rgb(210, 210, 210)
);
background-image: linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(210, 210, 210) 50%,
rgb(190, 190, 190) 50%,
rgb(210, 210, 210)
);
-webkit-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
-moz-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
-o-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
.annotator-editor a::after {
position: absolute;
top: 50%;
left: 5px;
display: block;
content: "";
width: 15px;
height: 15px;
margin-top: -7px;
background-position: 0 -90px;
}
.annotator-editor a:hover,
.annotator-editor a:focus,
.annotator-editor a.annotator-focus,
.annotator-filter .annotator-filter-active label,
.annotator-filter .annotator-filter-navigation button:hover {
outline: none;
border-color: rgb(67, 90, 160);
background-color: rgb(56, 101, 249);
background-image: -webkit-gradient(
linear, left top, left bottom,
from(rgb(118, 145, 251)),
color-stop(0.5, rgb(80, 117, 251)),
color-stop(0.5, rgb(56, 101, 249)),
to(rgb(54, 101, 250))
);
background-image: -moz-linear-gradient(
-90deg,
rgb(118, 145, 251),
rgb(80, 117, 251) 50%,
rgb(56, 101, 249) 50%,
rgb(54, 101, 250)
);
background-image: -webkit-linear-gradient(
-90deg,
rgb(118, 145, 251),
rgb(80, 117, 251) 50%,
rgb(56, 101, 249) 50%,
rgb(54, 101, 250)
);
background-image: linear-gradient(
-90deg,
rgb(118, 145, 251),
rgb(80, 117, 251) 50%,
rgb(56, 101, 249) 50%,
rgb(54, 101, 250)
);
color: rgb(255, 255, 255);
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.42);
}
.annotator-editor a:hover::after,
.annotator-editor a:focus::after {
margin-top: -8px;
background-position: 0 -105px;
}
.annotator-editor a:active,
.annotator-filter .annotator-filter-navigation button:active {
border-color: rgb(112, 12, 73);
background-color: rgb(209, 46, 142);
background-image: -webkit-gradient(
linear, left top, left bottom,
from(rgb(252, 124, 202)),
color-stop(0.5, rgb(232, 93, 178)),
color-stop(0.5, rgb(209, 46, 142)),
to(rgb(255, 0, 156))
);
background-image: -moz-linear-gradient(
-90deg,
rgb(252, 124, 202),
rgb(232, 93, 178) 50%,
rgb(209, 46, 142) 50%,
rgb(255, 0, 156)
);
background-image: -webkit-linear-gradient(
-90deg,
rgb(252, 124, 202),
rgb(232, 93, 178) 50%,
rgb(209, 46, 142) 50%,
rgb(255, 0, 156)
);
background-image: linear-gradient(
-90deg,
rgb(252, 124, 202),
rgb(232, 93, 178) 50%,
rgb(209, 46, 142) 50%,
rgb(255, 0, 156)
);
}
.annotator-editor a.annotator-save::after {
background-position: 0 -120px;
}
.annotator-editor a.annotator-save:hover::after,
.annotator-editor a.annotator-save:focus::after,
.annotator-editor a.annotator-save.annotator-focus::after {
margin-top: -8px;
background-position: 0 -135px;
}
.annotator-editor .annotator-widget::after {
background-position: 0 -30px;
}
.annotator-editor.annotator-invert-y .annotator-widget .annotator-controls {
background-color: #f2f2f2;
}
.annotator-editor.annotator-invert-y .annotator-widget::after {
background-position: 0 -45px;
height: 11px;
}
.annotator-resize {
position: absolute;
top: 0;
right: 0;
width: 12px;
height: 12px;
background-position: 2px -150px;
}
.annotator-invert-x .annotator-resize {
right: auto;
left: 0;
background-position: 0 -195px;
}
.annotator-invert-y .annotator-resize {
top: auto;
bottom: 0;
background-position: 2px -165px;
}
.annotator-invert-y.annotator-invert-x .annotator-resize {
background-position: 0 -180px;
}
/* Annotator Notification
-------------------------------------------------------------------- */
.annotator-notice {
color: #fff;
position: absolute;
position: fixed;
top: -54px;
left: 0;
width: 100%;
font-size: 14px;
line-height: 50px;
text-align: center;
background: black;
background: rgba(0, 0, 0, 0.9);
border-bottom: 4px solid #d4d4d4;
-webkit-transition: top 0.4s ease-out;
-moz-transition: top 0.4s ease-out;
-o-transition: top 0.4s ease-out;
transition: top 0.4s ease-out;
}
.ie6 .annotator-notice {
position: absolute;
}
.annotator-notice-success {
border-color: #3665f9;
}
.annotator-notice-error {
border-color: #ff7e00;
}
.annotator-notice p {
margin: 0;
}
.annotator-notice a {
color: #fff;
}
.annotator-notice-show {
top: 0;
}
/* Annotator Tags Plugin
-------------------------------------------------------------------- */
.annotator-tags {
margin-bottom: -2px;
}
.annotator-tags .annotator-tag {
display: inline-block;
padding: 0 8px;
margin-bottom: 2px;
line-height: 1.6;
font-weight: bold;
background-color: rgb(230, 230, 230);
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
-o-border-radius: 8px;
border-radius: 8px;
}
/* Annotator Filter Plugin
-------------------------------------------------------------------- */
.annotator-filter {
position: fixed;
top: 0;
right: 0;
left: 0;
text-align: left;
line-height: 0;
border: none;
border-bottom: 1px solid #878787;
padding-left: 10px;
padding-right: 10px;
-webkit-border-radius: 0;
-moz-border-radius: 0;
-o-border-radius: 0;
border-radius: 0;
-webkit-box-shadow:
inset 0 -1px 0 rgba(255, 255, 255, 0.3);
-moz-box-shadow:
inset 0 -1px 0 rgba(255, 255, 255, 0.3);
-o-box-shadow:
inset 0 -1px 0 rgba(255, 255, 255, 0.3);
box-shadow:
inset 0 -1px 0 rgba(255, 255, 255, 0.3);
}
.annotator-filter strong {
font-size: 12px;
font-weight: bold;
color: #3c3c3c;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
position: relative;
top: -9px;
}
.annotator-filter .annotator-filter-property,
.annotator-filter .annotator-filter-navigation {
position: relative;
display: inline-block;
overflow: hidden;
line-height: 10px;
padding: 2px 0;
margin-right: 8px;
}
.annotator-filter .annotator-filter-property label,
.annotator-filter .annotator-filter-navigation button {
text-align: left;
display: block;
float: left;
line-height: 20px;
-webkit-border-radius: 10px 0 0 10px;
-moz-border-radius: 10px 0 0 10px;
-o-border-radius: 10px 0 0 10px;
border-radius: 10px 0 0 10px;
}
.annotator-filter .annotator-filter-property label {
padding-left: 8px;
}
.annotator-filter .annotator-filter-property input {
display: block;
float: right;
-webkit-appearance: none;
background-color: #fff;
border: 1px solid #878787;
border-left: none;
padding: 2px 4px;
line-height: 16px;
min-height: 16px;
font-size: 12px;
width: 150px;
color: #333;
background-color: #f8f8f8;
-webkit-border-radius: 0 10px 10px 0;
-moz-border-radius: 0 10px 10px 0;
-o-border-radius: 0 10px 10px 0;
border-radius: 0 10px 10px 0;
-webkit-box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.2);
-moz-box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.2);
-o-box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.2);
box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.2);
}
.annotator-filter .annotator-filter-property input:focus {
outline: none;
background-color: #fff;
}
.annotator-filter .annotator-filter-clear {
position: absolute;
right: 3px;
top: 6px;
border: none;
text-indent: -900em;
width: 15px;
height: 15px;
background-position: 0 -90px;
opacity: 0.4;
}
.annotator-filter .annotator-filter-clear:hover,
.annotator-filter .annotator-filter-clear:focus {
opacity: 0.8;
}
.annotator-filter .annotator-filter-clear:active {
opacity: 1;
}
.annotator-filter .annotator-filter-navigation button {
border: 1px solid rgb(162, 162, 162);
padding: 0;
text-indent: -900px;
width: 20px;
min-height: 22px;
-webkit-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
-moz-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
-o-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
}
.annotator-filter .annotator-filter-navigation button,
.annotator-filter .annotator-filter-navigation button:hover,
.annotator-filter .annotator-filter-navigation button:focus {
color: transparent;
}
.annotator-filter .annotator-filter-navigation button::after {
position: absolute;
top: 8px;
left: 8px;
content: "";
display: block;
width: 9px;
height: 9px;
background-position: 0 -210px;
}
.annotator-filter .annotator-filter-navigation button:hover::after {
background-position: 0 -225px;
}
.annotator-filter .annotator-filter-navigation .annotator-filter-next {
-webkit-border-radius: 0 10px 10px 0;
-moz-border-radius: 0 10px 10px 0;
-o-border-radius: 0 10px 10px 0;
border-radius: 0 10px 10px 0;
border-left: none;
}
.annotator-filter .annotator-filter-navigation .annotator-filter-next::after {
left: auto;
right: 7px;
background-position: 0 -240px;
}
.annotator-filter .annotator-filter-navigation .annotator-filter-next:hover::after {
background-position: 0 -255px;
}
.annotator-hl-active {
background: rgba(255, 255, 10, 0.8);
}
.annotator-hl-filtered {
background-color: transparent;
}
/* FIXED HACK */
.annotator-adder,
.annotator-editor,
.annotator-viewer
{
position: fixed;
}

BIN
dist/.DS_Store vendored

Binary file not shown.

View file

@ -1,2 +1,2 @@
/*! FuturePress - v0.1.0 - 2013-03-02 */ /*! FuturePress - v0.1.0 - 2013-03-04 */
FP.Hooks.register("beforeChapterDisplay").transculsions=function(e,t){var n=t.doc.querySelectorAll("[transclusion]"),r=Array.prototype.slice.call(n);r.forEach(function(e){function l(){u=i,a=s,u>t.colWidth&&(f=t.colWidth/u,u=t.colWidth,a*=f),r.width=u,r.height=a}var n=e.getAttribute("ref"),r=document.createElement("iframe"),i=e.getAttribute("width"),s=e.getAttribute("height"),o=e.parentNode,u=i,a=s,f;l(),t.book.listenUntil("book:resized","book:chapterDestroy",l),r.src=n,o.replaceChild(r,e)}),e&&e()}; FP.Hooks.register("beforeChapterDisplay").transculsions=function(e,t){var n=t.doc.querySelectorAll("[transclusion]"),r=Array.prototype.slice.call(n);r.forEach(function(e){function l(){u=i,a=s,u>t.colWidth&&(f=t.colWidth/u,u=t.colWidth,a*=f),r.width=u,r.height=a}var n=e.getAttribute("ref"),r=document.createElement("iframe"),i=e.getAttribute("width"),s=e.getAttribute("height"),o=e.parentNode,u=i,a=s,f;l(),t.book.listenUntil("book:resized","book:chapterDestroy",l),r.src=n,o.replaceChild(r,e)}),e&&e()};

2
dist/reader.min.js vendored
View file

@ -1,2 +1,2 @@
/*! FuturePress - v0.1.0 - 2013-03-02 */ /*! FuturePress - v0.1.0 - 2013-03-04 */
var FPR=FPR||{};FPR.app={},FPR.app.init=function(e){"use strict";function s(n){var s=window.location.search.match(/book=(.*)/),n=n||(s?s[1]:"moby-dick");FP.core.crossBrowserColumnCss(),i=e(window).width(),i>550?e("#main").width(i-r):e("#main").width(i),a(),t=new FP.Book("area"),t.listen("book:metadataReady",o),t.listen("book:tocReady",u),t.listen("book:bookReady",l),t.listen("book:chapterReady",p),t.listen("book:online",c),t.listen("book:offline",h),t.start(n),e(function(){d()})}function o(){var n=t.getTitle(),r=t.getCreator(),i=e("#book-title"),s=e("#chapter-title"),o=e("#title-seperator");document.title=n+" "+r,i.html(n),s.html(r),o.show()}function u(){var n=t.getTOC(),r=e("#toc"),i,s;r.empty(),s=f(n,1),r.append(s),i=e(".toc_link"),i.on("click",function(n){var r=e(this),i=r.data("url");e(".openChapter").removeClass("openChapter"),r.parents("li").addClass("openChapter"),t.useHash||(t.show(i),n.preventDefault())})}function a(){var n="";localStorage.getItem("fontSize")?n=localStorage.getItem("fontSize"):(n="medium",localStorage.setItem("fontSize",n));var r=e("#settingsPanel");r.append("<ul></ul>");var i=e("<li><h3></h3></li>"),s=e("<input type='radio' name='fontSize' value='x-small'><span class='xsmall'>Extra Small</span><br><input type='radio' name='fontSize' value='small'><span class='small'>Small</span><br><input type='radio' name='fontSize' value='medium'><span class='medium'>Medium</span><br><input type='radio' name='fontSize' value='large'><span class='large'>Large</span><br><input type='radio' name='fontSize' value='x-large'><span class='xlarge'>Extra Large</span>");i.find("h3").text("Font Size").after(s),r.find("ul").append(i);var o=e('input[name="fontSize"]');o.each(function(){e(this).attr("value")==n&&e(this).attr("checked","checked"),e(this).on("click",function(){localStorage.setItem("fontSize",e(this).attr("value")),t.iframe.contentDocument.location.reload(!0)})})}function f(t,n){var r=e("<ul>"),i=n==1?"chapter":"section";return t.forEach(function(t){var s,o=e("<li id='toc-"+t.id+"'>"),u=e("<a class='toc_link "+i+"' href='#/"+t.href+"' data-url='"+t.href+"'>"+t.label+"</a>");o.append(u),t.subitems&&t.subitems.length&&(n++,s=f(t.subitems,n),o.append(s)),r.append(o)}),r}function l(){var t=e("#divider"),n=e("#loader");n.hide(),t.addClass("show")}function c(){var t=e("#store");n=!1,t.attr("src","img/save.png")}function h(){var t=e("#store");n=!0,t.attr("src","img/saved.png")}function p(t){var n=t.msg,r=e("#toc-"+n),i=e(".currentChapter");r.length&&(i.removeClass("currentChapter"),r.addClass("currentChapter"))}function d(){function y(){f.addClass("open"),u.addClass("closed"),c.attr("src","img/close.png")}function b(){a.css("pointer-events","visible"),f.removeClass("open"),u.removeClass("closed"),c.attr("src","img/menu-icon.png")}function w(){v.hide(),d.show()}function E(){d.hide(),v.show()}var s=e("#next"),o=e("#prev"),u=e("#main"),a=e("#area"),f=e("#sidebar"),l=e("#open"),c=l.find("img"),h=e("#network"),p=e("#setting"),d=e("#settingsPanel"),v=e("#toc"),m=e(window);m.on("resize",function(){i=e(window).width(),i>550?u.width(i-r):u.width(i)}),s.on("click",function(){t.nextPage()}),o.on("click",function(){t.prevPage()}),p.on("click",function(){d.is(":visible")?E():w()}),m.bind("touchy-swipe",function(e,n,r,i){(i.direction="left")&&t.nextPage(),(i.direction="right")&&t.prevPage()});var g=!1;e(document).keydown(function(e){if(g)return;if(e.keyCode==37)return o.trigger("click"),g=!0,setTimeout(function(){g=!1},100),!1;if(e.keyCode==39)return s.trigger("click"),g=!0,setTimeout(function(){g=!1},100),!1}),l.on("click",function(){f.hasClass("open")?b():y()}),h.on("click",function(){n=!n,t.fromStorage(n)})}var t,n=!1,r=0,i;return s}(jQuery),jQuery.fn.extend({clickOutside:function(e,t){var n=this;return jQuery(document).on("click.offer",function(r){if(t&&jQuery.inArray(r.target,t)>-1)return;if(jQuery.contains(n[0],r.target))return;jQuery(document).off("click.offer"),e(r,n)}),this}}),Modernizr.addTest("filesystem",function(){var e=Modernizr._domPrefixes;for(var t=-1,n=e.length;++t<n;)if(window[e[t]+"RequestFileSystem"])return!0;return"requestFileSystem"in window}); var FPR=FPR||{};FPR.app={},FPR.app.init=function(e){"use strict";function s(n){var s=window.location.search.match(/book=(.*)/),n=n||(s?s[1]:"moby-dick");FP.core.crossBrowserColumnCss(),i=e(window).width(),i>550?e("#main").width(i-r):e("#main").width(i),a(),t=new FP.Book("area"),t.listen("book:metadataReady",o),t.listen("book:tocReady",u),t.listen("book:bookReady",l),t.listen("book:chapterReady",p),t.listen("book:online",c),t.listen("book:offline",h),t.start(n),e(function(){d()})}function o(){var n=t.getTitle(),r=t.getCreator(),i=e("#book-title"),s=e("#chapter-title"),o=e("#title-seperator");document.title=n+" "+r,i.html(n),s.html(r),o.show()}function u(){var n=t.getTOC(),r=e("#toc"),i,s;r.empty(),s=f(n,1),r.append(s),i=e(".toc_link"),i.on("click",function(n){var r=e(this),i=r.data("url");e(".openChapter").removeClass("openChapter"),r.parents("li").addClass("openChapter"),t.useHash||(t.show(i),n.preventDefault())})}function a(){var n="";localStorage.getItem("fontSize")?n=localStorage.getItem("fontSize"):(n="medium",localStorage.setItem("fontSize",n));var r=e("#settingsPanel");r.append("<ul></ul>");var i=e("<li><h3></h3></li>"),s=e("<input type='radio' name='fontSize' value='x-small'><span class='xsmall'>Extra Small</span><br><input type='radio' name='fontSize' value='small'><span class='small'>Small</span><br><input type='radio' name='fontSize' value='medium'><span class='medium'>Medium</span><br><input type='radio' name='fontSize' value='large'><span class='large'>Large</span><br><input type='radio' name='fontSize' value='x-large'><span class='xlarge'>Extra Large</span>");i.find("h3").text("Font Size").after(s),r.find("ul").append(i);var o=e('input[name="fontSize"]');o.each(function(){e(this).attr("value")==n&&e(this).attr("checked","checked"),e(this).on("click",function(){localStorage.setItem("fontSize",e(this).attr("value")),t.iframe.contentDocument.location.reload(!0)})})}function f(t,n){var r=e("<ul>"),i=n==1?"chapter":"section";return t.forEach(function(t){var s,o=e("<li id='toc-"+t.id+"'>"),u=e("<a class='toc_link "+i+"' href='#/"+t.href+"' data-url='"+t.href+"'>"+t.label+"</a>");o.append(u),t.subitems&&t.subitems.length&&(n++,s=f(t.subitems,n),o.append(s)),r.append(o)}),r}function l(){var t=e("#divider"),n=e("#loader");n.hide(),t.addClass("show")}function c(){var t=e("#store");n=!1,t.attr("src","img/save.png")}function h(){var t=e("#store");n=!0,t.attr("src","img/saved.png")}function p(t){var n=t.msg,r=e("#toc-"+n),i=e(".currentChapter");r.length&&(i.removeClass("currentChapter"),r.addClass("currentChapter"))}function d(){function y(){f.addClass("open"),u.addClass("closed"),c.attr("src","img/close.png")}function b(){a.css("pointer-events","visible"),f.removeClass("open"),u.removeClass("closed"),c.attr("src","img/menu-icon.png")}function w(){v.hide(),d.show()}function E(){d.hide(),v.show()}var s=e("#next"),o=e("#prev"),u=e("#main"),a=e("#area"),f=e("#sidebar"),l=e("#open"),c=l.find("img"),h=e("#network"),p=e("#setting"),d=e("#settingsPanel"),v=e("#toc"),m=e(window);m.on("resize",function(){i=e(window).width(),i>550?u.width(i-r):u.width(i)}),s.on("click",function(){t.nextPage()}),o.on("click",function(){t.prevPage()}),p.on("click",function(){d.is(":visible")?E():w()}),m.bind("touchy-swipe",function(e,n,r,i){(i.direction="left")&&t.nextPage(),(i.direction="right")&&t.prevPage()});var g=!1;e(document).keydown(function(e){if(g)return;if(e.keyCode==37)return o.trigger("click"),g=!0,setTimeout(function(){g=!1},100),!1;if(e.keyCode==39)return s.trigger("click"),g=!0,setTimeout(function(){g=!1},100),!1}),l.on("click",function(){f.hasClass("open")?b():y()}),h.on("click",function(){n=!n,t.fromStorage(n)})}var t,n=!1,r=0,i;return s}(jQuery),jQuery.fn.extend({clickOutside:function(e,t){var n=this;return jQuery(document).on("click.offer",function(r){if(t&&jQuery.inArray(r.target,t)>-1)return;if(jQuery.contains(n[0],r.target))return;jQuery(document).off("click.offer"),e(r,n)}),this}}),Modernizr.addTest("filesystem",function(){var e=Modernizr._domPrefixes;for(var t=-1,n=e.length;++t<n;)if(window[e[t]+"RequestFileSystem"])return!0;return"requestFileSystem"in window});

4
dist/render.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -1,2 +1,2 @@
/*! FuturePress - v0.1.0 - 2013-03-02 */ /*! FuturePress - v0.1.0 - 2013-03-04 */
var _requestFileSystem=self.requestFileSystem||self.webkitRequestFileSystem;const DBSIZE=5242880,DBTYPE=TEMPORARY;self.onmessage=function(e){var t=e.data;self.request(t,function(e){self.save(t,e,function(){self.postMessage(t)})})},self.openFs=function(e){if(self._fs){e&&e(self._fs);return}_requestFileSystem(DBTYPE,DBSIZE,function(t){self._fs=t,e&&e(t)},self.failure)},self.request=function(e,t){var n=new self.loadFile(e);n.succeeded=function(e){t&&t(e)},n.failed=function(e){self.postMessage("failed: "+e.toString())},n.start()},self.save=function(e,t,n){self.openFs(function(r){var i=e.split("/").slice(0,-1);self.createDir(r.root,i),r.root.getFile(e,{create:!0},function(r){r.createWriter(function(r){r.onwriteend=function(e){n(e)},r.onerror=function(t){self.postMessage("write error:"+self.errorHandler(err)+" path="+e)},r.write(t)})},self.failure)})},self.createDir=function(e,t){if(t[0]=="."||t[0]=="")t=t.slice(1);e.getDirectory(t[0],{create:!0},function(e){t.length&&createDir(e,t.slice(1))},self.failure)},self.failure=function(e){self.postMessage("failed: "+self.errorHandler(e))},self.errorHandler=function(e){switch(e.code){case FileError.QUOTA_EXCEEDED_ERR:return"QUOTA_EXCEEDED_ERR";case FileError.NOT_FOUND_ERR:return"NOT_FOUND_ERR";case FileError.SECURITY_ERR:return"SECURITY_ERR";case FileError.INVALID_MODIFICATION_ERR:return"INVALID_MODIFICATION_ERR";case FileError.INVALID_STATE_ERR:return"INVALID_STATE_ERR";default:return"Unknown Error"}},self.loadFile=function(e,t){var n=new XMLHttpRequest;return this.succeeded=function(e){t&&t(e)},this.failed=function(e){console.log("Error:",e)},this.start=function(){var t=this;n.open("GET",e,!0),n.responseType="blob",n.onload=function(e){this.status==200&&t.succeeded(this.response)},n.onerror=function(e){t.failed(this.status)},n.send()},{start:this.start,succeeded:this.succeeded,failed:this.failed}},self.openFs(); ;

BIN
fpjs/.DS_Store vendored

Binary file not shown.

59
fpjs/hooks/annotate.js Normal file
View file

@ -0,0 +1,59 @@
FP.Hooks.register("beforeChapterDisplay").annotate = function(callback, chapter){
var chap = chapter.bodyEl,
server = 'http://127.0.0.1:5000/';
files = [
FP.filePath + "libs/jquery-1.9.0.js",
FP.filePath + "libs/jquery-migrate-1.1.1.js",
FP.filePath + "libs/annotator-full.js"
];
FP.core.loadScripts(files, annotate, chapter.doc.head);
function annotate(path){
FP.core.addCss("css/annotator.css", false, chapter.doc.head);
var s = document.createElement("script");
s.type = 'text/javascript';
var a = "jQuery.migrateTrace = false;";
//a += "console.log(document.getElementById('c001p0002').getBoundingClientRect());";
//a += "var content = $('body').annotator(),";
a += "var content = $('body').annotator().annotator('setupPlugins', {}, {Filter:false}),";
a += " server = '" + server + "';";
a += " path = '" + chapter.path + "';";
// a += " content.annotator('addPlugin', 'Store', {";
// // The endpoint of the store on your server.
// a += " prefix: server,";
//
// // Attach the uri of the current page to all annotations to allow search.
// a += " annotationData: {";
// a += " 'uri': path";
// a += " },";
//
// // This will perform a search action rather than read when the plugin
// // loads. Will request the last 20 annotations for the current url.
// // eg. /store/endpoint/search?limit=20&uri=http://this/document/only
// a += " loadFromSearch: {";
// a += " 'limit': 20,";
// a += " 'uri': path";
// a += " }";
// a += "});";
s.innerHTML = a;
chapter.doc.body.appendChild(s);
if(callback) callback();
}
}

2759
fpjs/libs/annotator-full.js Normal file

File diff suppressed because it is too large Load diff

11
fpjs/libs/annotator-full.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,511 @@
/*!
* jQuery Migrate - v1.1.1 - 2013-02-16
* https://github.com/jquery/jquery-migrate
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
*/
(function( jQuery, window, undefined ) {
// See http://bugs.jquery.com/ticket/13335
// "use strict";
var warnedAbout = {};
// List of warnings already given; public read only
jQuery.migrateWarnings = [];
// Set to true to prevent console output; migrateWarnings still maintained
// jQuery.migrateMute = false;
// Show a message on the console so devs know we're active
if ( !jQuery.migrateMute && window.console && console.log ) {
console.log("JQMIGRATE: Logging is active");
}
// Set to false to disable traces that appear with warnings
if ( jQuery.migrateTrace === undefined ) {
jQuery.migrateTrace = true;
}
// Forget any warnings we've already given; public
jQuery.migrateReset = function() {
warnedAbout = {};
jQuery.migrateWarnings.length = 0;
};
function migrateWarn( msg) {
if ( !warnedAbout[ msg ] ) {
warnedAbout[ msg ] = true;
jQuery.migrateWarnings.push( msg );
if ( window.console && console.warn && !jQuery.migrateMute ) {
console.warn( "JQMIGRATE: " + msg );
if ( jQuery.migrateTrace && console.trace ) {
console.trace();
}
}
}
}
function migrateWarnProp( obj, prop, value, msg ) {
if ( Object.defineProperty ) {
// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
// allow property to be overwritten in case some other plugin wants it
try {
Object.defineProperty( obj, prop, {
configurable: true,
enumerable: true,
get: function() {
migrateWarn( msg );
return value;
},
set: function( newValue ) {
migrateWarn( msg );
value = newValue;
}
});
return;
} catch( err ) {
// IE8 is a dope about Object.defineProperty, can't warn there
}
}
// Non-ES5 (or broken) browser; just set the property
jQuery._definePropertyBroken = true;
obj[ prop ] = value;
}
if ( document.compatMode === "BackCompat" ) {
// jQuery has never supported or tested Quirks Mode
migrateWarn( "jQuery is not compatible with Quirks Mode" );
}
var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
oldAttr = jQuery.attr,
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
function() { return null; },
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
function() { return undefined; },
rnoType = /^(?:input|button)$/i,
rnoAttrNodeType = /^[238]$/,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
ruseDefault = /^(?:checked|selected)$/i;
// jQuery.attrFn
migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
jQuery.attr = function( elem, name, value, pass ) {
var lowerName = name.toLowerCase(),
nType = elem && elem.nodeType;
if ( pass ) {
// Since pass is used internally, we only warn for new jQuery
// versions where there isn't a pass arg in the formal params
if ( oldAttr.length < 4 ) {
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
}
if ( elem && !rnoAttrNodeType.test( nType ) &&
(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
return jQuery( elem )[ name ]( value );
}
}
// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
}
// Restore boolHook for boolean property/attribute synchronization
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
jQuery.attrHooks[ lowerName ] = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode,
property = jQuery.prop( elem, name );
return property === true || typeof property !== "boolean" &&
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// Warn only for attributes that can remain distinct from their properties post-1.9
if ( ruseDefault.test( lowerName ) ) {
migrateWarn( "jQuery.fn.attr('" + lowerName + "') may use property instead of attribute" );
}
}
return oldAttr.call( jQuery, elem, name, value );
};
// attrHooks: value
jQuery.attrHooks.value = {
get: function( elem, name ) {
var nodeName = ( elem.nodeName || "" ).toLowerCase();
if ( nodeName === "button" ) {
return valueAttrGet.apply( this, arguments );
}
if ( nodeName !== "input" && nodeName !== "option" ) {
migrateWarn("jQuery.fn.attr('value') no longer gets properties");
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value ) {
var nodeName = ( elem.nodeName || "" ).toLowerCase();
if ( nodeName === "button" ) {
return valueAttrSet.apply( this, arguments );
}
if ( nodeName !== "input" && nodeName !== "option" ) {
migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
}
// Does not return so that setAttribute is also used
elem.value = value;
}
};
var matched, browser,
oldInit = jQuery.fn.init,
oldParseJSON = jQuery.parseJSON,
// Note this does NOT include the #9521 XSS fix from 1.7!
rquickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*|#([\w\-]*))$/;
// $(html) "looks like html" rule change
jQuery.fn.init = function( selector, context, rootjQuery ) {
var match;
if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
(match = rquickExpr.exec( selector )) && match[1] ) {
// This is an HTML string according to the "old" rules; is it still?
if ( selector.charAt( 0 ) !== "<" ) {
migrateWarn("$(html) HTML strings must start with '<' character");
}
// Now process using loose rules; let pre-1.8 play too
if ( context && context.context ) {
// jQuery object as context; parseHTML expects a DOM object
context = context.context;
}
if ( jQuery.parseHTML ) {
return oldInit.call( this, jQuery.parseHTML( jQuery.trim(selector), context, true ),
context, rootjQuery );
}
}
return oldInit.apply( this, arguments );
};
jQuery.fn.init.prototype = jQuery.fn;
// Let $.parseJSON(falsy_value) return null
jQuery.parseJSON = function( json ) {
if ( !json && json !== null ) {
migrateWarn("jQuery.parseJSON requires a valid JSON string");
return null;
}
return oldParseJSON.apply( this, arguments );
};
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
// Don't clobber any existing jQuery.browser in case it's different
if ( !jQuery.browser ) {
matched = jQuery.uaMatch( navigator.userAgent );
browser = {};
if ( matched.browser ) {
browser[ matched.browser ] = true;
browser.version = matched.version;
}
// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
browser.webkit = true;
} else if ( browser.webkit ) {
browser.safari = true;
}
jQuery.browser = browser;
}
// Warn if the code tries to get jQuery.browser
migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
jQuery.sub = function() {
function jQuerySub( selector, context ) {
return new jQuerySub.fn.init( selector, context );
}
jQuery.extend( true, jQuerySub, this );
jQuerySub.superclass = this;
jQuerySub.fn = jQuerySub.prototype = this();
jQuerySub.fn.constructor = jQuerySub;
jQuerySub.sub = this.sub;
jQuerySub.fn.init = function init( selector, context ) {
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
context = jQuerySub( context );
}
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
};
jQuerySub.fn.init.prototype = jQuerySub.fn;
var rootjQuerySub = jQuerySub(document);
migrateWarn( "jQuery.sub() is deprecated" );
return jQuerySub;
};
// Ensure that $.ajax gets the new parseJSON defined in core.js
jQuery.ajaxSetup({
converters: {
"text json": jQuery.parseJSON
}
});
var oldFnData = jQuery.fn.data;
jQuery.fn.data = function( name ) {
var ret, evt,
elem = this[0];
// Handles 1.7 which has this behavior and 1.8 which doesn't
if ( elem && name === "events" && arguments.length === 1 ) {
ret = jQuery.data( elem, name );
evt = jQuery._data( elem, name );
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
migrateWarn("Use of jQuery.fn.data('events') is deprecated");
return evt;
}
}
return oldFnData.apply( this, arguments );
};
var rscriptType = /\/(java|ecma)script/i,
oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
jQuery.fn.andSelf = function() {
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
return oldSelf.apply( this, arguments );
};
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
if ( !jQuery.clean ) {
jQuery.clean = function( elems, context, fragment, scripts ) {
// Set context per 1.8 logic
context = context || document;
context = !context.nodeType && context[0] || context;
context = context.ownerDocument || context;
migrateWarn("jQuery.clean() is deprecated");
var i, elem, handleScript, jsTags,
ret = [];
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
// Complex logic lifted directly from jQuery 1.8
if ( fragment ) {
// Special handling of each script element
handleScript = function( elem ) {
// Check if we consider it executable
if ( !elem.type || rscriptType.test( elem.type ) ) {
// Detach the script and store it in the scripts array (if provided) or the fragment
// Return truthy to indicate that it has been handled
return scripts ?
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
fragment.appendChild( elem );
}
};
for ( i = 0; (elem = ret[i]) != null; i++ ) {
// Check if we're done after handling an executable script
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
// Append to fragment and handle embedded scripts
fragment.appendChild( elem );
if ( typeof elem.getElementsByTagName !== "undefined" ) {
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
// Splice the scripts into ret after their former ancestor and advance our index beyond them
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
i += jsTags.length;
}
}
}
}
return ret;
};
}
var eventAdd = jQuery.event.add,
eventRemove = jQuery.event.remove,
eventTrigger = jQuery.event.trigger,
oldToggle = jQuery.fn.toggle,
oldLive = jQuery.fn.live,
oldDie = jQuery.fn.die,
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
hoverHack = function( events ) {
if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
return events;
}
if ( rhoverHack.test( events ) ) {
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
}
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};
// Event props removed in 1.9, put them back if needed; no practical way to warn them
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
}
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
if ( jQuery.event.dispatch ) {
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
}
// Support for 'hover' pseudo-event and ajax event warnings
jQuery.event.add = function( elem, types, handler, data, selector ){
if ( elem !== document && rajaxEvent.test( types ) ) {
migrateWarn( "AJAX events should be attached to document: " + types );
}
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
};
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
};
jQuery.fn.error = function() {
var args = Array.prototype.slice.call( arguments, 0);
migrateWarn("jQuery.fn.error() is deprecated");
args.splice( 0, 0, "error" );
if ( arguments.length ) {
return this.bind.apply( this, args );
}
// error event should not bubble to window, although it does pre-1.7
this.triggerHandler.apply( this, args );
return this;
};
jQuery.fn.toggle = function( fn, fn2 ) {
// Don't mess with animation or css toggles
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
return oldToggle.apply( this, arguments );
}
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
};
jQuery.fn.live = function( types, data, fn ) {
migrateWarn("jQuery.fn.live() is deprecated");
if ( oldLive ) {
return oldLive.apply( this, arguments );
}
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
};
jQuery.fn.die = function( types, fn ) {
migrateWarn("jQuery.fn.die() is deprecated");
if ( oldDie ) {
return oldDie.apply( this, arguments );
}
jQuery( this.context ).off( types, this.selector || "**", fn );
return this;
};
// Turn global events into document-triggered events
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
if ( !elem && !rajaxEvent.test( event ) ) {
migrateWarn( "Global events are undocumented and deprecated" );
}
return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
};
jQuery.each( ajaxEvents.split("|"),
function( _, name ) {
jQuery.event.special[ name ] = {
setup: function() {
var elem = this;
// The document needs no shimming; must be !== for oldIE
if ( elem !== document ) {
jQuery.event.add( document, name + "." + jQuery.guid, function() {
jQuery.event.trigger( name, null, elem, true );
});
jQuery._data( this, name, jQuery.guid++ );
}
return false;
},
teardown: function() {
if ( this !== document ) {
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
}
return false;
}
};
}
);
})( jQuery, window );

View file

@ -328,6 +328,7 @@ FPR.app.init = (function($){
} }
return init; return init;
})(jQuery); })(jQuery);

View file

@ -2,3 +2,5 @@ var FP = FP || {};
FP.VERSION = "0.1.4"; FP.VERSION = "0.1.4";
FP.plugins = FP.plugins || {}; FP.plugins = FP.plugins || {};
FP.filePath = FP.filePath || "/fpjs/";

View file

@ -53,6 +53,12 @@ FP.Chapter.prototype.setIframeSrc = function(url){
that.formatSpread(); that.formatSpread();
//-- Trigger registered hooks before displaying
that.beforeDisplay(function(){
that.book.tell("book:chapterDisplayed");
that.visible(true);
});
that.afterLoaded(that); that.afterLoaded(that);
that.book.listen("book:resized", that.formatSpread, that); that.book.listen("book:resized", that.formatSpread, that);
@ -119,16 +125,12 @@ FP.Chapter.prototype.formatSpread = function(){
this.calcPages(); this.calcPages();
//-- Trigger registered hooks before displaying
this.beforeDisplay(function(){
this.book.tell("book:chapterDisplayed");
this.visible(true);
});
//-- Go to current page after resize //-- Go to current page after resize
if(this.OldcolWidth){ if(this.OldcolWidth){
this.leftPos = (this.chapterPos - 1 ) * this.spreadWidth; this.leftPos = (this.chapterPos - 1 ) * this.spreadWidth;
this.bodyEl.scrollLeft = this.leftPos; this.bodyEl.scrollLeft = this.leftPos;
this.visible(true);
} }
} }

View file

@ -165,20 +165,58 @@ FP.core.dataURLToBlob = function(dataURL) {
} }
//-- Load scripts async: http://stackoverflow.com/questions/7718935/load-scripts-asynchronously //-- Load scripts async: http://stackoverflow.com/questions/7718935/load-scripts-asynchronously
FP.core.loadScript = function(src, callback) { FP.core.loadScript = function(src, callback, target) {
var s, r; var s, r;
r = false; r = false;
s = document.createElement('script'); s = document.createElement('script');
s.type = 'text/javascript'; s.type = 'text/javascript';
s.async = true; s.async = false;
s.src = src; s.src = src;
s.onload = s.onreadystatechange = function() { s.onload = s.onreadystatechange = function() {
//console.log( this.readyState ); //uncomment this line to see which ready states are called. //console.log( this.readyState ); //uncomment this line to see which ready states are called.
if ( !r && (!this.readyState || this.readyState == 'complete') ) if ( !r && (!this.readyState || this.readyState == 'complete') )
{ {
r = true; r = true;
callback(); if(callback) callback();
} }
}; },
document.body.appendChild(s); target = target || document.body;
target.appendChild(s);
} }
FP.core.loadScripts = function(srcArr, callback, target) {
var total = srcArr.length,
curr = 0,
cb = function(){
curr++;
if(total == curr){
if(callback) callback();
}else{
FP.core.loadScript(srcArr[curr], cb, target);
}
};
// srcArr.forEach(function(src){
// FP.core.loadScript(src, cb, target);
// });
FP.core.loadScript(srcArr[curr], cb, target);
}
FP.core.addCss = function(src, callback, target) {
var s, r;
r = false;
s = document.createElement('link');
s.type = 'text/css';
s.rel = "stylesheet";
s.href = src;
s.onload = s.onreadystatechange = function() {
if ( !r && (!this.readyState || this.readyState == 'complete') )
{
r = true;
if(callback) callback();
}
},
target = target || document.body;
target.appendChild(s);
}

View file

@ -2,7 +2,7 @@ FP.store = FP.store || {};
FP.store.filesystem = function() { FP.store.filesystem = function() {
var _urls = {}, var _urls = {},
_queue = new FP.Queue("fpjs/render/workers/loader_filesystem.js", 6), _queue = new FP.Queue(FP.filePath + "workers/loader_filesystem.js", 6),
_requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem, _requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem,
_fs; _fs;

View file

@ -1,5 +1,5 @@
FP.Unarchiver = function(url, callback){ FP.Unarchiver = function(url, callback){
this.libPath = (this.fpjsPath || "fpjs/" ) + "/libs/"; this.libPath = FP.filePath + "libs/";
this.zipUrl = url; this.zipUrl = url;
this.callback = callback; this.callback = callback;
this.loadLib(function(){ this.loadLib(function(){

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7 KiB

View file

@ -18,7 +18,7 @@
document.onreadystatechange = function () { document.onreadystatechange = function () {
if (document.readyState == "complete") { if (document.readyState == "complete") {
FPR.fpjsPath = "dist/" FP.filePath = "/dist/"
FPR.app.init(); FPR.app.init();
} }
}; };