mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
removed dead code
This commit is contained in:
parent
05b25af69f
commit
747d71e76d
2 changed files with 1 additions and 220 deletions
|
@ -120,180 +120,4 @@
|
|||
|
||||
};
|
||||
|
||||
$(document).on('pageshow', "#supporterKeyPage", SupporterKeyPage.onPageShow);
|
||||
|
||||
(function () {
|
||||
|
||||
var connectSupporterInfo;
|
||||
|
||||
function showAddUserForm(page) {
|
||||
|
||||
$('.popupAddUser', page).popup('open');
|
||||
|
||||
$('#selectUserToAdd', page).html(connectSupporterInfo.EligibleUsers.map(function (u) {
|
||||
|
||||
return '<option value="' + u.ConnectUserId + '">' + u.Name + '</option>';
|
||||
|
||||
}).join(''));
|
||||
}
|
||||
|
||||
function addUser(page, id) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.ajax({
|
||||
type: "POST",
|
||||
url: ApiClient.getUrl('Connect/Supporters', {
|
||||
Id: id
|
||||
})
|
||||
|
||||
}).then(function () {
|
||||
|
||||
$('.popupAddUser', page).popup('close');
|
||||
loadConnectSupporters(page);
|
||||
});
|
||||
}
|
||||
|
||||
function removeUser(page, id) {
|
||||
|
||||
Dashboard.confirm(Globalize.translate('MessageConfirmRemoveConnectSupporter'), Globalize.translate('HeaderConfirmRemoveUser'), function (result) {
|
||||
|
||||
if (result) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.ajax({
|
||||
type: "DELETE",
|
||||
url: ApiClient.getUrl('Connect/Supporters', {
|
||||
Id: id
|
||||
})
|
||||
|
||||
}).then(function () {
|
||||
|
||||
loadConnectSupporters(page);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function getUserHtml(user) {
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<li>';
|
||||
html += '<a href="#">';
|
||||
var imgUrl = user.ImageUrl || 'css/images/userflyoutdefault.png';
|
||||
html += '<img src="' + imgUrl + '" />';
|
||||
html += '<h3>';
|
||||
html += (user.DisplayName || user.Name);
|
||||
html += '</h3>';
|
||||
html += '<p>';
|
||||
html += user.Email;
|
||||
html += '</p>';
|
||||
html += '</a>';
|
||||
html += '<a href="#" data-icon="delete" class="btnRemoveUser" data-id="' + user.Id + '">';
|
||||
html += '</a>';
|
||||
html += '</li>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function renderUsers(page, result) {
|
||||
|
||||
$('.linkSupporterKeyMessage', page).html(Globalize.translate('MessageLinkYourSupporterKey', result.MaxUsers));
|
||||
|
||||
var html = '';
|
||||
|
||||
if (result.Users.length) {
|
||||
|
||||
html += '<ul data-role="listview" data-inset="true">';
|
||||
|
||||
html += '<li data-role="list-divider">' + Globalize.translate('HeaderUsers');
|
||||
|
||||
html += result.Users.map(getUserHtml).join('');
|
||||
|
||||
html += '</ul>';
|
||||
}
|
||||
|
||||
var elem = $('.supporters', page).html(html).trigger('create');
|
||||
|
||||
$('.btnRemoveUser', elem).on('click', function () {
|
||||
|
||||
removeUser(page, this.getAttribute('data-id'));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function loadConnectSupporters(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
Dashboard.suppressAjaxErrors = true;
|
||||
|
||||
ApiClient.ajax({
|
||||
type: "GET",
|
||||
url: ApiClient.getUrl('Connect/Supporters'),
|
||||
dataType: "json"
|
||||
|
||||
}).then(function (result) {
|
||||
|
||||
connectSupporterInfo = result;
|
||||
renderUsers(page, result);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
Dashboard.suppressAjaxErrors = false;
|
||||
|
||||
}, function () {
|
||||
|
||||
$('.supporters', page).html('<p>' + Globalize.translate('MessageErrorLoadingSupporterInfo') + '</p>');
|
||||
Dashboard.suppressAjaxErrors = false;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function loadUserInfo(page) {
|
||||
|
||||
Dashboard.getPluginSecurityInfo().then(function (info) {
|
||||
|
||||
if (info.IsMBSupporter) {
|
||||
$('.supporterContainer', page).addClass('hide');
|
||||
} else {
|
||||
$('.supporterContainer', page).removeClass('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#supporterKeyPage", function () {
|
||||
|
||||
var page = this;
|
||||
$('#btnAddConnectUser', page).on('click', function () {
|
||||
showAddUserForm(page);
|
||||
});
|
||||
|
||||
$('#supporterKeyForm').on('submit', SupporterKeyPage.updateSupporterKey);
|
||||
$('#lostKeyForm').on('submit', SupporterKeyPage.retrieveSupporterKey);
|
||||
$('#linkKeysForm').on('submit', SupporterKeyPage.linkSupporterKeys);
|
||||
$('.popupAddUserForm').on('submit', SupporterKeyPage.onAddConnectUserSubmit).on('submit', SupporterKeyPage.onAddConnectUserSubmit);
|
||||
|
||||
$('.benefits', page).html(Globalize.translate('HeaderSupporterBenefit', '<a href="http://emby.media/premiere" target="_blank">', '</a>'));
|
||||
|
||||
}).on('pageshow', "#supporterKeyPage", function () {
|
||||
|
||||
var page = this;
|
||||
loadConnectSupporters(page);
|
||||
loadUserInfo(page);
|
||||
});
|
||||
|
||||
window.SupporterKeyPage.onAddConnectUserSubmit = function () {
|
||||
|
||||
var page = $(this).parents('.page');
|
||||
|
||||
var id = $('#selectUserToAdd', page).val();
|
||||
|
||||
addUser(page, id);
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
})();
|
||||
$(document).on('pageshow', "#supporterKeyPage", SupporterKeyPage.onPageShow);
|
Loading…
Add table
Add a link
Reference in a new issue