-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmaterial-loading.js
More file actions
23 lines (23 loc) · 900 Bytes
/
material-loading.js
File metadata and controls
23 lines (23 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
ml_state = false;
ml_ready = false;
function materialLoading(state){
if(state && ml_ready) document.getElementById('materialLoading').className = 'show';
else if(ml_ready) document.getElementById('materialLoading').className = 'hide';
ml_state = state;
}
window.addEventListener('load', function(){
console.log('material-loading.js v1.2')
var ml = document.createElement('div');
ml.id = 'materialLoading';
ml.className = 'hide';
var mlCentered = document.createElement('div');
mlCentered.id = 'materialLoadingCentered'
var mlContent = document.createElement('div');
mlContent.id = 'materialLoadingContent';
mlContent.innerHTML = '<div class="mdl-spinner mdl-spinner--single-color mdl-js-spinner is-active"></div>';
mlCentered.appendChild(mlContent);
ml.appendChild(mlCentered);
document.body.appendChild(ml);
ml_ready = true;
materialLoading(ml_state);
})