@internetarchive/bookreader 5.0.0-86 → 5.0.0-87

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[393],{5964:function(t,e,i){i(2008),i(6099);var o,a=i(1669),n=i(1669);a.extend(BookReader.defaultOptions,{enableAutoPlayPlugin:!0}),BookReader.prototype.setup=(o=BookReader.prototype.setup,function(t){o.call(this,t),this.auto=!1,this.autoTimer=null,this.flipDelay=5e3}),BookReader.prototype.init=function(t){return function(e){var i=this;t.call(this,e),this.options.enableAutoPlayPlugin&&this.bind(BookReader.eventNames.stop,(function(){return i.autoStop()}))}}(BookReader.prototype.init),BookReader.prototype.bindNavigationHandlers=function(t){return function(){var e=this;if(t.call(this),this.options.enableAutoPlayPlugin){var i=this.$(".BRicon");i.filter(".play").click((function(){return e.autoToggle(),!1})),i.filter(".pause").click((function(){return e.autoToggle(),!1}))}}}(BookReader.prototype.bindNavigationHandlers),BookReader.prototype.autoToggle=function(t){var e=this;if(this.options.enableAutoPlayPlugin){var i=n.extend({flipSpeed:this.flipSpeed,flipDelay:this.flipDelay},t);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)),null==this.autoTimer?("rl"==this.pageProgression&&o||this.next({triggerStop:!1}),this.$(".play").hide(),this.$(".pause").show(),this.autoTimer=setInterval((function(){e.animating||(Math.max(e.twoPage.currentIndexL,e.twoPage.currentIndexR)>=e.book.getNumLeafs()-1?e.prev({triggerStop:!1}):e.next({triggerStop:!1}))}),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(t){t(t.s=5964)}]);
1
+ "use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[393],{5964:function(t,e,i){i(2008),i(3792),i(6099),i(7495),i(7764),i(5746),i(2953),i(8408);var o,a=i(1669),n=i(1669);a.extend(BookReader.defaultOptions,{enableAutoPlayPlugin:!0}),BookReader.prototype.setup=(o=BookReader.prototype.setup,function(t){o.call(this,t),this.autoTimer=null,this.flipDelay=5e3}),BookReader.prototype.init=function(t){return function(e){var i=this;t.call(this,e),this.options.enableAutoPlayPlugin&&(this.bind(BookReader.eventNames.stop,(function(){return i.autoStop()})),"1"===new URLSearchParams(window.location.search).get("autoflip")&&this.autoToggle())}}(BookReader.prototype.init),BookReader.prototype.bindNavigationHandlers=function(t){return function(){var e=this;if(t.call(this),this.options.enableAutoPlayPlugin){var i=this.$(".BRicon");i.filter(".play").click((function(){return e.autoToggle(),!1})),i.filter(".pause").click((function(){return e.autoToggle(),!1}))}}}(BookReader.prototype.bindNavigationHandlers),BookReader.prototype.autoToggle=function(t){var e=this;if(this.options.enableAutoPlayPlugin){var i=n.extend({flipSpeed:this.flipSpeed,flipDelay:this.flipDelay},t);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)),null==this.autoTimer?("rl"==this.pageProgression&&o||this.next({triggerStop:!1}),this.$(".play").hide(),this.$(".pause").show(),this.autoTimer=setInterval((function(){e.animating||(Math.max(e.twoPage.currentIndexL,e.twoPage.currentIndexR)>=e.book.getNumLeafs()-1?e.prev({triggerStop:!1}):e.next({triggerStop:!1}))}),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(t){t(t.s=5964)}]);
2
2
  //# 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,UAAUC,MAPf,SAAUC,GACfR,EAAOS,KAAKC,KAAMF,GAElBE,KAAKC,MAAY,EACjBD,KAAKE,UAAY,KACjBF,KAAKG,UAAY,GACnB,GAMFV,WAAWG,UAAUQ,KAAQ,SAASd,GACpC,OAAO,SAAUQ,GAAS,IAAAO,EAAA,KACxBf,EAAOS,KAAKC,KAAMF,GAEbE,KAAKF,QAAQH,sBAClBK,KAAKM,KAAKb,WAAWc,WAAWC,MAAM,kBAAMH,EAAKI,UAAU,GAC7D,CACF,CAP6B,CAO1BhB,WAAWG,UAAUQ,MAKxBX,WAAWG,UAAUc,uBAA0B,SAASpB,GACtD,OAAO,WAAW,IAAAqB,EAAA,KAGhB,GAFArB,EAAOS,KAAKC,MAEPA,KAAKF,QAAQH,qBAAlB,CAEA,IAAMiB,EAASZ,KAAKa,EAAE,WAEtBD,EAAOE,OAAO,SAASC,OAAM,WAE3B,OADAJ,EAAKK,cACE,CACT,IAEAJ,EAAOE,OAAO,UAAUC,OAAM,WAE5B,OADAJ,EAAKK,cACE,CACT,GAZ8C,CAahD,CACF,CAlB+C,CAkB5CvB,WAAWG,UAAUc,wBAQxBjB,WAAWG,UAAUoB,WAAa,SAASC,GAAW,IAAAC,EAAA,KACpD,GAAKlB,KAAKF,QAAQH,qBAAlB,CAEA,IAAMG,EAAUe,EAAErB,OAAO,CACvB2B,UAAWnB,KAAKmB,UAChBhB,UAAWH,KAAKG,WACfc,GAEHjB,KAAKmB,UAAyC,iBAAtBrB,EAAQqB,UAAyBrB,EAAQqB,UAAYnB,KAAKmB,UAClFnB,KAAKG,UAAyC,iBAAtBL,EAAQK,UAAyBL,EAAQK,UAAYH,KAAKG,UAClFH,KAAKoB,QAAQ3B,WAAWc,WAAWC,MAEnC,IAAIa,GAAiB,EACjBrB,KAAKsB,cAAgBtB,KAAKuB,OAC5BF,GAAiB,EACjBrB,KAAKwB,WAAWxB,KAAKsB,eAGnB,MAAQtB,KAAKE,WAKV,MAAQF,KAAKyB,iBAAoBJ,GAIpCrB,KAAK0B,KAAK,CAAEC,aAAa,IAG3B3B,KAAKa,EAAE,SAASe,OAChB5B,KAAKa,EAAE,UAAUgB,OACjB7B,KAAKE,UAAY4B,aAAY,WACvBZ,EAAKa,YAELC,KAAKC,IAAIf,EAAKgB,QAAQC,cAAejB,EAAKgB,QAAQE,gBAAkBlB,EAAKmB,KAAKC,cAAgB,EAChGpB,EAAKqB,KAAK,CAAEZ,aAAa,IAEzBT,EAAKQ,KAAK,CAAEC,aAAa,IAE7B,GAAG3B,KAAKG,YAERH,KAAKS,UAzCuC,CA2ChD,EAKAhB,WAAWG,UAAUa,SAAW,WACzBT,KAAKF,QAAQH,sBAEd,MAAQK,KAAKE,YACfsC,cAAcxC,KAAKE,WACnBF,KAAKmB,UAAY,OACjBnB,KAAKa,EAAE,UAAUe,OACjB5B,KAAKa,EAAE,SAASgB,OAChB7B,KAAKE,UAAY,KAErB,C","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 const jIcons = this.$('.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 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.next({ triggerStop: false });\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.book.getNumLeafs() - 1) {\n this.prev({ triggerStop: false }); // $$$ really what we want?\n } else {\n this.next({ triggerStop: false });\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","_this","bind","eventNames","stop","autoStop","bindNavigationHandlers","_this2","jIcons","$","filter","click","autoToggle","overrides","_this3","flipSpeed","trigger","bComingFrom1up","constMode2up","mode","switchMode","pageProgression","next","triggerStop","hide","show","setInterval","animating","Math","max","twoPage","currentIndexL","currentIndexR","book","getNumLeafs","prev","clearInterval"],"sourceRoot":""}
1
+ {"version":3,"file":"plugins/plugin.autoplay.js","mappings":"mNAYuCA,E,oBAPvCC,EAAOC,OAAOC,WAAWC,eAAgB,CACvCC,sBAAsB,IAMxBF,WAAWG,UAAUC,OAAkBP,EAOpCG,WAAWG,UAAUC,MANf,SAAUC,GACfR,EAAOS,KAAKC,KAAMF,GAElBE,KAAKC,UAAY,KACjBD,KAAKE,UAAY,GACnB,GAMFT,WAAWG,UAAUO,KAAQ,SAASb,GACpC,OAAO,SAAUQ,GAAS,IAAAM,EAAA,KACxBd,EAAOS,KAAKC,KAAMF,GAEbE,KAAKF,QAAQH,uBAElBK,KAAKK,KAAKZ,WAAWa,WAAWC,MAAM,kBAAMH,EAAKI,UAAU,IAGzB,MADhB,IAAIC,gBAAgBC,OAAOC,SAASC,QACxCC,IAAI,aAChBb,KAAKc,aAET,CACF,CAb6B,CAa1BrB,WAAWG,UAAUO,MAKxBV,WAAWG,UAAUmB,uBAA0B,SAASzB,GACtD,OAAO,WAAW,IAAA0B,EAAA,KAGhB,GAFA1B,EAAOS,KAAKC,MAEPA,KAAKF,QAAQH,qBAAlB,CAEA,IAAMsB,EAASjB,KAAKkB,EAAE,WAEtBD,EAAOE,OAAO,SAASC,OAAM,WAE3B,OADAJ,EAAKF,cACE,CACT,IAEAG,EAAOE,OAAO,UAAUC,OAAM,WAE5B,OADAJ,EAAKF,cACE,CACT,GAZ8C,CAahD,CACF,CAlB+C,CAkB5CrB,WAAWG,UAAUmB,wBAQxBtB,WAAWG,UAAUkB,WAAa,SAASO,GAAW,IAAAC,EAAA,KACpD,GAAKtB,KAAKF,QAAQH,qBAAlB,CAEA,IAAMG,EAAUoB,EAAE1B,OAAO,CACvB+B,UAAWvB,KAAKuB,UAChBrB,UAAWF,KAAKE,WACfmB,GAEHrB,KAAKuB,UAAyC,iBAAtBzB,EAAQyB,UAAyBzB,EAAQyB,UAAYvB,KAAKuB,UAClFvB,KAAKE,UAAyC,iBAAtBJ,EAAQI,UAAyBJ,EAAQI,UAAYF,KAAKE,UAClFF,KAAKwB,QAAQ/B,WAAWa,WAAWC,MAEnC,IAAIkB,GAAiB,EACjBzB,KAAK0B,cAAgB1B,KAAK2B,OAC5BF,GAAiB,EACjBzB,KAAK4B,WAAW5B,KAAK0B,eAGnB,MAAQ1B,KAAKC,WAKV,MAAQD,KAAK6B,iBAAoBJ,GAIpCzB,KAAK8B,KAAK,CAAEC,aAAa,IAG3B/B,KAAKkB,EAAE,SAASc,OAChBhC,KAAKkB,EAAE,UAAUe,OACjBjC,KAAKC,UAAYiC,aAAY,WACvBZ,EAAKa,YAELC,KAAKC,IAAIf,EAAKgB,QAAQC,cAAejB,EAAKgB,QAAQE,gBAAkBlB,EAAKmB,KAAKC,cAAgB,EAChGpB,EAAKqB,KAAK,CAAEZ,aAAa,IAEzBT,EAAKQ,KAAK,CAAEC,aAAa,IAE7B,GAAG/B,KAAKE,YAERF,KAAKQ,UAzCuC,CA2ChD,EAKAf,WAAWG,UAAUY,SAAW,WACzBR,KAAKF,QAAQH,sBAEd,MAAQK,KAAKC,YACf2C,cAAc5C,KAAKC,WACnBD,KAAKuB,UAAY,OACjBvB,KAAKkB,EAAE,UAAUc,OACjBhC,KAAKkB,EAAE,SAASe,OAChBjC,KAAKC,UAAY,KAErB,C","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.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\n this.bind(BookReader.eventNames.stop, () => this.autoStop());\n\n const urlParams = new URLSearchParams(window.location.search);\n if (urlParams.get('autoflip') === '1') {\n this.autoToggle();\n }\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 const jIcons = this.$('.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 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.next({ triggerStop: false });\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.book.getNumLeafs() - 1) {\n this.prev({ triggerStop: false }); // $$$ really what we want?\n } else {\n this.next({ triggerStop: false });\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","autoTimer","flipDelay","init","_this","bind","eventNames","stop","autoStop","URLSearchParams","window","location","search","get","autoToggle","bindNavigationHandlers","_this2","jIcons","$","filter","click","overrides","_this3","flipSpeed","trigger","bComingFrom1up","constMode2up","mode","switchMode","pageProgression","next","triggerStop","hide","show","setInterval","animating","Math","max","twoPage","currentIndexL","currentIndexR","book","getNumLeafs","prev","clearInterval"],"sourceRoot":""}
@@ -16,7 +16,6 @@ function getFromUrl(name, def) {
16
16
  const ocaid = urlParams.get('ocaid');
17
17
  const openFullImmersionTheater = urlParams.get('view') === 'theater';
18
18
  const ui = urlParams.get('ui');
19
- const autoflip = urlParams.get('autoflip');
20
19
  const searchTerm = urlParams.get('q');
21
20
 
22
21
  const iaBookReader = document.querySelector('ia-bookreader');
@@ -46,12 +45,6 @@ BookReader.optionOverrides.imagesBaseURL = '/BookReader/images/';
46
45
  const initializeBookReader = (brManifest) => {
47
46
  console.log('initializeBookReader', brManifest);
48
47
 
49
- const customAutoflipParams = {
50
- autoflip: !!autoflip,
51
- flipSpeed: parseFloat(getFromUrl('flipSpeed', '2000')),
52
- flipDelay: parseFloat(getFromUrl('flipDelay', '5000')),
53
- };
54
-
55
48
  const options = {
56
49
  el: '#BookReader',
57
50
  /* Url plugin - IA uses History mode for URL */
@@ -90,9 +83,6 @@ const initializeBookReader = (brManifest) => {
90
83
 
91
84
  const isRestricted = brManifest.data.isRestricted;
92
85
  window.dispatchEvent(new CustomEvent('contextmenu', { detail: { isRestricted } }));
93
- if (customAutoflipParams.autoflip) {
94
- window.br.autoToggle(customAutoflipParams);
95
- }
96
86
  };
97
87
 
98
88
  window.initializeBookReader = initializeBookReader;
package/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 5.0.0-87
2
+ - Fix: turn on autoplay option @cdrini
3
+
1
4
  # 5.0.0-86
2
5
  - Fix: Make JSON requests with cookies for protected books @cdrini
3
6
 
package/index.html CHANGED
@@ -23,7 +23,7 @@
23
23
  <!-- plugin.search.js -->
24
24
  <li><a href="BookReaderDemo/demo-internetarchive.html?ocaid=adventureofsherl0000unse">From Internet Archive - a book with CHAPTERS</a></li>
25
25
  <li><a href="BookReaderDemo/demo-iiif.html">IIIF</a></li>
26
- <li><a href="BookReaderDemo/demo-autoplay.html">Autoplay (kiosk mode)</a></li>
26
+ <li><a href="BookReaderDemo/demo-internetarchive.html?ocaid=goodytwoshoes00newyiala&autoflip=1">Autoplay (kiosk mode)</a></li>
27
27
  <li><a href="BookReaderDemo/demo-plugin-menu-toggle.html">Plugin: Full screen menu toggle</a></li>
28
28
  <li><a href="BookReaderDemo/immersion-mode.html">Start in immersion (fullscreen) mode</a></li>
29
29
  <!-- plugin.search.js -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/bookreader",
3
- "version": "5.0.0-86",
3
+ "version": "5.0.0-87",
4
4
  "description": "The Internet Archive BookReader.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,7 +14,6 @@ BookReader.prototype.setup = (function(super_) {
14
14
  return function (options) {
15
15
  super_.call(this, options);
16
16
 
17
- this.auto = false;
18
17
  this.autoTimer = null;
19
18
  this.flipDelay = 5000;
20
19
  };
@@ -28,7 +27,13 @@ BookReader.prototype.init = (function(super_) {
28
27
  super_.call(this, options);
29
28
 
30
29
  if (!this.options.enableAutoPlayPlugin) return;
30
+
31
31
  this.bind(BookReader.eventNames.stop, () => this.autoStop());
32
+
33
+ const urlParams = new URLSearchParams(window.location.search);
34
+ if (urlParams.get('autoflip') === '1') {
35
+ this.autoToggle();
36
+ }
32
37
  };
33
38
  })(BookReader.prototype.init);
34
39
 
@@ -5,7 +5,7 @@ const getLocationHref = ClientFunction(() => window.location.href.toString());
5
5
  const FLIP_SPEED = 1000;
6
6
  const FIRST_PAGE_DELAY = 2000;
7
7
 
8
- fixture `Autoplay plugin`.page `${params.baseUrl}/BookReaderDemo/demo-autoplay.html`;
8
+ fixture `Autoplay plugin`.page `${params.baseUrl}/BookReaderDemo/demo-internetarchive.html?ocaid=goody&autoflip=1`;
9
9
 
10
10
  test('page auto-advances after allotted flip speed and delay', async t => {
11
11
  await t.wait(2 * FLIP_SPEED + FIRST_PAGE_DELAY);
@@ -18,10 +18,6 @@ describe('Plugin: Menu Toggle', () => {
18
18
  test('has option flag', () => {
19
19
  expect(BookReader.defaultOptions.enableAutoPlayPlugin).toEqual(true);
20
20
  });
21
- test('has added BR property: auto', () => {
22
- expect(br).toHaveProperty('auto');
23
- expect(br.auto).toEqual(false);
24
- });
25
21
  test('has added BR property: autoTimer', () => {
26
22
  expect(br).toHaveProperty('autoTimer');
27
23
  expect(br.autoTimer).toEqual(null);
@@ -1,59 +0,0 @@
1
- //
2
- // This file shows the minimum you need to provide to BookReader to display a book
3
- //
4
- // Copyright(c)2008-2009 Internet Archive. Software license AGPL version 3.
5
-
6
- // Create the BookReader object
7
- function instantiateBookReader(selector, extraOptions) {
8
- selector = selector || '#BookReader';
9
- extraOptions = extraOptions || {};
10
- var options = {
11
- ppi: 100,
12
- data: [
13
- [
14
- { width: 800, height: 1200,
15
- uri: '//archive.org/download/BookReader/img/page001.jpg' },
16
- ],
17
- [
18
- { width: 800, height: 1200,
19
- uri: '//archive.org/download/BookReader/img/page002.jpg' },
20
- { width: 800, height: 1200,
21
- uri: '//archive.org/download/BookReader/img/page003.jpg' },
22
- ],
23
- [
24
- { width: 800, height: 1200,
25
- uri: '//archive.org/download/BookReader/img/page004.jpg' },
26
- { width: 800, height: 1200,
27
- uri: '//archive.org/download/BookReader/img/page005.jpg' },
28
- ]
29
- ],
30
-
31
- // Book title and the URL used for the book title link
32
- bookTitle: 'BookReader Demo',
33
- bookUrl: '../index.html',
34
- bookUrlText: 'Back to Demos',
35
- bookUrlTitle: 'This is the book URL title',
36
-
37
- // thumbnail is optional, but it is used in the info dialog
38
- thumbnail: '//archive.org/download/BookReader/img/page014.jpg',
39
- // Metadata is optional, but it is used in the info dialog
40
- metadata: [
41
- {label: 'Title', value: 'Open Library BookReader Presentation'},
42
- {label: 'Author', value: 'Internet Archive'},
43
- {label: 'Demo Info', value: 'This demo shows how one could use BookReader with their own content.'},
44
- ],
45
-
46
- // Override the path used to find UI images
47
- imagesBaseURL: '../BookReader/images/',
48
-
49
- ui: 'full', // embed, full (responsive)
50
-
51
- el: selector,
52
- };
53
- $.extend(options, extraOptions);
54
- var br = new BookReader(options);
55
- br.init();
56
- setTimeout(function() {
57
- br.autoToggle(options);
58
- }, 0);
59
- }
@@ -1,37 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>BookReader fullscreen demo</title>
5
-
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
7
- <meta name="apple-mobile-web-app-capable" content="yes">
8
-
9
- <!-- JS dependencies -->
10
- <script src="../BookReader/webcomponents-bundle.js"></script>
11
- <script src="../BookReader/jquery-3.js"></script>
12
-
13
-
14
- <!-- BookReader and plugins -->
15
- <link rel="stylesheet" href="../BookReader/BookReader.css"/>
16
- <script src="../BookReader/BookReader.js"></script>
17
-
18
- <!-- Autoplay plugin -->
19
- <script src="../BookReader/plugins/plugin.autoplay.js"></script>
20
-
21
- <!-- URL-changing plugin -->
22
- <script src="../BookReader/plugins/plugin.url.js"></script>
23
-
24
- <style>
25
- html, body { width: 100%; height: 100%; margin: 0; padding: 0; }
26
- #BookReader { width: 100%; height: 100%; }
27
- </style>
28
- </head>
29
- <body>
30
- <div id="BookReader"></div>
31
- <script type="text/javascript" src="BookReaderJSAutoplay.js"></script>
32
- <script>instantiateBookReader(null, {
33
- flipSpeed: 1000,
34
- flipDelay: 2000
35
- })</script>
36
- </body>
37
- </html>