mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Unminify using 1.5.323
Repo with tag: https://github.com/MediaBrowser/emby-webcomponents/tree/1.5.323
This commit is contained in:
parent
4678528d00
commit
de6ac33ec1
289 changed files with 78483 additions and 54701 deletions
|
@ -1,29 +1,99 @@
|
|||
define(["browser", "dom", "layoutManager", "shell", "appRouter", "apphost", "css!./emby-button", "registerElement"], function(browser, dom, layoutManager, shell, appRouter, appHost) {
|
||||
"use strict";
|
||||
define(['browser', 'dom', 'layoutManager', 'shell', 'appRouter', 'apphost', 'css!./emby-button', 'registerElement'], function (browser, dom, layoutManager, shell, appRouter, appHost) {
|
||||
'use strict';
|
||||
|
||||
var EmbyButtonPrototype = Object.create(HTMLButtonElement.prototype);
|
||||
var EmbyLinkButtonPrototype = Object.create(HTMLAnchorElement.prototype);
|
||||
|
||||
function openPremiumInfo() {
|
||||
require(["registrationServices"], function(registrationServices) {
|
||||
registrationServices.showPremiereInfo()
|
||||
})
|
||||
|
||||
require(['registrationServices'], function (registrationServices) {
|
||||
registrationServices.showPremiereInfo();
|
||||
});
|
||||
}
|
||||
|
||||
function onAnchorClick(e) {
|
||||
var href = this.getAttribute("href") || "";
|
||||
"#" !== href ? this.getAttribute("target") ? -1 === href.indexOf("emby.media/premiere") || appHost.supports("externalpremium") ? appHost.supports("targetblank") || (e.preventDefault(), shell.openUrl(href)) : (e.preventDefault(), openPremiumInfo()) : appRouter.handleAnchorClick(e) : e.preventDefault()
|
||||
|
||||
var href = this.getAttribute('href') || '';
|
||||
|
||||
if (href !== '#') {
|
||||
|
||||
if (this.getAttribute('target')) {
|
||||
if (href.indexOf('emby.media/premiere') !== -1 && !appHost.supports('externalpremium')) {
|
||||
e.preventDefault();
|
||||
openPremiumInfo();
|
||||
}
|
||||
else if (!appHost.supports('targetblank')) {
|
||||
e.preventDefault();
|
||||
shell.openUrl(href);
|
||||
}
|
||||
} else {
|
||||
appRouter.handleAnchorClick(e);
|
||||
}
|
||||
} else {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
var EmbyButtonPrototype = Object.create(HTMLButtonElement.prototype),
|
||||
EmbyLinkButtonPrototype = Object.create(HTMLAnchorElement.prototype);
|
||||
return EmbyButtonPrototype.createdCallback = function() {
|
||||
this.classList.contains("emby-button") || (this.classList.add("emby-button"), browser.firefox && this.classList.add("button-link-inline"), layoutManager.tv && ("false" !== this.getAttribute("data-focusscale") && this.classList.add("emby-button-focusscale"), this.classList.add("emby-button-tv")))
|
||||
}, EmbyButtonPrototype.attachedCallback = function() {
|
||||
"A" === this.tagName && (dom.removeEventListener(this, "click", onAnchorClick, {}), dom.addEventListener(this, "click", onAnchorClick, {}), "true" === this.getAttribute("data-autohide") && (appHost.supports("externallinks") ? this.classList.remove("hide") : this.classList.add("hide")))
|
||||
}, EmbyButtonPrototype.detachedCallback = function() {
|
||||
dom.removeEventListener(this, "click", onAnchorClick, {})
|
||||
}, EmbyLinkButtonPrototype.createdCallback = EmbyButtonPrototype.createdCallback, EmbyLinkButtonPrototype.attachedCallback = EmbyButtonPrototype.attachedCallback, document.registerElement("emby-button", {
|
||||
|
||||
EmbyButtonPrototype.createdCallback = function () {
|
||||
|
||||
if (this.classList.contains('emby-button')) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.classList.add('emby-button');
|
||||
|
||||
if (browser.firefox) {
|
||||
// a ff hack is needed for vertical alignment
|
||||
this.classList.add('button-link-inline');
|
||||
}
|
||||
|
||||
if (layoutManager.tv) {
|
||||
if (this.getAttribute('data-focusscale') !== 'false') {
|
||||
this.classList.add('emby-button-focusscale');
|
||||
}
|
||||
this.classList.add('emby-button-tv');
|
||||
}
|
||||
};
|
||||
|
||||
EmbyButtonPrototype.attachedCallback = function () {
|
||||
|
||||
if (this.tagName === 'A') {
|
||||
|
||||
dom.removeEventListener(this, 'click', onAnchorClick, {
|
||||
});
|
||||
|
||||
dom.addEventListener(this, 'click', onAnchorClick, {
|
||||
});
|
||||
|
||||
if (this.getAttribute('data-autohide') === 'true') {
|
||||
if (appHost.supports('externallinks')) {
|
||||
this.classList.remove('hide');
|
||||
} else {
|
||||
this.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
EmbyButtonPrototype.detachedCallback = function () {
|
||||
|
||||
dom.removeEventListener(this, 'click', onAnchorClick, {
|
||||
});
|
||||
};
|
||||
|
||||
EmbyLinkButtonPrototype.createdCallback = EmbyButtonPrototype.createdCallback;
|
||||
EmbyLinkButtonPrototype.attachedCallback = EmbyButtonPrototype.attachedCallback;
|
||||
|
||||
document.registerElement('emby-button', {
|
||||
prototype: EmbyButtonPrototype,
|
||||
extends: "button"
|
||||
}), document.registerElement("emby-linkbutton", {
|
||||
extends: 'button'
|
||||
});
|
||||
|
||||
document.registerElement('emby-linkbutton', {
|
||||
prototype: EmbyLinkButtonPrototype,
|
||||
extends: "a"
|
||||
}), EmbyButtonPrototype
|
||||
extends: 'a'
|
||||
});
|
||||
|
||||
// For extension purposes
|
||||
return EmbyButtonPrototype;
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue