minirefresh.theme.drawer3d.min.js 4.26 KB
/*!
 * minirefresh v2.0.2
 * (c) 2017-2018 dailc
 * Released under the MIT License.
 * https://github.com/minirefresh/minirefresh
 */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.MiniRefresh=e()}(this,function(){"use strict";var t=function(){function t(t,e){for(var o=0;o<e.length;o++){var r=e[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,o,r){return o&&t(e.prototype,o),r&&t(e,r),e}}(),e=function t(e,o,r){null===e&&(e=Function.prototype);var n=Object.getOwnPropertyDescriptor(e,o);if(void 0===n){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,o,r)}if("value"in n)return n.value;var s=n.get;if(void 0!==s)return s.call(r)},o=MiniRefreshTools.theme.defaults,r=MiniRefreshTools.version,n=MiniRefreshTools.extend,i=MiniRefreshTools.namespace,s={down:{offset:100,dampRate:.2,bounceTime:500,successAnim:{isEnable:!1},isWrapCssTranslate:!0}},a=function(r){function i(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i);var e=n(!0,{},s,t);return function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(i,o),t(i,[{key:"_initDownWrap",value:function(){e(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"_initDownWrap",this).call(this);var t=this.container,o=this.downWrap;o.innerHTML=' \n            <div class="state-3d">\n                <div class="drawer3d">\n                    <div class="downwrap-content">\n                        <p class="downwrap-progress"></p>\n                        <p class="downwrap-tips">'+this.options.down.contentdown+'</p>\n                    </div>\n                    <div class="drawer3d-mask"></div>\n                </div>\n            </div>\n        ',t.classList.add("minirefresh-theme-drawer3d"),this.downWrapProgress=o.querySelector(".downwrap-progress"),this.downWrapTips=o.querySelector(".downwrap-tips"),this.drawer=o.querySelector(".drawer3d"),this.drawerMask=o.querySelector(".drawer3d-mask"),this.downWrapHeight=o.offsetHeight||200,this._transformDownWrap(-this.downWrapHeight),this._resetDrawer()}},{key:"_transformDownWrap",value:function(t,o){e(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"_transformDownWrap",this).call(this,t,o)}},{key:"_transformDrawer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e="rotateX("+t+"deg) rotateY(0deg)",o=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)+"ms";this.drawer.style.transform=e,this.drawer.style.webkitTransform=e,this.drawer.style.transitionDuration=o,this.drawer.style.webkitTransitionDuration=o;var r=t/90;this.drawerMask.style.opacity=r,this.drawerMask.style.transitionDuration=o,this.drawerMask.style.webkitTransitionDuration=o}},{key:"_resetDrawer",value:function(){this._transformDrawer(90,this.options.down.bounceTime)}},{key:"_pullHook",value:function(t,o){e(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"_pullHook",this).call(this,t,o);var r=t/o,n=90*(1-Math.min(r,1));this._transformDrawer(n)}},{key:"_downLoaingHook",value:function(){e(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"_downLoaingHook",this).call(this),this._transformDrawer(0,this.options.down.bounceTime)}},{key:"_downLoaingSuccessHook",value:function(t,o){e(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"_downLoaingSuccessHook",this).call(this,t,o)}},{key:"_downLoaingEndHook",value:function(t){e(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"_downLoaingEndHook",this).call(this,t),this._resetDrawer()}},{key:"_cancelLoaingHook",value:function(){e(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"_cancelLoaingHook",this).call(this),this._resetDrawer()}}]),i}();return a.sign="drawer3d",a.version=r,i("theme.drawer3d",a),a});