mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fixes #1277 - Web: Wrong position of image and buttons during "Play To"
This commit is contained in:
parent
781f63d9ac
commit
b6040d998e
8 changed files with 92 additions and 164 deletions
|
@ -14,12 +14,12 @@
|
|||
},
|
||||
"devDependencies": {},
|
||||
"ignore": [],
|
||||
"version": "1.4.169",
|
||||
"_release": "1.4.169",
|
||||
"version": "1.4.170",
|
||||
"_release": "1.4.170",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "1.4.169",
|
||||
"commit": "af6acc90c4ff89041c8f0be115ec132389e7805b"
|
||||
"tag": "1.4.170",
|
||||
"commit": "61f0b1c9783d19db9b76882badbf575500dea6e9"
|
||||
},
|
||||
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
|
||||
"_target": "^1.2.1",
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
}
|
||||
|
||||
.formDialogHeaderTitle {
|
||||
margin-left: .75em;
|
||||
margin-left: .5em;
|
||||
}
|
||||
|
||||
.formDialogContent {
|
||||
|
|
|
@ -59,14 +59,20 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
} catch (err) {
|
||||
if (options.actions) {
|
||||
options.actions = [];
|
||||
show(title, options, timeoutMs);
|
||||
showNonPersistentNotification(title, options, timeoutMs);
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function show(title, options, timeoutMs) {
|
||||
function showNotification(options, timeoutMs, apiClient) {
|
||||
|
||||
var title = options.title;
|
||||
|
||||
options.data = options.data || {};
|
||||
options.data.serverId = apiClient.serverInfo().Id;
|
||||
options.icon = options.icon || getIconUrl();
|
||||
|
||||
resetRegistration();
|
||||
|
||||
|
@ -103,7 +109,7 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
});
|
||||
}
|
||||
|
||||
show(notification.title, notification, 15000);
|
||||
showNotification(notification, 15000, apiClient);
|
||||
}
|
||||
|
||||
function onLibraryChanged(data, apiClient) {
|
||||
|
@ -140,6 +146,9 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
}
|
||||
|
||||
function getIconUrl(name) {
|
||||
|
||||
name = name || 'notificationicon.png';
|
||||
|
||||
return require.toUrl('.').split('?')[0] + '/' + name;
|
||||
}
|
||||
|
||||
|
@ -153,8 +162,7 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
|
||||
var notification = {
|
||||
tag: "install" + installation.Id,
|
||||
data: {},
|
||||
icon: getIconUrl('/notificationicon.png')
|
||||
data: {}
|
||||
};
|
||||
|
||||
if (status == 'completed') {
|
||||
|
@ -173,8 +181,14 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
|
||||
notification.actions =
|
||||
[
|
||||
{ action: 'cancel-install-' + installation.Id, title: globalize.translate('sharedcomponents#ButtonCancel')/*, icon: 'https://example/like.png'*/ }
|
||||
{
|
||||
action: 'cancel-install',
|
||||
title: globalize.translate('sharedcomponents#ButtonCancel'),
|
||||
icon: getIconUrl()
|
||||
}
|
||||
];
|
||||
|
||||
notification.data.id = installation.id;
|
||||
}
|
||||
|
||||
if (status == 'progress') {
|
||||
|
@ -186,7 +200,7 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
|
||||
var timeout = status == 'cancelled' ? 5000 : 0;
|
||||
|
||||
show(notification.title, notification, timeout);
|
||||
showNotification(notification, timeout, apiClient);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -210,4 +224,41 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
showPackageInstallNotification(apiClient, data, "progress");
|
||||
});
|
||||
|
||||
events.on(serverNotifications, 'ServerShuttingDown', function (e, apiClient, data) {
|
||||
var serverId = apiClient.serverInfo().Id;
|
||||
var notification = {
|
||||
tag: "restart" + serverId,
|
||||
title: globalize.translate('sharedcomponents#ServerNameIsShuttingDown', apiClient.serverInfo().Name)
|
||||
};
|
||||
showNotification(notification, 0, apiClient);
|
||||
});
|
||||
|
||||
events.on(serverNotifications, 'ServerRestarting', function (e, apiClient, data) {
|
||||
var serverId = apiClient.serverInfo().Id;
|
||||
var notification = {
|
||||
tag: "restart" + serverId,
|
||||
title: globalize.translate('sharedcomponents#ServerNameIsRestarting', apiClient.serverInfo().Name)
|
||||
};
|
||||
showNotification(notification, 0, apiClient);
|
||||
});
|
||||
|
||||
events.on(serverNotifications, 'RestartRequired', function (e, apiClient, data) {
|
||||
|
||||
var serverId = apiClient.serverInfo().Id;
|
||||
var notification = {
|
||||
tag: "restart" + serverId,
|
||||
title: globalize.translate('sharedcomponents#PleaseRestartServerName', apiClient.serverInfo().Name)
|
||||
};
|
||||
|
||||
notification.actions =
|
||||
[
|
||||
{
|
||||
action: 'restart',
|
||||
title: globalize.translate('sharedcomponents#ButtonRestart'),
|
||||
icon: getIconUrl()
|
||||
}
|
||||
];
|
||||
|
||||
showNotification(notification, 0, apiClient);
|
||||
});
|
||||
});
|
|
@ -24,6 +24,7 @@
|
|||
"ButtonOk": "Ok",
|
||||
"ButtonCancel": "Cancel",
|
||||
"ButtonGotIt": "Got It",
|
||||
"ButtonRestart": "Restart",
|
||||
"RecordingCancelled": "Recording cancelled.",
|
||||
"RecordingScheduled": "Recording scheduled.",
|
||||
"SeriesRecordingScheduled": "Series recording scheduled.",
|
||||
|
@ -248,5 +249,8 @@
|
|||
"MessageItemSaved": "Item saved.",
|
||||
"SearchResults": "Search Results",
|
||||
"SyncToOtherDevice": "Sync to other device",
|
||||
"MakeAvailableOffline": "Make available offline"
|
||||
"MakeAvailableOffline": "Make available offline",
|
||||
"ServerNameIsRestarting": "Emby Server - {0} is restarting.",
|
||||
"ServerNameIsShuttingDown": "Emby Server - {0} is shutting down.",
|
||||
"PleaseRestartServerName": "Please restart Emby Server - {0}."
|
||||
}
|
|
@ -26,14 +26,14 @@
|
|||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"main": "iron-meta.html",
|
||||
"homepage": "https://github.com/polymerelements/iron-meta",
|
||||
"homepage": "https://github.com/PolymerElements/iron-meta",
|
||||
"_release": "1.1.1",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.1.1",
|
||||
"commit": "e171ee234b482219c9514e6f9551df48ef48bd9f"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/iron-meta.git",
|
||||
"_source": "git://github.com/PolymerElements/iron-meta.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "polymerelements/iron-meta"
|
||||
"_originalSource": "PolymerElements/iron-meta"
|
||||
}
|
|
@ -387,26 +387,6 @@ textarea {
|
|||
}
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
#footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
/* Above everything, except for the video player and popup overlays */
|
||||
z-index: 1097;
|
||||
color: #fff;
|
||||
border: 0 !important;
|
||||
background-color: rgba(26,26,26,.94);
|
||||
}
|
||||
|
||||
.footerNotification {
|
||||
padding: .75em 1em;
|
||||
margin: 0;
|
||||
font-weight: normal;
|
||||
border-top: 1px solid #555;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gradient Shadow
|
||||
*/
|
||||
|
|
|
@ -154,17 +154,8 @@ var Dashboard = {
|
|||
|
||||
if (info.HasPendingRestart) {
|
||||
|
||||
Dashboard.getCurrentUser().then(function (currentUser) {
|
||||
|
||||
if (currentUser.Policy.IsAdministrator) {
|
||||
Dashboard.showServerRestartWarning(info);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
Dashboard.hideServerRestartWarning();
|
||||
|
||||
if (Dashboard.initialServerVersion != info.Version && !AppInfo.isNativeApp) {
|
||||
|
||||
window.location.reload(true);
|
||||
|
@ -172,98 +163,6 @@ var Dashboard = {
|
|||
}
|
||||
},
|
||||
|
||||
showServerRestartWarning: function (systemInfo) {
|
||||
|
||||
if (AppInfo.isNativeApp) {
|
||||
return;
|
||||
}
|
||||
|
||||
var html = '<span style="margin-right: 1em;">' + Globalize.translate('MessagePleaseRestart') + '</span>';
|
||||
|
||||
if (systemInfo.CanSelfRestart) {
|
||||
html += '<button is="emby-button" type="button" class="raised submit mini" onclick="this.disabled=\'disabled\';Dashboard.restartServer();"><i class="md-icon">refresh</i><span>' + Globalize.translate('ButtonRestart') + '</span></button>';
|
||||
}
|
||||
|
||||
Dashboard.showFooterNotification({ id: "serverRestartWarning", html: html, forceShow: true, allowHide: false });
|
||||
},
|
||||
|
||||
hideServerRestartWarning: function () {
|
||||
|
||||
var elem = document.getElementById('serverRestartWarning');
|
||||
if (elem) {
|
||||
elem.parentNode.removeChild(elem);
|
||||
}
|
||||
},
|
||||
|
||||
showFooterNotification: function (options) {
|
||||
|
||||
var removeOnHide = !options.id;
|
||||
|
||||
options.id = options.id || "notification" + new Date().getTime() + parseInt(Math.random());
|
||||
|
||||
if (!document.querySelector(".footer")) {
|
||||
|
||||
var footerHtml = '<div id="footer" class="footer" data-theme="b" class="ui-bar-b">';
|
||||
|
||||
footerHtml += '<div id="footerNotifications"></div>';
|
||||
footerHtml += '</div>';
|
||||
|
||||
document.body.insertAdjacentHTML('beforeend', footerHtml);
|
||||
}
|
||||
|
||||
var footer = document.querySelector('.footer');
|
||||
footer.style.top = 'initial';
|
||||
footer.classList.remove('hide');
|
||||
|
||||
var parentElem = footer.querySelector('#footerNotifications');
|
||||
|
||||
var notificationElementId = 'notification' + options.id;
|
||||
|
||||
var elem = parentElem.querySelector('#' + notificationElementId);
|
||||
|
||||
if (!elem) {
|
||||
parentElem.insertAdjacentHTML('beforeend', '<p id="' + notificationElementId + '" class="footerNotification"></p>');
|
||||
elem = parentElem.querySelector('#' + notificationElementId);
|
||||
}
|
||||
|
||||
var onclick = removeOnHide ? "jQuery('#" + notificationElementId + "').trigger('notification.remove').remove();" : "jQuery('#" + notificationElementId + "').trigger('notification.hide').hide();";
|
||||
|
||||
if (options.allowHide !== false) {
|
||||
options.html += '<span style="margin-left: 1em;"><button is="emby-button" type="button" class="submit" onclick="' + onclick + '">' + Globalize.translate('ButtonHide') + "</button></span>";
|
||||
}
|
||||
|
||||
if (options.forceShow) {
|
||||
elem.classList.remove('hide');
|
||||
}
|
||||
|
||||
elem.innerHTML = options.html;
|
||||
|
||||
if (options.timeout) {
|
||||
|
||||
setTimeout(function () {
|
||||
|
||||
if (removeOnHide) {
|
||||
$(elem).trigger("notification.remove").remove();
|
||||
} else {
|
||||
$(elem).trigger("notification.hide").hide();
|
||||
}
|
||||
|
||||
}, options.timeout);
|
||||
}
|
||||
|
||||
$(footer).on("notification.remove notification.hide", function (e) {
|
||||
|
||||
setTimeout(function () { // give the DOM time to catch up
|
||||
|
||||
if (!parentElem.innerHTML) {
|
||||
footer.classList.add('hide');
|
||||
}
|
||||
|
||||
}, 50);
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
getConfigurationPageUrl: function (name) {
|
||||
return "configurationpage?name=" + encodeURIComponent(name);
|
||||
},
|
||||
|
@ -370,20 +269,6 @@ var Dashboard = {
|
|||
});
|
||||
},
|
||||
|
||||
refreshSystemInfoFromServer: function () {
|
||||
|
||||
var apiClient = ApiClient;
|
||||
|
||||
if (apiClient && apiClient.accessToken()) {
|
||||
if (AppInfo.enableFooterNotifications) {
|
||||
apiClient.getSystemInfo().then(function (info) {
|
||||
|
||||
Dashboard.updateSystemInfo(info);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
restartServer: function () {
|
||||
|
||||
var apiClient = window.ApiClient;
|
||||
|
@ -698,13 +583,7 @@ var Dashboard = {
|
|||
|
||||
var msg = data;
|
||||
|
||||
if (msg.MessageType === "ServerShuttingDown") {
|
||||
Dashboard.hideServerRestartWarning();
|
||||
}
|
||||
else if (msg.MessageType === "ServerRestarting") {
|
||||
Dashboard.hideServerRestartWarning();
|
||||
}
|
||||
else if (msg.MessageType === "SystemInfo") {
|
||||
if (msg.MessageType === "SystemInfo") {
|
||||
Dashboard.updateSystemInfo(msg.Data);
|
||||
}
|
||||
else if (msg.MessageType === "RestartRequired") {
|
||||
|
|
|
@ -100,14 +100,28 @@ self.addEventListener('activate', function (event) {
|
|||
});
|
||||
|
||||
self.addEventListener('notificationclick', function (event) {
|
||||
event.notification.close();
|
||||
|
||||
var notification = event.notification;
|
||||
notification.close();
|
||||
|
||||
var data = notification.data;
|
||||
var serverId = data.serverId;
|
||||
var action = event.action;
|
||||
var promise;
|
||||
|
||||
if (action.indexOf('cancel-install') == 0) {
|
||||
var id = action.split('-')[2];
|
||||
switch (action) {
|
||||
case 'cancel-install':
|
||||
var id = data.id;
|
||||
console.log('cancel: ' + id);
|
||||
} else {
|
||||
clients.openWindow("/index.html");
|
||||
break;
|
||||
case 'restart':
|
||||
break;
|
||||
default:
|
||||
clients.openWindow("/");
|
||||
break;
|
||||
}
|
||||
|
||||
promise = promise || Promise.resolve();
|
||||
event.waitUntil(promise);
|
||||
|
||||
}, false);
|
Loading…
Add table
Add a link
Reference in a new issue