@internetarchive/bookreader 5.0.0-66 → 5.0.0-68

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. package/BookReader/BookReader.css +68 -918
  2. package/BookReader/BookReader.js +1 -1
  3. package/BookReader/BookReader.js.map +1 -1
  4. package/BookReader/ia-bookreader-bundle.js +118 -128
  5. package/BookReader/ia-bookreader-bundle.js.map +1 -1
  6. package/BookReader/plugins/plugin.autoplay.js +1 -1
  7. package/BookReader/plugins/plugin.autoplay.js.map +1 -1
  8. package/BookReader/plugins/plugin.chapters.js +24 -1
  9. package/BookReader/plugins/plugin.chapters.js.map +1 -1
  10. package/BookReader/plugins/plugin.search.js.map +1 -1
  11. package/BookReader/plugins/plugin.tts.js +1 -1
  12. package/BookReader/plugins/plugin.tts.js.map +1 -1
  13. package/BookReaderDemo/BookReaderDemo.css +0 -18
  14. package/BookReaderDemo/BookReaderJSAdvanced.js +0 -3
  15. package/BookReaderDemo/demo-autoplay.html +0 -2
  16. package/BookReaderDemo/demo-fullscreen-mobile.html +1 -4
  17. package/BookReaderDemo/demo-fullscreen.html +0 -3
  18. package/BookReaderDemo/demo-iiif.js +0 -1
  19. package/BookReaderDemo/demo-internetarchive.html +41 -3
  20. package/BookReaderDemo/demo-vendor-fullscreen.html +0 -3
  21. package/BookReaderDemo/immersion-1up.html +0 -1
  22. package/BookReaderDemo/immersion-mode.html +0 -3
  23. package/BookReaderDemo/toggle_controls.html +1 -1
  24. package/CHANGELOG.md +10 -0
  25. package/index.html +1 -1
  26. package/package.json +9 -9
  27. package/src/BookNavigator/book-navigator.js +4 -3
  28. package/src/BookReader/Mode1Up.js +1 -1
  29. package/src/BookReader/Mode1UpLit.js +1 -1
  30. package/src/BookReader/Navbar/Navbar.js +2 -2
  31. package/src/BookReader/events.js +0 -1
  32. package/src/BookReader.js +1 -2
  33. package/src/css/BookReader.scss +1 -5
  34. package/src/css/_BRnav.scss +5 -10
  35. package/src/css/_BRsearch.scss +6 -2
  36. package/src/css/_controls.scss +3 -2
  37. package/src/plugins/plugin.autoplay.js +1 -2
  38. package/src/plugins/plugin.chapters.js +201 -169
  39. package/src/plugins/search/plugin.search.js +0 -3
  40. package/src/plugins/tts/plugin.tts.js +1 -1
  41. package/tests/e2e/base.test.js +3 -11
  42. package/tests/e2e/helpers/base.js +26 -26
  43. package/tests/e2e/helpers/rightToLeft.js +4 -4
  44. package/tests/e2e/helpers/{desktopSearch.js → search.js} +19 -19
  45. package/tests/e2e/models/Navigation.js +16 -42
  46. package/tests/e2e/viewmode.test.js +3 -3
  47. package/tests/jest/plugins/plugin.chapters.test.js +92 -76
  48. package/tests/jest/plugins/search/plugin.search.view.test.js +0 -1
  49. package/webpack.config.js +0 -1
  50. package/BookReader/plugins/plugin.mobile_nav.js +0 -2
  51. package/BookReader/plugins/plugin.mobile_nav.js.map +0 -1
  52. package/src/css/_MobileNav.scss +0 -194
  53. package/src/plugins/plugin.mobile_nav.js +0 -288
  54. package/tests/e2e/helpers/mobileSearch.js +0 -85
  55. package/tests/jest/plugins/plugin.mobile_nav.test.js +0 -66
@@ -3,7 +3,7 @@ import { SEARCH_INSIDE_URL_RE , mockResponseFound, mockResponseNotFound,
3
3
  TEST_TEXT_FOUND, TEST_TEXT_NOT_FOUND, PAGE_FIRST_RESULT, SEARCH_MATCHES_LENGTH } from './mockSearch';
4
4
 
5
5
 
