vevet 1.4.27 → 2.0.1-dev.3
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.
- package/LICENSE +1 -1
- package/README.md +7 -71
- package/build/cdn/index.js +12 -0
- package/build/cdn/index.js.LICENSE.txt +14 -0
- package/build/cjs/app/Application.js +297 -0
- package/build/cjs/app/events/PageLoad.js +74 -0
- package/build/cjs/app/events/Viewport.js +303 -0
- package/build/cjs/base/Callbacks.js +232 -0
- package/build/cjs/base/Component.js +56 -0
- package/build/cjs/base/Module.js +262 -0
- package/build/cjs/base/MutableProp.js +165 -0
- package/build/cjs/base/Plugin.js +56 -0
- package/build/cjs/components/animation-frame/AnimationFrame.js +183 -0
- package/build/cjs/components/canvas/Ctx2D.js +200 -0
- package/build/cjs/components/canvas/Ctx2DPrerender.js +72 -0
- package/build/cjs/components/cursor/CustomCursor.js +344 -0
- package/build/cjs/components/dragger/Dragger.js +229 -0
- package/build/cjs/components/dragger/DraggerDirection.js +77 -0
- package/build/cjs/components/dragger/DraggerMove.js +84 -0
- package/build/cjs/components/loading/Preloader.js +229 -0
- package/build/cjs/components/loading/ProgressPreloader.js +377 -0
- package/build/cjs/components/page/Page.js +353 -0
- package/build/cjs/components/scroll/custom-scroll/CustomScroll.js +517 -0
- package/build/cjs/components/scroll/plugins/SmoothScrollDragPlugin.js +178 -0
- package/build/cjs/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +138 -0
- package/build/cjs/components/scroll/scrollable/ScrollEventsBase.js +133 -0
- package/build/cjs/components/scroll/scrollable/ScrollView.js +315 -0
- package/build/cjs/components/scroll/scrollbar/Bar.js +315 -0
- package/build/cjs/components/scroll/scrollbar/ScrollBar.js +206 -0
- package/build/cjs/components/scroll/smooth-scroll/SmoothScroll.js +625 -0
- package/build/cjs/components/scroll/types.js +2 -0
- package/build/cjs/components/split-text/SplitText.js +233 -0
- package/build/cjs/components/text/SplitText.js +329 -0
- package/build/cjs/components/timeline/StaticTimeline.js +137 -0
- package/build/cjs/components/timeline/Timeline.js +190 -0
- package/build/cjs/index.js +87 -0
- package/build/cjs/utils/common/index.js +12 -0
- package/build/cjs/utils/common/mergeWithoutArrays.js +19 -0
- package/build/cjs/utils/common/randID.js +11 -0
- package/build/cjs/utils/common/timeoutCallback.js +17 -0
- package/build/cjs/utils/errors.js +8 -0
- package/build/cjs/utils/listeners/index.js +10 -0
- package/build/cjs/utils/listeners/intersectionObserverSupported.js +11 -0
- package/build/cjs/utils/listeners/onScroll.js +47 -0
- package/build/cjs/utils/math/boundVal.js +16 -0
- package/build/cjs/utils/math/index.js +12 -0
- package/build/cjs/utils/math/lerp.js +15 -0
- package/build/cjs/utils/math/scopeProgress.js +25 -0
- package/build/cjs/utils/types/general.js +2 -0
- package/build/cjs/utils/types/utility.js +2 -0
- package/build/es/app/Application.js +210 -0
- package/build/es/app/events/PageLoad.js +47 -0
- package/build/es/app/events/Viewport.js +232 -0
- package/build/es/base/Callbacks.js +205 -0
- package/build/es/base/Component.js +32 -0
- package/build/es/base/Module.js +225 -0
- package/build/es/base/MutableProp.js +152 -0
- package/build/es/base/Plugin.js +31 -0
- package/build/es/components/animation-frame/AnimationFrame.js +145 -0
- package/build/es/components/canvas/Ctx2D.js +133 -0
- package/build/es/components/canvas/Ctx2DPrerender.js +37 -0
- package/build/es/components/cursor/CustomCursor.js +274 -0
- package/build/es/components/dragger/Dragger.js +175 -0
- package/build/es/components/dragger/DraggerDirection.js +42 -0
- package/build/es/components/dragger/DraggerMove.js +56 -0
- package/build/es/components/loading/Preloader.js +164 -0
- package/build/es/components/loading/ProgressPreloader.js +304 -0
- package/build/es/components/page/Page.js +283 -0
- package/build/es/components/scroll/custom-scroll/CustomScroll.js +486 -0
- package/build/es/components/scroll/plugins/SmoothScrollDragPlugin.js +140 -0
- package/build/es/components/scroll/plugins/SmoothScrollKeyboardPlugin.js +109 -0
- package/build/es/components/scroll/scrollable/ScrollEventsBase.js +79 -0
- package/build/es/components/scroll/scrollable/ScrollView.js +264 -0
- package/build/es/components/scroll/scrollbar/Bar.js +262 -0
- package/build/es/components/scroll/scrollbar/ScrollBar.js +152 -0
- package/build/es/components/scroll/smooth-scroll/SmoothScroll.js +519 -0
- package/build/es/components/scroll/types.js +1 -0
- package/build/es/components/split-text/SplitText.js +199 -0
- package/build/es/components/text/SplitText.js +270 -0
- package/build/es/components/timeline/StaticTimeline.js +92 -0
- package/build/es/components/timeline/Timeline.js +141 -0
- package/build/es/index.js +37 -0
- package/build/es/utils/common/index.js +4 -0
- package/build/es/utils/common/mergeWithoutArrays.js +13 -0
- package/build/es/utils/common/randID.js +7 -0
- package/build/es/utils/common/timeoutCallback.js +14 -0
- package/build/es/utils/errors.js +5 -0
- package/build/es/utils/listeners/index.js +3 -0
- package/build/es/utils/listeners/intersectionObserverSupported.js +8 -0
- package/build/es/utils/listeners/onScroll.js +44 -0
- package/build/es/utils/math/boundVal.js +12 -0
- package/build/es/utils/math/index.js +4 -0
- package/build/es/utils/math/lerp.js +11 -0
- package/build/es/utils/math/scopeProgress.js +22 -0
- package/build/es/utils/types/general.js +1 -0
- package/build/es/utils/types/utility.js +1 -0
- package/build/types/app/Application.d.ts +161 -0
- package/build/types/app/Application.d.ts.map +1 -0
- package/build/types/app/events/PageLoad.d.ts +28 -0
- package/build/types/app/events/PageLoad.d.ts.map +1 -0
- package/build/types/app/events/Viewport.d.ts +137 -0
- package/build/types/app/events/Viewport.d.ts.map +1 -0
- package/build/types/base/Callbacks.d.ts +174 -0
- package/build/types/base/Callbacks.d.ts.map +1 -0
- package/build/types/base/Component.d.ts +48 -0
- package/build/types/base/Component.d.ts.map +1 -0
- package/build/types/base/Module.d.ts +179 -0
- package/build/types/base/Module.d.ts.map +1 -0
- package/build/types/base/MutableProp.d.ts +142 -0
- package/build/types/base/MutableProp.d.ts.map +1 -0
- package/build/types/base/Plugin.d.ts +35 -0
- package/build/types/base/Plugin.d.ts.map +1 -0
- package/build/types/components/animation-frame/AnimationFrame.d.ts +96 -0
- package/build/types/components/animation-frame/AnimationFrame.d.ts.map +1 -0
- package/build/types/components/canvas/Ctx2D.d.ts +111 -0
- package/build/types/components/canvas/Ctx2D.d.ts.map +1 -0
- package/build/types/components/canvas/Ctx2DPrerender.d.ts +41 -0
- package/build/types/components/canvas/Ctx2DPrerender.d.ts.map +1 -0
- package/build/types/components/cursor/CustomCursor.d.ts +181 -0
- package/build/types/components/cursor/CustomCursor.d.ts.map +1 -0
- package/build/types/components/dragger/Dragger.d.ts +120 -0
- package/build/types/components/dragger/Dragger.d.ts.map +1 -0
- package/build/types/components/dragger/DraggerDirection.d.ts +39 -0
- package/build/types/components/dragger/DraggerDirection.d.ts.map +1 -0
- package/build/types/components/dragger/DraggerMove.d.ts +49 -0
- package/build/types/components/dragger/DraggerMove.d.ts.map +1 -0
- package/build/types/components/loading/Preloader.d.ts +107 -0
- package/build/types/components/loading/Preloader.d.ts.map +1 -0
- package/build/types/components/loading/ProgressPreloader.d.ts +166 -0
- package/build/types/components/loading/ProgressPreloader.d.ts.map +1 -0
- package/build/types/components/page/Page.d.ts +126 -0
- package/build/types/components/page/Page.d.ts.map +1 -0
- package/build/types/components/scroll/custom-scroll/CustomScroll.d.ts +322 -0
- package/build/types/components/scroll/custom-scroll/CustomScroll.d.ts.map +1 -0
- package/build/types/components/scroll/plugins/SmoothScrollDragPlugin.d.ts +97 -0
- package/build/types/components/scroll/plugins/SmoothScrollDragPlugin.d.ts.map +1 -0
- package/build/types/components/scroll/plugins/SmoothScrollKeyboardPlugin.d.ts +34 -0
- package/build/types/components/scroll/plugins/SmoothScrollKeyboardPlugin.d.ts.map +1 -0
- package/build/types/components/scroll/scrollable/ScrollEventsBase.d.ts +60 -0
- package/build/types/components/scroll/scrollable/ScrollEventsBase.d.ts.map +1 -0
- package/build/types/components/scroll/scrollable/ScrollView.d.ts +140 -0
- package/build/types/components/scroll/scrollable/ScrollView.d.ts.map +1 -0
- package/build/types/components/scroll/scrollbar/Bar.d.ts +84 -0
- package/build/types/components/scroll/scrollbar/Bar.d.ts.map +1 -0
- package/build/types/components/scroll/scrollbar/ScrollBar.d.ts +109 -0
- package/build/types/components/scroll/scrollbar/ScrollBar.d.ts.map +1 -0
- package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts +307 -0
- package/build/types/components/scroll/smooth-scroll/SmoothScroll.d.ts.map +1 -0
- package/build/types/components/scroll/types.d.ts +11 -0
- package/build/types/components/scroll/types.d.ts.map +1 -0
- package/build/types/components/split-text/SplitText.d.ts +118 -0
- package/build/types/components/split-text/SplitText.d.ts.map +1 -0
- package/build/types/components/text/SplitText.d.ts +118 -0
- package/build/types/components/text/SplitText.d.ts.map +1 -0
- package/build/types/components/timeline/StaticTimeline.d.ts +92 -0
- package/build/types/components/timeline/StaticTimeline.d.ts.map +1 -0
- package/build/types/components/timeline/Timeline.d.ts +101 -0
- package/build/types/components/timeline/Timeline.d.ts.map +1 -0
- package/build/types/index.d.ts +38 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/utils/common/index.d.ts +5 -0
- package/build/types/utils/common/index.d.ts.map +1 -0
- package/build/types/utils/common/mergeWithoutArrays.d.ts +6 -0
- package/build/types/utils/common/mergeWithoutArrays.d.ts.map +1 -0
- package/build/types/utils/common/randID.d.ts +5 -0
- package/build/types/utils/common/randID.d.ts.map +1 -0
- package/build/types/utils/common/timeoutCallback.d.ts +6 -0
- package/build/types/utils/common/timeoutCallback.d.ts.map +1 -0
- package/build/types/utils/errors.d.ts +3 -0
- package/build/types/utils/errors.d.ts.map +1 -0
- package/build/types/utils/listeners/index.d.ts +4 -0
- package/build/types/utils/listeners/index.d.ts.map +1 -0
- package/build/types/utils/listeners/intersectionObserverSupported.d.ts +2 -0
- package/build/types/utils/listeners/intersectionObserverSupported.d.ts.map +1 -0
- package/build/types/utils/listeners/onScroll.d.ts +10 -0
- package/build/types/utils/listeners/onScroll.d.ts.map +1 -0
- package/build/types/utils/math/boundVal.d.ts +5 -0
- package/build/types/utils/math/boundVal.d.ts.map +1 -0
- package/build/types/utils/math/index.d.ts +5 -0
- package/build/types/utils/math/index.d.ts.map +1 -0
- package/build/types/utils/math/lerp.d.ts +5 -0
- package/build/types/utils/math/lerp.d.ts.map +1 -0
- package/build/types/utils/math/scopeProgress.d.ts +20 -0
- package/build/types/utils/math/scopeProgress.d.ts.map +1 -0
- package/build/types/utils/types/general.d.ts +7 -0
- package/build/types/utils/types/general.d.ts.map +1 -0
- package/build/types/utils/types/utility.d.ts +14 -0
- package/build/types/utils/types/utility.d.ts.map +1 -0
- package/package.json +88 -82
- package/src/cdn/index.js +3 -0
- package/src/sass/base.scss +3 -0
- package/src/sass/components/cursor/_custom-cursor.scss +63 -0
- package/src/sass/components/index.scss +6 -0
- package/src/sass/components/loading/_preloader.scss +15 -0
- package/src/sass/components/scroll/_scrollbar.scss +73 -0
- package/src/sass/components/scroll/_smooth-scroll.scss +17 -0
- package/src/sass/index.scss +3 -0
- package/src/sass/mixins/_scroll.scss +7 -0
- package/{dist/scss → src/sass}/mixins/_transition.scss +8 -4
- package/src/sass/mixins/_viewport.scss +69 -0
- package/src/sass/mixins/index.scss +3 -0
- package/src/ts/app/Application.ts +350 -0
- package/src/ts/app/events/PageLoad.ts +79 -0
- package/src/ts/app/events/Viewport.ts +365 -0
- package/src/ts/base/Callbacks.ts +380 -0
- package/src/ts/base/Component.ts +83 -0
- package/src/ts/base/Module.ts +385 -0
- package/src/ts/base/MutableProp.ts +242 -0
- package/src/ts/base/Plugin.ts +76 -0
- package/src/ts/components/animation-frame/AnimationFrame.ts +264 -0
- package/src/ts/components/canvas/Ctx2D.ts +260 -0
- package/src/ts/components/canvas/Ctx2DPrerender.ts +96 -0
- package/src/ts/components/cursor/CustomCursor.ts +462 -0
- package/src/ts/components/dragger/Dragger.ts +313 -0
- package/src/ts/components/dragger/DraggerDirection.ts +106 -0
- package/src/ts/components/dragger/DraggerMove.ts +114 -0
- package/src/ts/components/loading/Preloader.ts +279 -0
- package/src/ts/components/loading/ProgressPreloader.ts +484 -0
- package/src/ts/components/page/Page.ts +421 -0
- package/src/ts/components/scroll/plugins/SmoothScrollDragPlugin.ts +251 -0
- package/src/ts/components/scroll/plugins/SmoothScrollKeyboardPlugin.ts +166 -0
- package/src/ts/components/scroll/scrollable/ScrollEventsBase.ts +151 -0
- package/src/ts/components/scroll/scrollable/ScrollView.ts +435 -0
- package/src/ts/components/scroll/scrollbar/Bar.ts +364 -0
- package/src/ts/components/scroll/scrollbar/ScrollBar.ts +292 -0
- package/src/ts/components/scroll/smooth-scroll/SmoothScroll.ts +861 -0
- package/src/ts/components/scroll/types.ts +10 -0
- package/src/ts/components/text/SplitText.ts +418 -0
- package/src/ts/components/timeline/StaticTimeline.ts +197 -0
- package/src/ts/components/timeline/Timeline.ts +256 -0
- package/src/ts/index.ts +94 -0
- package/src/ts/utils/common/index.ts +9 -0
- package/src/ts/utils/common/mergeWithoutArrays.ts +20 -0
- package/src/ts/utils/common/randID.ts +9 -0
- package/src/ts/utils/common/timeoutCallback.ts +16 -0
- package/src/ts/utils/errors.ts +6 -0
- package/src/ts/utils/listeners/index.ts +7 -0
- package/src/ts/utils/listeners/intersectionObserverSupported.ts +10 -0
- package/src/ts/utils/listeners/onScroll.ts +56 -0
- package/src/ts/utils/math/boundVal.ts +15 -0
- package/src/ts/utils/math/index.ts +9 -0
- package/src/ts/utils/math/lerp.ts +16 -0
- package/src/ts/utils/math/scopeProgress.ts +23 -0
- package/src/ts/utils/types/general.ts +7 -0
- package/src/ts/utils/types/utility.ts +34 -0
- package/dist/js/AJAXEvent.js +0 -355
- package/dist/js/Application.js +0 -345
- package/dist/js/ColumnsModule.js +0 -392
- package/dist/js/CursorModule.js +0 -390
- package/dist/js/DraggerModule.js +0 -792
- package/dist/js/Event.js +0 -538
- package/dist/js/FilterModule.js +0 -943
- package/dist/js/FormModule.js +0 -706
- package/dist/js/FrameModule.js +0 -229
- package/dist/js/IntervalModule.js +0 -270
- package/dist/js/KeydownModule.js +0 -293
- package/dist/js/LoadEvent.js +0 -106
- package/dist/js/MenuBaseModule.js +0 -292
- package/dist/js/MenuModule.js +0 -265
- package/dist/js/MenuTimelineModule.js +0 -321
- package/dist/js/Module.js +0 -478
- package/dist/js/PageAjaxModule.js +0 -1010
- package/dist/js/PageLoadMediaPlugin.js +0 -285
- package/dist/js/PageModule.js +0 -440
- package/dist/js/PaginationModule.js +0 -961
- package/dist/js/PaginationScrollPlugin.js +0 -209
- package/dist/js/Plugin.js +0 -114
- package/dist/js/PopupModule.js +0 -942
- package/dist/js/PreloaderModule.js +0 -724
- package/dist/js/ResponsiveProp.js +0 -301
- package/dist/js/ScrollAnchorModule.js +0 -554
- package/dist/js/ScrollAnimateModule.js +0 -419
- package/dist/js/ScrollBarPlugin.js +0 -594
- package/dist/js/ScrollDragPlugin.js +0 -396
- package/dist/js/ScrollModule.js +0 -1071
- package/dist/js/ScrollViewModule.js +0 -388
- package/dist/js/SelectModule.js +0 -860
- package/dist/js/SliderCanvasModule.js +0 -733
- package/dist/js/SliderControlsPlugin.js +0 -247
- package/dist/js/SliderCounterPlugin.js +0 -278
- package/dist/js/SliderDotsPlugin.js +0 -270
- package/dist/js/SliderDragSwipePlugin.js +0 -245
- package/dist/js/SliderIntervalPlugin.js +0 -192
- package/dist/js/SliderKeydownPlugin.js +0 -185
- package/dist/js/SliderModule.js +0 -1062
- package/dist/js/SliderWheelPlugin.js +0 -194
- package/dist/js/TextAnimateModule.js +0 -663
- package/dist/js/TextSplitModule.js +0 -785
- package/dist/js/TimelineBaseModule.js +0 -405
- package/dist/js/TimelineModule.js +0 -494
- package/dist/js/URLEvent.js +0 -239
- package/dist/js/ViewportEvent.js +0 -465
- package/dist/js/WheelEventModule.js +0 -295
- package/dist/js/domChildOf.js +0 -46
- package/dist/js/domChildren.js +0 -47
- package/dist/js/domInsertAfter.js +0 -32
- package/dist/js/domRemoveChildren.js +0 -26
- package/dist/js/easing.js +0 -363
- package/dist/js/eventListenerAdd.js +0 -87
- package/dist/js/eventListenerGet.js +0 -49
- package/dist/js/eventListenerRemove.js +0 -36
- package/dist/js/generateId.js +0 -29
- package/dist/js/getBrowserName.js +0 -60
- package/dist/js/getOsName.js +0 -39
- package/dist/js/getVevetProperties.js +0 -22
- package/dist/js/index.js +0 -519
- package/dist/js/mathScopeProgress.js +0 -32
- package/dist/js/mathSpreadScopeProgress.js +0 -35
- package/dist/js/merge.js +0 -33
- package/dist/js/normalizeWheel.js +0 -97
- package/dist/js/text_animate_module_addons/_composite_elementary.js +0 -196
- package/dist/js/text_animate_module_addons/_elementary.js +0 -88
- package/dist/js/timeoutCallback.js +0 -26
- package/dist/js/vevet.js +0 -10
- package/dist/scss/_prefix.scss +0 -1
- package/dist/scss/classes/_clear.scss +0 -5
- package/dist/scss/classes/_col-row.scss +0 -48
- package/dist/scss/classes/_display.scss +0 -65
- package/dist/scss/classes/_document-reset.scss +0 -28
- package/dist/scss/classes/_document.scss +0 -7
- package/dist/scss/classes/_overflow.scss +0 -39
- package/dist/scss/classes/_position.scss +0 -55
- package/dist/scss/classes/_text.scss +0 -24
- package/dist/scss/classes/_transition.scss +0 -22
- package/dist/scss/classes/_wrap.scss +0 -31
- package/dist/scss/classes/index.scss +0 -14
- package/dist/scss/index.scss +0 -3
- package/dist/scss/mixins/_clear.scss +0 -6
- package/dist/scss/mixins/_display.scss +0 -6
- package/dist/scss/mixins/_form.scss +0 -14
- package/dist/scss/mixins/_position.scss +0 -42
- package/dist/scss/mixins/_reset.scss +0 -17
- package/dist/scss/mixins/_responsive.scss +0 -88
- package/dist/scss/mixins/index.scss +0 -7
- package/dist/scss/modules/columns/_settings.scss +0 -1
- package/dist/scss/modules/columns/index.scss +0 -19
- package/dist/scss/modules/cursor/_settings.scss +0 -7
- package/dist/scss/modules/cursor/index.scss +0 -15
- package/dist/scss/modules/form/_settings.scss +0 -15
- package/dist/scss/modules/form/index.scss +0 -57
- package/dist/scss/modules/index.scss +0 -11
- package/dist/scss/modules/menu/_button.scss +0 -58
- package/dist/scss/modules/menu/_menu.scss +0 -25
- package/dist/scss/modules/menu/_settings.scss +0 -23
- package/dist/scss/modules/menu/index.scss +0 -3
- package/dist/scss/modules/pagination/_settings.scss +0 -6
- package/dist/scss/modules/pagination/index.scss +0 -24
- package/dist/scss/modules/popup/_settings.scss +0 -26
- package/dist/scss/modules/popup/index.scss +0 -294
- package/dist/scss/modules/preloader/_settings.scss +0 -3
- package/dist/scss/modules/preloader/index.scss +0 -19
- package/dist/scss/modules/scroll/_settings.scss +0 -22
- package/dist/scss/modules/scroll/index.scss +0 -94
- package/dist/scss/modules/select/_settings.scss +0 -28
- package/dist/scss/modules/select/index.scss +0 -142
- package/dist/scss/modules/slider/_settings.scss +0 -35
- package/dist/scss/modules/slider/index.scss +0 -153
- package/dist/scss/modules/text/_settings.scss +0 -1
- package/dist/scss/modules/text/index.scss +0 -19
- package/dist/types/types.d.ts +0 -18763
|
@@ -1,1010 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _Module2 = _interopRequireDefault(require("./Module"));
|
|
11
|
-
|
|
12
|
-
var _merge = _interopRequireDefault(require("./merge"));
|
|
13
|
-
|
|
14
|
-
var _timeoutCallback = _interopRequireDefault(require("./timeoutCallback"));
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
-
|
|
20
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
21
|
-
|
|
22
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
23
|
-
|
|
24
|
-
function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
|
|
25
|
-
|
|
26
|
-
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
27
|
-
|
|
28
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
29
|
-
|
|
30
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
|
-
|
|
32
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
33
|
-
|
|
34
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
35
|
-
|
|
36
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
|
-
|
|
38
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
39
|
-
|
|
40
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
|
-
|
|
42
|
-
var selectEl = require('select-el');
|
|
43
|
-
/**
|
|
44
|
-
* @classdesc A class for changing pages on ajax requests. It manipulates pages created with the help of {@linkcode Vevet.PageModule}.
|
|
45
|
-
* While initializing the class, links with the selector 'selectorLinks' are searched and when they are clicked on, ajax request is launched, which receives HTML data of the page and decides what page to create and show. <br>
|
|
46
|
-
* Available targets:
|
|
47
|
-
* <ul>
|
|
48
|
-
* <li>click - when a link is clicked. Each event will receive {@linkcode Vevet.PageAjaxModule.EventLinkHref} as an argument.</li>
|
|
49
|
-
* <li>popstate - event on popstate. Each event will receive {@linkcode Vevet.PageAjaxModule.EventHref} as an argument.</li>
|
|
50
|
-
* <li>clickSame - when a link, which href is equal to the current page URL, is clicked. Each event will receive {@linkcode Vevet.PageAjaxModule.EventLinkHref} as an argument.</li>
|
|
51
|
-
* <li>prepare - before the request is launched. Each event will receive {@linkcode Vevet.PageAjaxModule.EventLinkHref} as an argument.</li>
|
|
52
|
-
* <li>loaded - when new content is loaded. Each event will receive {@linkcode Vevet.PageAjaxModule.EventLoaded} as an argument.</li>
|
|
53
|
-
* <li>updated - when the content is updated. Each event will receive {@linkcode Vevet.PageAjaxModule.EventLoaded} as an argument.</li>
|
|
54
|
-
* <li>done - when {@linkcode Vevet.PageAjaxModule#loading} becomes false. Each event will receive {@linkcode Vevet.PageAjaxModule.EventLoaded} as an argument.</li>
|
|
55
|
-
* </ul>
|
|
56
|
-
* <br><br> <b>import {PageAjaxModule} from 'vevet';</b>
|
|
57
|
-
*
|
|
58
|
-
* @vevetModuleCallback { Vevet.PageAjaxModule : click : Vevet.PageAjaxModule.EventLinkHref}
|
|
59
|
-
* @vevetModuleCallback { Vevet.PageAjaxModule : popstate : Vevet.PageAjaxModule.EventHref}
|
|
60
|
-
* @vevetModuleCallback { Vevet.PageAjaxModule : clickSame : Vevet.PageAjaxModule.EventLinkHref}
|
|
61
|
-
* @vevetModuleCallback { Vevet.PageAjaxModule : prepare : Vevet.PageAjaxModule.EventLinkHref}
|
|
62
|
-
* @vevetModuleCallback { Vevet.PageAjaxModule : loaded : Vevet.PageAjaxModule.EventLoaded}
|
|
63
|
-
* @vevetModuleCallback { Vevet.PageAjaxModule : updated : Vevet.PageAjaxModule.EventLoaded}
|
|
64
|
-
* @vevetModuleCallback { Vevet.PageAjaxModule : done : Vevet.PageAjaxModule.EventLoaded}
|
|
65
|
-
*
|
|
66
|
-
* @class
|
|
67
|
-
* @memberof Vevet
|
|
68
|
-
* @augments Vevet.Module
|
|
69
|
-
*/
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var PageAjaxModule = /*#__PURE__*/function (_Module) {
|
|
73
|
-
_inherits(PageAjaxModule, _Module);
|
|
74
|
-
|
|
75
|
-
var _super = _createSuper(PageAjaxModule);
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* @memberof Vevet.PageAjaxModule
|
|
79
|
-
* @typedef {object} Properties
|
|
80
|
-
* @augments Vevet.Module.Properties
|
|
81
|
-
*
|
|
82
|
-
* @property {object} [selectors] - ***
|
|
83
|
-
* @property {string|HTMLElement} [selectors.outer=.vevet-pageAjax] - The outer in which pages will be changed.
|
|
84
|
-
* The outer element must contain the attribute "data-vevet-pageAjax-name"
|
|
85
|
-
* to define the name of the page {@linkcode Vevet.PageModule}.
|
|
86
|
-
* @property {string} [selectors.links=.vevet-pageAjax__link] - Links on which event listeners
|
|
87
|
-
* will be set.
|
|
88
|
-
*
|
|
89
|
-
* @property {object} [popstate]
|
|
90
|
-
* @property {boolean} [popstate.event=true] - Defines if we need to load a new page thru ajax on popstate change.
|
|
91
|
-
* @property {boolean} [popstate.reload=true] - If true, the page will be reloaded after popstate change in case {@linkcode popstate.event} is false.
|
|
92
|
-
* @property {number} [popstate.timeout=300]
|
|
93
|
-
*
|
|
94
|
-
* @property {boolean} [on=true] - If false, {@linkcode Vevet.PageAjaxModule#load} will return 'false'.
|
|
95
|
-
* @property {boolean} [disabled=false] - If true, all listeners will be ignored.
|
|
96
|
-
*
|
|
97
|
-
* @property {object} [update]
|
|
98
|
-
* @property {boolean} [update.url=true]
|
|
99
|
-
* @property {boolean} [update.title=true]
|
|
100
|
-
* @property {object} [update.content=true]
|
|
101
|
-
*
|
|
102
|
-
* @property {Vevet.PageAjaxModule.MenuLinks} [menuLinks] - Update menu links.
|
|
103
|
-
*
|
|
104
|
-
* @property {object} [timeouts]
|
|
105
|
-
* @property {number} [timeouts.load=100] - Timeout before an ajax request will be sent.
|
|
106
|
-
* @property {number} [timeouts.update=100] - Timeout before the content will be updated after its loaded.
|
|
107
|
-
* @property {number} [timeouts.done=100] - Timeout before {@linkcode Vevet.PageAjaxModule#loading} will be false
|
|
108
|
-
* and events under the target 'done' will be launched.
|
|
109
|
-
*
|
|
110
|
-
* @property {object} [pageChange] - Moments of changes of states of a page {@linkcode Vevet.PageModule}.
|
|
111
|
-
* Possible values are targets of this class. F.e., if {@linkcode page.hide=='prepare'},
|
|
112
|
-
* the current page will be automatically hidden when events under the target 'prepare' are launched.
|
|
113
|
-
* @property {boolean} [pageChange.on=true] - Defines if you want to change pages automatically.
|
|
114
|
-
* @property {string} [pageChange.default=default] - The name of a default page.
|
|
115
|
-
* @property {string} [pageChange.hide=prepare] - {@linkcode Vevet.PageModule#hide}.
|
|
116
|
-
* @property {string} [pageChange.destroy=loaded] - {@linkcode Vevet.PageModule#destroy}
|
|
117
|
-
* @property {string} [pageChange.create=updated] - {@linkcode Vevet.PageModule#create}
|
|
118
|
-
* @property {string} [pageChange.show=done] - {@linkcode Vevet.PageModule#show}
|
|
119
|
-
*
|
|
120
|
-
* @property {boolean} [cache=false] - If we need to store ajax responses in cache {@linkcode Vevet.AJAXEvent#cache}.
|
|
121
|
-
*
|
|
122
|
-
* @property {boolean} [changeSame=true] - Defines if a new page with the same URL can be loaded.
|
|
123
|
-
*
|
|
124
|
-
* @property {object} [ajax] - Ajax requests.
|
|
125
|
-
* @property {string} [ajax.method=post] - Method of xhr requests.
|
|
126
|
-
* @property {Array<number>} [ajax.successCodes=[404]] - List of response codes that will not be accepted as errors. Otherwise the page will be reloaded.
|
|
127
|
-
*
|
|
128
|
-
*/
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* @memberof Vevet.PageAjaxModule
|
|
132
|
-
* @typedef {object} MenuLinks
|
|
133
|
-
*
|
|
134
|
-
* @property {boolean} [update=true] - If true, {@linkcode menuLinks.class} will be added to active links and it will be removed from none-active ones.
|
|
135
|
-
* @property {string} [class=active] - Name of the class for active links.
|
|
136
|
-
* @property {string} [compare=href] - The attribute that will help to match old and new links.
|
|
137
|
-
* @property {string} [selectorNew=.menu a]
|
|
138
|
-
* @property {string} [selectorOld=.menu a]
|
|
139
|
-
*/
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* @alias Vevet.PageAjaxModule
|
|
143
|
-
*
|
|
144
|
-
* @param {Vevet.PageAjaxModule.Properties} [data]
|
|
145
|
-
*/
|
|
146
|
-
function PageAjaxModule(data) {
|
|
147
|
-
_classCallCheck(this, PageAjaxModule);
|
|
148
|
-
|
|
149
|
-
return _super.call(this, data);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
_createClass(PageAjaxModule, [{
|
|
153
|
-
key: "prefix",
|
|
154
|
-
get: function get() {
|
|
155
|
-
return "".concat(this._v.prefix, "pageAjax");
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* @readonly
|
|
159
|
-
* @type {Vevet.PageAjaxModule.Properties}
|
|
160
|
-
*/
|
|
161
|
-
|
|
162
|
-
}, {
|
|
163
|
-
key: "defaultProp",
|
|
164
|
-
get: function get() {
|
|
165
|
-
return (0, _merge.default)(_get(_getPrototypeOf(PageAjaxModule.prototype), "defaultProp", this), {
|
|
166
|
-
selectors: {
|
|
167
|
-
outer: ".".concat(this._prefix),
|
|
168
|
-
links: ".".concat(this._prefix, "__link")
|
|
169
|
-
},
|
|
170
|
-
popstate: {
|
|
171
|
-
event: true,
|
|
172
|
-
reload: true,
|
|
173
|
-
timeout: 300
|
|
174
|
-
},
|
|
175
|
-
on: true,
|
|
176
|
-
disabled: false,
|
|
177
|
-
update: {
|
|
178
|
-
url: true,
|
|
179
|
-
title: true,
|
|
180
|
-
content: true
|
|
181
|
-
},
|
|
182
|
-
menuLinks: {
|
|
183
|
-
update: true,
|
|
184
|
-
class: 'active',
|
|
185
|
-
compare: 'href',
|
|
186
|
-
selectorNew: '.menu a',
|
|
187
|
-
selectorOld: '.menu a'
|
|
188
|
-
},
|
|
189
|
-
timeouts: {
|
|
190
|
-
load: 100,
|
|
191
|
-
update: 100,
|
|
192
|
-
done: 100
|
|
193
|
-
},
|
|
194
|
-
pageChange: {
|
|
195
|
-
on: true,
|
|
196
|
-
default: 'default',
|
|
197
|
-
hide: 'prepare',
|
|
198
|
-
destroy: 'loaded',
|
|
199
|
-
create: 'updated',
|
|
200
|
-
show: 'done'
|
|
201
|
-
},
|
|
202
|
-
changeSame: true,
|
|
203
|
-
cache: false,
|
|
204
|
-
ajax: {
|
|
205
|
-
method: 'post',
|
|
206
|
-
successCodes: [404]
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* @member Vevet.PageAjaxModule#prop
|
|
212
|
-
* @memberof Vevet.PageAjaxModule
|
|
213
|
-
* @readonly
|
|
214
|
-
* @type {Vevet.PageAjaxModule.Properties}
|
|
215
|
-
*/
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* @member Vevet.PageAjaxModule#_prop
|
|
219
|
-
* @memberof Vevet.PageAjaxModule
|
|
220
|
-
* @protected
|
|
221
|
-
* @type {Vevet.PageAjaxModule.Properties}
|
|
222
|
-
*/
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* @function Vevet.PageAjaxModule#changeProp
|
|
226
|
-
* @memberof Vevet.PageAjaxModule
|
|
227
|
-
* @param {Vevet.PageAjaxModule.Properties} [prop]
|
|
228
|
-
*/
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* @description Get links.
|
|
232
|
-
* @readonly
|
|
233
|
-
* @type {Array<HTMLAnchorElement>}
|
|
234
|
-
*/
|
|
235
|
-
|
|
236
|
-
}, {
|
|
237
|
-
key: "links",
|
|
238
|
-
get: function get() {
|
|
239
|
-
return this._links;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* @description Outer element.
|
|
243
|
-
* @readonly
|
|
244
|
-
* @type {HTMLElement}
|
|
245
|
-
*/
|
|
246
|
-
|
|
247
|
-
}, {
|
|
248
|
-
key: "outer",
|
|
249
|
-
get: function get() {
|
|
250
|
-
return this._outer;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* @description If something is being loaded.
|
|
254
|
-
* @default false
|
|
255
|
-
* @readonly
|
|
256
|
-
* @type {boolean}
|
|
257
|
-
*/
|
|
258
|
-
|
|
259
|
-
}, {
|
|
260
|
-
key: "loading",
|
|
261
|
-
get: function get() {
|
|
262
|
-
return this._loading;
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* @type {Vevet.PageAjaxModule.EventLoaded}
|
|
266
|
-
*/
|
|
267
|
-
|
|
268
|
-
}, {
|
|
269
|
-
key: "lastData",
|
|
270
|
-
get: function get() {
|
|
271
|
-
return this._lastData;
|
|
272
|
-
} // Extra Constructor
|
|
273
|
-
|
|
274
|
-
}, {
|
|
275
|
-
key: "_extra",
|
|
276
|
-
value: function _extra() {
|
|
277
|
-
_get(_getPrototypeOf(PageAjaxModule.prototype), "_extra", this).call(this);
|
|
278
|
-
/**
|
|
279
|
-
* @description Data attribute names.
|
|
280
|
-
* @member {object}
|
|
281
|
-
* @protected
|
|
282
|
-
*/
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
this._data = {
|
|
286
|
-
proceeded: "data-".concat(this._prefix, "-proceeded"),
|
|
287
|
-
name: "data-".concat(this._prefix, "-name")
|
|
288
|
-
};
|
|
289
|
-
/**
|
|
290
|
-
* @description If a page is loading.
|
|
291
|
-
* @protected
|
|
292
|
-
* @member {boolean}
|
|
293
|
-
*/
|
|
294
|
-
|
|
295
|
-
this._loading = false;
|
|
296
|
-
/**
|
|
297
|
-
* @description Links.
|
|
298
|
-
* @protected
|
|
299
|
-
* @member {NodeList}
|
|
300
|
-
*/
|
|
301
|
-
|
|
302
|
-
this._links = [];
|
|
303
|
-
/**
|
|
304
|
-
* @description Popstate timeout
|
|
305
|
-
* @member {number|false}
|
|
306
|
-
* @protected
|
|
307
|
-
*/
|
|
308
|
-
|
|
309
|
-
this._popstateTimeout = false;
|
|
310
|
-
/**
|
|
311
|
-
* @description Links listeners
|
|
312
|
-
* @protected
|
|
313
|
-
* @member {Array<Vevet.BindListener>}
|
|
314
|
-
*/
|
|
315
|
-
|
|
316
|
-
this._linksListeners = [];
|
|
317
|
-
/**
|
|
318
|
-
* @type {Vevet.PageAjaxModule.EventLoaded}
|
|
319
|
-
* @protected
|
|
320
|
-
*/
|
|
321
|
-
|
|
322
|
-
this._lastData = {};
|
|
323
|
-
/**
|
|
324
|
-
* @description A list of visited links.
|
|
325
|
-
* @protected
|
|
326
|
-
* @type {Array<string>}
|
|
327
|
-
*/
|
|
328
|
-
|
|
329
|
-
this._visitedLinks = [window.location.href];
|
|
330
|
-
/**
|
|
331
|
-
* @description Outer element
|
|
332
|
-
* @member {HTMLElement}
|
|
333
|
-
* @protected
|
|
334
|
-
*/
|
|
335
|
-
|
|
336
|
-
this._outer = selectEl.one(this._prop.selectors.outer); // get elements
|
|
337
|
-
|
|
338
|
-
this.setLinks();
|
|
339
|
-
} // Set event listeners
|
|
340
|
-
|
|
341
|
-
}, {
|
|
342
|
-
key: "_setEvents",
|
|
343
|
-
value: function _setEvents() {
|
|
344
|
-
// popstate
|
|
345
|
-
this.listener(window, "popstate", this._popstate.bind(this));
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* @description Get links and set event listeners on them,
|
|
349
|
-
* but remove listeners from previous links before.
|
|
350
|
-
*/
|
|
351
|
-
|
|
352
|
-
}, {
|
|
353
|
-
key: "setLinks",
|
|
354
|
-
value: function setLinks() {
|
|
355
|
-
// remove old event listeners
|
|
356
|
-
this._removeLinksListeners(); // get new links
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
this._links = selectEl.all(this._prop.selectors.links); // and set events on them
|
|
360
|
-
|
|
361
|
-
this._addLinksListeners();
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* @description Add event listeners on links.
|
|
365
|
-
* @protected
|
|
366
|
-
*/
|
|
367
|
-
|
|
368
|
-
}, {
|
|
369
|
-
key: "_addLinksListeners",
|
|
370
|
-
value: function _addLinksListeners() {
|
|
371
|
-
var _this = this;
|
|
372
|
-
|
|
373
|
-
var proceeded = this._data.proceeded;
|
|
374
|
-
|
|
375
|
-
this._links.forEach(function (link) {
|
|
376
|
-
// check if not set yet
|
|
377
|
-
if (typeof link[proceeded] == 'undefined') {
|
|
378
|
-
var e = _this.listener(link, 'click', _this.load.bind(_this, {
|
|
379
|
-
link: link,
|
|
380
|
-
push: true,
|
|
381
|
-
popstate: false
|
|
382
|
-
}));
|
|
383
|
-
|
|
384
|
-
_this._linksListeners.push(e);
|
|
385
|
-
|
|
386
|
-
link[proceeded] = true;
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* @description Remove listeners from links.
|
|
392
|
-
* @protected
|
|
393
|
-
*/
|
|
394
|
-
|
|
395
|
-
}, {
|
|
396
|
-
key: "_removeLinksListeners",
|
|
397
|
-
value: function _removeLinksListeners() {
|
|
398
|
-
var _this2 = this;
|
|
399
|
-
|
|
400
|
-
this._linksListeners.forEach(function (listener) {
|
|
401
|
-
_this2.removeEventListener({
|
|
402
|
-
el: listener.el,
|
|
403
|
-
id: listener.id
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
delete listener.el[_this2._data.proceeded];
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
this._linksListeners = [];
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* @description Popstate event
|
|
413
|
-
* @protected
|
|
414
|
-
*/
|
|
415
|
-
|
|
416
|
-
}, {
|
|
417
|
-
key: "_popstate",
|
|
418
|
-
value: function _popstate() {
|
|
419
|
-
var prop = this._prop.popstate;
|
|
420
|
-
|
|
421
|
-
if (!prop.event) {
|
|
422
|
-
if (prop.reload) {
|
|
423
|
-
window.location.reload();
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
this._popstateLoad();
|
|
430
|
-
}
|
|
431
|
-
/**
|
|
432
|
-
* @memberof Vevet.PageAjaxModule
|
|
433
|
-
* @typedef {object} EventHref
|
|
434
|
-
* @property {string} href - The url of the further ajax request.
|
|
435
|
-
*/
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* @description Load on popstate.
|
|
439
|
-
* @protected
|
|
440
|
-
*/
|
|
441
|
-
|
|
442
|
-
}, {
|
|
443
|
-
key: "_popstateLoad",
|
|
444
|
-
value: function _popstateLoad() {
|
|
445
|
-
var prop = this._prop; // clear timeout
|
|
446
|
-
|
|
447
|
-
if (this._popstateTimeout) {
|
|
448
|
-
clearTimeout(this._popstateTimeout);
|
|
449
|
-
this._popstateTimeout = false;
|
|
450
|
-
} // check if available and then load
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
if (!this._loading & !prop.disabled) {
|
|
454
|
-
this._popstateTimeout = setTimeout(this._popstateForceLoad.bind(this), prop.popstate.timeout);
|
|
455
|
-
} // timeouts and callbacks if not available
|
|
456
|
-
else {
|
|
457
|
-
if (this._loading) {
|
|
458
|
-
this._popstateTimeout = setTimeout(this._popstateBusyLoad.bind(this), prop.popstate.timeout);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* @description Popstate force load.
|
|
464
|
-
* @protected
|
|
465
|
-
*/
|
|
466
|
-
|
|
467
|
-
}, {
|
|
468
|
-
key: "_popstateForceLoad",
|
|
469
|
-
value: function _popstateForceLoad() {
|
|
470
|
-
this._pageChange('popstate');
|
|
471
|
-
|
|
472
|
-
this.lbt('popstate', {
|
|
473
|
-
href: window.location.href
|
|
474
|
-
});
|
|
475
|
-
this.load({
|
|
476
|
-
link: window.location.href,
|
|
477
|
-
push: false,
|
|
478
|
-
popstate: true
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* @description Popstate event when loading or disabled.
|
|
483
|
-
* @protected
|
|
484
|
-
*/
|
|
485
|
-
|
|
486
|
-
}, {
|
|
487
|
-
key: "_popstateBusyLoad",
|
|
488
|
-
value: function _popstateBusyLoad() {
|
|
489
|
-
var _this3 = this;
|
|
490
|
-
|
|
491
|
-
this.on("done", function () {
|
|
492
|
-
_this3._popstateLoad();
|
|
493
|
-
}, {
|
|
494
|
-
once: true
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
/**
|
|
498
|
-
* @memberof Vevet.PageAjaxModule
|
|
499
|
-
* @typedef {object} EventLinkHref
|
|
500
|
-
* @property {string} href - The url of the further ajax request.
|
|
501
|
-
* @property {HTMLAnchorElement|string} link - The link that was clicked or url passed.
|
|
502
|
-
* @property {boolean} visited - If the page was already visited.
|
|
503
|
-
*/
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* @description Page loading.
|
|
507
|
-
*
|
|
508
|
-
* @param {object} data
|
|
509
|
-
* @param {HTMLAnchorElement|string} data.link - Either an html element or a url string.
|
|
510
|
-
* @param {boolean} [data.push=true] - Defines if you need to push the new url to the history.
|
|
511
|
-
* @param {boolean} [data.popstate=false] - Defines if the action is called on popstate.
|
|
512
|
-
* @param {object} [e=null] - Event data. It is not needed if the method is called not on a click.
|
|
513
|
-
*
|
|
514
|
-
* @returns {boolean} Returns true if the action is successful.
|
|
515
|
-
*/
|
|
516
|
-
|
|
517
|
-
}, {
|
|
518
|
-
key: "load",
|
|
519
|
-
value: function load(data) {
|
|
520
|
-
var _this4 = this;
|
|
521
|
-
|
|
522
|
-
var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
523
|
-
var props = this._prop; // check if enabled
|
|
524
|
-
|
|
525
|
-
if (!props.on) {
|
|
526
|
-
return false;
|
|
527
|
-
} else {
|
|
528
|
-
// check if link
|
|
529
|
-
var hasTarget = false;
|
|
530
|
-
|
|
531
|
-
if (data.link instanceof HTMLAnchorElement) {
|
|
532
|
-
if (data.link.getAttribute("target")) {
|
|
533
|
-
hasTarget = true;
|
|
534
|
-
}
|
|
535
|
-
} // prevent default event if target doesn't exist
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
if (e != null & !hasTarget) {
|
|
539
|
-
e.preventDefault();
|
|
540
|
-
}
|
|
541
|
-
} // check if loading
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
if (this._loading) {
|
|
545
|
-
return false;
|
|
546
|
-
} // check if disabled
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
if (props.disabled) {
|
|
550
|
-
return false;
|
|
551
|
-
} // extend data
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
var prop = {
|
|
555
|
-
push: true,
|
|
556
|
-
popstate: false
|
|
557
|
-
};
|
|
558
|
-
data = (0, _merge.default)(prop, data); // get href
|
|
559
|
-
|
|
560
|
-
var href = this._getHref(data.link);
|
|
561
|
-
|
|
562
|
-
if (!href) {
|
|
563
|
-
return false;
|
|
564
|
-
} // check host
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
if (!href.includes(window.location.host)) {
|
|
568
|
-
window.location.href = href;
|
|
569
|
-
return false;
|
|
570
|
-
} // callback object
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
var callbackObj = {
|
|
574
|
-
href: href,
|
|
575
|
-
link: data.link,
|
|
576
|
-
visited: this._visitedLinks.includes(href)
|
|
577
|
-
}; // if the href is the same
|
|
578
|
-
|
|
579
|
-
if (!props.changeSame & !data.popstate) {
|
|
580
|
-
if (href == location.href) {
|
|
581
|
-
this._pageChange('clickSame');
|
|
582
|
-
|
|
583
|
-
this.lbt("clickSame", callbackObj);
|
|
584
|
-
return false;
|
|
585
|
-
}
|
|
586
|
-
} // change states
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
this._loading = true; // click event
|
|
590
|
-
|
|
591
|
-
this._pageChange('click');
|
|
592
|
-
|
|
593
|
-
this.lbt('click', callbackObj); // prepare event
|
|
594
|
-
|
|
595
|
-
this._pageChange('prepare');
|
|
596
|
-
|
|
597
|
-
this.lbt('prepare', callbackObj); // ajax load
|
|
598
|
-
|
|
599
|
-
(0, _timeoutCallback.default)(function () {
|
|
600
|
-
_this4._loadAjax(data, href);
|
|
601
|
-
}, props.timeouts.load);
|
|
602
|
-
return true;
|
|
603
|
-
}
|
|
604
|
-
/**
|
|
605
|
-
* @description Get href.
|
|
606
|
-
* @param {HTMLAnchorElement|string} link - Either an html element or a url string.
|
|
607
|
-
* @protected
|
|
608
|
-
*/
|
|
609
|
-
|
|
610
|
-
}, {
|
|
611
|
-
key: "_getHref",
|
|
612
|
-
value: function _getHref(link) {
|
|
613
|
-
if (typeof link === 'string') {
|
|
614
|
-
if (!link.includes("http")) {
|
|
615
|
-
link = location.origin + link;
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
return link;
|
|
619
|
-
} else {
|
|
620
|
-
if (link instanceof HTMLAnchorElement) {
|
|
621
|
-
if (link.getAttribute("href")) {
|
|
622
|
-
return link.href;
|
|
623
|
-
} else {
|
|
624
|
-
return false;
|
|
625
|
-
}
|
|
626
|
-
} else {
|
|
627
|
-
return false;
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
/**
|
|
632
|
-
* @description Load page through ajax.
|
|
633
|
-
*
|
|
634
|
-
* @protected
|
|
635
|
-
*
|
|
636
|
-
* @param {object} data
|
|
637
|
-
* @param {HTMLAnchorElement|string} data.link - Either html element or url itself.
|
|
638
|
-
* @param {boolean} data.push - Defines if you need to push the new url to the history.
|
|
639
|
-
* @param {boolean} data.popstate - Defines if the action is called on popstate.
|
|
640
|
-
* @param {string} href - Url.
|
|
641
|
-
*/
|
|
642
|
-
|
|
643
|
-
}, {
|
|
644
|
-
key: "_loadAjax",
|
|
645
|
-
value: function _loadAjax(data, href) {
|
|
646
|
-
var prop = this._prop;
|
|
647
|
-
|
|
648
|
-
this._v.ajax.load({
|
|
649
|
-
url: href,
|
|
650
|
-
method: prop.ajax.method,
|
|
651
|
-
data: {
|
|
652
|
-
pageAjax: 1
|
|
653
|
-
},
|
|
654
|
-
cache: prop.cache,
|
|
655
|
-
success: this._loadSuccess.bind(this, data, href),
|
|
656
|
-
abort: this._loadAjax.bind(this, data, href),
|
|
657
|
-
error: this._loadError.bind(this, data, href)
|
|
658
|
-
});
|
|
659
|
-
}
|
|
660
|
-
/**
|
|
661
|
-
* @description When a new page is successfully loaded.
|
|
662
|
-
*
|
|
663
|
-
* @protected
|
|
664
|
-
*
|
|
665
|
-
* @param {object} data
|
|
666
|
-
* @param {HTMLAnchorElement|string} data.link - Either html element or url itself.
|
|
667
|
-
* @param {boolean} data.push - Defines if you need to push the new url to the history.
|
|
668
|
-
* @param {boolean} data.popstate - Defines if the action is called on popstate.
|
|
669
|
-
* @param {string} href - Url.
|
|
670
|
-
* @param {Vevet.AJAXEvent.CacheItem} ajax - Ajax request & response data.
|
|
671
|
-
*/
|
|
672
|
-
|
|
673
|
-
}, {
|
|
674
|
-
key: "_loadSuccess",
|
|
675
|
-
value: function _loadSuccess(data, href, ajax) {
|
|
676
|
-
this._visitedLinks.push(href);
|
|
677
|
-
|
|
678
|
-
this._update(data, href, ajax);
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* @description When a new page is not loaded.
|
|
682
|
-
*
|
|
683
|
-
* @protected
|
|
684
|
-
*
|
|
685
|
-
* @param {object} data
|
|
686
|
-
* @param {HTMLAnchorElement|string} data.link - Either html element or url itself.
|
|
687
|
-
* @param {boolean} data.push - Defines if you need to push the new url to the history.
|
|
688
|
-
* @param {boolean} data.popstate - Defines if the action is called on popstate.
|
|
689
|
-
* @param {string} href - Url.
|
|
690
|
-
* @param {Vevet.AJAXEvent.CacheItem} ajax - Ajax request & response data.
|
|
691
|
-
*/
|
|
692
|
-
|
|
693
|
-
}, {
|
|
694
|
-
key: "_loadError",
|
|
695
|
-
value: function _loadError(data, href, ajax) {
|
|
696
|
-
if (this._prop.ajax.successCodes.includes(ajax.xhr.status)) {
|
|
697
|
-
this._loadSuccess(data, href, ajax);
|
|
698
|
-
} else {
|
|
699
|
-
window.location.href = href;
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
/**
|
|
703
|
-
* @memberof Vevet.PageAjaxModule
|
|
704
|
-
* @typedef {object} EventLoaded
|
|
705
|
-
* @property {Vevet.AJAXEvent.CacheItem} ajax - Ajax request & response data.
|
|
706
|
-
* @property {string} response - HTML of the whole page.
|
|
707
|
-
* @property {string} html - innerHTML of the new outer.
|
|
708
|
-
* @property {HTMLElement} e - An abstract html element with new html.
|
|
709
|
-
* @property {HTMLElement} outer - The new outer.
|
|
710
|
-
* @property {string} name - The name of the page.
|
|
711
|
-
* @property {boolean} push - Defines if you need to push the new url to the history.
|
|
712
|
-
* @property {string} href - Url.
|
|
713
|
-
* @property {boolean} popstate - Defines if the load was called on popstate change.
|
|
714
|
-
*/
|
|
715
|
-
|
|
716
|
-
/**
|
|
717
|
-
* @description Update values and contents.
|
|
718
|
-
*
|
|
719
|
-
* @protected
|
|
720
|
-
*
|
|
721
|
-
* @param {object} data - Request info.
|
|
722
|
-
* @param {HTMLAnchorElement|string} data.link
|
|
723
|
-
* @param {boolean} data.push - Defines if you need to push the new url to the history.
|
|
724
|
-
* @param {boolean} data.popstate - Defines if the action is called on popstate.
|
|
725
|
-
* @param {string} href - Url.
|
|
726
|
-
* @param {Vevet.AJAXEvent.CacheItem} ajax - Ajax request & response data.
|
|
727
|
-
*/
|
|
728
|
-
|
|
729
|
-
}, {
|
|
730
|
-
key: "_update",
|
|
731
|
-
value: function _update(data, href, ajax) {
|
|
732
|
-
var _this5 = this;
|
|
733
|
-
|
|
734
|
-
// get properties
|
|
735
|
-
var prop = this._prop,
|
|
736
|
-
propOuterSelector = prop.selectors.outer; // create a new abstract html element
|
|
737
|
-
|
|
738
|
-
var e = document.createElement("html");
|
|
739
|
-
e.innerHTML = ajax.xhr.responseText; // get outer of the page
|
|
740
|
-
|
|
741
|
-
var outer = e.querySelector(propOuterSelector);
|
|
742
|
-
|
|
743
|
-
if (outer == null) {
|
|
744
|
-
throw new Error("There's no HTMLElement under the selector \"".concat(propOuterSelector, "\""));
|
|
745
|
-
} // get name of the page
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
var name = outer.getAttribute(this._data.name);
|
|
749
|
-
|
|
750
|
-
if (name == null) {
|
|
751
|
-
throw new Error("The outer \"".concat(propOuterSelector, "\" must contain the attribute \"").concat(this._data.name, "\""));
|
|
752
|
-
} // get new html
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
var html = outer.innerHTML; // form object
|
|
756
|
-
|
|
757
|
-
var obj = {
|
|
758
|
-
ajax: ajax,
|
|
759
|
-
response: ajax.xhr.responseText,
|
|
760
|
-
html: html,
|
|
761
|
-
outer: outer,
|
|
762
|
-
name: name,
|
|
763
|
-
e: e,
|
|
764
|
-
push: data.push,
|
|
765
|
-
href: href,
|
|
766
|
-
popstate: data.popstate
|
|
767
|
-
}; // event loaded
|
|
768
|
-
|
|
769
|
-
this._pageChange('loaded', name);
|
|
770
|
-
|
|
771
|
-
this.lbt("loaded", obj); // update contents
|
|
772
|
-
|
|
773
|
-
(0, _timeoutCallback.default)(function () {
|
|
774
|
-
_this5._updateContents(obj); // done
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
(0, _timeoutCallback.default)(function () {
|
|
778
|
-
_this5._done(obj);
|
|
779
|
-
}, prop.timeouts.done); // clear html
|
|
780
|
-
|
|
781
|
-
e = null;
|
|
782
|
-
}, prop.timeouts.update);
|
|
783
|
-
}
|
|
784
|
-
/**
|
|
785
|
-
* @description Update contents inside the window.
|
|
786
|
-
* @protected
|
|
787
|
-
* @param {Vevet.PageAjaxModule.EventLoaded} data - Ajax data.
|
|
788
|
-
*/
|
|
789
|
-
|
|
790
|
-
}, {
|
|
791
|
-
key: "_updateContents",
|
|
792
|
-
value: function _updateContents(data) {
|
|
793
|
-
this._lastData = data; // update contents
|
|
794
|
-
|
|
795
|
-
this._updateUrl(data);
|
|
796
|
-
|
|
797
|
-
this._updateTitle(data);
|
|
798
|
-
|
|
799
|
-
this._updateHTML(data);
|
|
800
|
-
|
|
801
|
-
if (this._prop.menuLinks.update) {
|
|
802
|
-
this._updateMenuLinks(data, this.prop.menuLinks);
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
this._updatePageData(data); // launch callback
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
this._pageChange('updated', data.name);
|
|
809
|
-
|
|
810
|
-
this.lbt("updated", data);
|
|
811
|
-
}
|
|
812
|
-
/**
|
|
813
|
-
* @description Update page url.
|
|
814
|
-
* @protected
|
|
815
|
-
* @param {Vevet.PageAjaxModule.EventLoaded} data - Ajax data.
|
|
816
|
-
*/
|
|
817
|
-
|
|
818
|
-
}, {
|
|
819
|
-
key: "_updateUrl",
|
|
820
|
-
value: function _updateUrl(data) {
|
|
821
|
-
if (this._prop.update.url & data.push) {
|
|
822
|
-
window.history.pushState(null, "", data.href);
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
/**
|
|
826
|
-
* @description Update page title.
|
|
827
|
-
* @protected
|
|
828
|
-
* @param {Vevet.PageAjaxModule.EventLoaded} data - Ajax data.
|
|
829
|
-
*/
|
|
830
|
-
|
|
831
|
-
}, {
|
|
832
|
-
key: "_updateTitle",
|
|
833
|
-
value: function _updateTitle(data) {
|
|
834
|
-
if (this._prop.update.title) {
|
|
835
|
-
var el = {
|
|
836
|
-
old: document.querySelector("title"),
|
|
837
|
-
new: data.e.querySelector("title")
|
|
838
|
-
};
|
|
839
|
-
|
|
840
|
-
if (el.old !== null & el.new !== null) {
|
|
841
|
-
el.old.innerHTML = el.new.innerHTML;
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
/**
|
|
846
|
-
* @description Update page html.
|
|
847
|
-
* @protected
|
|
848
|
-
* @param {Vevet.PageAjaxModule.EventLoaded} data - Ajax data.
|
|
849
|
-
*/
|
|
850
|
-
|
|
851
|
-
}, {
|
|
852
|
-
key: "_updateHTML",
|
|
853
|
-
value: function _updateHTML(data) {
|
|
854
|
-
if (this._prop.update.content) {
|
|
855
|
-
this._outer.innerHTML = data.html;
|
|
856
|
-
this.setLinks();
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
/**
|
|
860
|
-
* @description Update menu links.
|
|
861
|
-
* @param {Vevet.PageAjaxModule.MenuLinks} menuLinks
|
|
862
|
-
*/
|
|
863
|
-
|
|
864
|
-
}, {
|
|
865
|
-
key: "updateMenuLinks",
|
|
866
|
-
value: function updateMenuLinks() {
|
|
867
|
-
var menuLinks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.prop.menuLinks;
|
|
868
|
-
menuLinks = (0, _merge.default)({
|
|
869
|
-
update: true,
|
|
870
|
-
class: 'active',
|
|
871
|
-
compare: 'href',
|
|
872
|
-
selectorNew: '.menu a',
|
|
873
|
-
selectorOld: '.menu a'
|
|
874
|
-
}, menuLinks);
|
|
875
|
-
|
|
876
|
-
if (Object.keys(this._lastData).length > 0) {
|
|
877
|
-
this._updateMenuLinks(this._lastData, menuLinks);
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
/**
|
|
881
|
-
* @description Update menu links.
|
|
882
|
-
* @protected
|
|
883
|
-
* @param {Vevet.PageAjaxModule.EventLoaded} data - Ajax data.
|
|
884
|
-
* @param {Vevet.PageAjaxModule.MenuLinks} menuLinks
|
|
885
|
-
*/
|
|
886
|
-
|
|
887
|
-
}, {
|
|
888
|
-
key: "_updateMenuLinks",
|
|
889
|
-
value: function _updateMenuLinks(data, menuLinks) {
|
|
890
|
-
// get links
|
|
891
|
-
var el = {
|
|
892
|
-
old: document.querySelectorAll(menuLinks.selectorNew),
|
|
893
|
-
new: data.e.querySelectorAll(menuLinks.selectorOld)
|
|
894
|
-
}; // compare them
|
|
895
|
-
|
|
896
|
-
for (var i = 0; i < el.new.length; i++) {
|
|
897
|
-
var elNew = el.new[i],
|
|
898
|
-
attributeNew = elNew.getAttribute(menuLinks.compare),
|
|
899
|
-
activeNew = elNew.classList.contains(menuLinks.class);
|
|
900
|
-
|
|
901
|
-
for (var a = 0; a < el.old.length; a++) {
|
|
902
|
-
var elOld = el.old[a],
|
|
903
|
-
attributeOld = elOld.getAttribute(menuLinks.compare);
|
|
904
|
-
|
|
905
|
-
if (attributeNew === attributeOld) {
|
|
906
|
-
if (activeNew) {
|
|
907
|
-
elOld.classList.add(menuLinks.class);
|
|
908
|
-
} else {
|
|
909
|
-
elOld.classList.remove(menuLinks.class);
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
/**
|
|
916
|
-
* @description Update current page data.
|
|
917
|
-
* @protected
|
|
918
|
-
* @param {Vevet.PageAjaxModule.EventLoaded} data - Ajax data.
|
|
919
|
-
*/
|
|
920
|
-
|
|
921
|
-
}, {
|
|
922
|
-
key: "_updatePageData",
|
|
923
|
-
value: function _updatePageData(data) {
|
|
924
|
-
this._outer.setAttribute(this._data.name, data.name);
|
|
925
|
-
|
|
926
|
-
this._v.page = [data.name];
|
|
927
|
-
}
|
|
928
|
-
/**
|
|
929
|
-
* @description End the process.
|
|
930
|
-
* @protected
|
|
931
|
-
* @param {Vevet.PageAjaxModule.EventLoaded} data - Ajax data.
|
|
932
|
-
*/
|
|
933
|
-
|
|
934
|
-
}, {
|
|
935
|
-
key: "_done",
|
|
936
|
-
value: function _done(data) {
|
|
937
|
-
// change state
|
|
938
|
-
this._loading = false; // launch callback
|
|
939
|
-
|
|
940
|
-
this._pageChange('done', data.name);
|
|
941
|
-
|
|
942
|
-
this.lbt("done", data);
|
|
943
|
-
}
|
|
944
|
-
/**
|
|
945
|
-
* @description Change pages automatically.
|
|
946
|
-
* @param {string} target - What callback is launched. See {@linkcode _prop.pageChange}.
|
|
947
|
-
* @param {string} name - Name of the page.
|
|
948
|
-
* @protected
|
|
949
|
-
*/
|
|
950
|
-
|
|
951
|
-
}, {
|
|
952
|
-
key: "_pageChange",
|
|
953
|
-
value: function _pageChange(target) {
|
|
954
|
-
var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
955
|
-
// automatical changes
|
|
956
|
-
var auto = this._prop.pageChange; // check if automatical change enabled
|
|
957
|
-
|
|
958
|
-
if (!auto.on) {
|
|
959
|
-
return;
|
|
960
|
-
} // if need to hide
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
if (target === auto.hide) {
|
|
964
|
-
this._v.vevetPage.hide();
|
|
965
|
-
} // if need to destroy
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
if (target === auto.destroy) {
|
|
969
|
-
this._v.vevetPage.destroy();
|
|
970
|
-
} // if need to create
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
if (target === auto.create) {
|
|
974
|
-
var existingPage = false,
|
|
975
|
-
defaultPage = false;
|
|
976
|
-
|
|
977
|
-
for (var i = 0; i < this._v.vevetPages.length; i++) {
|
|
978
|
-
var p = this._v.vevetPages[i];
|
|
979
|
-
|
|
980
|
-
if (p.name == name) {
|
|
981
|
-
existingPage = p;
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
if (p.name == this._prop.pageChange.default) {
|
|
985
|
-
defaultPage = p;
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
if (!existingPage) {
|
|
990
|
-
if (!defaultPage) {
|
|
991
|
-
throw new Error("Default page doesn't exist!");
|
|
992
|
-
} else {
|
|
993
|
-
defaultPage.create(true);
|
|
994
|
-
}
|
|
995
|
-
} else {
|
|
996
|
-
existingPage.create(true);
|
|
997
|
-
}
|
|
998
|
-
} // if need to show
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
if (target === auto.show) {
|
|
1002
|
-
this._v.vevetPage.show();
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
}]);
|
|
1006
|
-
|
|
1007
|
-
return PageAjaxModule;
|
|
1008
|
-
}(_Module2.default);
|
|
1009
|
-
|
|
1010
|
-
exports.default = PageAjaxModule;
|