framework7
Version:
Full featured mobile HTML framework for building iOS & Android apps
2 lines (1 loc) • 2.19 kB
JavaScript
(function framework7ComponentLoader(e,o){void 0===o&&(o=!0);document,window;var i=e.$,n=(e.Template7,e.utils),r=(e.device,e.support,e.Class,e.Modal,e.ConstructorMethods,e.ModalMethods,{init:function(e){var o=i(e);0===o.length||o.children(".preloader-inner").length>0||o.children(".preloader-inner-line").length>0||o.append(n[this.theme+"PreloaderContent"])},visible:!1,show:function(e){void 0===e&&(e="white");if(!r.visible){var o=n[this.theme+"PreloaderContent"]||"";i("html").addClass("with-modal-preloader"),this.root.append('\n <div class="preloader-backdrop"></div>\n <div class="preloader-modal">\n <div class="preloader color-'+e+'">'+o+"</div>\n </div>\n "),r.visible=!0}},showIn:function(e,o){void 0===o&&(o="white");var r=n[this.theme+"PreloaderContent"]||"";i(e||"html").addClass("with-modal-preloader"),i(e||this.root).append('\n <div class="preloader-backdrop"></div>\n <div class="preloader-modal">\n <div class="preloader color-'+o+'">'+r+"</div>\n </div>\n ")},hide:function(){r.visible&&(i("html").removeClass("with-modal-preloader"),this.root.find(".preloader-backdrop, .preloader-modal").remove(),r.visible=!1)},hideIn:function(e){i(e||"html").removeClass("with-modal-preloader"),i(e||this.root).find(".preloader-backdrop, .preloader-modal").remove()}}),d={name:"preloader",create:function(){n.extend(this,{preloader:{init:r.init.bind(this),show:r.show.bind(this),hide:r.hide.bind(this),showIn:r.showIn.bind(this),hideIn:r.hideIn.bind(this)}})},on:{photoBrowserOpen:function(e){var o=this;e.$el.find(".preloader").each((function(e,i){o.preloader.init(i)}))},tabMounted:function(e){var o=this;i(e).find(".preloader").each((function(e,i){o.preloader.init(i)}))},pageInit:function(e){var o=this;e.$el.find(".preloader").each((function(e,i){o.preloader.init(i)}))}},vnode:{preloader:{insert:function(e){var o=e.elm;this.preloader.init(o)}}}};if(o){if(e.prototype.modules&&e.prototype.modules[d.name])return;e.use(d),e.instance&&(e.instance.useModuleParams(d,e.instance.params),e.instance.useModule(d))}return d}(Framework7, typeof Framework7AutoInstallComponent === 'undefined' ? undefined : Framework7AutoInstallComponent))