@internetarchive/bookreader 5.0.0-30-c → 5.0.0-31
Sign up to get free protection for your applications and to get access to all the features.
- package/BookReader/BookReader.js +2 -32267
- package/BookReader/BookReader.js.LICENSE.txt +117 -0
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/ia-bookreader-bundle.js +1144 -14913
- package/BookReader/ia-bookreader-bundle.js.LICENSE.txt +39 -0
- package/BookReader/ia-bookreader-bundle.js.map +1 -1
- package/BookReader/jquery-1.10.1.js +2 -108
- package/BookReader/jquery-1.10.1.js.LICENSE.txt +24 -0
- package/BookReader/plugins/plugin.archive_analytics.js +1 -170
- package/BookReader/plugins/plugin.archive_analytics.js.map +1 -1
- package/BookReader/plugins/plugin.autoplay.js +1 -163
- package/BookReader/plugins/plugin.autoplay.js.map +1 -1
- package/BookReader/plugins/plugin.chapters.js +1 -333
- package/BookReader/plugins/plugin.chapters.js.map +1 -1
- package/BookReader/plugins/plugin.iframe.js +1 -72
- package/BookReader/plugins/plugin.iframe.js.map +1 -1
- package/BookReader/plugins/plugin.mobile_nav.js +1 -332
- package/BookReader/plugins/plugin.mobile_nav.js.map +1 -1
- package/BookReader/plugins/plugin.resume.js +1 -241
- package/BookReader/plugins/plugin.resume.js.map +1 -1
- package/BookReader/plugins/plugin.search.js +1 -1261
- package/BookReader/plugins/plugin.search.js.map +1 -1
- package/BookReader/plugins/plugin.text_selection.js +1 -839
- package/BookReader/plugins/plugin.text_selection.js.map +1 -1
- package/BookReader/plugins/plugin.tts.js +2 -9115
- package/BookReader/plugins/plugin.tts.js.LICENSE.txt +27 -0
- package/BookReader/plugins/plugin.tts.js.map +1 -1
- package/BookReader/plugins/plugin.url.js +1 -811
- package/BookReader/plugins/plugin.url.js.map +1 -1
- package/BookReader/plugins/plugin.vendor-fullscreen.js +1 -326
- package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
- package/BookReader/webcomponents-bundle.js +2 -411
- package/BookReader/webcomponents-bundle.js.LICENSE.txt +9 -0
- package/BookReader/webcomponents-bundle.js.map +1 -1
- package/BookReaderDemo/demo-internetarchive.html +2 -1
- package/CHANGELOG.md +6 -0
- package/package.json +2 -2
- package/src/BookNavigator/book-navigator.js +1 -1
- package/src/BookReader/Mode1Up.js +0 -1
- package/src/BookReader/Mode1UpLit.js +0 -4
- package/src/ia-bookreader/ia-bookreader.js +22 -14
- package/stat/BookNavigator/BookNavigator.js +1 -1
- package/stat/BookReaderComponent/BookReaderComponent.js +2 -2
- package/tests/karma/BookNavigator/book-navigator.test.js +1 -1
- package/webpack.config.js +1 -1
@@ -0,0 +1,24 @@
|
|
1
|
+
/*!
|
2
|
+
* Sizzle CSS Selector Engine v2.2.0-pre
|
3
|
+
* http://sizzlejs.com/
|
4
|
+
*
|
5
|
+
* Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
|
6
|
+
* Released under the MIT license
|
7
|
+
* http://jquery.org/license
|
8
|
+
*
|
9
|
+
* Date: 2014-12-16
|
10
|
+
*/
|
11
|
+
|
12
|
+
/*!
|
13
|
+
* jQuery JavaScript Library v1.11.3
|
14
|
+
* http://jquery.com/
|
15
|
+
*
|
16
|
+
* Includes Sizzle.js
|
17
|
+
* http://sizzlejs.com/
|
18
|
+
*
|
19
|
+
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
|
20
|
+
* Released under the MIT license
|
21
|
+
* http://jquery.org/license
|
22
|
+
*
|
23
|
+
* Date: 2015-04-28T16:19Z
|
24
|
+
*/
|
@@ -1,171 +1,2 @@
|
|
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
|
-
]);
|
1
|
+
"use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[810],{2815:function(e,n,t){var a;t(4916),t(4723),t(3609).extend(BookReader.defaultOptions,{enableArchiveAnalytics:!0,debugArchiveAnaltyics:!1}),BookReader.prototype.init=(a=BookReader.prototype.init,function(){var e=this;a.call(this),this.options.enableArchiveAnalytics&&this.bind(BookReader.eventNames.fragmentChange,(function(){return e.archiveAnalyticsSendFragmentChange()}))}),BookReader.prototype.archiveAnalyticsSendFragmentChange=function(){if(window.archive_analytics){var e=this.archiveAnalyticsSendFragmentChange.prevFragment,n=this.paramsFromCurrent(),t=this.fragmentFromParams(n);if(e!=t){var a={bookreader:"user_changed_view",itemid:this.bookId,cache_bust:Math.random(),offsite:1,details:0};try{a.offsite=window.top.location.hostname.match(/\.archive.org$/)?0:1,a.details=!a.offsite&&window.top.location.pathname.match(/^\/details\//)?1:0}catch(e){}archive_analytics.send_ping(a,null,"augment_for_ao_site");var i=this.options.lendingInfo&&this.options.lendingInfo.loanId?{loanId:this.options.lendingInfo.loanId}:{};archive_analytics.send_event("BookReader","UserChangedView",window.location.pathname,i),this.archiveAnalyticsSendFragmentChange.prevFragment=t}}},BookReader.prototype.archiveAnalyticsSendEvent=function(e,n,t,a){this.options.enableArchiveAnalytics&&(this.options.debugArchiveAnaltyics&&console.log("archiveAnalyticsSendEvent",arguments,window.archive_analytics),window.archive_analytics&&(a=a||{},"number"==typeof t&&(a.ev=t),window.archive_analytics.send_event(e,n,null,a)))}},4723:function(e,n,t){var a=t(7007),i=t(9670),o=t(7466),r=t(1340),s=t(4488),c=t(1530),l=t(7651);a("match",(function(e,n,t){return[function(n){var t=s(this),a=null==n?void 0:n[e];return void 0!==a?a.call(n,t):new RegExp(n)[e](r(t))},function(e){var a=i(this),s=r(e),h=t(n,a,s);if(h.done)return h.value;if(!a.global)return l(a,s);var d=a.unicode;a.lastIndex=0;for(var v,u=[],f=0;null!==(v=l(a,s));){var p=r(v[0]);u[f]=p,""===p&&(a.lastIndex=c(s,o(a.lastIndex),d)),f++}return 0===f?null:u}]}))}},function(e){e(e.s=2815)}]);
|
171
2
|
//# 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":"mJAUsCA,E,wBAN/BC,OAAOC,WAAWC,eAAgB,CACvCC,wBAAwB,EAExBC,uBAAuB,IAGzBH,WAAWI,UAAUC,MAAiBP,EAQnCE,WAAWI,UAAUC,KAPf,WAAW,WAChBP,EAAOQ,KAAKC,MAERA,KAAKC,QAAQN,wBACfK,KAAKE,KAAKT,WAAWU,WAAWC,gBAAgB,kBAAM,EAAKC,0CAMjEZ,WAAWI,UAAUQ,mCAAqC,WACxD,GAAKC,OAAOC,kBAAZ,CAIA,IAAMC,EAAeR,KAAKK,mCAAmCG,aAEvDC,EAAST,KAAKU,oBACdC,EAAcX,KAAKY,mBAAmBH,GAE5C,GAAID,GAAgBG,EAAa,CAC/B,IAAME,EAAS,CACbC,WAAY,oBACZC,OAAQf,KAAKgB,OACbC,WAAYC,KAAKC,SAGnBN,QAAiB,EACjBA,QAAiB,GACjB,IACEA,EAAOO,QAAUd,OAAOe,IAAIC,SAASC,SAASC,MAAM,kBAChD,EACA,EACJX,EAAOY,SACJZ,EAAOO,SAAWd,OAAOe,IAAIC,SAASI,SAASF,MAAM,gBAClD,EACA,EACN,MAAOG,IAITpB,kBAAkBqB,UAAUf,EAAQ,KAAM,uBAG1C,IAAMgB,EAAwB7B,KAAKC,QAAQ6B,aAAe9B,KAAKC,QAAQ6B,YAAYC,OAC/E,CAAEA,OAAQ/B,KAAKC,QAAQ6B,YAAYC,QACnC,GACJxB,kBAAkByB,WAAW,aAAc,kBAAmB1B,OAAOgB,SAASI,SAAUG,GAExF7B,KAAKK,mCAAmCG,aAAeG,KAW3DlB,WAAWI,UAAUoC,0BAA4B,SAASC,EAAUC,EAAQC,EAAOP,GAC5E7B,KAAKC,QAAQN,yBAEdK,KAAKC,QAAQL,uBACfyC,QAAQC,IAAI,4BAA6BC,UAAWjC,OAAOC,mBAGxDD,OAAOC,oBAEZsB,EAAwBA,GAAyB,GAC5B,iBAAVO,IACTP,EAAsBW,GAAKJ,GAE7B9B,OAAOC,kBAAkByB,WAAWE,EAAUC,EAAQ,KAAMN,O,qBCnF9D,IAAIY,EAAgC,EAAQ,MACxCC,EAAW,EAAQ,MACnBC,EAAW,EAAQ,MACnBC,EAAW,EAAQ,MACnBC,EAAyB,EAAQ,MACjCC,EAAqB,EAAQ,MAC7BC,EAAa,EAAQ,MAGzBN,EAA8B,SAAS,SAAUO,EAAOC,EAAaC,GACnE,MAAO,CAGL,SAAeC,GACb,IAAIC,EAAIP,EAAuB7C,MAC3BqD,EAAoBC,MAAVH,OAAsBG,EAAYH,EAAOH,GACvD,YAAmBM,IAAZD,EAAwBA,EAAQtD,KAAKoD,EAAQC,GAAK,IAAIG,OAAOJ,GAAQH,GAAOJ,EAASQ,KAI9F,SAAUI,GACR,IAAIC,EAAKf,EAAS1C,MACd0D,EAAId,EAASY,GACbG,EAAMT,EAAgBD,EAAaQ,EAAIC,GAE3C,GAAIC,EAAIC,KAAM,OAAOD,EAAIvB,MAEzB,IAAKqB,EAAGI,OAAQ,OAAOd,EAAWU,EAAIC,GAEtC,IAAII,EAAcL,EAAGM,QACrBN,EAAGO,UAAY,EAIf,IAHA,IAEIC,EAFAC,EAAI,GACJC,EAAI,EAEgC,QAAhCF,EAASlB,EAAWU,EAAIC,KAAc,CAC5C,IAAIU,EAAWxB,EAASqB,EAAO,IAC/BC,EAAEC,GAAKC,EACU,KAAbA,IAAiBX,EAAGO,UAAYlB,EAAmBY,EAAGf,EAASc,EAAGO,WAAYF,IAClFK,IAEF,OAAa,IAANA,EAAU,KAAOD,S","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":["super_","extend","BookReader","defaultOptions","enableArchiveAnalytics","debugArchiveAnaltyics","prototype","init","call","this","options","bind","eventNames","fragmentChange","archiveAnalyticsSendFragmentChange","window","archive_analytics","prevFragment","params","paramsFromCurrent","newFragment","fragmentFromParams","values","bookreader","itemid","bookId","cache_bust","Math","random","offsite","top","location","hostname","match","details","pathname","e","send_ping","additionalEventParams","lendingInfo","loanId","send_event","archiveAnalyticsSendEvent","category","action","value","console","log","arguments","ev","fixRegExpWellKnownSymbolLogic","anObject","toLength","toString","requireObjectCoercible","advanceStringIndex","regExpExec","MATCH","nativeMatch","maybeCallNative","regexp","O","matcher","undefined","RegExp","string","rx","S","res","done","global","fullUnicode","unicode","lastIndex","result","A","n","matchStr"],"sourceRoot":""}
|
@@ -1,164 +1,2 @@
|
|
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
|
-
]);
|
1
|
+
"use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[320],{2024:function(e,t,i){i(7327),i(5827);var o,a=i(3609),n=i(3609);a.extend(BookReader.defaultOptions,{enableAutoPlayPlugin:!0}),BookReader.prototype.setup=(o=BookReader.prototype.setup,function(e){o.call(this,e),this.auto=!1,this.autoTimer=null,this.flipDelay=5e3}),BookReader.prototype.init=function(e){return function(t){var i=this;e.call(this,t),this.options.enableAutoPlayPlugin&&this.bind(BookReader.eventNames.stop,(function(){return i.autoStop()}))}}(BookReader.prototype.init),BookReader.prototype.bindNavigationHandlers=function(e){return function(){var t=this;if(e.call(this),this.options.enableAutoPlayPlugin){var i=this.$(".BRicon").add(".BRmobileMenu .BRicon");i.filter(".play").click((function(){return t.autoToggle(),!1})),i.filter(".pause").click((function(){return t.autoToggle(),!1}))}}}(BookReader.prototype.bindNavigationHandlers),BookReader.prototype.autoToggle=function(e){var t=this;if(this.options.enableAutoPlayPlugin){var i=n.extend({flipSpeed:this.flipSpeed,flipDelay:this.flipDelay},e);this.flipSpeed="number"==typeof i.flipSpeed?i.flipSpeed:this.flipSpeed,this.flipDelay="number"==typeof i.flipDelay?i.flipDelay:this.flipDelay,this.trigger(BookReader.eventNames.stop);var o=!1;this.constMode2up!=this.mode&&(o=!0,this.switchMode(this.constMode2up)),this.reduce<this.twoPageGetAutofitReduce()&&this.zoom("auto"),null==this.autoTimer?("rl"==this.pageProgression&&o||this.flipFwdToIndex(),this.$(".play").hide(),this.$(".pause").show(),this.autoTimer=setInterval((function(){t.animating||(Math.max(t.twoPage.currentIndexL,t.twoPage.currentIndexR)>=t.lastDisplayableIndex()?t.flipBackToIndex(1):t.flipFwdToIndex())}),this.flipDelay)):this.autoStop()}},BookReader.prototype.autoStop=function(){this.options.enableAutoPlayPlugin&&null!=this.autoTimer&&(clearInterval(this.autoTimer),this.flipSpeed="fast",this.$(".pause").hide(),this.$(".play").show(),this.autoTimer=null)}}},function(e){e(e.s=2024)}]);
|
164
2
|
//# 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":"mKAYuCA,E,oBAPvCC,EAAOC,OAAOC,WAAWC,eAAgB,CACvCC,sBAAsB,IAMxBF,WAAWG,UAAUC,OAAkBP,EAQpCG,WAAWG,UAAUC,MAPf,SAAUC,GACfR,EAAOS,KAAKC,KAAMF,GAElBE,KAAKC,MAAY,EACjBD,KAAKE,UAAY,KACjBF,KAAKG,UAAY,MAOrBV,WAAWG,UAAUQ,KAAQ,SAASd,GACpC,OAAO,SAAUQ,GAAS,WACxBR,EAAOS,KAAKC,KAAMF,GAEbE,KAAKF,QAAQH,sBAClBK,KAAKK,KAAKZ,WAAWa,WAAWC,MAAM,kBAAM,EAAKC,eALxB,CAO1Bf,WAAWG,UAAUQ,MAKxBX,WAAWG,UAAUa,uBAA0B,SAASnB,GACtD,OAAO,WAAW,WAGhB,GAFAA,EAAOS,KAAKC,MAEPA,KAAKF,QAAQH,qBAAlB,CAGA,IAAMe,EAASV,KAAKW,EAAE,WAAWC,IAAI,yBAErCF,EAAOG,OAAO,SAASC,OAAM,WAE3B,OADA,EAAKC,cACE,KAGTL,EAAOG,OAAO,UAAUC,OAAM,WAE5B,OADA,EAAKC,cACE,OAhBkC,CAmB5CtB,WAAWG,UAAUa,wBAQxBhB,WAAWG,UAAUmB,WAAa,SAASC,GAAW,WACpD,GAAKhB,KAAKF,QAAQH,qBAAlB,CAEA,IAAMG,EAAUa,EAAEnB,OAAO,CACvByB,UAAWjB,KAAKiB,UAChBd,UAAWH,KAAKG,WACfa,GAEHhB,KAAKiB,UAAyC,iBAAtBnB,EAAQmB,UAAyBnB,EAAQmB,UAAYjB,KAAKiB,UAClFjB,KAAKG,UAAyC,iBAAtBL,EAAQK,UAAyBL,EAAQK,UAAYH,KAAKG,UAClFH,KAAKkB,QAAQzB,WAAWa,WAAWC,MAEnC,IAAIY,GAAiB,EACjBnB,KAAKoB,cAAgBpB,KAAKqB,OAC5BF,GAAiB,EACjBnB,KAAKsB,WAAWtB,KAAKoB,eAInBpB,KAAKuB,OAASvB,KAAKwB,2BACrBxB,KAAKyB,KAAK,QAGR,MAAQzB,KAAKE,WAKV,MAAQF,KAAK0B,iBAAoBP,GAIpCnB,KAAK2B,iBAGP3B,KAAKW,EAAE,SAASiB,OAChB5B,KAAKW,EAAE,UAAUkB,OACjB7B,KAAKE,UAAY4B,aAAY,WACvB,EAAKC,YAELC,KAAKC,IAAI,EAAKC,QAAQC,cAAe,EAAKD,QAAQE,gBAAkB,EAAKC,uBAC3E,EAAKC,gBAAgB,GAErB,EAAKX,oBAEN3B,KAAKG,YAERH,KAAKQ,aAOTf,WAAWG,UAAUY,SAAW,WACzBR,KAAKF,QAAQH,sBAEd,MAAQK,KAAKE,YACfqC,cAAcvC,KAAKE,WACnBF,KAAKiB,UAAY,OACjBjB,KAAKW,EAAE,UAAUiB,OACjB5B,KAAKW,EAAE,SAASkB,OAChB7B,KAAKE,UAAY,S","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":["super_","jQuery","extend","BookReader","defaultOptions","enableAutoPlayPlugin","prototype","setup","options","call","this","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":""}
|