app-loading
Advanced tools
+21
-17
@@ -1,6 +0,6 @@ | ||
| /*********************************************** | ||
| *app-loading | ||
| *(c) 2015 | ||
| *github.com/aprilorange/app-loading | ||
| ***********************************************/ | ||
| /* | ||
| * app-loading | ||
| * (c) 2015 | ||
| * github.com/aprilorange/app-loading | ||
| */ | ||
@@ -16,5 +16,5 @@ 'use strict'; | ||
| var definition = function definition(W, D) { | ||
| var appLoading = (function () { | ||
| function appLoading() { | ||
| _classCallCheck(this, appLoading); | ||
| var AppLoading = (function () { | ||
| function AppLoading() { | ||
| _classCallCheck(this, AppLoading); | ||
@@ -28,3 +28,3 @@ this.opts = { | ||
| _createClass(appLoading, [{ | ||
| _createClass(AppLoading, [{ | ||
| key: 'start', | ||
@@ -43,4 +43,8 @@ value: function start(color) { | ||
| var bar = this.getBar(); | ||
| if (this.opts.color) bar.style.backgroundColor = this.opts.color; | ||
| if (color) bar.style.backgroundColor = color; | ||
| if (this.opts.color) { | ||
| bar.style.backgroundColor = this.opts.color; | ||
| } | ||
| if (color) { | ||
| bar.style.backgroundColor = color; | ||
| } | ||
| D.querySelector('body').classList.add(this.opts.className); | ||
@@ -58,3 +62,5 @@ } | ||
| var bar = D.querySelector(this.opts.loadingBar); | ||
| if (!bar) this.initBar(); | ||
| if (!bar) { | ||
| this.initBar(); | ||
| } | ||
| return bar; | ||
@@ -76,12 +82,10 @@ } | ||
| return appLoading; | ||
| return AppLoading; | ||
| })(); | ||
| return new appLoading(); | ||
| return new AppLoading(); | ||
| };(function (context, name, definition) { | ||
| if (typeof module !== 'undefined') { | ||
| module.exports = definition; | ||
| } else if (typeof define === 'function' && define.amd) { | ||
| define(definition); | ||
| } else { | ||
| } else if (typeof context !== 'undefined') { | ||
| context[name] = definition; | ||
@@ -88,0 +92,0 @@ } |
@@ -1,2 +0,2 @@ | ||
| "use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}();!function(){var e=function(e,t){var o=function(){function e(){_classCallCheck(this,e),this.opts={className:"app-loading",loadingBar:".loading-bar",color:null}}return _createClass(e,[{key:"start",value:function(e){this.showBar(e)}},{key:"stop",value:function(){this.hideBar()}},{key:"showBar",value:function(e){var o=this.getBar();this.opts.color&&(o.style.backgroundColor=this.opts.color),e&&(o.style.backgroundColor=e),t.querySelector("body").classList.add(this.opts.className)}},{key:"hideBar",value:function(){t.querySelector("body").classList.remove(this.opts.className),this.getBar().style.backgroundColor=null}},{key:"getBar",value:function(){var e=t.querySelector(this.opts.loadingBar);return e||this.initBar(),e}},{key:"initBar",value:function(){var e=t.createElement("div");e.className=this.opts.loadingBar.substring(1),t.body.appendChild(e)}},{key:"setColor",value:function(e){this.opts.color=e}}]),e}();return new o};!function(e,t,o){"undefined"!=typeof module?module.exports=o:"function"==typeof define&&define.amd?define(o):e[t]=o}(window,"appLoading",e(window,document))}(); | ||
| "use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}();!function(){var e=function(e,t){var o=function(){function e(){_classCallCheck(this,e),this.opts={className:"app-loading",loadingBar:".loading-bar",color:null}}return _createClass(e,[{key:"start",value:function(e){this.showBar(e)}},{key:"stop",value:function(){this.hideBar()}},{key:"showBar",value:function(e){var o=this.getBar();this.opts.color&&(o.style.backgroundColor=this.opts.color),e&&(o.style.backgroundColor=e),t.querySelector("body").classList.add(this.opts.className)}},{key:"hideBar",value:function(){t.querySelector("body").classList.remove(this.opts.className),this.getBar().style.backgroundColor=null}},{key:"getBar",value:function(){var e=t.querySelector(this.opts.loadingBar);return e||this.initBar(),e}},{key:"initBar",value:function(){var e=t.createElement("div");e.className=this.opts.loadingBar.substring(1),t.body.appendChild(e)}},{key:"setColor",value:function(e){this.opts.color=e}}]),e}();return new o};!function(e,t,o){"undefined"!=typeof module?module.exports=o:"undefined"!=typeof e&&(e[t]=o)}(window,"appLoading",e(window,document))}(); | ||
| //# sourceMappingURL=app-loading.min.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["app-loading.js"],"names":["_classCallCheck","instance","Constructor","TypeError","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","prototype","definition","W","D","appLoading","this","opts","className","loadingBar","color","value","showBar","hideBar","bar","getBar","style","backgroundColor","querySelector","classList","add","remove","initBar","createElement","substring","body","appendChild","context","name","module","exports","define","amd","window","document"],"mappings":"AAMA,YAIA,SAASA,iBAAgBC,EAAUC,GAAe,KAAMD,YAAoBC,IAAgB,KAAM,IAAIC,WAAU,qCAFhH,GAAIC,cAAe,WAAe,QAASC,GAAiBC,EAAQC,GAAS,IAAK,GAAIC,GAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CAAE,GAAIE,GAAaH,EAAMC,EAAIE,GAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,SAAWF,KAAYA,EAAWG,UAAW,GAAMC,OAAOC,eAAeT,EAAQI,EAAWM,IAAKN,IAAiB,MAAO,UAAUR,EAAae,EAAYC,GAAiJ,MAA9HD,IAAYZ,EAAiBH,EAAYiB,UAAWF,GAAiBC,GAAab,EAAiBH,EAAagB,GAAqBhB,OAIjiB,WAEE,GAAIkB,GAAa,SAAoBC,EAAGC,GACtC,GAAIC,GAAa,WACf,QAASA,KACPvB,gBAAgBwB,KAAMD,GAEtBC,KAAKC,MACHC,UAAW,cACXC,WAAY,eACZC,MAAO,MAiDX,MA7CAxB,cAAamB,IACXP,IAAK,QACLa,MAAO,SAAeD,GACpBJ,KAAKM,QAAQF,MAGfZ,IAAK,OACLa,MAAO,WACLL,KAAKO,aAGPf,IAAK,UACLa,MAAO,SAAiBD,GACtB,GAAII,GAAMR,KAAKS,QACXT,MAAKC,KAAKG,QAAOI,EAAIE,MAAMC,gBAAkBX,KAAKC,KAAKG,OACvDA,IAAOI,EAAIE,MAAMC,gBAAkBP,GACvCN,EAAEc,cAAc,QAAQC,UAAUC,IAAId,KAAKC,KAAKC,cAGlDV,IAAK,UACLa,MAAO,WACLP,EAAEc,cAAc,QAAQC,UAAUE,OAAOf,KAAKC,KAAKC,WACnDF,KAAKS,SAASC,MAAMC,gBAAkB,QAGxCnB,IAAK,SACLa,MAAO,WACL,GAAIG,GAAMV,EAAEc,cAAcZ,KAAKC,KAAKE,WAEpC,OADKK,IAAKR,KAAKgB,UACRR,KAGThB,IAAK,UACLa,MAAO,WACL,GAAIG,GAAMV,EAAEmB,cAAc,MAC1BT,GAAIN,UAAYF,KAAKC,KAAKE,WAAWe,UAAU,GAC/CpB,EAAEqB,KAAKC,YAAYZ,MAGrBhB,IAAK,WACLa,MAAO,SAAkBD,GACvBJ,KAAKC,KAAKG,MAAQA,MAIfL,IAGT,OAAO,IAAIA,KACX,SAAWsB,EAASC,EAAM1B,GACJ,mBAAX2B,QACTA,OAAOC,QAAU5B,EACU,kBAAX6B,SAAyBA,OAAOC,IAChDD,OAAO7B,GAEPyB,EAAQC,GAAQ1B,GAEjB+B,OAAQ,aAAc/B,EAAW+B,OAAQC","file":"app-loading.min.js","sourcesContent":["/***********************************************\r\n *app-loading\r\n *(c) 2015\r\n *github.com/aprilorange/app-loading\r\n***********************************************/\n\n'use strict';\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\n(function () {\n\n var definition = function definition(W, D) {\n var appLoading = (function () {\n function appLoading() {\n _classCallCheck(this, appLoading);\n\n this.opts = {\n className: 'app-loading',\n loadingBar: '.loading-bar',\n color: null\n };\n }\n\n _createClass(appLoading, [{\n key: 'start',\n value: function start(color) {\n this.showBar(color);\n }\n }, {\n key: 'stop',\n value: function stop() {\n this.hideBar();\n }\n }, {\n key: 'showBar',\n value: function showBar(color) {\n var bar = this.getBar();\n if (this.opts.color) bar.style.backgroundColor = this.opts.color;\n if (color) bar.style.backgroundColor = color;\n D.querySelector('body').classList.add(this.opts.className);\n }\n }, {\n key: 'hideBar',\n value: function hideBar() {\n D.querySelector('body').classList.remove(this.opts.className);\n this.getBar().style.backgroundColor = null;\n }\n }, {\n key: 'getBar',\n value: function getBar() {\n var bar = D.querySelector(this.opts.loadingBar);\n if (!bar) this.initBar();\n return bar;\n }\n }, {\n key: 'initBar',\n value: function initBar() {\n var bar = D.createElement('div');\n bar.className = this.opts.loadingBar.substring(1);\n D.body.appendChild(bar);\n }\n }, {\n key: 'setColor',\n value: function setColor(color) {\n this.opts.color = color;\n }\n }]);\n\n return appLoading;\n })();\n\n return new appLoading();\n };(function (context, name, definition) {\n if (typeof module !== 'undefined') {\n module.exports = definition;\n } else if (typeof define === 'function' && define.amd) {\n define(definition);\n } else {\n context[name] = definition;\n }\n })(window, 'appLoading', definition(window, document));\n})();"],"sourceRoot":"/source/"} | ||
| {"version":3,"sources":["app-loading.js"],"names":["_classCallCheck","instance","Constructor","TypeError","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","prototype","definition","W","D","AppLoading","this","opts","className","loadingBar","color","value","showBar","hideBar","bar","getBar","style","backgroundColor","querySelector","classList","add","remove","initBar","createElement","substring","body","appendChild","context","name","module","exports","window","document"],"mappings":"AAMA,YAIA,SAASA,iBAAgBC,EAAUC,GAAe,KAAMD,YAAoBC,IAAgB,KAAM,IAAIC,WAAU,qCAFhH,GAAIC,cAAe,WAAe,QAASC,GAAiBC,EAAQC,GAAS,IAAK,GAAIC,GAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CAAE,GAAIE,GAAaH,EAAMC,EAAIE,GAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,SAAWF,KAAYA,EAAWG,UAAW,GAAMC,OAAOC,eAAeT,EAAQI,EAAWM,IAAKN,IAAiB,MAAO,UAAUR,EAAae,EAAYC,GAAiJ,MAA9HD,IAAYZ,EAAiBH,EAAYiB,UAAWF,GAAiBC,GAAab,EAAiBH,EAAagB,GAAqBhB,OAIjiB,WAEE,GAAIkB,GAAa,SAAoBC,EAAGC,GACtC,GAAIC,GAAa,WACf,QAASA,KACPvB,gBAAgBwB,KAAMD,GAEtBC,KAAKC,MACHC,UAAW,cACXC,WAAY,eACZC,MAAO,MAuDX,MAnDAxB,cAAamB,IACXP,IAAK,QACLa,MAAO,SAAeD,GACpBJ,KAAKM,QAAQF,MAGfZ,IAAK,OACLa,MAAO,WACLL,KAAKO,aAGPf,IAAK,UACLa,MAAO,SAAiBD,GACtB,GAAII,GAAMR,KAAKS,QACXT,MAAKC,KAAKG,QACZI,EAAIE,MAAMC,gBAAkBX,KAAKC,KAAKG,OAEpCA,IACFI,EAAIE,MAAMC,gBAAkBP,GAE9BN,EAAEc,cAAc,QAAQC,UAAUC,IAAId,KAAKC,KAAKC,cAGlDV,IAAK,UACLa,MAAO,WACLP,EAAEc,cAAc,QAAQC,UAAUE,OAAOf,KAAKC,KAAKC,WACnDF,KAAKS,SAASC,MAAMC,gBAAkB,QAGxCnB,IAAK,SACLa,MAAO,WACL,GAAIG,GAAMV,EAAEc,cAAcZ,KAAKC,KAAKE,WAIpC,OAHKK,IACHR,KAAKgB,UAEAR,KAGThB,IAAK,UACLa,MAAO,WACL,GAAIG,GAAMV,EAAEmB,cAAc,MAC1BT,GAAIN,UAAYF,KAAKC,KAAKE,WAAWe,UAAU,GAC/CpB,EAAEqB,KAAKC,YAAYZ,MAGrBhB,IAAK,WACLa,MAAO,SAAkBD,GACvBJ,KAAKC,KAAKG,MAAQA,MAIfL,IAGT,OAAO,IAAIA,KACX,SAAWsB,EAASC,EAAM1B,GACJ,mBAAX2B,QACTA,OAAOC,QAAU5B,EACW,mBAAZyB,KAChBA,EAAQC,GAAQ1B,IAEjB6B,OAAQ,aAAc7B,EAAW6B,OAAQC","file":"app-loading.min.js","sourcesContent":["/*\r\n * app-loading\r\n * (c) 2015\r\n * github.com/aprilorange/app-loading\r\n */\n\n'use strict';\n\nvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\n(function () {\n\n var definition = function definition(W, D) {\n var AppLoading = (function () {\n function AppLoading() {\n _classCallCheck(this, AppLoading);\n\n this.opts = {\n className: 'app-loading',\n loadingBar: '.loading-bar',\n color: null\n };\n }\n\n _createClass(AppLoading, [{\n key: 'start',\n value: function start(color) {\n this.showBar(color);\n }\n }, {\n key: 'stop',\n value: function stop() {\n this.hideBar();\n }\n }, {\n key: 'showBar',\n value: function showBar(color) {\n var bar = this.getBar();\n if (this.opts.color) {\n bar.style.backgroundColor = this.opts.color;\n }\n if (color) {\n bar.style.backgroundColor = color;\n }\n D.querySelector('body').classList.add(this.opts.className);\n }\n }, {\n key: 'hideBar',\n value: function hideBar() {\n D.querySelector('body').classList.remove(this.opts.className);\n this.getBar().style.backgroundColor = null;\n }\n }, {\n key: 'getBar',\n value: function getBar() {\n var bar = D.querySelector(this.opts.loadingBar);\n if (!bar) {\n this.initBar();\n }\n return bar;\n }\n }, {\n key: 'initBar',\n value: function initBar() {\n var bar = D.createElement('div');\n bar.className = this.opts.loadingBar.substring(1);\n D.body.appendChild(bar);\n }\n }, {\n key: 'setColor',\n value: function setColor(color) {\n this.opts.color = color;\n }\n }]);\n\n return AppLoading;\n })();\n\n return new AppLoading();\n };(function (context, name, definition) {\n if (typeof module !== 'undefined') {\n module.exports = definition;\n } else if (typeof context !== 'undefined') {\n context[name] = definition;\n }\n })(window, 'appLoading', definition(window, document));\n})();"],"sourceRoot":"/source/"} |
+2
-2
@@ -7,3 +7,3 @@ <!DOCTYPE html> | ||
| <title>app-loading example</title> | ||
| <link rel="stylesheet" type="text/css" href="./app-loading.css?v=0.0.41"> | ||
| <link rel="stylesheet" type="text/css" href="./app-loading.css?v=0.0.42"> | ||
| <style type="text/css"> | ||
@@ -72,4 +72,4 @@ body { | ||
| </div> | ||
| <script src="./app-loading.min.js?v=0.0.41"></script> | ||
| <script src="./app-loading.min.js?v=0.0.42"></script> | ||
| </body> | ||
| </html> |
+26
-24
@@ -1,6 +0,6 @@ | ||
| /*********************************************** | ||
| *app-loading | ||
| *(c) 2015 | ||
| *github.com/aprilorange/app-loading | ||
| ***********************************************/ | ||
| /* | ||
| * app-loading | ||
| * (c) 2015 | ||
| * github.com/aprilorange/app-loading | ||
| */ | ||
@@ -10,4 +10,4 @@ () => { | ||
| let definition = (W, D) => { | ||
| class appLoading { | ||
| constructor() { | ||
| class AppLoading { | ||
| constructor () { | ||
| this.opts = { | ||
@@ -20,18 +20,22 @@ className: 'app-loading', | ||
| start(color) { | ||
| start (color) { | ||
| this.showBar(color) | ||
| } | ||
| stop() { | ||
| stop () { | ||
| this.hideBar() | ||
| } | ||
| showBar(color) { | ||
| showBar (color) { | ||
| let bar = this.getBar() | ||
| if(this.opts.color) bar.style.backgroundColor = this.opts.color | ||
| if(color) bar.style.backgroundColor = color | ||
| if (this.opts.color) { | ||
| bar.style.backgroundColor = this.opts.color | ||
| } | ||
| if (color) { | ||
| bar.style.backgroundColor = color | ||
| } | ||
| D.querySelector('body').classList.add(this.opts.className) | ||
| } | ||
| hideBar() { | ||
| hideBar () { | ||
| D.querySelector('body').classList.remove(this.opts.className) | ||
@@ -41,9 +45,11 @@ this.getBar().style.backgroundColor = null | ||
| getBar() { | ||
| getBar () { | ||
| let bar = D.querySelector(this.opts.loadingBar) | ||
| if(!bar) this.initBar() | ||
| if (!bar) { | ||
| this.initBar() | ||
| } | ||
| return bar | ||
| } | ||
| initBar() { | ||
| initBar () { | ||
| let bar = D.createElement('div') | ||
@@ -54,3 +60,3 @@ bar.className = this.opts.loadingBar.substring(1) | ||
| setColor(color) { | ||
| setColor (color) { | ||
| this.opts.color = color | ||
@@ -61,13 +67,9 @@ } | ||
| return new appLoading() | ||
| return new AppLoading() | ||
| } | ||
| ;(context, name, definition) => { | ||
| if(typeof module !== 'undefined') { | ||
| if (typeof module !== 'undefined') { | ||
| module.exports = definition | ||
| } | ||
| else if(typeof define === 'function' && define.amd) { | ||
| define(definition) | ||
| } | ||
| else { | ||
| } else if (typeof context !== 'undefined') { | ||
| context[name] = definition | ||
@@ -74,0 +76,0 @@ } |
+5
-1
| { | ||
| "name": "app-loading", | ||
| "version": "0.0.41", | ||
| "version": "0.0.42", | ||
| "description": "Focus on Medium-like app loading style", | ||
@@ -19,2 +19,3 @@ "main": "app-loading.js", | ||
| "devDependencies": { | ||
| "babel-eslint": "^4.1.0", | ||
| "gulp": "^3.8.11", | ||
@@ -26,3 +27,6 @@ "gulp-babel": "^5.2.1", | ||
| "gulp-uglify": "^1.2.0" | ||
| }, | ||
| "standard": { | ||
| "parser": "babel-eslint" | ||
| } | ||
| } |
+2
-1
| # app-loading | ||
| Focus on Medium-like app loading style ;-) | ||
| [](https://github.com/feross/standard) | ||
| ## Quick start | ||
@@ -6,0 +7,0 @@ |
327
1.87%57
1.79%20231
-0.47%7
16.67%