@internetarchive/bookreader 5.0.0-30 → 5.0.0-32-shadydom2
Sign up to get free protection for your applications and to get access to all the features.
- package/BookReader/BookReader.js +32261 -2
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/ia-bookreader-bundle.js +14871 -1137
- package/BookReader/ia-bookreader-bundle.js.map +1 -1
- package/BookReader/icons/1up.svg +12 -1
- package/BookReader/icons/2up.svg +15 -1
- package/BookReader/icons/advance.svg +26 -3
- package/BookReader/icons/chevron-right.svg +1 -1
- package/BookReader/icons/close-circle-dark.svg +1 -1
- package/BookReader/icons/close-circle.svg +1 -1
- package/BookReader/icons/fullscreen.svg +17 -1
- package/BookReader/icons/fullscreen_exit.svg +17 -1
- package/BookReader/icons/hamburger.svg +15 -1
- package/BookReader/icons/left-arrow.svg +12 -1
- package/BookReader/icons/magnify-minus.svg +16 -1
- package/BookReader/icons/magnify-plus.svg +17 -1
- package/BookReader/icons/magnify.svg +15 -1
- package/BookReader/icons/pause.svg +23 -1
- package/BookReader/icons/play.svg +22 -1
- package/BookReader/icons/playback-speed.svg +34 -1
- package/BookReader/icons/read-aloud.svg +22 -1
- package/BookReader/icons/review.svg +22 -3
- package/BookReader/icons/thumbnails.svg +17 -1
- package/BookReader/icons/voice.svg +1 -1
- package/BookReader/icons/volume-full.svg +22 -1
- package/BookReader/images/BRicons.svg +94 -5
- package/BookReader/images/books_graphic.svg +177 -1
- package/BookReader/images/icon_book.svg +12 -1
- package/BookReader/images/icon_bookmark.svg +12 -1
- package/BookReader/images/icon_gear.svg +14 -1
- package/BookReader/images/icon_hamburger.svg +20 -1
- package/BookReader/images/icon_home.svg +21 -1
- package/BookReader/images/icon_info.svg +11 -1
- package/BookReader/images/icon_one_page.svg +8 -1
- package/BookReader/images/icon_pause.svg +1 -1
- package/BookReader/images/icon_play.svg +1 -1
- package/BookReader/images/icon_playback-rate.svg +15 -1
- package/BookReader/images/icon_search_button.svg +8 -1
- package/BookReader/images/icon_share.svg +9 -1
- package/BookReader/images/icon_skip-ahead.svg +6 -1
- package/BookReader/images/icon_skip-back.svg +13 -2
- package/BookReader/images/icon_speaker.svg +18 -1
- package/BookReader/images/icon_speaker_open.svg +10 -1
- package/BookReader/images/icon_thumbnails.svg +12 -1
- package/BookReader/images/icon_toc.svg +5 -1
- package/BookReader/images/icon_two_pages.svg +9 -1
- package/BookReader/images/marker_chap-off.svg +11 -1
- package/BookReader/images/marker_chap-on.svg +11 -1
- package/BookReader/images/marker_srch-on.svg +11 -1
- package/BookReader/jquery-1.10.1.js +108 -2
- package/BookReader/plugins/plugin.archive_analytics.js +170 -1
- package/BookReader/plugins/plugin.archive_analytics.js.map +1 -1
- package/BookReader/plugins/plugin.autoplay.js +163 -1
- package/BookReader/plugins/plugin.autoplay.js.map +1 -1
- package/BookReader/plugins/plugin.chapters.js +333 -1
- package/BookReader/plugins/plugin.chapters.js.map +1 -1
- package/BookReader/plugins/plugin.iframe.js +72 -1
- package/BookReader/plugins/plugin.iframe.js.map +1 -1
- package/BookReader/plugins/plugin.mobile_nav.js +332 -1
- package/BookReader/plugins/plugin.mobile_nav.js.map +1 -1
- package/BookReader/plugins/plugin.resume.js +241 -1
- package/BookReader/plugins/plugin.resume.js.map +1 -1
- package/BookReader/plugins/plugin.search.js +1261 -1
- package/BookReader/plugins/plugin.search.js.map +1 -1
- package/BookReader/plugins/plugin.text_selection.js +839 -1
- package/BookReader/plugins/plugin.text_selection.js.map +1 -1
- package/BookReader/plugins/plugin.tts.js +9115 -2
- package/BookReader/plugins/plugin.tts.js.map +1 -1
- package/BookReader/plugins/plugin.url.js +811 -1
- package/BookReader/plugins/plugin.url.js.map +1 -1
- package/BookReader/plugins/plugin.vendor-fullscreen.js +326 -1
- package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
- package/BookReader/webcomponents-bundle.js +411 -2
- package/BookReader/webcomponents-bundle.js.map +1 -1
- package/BookReaderDemo/demo-internetarchive.html +5 -0
- package/CHANGELOG.md +3 -0
- package/package.json +2 -2
- package/src/BookNavigator/book-navigator.js +1 -0
- package/src/BookNavigator/bookmarks/ia-bookmarks.js +2 -1
- package/src/ia-bookreader/ia-bookreader.js +15 -14
@@ -1,2 +1,171 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
(self["webpackChunk_internetarchive_bookreader"] = self["webpackChunk_internetarchive_bookreader"] || []).push([["plugins/plugin.archive_analytics.js"],{
|
3
|
+
|
4
|
+
/***/ "./src/plugins/plugin.archive_analytics.js":
|
5
|
+
/*!*************************************************!*\
|
6
|
+
!*** ./src/plugins/plugin.archive_analytics.js ***!
|
7
|
+
\*************************************************/
|
8
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
9
|
+
|
10
|
+
__webpack_require__.r(__webpack_exports__);
|
11
|
+
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.regexp.exec.js */ "./node_modules/core-js/modules/es.regexp.exec.js");
|
12
|
+
/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_0__);
|
13
|
+
/* harmony import */ var core_js_modules_es_string_match_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.string.match.js */ "./node_modules/core-js/modules/es.string.match.js");
|
14
|
+
/* harmony import */ var core_js_modules_es_string_match_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_match_js__WEBPACK_IMPORTED_MODULE_1__);
|
15
|
+
/* provided dependency */ var jQuery = __webpack_require__(/*! jquery */ "jquery");
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
/* global BookReader, archive_analytics */
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Plugin for Archive.org analytics
|
23
|
+
*/
|
24
|
+
jQuery.extend(BookReader.defaultOptions, {
|
25
|
+
enableArchiveAnalytics: true,
|
26
|
+
|
27
|
+
/** Provide a means of debugging, cause otherwise it's impossible to test locally */
|
28
|
+
debugArchiveAnaltyics: false
|
29
|
+
});
|
30
|
+
|
31
|
+
BookReader.prototype.init = function (super_) {
|
32
|
+
return function () {
|
33
|
+
var _this = this;
|
34
|
+
|
35
|
+
super_.call(this);
|
36
|
+
|
37
|
+
if (this.options.enableArchiveAnalytics) {
|
38
|
+
this.bind(BookReader.eventNames.fragmentChange, function () {
|
39
|
+
return _this.archiveAnalyticsSendFragmentChange();
|
40
|
+
});
|
41
|
+
}
|
42
|
+
};
|
43
|
+
}(BookReader.prototype.init);
|
44
|
+
/** @private */
|
45
|
+
|
46
|
+
|
47
|
+
BookReader.prototype.archiveAnalyticsSendFragmentChange = function () {
|
48
|
+
if (!window.archive_analytics) {
|
49
|
+
return;
|
50
|
+
}
|
51
|
+
|
52
|
+
var prevFragment = this.archiveAnalyticsSendFragmentChange.prevFragment;
|
53
|
+
var params = this.paramsFromCurrent();
|
54
|
+
var newFragment = this.fragmentFromParams(params);
|
55
|
+
|
56
|
+
if (prevFragment != newFragment) {
|
57
|
+
var values = {
|
58
|
+
bookreader: "user_changed_view",
|
59
|
+
itemid: this.bookId,
|
60
|
+
cache_bust: Math.random()
|
61
|
+
}; // EEK! offsite embedding and /details/ page books look the same in analytics, otherwise!
|
62
|
+
|
63
|
+
values.offsite = 1;
|
64
|
+
values.details = 0;
|
65
|
+
|
66
|
+
try {
|
67
|
+
values.offsite = window.top.location.hostname.match(/\.archive.org$/) ? 0 : 1;
|
68
|
+
values.details = !values.offsite && window.top.location.pathname.match(/^\/details\//) ? 1 : 0;
|
69
|
+
} catch (e) {} // avoids embed cross site exceptions -- but on (+) side, means it is and keeps marked offite!
|
70
|
+
// Send bookreader ping
|
71
|
+
|
72
|
+
|
73
|
+
archive_analytics.send_ping(values, null, "augment_for_ao_site"); // Also send tracking event ping
|
74
|
+
|
75
|
+
var additionalEventParams = this.options.lendingInfo && this.options.lendingInfo.loanId ? {
|
76
|
+
loanId: this.options.lendingInfo.loanId
|
77
|
+
} : {};
|
78
|
+
archive_analytics.send_event('BookReader', 'UserChangedView', window.location.pathname, additionalEventParams);
|
79
|
+
this.archiveAnalyticsSendFragmentChange.prevFragment = newFragment;
|
80
|
+
}
|
81
|
+
};
|
82
|
+
/**
|
83
|
+
* Sends a tracking "Event". See https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#events
|
84
|
+
* @param {string} category
|
85
|
+
* @param {string} action
|
86
|
+
* @param {number} [value] (must be an int)
|
87
|
+
* @param {Object} [additionalEventParams]
|
88
|
+
*/
|
89
|
+
|
90
|
+
|
91
|
+
BookReader.prototype.archiveAnalyticsSendEvent = function (category, action, value, additionalEventParams) {
|
92
|
+
if (!this.options.enableArchiveAnalytics) return;
|
93
|
+
|
94
|
+
if (this.options.debugArchiveAnaltyics) {
|
95
|
+
console.log("archiveAnalyticsSendEvent", arguments, window.archive_analytics);
|
96
|
+
}
|
97
|
+
|
98
|
+
if (!window.archive_analytics) return;
|
99
|
+
additionalEventParams = additionalEventParams || {};
|
100
|
+
|
101
|
+
if (typeof value == 'number') {
|
102
|
+
additionalEventParams.ev = value;
|
103
|
+
}
|
104
|
+
|
105
|
+
window.archive_analytics.send_event(category, action, null, additionalEventParams);
|
106
|
+
};
|
107
|
+
|
108
|
+
/***/ }),
|
109
|
+
|
110
|
+
/***/ "./node_modules/core-js/modules/es.string.match.js":
|
111
|
+
/*!*********************************************************!*\
|
112
|
+
!*** ./node_modules/core-js/modules/es.string.match.js ***!
|
113
|
+
\*********************************************************/
|
114
|
+
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
115
|
+
|
116
|
+
|
117
|
+
var fixRegExpWellKnownSymbolLogic = __webpack_require__(/*! ../internals/fix-regexp-well-known-symbol-logic */ "./node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js");
|
118
|
+
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
|
119
|
+
var toLength = __webpack_require__(/*! ../internals/to-length */ "./node_modules/core-js/internals/to-length.js");
|
120
|
+
var toString = __webpack_require__(/*! ../internals/to-string */ "./node_modules/core-js/internals/to-string.js");
|
121
|
+
var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js/internals/require-object-coercible.js");
|
122
|
+
var advanceStringIndex = __webpack_require__(/*! ../internals/advance-string-index */ "./node_modules/core-js/internals/advance-string-index.js");
|
123
|
+
var regExpExec = __webpack_require__(/*! ../internals/regexp-exec-abstract */ "./node_modules/core-js/internals/regexp-exec-abstract.js");
|
124
|
+
|
125
|
+
// @@match logic
|
126
|
+
fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
|
127
|
+
return [
|
128
|
+
// `String.prototype.match` method
|
129
|
+
// https://tc39.es/ecma262/#sec-string.prototype.match
|
130
|
+
function match(regexp) {
|
131
|
+
var O = requireObjectCoercible(this);
|
132
|
+
var matcher = regexp == undefined ? undefined : regexp[MATCH];
|
133
|
+
return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](toString(O));
|
134
|
+
},
|
135
|
+
// `RegExp.prototype[@@match]` method
|
136
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype-@@match
|
137
|
+
function (string) {
|
138
|
+
var rx = anObject(this);
|
139
|
+
var S = toString(string);
|
140
|
+
var res = maybeCallNative(nativeMatch, rx, S);
|
141
|
+
|
142
|
+
if (res.done) return res.value;
|
143
|
+
|
144
|
+
if (!rx.global) return regExpExec(rx, S);
|
145
|
+
|
146
|
+
var fullUnicode = rx.unicode;
|
147
|
+
rx.lastIndex = 0;
|
148
|
+
var A = [];
|
149
|
+
var n = 0;
|
150
|
+
var result;
|
151
|
+
while ((result = regExpExec(rx, S)) !== null) {
|
152
|
+
var matchStr = toString(result[0]);
|
153
|
+
A[n] = matchStr;
|
154
|
+
if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
|
155
|
+
n++;
|
156
|
+
}
|
157
|
+
return n === 0 ? null : A;
|
158
|
+
}
|
159
|
+
];
|
160
|
+
});
|
161
|
+
|
162
|
+
|
163
|
+
/***/ })
|
164
|
+
|
165
|
+
},
|
166
|
+
/******/ function(__webpack_require__) { // webpackRuntimeModules
|
167
|
+
/******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
168
|
+
/******/ var __webpack_exports__ = (__webpack_exec__("./src/plugins/plugin.archive_analytics.js"));
|
169
|
+
/******/ }
|
170
|
+
]);
|
2
171
|
//# sourceMappingURL=plugin.archive_analytics.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"plugins/plugin.archive_analytics.js","mappings":"
|
1
|
+
{"version":3,"file":"plugins/plugin.archive_analytics.js","mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA;AACA;AACA;AACAA,MAAM,CAACC,MAAP,CAAcC,UAAU,CAACC,cAAzB,EAAyC;AACvCC,EAAAA,sBAAsB,EAAE,IADe;;AAEvC;AACAC,EAAAA,qBAAqB,EAAE;AAHgB,CAAzC;;AAMAH,UAAU,CAACI,SAAX,CAAqBC,IAArB,GAA6B,UAASC,MAAT,EAAiB;AAC5C,SAAO,YAAW;AAAA;;AAChBA,IAAAA,MAAM,CAACC,IAAP,CAAY,IAAZ;;AAEA,QAAI,KAAKC,OAAL,CAAaN,sBAAjB,EAAyC;AACvC,WAAKO,IAAL,CAAUT,UAAU,CAACU,UAAX,CAAsBC,cAAhC,EAAgD;AAAA,eAAM,KAAI,CAACC,kCAAL,EAAN;AAAA,OAAhD;AACD;AACF,GAND;AAOD,CAR2B,CAQzBZ,UAAU,CAACI,SAAX,CAAqBC,IARI,CAA5B;AAUA;;;AACAL,UAAU,CAACI,SAAX,CAAqBQ,kCAArB,GAA0D,YAAW;AACnE,MAAI,CAACC,MAAM,CAACC,iBAAZ,EAA+B;AAC7B;AACD;;AAED,MAAMC,YAA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A;AACA;AACA;AACA,CAAC","sources":["webpack://@internetarchive/bookreader/./src/plugins/plugin.archive_analytics.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.string.match.js"],"sourcesContent":["/* global BookReader, archive_analytics */\n/**\n * Plugin for Archive.org analytics\n */\njQuery.extend(BookReader.defaultOptions, {\n enableArchiveAnalytics: true,\n /** Provide a means of debugging, cause otherwise it's impossible to test locally */\n debugArchiveAnaltyics: false,\n});\n\nBookReader.prototype.init = (function(super_) {\n return function() {\n super_.call(this);\n\n if (this.options.enableArchiveAnalytics) {\n this.bind(BookReader.eventNames.fragmentChange, () => this.archiveAnalyticsSendFragmentChange());\n }\n };\n})(BookReader.prototype.init);\n\n/** @private */\nBookReader.prototype.archiveAnalyticsSendFragmentChange = function() {\n if (!window.archive_analytics) {\n return;\n }\n\n const prevFragment = this.archiveAnalyticsSendFragmentChange.prevFragment;\n\n const params = this.paramsFromCurrent();\n const newFragment = this.fragmentFromParams(params);\n\n if (prevFragment != newFragment) {\n const values = {\n bookreader: \"user_changed_view\",\n itemid: this.bookId,\n cache_bust: Math.random()\n };\n // EEK! offsite embedding and /details/ page books look the same in analytics, otherwise!\n values.offsite = 1;\n values.details = 0;\n try {\n values.offsite = window.top.location.hostname.match(/\\.archive.org$/)\n ? 0\n : 1;\n values.details =\n !values.offsite && window.top.location.pathname.match(/^\\/details\\//)\n ? 1\n : 0;\n } catch (e) {}\n // avoids embed cross site exceptions -- but on (+) side, means it is and keeps marked offite!\n\n // Send bookreader ping\n archive_analytics.send_ping(values, null, \"augment_for_ao_site\");\n\n // Also send tracking event ping\n const additionalEventParams = this.options.lendingInfo && this.options.lendingInfo.loanId\n ? { loanId: this.options.lendingInfo.loanId }\n : {};\n archive_analytics.send_event('BookReader', 'UserChangedView', window.location.pathname, additionalEventParams);\n\n this.archiveAnalyticsSendFragmentChange.prevFragment = newFragment;\n }\n};\n\n/**\n * Sends a tracking \"Event\". See https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#events\n * @param {string} category\n * @param {string} action\n * @param {number} [value] (must be an int)\n * @param {Object} [additionalEventParams]\n */\nBookReader.prototype.archiveAnalyticsSendEvent = function(category, action, value, additionalEventParams) {\n if (!this.options.enableArchiveAnalytics) return;\n\n if (this.options.debugArchiveAnaltyics) {\n console.log(\"archiveAnalyticsSendEvent\", arguments, window.archive_analytics);\n }\n\n if (!window.archive_analytics) return;\n\n additionalEventParams = additionalEventParams || {};\n if (typeof(value) == 'number') {\n additionalEventParams.ev = value;\n }\n window.archive_analytics.send_event(category, action, null, additionalEventParams);\n};\n","'use strict';\nvar fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');\nvar anObject = require('../internals/an-object');\nvar toLength = require('../internals/to-length');\nvar toString = require('../internals/to-string');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar advanceStringIndex = require('../internals/advance-string-index');\nvar regExpExec = require('../internals/regexp-exec-abstract');\n\n// @@match logic\nfixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {\n return [\n // `String.prototype.match` method\n // https://tc39.es/ecma262/#sec-string.prototype.match\n function match(regexp) {\n var O = requireObjectCoercible(this);\n var matcher = regexp == undefined ? undefined : regexp[MATCH];\n return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](toString(O));\n },\n // `RegExp.prototype[@@match]` method\n // https://tc39.es/ecma262/#sec-regexp.prototype-@@match\n function (string) {\n var rx = anObject(this);\n var S = toString(string);\n var res = maybeCallNative(nativeMatch, rx, S);\n\n if (res.done) return res.value;\n\n if (!rx.global) return regExpExec(rx, S);\n\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n var A = [];\n var n = 0;\n var result;\n while ((result = regExpExec(rx, S)) !== null) {\n var matchStr = toString(result[0]);\n A[n] = matchStr;\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n n++;\n }\n return n === 0 ? null : A;\n }\n ];\n});\n"],"names":["jQuery","extend","BookReader","defaultOptions","enableArchiveAnalytics","debugArchiveAnaltyics","prototype","init","super_","call","options","bind","eventNames","fragmentChange","archiveAnalyticsSendFragmentChange","window","archive_analytics","prevFragment","params","paramsFromCurrent","newFragment","fragmentFromParams","values","bookreader","itemid","bookId","cache_bust","Math","random","offsite","details","top","location","hostname","match","pathname","e","send_ping","additionalEventParams","lendingInfo","loanId","send_event","archiveAnalyticsSendEvent","category","action","value","console","log","arguments","ev"],"sourceRoot":""}
|
@@ -1,2 +1,164 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
(self["webpackChunk_internetarchive_bookreader"] = self["webpackChunk_internetarchive_bookreader"] || []).push([["plugins/plugin.autoplay.js"],{
|
3
|
+
|
4
|
+
/***/ "./src/plugins/plugin.autoplay.js":
|
5
|
+
/*!****************************************!*\
|
6
|
+
!*** ./src/plugins/plugin.autoplay.js ***!
|
7
|
+
\****************************************/
|
8
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
9
|
+
|
10
|
+
__webpack_require__.r(__webpack_exports__);
|
11
|
+
/* harmony import */ var core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.filter.js */ "./node_modules/core-js/modules/es.array.filter.js");
|
12
|
+
/* harmony import */ var core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_0__);
|
13
|
+
/* harmony import */ var core_js_modules_es_array_reduce_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.array.reduce.js */ "./node_modules/core-js/modules/es.array.reduce.js");
|
14
|
+
/* harmony import */ var core_js_modules_es_array_reduce_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_reduce_js__WEBPACK_IMPORTED_MODULE_1__);
|
15
|
+
/* provided dependency */ var jQuery = __webpack_require__(/*! jquery */ "jquery");
|
16
|
+
/* provided dependency */ var $ = __webpack_require__(/*! jquery */ "jquery");
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
/*global BookReader */
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Plugin which adds an autoplay feature. Useful for kiosk situations.
|
24
|
+
*/
|
25
|
+
jQuery.extend(BookReader.defaultOptions, {
|
26
|
+
enableAutoPlayPlugin: true
|
27
|
+
});
|
28
|
+
/**
|
29
|
+
* @override BookReader.setup
|
30
|
+
*/
|
31
|
+
|
32
|
+
BookReader.prototype.setup = function (super_) {
|
33
|
+
return function (options) {
|
34
|
+
super_.call(this, options);
|
35
|
+
this.auto = false;
|
36
|
+
this.autoTimer = null;
|
37
|
+
this.flipDelay = 5000;
|
38
|
+
};
|
39
|
+
}(BookReader.prototype.setup);
|
40
|
+
/**
|
41
|
+
* @override BookReader.init
|
42
|
+
*/
|
43
|
+
|
44
|
+
|
45
|
+
BookReader.prototype.init = function (super_) {
|
46
|
+
return function (options) {
|
47
|
+
var _this = this;
|
48
|
+
|
49
|
+
super_.call(this, options);
|
50
|
+
if (!this.options.enableAutoPlayPlugin) return;
|
51
|
+
this.bind(BookReader.eventNames.stop, function () {
|
52
|
+
return _this.autoStop();
|
53
|
+
});
|
54
|
+
};
|
55
|
+
}(BookReader.prototype.init);
|
56
|
+
/**
|
57
|
+
* @override BookReader.bindNavigationHandlers
|
58
|
+
*/
|
59
|
+
|
60
|
+
|
61
|
+
BookReader.prototype.bindNavigationHandlers = function (super_) {
|
62
|
+
return function () {
|
63
|
+
var _this2 = this;
|
64
|
+
|
65
|
+
super_.call(this);
|
66
|
+
if (!this.options.enableAutoPlayPlugin) return; // Note the mobile plugin attaches itself to body, so we need to select outside
|
67
|
+
|
68
|
+
var jIcons = this.$('.BRicon').add('.BRmobileMenu .BRicon');
|
69
|
+
jIcons.filter('.play').click(function () {
|
70
|
+
_this2.autoToggle();
|
71
|
+
|
72
|
+
return false;
|
73
|
+
});
|
74
|
+
jIcons.filter('.pause').click(function () {
|
75
|
+
_this2.autoToggle();
|
76
|
+
|
77
|
+
return false;
|
78
|
+
});
|
79
|
+
};
|
80
|
+
}(BookReader.prototype.bindNavigationHandlers);
|
81
|
+
/**
|
82
|
+
* Starts autoplay mode
|
83
|
+
* @param {object} overrides
|
84
|
+
* @param {number} overrides.flipSpeed
|
85
|
+
* @param {number} overrides.flipDelay
|
86
|
+
*/
|
87
|
+
|
88
|
+
|
89
|
+
BookReader.prototype.autoToggle = function (overrides) {
|
90
|
+
var _this3 = this;
|
91
|
+
|
92
|
+
if (!this.options.enableAutoPlayPlugin) return;
|
93
|
+
var options = $.extend({
|
94
|
+
flipSpeed: this.flipSpeed,
|
95
|
+
flipDelay: this.flipDelay
|
96
|
+
}, overrides);
|
97
|
+
this.flipSpeed = typeof options.flipSpeed === "number" ? options.flipSpeed : this.flipSpeed;
|
98
|
+
this.flipDelay = typeof options.flipDelay === "number" ? options.flipDelay : this.flipDelay;
|
99
|
+
this.trigger(BookReader.eventNames.stop);
|
100
|
+
var bComingFrom1up = false;
|
101
|
+
|
102
|
+
if (this.constMode2up != this.mode) {
|
103
|
+
bComingFrom1up = true;
|
104
|
+
this.switchMode(this.constMode2up);
|
105
|
+
} // Change to autofit if book is too large
|
106
|
+
|
107
|
+
|
108
|
+
if (this.reduce < this.twoPageGetAutofitReduce()) {
|
109
|
+
this.zoom('auto');
|
110
|
+
}
|
111
|
+
|
112
|
+
if (null == this.autoTimer) {
|
113
|
+
// $$$ Draw events currently cause layout problems when they occur during animation.
|
114
|
+
// There is a specific problem when changing from 1-up immediately to autoplay in RTL so
|
115
|
+
// we workaround for now by not triggering immediate animation in that case.
|
116
|
+
// See https://bugs.launchpad.net/gnubook/+bug/328327
|
117
|
+
if ('rl' == this.pageProgression && bComingFrom1up) {// don't flip immediately -- wait until timer fires
|
118
|
+
} else {
|
119
|
+
// flip immediately
|
120
|
+
this.flipFwdToIndex();
|
121
|
+
}
|
122
|
+
|
123
|
+
this.$('.play').hide();
|
124
|
+
this.$('.pause').show();
|
125
|
+
this.autoTimer = setInterval(function () {
|
126
|
+
if (_this3.animating) return;
|
127
|
+
|
128
|
+
if (Math.max(_this3.twoPage.currentIndexL, _this3.twoPage.currentIndexR) >= _this3.lastDisplayableIndex()) {
|
129
|
+
_this3.flipBackToIndex(1); // $$$ really what we want?
|
130
|
+
|
131
|
+
} else {
|
132
|
+
_this3.flipFwdToIndex();
|
133
|
+
}
|
134
|
+
}, this.flipDelay);
|
135
|
+
} else {
|
136
|
+
this.autoStop();
|
137
|
+
}
|
138
|
+
};
|
139
|
+
/**
|
140
|
+
* Stop autoplay mode, allowing animations to finish
|
141
|
+
*/
|
142
|
+
|
143
|
+
|
144
|
+
BookReader.prototype.autoStop = function () {
|
145
|
+
if (!this.options.enableAutoPlayPlugin) return;
|
146
|
+
|
147
|
+
if (null != this.autoTimer) {
|
148
|
+
clearInterval(this.autoTimer);
|
149
|
+
this.flipSpeed = 'fast';
|
150
|
+
this.$('.pause').hide();
|
151
|
+
this.$('.play').show();
|
152
|
+
this.autoTimer = null;
|
153
|
+
}
|
154
|
+
};
|
155
|
+
|
156
|
+
/***/ })
|
157
|
+
|
158
|
+
},
|
159
|
+
/******/ function(__webpack_require__) { // webpackRuntimeModules
|
160
|
+
/******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
161
|
+
/******/ var __webpack_exports__ = (__webpack_exec__("./src/plugins/plugin.autoplay.js"));
|
162
|
+
/******/ }
|
163
|
+
]);
|
2
164
|
//# sourceMappingURL=plugin.autoplay.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"plugins/plugin.autoplay.js","mappings":"
|
1
|
+
{"version":3,"file":"plugins/plugin.autoplay.js","mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AAEA;AACA;AACA;AACAA,MAAM,CAACC,MAAP,CAAcC,UAAU,CAACC,cAAzB,EAAyC;AACv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AAtC,EAAsD,CACpD;AACD,KAFD,MAEO;AACL;AACA,WAAKQ,cAAL;AACD;;AAED,SAAKhB,CAAL,CAAO,OAAP,EAAgBiB,IAAhB;AACA,SAAKjB,CAAL,CAAO,QAAP,EAAiBkB,IAAjB;AACA,SAAK3B,SAAL,GAAiB4B,WAAW,CAAC,YAAM;AACjC,UAAI,MAAI,CAACC,SAAT,EAAoB;;AAEpB,UAAIC,IAAI,CAACC,GAAL,CAAS,MAAI,CAACC,OAAL,CAAaC,aAAtB,EAAqC,MAAI,CAACD,OAAL,CAAaE,aAAlD,KAAoE,MAAI,CAACC,oBAAL,EAAxE,EAAqG;AACnG,cAAI,CAACC,eAAL,CAAqB,CAArB,EADmG,CAC1E;;AAC1B,OAFD,MAEO;AACL,cAAI,CAACX,cAAL;AACD;AACF,KAR2B,EAQzB,KAAKxB,SARoB,CAA5B;AASD,GAvBD,MAuBO;AACL,SAAKK,QAAL;AACD;AACF,CAjDD;AAmDA;AACA;AACA;;;AACAf,UAAU,CAACG,SAAX,CAAqBY,QAArB,GAAgC,YAAW;AACzC,MAAI,CAAC,KAAKT,OAAL,CAAaJ,oBAAlB,EAAwC;;AAExC,MAAI,QAAQ,KAAKO,SAAjB,EAA4B;AAC1BqC,IAAAA,aAAa,CAAC,KAAKrC,SAAN,CAAb;AACA,SAAKe,SAAL,GAAiB,MAAjB;AACA,SAAKN,CAAL,CAAO,QAAP,EAAiBiB,IAAjB;AACA,SAAKjB,CAAL,CAAO,OAAP,EAAgBkB,IAAhB;AACA,SAAK3B,SAAL,GAAiB,IAAjB;AACD;AACF,CAVD","sources":["webpack://@internetarchive/bookreader/./src/plugins/plugin.autoplay.js"],"sourcesContent":["/*global BookReader */\n\n/**\n * Plugin which adds an autoplay feature. Useful for kiosk situations.\n */\njQuery.extend(BookReader.defaultOptions, {\n enableAutoPlayPlugin: true\n});\n\n/**\n * @override BookReader.setup\n */\nBookReader.prototype.setup = (function(super_) {\n return function (options) {\n super_.call(this, options);\n\n this.auto = false;\n this.autoTimer = null;\n this.flipDelay = 5000;\n };\n})(BookReader.prototype.setup);\n\n/**\n * @override BookReader.init\n */\nBookReader.prototype.init = (function(super_) {\n return function (options) {\n super_.call(this, options);\n\n if (!this.options.enableAutoPlayPlugin) return;\n this.bind(BookReader.eventNames.stop, () => this.autoStop());\n };\n})(BookReader.prototype.init);\n\n/**\n * @override BookReader.bindNavigationHandlers\n */\nBookReader.prototype.bindNavigationHandlers = (function(super_) {\n return function() {\n super_.call(this);\n\n if (!this.options.enableAutoPlayPlugin) return;\n\n // Note the mobile plugin attaches itself to body, so we need to select outside\n const jIcons = this.$('.BRicon').add('.BRmobileMenu .BRicon');\n\n jIcons.filter('.play').click(() => {\n this.autoToggle();\n return false;\n });\n\n jIcons.filter('.pause').click(() => {\n this.autoToggle();\n return false;\n });\n };\n})(BookReader.prototype.bindNavigationHandlers);\n\n/**\n * Starts autoplay mode\n * @param {object} overrides\n * @param {number} overrides.flipSpeed\n * @param {number} overrides.flipDelay\n */\nBookReader.prototype.autoToggle = function(overrides) {\n if (!this.options.enableAutoPlayPlugin) return;\n\n const options = $.extend({\n flipSpeed: this.flipSpeed,\n flipDelay: this.flipDelay\n }, overrides);\n\n this.flipSpeed = typeof options.flipSpeed === \"number\" ? options.flipSpeed : this.flipSpeed;\n this.flipDelay = typeof options.flipDelay === \"number\" ? options.flipDelay : this.flipDelay;\n this.trigger(BookReader.eventNames.stop);\n\n let bComingFrom1up = false;\n if (this.constMode2up != this.mode) {\n bComingFrom1up = true;\n this.switchMode(this.constMode2up);\n }\n\n // Change to autofit if book is too large\n if (this.reduce < this.twoPageGetAutofitReduce()) {\n this.zoom('auto');\n }\n\n if (null == this.autoTimer) {\n // $$$ Draw events currently cause layout problems when they occur during animation.\n // There is a specific problem when changing from 1-up immediately to autoplay in RTL so\n // we workaround for now by not triggering immediate animation in that case.\n // See https://bugs.launchpad.net/gnubook/+bug/328327\n if (('rl' == this.pageProgression) && bComingFrom1up) {\n // don't flip immediately -- wait until timer fires\n } else {\n // flip immediately\n this.flipFwdToIndex();\n }\n\n this.$('.play').hide();\n this.$('.pause').show();\n this.autoTimer = setInterval(() => {\n if (this.animating) return;\n\n if (Math.max(this.twoPage.currentIndexL, this.twoPage.currentIndexR) >= this.lastDisplayableIndex()) {\n this.flipBackToIndex(1); // $$$ really what we want?\n } else {\n this.flipFwdToIndex();\n }\n }, this.flipDelay);\n } else {\n this.autoStop();\n }\n};\n\n/**\n * Stop autoplay mode, allowing animations to finish\n */\nBookReader.prototype.autoStop = function() {\n if (!this.options.enableAutoPlayPlugin) return;\n\n if (null != this.autoTimer) {\n clearInterval(this.autoTimer);\n this.flipSpeed = 'fast';\n this.$('.pause').hide();\n this.$('.play').show();\n this.autoTimer = null;\n }\n};\n"],"names":["jQuery","extend","BookReader","defaultOptions","enableAutoPlayPlugin","prototype","setup","super_","options","call","auto","autoTimer","flipDelay","init","bind","eventNames","stop","autoStop","bindNavigationHandlers","jIcons","$","add","filter","click","autoToggle","overrides","flipSpeed","trigger","bComingFrom1up","constMode2up","mode","switchMode","reduce","twoPageGetAutofitReduce","zoom","pageProgression","flipFwdToIndex","hide","show","setInterval","animating","Math","max","twoPage","currentIndexL","currentIndexR","lastDisplayableIndex","flipBackToIndex","clearInterval"],"sourceRoot":""}
|