app-loading
Advanced tools
Comparing version 0.0.41 to 0.0.42
@@ -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,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 @@ } |
{ | ||
"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" | ||
} | ||
} |
# app-loading | ||
Focus on Medium-like app loading style ;-) | ||
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) | ||
## Quick start | ||
@@ -6,0 +7,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
327
57
20231
7