@internetarchive/bookreader 5.0.0-24 → 5.0.0-24-sortingstate

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/.nvmrc +1 -0
  2. package/BookReader/BookReader.js +32148 -2
  3. package/BookReader/BookReader.js.map +1 -1
  4. package/BookReader/bookreader-component-bundle.js +10916 -941
  5. package/BookReader/bookreader-component-bundle.js.map +1 -1
  6. package/BookReader/icons/1up.svg +12 -1
  7. package/BookReader/icons/2up.svg +15 -1
  8. package/BookReader/icons/advance.svg +26 -3
  9. package/BookReader/icons/chevron-right.svg +1 -1
  10. package/BookReader/icons/close-circle-dark.svg +1 -1
  11. package/BookReader/icons/close-circle.svg +1 -1
  12. package/BookReader/icons/fullscreen.svg +17 -1
  13. package/BookReader/icons/fullscreen_exit.svg +17 -1
  14. package/BookReader/icons/hamburger.svg +15 -1
  15. package/BookReader/icons/left-arrow.svg +12 -1
  16. package/BookReader/icons/magnify-minus.svg +16 -1
  17. package/BookReader/icons/magnify-plus.svg +17 -1
  18. package/BookReader/icons/magnify.svg +15 -1
  19. package/BookReader/icons/pause.svg +23 -1
  20. package/BookReader/icons/play.svg +22 -1
  21. package/BookReader/icons/playback-speed.svg +34 -1
  22. package/BookReader/icons/read-aloud.svg +22 -1
  23. package/BookReader/icons/review.svg +22 -3
  24. package/BookReader/icons/thumbnails.svg +17 -1
  25. package/BookReader/icons/voice.svg +1 -1
  26. package/BookReader/icons/volume-full.svg +22 -1
  27. package/BookReader/images/BRicons.svg +94 -5
  28. package/BookReader/images/books_graphic.svg +177 -1
  29. package/BookReader/images/icon_book.svg +12 -1
  30. package/BookReader/images/icon_bookmark.svg +12 -1
  31. package/BookReader/images/icon_gear.svg +14 -1
  32. package/BookReader/images/icon_hamburger.svg +20 -1
  33. package/BookReader/images/icon_home.svg +21 -1
  34. package/BookReader/images/icon_info.svg +11 -1
  35. package/BookReader/images/icon_one_page.svg +8 -1
  36. package/BookReader/images/icon_pause.svg +1 -1
  37. package/BookReader/images/icon_play.svg +1 -1
  38. package/BookReader/images/icon_playback-rate.svg +15 -1
  39. package/BookReader/images/icon_search_button.svg +8 -1
  40. package/BookReader/images/icon_share.svg +9 -1
  41. package/BookReader/images/icon_skip-ahead.svg +6 -1
  42. package/BookReader/images/icon_skip-back.svg +13 -2
  43. package/BookReader/images/icon_speaker.svg +18 -1
  44. package/BookReader/images/icon_speaker_open.svg +10 -1
  45. package/BookReader/images/icon_thumbnails.svg +12 -1
  46. package/BookReader/images/icon_toc.svg +5 -1
  47. package/BookReader/images/icon_two_pages.svg +9 -1
  48. package/BookReader/images/marker_chap-off.svg +11 -1
  49. package/BookReader/images/marker_chap-on.svg +11 -1
  50. package/BookReader/images/marker_srch-on.svg +11 -1
  51. package/BookReader/jquery-1.10.1.js +108 -2
  52. package/BookReader/plugins/plugin.archive_analytics.js +170 -1
  53. package/BookReader/plugins/plugin.archive_analytics.js.map +1 -1
  54. package/BookReader/plugins/plugin.autoplay.js +163 -1
  55. package/BookReader/plugins/plugin.autoplay.js.map +1 -1
  56. package/BookReader/plugins/plugin.chapters.js +333 -1
  57. package/BookReader/plugins/plugin.chapters.js.map +1 -1
  58. package/BookReader/plugins/plugin.iframe.js +72 -1
  59. package/BookReader/plugins/plugin.iframe.js.map +1 -1
  60. package/BookReader/plugins/plugin.mobile_nav.js +332 -1
  61. package/BookReader/plugins/plugin.mobile_nav.js.map +1 -1
  62. package/BookReader/plugins/plugin.resume.js +241 -1
  63. package/BookReader/plugins/plugin.resume.js.map +1 -1
  64. package/BookReader/plugins/plugin.search.js +1263 -1
  65. package/BookReader/plugins/plugin.search.js.map +1 -1
  66. package/BookReader/plugins/plugin.text_selection.js +839 -1
  67. package/BookReader/plugins/plugin.text_selection.js.map +1 -1
  68. package/BookReader/plugins/plugin.tts.js +9114 -2
  69. package/BookReader/plugins/plugin.tts.js.map +1 -1
  70. package/BookReader/plugins/plugin.url.js +750 -1
  71. package/BookReader/plugins/plugin.url.js.map +1 -1
  72. package/BookReader/plugins/plugin.vendor-fullscreen.js +326 -1
  73. package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
  74. package/BookReader/webcomponents-bundle.js +411 -2
  75. package/BookReader/webcomponents-bundle.js.map +1 -1
  76. package/package.json +1 -1
  77. package/src/BookNavigator/volumes/volumes-provider.js +39 -9
  78. package/src/BookReader.js +4 -0
  79. package/src/plugins/plugin.url.js +209 -2
  80. package/tests/jest/plugins/plugin.url.test.js +160 -1
  81. package/tests/karma/BookNavigator/volumes/volumes-provider.test.js +6 -6
