jellyfin-web/dashboard-ui/components/appfooter/appfooter.js

56 lines
1.2 KiB
JavaScript
Raw Normal View History

2016-08-15 11:18:05 -07:00
define(['css!./appfooter'], function () {
function render(options) {
var elem = document.createElement('div');
elem.classList.add('appfooter');
document.body.appendChild(elem);
return elem;
}
function initHeadRoom(instance, elem) {
2016-08-15 19:40:29 -07:00
require(["headroom-window"], function (headroom) {
self.headroom = headroom;
headroom.add(elem);
2016-08-15 11:18:05 -07:00
});
}
2016-08-22 13:47:16 -07:00
function appFooter(options) {
2016-08-15 11:18:05 -07:00
var self = this;
self.element = render(options);
self.add = function (elem) {
self.element.appendChild(elem);
};
self.insert = function (elem) {
if (typeof elem === 'string') {
self.element.insertAdjacentHTML('afterbegin', elem);
} else {
self.element.insertBefore(elem, self.element.firstChild);
}
};
initHeadRoom(self, self.element);
}
2016-08-22 13:47:16 -07:00
appFooter.prototype.destroy = function () {
2016-08-15 11:18:05 -07:00
var self = this;
if (self.headroom) {
2016-08-15 19:40:29 -07:00
self.headroom.remove(self.element);
self.headroom = null;
2016-08-15 11:18:05 -07:00
}
2016-08-15 19:40:29 -07:00
self.element = null;
2016-08-15 11:18:05 -07:00
};
2016-08-22 13:47:16 -07:00
return appFooter;
2016-08-15 11:18:05 -07:00
});