@kasko/fe-loading-indicator 1.3.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{loader.js → kasko-loader/kasko-loader.js} +12 -4
- package/dist/spinner/spinner.js +18 -0
- package/index.js +4 -1
- package/package.json +9 -3
- package/src/kasko-loader/loader.js +88 -0
- package/src/spinner/loader.html +22 -0
- package/src/spinner/loader.js +83 -0
- package/src/spinner/loader.less +48 -0
- package/src/loader.js +0 -40
- /package/src/{loader.html → kasko-loader/loader.html} +0 -0
- /package/src/{loader.less → kasko-loader/loader.less} +0 -0
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ yarn add @kasko/fe-loading-indicator
|
|
|
15
15
|
Requiring `@kasko/fe-loading-indicator` will return string that could be injected in
|
|
16
16
|
HTML using 'HtmlWebpackPlugin'.
|
|
17
17
|
```js
|
|
18
|
-
const loader = require('@kasko/fe-loading-indicator')();
|
|
18
|
+
const loader = require('@kasko/fe-loading-indicator').kaskoLoader();
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
Module accepts configuration object, where custom CSS loading colors could be provided e.g.
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This function is used by gulp to replace LESS variables
|
|
5
|
+
* with actual values.
|
|
6
|
+
*/
|
|
7
|
+
module.exports = function () {
|
|
8
|
+
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9
|
+
|
|
10
|
+
var result = '<style title="li-loader">@keyframes spinner-loader{0%{transform:rotate(0deg)}to{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(360deg)}}.hidden{display:none}#kasko-loader-wrapper{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1500}#kasko-loader-wrapper:not(.li-loaded){background:"@overlaycolor";opacity:1}#kasko-loader{display:block;position:relative;left:50%;top:50%;width:150px;height:150px;margin:-75px 0 0 -75px;border-radius:50%;border:3px solid transparent;border-top-color:"@color1";animation:spin 2s linear infinite;z-index:1501}#kasko-loader::after,#kasko-loader::before{content:"";position:absolute;top:5px;left:5px;right:5px;bottom:5px;border-radius:50%;border:3px solid transparent;border-top-color:"@color2";animation:spin 3s linear infinite}#kasko-loader::after{top:15px;left:15px;right:15px;bottom:15px;border-top-color:"@color3";animation:spin 1.5s linear infinite}#kasko-loader-wrapper .loader-section{position:fixed;top:0;width:50%;height:100%;z-index:1500;transform:translateX(0)}.li-loaded .loader-section{background:"@overlaycolor";opacity:.9}#kasko-loader-wrapper .loader-section.section-left{left:0}#kasko-loader-wrapper .loader-section.section-right{right:0}#kasko-loader-wrapper.li-loaded .loader-section.section-left{transform:translateX(-100%);transition:all .7s .3s cubic-bezier(.645,.045,.355,1)}#kasko-loader-wrapper.li-loaded .loader-section.section-right{transform:translateX(100%);transition:all .7s .3s cubic-bezier(.645,.045,.355,1)}.li-loaded #kasko-loader{opacity:0;transition:all .3s ease-out}#kasko-loader-wrapper.li-loaded{visibility:hidden}.spinner-loader:not(:requigray){animation:spinner-loader 1500ms infinite linear;border-radius:.5em;box-shadow:#025983 1.5em 0 0 0,#025983 1.1em 1.1em 0 0,#025983 0 1.5em 0 0,#025983 -1.1em 1.1em 0 0,#025983 -1.5em 0 0 0,#025983 -1.1em -1.1em 0 0,#025983 0 -1.5em 0 0,#025983 1.1em -1.1em 0 0;display:inline-block;font-size:10px;width:1em;height:1em;margin:1.5em;overflow:hidden;text-indent:100%}</style> <div id="kasko-loader-wrapper" class="hidden"> <div id="kasko-loader"></div> <div class="loader-section section-left"></div> <div class="loader-section section-right"></div> </div> <script>"use strict";function LoadingIndicator(){var o=this,t=null;function r(o){t||function(){for(var o=0;o<document.styleSheets.length;o+=1){var r=document.styleSheets.item(o);if("li-loader"===r.title){t=r;break}}}(),t&&t.insertRule(o)}function e(o){var t=RegExp("[?&]"+o+"=([^&]*)").exec(window.location.search);if(!t)return"";var r=decodeURIComponent(t[1].replace(/[+]/g," "));try{r=JSON.parse(r)}catch(o){}return r}this.init=function(){var t=e("loader_background_color"),r=e("loader_animation_colors"),n=document.getElementById("kasko-loader-wrapper");r&&o.setAnimationColors(r),t&&o.setBackdropColor(t),n&&n.classList.remove("hidden")},this.hide=function(){var o=document.getElementById("kasko-loader-wrapper");o&&o.classList.add("li-loaded")},this.setColors=function(t){o.setAnimationColors(t)},this.setAnimationColors=function(o){r("#kasko-loader{border-top-color:"+o[0]+"!important;}"),r("#kasko-loader::before{border-top-color:"+o[1]+"!important;}"),r("#kasko-loader::after{border-top-color:"+o[2]+"!important;}")},this.setBackdropColor=function(o){r("#kasko-loader-wrapper:not(.li-loaded){background:"+o+"!important;}"),r(".li-loaded .loader-section{background:"+o+"!important;}")}}var loadingIndicator=new LoadingIndicator;window.LoadingIndicator=loadingIndicator,window.LoadingIndicator.init();</script> ';
|
|
3
11
|
|
|
4
12
|
if (!config.colors) {
|
|
5
13
|
config.colors = ['#ebbb2a', '#fff', '#a07c0f'];
|
|
@@ -9,10 +17,10 @@ module.exports = function (config = {}) {
|
|
|
9
17
|
config.overlayColor = '#222';
|
|
10
18
|
}
|
|
11
19
|
|
|
12
|
-
config.colors.forEach((color, index)
|
|
20
|
+
config.colors.forEach(function (color, index) {
|
|
13
21
|
result = result.replace('\"@color' + (index + 1) + '\"', color);
|
|
14
22
|
});
|
|
15
23
|
|
|
16
24
|
result = result.replace(/\"@overlaycolor\"/g, config.overlayColor);
|
|
17
25
|
return result;
|
|
18
|
-
}
|
|
26
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This function is used by gulp to replace LESS variables
|
|
5
|
+
* with actual values.
|
|
6
|
+
*/
|
|
7
|
+
module.exports = function () {
|
|
8
|
+
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9
|
+
|
|
10
|
+
var result = '<style title="li-loader">@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(360deg)}}.hidden{display:none}#kasko-loader-wrapper{position:fixed;top:0;left:0;width:100%;height:100%;z-index:1500}#kasko-loader-wrapper svg{display:block;position:relative;left:50%;top:50%;width:150px;height:150px;margin:-75px 0 0 -75px;z-index:1501;animation:spin 1s linear infinite}#kasko-loader-wrapper:not(.li-loaded){background:"@overlaycolor";opacity:1}.li-loaded svg{opacity:0;transition:all .3s ease-out}#kasko-loader-wrapper.li-loaded{visibility:hidden}</style> <div id="kasko-loader-wrapper" class="hidden"> <!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL --> <svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg"> <defs> <linearGradient x1="8.042%" y1="0%" x2="65.682%" y2="23.865%" id="a"> <stop stop-color="#fff" stop-opacity="0" offset="0%"/> <stop stop-color="#fff" stop-opacity=".631" offset="63.146%"/> <stop stop-color="#fff" offset="100%"/> </linearGradient> </defs> <g fill="none" fill-rule="evenodd"> <g transform="translate(1 1)"> <path d="M36 18c0-9.94-8.06-18-18-18" id="Oval-2" stroke="url(#a)" stroke-width="2"></path> <circle fill="#fff" cx="36" cy="18" r="1"></circle> </g> </g> </svg> </div> <script>"use strict";function LoadingIndicator(){var o=this,t=null;function n(o){t||function(){for(var o=0;o<document.styleSheets.length;o+=1){var n=document.styleSheets.item(o);if("li-loader"===n.title){t=n;break}}}(),t&&t.insertRule(o)}function r(o){var t=RegExp("[?&]"+o+"=([^&]*)").exec(window.location.search);if(!t)return"";var n=decodeURIComponent(t[1].replace(/[+]/g," "));try{n=JSON.parse(n)}catch(o){}return n}this.init=function(){var t=r("loader_background_color"),n=r("loader_animation_colors"),a=document.getElementById("kasko-loader-wrapper");if(n){var e="string"==typeof n?n:n[0];o.setAnimationColors(e)}t&&o.setBackdropColor(t),a&&a.classList.remove("hidden")},this.hide=function(){var o=document.getElementById("kasko-loader-wrapper");o&&o.classList.add("li-loaded")},this.setAnimationColors=function(o){n("#kasko-loader-wrapper svg stop{stop-color:"+o+"!important;}"),n("#kasko-loader-wrapper svg circle{fill:"+o+"!important;}")},this.setBackdropColor=function(o){n("#kasko-loader-wrapper:not(.li-loaded){background:"+o+"!important;}")}}var loadingIndicator=new LoadingIndicator;window.LoadingIndicator=loadingIndicator,window.LoadingIndicator.init();</script> ';
|
|
11
|
+
|
|
12
|
+
if (!config.overlayColor) {
|
|
13
|
+
config.overlayColor = '#222';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
result = result.replace(/\"@overlaycolor\"/g, config.overlayColor);
|
|
17
|
+
return result;
|
|
18
|
+
};
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kasko/fe-loading-indicator",
|
|
3
3
|
"shortname": "fe-loading-indicator",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"description": "Kasko frontend loading indicator",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"main": "index.js",
|
|
@@ -15,8 +15,13 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {},
|
|
17
17
|
"devDependencies": {
|
|
18
|
+
"babel-core": "^6.26.3",
|
|
19
|
+
"babel-preset-env": "^1.7.0",
|
|
20
|
+
"eslint": "^4.19.1",
|
|
21
|
+
"eslint-config-airbnb-base": "^12.1.0",
|
|
22
|
+
"eslint-plugin-import": "^2.12.0",
|
|
18
23
|
"gulp": "^3.9.1",
|
|
19
|
-
"gulp-
|
|
24
|
+
"gulp-babel": "^7.0.1",
|
|
20
25
|
"gulp-csso": "^3.0.0",
|
|
21
26
|
"gulp-less": "^3.3.2",
|
|
22
27
|
"gulp-minify": "^2.1.0",
|
|
@@ -25,6 +30,7 @@
|
|
|
25
30
|
},
|
|
26
31
|
"scripts": {
|
|
27
32
|
"build": "gulp",
|
|
28
|
-
"test": "
|
|
33
|
+
"test": "npm run lint",
|
|
34
|
+
"lint": "eslint src/"
|
|
29
35
|
}
|
|
30
36
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
function LoadingIndicator() {
|
|
2
|
+
let styleSheet = null;
|
|
3
|
+
|
|
4
|
+
function loadStyleSheet() {
|
|
5
|
+
for (let i = 0; i < document.styleSheets.length; i += 1) {
|
|
6
|
+
const styleSheetItem = document.styleSheets.item(i);
|
|
7
|
+
|
|
8
|
+
if (styleSheetItem.title === 'li-loader') {
|
|
9
|
+
styleSheet = styleSheetItem;
|
|
10
|
+
break;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function insertRule(rule) {
|
|
16
|
+
if (!styleSheet) {
|
|
17
|
+
loadStyleSheet();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (styleSheet) {
|
|
21
|
+
styleSheet.insertRule(rule);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getParameterByName(name) {
|
|
26
|
+
const match = RegExp(`[?&]${name}=([^&]*)`).exec(window.location.search);
|
|
27
|
+
|
|
28
|
+
if (!match) {
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let decoded = decodeURIComponent(match[1].replace(/[+]/g, ' '));
|
|
33
|
+
|
|
34
|
+
// Attempt to json-decode
|
|
35
|
+
try {
|
|
36
|
+
decoded = JSON.parse(decoded);
|
|
37
|
+
} catch (e) {
|
|
38
|
+
// Do nothing..
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return decoded;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
this.init = () => {
|
|
45
|
+
const backdropColor = getParameterByName('loader_background_color');
|
|
46
|
+
const animationColors = getParameterByName('loader_animation_colors');
|
|
47
|
+
const elementById = document.getElementById('kasko-loader-wrapper');
|
|
48
|
+
|
|
49
|
+
if (animationColors) {
|
|
50
|
+
this.setAnimationColors(animationColors);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (backdropColor) {
|
|
54
|
+
this.setBackdropColor(backdropColor);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (elementById) {
|
|
58
|
+
elementById.classList.remove('hidden');
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
this.hide = () => {
|
|
63
|
+
const elementById = document.getElementById('kasko-loader-wrapper');
|
|
64
|
+
|
|
65
|
+
if (elementById) {
|
|
66
|
+
elementById.classList.add('li-loaded');
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
this.setColors = (colors) => {
|
|
71
|
+
this.setAnimationColors(colors);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
this.setAnimationColors = (colors) => {
|
|
75
|
+
insertRule(`#kasko-loader{border-top-color:${colors[0]}!important;}`);
|
|
76
|
+
insertRule(`#kasko-loader::before{border-top-color:${colors[1]}!important;}`);
|
|
77
|
+
insertRule(`#kasko-loader::after{border-top-color:${colors[2]}!important;}`);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
this.setBackdropColor = (color) => {
|
|
81
|
+
insertRule(`#kasko-loader-wrapper:not(.li-loaded){background:${color}!important;}`);
|
|
82
|
+
insertRule(`.li-loaded .loader-section{background:${color}!important;}`);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const loadingIndicator = new LoadingIndicator();
|
|
87
|
+
window.LoadingIndicator = loadingIndicator;
|
|
88
|
+
window.LoadingIndicator.init();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<link rel="stylesheet" href="loader.css">
|
|
2
|
+
|
|
3
|
+
<div id="kasko-loader-wrapper" class="hidden">
|
|
4
|
+
<!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
|
|
5
|
+
<svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg">
|
|
6
|
+
<defs>
|
|
7
|
+
<linearGradient x1="8.042%" y1="0%" x2="65.682%" y2="23.865%" id="a">
|
|
8
|
+
<stop stop-color="#fff" stop-opacity="0" offset="0%"/>
|
|
9
|
+
<stop stop-color="#fff" stop-opacity=".631" offset="63.146%"/>
|
|
10
|
+
<stop stop-color="#fff" offset="100%"/>
|
|
11
|
+
</linearGradient>
|
|
12
|
+
</defs>
|
|
13
|
+
<g fill="none" fill-rule="evenodd">
|
|
14
|
+
<g transform="translate(1 1)">
|
|
15
|
+
<path d="M36 18c0-9.94-8.06-18-18-18" id="Oval-2" stroke="url(#a)" stroke-width="2"></path>
|
|
16
|
+
<circle fill="#fff" cx="36" cy="18" r="1"></circle>
|
|
17
|
+
</g>
|
|
18
|
+
</g>
|
|
19
|
+
</svg>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<script href="loader.js"></script>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
function LoadingIndicator() {
|
|
2
|
+
let styleSheet = null;
|
|
3
|
+
|
|
4
|
+
function loadStyleSheet() {
|
|
5
|
+
for (let i = 0; i < document.styleSheets.length; i += 1) {
|
|
6
|
+
const styleSheetItem = document.styleSheets.item(i);
|
|
7
|
+
|
|
8
|
+
if (styleSheetItem.title === 'li-loader') {
|
|
9
|
+
styleSheet = styleSheetItem;
|
|
10
|
+
break;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function insertRule(rule) {
|
|
16
|
+
if (!styleSheet) {
|
|
17
|
+
loadStyleSheet();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (styleSheet) {
|
|
21
|
+
styleSheet.insertRule(rule);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getParameterByName(name) {
|
|
26
|
+
const match = RegExp(`[?&]${name}=([^&]*)`).exec(window.location.search);
|
|
27
|
+
|
|
28
|
+
if (!match) {
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let decoded = decodeURIComponent(match[1].replace(/[+]/g, ' '));
|
|
33
|
+
|
|
34
|
+
// Attempt to json-decode
|
|
35
|
+
try {
|
|
36
|
+
decoded = JSON.parse(decoded);
|
|
37
|
+
} catch (e) {
|
|
38
|
+
// Do nothing..
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return decoded;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
this.init = () => {
|
|
45
|
+
const backdropColor = getParameterByName('loader_background_color');
|
|
46
|
+
const animationColors = getParameterByName('loader_animation_colors');
|
|
47
|
+
const elementById = document.getElementById('kasko-loader-wrapper');
|
|
48
|
+
|
|
49
|
+
if (animationColors) {
|
|
50
|
+
const color = typeof animationColors === 'string' ? animationColors : animationColors[0];
|
|
51
|
+
this.setAnimationColors(color);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (backdropColor) {
|
|
55
|
+
this.setBackdropColor(backdropColor);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (elementById) {
|
|
59
|
+
elementById.classList.remove('hidden');
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
this.hide = () => {
|
|
64
|
+
const elementById = document.getElementById('kasko-loader-wrapper');
|
|
65
|
+
|
|
66
|
+
if (elementById) {
|
|
67
|
+
elementById.classList.add('li-loaded');
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
this.setAnimationColors = (color) => {
|
|
72
|
+
insertRule(`#kasko-loader-wrapper svg stop{stop-color:${color}!important;}`);
|
|
73
|
+
insertRule(`#kasko-loader-wrapper svg circle{fill:${color}!important;}`);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
this.setBackdropColor = (color) => {
|
|
77
|
+
insertRule(`#kasko-loader-wrapper:not(.li-loaded){background:${color}!important;}`);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const loadingIndicator = new LoadingIndicator();
|
|
82
|
+
window.LoadingIndicator = loadingIndicator;
|
|
83
|
+
window.LoadingIndicator.init();
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@keyframes spin {
|
|
2
|
+
0% {
|
|
3
|
+
transform: rotate(0deg);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
100% {
|
|
7
|
+
transform: rotate(360deg);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.hidden {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
#kasko-loader-wrapper {
|
|
16
|
+
position: fixed;
|
|
17
|
+
top: 0;
|
|
18
|
+
left: 0;
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
z-index: 1500;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#kasko-loader-wrapper svg {
|
|
25
|
+
display: block;
|
|
26
|
+
position: relative;
|
|
27
|
+
left: 50%;
|
|
28
|
+
top: 50%;
|
|
29
|
+
width: 150px;
|
|
30
|
+
height: 150px;
|
|
31
|
+
margin: -75px 0 0 -75px;
|
|
32
|
+
z-index: 1501;
|
|
33
|
+
animation: spin 1s linear infinite;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
#kasko-loader-wrapper:not(.li-loaded) {
|
|
37
|
+
background: "@overlaycolor";
|
|
38
|
+
opacity: 1;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.li-loaded svg {
|
|
42
|
+
opacity: 0;
|
|
43
|
+
transition: all 0.3s ease-out;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
#kasko-loader-wrapper.li-loaded {
|
|
47
|
+
visibility: hidden;
|
|
48
|
+
}
|
package/src/loader.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
function LoadingIndicator() {
|
|
2
|
-
this.init = function () {
|
|
3
|
-
var elementById = document.getElementById('kasko-loader-wrapper');
|
|
4
|
-
|
|
5
|
-
if (elementById) {
|
|
6
|
-
elementById.classList.remove('hidden');
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
this.hide = function () {
|
|
11
|
-
const elementById = document.getElementById('kasko-loader-wrapper');
|
|
12
|
-
|
|
13
|
-
if (elementById) {
|
|
14
|
-
elementById.classList.add('li-loaded');
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
this.setColors = function (colors) {
|
|
19
|
-
var styleSheet;
|
|
20
|
-
|
|
21
|
-
for (var i = 0; i < document.styleSheets.length; i++) {
|
|
22
|
-
var styleSheetItem = document.styleSheets.item(i);
|
|
23
|
-
|
|
24
|
-
if (styleSheetItem.title === 'li-loader') {
|
|
25
|
-
styleSheet = styleSheetItem;
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (styleSheet) {
|
|
31
|
-
styleSheet.insertRule('#loader { border-top-color:' + colors[0] + '!important;}');
|
|
32
|
-
styleSheet.insertRule('#loader::before { border-top-color:' + colors[1] + '!important;}');
|
|
33
|
-
styleSheet.insertRule('#loader::after { border-top-color:' + colors[2] + '!important;}');
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const loadingIndicator = new LoadingIndicator();
|
|
39
|
-
window.LoadingIndicator = loadingIndicator;
|
|
40
|
-
window.LoadingIndicator.init();
|
|
File without changes
|
|
File without changes
|