@@ -1,2 +1,171 @@
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)}]);
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":"mJAUsCA,E,w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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
+ {"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,YAAY,GAAG,KAAKH,kCAAL,CAAwCG,YAA7D;AAEA,MAAMC,MAAM,GAAG,KAAKC,iBAAL,EAAf;AACA,MAAMC,WAAW,GAAG,KAAKC,kBAAL,CAAwBH,MAAxB,CAApB;;AAEA,MAAID,YAAY,IAAIG,WAApB,EAAiC;AAC/B,QAAME,MAAM,GAAG;AACbC,MAAAA,UAAU,EAAE,mBADC;AAEbC,MAAAA,MAAM,EAAE,KAAKC,MAFA;AAGbC,MAAAA,UAAU,EAAEC,IAAI,CAACC,MAAL;AAHC,KAAf,CAD+B,CAM/B;;AACAN,IAAAA,M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jB,EAAwC;AACtCyC,IAAAA,OAAO,CAACC,GAAR,CAAY,2BAAZ,EAAyCC,SAAzC,EAAoDjC,MAAM,CAACC,iBAA3D;AACD;;AAED,MAAI,CAACD,MAAM,CAACC,iBAAZ,EAA+B;AAE/BsB,EAAAA,qBAAqB,GAAGA,qBAAqB,IAAI,EAAjD;;AACA,MAAI,OAAOO,KAAP,IAAiB,QAArB,EAA+B;AAC7BP,IAAAA,qBAAqB,CAACW,EAAtB,GAA2BJ,KAA3B;AACD;;AACD9B,EAAAA,MAAM,CAACC,iBAAP,CAAyByB,UAAzB,CAAoCE,QAApC,EAA8CC,MAA9C,EAAsD,IAAtD,EAA4DN,qBAA5D;AACD,CAdD;;;;;;;;;;ACvEa;AACb,oCAAoC,mBAAO,CAAC,+HAAiD;AAC7F,eAAe,mBAAO,CAAC,6EAAwB;AAC/C,eAAe,mBAAO,CAAC,6EAAwB;AAC/C,eAAe,mBAAO,CAAC,6EAAwB;AAC/C,6BAA6B,mBAAO,CAAC,2GAAuC;AAC5E,yBAAyB,mBAAO,CAAC,mGAAmC;AACpE,iBAAiB,mBAAO,CAAC,mGAAmC;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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";(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)}]);
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":"mKAYuCA,E,oBAPvCC,EAAOC,OAAOC,WAAWC,eAAgB,CACvCC,sBAAsB,IAMxBF,WAAWG,UAAUC,OAAkBP,EAQpCG,WAAWG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AAE,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":""}
1
+ {"version":3,"file":"plugins/plugin.autoplay.js","mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AAEA;AACA;AACA;AACAA,MAAM,CAACC,MAAP,CAAcC,UAAU,CAACC,cAAzB,EAAyC;AACvCC,EAAAA,oBAAoB,EAAE;AADiB,CAAzC;AAIA;AACA;AACA;;AACAF,UAAU,CAACG,SAAX,CAAqBC,KAArB,GAA8B,UAASC,MAAT,EAAiB;AAC7C,SAAO,UAAUC,OAAV,EAAmB;AACxBD,IAAAA,MAAM,CAACE,IAAP,CAAY,IAAZ,EAAkBD,OAAlB;AAEA,SAAKE,IAAL,GAAiB,KAAjB;AACA,SAAKC,SAAL,GAAiB,IAAjB;AACA,SAAKC,SAAL,GAAiB,IAAjB;AACD,GAND;AAOD,CAR4B,CAQ1BV,UAAU,CAACG,SAAX,CAAqBC,KARK,CAA7B;AAUA;AACA;AACA;;;AACAJ,UAAU,CAACG,SAAX,CAAqBQ,IAArB,GAA6B,UAASN,MAAT,EAAiB;AAC5C,SAAO,UAAUC,OAAV,EAAmB;AAAA;;AACxBD,IAAAA,MAAM,CAACE,IAAP,CAAY,IAAZ,EAAkBD,OAAlB;AAEA,QAAI,CAAC,KAAKA,OAAL,CAAaJ,oBAAlB,EAAwC;AACxC,SAAKU,IAAL,CAAUZ,UAAU,CAACa,UAAX,CAAsBC,IAAhC,EAAsC;AAAA,aAAM,KAAI,CAACC,QAAL,EAAN;AAAA,KAAtC;AACD,GALD;AAMD,CAP2B,CAOzBf,UAAU,CAACG,SAAX,CAAqBQ,IAPI,CAA5B;AASA;AACA;AACA;;;AACAX,UAAU,CAACG,SA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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":""}