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

fix language dropdown

This commit is contained in:
Luke Pulverenti 2015-11-29 14:44:15 -05:00
parent 3c30ee6e81
commit 039dcc8f8c
24 changed files with 154 additions and 82 deletions

View file

@ -100,6 +100,24 @@
setTimeout(function () {
var dlg = document.getElementById(id);
// The animations flicker in IE and Firefox (probably wherever the polyfill is used)
if (browserInfo.chrome) {
dlg.animationConfig = {
// scale up
'entry': {
name: 'scale-up-animation',
node: dlg,
timing: { duration: 160, easing: 'ease-out' }
},
// fade out
'exit': {
name: 'fade-out-animation',
node: dlg,
timing: { duration: 200, easing: 'ease-in' }
}
};
}
dlg.open();
// Has to be assigned a z-index after the call to .open()

View file

@ -38,8 +38,8 @@
loadExternalIds(page, item, metadataEditorInfo.ExternalIdInfos);
Dashboard.populateLanguages($('#selectLanguage', page), languages);
Dashboard.populateCountries($('#selectCountry', page), countries);
populateLanguages(page.querySelector('#selectLanguage'), languages);
populateCountries(page.querySelector('#selectCountry'), countries);
LibraryBrowser.renderName(item, $('.itemName', page), true);
@ -69,6 +69,38 @@
});
}
function populateCountries(select, allCountries) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = allCountries.length; i < length; i++) {
var culture = allCountries[i];
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html;
}
function populateLanguages(select, languages) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = languages.length; i < length; i++) {
var culture = languages[i];
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html;
}
function renderContentTypeOptions(page, metadataInfo) {
if (metadataInfo.ContentTypeOptions.length) {

View file

@ -58,9 +58,41 @@
load(page, config, allCultures, allCountries);
});
function populateLanguages(select, languages) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = languages.length; i < length; i++) {
var culture = languages[i];
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html;
}
function populateCountries(select, allCountries) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = allCountries.length; i < length; i++) {
var culture = allCountries[i];
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html;
}
ApiClient.getCultures().then(function (result) {
Dashboard.populateLanguages($('#selectLanguage', page), result);
populateLanguages(page.querySelector('#selectLanguage'), result);
allCultures = result;
load(page, config, allCultures, allCountries);
@ -68,7 +100,7 @@
ApiClient.getCountries().then(function (result) {
Dashboard.populateCountries($('#selectCountry', page), result);
populateCountries(page.querySelector('#selectCountry'), result);
allCountries = result;
load(page, config, allCultures, allCountries);

View file

@ -4,7 +4,7 @@
Dashboard.importCss('thirdparty/social-share-kit-1.0.4/dist/css/social-share-kit.css');
require(['paperbuttonstyle', 'thirdparty/social-share-kit-1.0.4/dist/js/social-share-kit.min'], function () {
require(['thirdparty/social-share-kit-1.0.4/dist/js/social-share-kit.min'], function () {
var id = 'dlg' + new Date().getTime();
var html = '';

View file

@ -521,29 +521,27 @@ var Dashboard = {
if (typeof options == "string") {
require(['paperbuttonstyle'], function () {
var message = options;
var message = options;
Dashboard.toastId = Dashboard.toastId || 0;
Dashboard.toastId = Dashboard.toastId || 0;
var id = 'toast' + (Dashboard.toastId++);
var id = 'toast' + (Dashboard.toastId++);
var elem = document.createElement("paper-toast");
elem.setAttribute('text', message);
elem.id = id;
var elem = document.createElement("paper-toast");
elem.setAttribute('text', message);
elem.id = id;
document.body.appendChild(elem);
document.body.appendChild(elem);
// 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 () {
elem.show();
// 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 () {
elem.show();
setTimeout(function () {
elem.parentNode.removeChild(elem);
}, 5000);
}, 300);
});
elem.parentNode.removeChild(elem);
}, 5000);
}, 300);
return;
}
@ -1378,10 +1376,6 @@ var Dashboard = {
html += '</div>';
$(parent).prepend(html);
if (helpUrl) {
require(['paperbuttonstyle']);
}
},
setPageTitle: function (title) {
@ -1439,38 +1433,6 @@ var Dashboard = {
return parts.join(':');
},
populateLanguages: function (select, languages) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = languages.length; i < length; i++) {
var culture = languages[i];
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html;
},
populateCountries: function (select, allCountries) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = allCountries.length; i < length; i++) {
var culture = allCountries[i];
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html;
},
getSupportedRemoteCommands: function () {
// Full list
@ -1999,9 +1961,7 @@ var AppInfo = {};
}
define("connectservice", ["apiclient/connectservice"]);
define("paperbuttonstyle", [], function () {
return {};
});
define("jqmicons", [], function () {
Dashboard.importCss('thirdparty/jquerymobile-1.4.5/jquery.mobile.custom.icons.css');
return {};

View file

@ -2,8 +2,6 @@
function renderJob(page, job, dialogOptions) {
require(['paperbuttonstyle']);
var html = '';
html += '<div>';

View file

@ -29,10 +29,42 @@
}
function populateLanguages(select, languages) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = languages.length; i < length; i++) {
var culture = languages[i];
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html;
}
function populateCountries (select, allCountries) {
var html = "";
html += "<option value=''></option>";
for (var i = 0, length = allCountries.length; i < length; i++) {
var culture = allCountries[i];
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + "</option>";
}
select.innerHTML = html;
}
function reloadData(page, config, cultures, countries) {
Dashboard.populateLanguages($('#selectLanguage', page), cultures);
Dashboard.populateCountries($('#selectCountry', page), countries);
populateLanguages(page.querySelector('#selectLanguage'), cultures);
populateCountries(page.querySelector('#selectCountry'), countries);
$('#selectLanguage', page).val(config.PreferredMetadataLanguage);
$('#selectCountry', page).val(config.MetadataCountryCode);