mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
rework dialog
This commit is contained in:
parent
b86d2368f4
commit
996f2504b2
16 changed files with 139 additions and 179 deletions
|
@ -636,7 +636,6 @@
|
|||
resolve({
|
||||
localUser: localUser,
|
||||
name: connectUser ? connectUser.Name : (localUser ? localUser.Name : null),
|
||||
canManageServer: localUser ? localUser.Policy.IsAdministrator : false,
|
||||
imageUrl: image.url,
|
||||
supportsImageParams: image.supportsParams
|
||||
});
|
||||
|
@ -851,8 +850,8 @@
|
|||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['serverdiscovery'], function () {
|
||||
ServerDiscovery.findServers(1000).then(function (foundServers) {
|
||||
require(['serverdiscovery'], function (serverDiscovery) {
|
||||
serverDiscovery.findServers(1000).then(function (foundServers) {
|
||||
|
||||
var servers = foundServers.map(function (foundServer) {
|
||||
|
||||
|
@ -974,12 +973,12 @@
|
|||
|
||||
function beginWakeServer(server) {
|
||||
|
||||
require(['wakeonlan'], function () {
|
||||
require(['wakeonlan'], function (wakeonlan) {
|
||||
var infos = server.WakeOnLanInfos || [];
|
||||
|
||||
for (var i = 0, length = infos.length; i < length; i++) {
|
||||
|
||||
WakeOnLan.send(infos[i]);
|
||||
wakeonlan.send(infos[i]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(function (globalScope) {
|
||||
define([], function () {
|
||||
|
||||
globalScope.ServerDiscovery = {
|
||||
return {
|
||||
|
||||
findServers: function (timeoutMs) {
|
||||
|
||||
|
@ -15,4 +15,4 @@
|
|||
}
|
||||
};
|
||||
|
||||
})(window);
|
||||
});
|
|
@ -1,4 +1,4 @@
|
|||
(function (globalScope) {
|
||||
define([], function () {
|
||||
|
||||
function send(info) {
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
|||
});
|
||||
}
|
||||
|
||||
globalScope.WakeOnLan = {
|
||||
return {
|
||||
send: send
|
||||
};
|
||||
|
||||
})(window);
|
||||
});
|
|
@ -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"
|
||||
}
|
|
@ -52,7 +52,7 @@
|
|||
"tag": "v1.1.3",
|
||||
"commit": "f070288446f9e78fbe16b032ddb429a8e8015ee7"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/paper-input.git",
|
||||
"_target": "^1.0.9",
|
||||
"_originalSource": "polymerelements/paper-input"
|
||||
"_source": "git://github.com/PolymerElements/paper-input.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "PolymerElements/paper-input"
|
||||
}
|
|
@ -32,14 +32,14 @@
|
|||
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0"
|
||||
},
|
||||
"ignore": [],
|
||||
"homepage": "https://github.com/PolymerElements/paper-ripple",
|
||||
"homepage": "https://github.com/polymerelements/paper-ripple",
|
||||
"_release": "1.0.5",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.5",
|
||||
"commit": "d72e7a9a8ab518b901ed18dde492df3b87a93be5"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/paper-ripple.git",
|
||||
"_source": "git://github.com/polymerelements/paper-ripple.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "PolymerElements/paper-ripple"
|
||||
"_originalSource": "polymerelements/paper-ripple"
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
define(['fade-in-animation', 'fade-out-animation', 'paper-dialog'], function () {
|
||||
|
||||
return function (options) {
|
||||
|
||||
var title = options.title;
|
||||
var message = options.message;
|
||||
var buttons = options.buttons;
|
||||
var callback = options.callback;
|
||||
|
||||
var id = 'paperdlg' + new Date().getTime();
|
||||
|
||||
var html = '<paper-dialog id="' + id + '" role="alertdialog" entry-animation="fade-in-animation" exit-animation="fade-out-animation" with-backdrop>';
|
||||
html += '<h2>' + title + '</h2>';
|
||||
html += '<div>' + message + '</div>';
|
||||
html += '<div class="buttons">';
|
||||
|
||||
var index = 0;
|
||||
html += buttons.map(function (b) {
|
||||
|
||||
var dataIndex = ' data-index="' + index + '"';
|
||||
index++;
|
||||
return '<paper-button class="dialogButton"' + dataIndex + ' dialog-dismiss>' + b + '</paper-button>';
|
||||
|
||||
}).join('');
|
||||
|
||||
html += '</div>';
|
||||
html += '</paper-dialog>';
|
||||
|
||||
$(document.body).append(html);
|
||||
|
||||
// This timeout is obviously messy but it's unclear how to determine when the webcomponent is ready for use
|
||||
// element onload never fires
|
||||
setTimeout(function () {
|
||||
|
||||
var dlg = document.getElementById(id);
|
||||
|
||||
$('.dialogButton', dlg).on('click', function () {
|
||||
|
||||
if (callback) {
|
||||
callback(parseInt(this.getAttribute('data-index')));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Has to be assigned a z-index after the call to .open()
|
||||
dlg.addEventListener('iron-overlay-closed', function (e) {
|
||||
|
||||
dlg.parentNode.removeChild(dlg);
|
||||
});
|
||||
|
||||
dlg.open();
|
||||
|
||||
}, 300);
|
||||
};
|
||||
});
|
|
@ -66,7 +66,11 @@
|
|||
return o.ironIcon;
|
||||
}).length;
|
||||
|
||||
if (options.title && !renderIcon) {
|
||||
html += '<paper-menu style="text-align:center;">';
|
||||
} else {
|
||||
html += '<paper-menu>';
|
||||
}
|
||||
for (var i = 0, length = options.items.length; i < length; i++) {
|
||||
|
||||
var option = options.items[i];
|
||||
|
|
|
@ -70,43 +70,6 @@
|
|||
|
||||
var header = document.querySelector('.viewMenuBar');
|
||||
|
||||
var headerSearchButton = header.querySelector('.headerSearchButton');
|
||||
var btnCast = header.querySelector('.btnCast');
|
||||
|
||||
if (user.localUser) {
|
||||
btnCast.classList.remove('hide');
|
||||
|
||||
if (headerSearchButton) {
|
||||
headerSearchButton.classList.remove('hide');
|
||||
}
|
||||
|
||||
requirejs(['voice/voice'], function () {
|
||||
|
||||
if (VoiceInputManager.isSupported()) {
|
||||
header.querySelector('.headerVoiceButton').classList.remove('hide');
|
||||
} else {
|
||||
header.querySelector('.headerVoiceButton').classList.add('hide');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
btnCast.classList.add('hide');
|
||||
header.querySelector('.headerVoiceButton').classList.add('hide');
|
||||
if (headerSearchButton) {
|
||||
headerSearchButton.classList.add('hide');
|
||||
}
|
||||
}
|
||||
|
||||
var dashboardEntryHeaderButton = header.querySelector('.dashboardEntryHeaderButton');
|
||||
if (dashboardEntryHeaderButton) {
|
||||
if (user.canManageServer) {
|
||||
dashboardEntryHeaderButton.classList.remove('hide');
|
||||
} else {
|
||||
dashboardEntryHeaderButton.classList.add('hide');
|
||||
}
|
||||
}
|
||||
|
||||
if (user.name) {
|
||||
if (user.imageUrl && AppInfo.enableUserImage) {
|
||||
|
||||
|
@ -127,30 +90,60 @@
|
|||
}
|
||||
}
|
||||
|
||||
updateLocalUser(user.localUser);
|
||||
requiresUserRefresh = false;
|
||||
}
|
||||
|
||||
function removeUserFromHeader() {
|
||||
function updateLocalUser(user) {
|
||||
|
||||
var header = document.querySelector('.viewMenuBar');
|
||||
|
||||
header.querySelector('.headerVoiceButton').classList.add('hide');
|
||||
|
||||
var headerSearchButton = header.querySelector('.headerSearchButton');
|
||||
var btnCast = header.querySelector('.btnCast');
|
||||
if (btnCast) {
|
||||
btnCast.classList.add('hide');
|
||||
var dashboardEntryHeaderButton = header.querySelector('.dashboardEntryHeaderButton');
|
||||
|
||||
if (user) {
|
||||
btnCast.classList.remove('hide');
|
||||
|
||||
if (headerSearchButton) {
|
||||
headerSearchButton.classList.remove('hide');
|
||||
}
|
||||
|
||||
var headerSearchButton = header.querySelector('.headerSearchButton');
|
||||
if (dashboardEntryHeaderButton) {
|
||||
if (user.Policy.IsAdministrator) {
|
||||
dashboardEntryHeaderButton.classList.remove('hide');
|
||||
} else {
|
||||
dashboardEntryHeaderButton.classList.add('hide');
|
||||
}
|
||||
}
|
||||
|
||||
requirejs(['voice/voice'], function () {
|
||||
|
||||
if (VoiceInputManager.isSupported()) {
|
||||
header.querySelector('.headerVoiceButton').classList.remove('hide');
|
||||
} else {
|
||||
header.querySelector('.headerVoiceButton').classList.add('hide');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
btnCast.classList.add('hide');
|
||||
header.querySelector('.headerVoiceButton').classList.add('hide');
|
||||
if (headerSearchButton) {
|
||||
headerSearchButton.classList.add('hide');
|
||||
}
|
||||
|
||||
var dashboardEntryHeaderButton = header.querySelector('.dashboardEntryHeaderButton');
|
||||
if (dashboardEntryHeaderButton) {
|
||||
dashboardEntryHeaderButton.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeUserFromHeader() {
|
||||
|
||||
updateLocalUser(null);
|
||||
}
|
||||
|
||||
function bindMenuEvents() {
|
||||
|
||||
|
@ -933,15 +926,19 @@
|
|||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
||||
var mainDrawerPanel = document.querySelector('.mainDrawerPanel');
|
||||
mainDrawerPanel.addEventListener('iron-select', onMainDrawerSelect);
|
||||
|
||||
renderHeader();
|
||||
|
||||
Events.on(ConnectionManager, 'apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
|
||||
});
|
||||
|
||||
Events.on(ConnectionManager, 'localusersignedin', function () {
|
||||
Events.on(ConnectionManager, 'localusersignedin', function (e, user) {
|
||||
requiresLibraryMenuRefresh = true;
|
||||
requiresDrawerRefresh = true;
|
||||
ConnectionManager.user(window.ApiClient).then(addUserToHeader);
|
||||
ConnectionManager.user(ConnectionManager.getApiClient(user.ServerId)).then(addUserToHeader);
|
||||
});
|
||||
|
||||
Events.on(ConnectionManager, 'localusersignedout', function () {
|
||||
|
@ -954,11 +951,6 @@
|
|||
updateCastIcon();
|
||||
});
|
||||
|
||||
var mainDrawerPanel = document.querySelector('.mainDrawerPanel');
|
||||
mainDrawerPanel.addEventListener('iron-select', onMainDrawerSelect);
|
||||
|
||||
renderHeader();
|
||||
|
||||
})(window, document, jQuery, window.devicePixelRatio);
|
||||
|
||||
(function () {
|
||||
|
|
|
@ -392,25 +392,46 @@
|
|||
|
||||
if (playerInfo.supportedCommands.indexOf('EndSession') != -1) {
|
||||
|
||||
var options = {
|
||||
callback: function (result) {
|
||||
var menuItems = [];
|
||||
|
||||
if (result == 0) {
|
||||
MediaController.getCurrentPlayer().endSession();
|
||||
}
|
||||
|
||||
if (result != 2) {
|
||||
self.setDefaultPlayerActive();
|
||||
}
|
||||
},
|
||||
message: Globalize.translate('ConfirmEndPlayerSession'),
|
||||
title: Globalize.translate('HeaderDisconnectFromPlayer'),
|
||||
buttons: [Globalize.translate('ButtonYes'), Globalize.translate('ButtonNo'), Globalize.translate('ButtonCancel')]
|
||||
};
|
||||
|
||||
require(['dialog'], function (dialog) {
|
||||
dialog(options);
|
||||
menuItems.push({
|
||||
name: Globalize.translate('ButtonYes'),
|
||||
id: 'yes'
|
||||
});
|
||||
menuItems.push({
|
||||
name: Globalize.translate('ButtonNo'),
|
||||
id: 'no'
|
||||
});
|
||||
menuItems.push({
|
||||
name: Globalize.translate('ButtonCancel'),
|
||||
id: 'cancel'
|
||||
});
|
||||
|
||||
require(['actionsheet'], function () {
|
||||
|
||||
ActionSheetElement.show({
|
||||
items: menuItems,
|
||||
//positionTo: positionTo,
|
||||
title: Globalize.translate('ConfirmEndPlayerSession'),
|
||||
callback: function (id) {
|
||||
|
||||
switch (id) {
|
||||
|
||||
case 'yes':
|
||||
MediaController.getCurrentPlayer().endSession();
|
||||
self.setDefaultPlayerActive();
|
||||
break;
|
||||
case 'no':
|
||||
self.setDefaultPlayerActive();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
|
|
@ -1789,10 +1789,14 @@ var AppInfo = {};
|
|||
paths.dialog = "cordova/dialog";
|
||||
paths.prompt = "cordova/prompt";
|
||||
paths.sharingwidget = "cordova/sharingwidget";
|
||||
paths.serverdiscovery = "cordova/serverdiscovery";
|
||||
paths.wakeonlan = "cordova/wakeonlan";
|
||||
} else {
|
||||
paths.dialog = "components/dialog";
|
||||
paths.prompt = "components/prompt";
|
||||
paths.sharingwidget = "components/sharingwidget";
|
||||
paths.serverdiscovery = "apiclient/serverdiscovery";
|
||||
paths.wakeonlan = "apiclient/wakeonlan";
|
||||
}
|
||||
|
||||
var sha1Path = bowerPath + "/cryptojslib/components/sha1-min";
|
||||
|
@ -1904,13 +1908,6 @@ var AppInfo = {};
|
|||
return appStorage;
|
||||
});
|
||||
}
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
define("serverdiscovery", ["cordova/serverdiscovery"]);
|
||||
define("wakeonlan", ["cordova/wakeonlan"]);
|
||||
} else {
|
||||
define("serverdiscovery", ["apiclient/serverdiscovery"]);
|
||||
define("wakeonlan", ["apiclient/wakeonlan"]);
|
||||
}
|
||||
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
define("localassetmanager", ["cordova/localassetmanager"]);
|
||||
|
@ -1980,7 +1977,7 @@ var AppInfo = {};
|
|||
define("fileupload", ["apiclient/fileupload"]);
|
||||
}
|
||||
|
||||
define("buttonenabled", ["components/buttonenabled"]);
|
||||
define("buttonenabled", ["legacy/buttonenabled"]);
|
||||
|
||||
var deps = [];
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
var page = $(form).parents('.page');
|
||||
var page = $(form).parents('.page')[0];
|
||||
|
||||
SupporterKeyPage.load(page);
|
||||
});
|
||||
|
|
|
@ -882,7 +882,7 @@
|
|||
"ButtonGuide": "Guide",
|
||||
"ButtonRecordedTv": "Recorded TV",
|
||||
"HeaderDisconnectFromPlayer": "Disconnect from Player",
|
||||
"ConfirmEndPlayerSession": "Would you like to shutdown the app on the remote device?",
|
||||
"ConfirmEndPlayerSession": "Would you like to close Emby on the device?",
|
||||
"ButtonYes": "Yes",
|
||||
"ButtonNo": "No",
|
||||
"ButtonRestorePreviousPurchase": "Restore Purchase",
|
||||
|
|
|
@ -892,7 +892,7 @@
|
|||
"ButtonGuide": "Guide",
|
||||
"ButtonRecordedTv": "Recorded TV",
|
||||
"HeaderDisconnectFromPlayer": "Disconnect from Player",
|
||||
"ConfirmEndPlayerSession": "Would you like to shutdown the app on the remote device?",
|
||||
"ConfirmEndPlayerSession": "Would you like to close Emby on the device?",
|
||||
"ButtonYes": "Yes",
|
||||
"ButtonNo": "No",
|
||||
"ButtonRestorePreviousPurchase": "Restore Purchase",
|
||||
|
|
|
@ -59,21 +59,23 @@
|
|||
|
||||
function onIconClick() {
|
||||
|
||||
require(['dialog'], function (dialog) {
|
||||
dialog({
|
||||
// todo: switch this to action sheet
|
||||
|
||||
title: "Happy Halloween",
|
||||
message: "Happy Halloween from the Emby Team. We hope your Halloween is spooktacular! Would you like to allow the Halloween theme to continue?",
|
||||
callback: function (result) {
|
||||
//require(['dialog'], function (dialog) {
|
||||
// dialog({
|
||||
|
||||
if (result == 1) {
|
||||
destroyTheme();
|
||||
}
|
||||
},
|
||||
// title: "Happy Halloween",
|
||||
// message: "Happy Halloween from the Emby Team. We hope your Halloween is spooktacular! Would you like to allow the Halloween theme to continue?",
|
||||
// callback: function (result) {
|
||||
|
||||
buttons: [Globalize.translate('ButtonYes'), Globalize.translate('ButtonNo')]
|
||||
});
|
||||
});
|
||||
// if (result == 1) {
|
||||
// destroyTheme();
|
||||
// }
|
||||
// },
|
||||
|
||||
// buttons: [Globalize.translate('ButtonYes'), Globalize.translate('ButtonNo')]
|
||||
// });
|
||||
//});
|
||||
}
|
||||
|
||||
function destroyTheme() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue