jellyfin-web/dashboard-ui/bower_components/emby-webcomponents/loading/loading-lite.js

34 lines
2.0 KiB
JavaScript
Raw Normal View History

define(['css!./loading-lite'], function () {
2016-10-17 22:06:48 -07:00
'use strict';
2016-03-09 10:40:22 -07:00
2016-05-15 18:22:22 -07:00
var loadingElem;
2016-03-09 10:40:22 -07:00
return {
show: function () {
2016-05-15 18:22:22 -07:00
var elem = loadingElem;
2016-03-09 10:40:22 -07:00
if (!elem) {
elem = document.createElement("div");
2016-05-15 18:22:22 -07:00
loadingElem = elem;
2016-03-09 10:40:22 -07:00
elem.classList.add('docspinner');
elem.classList.add('mdl-spinner');
2016-08-01 22:55:52 -07:00
elem.innerHTML = '<div class="mdl-spinner__layer mdl-spinner__layer-1"><div class="mdl-spinner__circle-clipper mdl-spinner__left"><div class="mdl-spinner__circle mdl-spinner__circleLeft"></div></div><div class="mdl-spinner__circle-clipper mdl-spinner__right"><div class="mdl-spinner__circle mdl-spinner__circleRight"></div></div></div><div class="mdl-spinner__layer mdl-spinner__layer-2"><div class="mdl-spinner__circle-clipper mdl-spinner__left"><div class="mdl-spinner__circle mdl-spinner__circleLeft"></div></div><div class="mdl-spinner__circle-clipper mdl-spinner__right"><div class="mdl-spinner__circle mdl-spinner__circleRight"></div></div></div><div class="mdl-spinner__layer mdl-spinner__layer-3"><div class="mdl-spinner__circle-clipper mdl-spinner__left"><div class="mdl-spinner__circle mdl-spinner__circleLeft"></div></div><div class="mdl-spinner__circle-clipper mdl-spinner__right"><div class="mdl-spinner__circle mdl-spinner__circleRight"></div></div></div><div class="mdl-spinner__layer mdl-spinner__layer-4"><div class="mdl-spinner__circle-clipper mdl-spinner__left"><div class="mdl-spinner__circle mdl-spinner__circleLeft"></div></div><div class="mdl-spinner__circle-clipper mdl-spinner__right"><div class="mdl-spinner__circle mdl-spinner__circleRight"></div></div></div>';
2016-03-09 10:40:22 -07:00
document.body.appendChild(elem);
}
2016-08-01 22:55:52 -07:00
elem.classList.add('mdlSpinnerActive');
2016-03-09 10:40:22 -07:00
},
hide: function () {
2016-05-15 18:22:22 -07:00
var elem = loadingElem;
2016-03-09 10:40:22 -07:00
if (elem) {
2016-08-01 22:55:52 -07:00
elem.classList.remove('mdlSpinnerActive');
2016-03-09 10:40:22 -07:00
}
}
};
});