minirefresh.theme.applet.min.js
3.52 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 n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),e=MiniRefreshTools.theme.defaults,n=MiniRefreshTools.version,o=MiniRefreshTools.extend,s=MiniRefreshTools.namespace,a={down:{successAnim:{isEnable:!1},isWrapCssTranslate:!0}},i=function(n){function s(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s);var e=o(!0,{},a,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,(s.__proto__||Object.getPrototypeOf(s)).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)}(s,e),t(s,[{key:"_initDownWrap",value:function(){var t=this.container,n=this.contentWrap,o=document.createElement("div");o.className="minirefresh-downwrap minirefresh-hardware-speedup",o.innerHTML=' \n <div class="downwrap-content ball-beat">\n <div class="dot"></div>\n <div class="dot"></div>\n <div class="dot"></div>\n </div>\n ',t.insertBefore(o,n),t.classList.add("minirefresh-theme-applet"),this.downWrap=o,this.isCanPullDown=!1,this.downWrapHeight=this.downWrap.offsetHeight||50,this._transformDownWrap(-1*this.downWrapHeight),e._changeWrapStatusClass(this.downWrap,"status-default")}},{key:"_transformDownWrap",value:function(t,e){(function t(e,n,o){null===e&&(e=Function.prototype);var s=Object.getOwnPropertyDescriptor(e,n);if(void 0===s){var a=Object.getPrototypeOf(e);return null===a?void 0:t(a,n,o)}if("value"in s)return s.value;var i=s.get;if(void 0!==i)return i.call(o)})(s.prototype.__proto__||Object.getPrototypeOf(s.prototype),"_transformDownWrap",this).call(this,t,e)}},{key:"_pullHook",value:function(t,n){if(t<n){var o=t/n,s=this.downWrapHeight*(-1+o);this._transformDownWrap(s),this.isCanPullDown&&(this.isCanPullDown=!1,e._changeWrapStatusClass(this.downWrap,"status-default"))}else this._transformDownWrap(0),this.isCanPullDown||(this.isCanPullDown=!0,e._changeWrapStatusClass(this.downWrap,"status-pull"))}},{key:"_downLoaingHook",value:function(){this.downWrap.classList.add("loading-applet"),e._changeWrapStatusClass(this.downWrap,"status-loading")}},{key:"_downLoaingSuccessHook",value:function(t){e._changeWrapStatusClass(this.downWrap,t?"status-success":"status-error")}},{key:"_downLoaingEndHook",value:function(){this.downWrap.classList.remove("loading-applet"),this._transformDownWrap(-1*this.downWrapHeight,this.options.down.bounceTime),this.isCanPullDown=!1,e._changeWrapStatusClass(this.downWrap,"status-default")}},{key:"_cancelLoaingHook",value:function(){this._transformDownWrap(-1*this.downWrapHeight,this.options.down.bounceTime),e._changeWrapStatusClass(this.downWrap,"status-default")}}]),s}();return i.sign="applet",i.version=n,s("theme.applet",i),i});