6
- export function runDesktopSearchTests(br) {
6
+ export function runSearchTests(br) {
7
7
  //building mock response for successful and unsuccessful search
8
8
  const mockFound = RequestMock()
9
9
  .onRequestTo(SEARCH_INSIDE_URL_RE )
@@ -15,32 +15,32 @@ export function runDesktopSearchTests(br) {
15
15
 
16
16
 
17
17
  test
18
- .requestHooks(mockFound)('Desktop search - successful search', async t => {
18
+ .requestHooks(mockFound)('Search - successful search', async t => {
19
19
  const nav = br.nav;
20
20
 
21
21
  //assuring that the search bar is enabled
22
- await t.expect(nav.desktop.searchIcon.visible).ok();
23
- await t.click(nav.desktop.searchIcon);
22
+ await t.expect(nav.searchIcon.visible).ok();
23
+ await t.click(nav.searchIcon);
24
24
 
25
25
  //testing search for a word found in the book
26
- await t.selectText(nav.desktop.searchBox).pressKey('delete');
26
+ await t.selectText(nav.searchBox).pressKey('delete');
27
27
  // FIXME: Why is it only typing every other letter?!?!
28
- await t.typeText(nav.desktop.searchBox, TEST_TEXT_FOUND.split('').join('_'));
28
+ await t.typeText(nav.searchBox, TEST_TEXT_FOUND.split('').join('_'));
29
29
  await t.pressKey('enter');
30
30
 
31
- await t.expect(nav.desktop.searchPin.exists).ok();
32
- await t.expect(nav.desktop.searchPin.child('.BRquery').child('main').exists).ok();
33
- await t.expect(nav.desktop.searchPin.child('.BRquery').child('main').innerText).contains(TEST_TEXT_FOUND);
34
- await t.expect(nav.desktop.searchNavigation.exists).ok();
35
- await t.expect(nav.desktop.searchNavigation.find('[data-id="resultsCount"]').exists).ok();
36
- await t.expect(nav.desktop.searchNavigation.find('[data-id="resultsCount"]').innerText).contains(SEARCH_MATCHES_LENGTH);
31
+ await t.expect(nav.searchPin.exists).ok();
32
+ await t.expect(nav.searchPin.child('.BRquery').child('main').exists).ok();
33
+ await t.expect(nav.searchPin.child('.BRquery').child('main').innerText).contains(TEST_TEXT_FOUND);
34
+ await t.expect(nav.searchNavigation.exists).ok();
35
+ await t.expect(nav.searchNavigation.find('[data-id="resultsCount"]').exists).ok();
36
+ await t.expect(nav.searchNavigation.find('[data-id="resultsCount"]').innerText).contains(SEARCH_MATCHES_LENGTH);
37
37
 
38
38
  //checking url
39
39
  const getPageUrl = ClientFunction(() => window.location.href.toString());
40
40
  await t.expect(getPageUrl()).contains(TEST_TEXT_FOUND);
41
41
 
42
42
  //checks clicking on first search pin opens correct page
43
- await t.click(nav.desktop.searchPin);
43
+ await t.click(nav.searchPin);
44
44
  await t.expect(getPageUrl()).contains(PAGE_FIRST_RESULT);
45
45
 
46
46
  //checks highlight on result page is visible
@@ -51,19 +51,19 @@ export function runDesktopSearchTests(br) {
51
51
 
52
52
 
53
53
  test
54
- .requestHooks(mockNotFound)('Desktop search - unsuccessful search', async t => {
54
+ .requestHooks(mockNotFound)('Search - unsuccessful search', async t => {
55
55
  const nav = br.nav;
56
56
 
57
57
  //assuring that the search bar is enabled
58
- await t.expect(nav.desktop.searchIcon.visible).ok();
59
- await t.click(nav.desktop.searchIcon);
58
+ await t.expect(nav.searchIcon.visible).ok();
59
+ await t.click(nav.searchIcon);
60
60
 
61
61
  //testing search for a word not found in the book
62
- await t.selectText(nav.desktop.searchBox).pressKey('delete');
62
+ await t.selectText(nav.searchBox).pressKey('delete');
63
63
  // FIXME: Why is it only typing every other letter?!?!
64
- await t.typeText(nav.desktop.searchBox, TEST_TEXT_NOT_FOUND.split('').join('_'));
64
+ await t.typeText(nav.searchBox, TEST_TEXT_NOT_FOUND.split('').join('_'));
65
65
  await t.pressKey('enter');
66
- await t.expect(nav.desktop.searchPin.child('.BRquery').child('main').withText(TEST_TEXT_NOT_FOUND).exists).notOk();
66
+ await t.expect(nav.searchPin.child('.BRquery').child('main').withText(TEST_TEXT_NOT_FOUND).exists).notOk();
67
67
 
68
68
  const getPageUrl = ClientFunction(() => window.location.href.toString());
69
69
  await t.expect(getPageUrl()).contains(TEST_TEXT_NOT_FOUND);
@@ -5,61 +5,35 @@ export default class Navigation {
5
5
  constructor() {
6
6
  this.topNavShell = new Selector('.BRtoolbar');
7
7
  this.bottomNavShell = new Selector('.BRfooter');
8
- this.mobileMenu = new Selector('.BRmobileMenu');
9
8
  this.itemNav = Selector('ia-bookreader').shadowRoot().find('ia-item-navigator').shadowRoot();
10
- this.desktop = new DesktopNav(this.bottomNavShell, this.itemNav);
11
- this.mobile = new MobileNav(this.mobileMenu, this.topNavShell);
12
- }
13
- }
14
9
 
15
- /**
16
- * DesktopNav Model
17
- * @class
18
- * @classdesc defines DesktopNav base elements
19
- */
20
- export class DesktopNav {
21
- /**
22
- * @param {Selector} bottomToolbar
23
- * @param {Selector} itemNav
24
- */
25
- constructor(bottomToolbar, itemNav) {
26
10
  // flipping
27
- this.goLeft = bottomToolbar.find('.BRicon.book_left');
28
- this.goRight = bottomToolbar.find('.BRicon.book_right');
29
- this.goNext = bottomToolbar.find('.BRicon.book_flip_next');
30
- this.goPrev = bottomToolbar.find('.BRicon.book_flip_prev');
11
+ this.goLeft = this.bottomNavShell.find('.BRicon.book_left');
12
+ this.goRight = this.bottomNavShell.find('.BRicon.book_right');
13
+ this.goNext = this.bottomNavShell.find('.BRicon.book_flip_next');
14
+ this.goPrev = this.bottomNavShell.find('.BRicon.book_flip_prev');
31
15
 
32
16
  // mode switching
33
- this.mode1Up = bottomToolbar.find('.BRicon.onepg');
34
- this.mode2Up = bottomToolbar.find('.BRicon.twopg');
35
- this.modeThumb = bottomToolbar.find('.BRicon.thumb');
36
- this.viewmode = bottomToolbar.find('.BRicon.viewmode');
17
+ this.mode1Up = this.bottomNavShell.find('.BRicon.onepg');
18
+ this.mode2Up = this.bottomNavShell.find('.BRicon.twopg');
19
+ this.modeThumb = this.bottomNavShell.find('.BRicon.thumb');
20
+ this.viewmode = this.bottomNavShell.find('.BRicon.viewmode');
37
21
 
38
22
  // zoom
39
- this.zoomIn = bottomToolbar.find('.BRicon.zoom_in');
40
- this.zoomOut = bottomToolbar.find('.BRicon.zoom_out');
23
+ this.zoomIn = this.bottomNavShell.find('.BRicon.zoom_in');
24
+ this.zoomOut = this.bottomNavShell.find('.BRicon.zoom_out');
41
25
 
42
26
  // search
43
- this.searchIcon = itemNav.find('button.shortcut.search');
44
- this.searchBox = itemNav
27
+ this.searchIcon = this.itemNav.find('button.shortcut.search');
28
+ this.searchBox = this.itemNav
45
29
  .find('ia-menu-slider').shadowRoot()
46
30
  .find('ia-book-search-results').shadowRoot()
47
31
  .find('input[name=query]');
48
- this.searchPin = bottomToolbar.find('.BRsearch');
49
- this.searchNavigation = bottomToolbar.find('.BRsearch-navigation');
32
+ this.searchPin = this.bottomNavShell.find('.BRsearch');
33
+ this.searchNavigation = this.bottomNavShell.find('.BRsearch-navigation');
50
34
 
51
35
  // other
52
- this.fullScreen = bottomToolbar.find('.BRicon.full');
53
- this.sliderRange = bottomToolbar.find('.ui-slider-range');
54
- }
55
- }
56
-
57
- class MobileNav {
58
- constructor(mobileMenu, topToolbar) {
59
- this.hamburgerButton = topToolbar.find('.BRmobileHamburger');
60
- this.menuSearchButton = mobileMenu.find('.BRmobileMenu__search');
61
- this.searchBox = mobileMenu.find('#BRsearch_tray');
62
- this.searchResults = mobileMenu.find('[data-id="results"]');
63
- this.searchResultText = this.searchResults.child(0).find('p');
36
+ this.fullScreen = this.bottomNavShell.find('.BRicon.full');
37
+ this.sliderRange = this.bottomNavShell.find('.ui-slider-range');
64
38
  }
65
39
  }
@@ -20,21 +20,21 @@ ocaids.forEach(ocaid => {
20
20
  await t.pressKey('right');
21
21
 
22
22
  // 1up to 2up
23
- await t.click(nav.desktop.viewmode);
23
+ await t.click(nav.viewmode);
24
24
  const twoPageContainer = Selector('.BRmode2up');
25
25
  await t.expect(twoPageContainer.visible).ok();
26
26
  const twoPageImages = twoPageContainer.find('img.BRpageimage');
27
27
  await t.expect(twoPageImages.count).gte(2);
28
28
 
29
29
  // 2up to thumb
30
- await t.click(nav.desktop.viewmode);
30
+ await t.click(nav.viewmode);
31
31
  const thumbnailContainer = Selector('.BRmodeThumb');
32
32
  await t.expect(thumbnailContainer.visible).ok();
33
33
  const thumbImages = thumbnailContainer.find('.BRpageview img');
34
34
  await t.expect(thumbImages.count).gt(0);
35
35
 
36
36
  // thumb to 1up
37
- await t.click(nav.desktop.viewmode);
37
+ await t.click(nav.viewmode);
38
38
  const onePageViewContainer = Selector('br-mode-1up');
39
39
  await t.expect(onePageViewContainer.visible).ok();
40
40
  const onePageImages = onePageViewContainer.find('.BRmode1up .BRpagecontainer');
@@ -1,37 +1,35 @@
1
- import sinon from 'sinon';
1
+ import sinon from "sinon";
2
2
 
3
- import BookReader from '@/src/BookReader.js';
4
- import '@/src/plugins/plugin.mobile_nav.js';
5
- import '@/src/plugins/plugin.chapters.js';
3
+ import BookReader from "@/src/BookReader.js";
4
+ import "@/src/plugins/plugin.chapters.js";
5
+ import { BookModel } from "@/src/BookReader/BookModel";
6
+ import { deepCopy } from "../utils";
6
7
 
7
8
  const SAMPLE_TOC = [{
8
9
  "pagenum": "3",
9
10
  "level": 1,
10
11
  "label": "CHAPTER I",
11
- "type": {"key": "/type/toc_item"},
12
+ "type": { "key": "/type/toc_item" },
12
13
  "title": "THE COUNTRY AND THE MISSION 1",
13
14
  "pageIndex": 3,
14
- },{
15
+ }, {
15
16
  "pagenum": "17",
16
17
  "level": 1,
17
18
  "label": "CHAPTER II",
18
- "type": {"key": "/type/toc_item"},
19
+ "type": { "key": "/type/toc_item" },
19
20
  "title": "THE COUNTRY AND THE MISSION 2",
20
21
  "pageIndex": 17,
21
- },
22
- {
22
+ }, {
23
23
  "pagenum": "undefined",
24
24
  "level": 1,
25
25
  "label": "CHAPTER III",
26
- "type": {"key": "/type/toc_item"},
26
+ "type": { "key": "/type/toc_item" },
27
27
  "title": "THE COUNTRY AND THE MISSION 3",
28
- "pageIndex": undefined,
29
- },
30
- {
28
+ }, {
31
29
  "pagenum": "40",
32
30
  "level": 1,
33
31
  "label": "CHAPTER IV",
34
- "type": {"key": "/type/toc_item"},
32
+ "type": { "key": "/type/toc_item" },
35
33
  "title": "THE COUNTRY AND THE MISSION 4",
36
34
  "pageIndex": 40,
37
35
  }];
@@ -41,89 +39,107 @@ const SAMPLE_TOC_UNDEF = [
41
39
  "pagenum": "undefined",
42
40
  "level": 1,
43
41
  "label": "CHAPTER I",
44
- "type": {"key": "/type/toc_item"},
42
+ "type": { "key": "/type/toc_item" },
45
43
  "title": "THE COUNTRY AND THE MISSION 1",
46
- "pageIndex": undefined,
47
44
  },
48
45
  {
49
46
  "pagenum": "undefined",
50
47
  "level": 1,
51
48
  "label": "CHAPTER II",
52
- "type": {"key": "/type/toc_item"},
49
+ "type": { "key": "/type/toc_item" },
53
50
  "title": "THE COUNTRY AND THE MISSION 2",
54
- "pageIndex": undefined,
55
- }
51
+ },
56
52
  ];
57
53
 
58
- /** @type {BookReader} */
59
- let br;
60
- beforeEach(() => {
61
- $.ajax = jest.fn().mockImplementation((args) => {
62
- return Promise.resolve([{
63
- table_of_contents: SAMPLE_TOC,
64
- }]);
65
- });
66
- document.body.innerHTML = '<div id="BookReader">';
67
- br = new BookReader();
68
- });
69
-
70
54
  afterEach(() => {
71
- jest.clearAllMocks();
55
+ sinon.restore();
72
56
  });
73
57
 
74
- describe('Plugin: Menu Toggle', () => {
75
- test('has option flag', () => {
76
- expect(BookReader.defaultOptions.enableChaptersPlugin).toEqual(true);
77
- });
78
- test('has added BR property: olHost', () => {
79
- expect(br).toHaveProperty('olHost');
80
- expect(br.olHost).toBeTruthy();
81
- });
82
- test('has added BR property: bookId', () => {
83
- expect(br).toHaveProperty('bookId');
84
- expect(br.bookId).toBeFalsy();
85
- });
86
- test('fetches OL Book Record on init', () => {
87
- br.getOpenLibraryRecord = jest.fn();
88
- br.init();
89
- expect(br.getOpenLibraryRecord).toHaveBeenCalled();
90
- });
91
- test('Updates Table of Contents when available', () => {
92
- br.init();
93
- expect($.ajax).toHaveBeenCalled();
58
+ describe("BRChaptersPlugin", () => {
59
+ beforeEach(() => {
60
+ sinon.stub(BookModel.prototype, "getPageIndex").callsFake((str) =>
61
+ parseFloat(str)
62
+ );
94
63
  });
95
- });
96
64
 
97
- describe('updateTOCState', () => {
65
+ describe("_chaptersInit", () => {
66
+ test("does not render when no open library record", async () => {
67
+ const fakeBR = {
68
+ options: {},
69
+ getOpenLibraryRecord: async () => null,
70
+ _chaptersRender: sinon.stub(),
71
+ };
72
+ await BookReader.prototype._chapterInit.call(fakeBR);
73
+ expect(fakeBR._chaptersRender.callCount).toBe(0);
74
+ });
98
75
 
99
- beforeEach(() => {
100
- window.HTMLElement.prototype.scrollIntoView = sinon.stub();
101
- br.book.getPageIndex = (str) => parseFloat(str);
102
- br.init();
103
- });
76
+ test("does not render when open library record with no TOC", async () => {
77
+ const fakeBR = {
78
+ options: {},
79
+ getOpenLibraryRecord: async () => ({ key: "/books/OL1M" }),
80
+ _chaptersRender: sinon.stub(),
81
+ };
82
+ await BookReader.prototype._chapterInit.call(fakeBR);
83
+ expect(fakeBR._chaptersRender.callCount).toBe(0);
84
+ });
104
85
 
105
- test('Test page is one of TOC', () => {
106
- br.updateTOCState(20, SAMPLE_TOC);
107
- expect($('li.BRtable-contents-el')[1].classList.contains('current-chapter'));
86
+ test("renders if valid TOC on open library", async () => {
87
+ const fakeBR = {
88
+ options: {},
89
+ bind: sinon.stub(),
90
+ book: {
91
+ getPageIndex: (str) => parseFloat(str),
92
+ },
93
+ getOpenLibraryRecord: async () => ({
94
+ "title": "The Adventures of Sherlock Holmes",
95
+ "table_of_contents": deepCopy(SAMPLE_TOC_UNDEF),
96
+ "ocaid": "adventureofsherl0000unse",
97
+ }),
98
+ _chaptersRender: sinon.stub(),
99
+ };
100
+ await BookReader.prototype._chapterInit.call(fakeBR);
101
+ expect(fakeBR._chaptersRender.callCount).toBe(1);
102
+ });
108
103
  });
109
104
 
110
- test('Only one element has .current-chapter', () => {
111
- br.updateTOCState(9, SAMPLE_TOC);
112
- expect($('li.BRtable-contents-el.current-chapter').length).toBe(1);
105
+ describe('_chaptersRender', () => {
106
+ test('renders markers and panel', () => {
107
+ const fakeBR = {
108
+ _tocEntries: SAMPLE_TOC,
109
+ _chaptersRenderMarker: sinon.stub(),
110
+ shell: {
111
+ menuProviders: {},
112
+ updateMenuContents: sinon.stub(),
113
+ }
114
+ };
115
+ BookReader.prototype._chaptersRender.call(fakeBR);
116
+ expect(fakeBR.shell.menuProviders['chapters']).toBeTruthy();
117
+ expect(fakeBR.shell.updateMenuContents.callCount).toBe(1);
118
+ expect(fakeBR._chaptersRenderMarker.callCount).toBeGreaterThan(1);
119
+ });
113
120
  });
114
121
 
115
- test('No chapter has .current-chapter if current index is < than any chapter index', () => {
116
- br.updateTOCState(1, SAMPLE_TOC);
117
- expect($('li.BRtable-contents-el.current-chapter').length).toBe(0);
118
- });
122
+ describe('_chaptersUpdateCurrent', () => {
123
+ test('highlights the current chapter', () => {
124
+ const fakeBR = {
125
+ mode: 2,
126
+ firstIndex: 16,
127
+ displayedIndices: [16, 17],
128
+ _tocEntries: SAMPLE_TOC,
129
+ _chaptersPanel: {
130
+ currentChapter: null,
131
+ }
132
+ };
133
+ BookReader.prototype._chaptersUpdateCurrent.call(fakeBR);
134
+ expect(fakeBR._chaptersPanel.currentChapter).toEqual(SAMPLE_TOC[1]);
119
135
 
120
- test('if current index == chapter index ', () => {
121
- br.updateTOCState(17, SAMPLE_TOC);
122
- expect($('li.BRtable-contents-el')[1].classList.contains('current-chapter'));
123
- });
136
+ fakeBR.mode = 1;
137
+ BookReader.prototype._chaptersUpdateCurrent.call(fakeBR);
138
+ expect(fakeBR._chaptersPanel.currentChapter).toEqual(SAMPLE_TOC[0]);
124
139
 
125
- test('No chapter has .current-chapter if all chapter have undefined pageIndex ', () => {
126
- br.updateTOCState(10, SAMPLE_TOC_UNDEF);
127
- expect($('li.BRtable-contents-el.current-chapter').length).toBe(0);
140
+ fakeBR.firstIndex = 0;
141
+ BookReader.prototype._chaptersUpdateCurrent.call(fakeBR);
142
+ expect(fakeBR._chaptersPanel.currentChapter).toBeUndefined();
143
+ });
128
144
  });
129
145
  });
@@ -1,6 +1,5 @@
1
1
 
2
2
  import BookReader from '@/src/BookReader.js';
3
- import '@/src/plugins/plugin.mobile_nav.js';
4
3
  import '@/src/plugins/search/plugin.search.js';
5
4
  import { marshallSearchResults } from '@/src/plugins/search/utils.js';
6
5
  import '@/src/plugins/search/view.js';
package/webpack.config.js CHANGED
@@ -46,7 +46,6 @@ module.exports = [
46
46
  'plugins/plugin.autoplay.js': { import: './src/plugins/plugin.autoplay.js', dependOn: 'BookReader.js' },
47
47
  'plugins/plugin.chapters.js': { import: './src/plugins/plugin.chapters.js', dependOn: 'BookReader.js' },
48
48
  'plugins/plugin.iframe.js': { import: './src/plugins/plugin.iframe.js', dependOn: 'BookReader.js' },
49
- 'plugins/plugin.mobile_nav.js': { import: './src/plugins/plugin.mobile_nav.js', dependOn: 'BookReader.js' },
50
49
  'plugins/plugin.resume.js': { import: './src/plugins/plugin.resume.js', dependOn: 'BookReader.js' },
51
50
  'plugins/plugin.search.js': { import: './src/plugins/search/plugin.search.js', dependOn: 'BookReader.js' },
52
51
  'plugins/plugin.text_selection.js': { import: './src/plugins/plugin.text_selection.js', dependOn: 'BookReader.js' },
@@ -1,2 +0,0 @@
1
- (self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[111],{2878:function(e,n,t){"use strict";t(9826),t(1539),t(2222),t(7327);var s,a=t(5685),i=(t(866),t(2026),t(5311)),o=t(5311),r=[{filter:"grayscale(100%)",label:"Grayscale"},{filter:"brightness(120%)",label:"High brightness"},{filter:"invert(100%)",label:"Inverted (dark mode)"},{filter:"contrast(120%)",label:"High contrast"}];i.extend(BookReader.defaultOptions,{enableMobileNav:!0,mobileNavTitle:"Internet Archive",mobileNavFullscreenOnly:!1}),BookReader.prototype.setup=(s=BookReader.prototype.setup,function(e){s.call(this,e),this.enableMobileNav=e.enableMobileNav,this.mobileNavTitle=e.mobileNavTitle,this.mobileNavFullscreenOnly=e.mobileNavFullscreenOnly,this.refs.$mmenu=null}),BookReader.prototype.initToolbar=function(e){return function(n,t){var s,i=this;if(this.enableMobileNav){var r=this.buildMobileDrawerElement();this.refs.$br.append(r),this.buildInfoDiv(this.$(".BRmobileInfo")),this.buildShareDiv(this.$(".BRmobileShare")),(s=r).mmenu({navbars:[{position:"top"}],navbar:{add:!0,title:this.mobileNavTitle,titleLink:"panel"},extensions:["panelshadow"]},{offCanvas:{wrapPageIfNeeded:!1,zposition:"next",pageSelector:this.el}});var c=s.find(".BRpageviewValue");s.data("mmenu").bind("opened",(function(){c.length&&c.val(window.location.href)})),r.find(".BRcheckbox-filters").on("click",(function(){return l(r,i)})),r.find(".DrawerLayoutButton.one_page_mode").on("click",(function(){return i.switchMode(i.constMode1up)})),r.find(".DrawerLayoutButton.two_page_mode").on("click",(function(){return i.switchMode(i.constMode2up)})),r.find(".DrawerLayoutButton.thumbnail_mode").on("click",(function(){return i.switchMode(i.constModeThumb)})),this.mobileNavFullscreenOnly?o(document.body).addClass("BRbodyMobileNavEnabledFullscreen"):o(document.body).addClass("BRbodyMobileNavEnabled"),this.refs.$mmenu=s}e.apply(this,arguments),this.enableMobileNav&&(this.$(".BRmobileHamburger").click((function(){s.data("mmenu").getInstance().vars.opened?s.data("mmenu").close():(s.data("mmenu").open(),i.trigger("mobileNavOpen"))})),window.addEventListener("resize",a.debounce((function(e){var n=o(window).width();s.data("mmenu").getInstance().vars.opened&&n>=800&&s.data("mmenu").close()}),900)))}}(BookReader.prototype.initToolbar),BookReader.prototype.buildToolbarElement=function(e){return function(){var n=e.call(this);if(this.enableMobileNav){var t=BookReader.util.escapeHTML(this.bookTitle),s='\n <span class="BRmobileHamburgerWrapper">\n <button class="BRmobileHamburger"></button>\n <span class="BRtoolbarMobileTitle" title="'.concat(t,'">').concat(t,"</span>\n </span>\n ");n.addClass("responsive").prepend(o(s))}return n}}(BookReader.prototype.buildToolbarElement),BookReader.prototype.buildMobileDrawerElement=function(){var e="";this.enableExperimentalControls&&(e='\n <p class="DrawerSettingsTitle">Visual Adjustment</p>\n <div class="BRcheckbox-group-filters">\n ',r.forEach((function(n,t){var s='\n <input type="checkbox" class="BRcheckbox-filters" id="filter'.concat(t,'">\n <label for="filter').concat(t,'" class="BRcheckbox-label-filters">').concat(n.label,"</label><br>\n \n ");e=e.concat(s)})),e=e.concat("</div>"));var n='\n <span>\n <span class="DrawerIconWrapper">\n <img class="DrawerIcon" src="'.concat("".concat(this.imagesBaseURL,"icon_gear.svg"),'" alt="settings-icon"/>\n </span>\n Settings\n </span>\n <div class=DrawerSettingsWrapper>\n <div class="DrawerSettingsLayoutWrapper">\n <button class="DrawerLayoutButton one_page_mode">\n <img src="',this.imagesBaseURL,'icon_one_page.svg" alt="Single Page"/>\n <br>\n One Page\n </button>\n <button class="DrawerLayoutButton two_page_mode TwoPagesButton">\n <img src="').concat(this.imagesBaseURL,'icon_two_pages.svg" alt="Two Pages"/>\n <br>\n Two Pages\n </button>\n <button class="DrawerLayoutButton thumbnail_mode">\n <img src="').concat(this.imagesBaseURL,'icon_thumbnails.svg" alt="Thumbnails"/>\n <br>\n Thumbnails\n </button>\n </div>\n <br>\n <div class="DrawerSettingsTitle">Zoom</div>\n <button class=\'BRicon zoom_out\'></button>\n <button class=\'BRicon zoom_in\'></button>\n <br style="clear:both"><br><br>\n ').concat(e,"\n </div>\n "),t='\n <span>\n <span class="DrawerIconWrapper ">\n <img class="DrawerIcon" src="'.concat(this.imagesBaseURL,'icon_info.svg" alt="info-icon"/>\n </span>\n About This Book\n </span>\n <div class="BRmobileInfo"></div>\n '),s='\n <span>\n <span class="DrawerIconWrapper">\n <img class="DrawerIcon" src="'.concat(this.imagesBaseURL,'icon_share.svg" alt="info-share"/>\n </span>\n Share This Book\n </span>\n <div class="BRmobileShare"></div>\n '),a='\n <nav id="BRmobileMenu" class="BRmobileMenu">\n <ul>\n <li class="BRmobileMenu__settings">'.concat(n,'</li>\n <li class="BRmobileMenu__moreInfoRow">').concat(t,'</li>\n <li class="BRmobileMenu__share">').concat(s,"</li>\n </ul>\n </nav>\n ");return o(a)},BookReader.prototype.$=function(e){return function(n){var t=e.call(this,n);return this.refs.$mmenu&&(t=t.add(this.refs.$mmenu.find(n))),t}}(BookReader.prototype.$);var l=function(e,n){var t="";o(".BRcheckbox-filters").each((function(e,s){n.refs.$br.removeClass("filter-applied"),o(s).is(":checked")&&(n.refs.$br.addClass(o(s).attr("filter-applied")),t+=r[e].filter)}));var s=o("#filtersStyle")[0]||document.createElement("style");s.id="filtersStyle",s.innerHTML=".BRpagecontainer img {\n filter: ".concat(t,";\n -webkit-filter: ").concat(t,";}"),document.body.appendChild(s)}},2026:function(e,n,t){var s,a,i,o,r=t(5311);o="navbars",(s=r)[i="mmenu"].addons[o]={setup:function(){var e=this,n=this.opts[o],t=this.conf[o];if(s[i].glbl,void 0!==n){n instanceof Array||(n=[n]);var r={};for(var l in s.each(n,(function(l){var c=n[l];"boolean"==typeof c&&c&&(c={}),"object"!=typeof c&&(c={}),void 0===c.content&&(c.content=["prev","title"]),c.content instanceof Array||(c.content=[c.content]);var d=(c=s.extend(!0,{},e.opts.navbar,c)).position,p=c.height;"number"!=typeof p&&(p=1),p=Math.min(4,Math.max(1,p)),"bottom"!=d&&(d="top"),r[d]||(r[d]=0),r[d]++;var h=s("<div />").addClass(a.navbar+" "+a.navbar+"-"+d+" "+a.navbar+"-"+d+"-"+r[d]+" "+a.navbar+"-size-"+p);r[d]+=p-1;for(var u=0,f=0,v=c.content.length;v>f;f++){var m=s[i].addons[o][c.content[f]]||!1;m?u+=m.call(e,h,c,t):((m=c.content[f])instanceof s||(m=s(c.content[f])),h.append(m))}(u+=Math.ceil(h.children().not("."+a.btn).length/p))>1&&h.addClass(a.navbar+"-content-"+u),h.children("."+a.btn).length&&h.addClass(a.hasbtns),h.prependTo(e.$menu)})),r)e.$menu.addClass(a.hasnavbar+"-"+l+"-"+r[l])}},add:function(){a=s[i]._c,s[i]._d,s[i]._e,a.add("close hasbtns")},clickAnchor:function(e,n){}},s[i].configuration[o]={breadcrumbSeparator:"/"},s[i].configuration.classNames[o]={},function(e){var n="mmenu";e[n].addons.navbars.breadcrumbs=function(t,s,a){var i=e[n]._c,o=e[n]._d;i.add("breadcrumbs separator");var r=e('<span class="'+i.breadcrumbs+'" />').appendTo(t);this.bind("init",(function(n){n.removeClass(i.hasnavbar).each((function(){for(var n=[],t=e(this),s=e('<span class="'+i.breadcrumbs+'"></span>'),r=e(this).children().first(),l=!0;r&&r.length;){r.is("."+i.panel)||(r=r.closest("."+i.panel));var c=r.children("."+i.navbar).children("."+i.title).text();n.unshift(l?"<span>"+c+"</span>":'<a href="#'+r.attr("id")+'">'+c+"</a>"),l=!1,r=r.data(o.parent)}s.append(n.join('<span class="'+i.separator+'">'+a.breadcrumbSeparator+"</span>")).appendTo(t.children("."+i.navbar))}))}));var l=function(){r.html(this.$pnls.children("."+i.current).children("."+i.navbar).children("."+i.breadcrumbs).html())};return this.bind("openPanel",l),this.bind("init",l),0}}(r),function(e){var n="mmenu";e[n].addons.navbars.close=function(t,s){var a=e[n]._c,i=e[n].glbl,o=e('<a class="'+a.close+" "+a.btn+'" href="#" />').appendTo(t),r=function(e){o.attr("href","#"+e.attr("id"))};return r.call(this,i.$page),this.bind("setPage",r),-1}}(r),function(e){var n="mmenu",t="navbars";e[n].addons[t].next=function(s,a){var i,o,r=e[n]._c,l=e('<a class="'+r.next+" "+r.btn+'" href="#" />').appendTo(s),c=function(e){var n=(e=e||this.$pnls.children("."+r.current)).find("."+this.conf.classNames[t].panelNext);i=n.attr("href"),o=n.html(),l[i?"attr":"removeAttr"]("href",i),l[i||o?"removeClass":"addClass"](r.hidden),l.html(o)};return this.bind("openPanel",c),this.bind("init",(function(){c.call(this)})),-1},e[n].configuration.classNames[t].panelNext="Next"}(r),function(e){var n="mmenu",t="navbars";e[n].addons[t].prev=function(s,a){var i=e[n]._c,o=e('<a class="'+i.prev+" "+i.btn+'" href="#" />').appendTo(s);this.bind("init",(function(e){e.removeClass(i.hasnavbar).children("."+i.navbar).addClass(i.hidden)}));var r,l,c=function(e){if(!(e=e||this.$pnls.children("."+i.current)).hasClass(i.vertical)){var n=e.find("."+this.conf.classNames[t].panelPrev);n.length||(n=e.children("."+i.navbar).children("."+i.prev)),r=n.attr("href"),l=n.html(),o[r?"attr":"removeAttr"]("href",r),o[r||l?"removeClass":"addClass"](i.hidden),o.html(l)}};return this.bind("openPanel",c),this.bind("init",(function(){c.call(this)})),-1},e[n].configuration.classNames[t].panelPrev="Prev"}(r),function(e){var n="mmenu";e[n].addons.navbars.searchfield=function(t,s){var a=e[n]._c,i=e('<div class="'+a.search+'" />').appendTo(t);return"object"!=typeof this.opts.searchfield&&(this.opts.searchfield={}),this.opts.searchfield.add=!0,this.opts.searchfield.addTo=i,0}}(r),function(e){var n="mmenu",t="navbars";e[n].addons[t].title=function(s,a){var i,o,r=e[n]._c,l=e('<a class="'+r.title+'" />').appendTo(s),c=function(e){if(!(e=e||this.$pnls.children("."+r.current)).hasClass(r.vertical)){var n=e.find("."+this.conf.classNames[t].panelTitle);n.length||(n=e.children("."+r.navbar).children("."+r.title)),i=n.attr("href"),o=n.html()||a.title,l[i?"attr":"removeAttr"]("href",i),l[i||o?"removeClass":"addClass"](r.hidden),l.html(o)}};return this.bind("openPanel",c),this.bind("init",(function(e){c.call(this)})),0},e[n].configuration.classNames[t].panelTitle="Title"}(r)},866:function(e,n,t){var s,a,i,o,r,l,c,d=t(5311);!function(e){function n(){e[o].glbl||(i={$wndw:e(window),$docu:e(document),$html:e("html"),$body:e("body")},t={},s={},a={},e.each([t,s,a],(function(e,n){n.add=function(e){for(var t=0,s=(e=e.split(" ")).length;s>t;t++)n[e[t]]=n.mm(e[t])}})),t.mm=function(e){return"mm-"+e},t.add("wrapper menu panels panel nopanel current highest opened subopened navbar hasnavbar title btn prev next listview nolistview inset vertical selected divider spacer hidden fullsubopen"),t.umm=function(e){return"mm-"==e.slice(0,3)&&(e=e.slice(3)),e},s.mm=function(e){return"mm-"+e},s.add("parent sub"),a.mm=function(e){return e+".mm"},a.add("transitionend webkitTransitionEnd click scroll keydown mousedown mouseup touchstart touchmove touchend orientationchange"),e[o]._c=t,e[o]._d=s,e[o]._e=a,e[o].glbl=i)}var t,s,a,i,o="mmenu",r="5.6.4";e[o]&&e[o].version>r||(e[o]=function(e,n,t){this.$menu=e,this._api=["bind","init","update","setSelected","getInstance","openPanel","closePanel","closeAllPanels"],this.opts=n,this.conf=t,this.vars={},this.cbck={},"function"==typeof this.___deprecated&&this.___deprecated(),this._initMenu(),this._initAnchors();var s=this.$pnls.children();return this._initAddons(),this.init(s),"function"==typeof this.___debug&&this.___debug(),this},e[o].version=r,e[o].addons={},e[o].uniqueId=0,e[o].defaults={extensions:[],navbar:{add:!0,title:"Menu",titleLink:"panel"},onClick:{setSelected:!0},slidingSubmenus:!0},e[o].configuration={classNames:{divider:"Divider",inset:"Inset",panel:"Panel",selected:"Selected",spacer:"Spacer",vertical:"Vertical"},clone:!1,openingInterval:25,panelNodetype:"ul, ol, div",transitionDuration:400},e[o].prototype={init:function(e){e=e.not("."+t.nopanel),e=this._initPanels(e),this.trigger("init",e),this.trigger("update")},update:function(){this.trigger("update")},setSelected:function(e){this.$menu.find("."+t.listview).children().removeClass(t.selected),e.addClass(t.selected),this.trigger("setSelected",e)},openPanel:function(n){var s=n.parent(),a=this;if(s.hasClass(t.vertical)){var i=s.parents("."+t.subopened);if(i.length)return void this.openPanel(i.first());s.addClass(t.opened),this.trigger("openPanel",n),this.trigger("openingPanel",n),this.trigger("openedPanel",n)}else{if(n.hasClass(t.current))return;var r=this.$pnls.children("."+t.panel),l=r.filter("."+t.current);r.removeClass(t.highest).removeClass(t.current).not(n).not(l).not("."+t.vertical).addClass(t.hidden),e[o].support.csstransitions||l.addClass(t.hidden),n.hasClass(t.opened)?n.nextAll("."+t.opened).addClass(t.highest).removeClass(t.opened).removeClass(t.subopened):(n.addClass(t.highest),l.addClass(t.subopened)),n.removeClass(t.hidden).addClass(t.current),a.trigger("openPanel",n),setTimeout((function(){n.removeClass(t.subopened).addClass(t.opened),a.trigger("openingPanel",n),a.__transitionend(n,(function(){a.trigger("openedPanel",n)}),a.conf.transitionDuration)}),this.conf.openingInterval)}},closePanel:function(e){var n=e.parent();n.hasClass(t.vertical)&&(n.removeClass(t.opened),this.trigger("closePanel",e),this.trigger("closingPanel",e),this.trigger("closedPanel",e))},closeAllPanels:function(){this.$menu.find("."+t.listview).children().removeClass(t.selected).filter("."+t.vertical).removeClass(t.opened);var e=this.$pnls.children("."+t.panel).first();this.$pnls.children("."+t.panel).not(e).removeClass(t.subopened).removeClass(t.opened).removeClass(t.current).removeClass(t.highest).addClass(t.hidden),this.openPanel(e)},togglePanel:function(e){var n=e.parent();n.hasClass(t.vertical)&&this[n.hasClass(t.opened)?"closePanel":"openPanel"](e)},getInstance:function(){return this},bind:function(e,n){this.cbck[e]=this.cbck[e]||[],this.cbck[e].push(n)},trigger:function(){var e=Array.prototype.slice.call(arguments),n=e.shift();if(this.cbck[n])for(var t=0,s=this.cbck[n].length;s>t;t++)this.cbck[n][t].apply(this,e)},_initMenu:function(){this.$menu.attr("id",this.$menu.attr("id")||this.__getUniqueId()),this.conf.clone&&(this.$menu=this.$menu.clone(!0),this.$menu.add(this.$menu.find("[id]")).filter("[id]").each((function(){e(this).attr("id",t.mm(e(this).attr("id")))}))),this.$menu.contents().each((function(){3==e(this)[0].nodeType&&e(this).remove()})),this.$pnls=e('<div class="'+t.panels+'" />').append(this.$menu.children(this.conf.panelNodetype)).prependTo(this.$menu),this.$menu.parent().addClass(t.wrapper);var n=[t.menu];this.opts.slidingSubmenus||n.push(t.vertical),this.opts.extensions=this.opts.extensions.length?"mm-"+this.opts.extensions.join(" mm-"):"",this.opts.extensions&&n.push(this.opts.extensions),this.$menu.addClass(n.join(" "))},_initPanels:function(n){var a=this,i=this.__findAddBack(n,"ul, ol");this.__refactorClass(i,this.conf.classNames.inset,"inset").addClass(t.nolistview+" "+t.nopanel),i.not("."+t.nolistview).addClass(t.listview);var o=this.__findAddBack(n,"."+t.listview).children();this.__refactorClass(o,this.conf.classNames.selected,"selected"),this.__refactorClass(o,this.conf.classNames.divider,"divider"),this.__refactorClass(o,this.conf.classNames.spacer,"spacer"),this.__refactorClass(this.__findAddBack(n,"."+this.conf.classNames.panel),this.conf.classNames.panel,"panel");var r=e(),l=n.add(n.find("."+t.panel)).add(this.__findAddBack(n,"."+t.listview).children().children(this.conf.panelNodetype)).not("."+t.nopanel);this.__refactorClass(l,this.conf.classNames.vertical,"vertical"),this.opts.slidingSubmenus||l.addClass(t.vertical),l.each((function(){var n=e(this),s=n;n.is("ul, ol")?(n.wrap('<div class="'+t.panel+'" />'),s=n.parent()):s.addClass(t.panel);var i=n.attr("id");n.removeAttr("id"),s.attr("id",i||a.__getUniqueId()),n.hasClass(t.vertical)&&(n.removeClass(a.conf.classNames.vertical),s.add(s.parent()).addClass(t.vertical)),r=r.add(s)}));var c=e("."+t.panel,this.$menu);r.each((function(n){var i,o,r=e(this),l=r.parent(),c=l.children("a, span").first();if(l.is("."+t.panels)||(l.data(s.sub,r),r.data(s.parent,l)),l.children("."+t.next).length||l.parent().is("."+t.listview)&&(i=r.attr("id"),o=e('<a class="'+t.next+'" href="#'+i+'" data-target="#'+i+'" />').insertBefore(c),c.is("span")&&o.addClass(t.fullsubopen)),!r.children("."+t.navbar).length&&!l.hasClass(t.vertical)){l.parent().is("."+t.listview)?l=l.closest("."+t.panel):(c=l.closest("."+t.panel).find('a[href="#'+r.attr("id")+'"]').first(),l=c.closest("."+t.panel));var d=!1,p=e('<div class="'+t.navbar+'" />');if(a.opts.navbar.add&&r.addClass(t.hasnavbar),l.length){switch(i=l.attr("id"),a.opts.navbar.titleLink){case"anchor":d=c.attr("href");break;case"panel":case"parent":d="#"+i;break;default:d=!1}p.append('<a class="'+t.btn+" "+t.prev+'" href="#'+i+'" data-target="#'+i+'" />').append(e('<a class="'+t.title+'"'+(d?' href="'+d+'"':"")+" />").text(c.text())).prependTo(r)}else a.opts.navbar.title&&p.append('<a class="'+t.title+'">'+a.opts.navbar.title+"</a>").prependTo(r)}}));var d=this.__findAddBack(n,"."+t.listview).children("."+t.selected).removeClass(t.selected).last().addClass(t.selected);d.add(d.parentsUntil("."+t.menu,"li")).filter("."+t.vertical).addClass(t.opened).end().each((function(){e(this).parentsUntil("."+t.menu,"."+t.panel).not("."+t.vertical).first().addClass(t.opened).parentsUntil("."+t.menu,"."+t.panel).not("."+t.vertical).first().addClass(t.opened).addClass(t.subopened)})),d.children("."+t.panel).not("."+t.vertical).addClass(t.opened).parentsUntil("."+t.menu,"."+t.panel).not("."+t.vertical).first().addClass(t.opened).addClass(t.subopened);var p=c.filter("."+t.opened);return p.length||(p=r.first()),p.addClass(t.opened).last().addClass(t.current),r.not("."+t.vertical).not(p.last()).addClass(t.hidden).end().filter((function(){return!e(this).parent().hasClass(t.panels)})).appendTo(this.$pnls),r},_initAnchors:function(){var n=this;i.$body.on(a.click+"-oncanvas","a[href]",(function(s){var a=e(this),i=!1,r=n.$menu.find(a).length;for(var l in e[o].addons)if(e[o].addons[l].clickAnchor.call(n,a,r)){i=!0;break}var c=a.attr("href");if(!i&&r&&c.length>1&&"#"==c.slice(0,1))try{var d=e(c,n.$menu);d.is("."+t.panel)&&(i=!0,n[a.parent().hasClass(t.vertical)?"togglePanel":"openPanel"](d))}catch(e){}if(i&&s.preventDefault(),!i&&r&&a.is("."+t.listview+" > li > a")&&!a.is('[rel="external"]')&&!a.is('[target="_blank"]')){n.__valueOrFn(n.opts.onClick.setSelected,a)&&n.setSelected(e(s.target).parent());var p=n.__valueOrFn(n.opts.onClick.preventDefault,a,"#"==c.slice(0,1));p&&s.preventDefault(),n.__valueOrFn(n.opts.onClick.close,a,p)&&n.close()}}))},_initAddons:function(){var n;for(n in e[o].addons)e[o].addons[n].add.call(this),e[o].addons[n].add=function(){};for(n in e[o].addons)e[o].addons[n].setup.call(this)},_getOriginalMenuId:function(){var e=this.$menu.attr("id");return e&&e.length&&this.conf.clone&&(e=t.umm(e)),e},__api:function(){var n=this,t={};return e.each(this._api,(function(e){var s=this;t[s]=function(){var e=n[s].apply(n,arguments);return void 0===e?t:e}})),t},__valueOrFn:function(e,n,t){return"function"==typeof e?e.call(n[0]):void 0===e&&void 0!==t?t:e},__refactorClass:function(e,n,s){return e.filter("."+n).removeClass(n).addClass(t[s])},__findAddBack:function(e,n){return e.find(n).add(e.filter(n))},__filterListItems:function(e){return e.not("."+t.divider).not("."+t.hidden)},__transitionend:function(e,n,t){var s=!1,i=function(){s||n.call(e[0]),s=!0};e.one(a.transitionend,i),e.one(a.webkitTransitionEnd,i),setTimeout(i,1.1*t)},__getUniqueId:function(){return t.mm(e[o].uniqueId++)}},e.fn[o]=function(t,s){return n(),t=e.extend(!0,{},e[o].defaults,t),s=e.extend(!0,{},e[o].configuration,s),this.each((function(){var n=e(this);if(!n.data(o)){var a=new e[o](n,t,s);a.$menu.data(o,a.__api())}}))},e[o].support={touch:"ontouchstart"in window||navigator.msMaxTouchPoints||!1,csstransitions:function(){if("undefined"!=typeof Modernizr&&void 0!==Modernizr.csstransitions)return Modernizr.csstransitions;var e=(document.body||document.documentElement).style,n="transition";if("string"==typeof e[n])return!0;var t=["Moz","webkit","Webkit","Khtml","O","ms"];n=n.charAt(0).toUpperCase()+n.substr(1);for(var s=0;s<t.length;s++)if("string"==typeof e[t[s]+n])return!0;return!1}()})}(d),c="offCanvas",(s=d)[l="mmenu"].addons[c]={setup:function(){if(this.opts[c]){var e=this.opts[c],n=this.conf[c];r=s[l].glbl,this._api=s.merge(this._api,["open","close","setPage"]),("top"==e.position||"bottom"==e.position)&&(e.zposition="front"),"string"!=typeof n.pageSelector&&(n.pageSelector="> "+n.pageNodetype),r.$allMenus=(r.$allMenus||s()).add(this.$menu),this.vars.opened=!1;var t=[a.offcanvas];"left"!=e.position&&t.push(a.mm(e.position)),"back"!=e.zposition&&t.push(a.mm(e.zposition)),this.$menu.addClass(t.join(" ")).parent().removeClass(a.wrapper),this.setPage(r.$page),this._initBlocker(),this["_initWindow_"+c](),this.$menu[n.menuInjectMethod+"To"](n.menuWrapperSelector);var i=window.location.hash;if(i){var o=this._getOriginalMenuId();o&&o==i.slice(1)&&this.open()}}},add:function(){a=s[l]._c,i=s[l]._d,o=s[l]._e,a.add("offcanvas slideout blocking modal background opening blocker page"),i.add("style"),o.add("resize")},clickAnchor:function(e,n){if(!this.opts[c])return!1;var t=this._getOriginalMenuId();return t&&e.is('[href="#'+t+'"]')?(this.open(),!0):r.$page?!(!(t=r.$page.first().attr("id"))||!e.is('[href="#'+t+'"]')||(this.close(),0)):void 0}},s[l].defaults[c]={position:"left",zposition:"back",blockUI:!0,moveBackground:!0},s[l].configuration[c]={pageNodetype:"div",pageSelector:null,noPageSelector:[],wrapPageIfNeeded:!0,menuWrapperSelector:"body",menuInjectMethod:"prepend"},s[l].prototype.open=function(){if(!this.vars.opened){var e=this;this._openSetup(),setTimeout((function(){e._openFinish()}),this.conf.openingInterval),this.trigger("open")}},s[l].prototype._openSetup=function(){var e=this,n=this.opts[c];this.closeAllOthers(),r.$page.each((function(){s(this).data(i.style,s(this).attr("style")||"")})),r.$wndw.trigger(o.resize+"-"+c,[!0]);var t=[a.opened];n.blockUI&&t.push(a.blocking),"modal"==n.blockUI&&t.push(a.modal),n.moveBackground&&t.push(a.background),"left"!=n.position&&t.push(a.mm(this.opts[c].position)),"back"!=n.zposition&&t.push(a.mm(this.opts[c].zposition)),this.opts.extensions&&t.push(this.opts.extensions),r.$html.addClass(t.join(" ")),setTimeout((function(){e.vars.opened=!0}),this.conf.openingInterval),this.$menu.addClass(a.current+" "+a.opened)},s[l].prototype._openFinish=function(){var e=this;this.__transitionend(r.$page.first(),(function(){e.trigger("opened")}),this.conf.transitionDuration),r.$html.addClass(a.opening),this.trigger("opening")},s[l].prototype.close=function(){if(this.vars.opened){var e=this;this.__transitionend(r.$page.first(),(function(){e.$menu.removeClass(a.current).removeClass(a.opened),r.$html.removeClass(a.opened).removeClass(a.blocking).removeClass(a.modal).removeClass(a.background).removeClass(a.mm(e.opts[c].position)).removeClass(a.mm(e.opts[c].zposition)),e.opts.extensions&&r.$html.removeClass(e.opts.extensions),r.$page.each((function(){s(this).attr("style",s(this).data(i.style))})),e.vars.opened=!1,e.trigger("closed")}),this.conf.transitionDuration),r.$html.removeClass(a.opening),this.trigger("close"),this.trigger("closing")}},s[l].prototype.closeAllOthers=function(){r.$allMenus.not(this.$menu).each((function(){var e=s(this).data(l);e&&e.close&&e.close()}))},s[l].prototype.setPage=function(e){var n=this,t=this.conf[c];e&&e.length||(e=r.$body.find(t.pageSelector),t.noPageSelector.length&&(e=e.not(t.noPageSelector.join(", "))),e.length>1&&t.wrapPageIfNeeded&&(e=e.wrapAll("<"+this.conf[c].pageNodetype+" />").parent())),e.each((function(){s(this).attr("id",s(this).attr("id")||n.__getUniqueId())})),e.addClass(a.page+" "+a.slideout),r.$page=e,this.trigger("setPage",e)},s[l].prototype["_initWindow_"+c]=function(){r.$wndw.off(o.keydown+"-"+c).on(o.keydown+"-"+c,(function(e){return r.$html.hasClass(a.opened)&&9==e.keyCode?(e.preventDefault(),!1):void 0}));var e=0;r.$wndw.off(o.resize+"-"+c).on(o.resize+"-"+c,(function(n,t){if(1==r.$page.length&&(t||r.$html.hasClass(a.opened))){var s=r.$wndw.height();(t||s!=e)&&(e=s,r.$page.css("minHeight",s))}}))},s[l].prototype._initBlocker=function(){var e=this;this.opts[c].blockUI&&(r.$blck||(r.$blck=s('<div id="'+a.blocker+'" class="'+a.slideout+'" />')),r.$blck.appendTo(r.$body).off(o.touchstart+"-"+c+" "+o.touchmove+"-"+c).on(o.touchstart+"-"+c+" "+o.touchmove+"-"+c,(function(e){e.preventDefault(),e.stopPropagation(),r.$blck.trigger(o.mousedown+"-"+c)})).off(o.mousedown+"-"+c).on(o.mousedown+"-"+c,(function(n){n.preventDefault(),r.$html.hasClass(a.modal)||(e.closeAllOthers(),e.close())})))},function(e){var n,t,s,a="mmenu",i="scrollBugFix";e[a].addons[i]={setup:function(){var o=this,r=this.opts[i];if(this.conf[i],s=e[a].glbl,e[a].support.touch&&this.opts.offCanvas&&this.opts.offCanvas.blockUI&&("boolean"==typeof r&&(r={fix:r}),"object"!=typeof r&&(r={}),(r=this.opts[i]=e.extend(!0,{},e[a].defaults[i],r)).fix)){var l=this.$menu.attr("id"),c=!1;this.bind("opening",(function(){this.$pnls.children("."+n.current).scrollTop(0)})),s.$docu.on(t.touchmove,(function(e){o.vars.opened&&e.preventDefault()})),s.$body.on(t.touchstart,"#"+l+"> ."+n.panels+"> ."+n.current,(function(e){o.vars.opened&&(c||(c=!0,0===e.currentTarget.scrollTop?e.currentTarget.scrollTop=1:e.currentTarget.scrollHeight===e.currentTarget.scrollTop+e.currentTarget.offsetHeight&&(e.currentTarget.scrollTop-=1),c=!1))})).on(t.touchmove,"#"+l+"> ."+n.panels+"> ."+n.current,(function(n){o.vars.opened&&e(this)[0].scrollHeight>e(this).innerHeight()&&n.stopPropagation()})),s.$wndw.on(t.orientationchange,(function(){o.$pnls.children("."+n.current).scrollTop(0).css({"-webkit-overflow-scrolling":"auto"}).css({"-webkit-overflow-scrolling":"touch"})}))}},add:function(){n=e[a]._c,e[a]._d,t=e[a]._e},clickAnchor:function(e,n){}},e[a].defaults[i]={fix:!0}}(d)}},function(e){e(e.s=2878)}]);
2
- //# sourceMappingURL=plugin.mobile_nav.js.map