@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,322 @@
|
|
|
1
|
+
(function($, window) {
|
|
2
|
+
var CLASS_ZOOM = $.className('zoom');
|
|
3
|
+
var CLASS_ZOOM_SCROLLER = $.className('zoom-scroller');
|
|
4
|
+
|
|
5
|
+
var SELECTOR_ZOOM = '.' + CLASS_ZOOM;
|
|
6
|
+
var SELECTOR_ZOOM_SCROLLER = '.' + CLASS_ZOOM_SCROLLER;
|
|
7
|
+
|
|
8
|
+
var EVENT_PINCH_START = 'pinchstart';
|
|
9
|
+
var EVENT_PINCH = 'pinch';
|
|
10
|
+
var EVENT_PINCH_END = 'pinchend';
|
|
11
|
+
if ('ongesturestart' in window) {
|
|
12
|
+
EVENT_PINCH_START = 'gesturestart';
|
|
13
|
+
EVENT_PINCH = 'gesturechange';
|
|
14
|
+
EVENT_PINCH_END = 'gestureend';
|
|
15
|
+
}
|
|
16
|
+
$.Zoom = function(element, options) {
|
|
17
|
+
var zoom = this;
|
|
18
|
+
|
|
19
|
+
zoom.options = $.extend($.Zoom.defaults, options);
|
|
20
|
+
|
|
21
|
+
zoom.wrapper = zoom.element = element;
|
|
22
|
+
zoom.scroller = element.querySelector(SELECTOR_ZOOM_SCROLLER);
|
|
23
|
+
zoom.scrollerStyle = zoom.scroller && zoom.scroller.style;
|
|
24
|
+
|
|
25
|
+
zoom.zoomer = element.querySelector(SELECTOR_ZOOM);
|
|
26
|
+
zoom.zoomerStyle = zoom.zoomer && zoom.zoomer.style;
|
|
27
|
+
|
|
28
|
+
zoom.init = function() {
|
|
29
|
+
//自动启用
|
|
30
|
+
$.options.gestureConfig.pinch = true;
|
|
31
|
+
$.options.gestureConfig.doubletap = true;
|
|
32
|
+
zoom.initEvents();
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
zoom.initEvents = function(detach) {
|
|
36
|
+
var action = detach ? 'removeEventListener' : 'addEventListener';
|
|
37
|
+
var target = zoom.scroller;
|
|
38
|
+
|
|
39
|
+
target[action](EVENT_PINCH_START, zoom.onPinchstart);
|
|
40
|
+
target[action](EVENT_PINCH, zoom.onPinch);
|
|
41
|
+
target[action](EVENT_PINCH_END, zoom.onPinchend);
|
|
42
|
+
|
|
43
|
+
target[action]($.EVENT_START, zoom.onTouchstart);
|
|
44
|
+
target[action]($.EVENT_MOVE, zoom.onTouchMove);
|
|
45
|
+
target[action]($.EVENT_CANCEL, zoom.onTouchEnd);
|
|
46
|
+
target[action]($.EVENT_END, zoom.onTouchEnd);
|
|
47
|
+
|
|
48
|
+
target[action]('drag', zoom.dragEvent);
|
|
49
|
+
target[action]('doubletap', zoom.doubleTapEvent);
|
|
50
|
+
};
|
|
51
|
+
zoom.dragEvent = function(e) {
|
|
52
|
+
if (imageIsMoved || isGesturing) {
|
|
53
|
+
e.stopPropagation();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
zoom.doubleTapEvent = function(e) {
|
|
57
|
+
zoom.toggleZoom(e.detail.center);
|
|
58
|
+
};
|
|
59
|
+
zoom.transition = function(style, time) {
|
|
60
|
+
time = time || 0;
|
|
61
|
+
style['webkitTransitionDuration'] = time + 'ms';
|
|
62
|
+
return zoom;
|
|
63
|
+
};
|
|
64
|
+
zoom.translate = function(style, x, y) {
|
|
65
|
+
x = x || 0;
|
|
66
|
+
y = y || 0;
|
|
67
|
+
style['webkitTransform'] = 'translate3d(' + x + 'px,' + y + 'px,0px)';
|
|
68
|
+
return zoom;
|
|
69
|
+
};
|
|
70
|
+
zoom.scale = function(style, scale) {
|
|
71
|
+
scale = scale || 1;
|
|
72
|
+
style['webkitTransform'] = 'translate3d(0,0,0) scale(' + scale + ')';
|
|
73
|
+
return zoom;
|
|
74
|
+
};
|
|
75
|
+
zoom.scrollerTransition = function(time) {
|
|
76
|
+
return zoom.transition(zoom.scrollerStyle, time);
|
|
77
|
+
};
|
|
78
|
+
zoom.scrollerTransform = function(x, y) {
|
|
79
|
+
return zoom.translate(zoom.scrollerStyle, x, y);
|
|
80
|
+
};
|
|
81
|
+
zoom.zoomerTransition = function(time) {
|
|
82
|
+
return zoom.transition(zoom.zoomerStyle, time);
|
|
83
|
+
};
|
|
84
|
+
zoom.zoomerTransform = function(scale) {
|
|
85
|
+
return zoom.scale(zoom.zoomerStyle, scale);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// Gestures
|
|
89
|
+
var scale = 1,
|
|
90
|
+
currentScale = 1,
|
|
91
|
+
isScaling = false,
|
|
92
|
+
isGesturing = false;
|
|
93
|
+
zoom.onPinchstart = function(e) {
|
|
94
|
+
isGesturing = true;
|
|
95
|
+
};
|
|
96
|
+
zoom.onPinch = function(e) {
|
|
97
|
+
if (!isScaling) {
|
|
98
|
+
zoom.zoomerTransition(0);
|
|
99
|
+
isScaling = true;
|
|
100
|
+
}
|
|
101
|
+
scale = (e.detail ? e.detail.scale : e.scale) * currentScale;
|
|
102
|
+
if (scale > zoom.options.maxZoom) {
|
|
103
|
+
scale = zoom.options.maxZoom - 1 + Math.pow((scale - zoom.options.maxZoom + 1), 0.5);
|
|
104
|
+
}
|
|
105
|
+
if (scale < zoom.options.minZoom) {
|
|
106
|
+
scale = zoom.options.minZoom + 1 - Math.pow((zoom.options.minZoom - scale + 1), 0.5);
|
|
107
|
+
}
|
|
108
|
+
zoom.zoomerTransform(scale);
|
|
109
|
+
};
|
|
110
|
+
zoom.onPinchend = function(e) {
|
|
111
|
+
scale = Math.max(Math.min(scale, zoom.options.maxZoom), zoom.options.minZoom);
|
|
112
|
+
zoom.zoomerTransition(zoom.options.speed).zoomerTransform(scale);
|
|
113
|
+
currentScale = scale;
|
|
114
|
+
isScaling = false;
|
|
115
|
+
};
|
|
116
|
+
zoom.setZoom = function(newScale) {
|
|
117
|
+
scale = currentScale = newScale;
|
|
118
|
+
zoom.scrollerTransition(zoom.options.speed).scrollerTransform(0, 0);
|
|
119
|
+
zoom.zoomerTransition(zoom.options.speed).zoomerTransform(scale);
|
|
120
|
+
};
|
|
121
|
+
zoom.toggleZoom = function(position, speed) {
|
|
122
|
+
if (typeof position === 'number') {
|
|
123
|
+
speed = position;
|
|
124
|
+
position = undefined;
|
|
125
|
+
}
|
|
126
|
+
speed = typeof speed === 'undefined' ? zoom.options.speed : speed;
|
|
127
|
+
if (scale && scale !== 1) {
|
|
128
|
+
scale = currentScale = 1;
|
|
129
|
+
zoom.scrollerTransition(speed).scrollerTransform(0, 0);
|
|
130
|
+
} else {
|
|
131
|
+
scale = currentScale = zoom.options.maxZoom;
|
|
132
|
+
if (position) {
|
|
133
|
+
var offset = $.offset(zoom.zoomer);
|
|
134
|
+
var top = offset.top;
|
|
135
|
+
var left = offset.left;
|
|
136
|
+
var offsetX = (position.x - left) * scale;
|
|
137
|
+
var offsetY = (position.y - top) * scale;
|
|
138
|
+
this._cal();
|
|
139
|
+
if (offsetX >= imageMaxX && offsetX <= (imageMaxX + wrapperWidth)) { //center
|
|
140
|
+
offsetX = imageMaxX - offsetX + wrapperWidth / 2;
|
|
141
|
+
} else if (offsetX < imageMaxX) { //left
|
|
142
|
+
offsetX = imageMaxX - offsetX + wrapperWidth / 2;
|
|
143
|
+
} else if (offsetX > (imageMaxX + wrapperWidth)) { //right
|
|
144
|
+
offsetX = imageMaxX + wrapperWidth - offsetX - wrapperWidth / 2;
|
|
145
|
+
}
|
|
146
|
+
if (offsetY >= imageMaxY && offsetY <= (imageMaxY + wrapperHeight)) { //middle
|
|
147
|
+
offsetY = imageMaxY - offsetY + wrapperHeight / 2;
|
|
148
|
+
} else if (offsetY < imageMaxY) { //top
|
|
149
|
+
offsetY = imageMaxY - offsetY + wrapperHeight / 2;
|
|
150
|
+
} else if (offsetY > (imageMaxY + wrapperHeight)) { //bottom
|
|
151
|
+
offsetY = imageMaxY + wrapperHeight - offsetY - wrapperHeight / 2;
|
|
152
|
+
}
|
|
153
|
+
offsetX = Math.min(Math.max(offsetX, imageMinX), imageMaxX);
|
|
154
|
+
offsetY = Math.min(Math.max(offsetY, imageMinY), imageMaxY);
|
|
155
|
+
zoom.scrollerTransition(speed).scrollerTransform(offsetX, offsetY);
|
|
156
|
+
} else {
|
|
157
|
+
zoom.scrollerTransition(speed).scrollerTransform(0, 0);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
zoom.zoomerTransition(speed).zoomerTransform(scale);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
zoom._cal = function() {
|
|
164
|
+
wrapperWidth = zoom.wrapper.offsetWidth;
|
|
165
|
+
wrapperHeight = zoom.wrapper.offsetHeight;
|
|
166
|
+
imageWidth = zoom.zoomer.offsetWidth;
|
|
167
|
+
imageHeight = zoom.zoomer.offsetHeight;
|
|
168
|
+
var scaledWidth = imageWidth * scale;
|
|
169
|
+
var scaledHeight = imageHeight * scale;
|
|
170
|
+
imageMinX = Math.min((wrapperWidth / 2 - scaledWidth / 2), 0);
|
|
171
|
+
imageMaxX = -imageMinX;
|
|
172
|
+
imageMinY = Math.min((wrapperHeight / 2 - scaledHeight / 2), 0);
|
|
173
|
+
imageMaxY = -imageMinY;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
var wrapperWidth, wrapperHeight, imageIsTouched, imageIsMoved, imageCurrentX, imageCurrentY, imageMinX, imageMinY, imageMaxX, imageMaxY, imageWidth, imageHeight, imageTouchesStart = {},
|
|
177
|
+
imageTouchesCurrent = {},
|
|
178
|
+
imageStartX, imageStartY, velocityPrevPositionX, velocityPrevTime, velocityX, velocityPrevPositionY, velocityY;
|
|
179
|
+
|
|
180
|
+
zoom.onTouchstart = function(e) {
|
|
181
|
+
e.preventDefault();
|
|
182
|
+
imageIsTouched = true;
|
|
183
|
+
imageTouchesStart.x = e.type === $.EVENT_START ? e.targetTouches[0].pageX : e.pageX;
|
|
184
|
+
imageTouchesStart.y = e.type === $.EVENT_START ? e.targetTouches[0].pageY : e.pageY;
|
|
185
|
+
};
|
|
186
|
+
zoom.onTouchMove = function(e) {
|
|
187
|
+
e.preventDefault();
|
|
188
|
+
if (!imageIsTouched) return;
|
|
189
|
+
if (!imageIsMoved) {
|
|
190
|
+
wrapperWidth = zoom.wrapper.offsetWidth;
|
|
191
|
+
wrapperHeight = zoom.wrapper.offsetHeight;
|
|
192
|
+
imageWidth = zoom.zoomer.offsetWidth;
|
|
193
|
+
imageHeight = zoom.zoomer.offsetHeight;
|
|
194
|
+
var translate = $.parseTranslateMatrix($.getStyles(zoom.scroller, 'webkitTransform'));
|
|
195
|
+
imageStartX = translate.x || 0;
|
|
196
|
+
imageStartY = translate.y || 0;
|
|
197
|
+
zoom.scrollerTransition(0);
|
|
198
|
+
}
|
|
199
|
+
var scaledWidth = imageWidth * scale;
|
|
200
|
+
var scaledHeight = imageHeight * scale;
|
|
201
|
+
|
|
202
|
+
if (scaledWidth < wrapperWidth && scaledHeight < wrapperHeight) return;
|
|
203
|
+
|
|
204
|
+
imageMinX = Math.min((wrapperWidth / 2 - scaledWidth / 2), 0);
|
|
205
|
+
imageMaxX = -imageMinX;
|
|
206
|
+
imageMinY = Math.min((wrapperHeight / 2 - scaledHeight / 2), 0);
|
|
207
|
+
imageMaxY = -imageMinY;
|
|
208
|
+
|
|
209
|
+
imageTouchesCurrent.x = e.type === $.EVENT_MOVE ? e.targetTouches[0].pageX : e.pageX;
|
|
210
|
+
imageTouchesCurrent.y = e.type === $.EVENT_MOVE ? e.targetTouches[0].pageY : e.pageY;
|
|
211
|
+
|
|
212
|
+
if (!imageIsMoved && !isScaling) {
|
|
213
|
+
// if (Math.abs(imageTouchesCurrent.y - imageTouchesStart.y) < Math.abs(imageTouchesCurrent.x - imageTouchesStart.x)) {
|
|
214
|
+
//TODO 此处需要优化,当遇到长图,需要上下滚动时,下列判断会导致滚动不流畅
|
|
215
|
+
if (
|
|
216
|
+
(Math.floor(imageMinX) === Math.floor(imageStartX) && imageTouchesCurrent.x < imageTouchesStart.x) ||
|
|
217
|
+
(Math.floor(imageMaxX) === Math.floor(imageStartX) && imageTouchesCurrent.x > imageTouchesStart.x)
|
|
218
|
+
) {
|
|
219
|
+
imageIsTouched = false;
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
// }
|
|
223
|
+
}
|
|
224
|
+
imageIsMoved = true;
|
|
225
|
+
imageCurrentX = imageTouchesCurrent.x - imageTouchesStart.x + imageStartX;
|
|
226
|
+
imageCurrentY = imageTouchesCurrent.y - imageTouchesStart.y + imageStartY;
|
|
227
|
+
|
|
228
|
+
if (imageCurrentX < imageMinX) {
|
|
229
|
+
imageCurrentX = imageMinX + 1 - Math.pow((imageMinX - imageCurrentX + 1), 0.8);
|
|
230
|
+
}
|
|
231
|
+
if (imageCurrentX > imageMaxX) {
|
|
232
|
+
imageCurrentX = imageMaxX - 1 + Math.pow((imageCurrentX - imageMaxX + 1), 0.8);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (imageCurrentY < imageMinY) {
|
|
236
|
+
imageCurrentY = imageMinY + 1 - Math.pow((imageMinY - imageCurrentY + 1), 0.8);
|
|
237
|
+
}
|
|
238
|
+
if (imageCurrentY > imageMaxY) {
|
|
239
|
+
imageCurrentY = imageMaxY - 1 + Math.pow((imageCurrentY - imageMaxY + 1), 0.8);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
//Velocity
|
|
243
|
+
if (!velocityPrevPositionX) velocityPrevPositionX = imageTouchesCurrent.x;
|
|
244
|
+
if (!velocityPrevPositionY) velocityPrevPositionY = imageTouchesCurrent.y;
|
|
245
|
+
if (!velocityPrevTime) velocityPrevTime = $.now();
|
|
246
|
+
velocityX = (imageTouchesCurrent.x - velocityPrevPositionX) / ($.now() - velocityPrevTime) / 2;
|
|
247
|
+
velocityY = (imageTouchesCurrent.y - velocityPrevPositionY) / ($.now() - velocityPrevTime) / 2;
|
|
248
|
+
if (Math.abs(imageTouchesCurrent.x - velocityPrevPositionX) < 2) velocityX = 0;
|
|
249
|
+
if (Math.abs(imageTouchesCurrent.y - velocityPrevPositionY) < 2) velocityY = 0;
|
|
250
|
+
velocityPrevPositionX = imageTouchesCurrent.x;
|
|
251
|
+
velocityPrevPositionY = imageTouchesCurrent.y;
|
|
252
|
+
velocityPrevTime = $.now();
|
|
253
|
+
|
|
254
|
+
zoom.scrollerTransform(imageCurrentX, imageCurrentY);
|
|
255
|
+
};
|
|
256
|
+
zoom.onTouchEnd = function(e) {
|
|
257
|
+
if (!e.touches.length) {
|
|
258
|
+
isGesturing = false;
|
|
259
|
+
}
|
|
260
|
+
if (!imageIsTouched || !imageIsMoved) {
|
|
261
|
+
imageIsTouched = false;
|
|
262
|
+
imageIsMoved = false;
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
imageIsTouched = false;
|
|
266
|
+
imageIsMoved = false;
|
|
267
|
+
var momentumDurationX = 300;
|
|
268
|
+
var momentumDurationY = 300;
|
|
269
|
+
var momentumDistanceX = velocityX * momentumDurationX;
|
|
270
|
+
var newPositionX = imageCurrentX + momentumDistanceX;
|
|
271
|
+
var momentumDistanceY = velocityY * momentumDurationY;
|
|
272
|
+
var newPositionY = imageCurrentY + momentumDistanceY;
|
|
273
|
+
|
|
274
|
+
if (velocityX !== 0) momentumDurationX = Math.abs((newPositionX - imageCurrentX) / velocityX);
|
|
275
|
+
if (velocityY !== 0) momentumDurationY = Math.abs((newPositionY - imageCurrentY) / velocityY);
|
|
276
|
+
var momentumDuration = Math.max(momentumDurationX, momentumDurationY);
|
|
277
|
+
|
|
278
|
+
imageCurrentX = newPositionX;
|
|
279
|
+
imageCurrentY = newPositionY;
|
|
280
|
+
|
|
281
|
+
var scaledWidth = imageWidth * scale;
|
|
282
|
+
var scaledHeight = imageHeight * scale;
|
|
283
|
+
imageMinX = Math.min((wrapperWidth / 2 - scaledWidth / 2), 0);
|
|
284
|
+
imageMaxX = -imageMinX;
|
|
285
|
+
imageMinY = Math.min((wrapperHeight / 2 - scaledHeight / 2), 0);
|
|
286
|
+
imageMaxY = -imageMinY;
|
|
287
|
+
imageCurrentX = Math.max(Math.min(imageCurrentX, imageMaxX), imageMinX);
|
|
288
|
+
imageCurrentY = Math.max(Math.min(imageCurrentY, imageMaxY), imageMinY);
|
|
289
|
+
|
|
290
|
+
zoom.scrollerTransition(momentumDuration).scrollerTransform(imageCurrentX, imageCurrentY);
|
|
291
|
+
};
|
|
292
|
+
zoom.destroy = function() {
|
|
293
|
+
zoom.initEvents(true); //detach
|
|
294
|
+
delete $.data[zoom.wrapper.getAttribute('data-zoomer')];
|
|
295
|
+
zoom.wrapper.setAttribute('data-zoomer', '');
|
|
296
|
+
}
|
|
297
|
+
zoom.init();
|
|
298
|
+
return zoom;
|
|
299
|
+
};
|
|
300
|
+
$.Zoom.defaults = {
|
|
301
|
+
speed: 300,
|
|
302
|
+
maxZoom: 3,
|
|
303
|
+
minZoom: 1,
|
|
304
|
+
};
|
|
305
|
+
$.fn.zoom = function(options) {
|
|
306
|
+
var zoomApis = [];
|
|
307
|
+
this.each(function() {
|
|
308
|
+
var zoomApi = null;
|
|
309
|
+
var self = this;
|
|
310
|
+
var id = self.getAttribute('data-zoomer');
|
|
311
|
+
if (!id) {
|
|
312
|
+
id = ++$.uuid;
|
|
313
|
+
$.data[id] = zoomApi = new $.Zoom(self, options);
|
|
314
|
+
self.setAttribute('data-zoomer', id);
|
|
315
|
+
} else {
|
|
316
|
+
zoomApi = $.data[id];
|
|
317
|
+
}
|
|
318
|
+
zoomApis.push(zoomApi);
|
|
319
|
+
});
|
|
320
|
+
return zoomApis.length === 1 ? zoomApis[0] : zoomApis;
|
|
321
|
+
};
|
|
322
|
+
})(mui, window);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 5+ App客户端升级参考:http://ask.dcloud.net.cn/article/431
|
|
3
|
+
* 服务端升级逻辑参考:https://ext.dcloud.net.cn/plugin?id=2226
|
|
4
|
+
*
|
|
5
|
+
* 检查升级返回值为JSON格式,如下:
|
|
6
|
+
*
|
|
7
|
+
* 需升级
|
|
8
|
+
{
|
|
9
|
+
"isUpdate":true,
|
|
10
|
+
"version": "2.6.0",
|
|
11
|
+
"title": "Hello MUI版本更新",
|
|
12
|
+
"note": "修复“选项卡+下拉刷新”示例中,某个选项卡滚动到底时,会触发所有选项卡上拉加载事件的bug;\n修复Android4.4.4版本部分手机上,软键盘弹出时影响图片轮播组件,导致自动轮播停止的bug;",
|
|
13
|
+
"url": "http://www.dcloud.io/hellomui/HelloMUI.apk"
|
|
14
|
+
}
|
|
15
|
+
*
|
|
16
|
+
* 无需升级
|
|
17
|
+
{
|
|
18
|
+
"isUpdate":false
|
|
19
|
+
}
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
//服务端检查更新地址,这里是 uniCloud 实现示例,开发者可替换为自己的地址
|
|
24
|
+
var server = "https://7a3e3fa9-7820-41d0-be80-11927ac2026c.bspapp.com/http/update";
|
|
25
|
+
|
|
26
|
+
function update() {
|
|
27
|
+
mui.getJSON(server, {
|
|
28
|
+
"appid": plus.runtime.appid,
|
|
29
|
+
"version": plus.runtime.version,
|
|
30
|
+
"imei": plus.device.imei
|
|
31
|
+
}, function(data) {
|
|
32
|
+
if (data.isUpdate) {
|
|
33
|
+
plus.nativeUI.confirm(data.note, function(event) {
|
|
34
|
+
if (0 == event.index) {
|
|
35
|
+
plus.runtime.openURL(data.url);
|
|
36
|
+
}
|
|
37
|
+
}, data.title, ["立即更新", "取 消"]);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// 真机运行不需要检查更新,真机运行时appid固定为'HBuilder',这是调试基座的appid
|
|
43
|
+
if(plus.runtime.appid !== 'HBuilder' && mui.os.plus && !mui.os.stream ){
|
|
44
|
+
mui.plusReady(update);
|
|
45
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
var webviewGroup = function(id, options) {
|
|
2
|
+
this.id = id;
|
|
3
|
+
this.options = options;
|
|
4
|
+
this.styles = options.styles;
|
|
5
|
+
this.items = options.items;
|
|
6
|
+
this.onChange = options.onChange
|
|
7
|
+
|
|
8
|
+
this.options.index = options.index || 0;
|
|
9
|
+
|
|
10
|
+
this.webviews = {};
|
|
11
|
+
this.webviewContexts = {};
|
|
12
|
+
this.currentWebview = false;
|
|
13
|
+
this._init();
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
var proto = webviewGroup.prototype;
|
|
17
|
+
|
|
18
|
+
proto._init = function() {
|
|
19
|
+
this._initParent();
|
|
20
|
+
this._initNativeView();
|
|
21
|
+
this._initWebviewContexts(this.options.index);
|
|
22
|
+
};
|
|
23
|
+
proto._initParent = function() {
|
|
24
|
+
this.parent = plus.webview.getWebviewById(this.id);
|
|
25
|
+
if(!this.parent) {
|
|
26
|
+
this.parent = plus.webview.create(this.id, this.id);
|
|
27
|
+
this.parent.show('none');
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
proto._initNativeView = function() {
|
|
31
|
+
// fixed by wmy 因为沉浸式应用,需要额外加上状态栏高度
|
|
32
|
+
var statusbar_H = plus.navigator.getStatusbarHeight();
|
|
33
|
+
this.nativeView = new plus.nativeObj.View('__MUI_TAB_NATIVE', {
|
|
34
|
+
'top': (83 + statusbar_H) +'px', //这个需要根据顶部导航及顶部选项卡高度自动调整
|
|
35
|
+
'height': (window.screen.height - 83)+"px",
|
|
36
|
+
'left': '100%',
|
|
37
|
+
'width': '100%',
|
|
38
|
+
"backgroundColor":"#ffffff"
|
|
39
|
+
});
|
|
40
|
+
this.nativeView.show();
|
|
41
|
+
};
|
|
42
|
+
proto._initWebviewContexts = function() {
|
|
43
|
+
for(var len = this.items.length, i = len - 1; i >= 0; i--) {
|
|
44
|
+
var webviewOptions = this.items[i];
|
|
45
|
+
var id = webviewOptions.id;
|
|
46
|
+
var isFirst = i === 0;
|
|
47
|
+
var isLast = i === (len - 1);
|
|
48
|
+
var isCurrent = this.options.index === i;
|
|
49
|
+
var extras = webviewOptions.extras;
|
|
50
|
+
extras.__mui_url = webviewOptions.url;
|
|
51
|
+
extras.__mui_index = i;
|
|
52
|
+
|
|
53
|
+
extras.__mui_left = isFirst ? '' : this.items[i - 1].id;
|
|
54
|
+
extras.__mui_right = isLast ? '' : this.items[i + 1].id;
|
|
55
|
+
|
|
56
|
+
var styles = webviewOptions.styles || {};
|
|
57
|
+
|
|
58
|
+
if(i > this.options.index) {
|
|
59
|
+
styles.left = '100%';
|
|
60
|
+
} else if(i < this.options.index) {
|
|
61
|
+
styles.left = '-100%';
|
|
62
|
+
} else {
|
|
63
|
+
styles.left = '0';
|
|
64
|
+
}
|
|
65
|
+
var webviewContext = new webviewGroupContext(id, webviewOptions, this);
|
|
66
|
+
this.webviewContexts[id] = webviewContext;
|
|
67
|
+
if(isCurrent) {
|
|
68
|
+
webviewContext.webview = plus.webview.getWebviewById(id);
|
|
69
|
+
webviewContext.createWebview();
|
|
70
|
+
webviewContext.webview.show("none");
|
|
71
|
+
this._initDrags(webviewContext.webview);
|
|
72
|
+
this.currentWebview = webviewContext.webview;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
proto._onChange = function(webview) {
|
|
77
|
+
this.currentWebview = webview;
|
|
78
|
+
this.onChange({
|
|
79
|
+
index: webview.__mui_index
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
proto._dragCallback = function(dir, fromWebview, view, viewId) {
|
|
83
|
+
if(view === this.nativeView) { //需要创建webview
|
|
84
|
+
//第一步:初始化目标webview
|
|
85
|
+
this.webviewContexts[viewId].createWebview('drag');
|
|
86
|
+
var targetWebview = this.webviewContexts[viewId].webview;
|
|
87
|
+
targetWebview.show();
|
|
88
|
+
this.nativeView.setStyle({
|
|
89
|
+
left: '100%'
|
|
90
|
+
});
|
|
91
|
+
//第二步:初始化目标webview的drag
|
|
92
|
+
this._initDrags(targetWebview);
|
|
93
|
+
this._onChange(targetWebview);
|
|
94
|
+
//第三步:校验目标webview的左右webview的drag初始化
|
|
95
|
+
this._checkDrags(targetWebview);
|
|
96
|
+
} else {
|
|
97
|
+
this._onChange(view);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
proto._initDrag = function(webview, dir) {
|
|
102
|
+
var flag = ('__mui_drag_' + dir + '_flag');
|
|
103
|
+
if(webview[flag]) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
var viewId = webview['__mui_' + (dir === 'left' ? 'right' : 'left')];
|
|
107
|
+
if(viewId) {
|
|
108
|
+
var view = plus.webview.getWebviewById(viewId);
|
|
109
|
+
if(!view) { //如果目标webview不存在,使用nativeView替换
|
|
110
|
+
view = this.nativeView;
|
|
111
|
+
} else {
|
|
112
|
+
webview[flag] = true;
|
|
113
|
+
}
|
|
114
|
+
webview.drag({
|
|
115
|
+
'direction': dir,
|
|
116
|
+
'moveMode': 'followFinger'
|
|
117
|
+
}, {
|
|
118
|
+
'view': view,
|
|
119
|
+
'moveMode': 'follow'
|
|
120
|
+
},
|
|
121
|
+
function(res) {
|
|
122
|
+
if(res.type === 'end' && res.result) { //拖拽完成
|
|
123
|
+
this._dragCallback(dir, webview, view, viewId);
|
|
124
|
+
}
|
|
125
|
+
}.bind(this)
|
|
126
|
+
)
|
|
127
|
+
} else {
|
|
128
|
+
webview[flag] = true;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
proto._initDrags = function(webview) {
|
|
132
|
+
this._initDrag(webview, 'left');
|
|
133
|
+
this._initDrag(webview, 'right');
|
|
134
|
+
};
|
|
135
|
+
proto._checkDrags = function(webview) {
|
|
136
|
+
var left = webview.__mui_left;
|
|
137
|
+
var right = webview.__mui_right;
|
|
138
|
+
if(left) {
|
|
139
|
+
var leftWebview = plus.webview.getWebviewById(left);
|
|
140
|
+
if(leftWebview && !leftWebview.__mui_drag_left_flag) {
|
|
141
|
+
this._initDrag(leftWebview, 'left');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if(right) {
|
|
145
|
+
var rightWebview = plus.webview.getWebviewById(right);
|
|
146
|
+
if(rightWebview && !rightWebview.__mui_drag_right_flag) {
|
|
147
|
+
this._initDrag(rightWebview, 'right');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
proto.getCurrentWebview = function() {
|
|
152
|
+
return this.currentWebview;
|
|
153
|
+
};
|
|
154
|
+
proto.getCurrentWebviewContext = function() {
|
|
155
|
+
if(this.currentWebview) {
|
|
156
|
+
return this.webviewContexts[this.currentWebview.id];
|
|
157
|
+
}
|
|
158
|
+
return false;
|
|
159
|
+
};
|
|
160
|
+
proto.switchTab = function(id) {
|
|
161
|
+
id = id.replace('_0', ''); //首页需要替换为appid
|
|
162
|
+
var fromWebview = this.currentWebview;
|
|
163
|
+
if(id === fromWebview.id) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
var toWebviewContext = this.webviewContexts[id];
|
|
167
|
+
var toWebview = toWebviewContext.webview;
|
|
168
|
+
var fromToLeft = '100%';
|
|
169
|
+
var toFromLeft = '-100%';
|
|
170
|
+
if(toWebviewContext.options.extras.__mui_index > fromWebview.__mui_index) {
|
|
171
|
+
fromToLeft = '-100%';
|
|
172
|
+
toFromLeft = '100%';
|
|
173
|
+
}
|
|
174
|
+
var isNew = false;
|
|
175
|
+
if(!toWebview) {
|
|
176
|
+
isNew = true;
|
|
177
|
+
toWebviewContext.createWebview('startAnimation');
|
|
178
|
+
toWebview = toWebviewContext.webview;
|
|
179
|
+
// toWebview.showBehind(plus.webview.getSecondWebview());
|
|
180
|
+
toWebview.show();
|
|
181
|
+
this._initDrags(toWebview);
|
|
182
|
+
this._checkDrags(toWebview); //新建的时候均需校验
|
|
183
|
+
}
|
|
184
|
+
var self = this;
|
|
185
|
+
// console.log("current:" + fromWebview.id + ",to:" + fromToLeft);
|
|
186
|
+
// console.log("next:" + toWebview.id + ",from:" + toFromLeft);
|
|
187
|
+
|
|
188
|
+
plus.webview.startAnimation({
|
|
189
|
+
'view': fromWebview,
|
|
190
|
+
'styles': {
|
|
191
|
+
'fromLeft': '0',
|
|
192
|
+
'toLeft': fromToLeft
|
|
193
|
+
},
|
|
194
|
+
'action': 'show'
|
|
195
|
+
}, {
|
|
196
|
+
'view': toWebview,
|
|
197
|
+
'styles': {
|
|
198
|
+
'fromLeft': toFromLeft,
|
|
199
|
+
'toLeft': '0'
|
|
200
|
+
},
|
|
201
|
+
'action': 'show'
|
|
202
|
+
},
|
|
203
|
+
function(e) {
|
|
204
|
+
//console.log("startAnimation callback...");
|
|
205
|
+
if(e.id === toWebview.id) {
|
|
206
|
+
isNew && plus.nativeUI.showWaiting();
|
|
207
|
+
this.currentWebview = toWebview;
|
|
208
|
+
this.onChange({
|
|
209
|
+
index: toWebview.__mui_index
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}.bind(this)
|
|
213
|
+
)
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* @param {Object} id
|
|
218
|
+
* @param {Object} webviewOptions
|
|
219
|
+
*/
|
|
220
|
+
var webviewGroupContext = function(id, webviewOptions, groupContext) {
|
|
221
|
+
this.id = id;
|
|
222
|
+
this.url = webviewOptions.url;
|
|
223
|
+
this.options = webviewOptions;
|
|
224
|
+
this.groupContext = groupContext;
|
|
225
|
+
|
|
226
|
+
this.webview = false;
|
|
227
|
+
this.inited = false;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
var _proto = webviewGroupContext.prototype;
|
|
231
|
+
|
|
232
|
+
_proto.createWebview = function(from) {
|
|
233
|
+
var options = this.options;
|
|
234
|
+
options.styles = options.styles || {
|
|
235
|
+
top: "83px",
|
|
236
|
+
bottom: "0px",
|
|
237
|
+
render: "always"
|
|
238
|
+
};
|
|
239
|
+
options.styles.popGesture = 'none';
|
|
240
|
+
if(this.webview) {
|
|
241
|
+
this.webview.setStyle(options.styles);
|
|
242
|
+
for(var key in options.extras) {
|
|
243
|
+
this.webview[key] = options.extras[key];
|
|
244
|
+
}
|
|
245
|
+
} else {
|
|
246
|
+
options.styles.left = '100%';
|
|
247
|
+
if(from !== 'startAnimation') {
|
|
248
|
+
options.styles.left = '0';
|
|
249
|
+
plus.nativeUI.showWaiting();
|
|
250
|
+
}
|
|
251
|
+
this.webview = plus.webview.create(this.url, this.id, options.styles, options.extras);
|
|
252
|
+
//append进去,避免返回时闪屏
|
|
253
|
+
plus.webview.currentWebview().append(this.webview);
|
|
254
|
+
}
|
|
255
|
+
this._initWebview();
|
|
256
|
+
this.inited = true;
|
|
257
|
+
};
|
|
258
|
+
_proto._initWebview = function() {
|
|
259
|
+
var options = this.options;
|
|
260
|
+
if(!this.webview) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
this.webview.addEventListener('rendering', function() {
|
|
264
|
+
setTimeout(function() {
|
|
265
|
+
plus.nativeUI.closeWaiting();
|
|
266
|
+
}, 500);
|
|
267
|
+
});
|
|
268
|
+
if(options.pullToRefresh && options.pullToRefresh.support && support.pullToRefresh()) {
|
|
269
|
+
var callback = options.pullToRefresh.callback;
|
|
270
|
+
this.webview.setPullToRefresh(options.pullToRefresh, function() {
|
|
271
|
+
if(callback) { //如果指定了下拉回调
|
|
272
|
+
callback(this.webview);
|
|
273
|
+
} else { //下拉刷新回调,默认reload当前页面
|
|
274
|
+
var self = this;
|
|
275
|
+
var titleUpdate = function() {
|
|
276
|
+
setTimeout(function() {
|
|
277
|
+
self.webview.endPullToRefresh();
|
|
278
|
+
}.bind(this), 1000);
|
|
279
|
+
self.webview.removeEventListener('titleUpdate', titleUpdate);
|
|
280
|
+
};
|
|
281
|
+
this.webview.addEventListener('titleUpdate', titleUpdate);
|
|
282
|
+
this.webview.reload();
|
|
283
|
+
}
|
|
284
|
+
}.bind(this));
|
|
285
|
+
}
|
|
286
|
+
};
|