mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update shared components
This commit is contained in:
parent
30db5a009c
commit
489dc97aab
33 changed files with 368 additions and 212 deletions
|
@ -249,9 +249,9 @@
|
|||
|
||||
}
|
||||
|
||||
function scrollToNode(page, id) {
|
||||
function scrollToNode(id) {
|
||||
|
||||
var elem = $('#' + id, page)[0];
|
||||
var elem = $('#' + id)[0];
|
||||
|
||||
if (elem) {
|
||||
// commenting out for now because it's causing the whole window to scroll in chrome
|
||||
|
@ -365,7 +365,7 @@
|
|||
|
||||
setTimeout(function () {
|
||||
|
||||
scrollToNode($.mobile.activePage, selectedNodeId);
|
||||
scrollToNode(selectedNodeId);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1252,7 +1252,7 @@
|
|||
hideSelections();
|
||||
break;
|
||||
case 'groupvideos':
|
||||
combineVersions($.mobile.activePage, items);
|
||||
combineVersions(parentWithClass(e.target, 'page'), items);
|
||||
break;
|
||||
case 'markplayed':
|
||||
items.forEach(function (itemId) {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
html += '<button is="paper-icon-button-light" class="btnCast headerButton headerButtonRight hide"><iron-icon icon="cast"></iron-icon></button>';
|
||||
|
||||
if (AppInfo.enableSearchInTopMenu) {
|
||||
html += '<button is="paper-icon-button-light" class=headerButton headerButtonRight headerSearchButton hide" onclick="Search.showSearchPanel();"><iron-icon icon="search"></iron-icon></button>';
|
||||
html += '<button type="button" is="paper-icon-button-light" class=headerButton headerButtonRight headerSearchButton hide" onclick="Search.showSearchPanel();"><iron-icon icon="search"></iron-icon></button>';
|
||||
html += '<div class="viewMenuSearch hide">';
|
||||
html += '<form class="viewMenuSearchForm">';
|
||||
html += '<input type="text" data-role="none" data-type="search" class="headerSearchInput" autocomplete="off" spellcheck="off" />';
|
||||
|
|
|
@ -1,135 +1,104 @@
|
|||
var LoginPage = {
|
||||
define(['jQuery'], function ($) {
|
||||
|
||||
getApiClient: function () {
|
||||
var LoginPage = {
|
||||
|
||||
var serverId = getParameterByName('serverid');
|
||||
showVisualForm: function (page) {
|
||||
$('.visualLoginForm', page).show();
|
||||
$('.manualLoginForm', page).hide();
|
||||
},
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
getLastSeenText: function (lastActivityDate) {
|
||||
|
||||
if (serverId) {
|
||||
resolve(ConnectionManager.getOrCreateApiClient(serverId));
|
||||
|
||||
} else {
|
||||
resolve(ApiClient);
|
||||
if (!lastActivityDate) {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onPageShow: function () {
|
||||
return "Last seen " + humane_date(lastActivityDate);
|
||||
},
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
authenticateUserByName: function (page, apiClient, username, password) {
|
||||
|
||||
var page = this;
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
LoginPage.getApiClient().then(function (apiClient) {
|
||||
apiClient.authenticateUserByName(username, password).then(function (result) {
|
||||
|
||||
apiClient.getPublicUsers().then(function (users) {
|
||||
var user = result.User;
|
||||
|
||||
var showManualForm = !users.length;
|
||||
var serverId = getParameterByName('serverid');
|
||||
|
||||
if (showManualForm) {
|
||||
|
||||
LoginPage.showManualForm(page, false, false);
|
||||
var newUrl;
|
||||
|
||||
if (user.Policy.IsAdministrator && !serverId) {
|
||||
newUrl = "dashboard.html";
|
||||
} else {
|
||||
|
||||
LoginPage.showVisualForm(page);
|
||||
LoginPage.loadUserList(page, apiClient, users);
|
||||
newUrl = "home.html";
|
||||
}
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
Dashboard.onServerChanged(user.Id, result.AccessToken, apiClient);
|
||||
Dashboard.navigate(newUrl);
|
||||
|
||||
}, function () {
|
||||
|
||||
$('#pw', page).val('');
|
||||
$('#txtManualName', page).val('');
|
||||
$('#txtManualPassword', page).val('');
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
setTimeout(function () {
|
||||
require(['toast'], function (toast) {
|
||||
toast(Globalize.translate('MessageInvalidUser'));
|
||||
});
|
||||
}, 300);
|
||||
});
|
||||
|
||||
apiClient.getJSON(apiClient.getUrl('Branding/Configuration')).then(function (options) {
|
||||
}
|
||||
|
||||
$('.disclaimer', page).html(options.LoginDisclaimer || '');
|
||||
});
|
||||
};
|
||||
|
||||
function getApiClient() {
|
||||
|
||||
var serverId = getParameterByName('serverid');
|
||||
|
||||
if (serverId) {
|
||||
return Promise.resolve(ConnectionManager.getOrCreateApiClient(serverId));
|
||||
|
||||
} else {
|
||||
return Promise.resolve(ApiClient);
|
||||
}
|
||||
}
|
||||
|
||||
function onManualSubmit() {
|
||||
var page = $(this).parents('.page');
|
||||
|
||||
getApiClient().then(function (apiClient) {
|
||||
LoginPage.authenticateUserByName(page, apiClient, $('#txtManualName', page).val(), $('#txtManualPassword', page).val());
|
||||
});
|
||||
|
||||
if (Dashboard.isConnectMode()) {
|
||||
$('.connectButtons', page).show();
|
||||
} else {
|
||||
$('.connectButtons', page).hide();
|
||||
}
|
||||
},
|
||||
// Disable default form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
cancelLogin: function () {
|
||||
|
||||
LoginPage.showVisualForm($.mobile.activePage);
|
||||
},
|
||||
|
||||
showManualForm: function (page, showCancel, focusPassword) {
|
||||
$('.visualLoginForm', page).hide();
|
||||
$('.manualLoginForm', page).show();
|
||||
function showManualForm(context, showCancel, focusPassword) {
|
||||
$('.visualLoginForm', context).hide();
|
||||
$('.manualLoginForm', context).show();
|
||||
|
||||
if (focusPassword) {
|
||||
$('#txtManualPassword input', page).focus();
|
||||
$('#txtManualPassword input', context).focus();
|
||||
} else {
|
||||
$('#txtManualName input', page).focus();
|
||||
$('#txtManualName input', context).focus();
|
||||
}
|
||||
|
||||
if (showCancel) {
|
||||
$('.btnCancel', page).show();
|
||||
$('.btnCancel', context).show();
|
||||
} else {
|
||||
$('.btnCancel', page).hide();
|
||||
$('.btnCancel', context).hide();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
showVisualForm: function (page) {
|
||||
$('.visualLoginForm', page).show();
|
||||
$('.manualLoginForm', page).hide();
|
||||
},
|
||||
|
||||
getLastSeenText: function (lastActivityDate) {
|
||||
|
||||
if (!lastActivityDate) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return "Last seen " + humane_date(lastActivityDate);
|
||||
},
|
||||
|
||||
authenticateUserByName: function (page, apiClient, username, password) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
apiClient.authenticateUserByName(username, password).then(function (result) {
|
||||
|
||||
var user = result.User;
|
||||
|
||||
var serverId = getParameterByName('serverid');
|
||||
|
||||
var newUrl;
|
||||
|
||||
if (user.Policy.IsAdministrator && !serverId) {
|
||||
newUrl = "dashboard.html";
|
||||
} else {
|
||||
newUrl = "home.html";
|
||||
}
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
Dashboard.onServerChanged(user.Id, result.AccessToken, apiClient);
|
||||
Dashboard.navigate(newUrl);
|
||||
|
||||
}, function () {
|
||||
|
||||
$('#pw', page).val('');
|
||||
$('#txtManualName', page).val('');
|
||||
$('#txtManualPassword', page).val('');
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
setTimeout(function () {
|
||||
require(['toast'], function (toast) {
|
||||
toast(Globalize.translate('MessageInvalidUser'));
|
||||
});
|
||||
}, 300);
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
loadUserList: function (page, apiClient, users) {
|
||||
function loadUserList(context, apiClient, users) {
|
||||
var html = "";
|
||||
|
||||
for (var i = 0, length = users.length; i < length; i++) {
|
||||
|
@ -184,7 +153,7 @@
|
|||
html += '</div>';
|
||||
}
|
||||
|
||||
var elem = $('#divUsers', page).html(html);
|
||||
var elem = $('#divUsers', context).html(html);
|
||||
|
||||
$('a', elem).on('click', function () {
|
||||
|
||||
|
@ -193,39 +162,69 @@
|
|||
var haspw = this.getAttribute('data-haspw');
|
||||
|
||||
if (id == 'manual') {
|
||||
LoginPage.showManualForm(page, true);
|
||||
showManualForm(context, true);
|
||||
}
|
||||
else if (haspw == 'false') {
|
||||
LoginPage.authenticateUserByName(page, apiClient, name, '');
|
||||
LoginPage.authenticateUserByName(context, apiClient, name, '');
|
||||
} else {
|
||||
$('#txtManualName', page).val(name);
|
||||
$('#txtManualPassword', page).val('');
|
||||
LoginPage.showManualForm(page, true, true);
|
||||
$('#txtManualName', context).val(name);
|
||||
$('#txtManualPassword', context).val('');
|
||||
showManualForm(context, true, true);
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
onManualSubmit: function () {
|
||||
return function (view, params) {
|
||||
|
||||
var page = $(this).parents('.page');
|
||||
var self = this;
|
||||
|
||||
LoginPage.getApiClient().then(function (apiClient) {
|
||||
LoginPage.authenticateUserByName(page, apiClient, $('#txtManualName', page).val(), $('#txtManualPassword', page).val());
|
||||
$('.manualLoginForm', view).on('submit', onManualSubmit);
|
||||
|
||||
view.querySelector('.btnForgotPassword').addEventListener('click', function () {
|
||||
Dashboard.navigate('forgotpassword.html');
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
}
|
||||
};
|
||||
view.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
LoginPage.showVisualForm(view);
|
||||
});
|
||||
|
||||
$(document).on('pageinit', "#loginPage", function () {
|
||||
view.querySelector('.btnManual').addEventListener('click', function () {
|
||||
showManualForm(view, true);
|
||||
});
|
||||
|
||||
var page = this;
|
||||
view.addEventListener('viewshow', function (e) {
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
$('.manualLoginForm', page).off('submit', LoginPage.onManualSubmit).on('submit', LoginPage.onManualSubmit);
|
||||
getApiClient().then(function (apiClient) {
|
||||
|
||||
$('.btnForgotPassword', page).on('click', function () {
|
||||
Dashboard.navigate('forgotpassword.html');
|
||||
});
|
||||
apiClient.getPublicUsers().then(function (users) {
|
||||
|
||||
}).on('pageshow', "#loginPage", LoginPage.onPageShow);
|
||||
var showManualForm = !users.length;
|
||||
|
||||
if (showManualForm) {
|
||||
|
||||
showManualForm(view, false, false);
|
||||
|
||||
} else {
|
||||
|
||||
LoginPage.showVisualForm(view);
|
||||
loadUserList(view, apiClient, users);
|
||||
}
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
||||
apiClient.getJSON(apiClient.getUrl('Branding/Configuration')).then(function (options) {
|
||||
|
||||
$('.disclaimer', view).html(options.LoginDisclaimer || '');
|
||||
});
|
||||
});
|
||||
|
||||
if (Dashboard.isConnectMode()) {
|
||||
$('.connectButtons', view).show();
|
||||
} else {
|
||||
$('.connectButtons', view).hide();
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
|
@ -21,22 +21,32 @@
|
|||
|
||||
function saveUser(page, user) {
|
||||
|
||||
appSettings.syncPath(page.querySelector('#txtSyncPath').value);
|
||||
var syncPath = page.querySelector('#txtSyncPath').value;
|
||||
|
||||
appSettings.syncPath(syncPath);
|
||||
appSettings.syncOnlyOnWifi(page.querySelector('#chkWifi').checked);
|
||||
|
||||
appSettings.cameraUploadServers($(".chkUploadServer", page).get().filter(function (i) {
|
||||
var cameraUploadServers = $(".chkUploadServer", page).get().filter(function (i) {
|
||||
|
||||
return i.checked;
|
||||
|
||||
}).map(function (i) {
|
||||
|
||||
return i.getAttribute('data-id');
|
||||
}));
|
||||
});
|
||||
|
||||
appSettings.cameraUploadServers(cameraUploadServers);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
require(['toast'], function (toast) {
|
||||
toast(Globalize.translate('SettingsSaved'));
|
||||
});
|
||||
|
||||
if (cameraUploadServers.length || syncPath) {
|
||||
if (window.MainActivity) {
|
||||
MainActivity.authorizeStorage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
|
|
|
@ -166,7 +166,7 @@
|
|||
var frequency = 86400000;
|
||||
|
||||
if (AppInfo.isNativeApp) {
|
||||
frequency = 259200000;
|
||||
frequency = 172800000;
|
||||
}
|
||||
|
||||
var cacheKey = 'lastappinfopresent5';
|
||||
|
|
|
@ -2243,7 +2243,7 @@ var AppInfo = {};
|
|||
|
||||
var baseUrl = 'bower_components/emby-webcomponents/strings/';
|
||||
|
||||
var languages = ['en-US', 'kk', 'ru'];
|
||||
var languages = ['da', 'en-US', 'kk', 'nl', 'ru'];
|
||||
|
||||
var translations = languages.map(function (i) {
|
||||
return {
|
||||
|
@ -2655,9 +2655,10 @@ var AppInfo = {};
|
|||
|
||||
defineRoute({
|
||||
path: '/login.html',
|
||||
dependencies: ['paper-button'],
|
||||
dependencies: ['paper-button', 'humanedate', 'paper-input'],
|
||||
autoFocus: false,
|
||||
anonymous: true
|
||||
anonymous: true,
|
||||
controller: 'scripts/loginpage'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue