@oxiaom/adoremix-linux-arm 1.0.0
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/index.js +24 -0
- package/native/.adoremix-native.json +1 -0
- package/native/AdoreMixV8.0.17_console_linuxarm +0 -0
- package/native/README.md +20 -0
- package/native/audio/libqtaudio_alsa.so +0 -0
- package/native/audio/libqtmedia_pulse.so +0 -0
- package/native/bearer/libqconnmanbearer.so +0 -0
- package/native/bearer/libqgenericbearer.so +0 -0
- package/native/bearer/libqnmbearer.so +0 -0
- package/native/etc/Demo1.ini +49 -0
- package/native/etc/docroot/bangzhu/.project +22 -0
- package/native/etc/docroot/bangzhu/css/app.css +21 -0
- package/native/etc/docroot/bangzhu/css/feedback.css +131 -0
- package/native/etc/docroot/bangzhu/css/icons-extra.css +63 -0
- package/native/etc/docroot/bangzhu/css/mui.dtpicker.css +136 -0
- package/native/etc/docroot/bangzhu/css/mui.imageviewer.css +123 -0
- package/native/etc/docroot/bangzhu/css/mui.indexedlist.css +112 -0
- package/native/etc/docroot/bangzhu/css/mui.listpicker.css +95 -0
- package/native/etc/docroot/bangzhu/css/mui.min.css +5 -0
- package/native/etc/docroot/bangzhu/css/mui.picker.all.css +285 -0
- package/native/etc/docroot/bangzhu/css/mui.picker.css +85 -0
- package/native/etc/docroot/bangzhu/css/mui.picker.min.css +7 -0
- package/native/etc/docroot/bangzhu/css/mui.poppicker.css +64 -0
- package/native/etc/docroot/bangzhu/examples/accordion.html +125 -0
- package/native/etc/docroot/bangzhu/examples/actionsheet-plus.html +128 -0
- package/native/etc/docroot/bangzhu/examples/actionsheet.html +153 -0
- package/native/etc/docroot/bangzhu/examples/ad.html +47 -0
- package/native/etc/docroot/bangzhu/examples/ajax.html +155 -0
- package/native/etc/docroot/bangzhu/examples/badges.html +54 -0
- package/native/etc/docroot/bangzhu/examples/beecloud.html +150 -0
- package/native/etc/docroot/bangzhu/examples/best-practices/list-to-detail/detail.html +104 -0
- package/native/etc/docroot/bangzhu/examples/best-practices/list-to-detail/list-to-detail.css +160 -0
- package/native/etc/docroot/bangzhu/examples/best-practices/list-to-detail/listview.html +326 -0
- package/native/etc/docroot/bangzhu/examples/best-practices/list-to-detail/vue.min.js +8 -0
- package/native/etc/docroot/bangzhu/examples/buttons-with-badges.html +48 -0
- package/native/etc/docroot/bangzhu/examples/buttons-with-block.html +50 -0
- package/native/etc/docroot/bangzhu/examples/buttons-with-icons.html +68 -0
- package/native/etc/docroot/bangzhu/examples/buttons-with-loading.html +86 -0
- package/native/etc/docroot/bangzhu/examples/buttons.html +89 -0
- package/native/etc/docroot/bangzhu/examples/card.html +97 -0
- package/native/etc/docroot/bangzhu/examples/checkbox.html +68 -0
- package/native/etc/docroot/bangzhu/examples/clouddb_wilddog.html +268 -0
- package/native/etc/docroot/bangzhu/examples/date.html +88 -0
- package/native/etc/docroot/bangzhu/examples/dialog.html +82 -0
- package/native/etc/docroot/bangzhu/examples/dtpicker.html +129 -0
- package/native/etc/docroot/bangzhu/examples/echarts.html +150 -0
- package/native/etc/docroot/bangzhu/examples/feedback.html +72 -0
- package/native/etc/docroot/bangzhu/examples/grid-default.html +61 -0
- package/native/etc/docroot/bangzhu/examples/grid-pagination.html +266 -0
- package/native/etc/docroot/bangzhu/examples/guide.html +269 -0
- package/native/etc/docroot/bangzhu/examples/icons-extra.html +161 -0
- package/native/etc/docroot/bangzhu/examples/icons.html +182 -0
- package/native/etc/docroot/bangzhu/examples/im-chat.html +711 -0
- package/native/etc/docroot/bangzhu/examples/imageviewer-native.html +90 -0
- package/native/etc/docroot/bangzhu/examples/imageviewer.html +197 -0
- package/native/etc/docroot/bangzhu/examples/indexed-list-select.html +459 -0
- package/native/etc/docroot/bangzhu/examples/indexed-list.html +265 -0
- package/native/etc/docroot/bangzhu/examples/info.html +119 -0
- package/native/etc/docroot/bangzhu/examples/input.html +108 -0
- package/native/etc/docroot/bangzhu/examples/lazyload-image.html +73 -0
- package/native/etc/docroot/bangzhu/examples/list-triplex-row.html +115 -0
- package/native/etc/docroot/bangzhu/examples/list-with-input.html +91 -0
- package/native/etc/docroot/bangzhu/examples/locker-dom.html +85 -0
- package/native/etc/docroot/bangzhu/examples/login.html +83 -0
- package/native/etc/docroot/bangzhu/examples/media-list.html +220 -0
- package/native/etc/docroot/bangzhu/examples/message-bottom.html +87 -0
- package/native/etc/docroot/bangzhu/examples/modals.html +45 -0
- package/native/etc/docroot/bangzhu/examples/nav-nativeObj.html +45 -0
- package/native/etc/docroot/bangzhu/examples/nav.html +135 -0
- package/native/etc/docroot/bangzhu/examples/nav_transparent.html +127 -0
- package/native/etc/docroot/bangzhu/examples/nav_transparent_native.html +121 -0
- package/native/etc/docroot/bangzhu/examples/numbox.html +114 -0
- package/native/etc/docroot/bangzhu/examples/offcanvas-drag-down.html +384 -0
- package/native/etc/docroot/bangzhu/examples/offcanvas-drag-left-plus-main.html +293 -0
- package/native/etc/docroot/bangzhu/examples/offcanvas-drag-left-plus-menu.html +102 -0
- package/native/etc/docroot/bangzhu/examples/offcanvas-drag-left.html +228 -0
- package/native/etc/docroot/bangzhu/examples/offcanvas-drag-right-plus-main.html +292 -0
- package/native/etc/docroot/bangzhu/examples/offcanvas-drag-right-plus-menu.html +111 -0
- package/native/etc/docroot/bangzhu/examples/offcanvas-drag-right.html +220 -0
- package/native/etc/docroot/bangzhu/examples/pagination.html +236 -0
- package/native/etc/docroot/bangzhu/examples/picker.html +159 -0
- package/native/etc/docroot/bangzhu/examples/popovers.html +200 -0
- package/native/etc/docroot/bangzhu/examples/progressbar.html +171 -0
- package/native/etc/docroot/bangzhu/examples/pullrefresh.html +86 -0
- package/native/etc/docroot/bangzhu/examples/pullrefresh_main.html +46 -0
- package/native/etc/docroot/bangzhu/examples/pullrefresh_sub.html +101 -0
- package/native/etc/docroot/bangzhu/examples/pullrefresh_with_tab.html +586 -0
- package/native/etc/docroot/bangzhu/examples/radio.html +93 -0
- package/native/etc/docroot/bangzhu/examples/range.html +89 -0
- package/native/etc/docroot/bangzhu/examples/setting.html +910 -0
- package/native/etc/docroot/bangzhu/examples/slider-default.html +98 -0
- package/native/etc/docroot/bangzhu/examples/slider-native.html +43 -0
- package/native/etc/docroot/bangzhu/examples/slider-table-default.html +62 -0
- package/native/etc/docroot/bangzhu/examples/slider-table-pagination.html +74 -0
- package/native/etc/docroot/bangzhu/examples/slider-with-title.html +99 -0
- package/native/etc/docroot/bangzhu/examples/switches.html +92 -0
- package/native/etc/docroot/bangzhu/examples/tab-top-subpage-1.html +131 -0
- package/native/etc/docroot/bangzhu/examples/tab-top-subpage-2.html +131 -0
- package/native/etc/docroot/bangzhu/examples/tab-top-subpage-3.html +56 -0
- package/native/etc/docroot/bangzhu/examples/tab-top-subpage-4.html +110 -0
- package/native/etc/docroot/bangzhu/examples/tab-top-subpage-5.html +131 -0
- package/native/etc/docroot/bangzhu/examples/tab-top-webview-main.html +183 -0
- package/native/etc/docroot/bangzhu/examples/tab-vertical-scroll.html +170 -0
- package/native/etc/docroot/bangzhu/examples/tab-webview-main.html +112 -0
- package/native/etc/docroot/bangzhu/examples/tab-webview-subpage-about.html +38 -0
- package/native/etc/docroot/bangzhu/examples/tab-webview-subpage-chat.html +127 -0
- package/native/etc/docroot/bangzhu/examples/tab-webview-subpage-contact.html +155 -0
- package/native/etc/docroot/bangzhu/examples/tab-webview-subpage-setting.html +79 -0
- package/native/etc/docroot/bangzhu/examples/tab-with-segmented-control-vertical.html +85 -0
- package/native/etc/docroot/bangzhu/examples/tab-with-segmented-control.html +195 -0
- package/native/etc/docroot/bangzhu/examples/tab-with-viewpagerindicator.html +203 -0
- package/native/etc/docroot/bangzhu/examples/tabbar-labels-only.html +44 -0
- package/native/etc/docroot/bangzhu/examples/tabbar-with-submenus.html +75 -0
- package/native/etc/docroot/bangzhu/examples/tabbar.html +247 -0
- package/native/etc/docroot/bangzhu/examples/tableviews-with-badges.html +78 -0
- package/native/etc/docroot/bangzhu/examples/tableviews-with-collapses.html +83 -0
- package/native/etc/docroot/bangzhu/examples/tableviews-with-swipe.html +184 -0
- package/native/etc/docroot/bangzhu/examples/tableviews.html +87 -0
- package/native/etc/docroot/bangzhu/examples/typography.html +41 -0
- package/native/etc/docroot/bangzhu/fonts/mui-icons-extra.ttf +0 -0
- package/native/etc/docroot/bangzhu/fonts/mui.ttf +0 -0
- package/native/etc/docroot/bangzhu/images/60x60.gif +0 -0
- package/native/etc/docroot/bangzhu/images/cbd.jpg +0 -0
- package/native/etc/docroot/bangzhu/images/login-1.png +0 -0
- package/native/etc/docroot/bangzhu/images/logo.png +0 -0
- package/native/etc/docroot/bangzhu/images/muwu.jpg +0 -0
- package/native/etc/docroot/bangzhu/images/qrcode.png +0 -0
- package/native/etc/docroot/bangzhu/images/shuijiao.jpg +0 -0
- package/native/etc/docroot/bangzhu/images/yuantiao.jpg +0 -0
- package/native/etc/docroot/bangzhu/index-menu.html +196 -0
- package/native/etc/docroot/bangzhu/index.html +414 -0
- package/native/etc/docroot/bangzhu/js/95516.js +32 -0
- package/native/etc/docroot/bangzhu/js/arttmpl.js +2 -0
- package/native/etc/docroot/bangzhu/js/beecloud.js +141 -0
- package/native/etc/docroot/bangzhu/js/city.data-3.js +11548 -0
- package/native/etc/docroot/bangzhu/js/city.data.js +1605 -0
- package/native/etc/docroot/bangzhu/js/feedback.js +234 -0
- package/native/etc/docroot/bangzhu/js/mui.dtpicker.js +471 -0
- package/native/etc/docroot/bangzhu/js/mui.imageViewer.js +268 -0
- package/native/etc/docroot/bangzhu/js/mui.indexedlist.js +187 -0
- package/native/etc/docroot/bangzhu/js/mui.js +8390 -0
- package/native/etc/docroot/bangzhu/js/mui.lazyload.img.js +116 -0
- package/native/etc/docroot/bangzhu/js/mui.lazyload.js +327 -0
- package/native/etc/docroot/bangzhu/js/mui.listpicker.js +399 -0
- package/native/etc/docroot/bangzhu/js/mui.locker.js +303 -0
- package/native/etc/docroot/bangzhu/js/mui.min.js +6 -0
- package/native/etc/docroot/bangzhu/js/mui.picker.all.js +1018 -0
- package/native/etc/docroot/bangzhu/js/mui.picker.js +389 -0
- package/native/etc/docroot/bangzhu/js/mui.picker.min.js +7 -0
- package/native/etc/docroot/bangzhu/js/mui.poppicker.js +160 -0
- package/native/etc/docroot/bangzhu/js/mui.previewimage.js +382 -0
- package/native/etc/docroot/bangzhu/js/mui.pullToRefresh.js +407 -0
- package/native/etc/docroot/bangzhu/js/mui.pullToRefresh.material.js +352 -0
- package/native/etc/docroot/bangzhu/js/mui.view.js +628 -0
- package/native/etc/docroot/bangzhu/js/mui.zoom.js +322 -0
- package/native/etc/docroot/bangzhu/js/update.js +45 -0
- package/native/etc/docroot/bangzhu/js/webviewGroup.js +286 -0
- package/native/etc/docroot/bangzhu/libs/echarts-all.js +35 -0
- package/native/etc/docroot/bangzhu/manifest.json +994 -0
- package/native/etc/docroot/index.html +1 -0
- package/native/etc/docroot/luyin2/index.html +145 -0
- package/native/etc/docroot/luyin2/js/jquery-1.10.1.min.js +6 -0
- package/native/etc/docroot/luyin2/js/jquery-1.5.min.js +16 -0
- package/native/etc/docroot/luyin2/js/jquery.js +18 -0
- package/native/etc/docroot/luyin2/js/jquery.multiselect.js +104 -0
- package/native/etc/docroot/luyin2/js/lame.min.js +308 -0
- package/native/etc/docroot/luyin2/js/recordmp3.js +239 -0
- package/native/etc/docroot/luyin2/js/worker-realtime.js +106 -0
- package/native/etc/docroot/luyin2//346/223/215/344/275/234/346/214/207/345/215/227.txt +3 -0
- package/native/etc/docroot/static/css/app.8421a6d597ba48619941ccd4e386fbb2.css +675 -0
- package/native/etc/docroot/static/css/app.8421a6d597ba48619941ccd4e386fbb2.css.map +1 -0
- package/native/etc/docroot/static/fonts/element-icons.535877f.woff +0 -0
- package/native/etc/docroot/static/fonts/element-icons.732389d.ttf +0 -0
- package/native/etc/docroot/static/img/login_bg.ad6b482.jpg +0 -0
- package/native/etc/docroot/static/js/app.eff1c2200a448936b027.js +2 -0
- package/native/etc/docroot/static/js/app.eff1c2200a448936b027.js.map +1 -0
- package/native/etc/docroot/static/js/manifest.400eada2d24447a4fc30.js +2 -0
- package/native/etc/docroot/static/js/manifest.400eada2d24447a4fc30.js.map +1 -0
- package/native/etc/docroot/static/js/vendor.ca4f735ec1dfe336a804.js +45 -0
- package/native/etc/docroot/static/js/vendor.ca4f735ec1dfe336a804.js.map +1 -0
- package/native/etc/docroot/tts.js +151 -0
- package/native/etc/docroot/xcx/Discover.html +156 -0
- package/native/etc/docroot/xcx/css/mui.css +5649 -0
- package/native/etc/docroot/xcx/css/mui.min.css +5 -0
- package/native/etc/docroot/xcx/devicelist.html +659 -0
- package/native/etc/docroot/xcx/fonts/mui.ttf +0 -0
- package/native/etc/docroot/xcx/index.html +75 -0
- package/native/etc/docroot/xcx/index.js +1 -0
- package/native/etc/docroot/xcx/js/axios.min.js +3 -0
- package/native/etc/docroot/xcx/js/axios.min.map +1 -0
- package/native/etc/docroot/xcx/js/js.cookie.js +8 -0
- package/native/etc/docroot/xcx/js/mui.js +8390 -0
- package/native/etc/docroot/xcx/js/mui.min.js +6 -0
- package/native/etc/docroot/xcx/main.html +85 -0
- package/native/etc/ssl/README.txt +5 -0
- package/native/etc/ssl/ca.crt +21 -0
- package/native/etc/ssl/ca.key +27 -0
- package/native/etc/ssl/client.crt +20 -0
- package/native/etc/ssl/client.key +28 -0
- package/native/etc/ssl/client.p12 +0 -0
- package/native/etc/ssl/server.crt +20 -0
- package/native/etc/ssl/server.key +28 -0
- package/native/etc/templates/demo-de.tpl +12 -0
- package/native/etc/templates/demo.tpl +12 -0
- package/native/etc/ttys/adore03.sql +426 -0
- package/native/etc/ttys/adore04.sql +426 -0
- package/native/etc/ttys/adore1.sql +859 -0
- package/native/etc/ttys/adore_mix22.sql +806 -0
- package/native/etc/ttys/sqlite.sql +1140 -0
- package/native/etc/ttys/sqlite3main.sql +434 -0
- package/native/etc/ttys/sqltest.sql +279 -0
- package/native/etc/ttys/tp3sql.sql +1412 -0
- package/native/find.js +529 -0
- package/native/findsc.js +701 -0
- package/native/iconengines/libqsvgicon.so +0 -0
- package/native/imageformats/libqgif.so +0 -0
- package/native/imageformats/libqico.so +0 -0
- package/native/imageformats/libqjpeg.so +0 -0
- package/native/imageformats/libqsvg.so +0 -0
- package/native/lib/libQt5Concurrent.so.5 +0 -0
- package/native/lib/libQt5Core.so.5 +0 -0
- package/native/lib/libQt5DBus.so.5 +0 -0
- package/native/lib/libQt5Multimedia.so.5 +0 -0
- package/native/lib/libQt5MultimediaGstTools.so.5 +0 -0
- package/native/lib/libQt5Network.so.5 +0 -0
- package/native/lib/libQt5Sql.so.5 +0 -0
- package/native/lib/libQt5Svg.so.5 +0 -0
- package/native/lib/libQt5WebSockets.so.5 +0 -0
- package/native/lib/libQt5Xml.so.5 +0 -0
- package/native/lib/libcrypto.so.3 +0 -0
- package/native/lib/libgcc_s.so.1 +0 -0
- package/native/lib/libmariadb.so.3 +0 -0
- package/native/lib/libmp3lame.so.0 +0 -0
- package/native/lib/libmp3lame.so.0.0.0 +0 -0
- package/native/lib/libopus.so.0 +0 -0
- package/native/lib/libopus.so.0.8.0 +0 -0
- package/native/lib/libopusfile.so.0 +0 -0
- package/native/lib/libopusfile.so.0.4.2 +0 -0
- package/native/lib/libopusurl.so.0 +0 -0
- package/native/lib/libopusurl.so.0.4.2 +0 -0
- package/native/lib/libsqlite3.so.0 +0 -0
- package/native/lib/libsqlite3.so.0.8.6 +0 -0
- package/native/lib/libssl.so.3 +0 -0
- package/native/lib/libstdc++.so.6 +0 -0
- package/native/lib/libstdc++.so.6.0.30 +0 -0
- package/native/mediaservice/libgstaudiodecoder.so +0 -0
- package/native/mediaservice/libgstcamerabin.so +0 -0
- package/native/mediaservice/libgstmediacapture.so +0 -0
- package/native/mediaservice/libgstmediaplayer.so +0 -0
- package/native/platforms/libqeglfs.so +0 -0
- package/native/platforms/libqlinuxfb.so +0 -0
- package/native/platforms/libqminimal.so +0 -0
- package/native/platforms/libqminimalegl.so +0 -0
- package/native/platforms/libqoffscreen.so +0 -0
- package/native/platforms/libqvnc.so +0 -0
- package/native/platforms/libqxcb.so +0 -0
- package/native/qt.conf +3 -0
- package/native/sqldrivers/libqsqlite.so +0 -0
- package/native/sqldrivers/libqsqlmysql.so +0 -0
- package/native/sqldrivers/libsqlitecipher.so +0 -0
- package/native/tts.js +151 -0
- package/package.json +23 -0
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <div id="app" class="mui-views">
|
|
3
|
+
<div class="mui-view">
|
|
4
|
+
<div class="mui-navbar">
|
|
5
|
+
</div>
|
|
6
|
+
<div class="mui-pages">
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
* @param {Object} $
|
|
11
|
+
* @param {Object} window
|
|
12
|
+
*/
|
|
13
|
+
(function($, window) {
|
|
14
|
+
var CLASS_LEFT = $.className('left');
|
|
15
|
+
var CLASS_CENTER = $.className('center');
|
|
16
|
+
var CLASS_RIGHT = $.className('right');
|
|
17
|
+
var CLASS_PAGE = $.className('page');
|
|
18
|
+
var CLASS_PAGE_LEFT = $.className('page-left');
|
|
19
|
+
var CLASS_PAGE_CENTER = $.className('page-center');
|
|
20
|
+
var CLASS_NAVBAR_LEFT = $.className('navbar-left');
|
|
21
|
+
var CLASS_NAVBAR_CENTER = $.className('navbar-center');
|
|
22
|
+
var CLASS_PAGE_SHADOW = $.className('page-shadow');
|
|
23
|
+
|
|
24
|
+
var CLASS_TRANSITIONING = $.className('transitioning');
|
|
25
|
+
|
|
26
|
+
var SELECTOR_LEFT = '.' + CLASS_LEFT;
|
|
27
|
+
var SELECTOR_CENTER = '.' + CLASS_CENTER;
|
|
28
|
+
var SELECTOR_RIGHT = '.' + CLASS_RIGHT;
|
|
29
|
+
|
|
30
|
+
var SELECTOR_ICON = $.classSelector('.icon');
|
|
31
|
+
var SELECTOR_NAVBAR = $.classSelector('.navbar');
|
|
32
|
+
var SELECTOR_NAVBAR_INNER = $.classSelector('.navbar-inner');
|
|
33
|
+
var SELECTOR_PAGES = $.classSelector('.pages');
|
|
34
|
+
var SELECTOR_BTN_NAV = $.classSelector('.btn-nav');
|
|
35
|
+
var SELECTOR_PAGE_LEFT = '.' + CLASS_PAGE_LEFT;
|
|
36
|
+
var SELECTOR_PAGE_CENTER = '.' + CLASS_PAGE_CENTER;
|
|
37
|
+
var SELECTOR_NAVBAR_LEFT = '.' + CLASS_NAVBAR_LEFT;
|
|
38
|
+
var SELECTOR_NAVBAR_CENTER = '.' + CLASS_NAVBAR_CENTER;
|
|
39
|
+
|
|
40
|
+
var View = $.Class.extend({
|
|
41
|
+
init: function(element, options) {
|
|
42
|
+
this.view = this.element = element;
|
|
43
|
+
this.options = $.extend({
|
|
44
|
+
animateNavbar: 'ios', //ios
|
|
45
|
+
swipeBackPageActiveArea: 30,
|
|
46
|
+
hardwareAccelerated: true
|
|
47
|
+
}, options);
|
|
48
|
+
this.navbars = this.view.querySelector(SELECTOR_NAVBAR);
|
|
49
|
+
this.pages = this.view.querySelector(SELECTOR_PAGES);
|
|
50
|
+
|
|
51
|
+
this.history = []; //history
|
|
52
|
+
|
|
53
|
+
this.maxScrollX = this.view.offsetWidth;
|
|
54
|
+
this.x = this.y = 0;
|
|
55
|
+
this.translateZ = this.options.hardwareAccelerated ? ' translateZ(0)' : '';
|
|
56
|
+
this.ratio = 0;
|
|
57
|
+
this.isBack = true;
|
|
58
|
+
this.moved = this.dragging = false;
|
|
59
|
+
|
|
60
|
+
this.activeNavbar = this.previousNavbar = null;
|
|
61
|
+
this.activePage = this.previousPage = null;
|
|
62
|
+
|
|
63
|
+
this._initPageEventMethod();
|
|
64
|
+
|
|
65
|
+
this._initDefaultPage();
|
|
66
|
+
|
|
67
|
+
this.navbars && this._initNavBar();
|
|
68
|
+
|
|
69
|
+
this.initEvent();
|
|
70
|
+
},
|
|
71
|
+
_initPageEventMethod: function() {
|
|
72
|
+
var self = this;
|
|
73
|
+
$.each(['onPageBeforeShow', 'onPageShow', 'onPageBeforeBack', 'onPageBack'], function(index, event) {
|
|
74
|
+
self[event + 'Callbacks'] = {};
|
|
75
|
+
self[event] = function(page, callback) {
|
|
76
|
+
var eventCallbacks = event + 'Callbacks';
|
|
77
|
+
if (!self[eventCallbacks].hasOwnProperty(page)) {
|
|
78
|
+
self[eventCallbacks][page] = [callback];
|
|
79
|
+
} else {
|
|
80
|
+
self[eventCallbacks][page].push(callback);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
_initDefaultPage: function() {
|
|
86
|
+
var defaultPage = document.querySelector(this.options.defaultPage);
|
|
87
|
+
if (defaultPage) {
|
|
88
|
+
this._appendPage(defaultPage);
|
|
89
|
+
} else {
|
|
90
|
+
throw new Error('defaultPage[' + this.options.defaultPage + '] does not exist');
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
initEvent: function() {
|
|
94
|
+
this.view.addEventListener('click', this);
|
|
95
|
+
this.view.addEventListener('tap', this);
|
|
96
|
+
this.pages.addEventListener('drag', this);
|
|
97
|
+
this.pages.addEventListener('dragend', this);
|
|
98
|
+
this.pages.addEventListener('webkitTransitionEnd', this);
|
|
99
|
+
},
|
|
100
|
+
handleEvent: function(event) {
|
|
101
|
+
switch (event.type) {
|
|
102
|
+
case 'click':
|
|
103
|
+
this._click(event);
|
|
104
|
+
break;
|
|
105
|
+
case 'tap':
|
|
106
|
+
this._tap(event);
|
|
107
|
+
break;
|
|
108
|
+
case 'drag':
|
|
109
|
+
this._drag(event);
|
|
110
|
+
break;
|
|
111
|
+
case 'dragend':
|
|
112
|
+
this._dragend(event);
|
|
113
|
+
break;
|
|
114
|
+
case 'webkitTransitionEnd':
|
|
115
|
+
this._webkitTransitionEnd(event);
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
shadow: function() {
|
|
120
|
+
var shadow = document.createElement('div');
|
|
121
|
+
shadow.className = CLASS_PAGE_SHADOW;
|
|
122
|
+
return shadow;
|
|
123
|
+
}(),
|
|
124
|
+
_removePage: function(page, navbar) {
|
|
125
|
+
navbar && this._removeNavbar(page, navbar);
|
|
126
|
+
document.body.appendChild(page);
|
|
127
|
+
this._cleanPageClass(page);
|
|
128
|
+
},
|
|
129
|
+
_prependPage: function(page) {
|
|
130
|
+
var navbar = page.querySelector(SELECTOR_NAVBAR_INNER);
|
|
131
|
+
navbar && this._prependNavbar(navbar);
|
|
132
|
+
page.classList.add(CLASS_PAGE_LEFT);
|
|
133
|
+
this.pages.insertBefore(page, this.pages.firstElementChild);
|
|
134
|
+
},
|
|
135
|
+
_appendPage: function(page) {
|
|
136
|
+
var navbar = page.querySelector(SELECTOR_NAVBAR_INNER);
|
|
137
|
+
navbar && this._appendNavbar(navbar);
|
|
138
|
+
page.classList.add(CLASS_PAGE_CENTER);
|
|
139
|
+
this.pages.appendChild(page);
|
|
140
|
+
},
|
|
141
|
+
_removeNavbar: function(page, navbar) {
|
|
142
|
+
page.insertBefore(navbar, page.firstElementChild);
|
|
143
|
+
this._cleanNavbarClass(navbar);
|
|
144
|
+
},
|
|
145
|
+
_prependNavbar: function(navbar) {
|
|
146
|
+
navbar.classList.add(CLASS_NAVBAR_LEFT);
|
|
147
|
+
this.navbars.insertBefore(navbar, this.navbars.firstElementChild);
|
|
148
|
+
},
|
|
149
|
+
_appendNavbar: function(navbar) {
|
|
150
|
+
navbar.classList.add(CLASS_NAVBAR_CENTER);
|
|
151
|
+
this.navbars.appendChild(navbar);
|
|
152
|
+
},
|
|
153
|
+
_cleanPageClass: function(page) {
|
|
154
|
+
page.classList.remove(CLASS_PAGE_CENTER);
|
|
155
|
+
page.classList.remove(CLASS_PAGE_LEFT);
|
|
156
|
+
},
|
|
157
|
+
_cleanNavbarClass: function(navbar) {
|
|
158
|
+
navbar.classList.remove(CLASS_NAVBAR_CENTER);
|
|
159
|
+
navbar.classList.remove(CLASS_NAVBAR_LEFT);
|
|
160
|
+
},
|
|
161
|
+
_tap: function(event) {
|
|
162
|
+
var target = event.target;
|
|
163
|
+
for (; target && target !== document; target = target.parentNode) {
|
|
164
|
+
if (target.tagName === 'A' && target.hash) {
|
|
165
|
+
var page = document.getElementById(target.hash.replace('#', ''));
|
|
166
|
+
if (page && page.classList.contains(CLASS_PAGE)) {
|
|
167
|
+
event.stopPropagation();
|
|
168
|
+
event.detail.gesture.preventDefault();
|
|
169
|
+
this.go(target.hash);
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
_click: function(event) {
|
|
176
|
+
var target = event.target;
|
|
177
|
+
for (; target && target !== document; target = target.parentNode) {
|
|
178
|
+
if (target.tagName === 'A' && target.hash) {
|
|
179
|
+
var page = document.getElementById(target.hash.replace('#', ''));
|
|
180
|
+
if (page && page.classList.contains(CLASS_PAGE)) {
|
|
181
|
+
event.preventDefault();
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
_cleanStyle: function(el) {
|
|
188
|
+
if (el) {
|
|
189
|
+
el.style.webkitTransform = '';
|
|
190
|
+
el.style.opacity = '';
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
_isAnimateNavbarIOS: function() {
|
|
194
|
+
return !$.os.android && this.options.animateNavbar === 'ios';
|
|
195
|
+
},
|
|
196
|
+
_webkitTransitionEnd: function(event) {
|
|
197
|
+
this.dragging = this.moved = false;
|
|
198
|
+
if (this.activePage !== event.target) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
this.isInTransition = false;
|
|
203
|
+
|
|
204
|
+
this.shadow.parentNode === this.activePage && this.activePage.removeChild(this.shadow);
|
|
205
|
+
this.previousPageClassList.remove(CLASS_TRANSITIONING);
|
|
206
|
+
this.activePageClassList.remove(CLASS_TRANSITIONING);
|
|
207
|
+
|
|
208
|
+
var self = this;
|
|
209
|
+
if (this._isAnimateNavbarIOS() && this.previousNavElements && this.activeNavElements) {
|
|
210
|
+
var isBack = this.isBack;
|
|
211
|
+
$.each(this.previousNavElements, function(i, el) {
|
|
212
|
+
el.classList.remove(CLASS_TRANSITIONING);
|
|
213
|
+
isBack && self._cleanStyle(el);
|
|
214
|
+
});
|
|
215
|
+
$.each(this.activeNavElements, function(i, el) {
|
|
216
|
+
el.classList.remove(CLASS_TRANSITIONING);
|
|
217
|
+
self._cleanStyle(el);
|
|
218
|
+
});
|
|
219
|
+
if (this.previousNavBackIcon) {
|
|
220
|
+
this.previousNavBackIcon.classList.remove(CLASS_TRANSITIONING);
|
|
221
|
+
isBack && this._cleanStyle(this.previousNavBackIcon);
|
|
222
|
+
}
|
|
223
|
+
if (this.activeNavBackIcon) {
|
|
224
|
+
this.activeNavBackIcon.classList.remove(CLASS_TRANSITIONING);
|
|
225
|
+
this._cleanStyle(this.activeNavBackIcon);
|
|
226
|
+
}
|
|
227
|
+
} else {
|
|
228
|
+
this.previousNavbar && this.previousNavbar.classList.remove(CLASS_TRANSITIONING);
|
|
229
|
+
this.activeNavbar && this.activeNavbar.classList.remove(CLASS_TRANSITIONING);
|
|
230
|
+
this._cleanStyle(this.previousNavbar);
|
|
231
|
+
this._cleanStyle(this.activeNavbar);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
this._cleanStyle(this.previousPage);
|
|
235
|
+
this._cleanStyle(this.activePage);
|
|
236
|
+
|
|
237
|
+
if (this.ratio <= 0.5) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if (this.isBack) {
|
|
241
|
+
this._removePage(this.activePage, this.activeNavbar);
|
|
242
|
+
this.previousPageClassList.remove(CLASS_PAGE_LEFT);
|
|
243
|
+
this.previousPageClassList.add(CLASS_PAGE_CENTER);
|
|
244
|
+
if (this.previousNavbar) {
|
|
245
|
+
this.previousNavbar.classList.remove(CLASS_NAVBAR_LEFT);
|
|
246
|
+
this.previousNavbar.classList.add(CLASS_NAVBAR_CENTER);
|
|
247
|
+
}
|
|
248
|
+
if (this.history.length > 0) {
|
|
249
|
+
this._prependPage(this.history.pop());
|
|
250
|
+
}
|
|
251
|
+
this.navbars && this._initNavBar();
|
|
252
|
+
this._trigger('pageBack', this.activePage);
|
|
253
|
+
this._trigger('pageShow', this.previousPage);
|
|
254
|
+
} else {
|
|
255
|
+
this.previousPageClassList.add(CLASS_PAGE_LEFT);
|
|
256
|
+
this.activePageClassList.add(CLASS_PAGE_CENTER);
|
|
257
|
+
this._trigger('pageShow', this.activePage);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
},
|
|
262
|
+
_trigger: function(eventType, page) {
|
|
263
|
+
var eventCallbacks = 'on' + eventType.charAt(0).toUpperCase() + eventType.slice(1) + 'Callbacks';
|
|
264
|
+
if (this[eventCallbacks].hasOwnProperty(page.id)) {
|
|
265
|
+
var callbacks = this[eventCallbacks][page.id];
|
|
266
|
+
var event = new CustomEvent(eventType, {
|
|
267
|
+
detail: {
|
|
268
|
+
page: page
|
|
269
|
+
},
|
|
270
|
+
bubbles: true,
|
|
271
|
+
cancelable: true
|
|
272
|
+
});
|
|
273
|
+
for (var len = callbacks.length; len--;) {
|
|
274
|
+
callbacks[len].call(this, event);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
$.trigger(this.view, eventType, {
|
|
278
|
+
page: page
|
|
279
|
+
});
|
|
280
|
+
},
|
|
281
|
+
_initPageTransform: function() {
|
|
282
|
+
this.previousPage = this.pages.querySelector(SELECTOR_PAGE_LEFT);
|
|
283
|
+
this.activePage = this.pages.querySelector(SELECTOR_PAGE_CENTER);
|
|
284
|
+
if (this.previousPage && this.activePage) {
|
|
285
|
+
this.activePage.appendChild(this.shadow);
|
|
286
|
+
this.previousPageClassList = this.previousPage.classList;
|
|
287
|
+
this.activePageClassList = this.activePage.classList;
|
|
288
|
+
|
|
289
|
+
this.previousPageStyle = this.previousPage.style;
|
|
290
|
+
this.activePageStyle = this.activePage.style;
|
|
291
|
+
|
|
292
|
+
this.previousPageClassList.remove(CLASS_TRANSITIONING);
|
|
293
|
+
this.activePageClassList.remove(CLASS_TRANSITIONING);
|
|
294
|
+
|
|
295
|
+
if (this.navbars) {
|
|
296
|
+
this.previousNavbar = this.navbars.querySelector(SELECTOR_NAVBAR_LEFT);
|
|
297
|
+
this.activeNavbar = this.navbars.querySelector(SELECTOR_NAVBAR_CENTER);
|
|
298
|
+
if (this._isAnimateNavbarIOS() && this.previousNavbar && this.activeNavbar) {
|
|
299
|
+
this.previousNavElements = this.previousNavbar.querySelectorAll(SELECTOR_LEFT + ',' + SELECTOR_CENTER + ',' + SELECTOR_RIGHT);
|
|
300
|
+
this.activeNavElements = this.activeNavbar.querySelectorAll(SELECTOR_LEFT + ',' + SELECTOR_CENTER + ',' + SELECTOR_RIGHT);
|
|
301
|
+
this.previousNavBackIcon = this.previousNavbar.querySelector(SELECTOR_LEFT + SELECTOR_BTN_NAV + ' ' + SELECTOR_ICON);
|
|
302
|
+
this.activeNavBackIcon = this.activeNavbar.querySelector(SELECTOR_LEFT + SELECTOR_BTN_NAV + ' ' + SELECTOR_ICON);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
this.x = 0;
|
|
306
|
+
this.dragging = true;
|
|
307
|
+
return true;
|
|
308
|
+
}
|
|
309
|
+
return false;
|
|
310
|
+
},
|
|
311
|
+
_initNavBar: function() {
|
|
312
|
+
if (this._isAnimateNavbarIOS() && this.navbars) {
|
|
313
|
+
var inners = this.navbars.querySelectorAll(SELECTOR_NAVBAR_INNER);
|
|
314
|
+
var inner, left, right, center, leftWidth, rightWidth, centerWidth, noLeft, onRight, currLeft, diff, navbarWidth;
|
|
315
|
+
for (var i = 0, len = inners.length; i < len; i++) {
|
|
316
|
+
inner = inners[i];
|
|
317
|
+
left = inner.querySelector(SELECTOR_LEFT);
|
|
318
|
+
right = inner.querySelector(SELECTOR_RIGHT);
|
|
319
|
+
center = inner.querySelector(SELECTOR_CENTER);
|
|
320
|
+
noLeft = !left;
|
|
321
|
+
noRight = !right;
|
|
322
|
+
leftWidth = noLeft ? 0 : left.offsetWidth;
|
|
323
|
+
rightWidth = noRight ? 0 : right.offsetWidth;
|
|
324
|
+
centerWidth = center ? center.offsetWidth : 0;
|
|
325
|
+
navbarWidth = this.maxScrollX;
|
|
326
|
+
onLeft = inner.classList.contains('navbar-left');
|
|
327
|
+
if (noRight) {
|
|
328
|
+
currLeft = navbarWidth - centerWidth;
|
|
329
|
+
}
|
|
330
|
+
if (noLeft) {
|
|
331
|
+
currLeft = 0;
|
|
332
|
+
}
|
|
333
|
+
if (!noLeft && !noRight) {
|
|
334
|
+
currLeft = (navbarWidth - rightWidth - centerWidth + leftWidth) / 2;
|
|
335
|
+
}
|
|
336
|
+
var requiredLeft = (navbarWidth - centerWidth) / 2;
|
|
337
|
+
if (navbarWidth - leftWidth - rightWidth > centerWidth) {
|
|
338
|
+
if (requiredLeft < leftWidth) {
|
|
339
|
+
requiredLeft = leftWidth;
|
|
340
|
+
}
|
|
341
|
+
if (requiredLeft + centerWidth > navbarWidth - rightWidth) {
|
|
342
|
+
requiredLeft = navbarWidth - rightWidth - centerWidth;
|
|
343
|
+
}
|
|
344
|
+
diff = requiredLeft - currLeft;
|
|
345
|
+
} else {
|
|
346
|
+
diff = 0;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
var centerLeft = diff;
|
|
350
|
+
if (center) {
|
|
351
|
+
center.style.marginLeft = -leftWidth + 'px';
|
|
352
|
+
center.mNavbarLeftOffset = -(currLeft + diff) + 30; //这个30是测出来的。后续要实际计算一下
|
|
353
|
+
center.mNavbarRightOffset = navbarWidth - currLeft - diff - centerWidth;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
if (onLeft) center.style.webkitTransform = ('translate3d(' + center.mNavbarLeftOffset + 'px, 0, 0)');
|
|
357
|
+
|
|
358
|
+
if (!noLeft) {
|
|
359
|
+
left.mNavbarLeftOffset = -leftWidth;
|
|
360
|
+
left.mNavbarRightOffset = (navbarWidth - leftWidth) / 2;
|
|
361
|
+
if (onLeft) left.style.webkitTransform = ('translate3d(' + left[0].mNavbarLeftOffset + 'px, 0, 0)');
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
if (!noRight) {
|
|
365
|
+
right.mNavbarLeftOffset = -(navbarWidth - rightWidth) / 2;
|
|
366
|
+
right.mNavbarRightOffset = rightWidth;
|
|
367
|
+
if (onLeft) right.style.webkitTransform = ('translate3d(' + right[0].mNavbarLeftOffset + 'px, 0, 0)');
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
_drag: function(event) {
|
|
374
|
+
if (this.isInTransition) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
var detail = event.detail;
|
|
378
|
+
if (!this.dragging) {
|
|
379
|
+
if (($.gestures.session.firstTouch.center.x - this.view.offsetLeft) < this.options.swipeBackPageActiveArea) {
|
|
380
|
+
this.isBack = true;
|
|
381
|
+
this._initPageTransform();
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (this.dragging) {
|
|
385
|
+
var deltaX = 0;
|
|
386
|
+
if (!this.moved) { //start
|
|
387
|
+
deltaX = detail.deltaX;
|
|
388
|
+
$.gestures.session.lockDirection = true; //锁定方向
|
|
389
|
+
$.gestures.session.startDirection = detail.direction;
|
|
390
|
+
} else { //move
|
|
391
|
+
deltaX = detail.deltaX - ($.gestures.session.prevTouch && $.gestures.session.prevTouch.deltaX || 0);
|
|
392
|
+
}
|
|
393
|
+
var newX = this.x + deltaX;
|
|
394
|
+
if (newX < 0 || newX > this.maxScrollX) {
|
|
395
|
+
newX = newX < 0 ? 0 : this.maxScrollX;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
event.stopPropagation();
|
|
399
|
+
detail.gesture.preventDefault();
|
|
400
|
+
|
|
401
|
+
if (!this.requestAnimationFrame) {
|
|
402
|
+
this._updateTranslate();
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
this.moved = true;
|
|
406
|
+
this.x = newX;
|
|
407
|
+
this.y = 0;
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
_dragend: function(event) {
|
|
411
|
+
if (!this.moved) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
event.stopPropagation();
|
|
416
|
+
|
|
417
|
+
var detail = event.detail;
|
|
418
|
+
|
|
419
|
+
this._clearRequestAnimationFrame();
|
|
420
|
+
|
|
421
|
+
this._prepareTransition();
|
|
422
|
+
|
|
423
|
+
this.ratio = this.x / this.maxScrollX;
|
|
424
|
+
if (this.ratio === 1 || this.ratio === 0) {
|
|
425
|
+
$.trigger(this.activePage, 'webkitTransitionEnd');
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
if (this.ratio > 0.5) {
|
|
429
|
+
this.setTranslate(this.maxScrollX, 0);
|
|
430
|
+
} else {
|
|
431
|
+
this._cleanStyle(this.previousPage);
|
|
432
|
+
this._cleanStyle(this.activePage);
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
_prepareTransition: function() {
|
|
436
|
+
this.isInTransition = true;
|
|
437
|
+
this.previousPageClassList.add(CLASS_TRANSITIONING);
|
|
438
|
+
this.activePageClassList.add(CLASS_TRANSITIONING);
|
|
439
|
+
var self = this;
|
|
440
|
+
if (this.previousNavbar && this.activeNavbar) {
|
|
441
|
+
this.previousNavbar.classList.add(CLASS_TRANSITIONING);
|
|
442
|
+
this.activeNavbar.classList.add(CLASS_TRANSITIONING);
|
|
443
|
+
if (this._isAnimateNavbarIOS() && this.previousNavElements && this.activeNavElements) {
|
|
444
|
+
$.each(this.previousNavElements, function(i, el) {
|
|
445
|
+
el.classList.add(CLASS_TRANSITIONING);
|
|
446
|
+
self._cleanStyle(el);
|
|
447
|
+
});
|
|
448
|
+
$.each(this.activeNavElements, function(i, el) {
|
|
449
|
+
el.classList.add(CLASS_TRANSITIONING);
|
|
450
|
+
self._cleanStyle(el);
|
|
451
|
+
});
|
|
452
|
+
if (this.previousNavBackIcon) {
|
|
453
|
+
this._cleanStyle(this.previousNavBackIcon);
|
|
454
|
+
this.previousNavBackIcon.classList.add(CLASS_TRANSITIONING);
|
|
455
|
+
}
|
|
456
|
+
if (this.activeNavBackIcon) {
|
|
457
|
+
this._cleanStyle(this.activeNavBackIcon);
|
|
458
|
+
this.activeNavBackIcon.classList.add(CLASS_TRANSITIONING);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
_clearRequestAnimationFrame: function() {
|
|
464
|
+
if (this.requestAnimationFrame) {
|
|
465
|
+
cancelAnimationFrame(this.requestAnimationFrame);
|
|
466
|
+
this.requestAnimationFrame = null;
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
_getTranslateStr: function(x, y) {
|
|
470
|
+
if (this.options.hardwareAccelerated) {
|
|
471
|
+
return 'translate3d(' + x + 'px,' + y + 'px,0px) ' + this.translateZ;
|
|
472
|
+
}
|
|
473
|
+
return 'translate(' + x + 'px,' + y + 'px) ';
|
|
474
|
+
},
|
|
475
|
+
|
|
476
|
+
_updateTranslate: function() {
|
|
477
|
+
var self = this;
|
|
478
|
+
if (self.x !== self.lastX || self.y !== self.lastY) {
|
|
479
|
+
self.setTranslate(self.x, self.y);
|
|
480
|
+
}
|
|
481
|
+
self.requestAnimationFrame = requestAnimationFrame(function() {
|
|
482
|
+
self._updateTranslate();
|
|
483
|
+
});
|
|
484
|
+
},
|
|
485
|
+
_setNavbarTranslate: function(x, y) {
|
|
486
|
+
var percentage = x / this.maxScrollX;
|
|
487
|
+
//only for ios
|
|
488
|
+
if (this._isAnimateNavbarIOS()) {
|
|
489
|
+
if (this.previousNavElements && this.activeNavElements) {
|
|
490
|
+
this.animateNavbarByIOS(percentage);
|
|
491
|
+
}
|
|
492
|
+
} else { //pop-in
|
|
493
|
+
this.activeNavbar.style.opacity = 1 - percentage * 1.3;
|
|
494
|
+
this.previousNavbar.style.opacity = percentage * 1.3 - 0.3;
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
animateNavbarByIOS: function(percentage) {
|
|
498
|
+
var i, len, style, el;
|
|
499
|
+
for (i = 0, len = this.activeNavElements.length; i < len; i++) {
|
|
500
|
+
el = this.activeNavElements[i];
|
|
501
|
+
style = el.style;
|
|
502
|
+
style.opacity = (1 - percentage * (el.classList.contains(CLASS_LEFT) ? 3.5 : 1.3));
|
|
503
|
+
if (!el.classList.contains(CLASS_RIGHT)) {
|
|
504
|
+
var activeNavTranslate = percentage * el.mNavbarRightOffset;
|
|
505
|
+
el.style.webkitTransform = ('translate3d(' + activeNavTranslate + 'px,0,0)');
|
|
506
|
+
if (el.classList.contains(CLASS_LEFT) && this.activeNavBackIcon) {
|
|
507
|
+
this.activeNavBackIcon.style.webkitTransform = ('translate3d(' + -activeNavTranslate + 'px,0,0)');
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
for (i = 0, len = this.previousNavElements.length; i < len; i++) {
|
|
512
|
+
el = this.previousNavElements[i];
|
|
513
|
+
style = el.style;
|
|
514
|
+
style.opacity = percentage * 1.3 - 0.3;
|
|
515
|
+
if (!el.classList.contains(CLASS_RIGHT)) {
|
|
516
|
+
var previousNavTranslate = el.mNavbarLeftOffset * (1 - percentage);
|
|
517
|
+
el.style.webkitTransform = ('translate3d(' + previousNavTranslate + 'px,0,0)');
|
|
518
|
+
if (el.classList.contains(CLASS_LEFT) && this.previousNavBackIcon) {
|
|
519
|
+
this.previousNavBackIcon.style.webkitTransform = ('translate3d(' + -previousNavTranslate + 'px,0,0)');
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
setTranslate: function(x, y) {
|
|
525
|
+
this.x = x;
|
|
526
|
+
this.y = y;
|
|
527
|
+
this.previousPage.style.opacity = 0.9 + 0.1 * x / this.maxScrollX;
|
|
528
|
+
this.previousPage.style['webkitTransform'] = this._getTranslateStr((x / 6 - this.maxScrollX / 6), y);
|
|
529
|
+
this.activePage.style['webkitTransform'] = this._getTranslateStr(x, y);
|
|
530
|
+
|
|
531
|
+
this.navbars && this._setNavbarTranslate(x, y);
|
|
532
|
+
this.lastX = this.x;
|
|
533
|
+
this.lastY = this.y;
|
|
534
|
+
},
|
|
535
|
+
canBack: function() {
|
|
536
|
+
return this.pages.querySelector(SELECTOR_PAGE_LEFT);
|
|
537
|
+
},
|
|
538
|
+
back: function() {
|
|
539
|
+
if (this.isInTransition) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
this.isBack = true;
|
|
543
|
+
this.ratio = 1;
|
|
544
|
+
if (this._initPageTransform()) {
|
|
545
|
+
this._trigger('pageBeforeBack', this.activePage);
|
|
546
|
+
this._trigger('pageBeforeShow', this.previousPage);
|
|
547
|
+
this._prepareTransition();
|
|
548
|
+
this.previousPage.offsetHeight;
|
|
549
|
+
this.activePage.offsetHeight;
|
|
550
|
+
this.setTranslate(this.maxScrollX, 0);
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
go: function(pageSelector) {
|
|
554
|
+
if (this.isInTransition) {
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
var nextPage = document.querySelector(pageSelector);
|
|
558
|
+
|
|
559
|
+
if (nextPage) {
|
|
560
|
+
var previousPage = this.pages.querySelector(SELECTOR_PAGE_LEFT);
|
|
561
|
+
var activePage = this.pages.querySelector(SELECTOR_PAGE_CENTER);
|
|
562
|
+
var previousNavbar;
|
|
563
|
+
var activeNavbar;
|
|
564
|
+
if (this.navbars) {
|
|
565
|
+
previousNavbar = this.navbars.querySelector(SELECTOR_NAVBAR_LEFT);
|
|
566
|
+
activeNavbar = this.navbars.querySelector(SELECTOR_NAVBAR_CENTER);
|
|
567
|
+
}
|
|
568
|
+
if (activeNavbar) {
|
|
569
|
+
activeNavbar.classList.remove(CLASS_NAVBAR_CENTER);
|
|
570
|
+
activeNavbar.classList.add(CLASS_NAVBAR_LEFT);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
if (previousPage) {
|
|
574
|
+
this._removePage(previousPage, previousNavbar);
|
|
575
|
+
this.history.push(previousPage); //add to history
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
if (activePage) {
|
|
579
|
+
activePage.classList.remove(CLASS_PAGE_CENTER);
|
|
580
|
+
activePage.style.webkitTransform = 'translate3d(0,0,0)';
|
|
581
|
+
activePage.classList.add(CLASS_PAGE_LEFT);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
nextPage.style.webkitTransform = 'translate3d(100%,0,0)';
|
|
586
|
+
this._appendPage(nextPage);
|
|
587
|
+
nextPage.appendChild(this.shadow); //shadow
|
|
588
|
+
nextPage.offsetHeight; //force
|
|
589
|
+
this.isBack = false;
|
|
590
|
+
this.ratio = 1;
|
|
591
|
+
|
|
592
|
+
this._initPageTransform();
|
|
593
|
+
|
|
594
|
+
this.navbars && this._initNavBar();
|
|
595
|
+
|
|
596
|
+
this.navbars && this._setNavbarTranslate(this.maxScrollX, 0);
|
|
597
|
+
//force
|
|
598
|
+
this.previousPage.offsetHeight;
|
|
599
|
+
this.activePage.offsetHeight;
|
|
600
|
+
|
|
601
|
+
if (this.navbars) {
|
|
602
|
+
this.previousNavbar.offsetHeight;
|
|
603
|
+
this.activeNavbar.offsetHeight;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
this._trigger('pageBeforeShow', this.activePage);
|
|
607
|
+
this._prepareTransition();
|
|
608
|
+
this.setTranslate(0, 0);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
$.fn.view = function(options) {
|
|
616
|
+
var self = this[0];
|
|
617
|
+
var viewApi = null;
|
|
618
|
+
var id = self.getAttribute('data-view');
|
|
619
|
+
if (!id) {
|
|
620
|
+
id = ++$.uuid;
|
|
621
|
+
$.data[id] = viewApi = new View(self, options);
|
|
622
|
+
self.setAttribute('data-view', id);
|
|
623
|
+
} else {
|
|
624
|
+
viewApi = $.data[id];
|
|
625
|
+
}
|
|
626
|
+
return viewApi;
|
|
627
|
+
}
|
|
628
|
+
})(mui, window);
|