1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update components

This commit is contained in:
Luke Pulverenti 2016-07-20 02:23:18 -04:00
parent a694661cc1
commit 9ff21cf7b8
9 changed files with 174 additions and 126 deletions

View file

@ -15,12 +15,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.4.106",
"_release": "1.4.106",
"version": "1.4.107",
"_release": "1.4.107",
"_resolution": {
"type": "version",
"tag": "1.4.106",
"commit": "a24b7adf582019433bcd1cc93c7c38495e642d89"
"tag": "1.4.107",
"commit": "924bb12b6d7c3536ee00fc1a58ac4c492c36f559"
},
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.0",

View file

@ -217,16 +217,30 @@
});
var timeout;
if (options.timeout) {
timeout = setTimeout(function () {
dialogHelper.close(dlg);
}, options.timeout);
}
return new Promise(function (resolve, reject) {
dlg.addEventListener('close', function () {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
if (selectedId != null) {
if (options.callback) {
options.callback(selectedId);
}
resolve(selectedId);
} else {
reject();
}
});

View file

@ -1,116 +1,4 @@
define(['layoutManager', 'globalize'], function (layoutManager, globalize) {
function showTvConfirm(options) {
return new Promise(function (resolve, reject) {
require(['actionsheet'], function (actionSheet) {
var items = [];
items.push({
name: globalize.translate('sharedcomponents#ButtonOk'),
id: 'ok'
});
items.push({
name: globalize.translate('sharedcomponents#ButtonCancel'),
id: 'cancel'
});
actionSheet.show({
title: options.text,
items: items
}).then(function (id) {
switch (id) {
case 'ok':
resolve();
break;
default:
reject();
break;
}
}, reject);
});
});
}
function showConfirmInternal(options, dialogHelper, resolve, reject) {
var dialogOptions = {
removeOnClose: true
};
var backButton = false;
if (layoutManager.tv) {
dialogOptions.size = 'fullscreen';
backButton = true;
dialogOptions.autoFocus = true;
} else {
dialogOptions.modal = false;
dialogOptions.entryAnimationDuration = 160;
dialogOptions.exitAnimationDuration = 160;
dialogOptions.autoFocus = false;
}
var dlg = dialogHelper.createDialog(dialogOptions);
var html = '';
if (options.title) {
html += '<h2>' + options.title + '</h2>';
}
var text = options.html || options.text;
if (text) {
html += '<div>' + text + '</div>';
}
html += '<div class="buttons">';
html += '<button is="emby-button" type="button" class="btnConfirm" autofocus>' + globalize.translate('sharedcomponents#ButtonOk') + '</button>';
html += '<button is="emby-button" type="button" class="btnCancel">' + globalize.translate('sharedcomponents#ButtonCancel') + '</button>';
html += '</div>';
dlg.innerHTML = html;
document.body.appendChild(dlg);
var confirmed = false;
dlg.querySelector('.btnConfirm').addEventListener('click', function () {
confirmed = true;
dialogHelper.close(dlg);
});
dlg.querySelector('.btnCancel').addEventListener('click', function () {
confirmed = false;
dialogHelper.close(dlg);
});
dialogHelper.open(dlg).then(function () {
if (confirmed) {
resolve();
} else {
reject();
}
});
}
function showConfirm(options) {
return new Promise(function (resolve, reject) {
require(['dialogHelper', 'emby-button'], function (dialogHelper) {
showConfirmInternal(options, dialogHelper, resolve, reject);
});
});
}
define(['dialog', 'globalize'], function (dialog, globalize) {
return function (text, title) {
@ -124,10 +12,26 @@ define(['layoutManager', 'globalize'], function (layoutManager, globalize) {
options = text;
}
if (layoutManager.tv) {
return showTvConfirm(options);
}
var items = [];
return showConfirm(options);
items.push({
name: globalize.translate('sharedcomponents#ButtonOk'),
id: 'ok'
});
items.push({
name: globalize.translate('sharedcomponents#ButtonCancel'),
id: 'cancel'
});
options.buttons = items;
return dialog(options).then(function (result) {
if (result == 'ok') {
return Promise.resolve();
}
return Promise.reject();
});
};
});

View file

@ -0,0 +1,126 @@
define(['layoutManager', 'globalize'], function (layoutManager, globalize) {
function showTvDialog(options) {
return new Promise(function (resolve, reject) {
require(['actionsheet'], function (actionSheet) {
var items = [];
items.push({
name: globalize.translate('sharedcomponents#ButtonOk'),
id: 'ok'
});
items.push({
name: globalize.translate('sharedcomponents#ButtonCancel'),
id: 'cancel'
});
actionSheet.show({
title: options.text,
items: options.buttons
}).then(resolve, reject);
});
});
}
function showDialogInternal(options, dialogHelper, resolve, reject) {
var dialogOptions = {
removeOnClose: true
};
var backButton = false;
if (layoutManager.tv) {
dialogOptions.size = 'fullscreen';
backButton = true;
dialogOptions.autoFocus = true;
} else {
dialogOptions.modal = false;
dialogOptions.entryAnimationDuration = 160;
dialogOptions.exitAnimationDuration = 160;
dialogOptions.autoFocus = true;
}
var dlg = dialogHelper.createDialog(dialogOptions);
var html = '';
if (options.title) {
html += '<h2>' + options.title + '</h2>';
}
var text = options.html || options.text;
if (text) {
html += '<div>' + text + '</div>';
}
html += '<div class="buttons">';
var i, length;
for (i = 0, length = options.buttons.length; i < length; i++) {
var item = options.buttons[i];
var autoFocus = i == 0 ? ' autofocus' : '';
html += '<button is="emby-button" type="button" class="btnOption" data-id="' + item.id + '"' + autoFocus + '>' + item.name + '</button>';
}
html += '</div>';
dlg.innerHTML = html;
document.body.appendChild(dlg);
var dialogResult;
function onButtonClick() {
dialogResult = this.getAttribute('data-id');
dialogHelper.close(dlg);
}
var buttons = dlg.querySelectorAll('.btnOption');
for (i = 0, length = options.buttons.length; i < length; i++) {
buttons[i].addEventListener('click', onButtonClick);
}
dialogHelper.open(dlg).then(function () {
if (dialogResult) {
resolve(dialogResult);
} else {
reject();
}
});
}
function showDialog(options) {
return new Promise(function (resolve, reject) {
require(['dialogHelper', 'emby-button'], function (dialogHelper) {
showDialogInternal(options, dialogHelper, resolve, reject);
});
});
}
return function (text, title) {
var options;
if (typeof text === 'string') {
options = {
title: title,
text: text
};
} else {
options = text;
}
if (layoutManager.tv) {
return showTvDialog(options);
}
return showDialog(options);
};
});

View file

@ -1,7 +1,7 @@
button.listItem {
background: transparent;
border: 0 !important;
border-bottom: 1px solid #2a2a2a !important;
border: 0;
border-bottom: 1px solid #2a2a2a;
cursor: pointer;
outline: none !important;
color: inherit;
@ -138,7 +138,7 @@ div.listItem {
transform: scale(1.025, 1.025);
}
.listItem > .fab:first-child {
.listItem > .fab:first-child, .listItem > i:first-child {
margin-left: .75em;
}

View file

@ -127,5 +127,6 @@
"TryMultiSelectMessage": "To edit multiple media items, just click and hold any poster and select the items you want to manage. Try it!",
"HeaderConfirmRecordingCancellation": "Confirm Recording Cancellation",
"MessageConfirmRecordingCancellation": "Are you sure you wish to cancel this recording?",
"Error": "Error"
"Error": "Error",
"VoiceInput": "Voice Input"
}

View file

@ -114,7 +114,7 @@ define(['dialogHelper', './voicereceiver', './voiceprocessor', 'globalize', 'emb
html += '<div class="dialogHeader">';
html += '<button is="paper-icon-button-light" class="btnCancelVoiceInput autoSize" tabindex="-1"><i class="md-icon">&#xE5C4;</i></button>';
html += '<div class="dialogHeaderTitle">';
//html += title;
html += globalize.translate('sharedcomponents#VoiceInput');
html += '</div>';
html += '</div>';

View file

@ -70,6 +70,7 @@
queue: false,
playAllFromHere: false,
queueAllFromHere: false,
sync: false,
positionTo: button
};
}

View file

@ -2175,6 +2175,8 @@ var AppInfo = {};
define("alert", [embyWebComponentsBowerPath + "/alert/alert"], returnFirstDependency);
}
define("dialog", [embyWebComponentsBowerPath + "/dialog/dialog"], returnFirstDependency);
if (preferNativeAlerts && window.confirm) {
define("confirm", [embyWebComponentsBowerPath + "/confirm/nativeconfirm"], returnFirstDependency);
} else {