mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add new notification features
This commit is contained in:
parent
b94fa3f72c
commit
28ea06a627
9 changed files with 320 additions and 812 deletions
87
dashboard-ui/notificationsetting.html
Normal file
87
dashboard-ui/notificationsetting.html
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>${TitleAdvanced}</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="notificationSettingPage" data-role="page" class="page type-interior advancedConfigurationPage">
|
||||||
|
|
||||||
|
<div data-role="content">
|
||||||
|
<div class="content-primary">
|
||||||
|
|
||||||
|
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||||
|
<a href="advanced.html" data-role="button">${TabGeneral}</a>
|
||||||
|
<a href="notificationsettings.html" data-role="button" class="ui-btn-active">${TabNotifications}</a>
|
||||||
|
<a href="advancedpaths.html" data-role="button">${TabPaths}</a>
|
||||||
|
<a href="advancedserversettings.html" data-role="button">${TabServer}</a>
|
||||||
|
<a href="encodingsettings.html" data-role="button">${TabTranscoding}</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2 class="notificationType" style="margin-bottom: 0;"></h2>
|
||||||
|
|
||||||
|
<form class="notificationSettingForm">
|
||||||
|
|
||||||
|
<ul data-role="listview" class="ulForm">
|
||||||
|
<li>
|
||||||
|
<input type="checkbox" id="chkEnabled" data-mini="true" />
|
||||||
|
<label for="chkEnabled">${LabelNotificationEnabled}</label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="monitorUsers" style="display: none;">
|
||||||
|
<label>${LabelMonitorUsers}</label>
|
||||||
|
<div class="monitorUsersList">
|
||||||
|
</div>
|
||||||
|
<div class="fieldDescription">${UsersNotNotifiedAboutSelfActivity}</div>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label>${LabelSendNotificationToUsers}</label>
|
||||||
|
<div class="sendToUsersList">
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label>${LabelUseNotificationServices}</label>
|
||||||
|
<div class="servicesList">
|
||||||
|
</div>
|
||||||
|
<div class="fieldDescription">${AdditionalNotificationServices}</div>
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<ul data-role="listview" class="ulForm">
|
||||||
|
<li>
|
||||||
|
<label for="txtTitle">${LabelMessageTitle}</label>
|
||||||
|
<input id="txtTitle" type="text" data-mini="true" />
|
||||||
|
<div class="fieldDescription tokenHelp">
|
||||||
|
<div>${LabelAvailableTokens}</div>
|
||||||
|
<div class="tokenList" style="margin-top: .5em;"></div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<br />
|
||||||
|
<button type="submit" data-theme="b" data-icon="check" data-mini="true">
|
||||||
|
${ButtonSave}
|
||||||
|
</button>
|
||||||
|
<button type="button" onclick="Dashboard.navigate('notificationsettings.html');" data-icon="delete" data-mini="true">
|
||||||
|
${ButtonCancel}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$('.notificationSettingForm').off('submit', NotificationSettingPage.onSubmit).on('submit', NotificationSettingPage.onSubmit);
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -16,61 +16,17 @@
|
||||||
<a href="advancedserversettings.html" data-role="button">${TabServer}</a>
|
<a href="advancedserversettings.html" data-role="button">${TabServer}</a>
|
||||||
<a href="encodingsettings.html" data-role="button">${TabTranscoding}</a>
|
<a href="encodingsettings.html" data-role="button">${TabTranscoding}</a>
|
||||||
</div>
|
</div>
|
||||||
<form class="notificationSettingsForm">
|
|
||||||
|
|
||||||
<ul data-role="listview" class="ulForm">
|
<div class="readOnlyContent">
|
||||||
<li>
|
<p>${HeaderNotificationList}</p>
|
||||||
<label>${HeaderEnableNotificationForEvents}</label>
|
<p>${SendNotificationHelp}</p>
|
||||||
<div data-role="controlgroup">
|
|
||||||
<input type="checkbox" data-mini="true" id="chkNewLibraryContent" />
|
|
||||||
<label for="chkNewLibraryContent">${OptionNotifyOnNewLibraryContent}</label>
|
|
||||||
|
|
||||||
<input type="checkbox" data-mini="true" id="chkFailedTasks" />
|
<div class="notificationList" style="margin-top: 2em;">
|
||||||
<label for="chkFailedTasks">${OptionNotifyOnFailedTasks}</label>
|
</div>
|
||||||
|
|
||||||
<input type="checkbox" data-mini="true" id="chkServerRestartRequired" />
|
</div>
|
||||||
<label for="chkServerRestartRequired">${OptionNotifyOnServerRestartRequired}</label>
|
|
||||||
|
|
||||||
<input type="checkbox" data-mini="true" id="chkUpdates" />
|
|
||||||
<label for="chkUpdates">${OptionNotifyOnUpdates}</label>
|
|
||||||
|
|
||||||
<div class="fieldDescription">${SendNotificationHelp}</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<label>${HeaderEnableNotificationForPlayback}</label>
|
|
||||||
<div data-role="controlgroup">
|
|
||||||
<input type="checkbox" data-mini="true" id="chkVideoPlayback" />
|
|
||||||
<label for="chkVideoPlayback">${OptionNotifyOnVideoPlayback}</label>
|
|
||||||
|
|
||||||
<input type="checkbox" data-mini="true" id="chkAudioPlayback" />
|
|
||||||
<label for="chkAudioPlayback">${OptionNotifyOnAudioPlayback}</label>
|
|
||||||
|
|
||||||
<input type="checkbox" data-mini="true" id="chkGamePlayback" />
|
|
||||||
<label for="chkGamePlayback">${OptionNotifyOnGamePlayback}</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<br />
|
|
||||||
<ul data-role="listview" class="ulForm">
|
|
||||||
<li>
|
|
||||||
<button type="submit" data-theme="b" data-icon="check" data-mini="true">
|
|
||||||
${ButtonSave}
|
|
||||||
</button>
|
|
||||||
<button type="button" onclick="Dashboard.navigate('dashboard.html');" data-icon="delete" data-mini="true">
|
|
||||||
${ButtonCancel}
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
$('.notificationSettingsForm').off('submit', NotificationSettingsPage.onSubmit).on('submit', NotificationSettingsPage.onSubmit);
|
|
||||||
</script>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -289,7 +289,7 @@
|
||||||
$('.lnkBrowseAllImages', page).addClass('hide');
|
$('.lnkBrowseAllImages', page).addClass('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiClient.getItemImageInfos(currentItem.Id, currentItem.Type, currentItem.Name).done(function (imageInfos) {
|
ApiClient.getItemImageInfos(currentItem.Id).done(function (imageInfos) {
|
||||||
|
|
||||||
renderStandardImages(page, item, imageInfos, providers);
|
renderStandardImages(page, item, imageInfos, providers);
|
||||||
renderBackdrops(page, item, imageInfos, providers);
|
renderBackdrops(page, item, imageInfos, providers);
|
||||||
|
@ -486,7 +486,7 @@
|
||||||
|
|
||||||
var imageType = $('#selectImageType', page).val();
|
var imageType = $('#selectImageType', page).val();
|
||||||
|
|
||||||
ApiClient.uploadItemImage(currentItem.Id, currentItem.Type, currentItem.Name, imageType, file).done(function () {
|
ApiClient.uploadItemImage(currentItem.Id, imageType, file).done(function () {
|
||||||
|
|
||||||
$('#uploadImage', page).val('').trigger('change');
|
$('#uploadImage', page).val('').trigger('change');
|
||||||
$('#popupUpload', page).popup("close");
|
$('#popupUpload', page).popup("close");
|
||||||
|
@ -504,7 +504,7 @@
|
||||||
Dashboard.confirm("Are you sure you wish to delete this image?", "Delete " + type + " Image", function (result) {
|
Dashboard.confirm("Are you sure you wish to delete this image?", "Delete " + type + " Image", function (result) {
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
ApiClient.deleteItemImage(currentItem.Id, currentItem.Type, currentItem.Name, type, index).done(function () {
|
ApiClient.deleteItemImage(currentItem.Id, type, index).done(function () {
|
||||||
|
|
||||||
processImageChangeResult(page);
|
processImageChangeResult(page);
|
||||||
|
|
||||||
|
@ -520,7 +520,7 @@
|
||||||
|
|
||||||
var page = $.mobile.activePage;
|
var page = $.mobile.activePage;
|
||||||
|
|
||||||
ApiClient.updateItemImageIndex(currentItem.Id, currentItem.Type, currentItem.Name, type, index, newIndex).done(function () {
|
ApiClient.updateItemImageIndex(currentItem.Id, type, index, newIndex).done(function () {
|
||||||
|
|
||||||
processImageChangeResult(page);
|
processImageChangeResult(page);
|
||||||
|
|
||||||
|
|
|
@ -807,31 +807,7 @@
|
||||||
item.RunTimeTicks = seriesRuntime ? (seriesRuntime * 600000000) : null;
|
item.RunTimeTicks = seriesRuntime ? (seriesRuntime * 600000000) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var updatePromise;
|
ApiClient.updateItem(item).done(function () {
|
||||||
|
|
||||||
if (currentItem.Type == "MusicArtist") {
|
|
||||||
updatePromise = ApiClient.updateArtist(item);
|
|
||||||
}
|
|
||||||
else if (currentItem.Type == "Genre") {
|
|
||||||
updatePromise = ApiClient.updateGenre(item);
|
|
||||||
}
|
|
||||||
else if (currentItem.Type == "MusicGenre") {
|
|
||||||
updatePromise = ApiClient.updateMusicGenre(item);
|
|
||||||
}
|
|
||||||
else if (currentItem.Type == "GameGenre") {
|
|
||||||
updatePromise = ApiClient.updateGameGenre(item);
|
|
||||||
}
|
|
||||||
else if (currentItem.Type == "Person") {
|
|
||||||
updatePromise = ApiClient.updatePerson(item);
|
|
||||||
}
|
|
||||||
else if (currentItem.Type == "Studio") {
|
|
||||||
updatePromise = ApiClient.updateStudio(item);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
updatePromise = ApiClient.updateItem(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
updatePromise.done(function () {
|
|
||||||
|
|
||||||
Dashboard.alert('Item saved.');
|
Dashboard.alert('Item saved.');
|
||||||
|
|
||||||
|
@ -1104,33 +1080,9 @@
|
||||||
|
|
||||||
$('#refreshLoading', page).show();
|
$('#refreshLoading', page).show();
|
||||||
|
|
||||||
var refreshPromise;
|
|
||||||
|
|
||||||
var force = $('#selectRefreshMode', page).val() == 'all';
|
var force = $('#selectRefreshMode', page).val() == 'all';
|
||||||
|
|
||||||
if (currentItem.Type == "MusicArtist") {
|
ApiClient.refreshItem(currentItem.Id, force, true).done(function () {
|
||||||
refreshPromise = ApiClient.refreshArtist(currentItem.Name, force);
|
|
||||||
}
|
|
||||||
else if (currentItem.Type == "Genre") {
|
|
||||||
refreshPromise = ApiClient.refreshGenre(currentItem.Name, force);
|
|
||||||
}
|
|
||||||
else if (currentItem.Type == "MusicGenre") {
|
|
||||||
refreshPromise = ApiClient.refreshMusicGenre(currentItem.Name, force);
|
|
||||||
}
|
|
||||||
else if (currentItem.Type == "GameGenre") {
|
|
||||||
refreshPromise = ApiClient.refreshGameGenre(currentItem.Name, force);
|
|
||||||
}
|
|
||||||
else if (currentItem.Type == "Person") {
|
|
||||||
refreshPromise = ApiClient.refreshPerson(currentItem.Name, force);
|
|
||||||
}
|
|
||||||
else if (currentItem.Type == "Studio") {
|
|
||||||
refreshPromise = ApiClient.refreshStudio(currentItem.Name, force);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
refreshPromise = ApiClient.refreshItem(currentItem.Id, force, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshPromise.done(function () {
|
|
||||||
|
|
||||||
reload(page);
|
reload(page);
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
Limit: screenWidth >= 1920 ? 32 : (screenWidth >= 1440 ? 24 : (screenWidth >= 800 ? 18 : 12)),
|
Limit: screenWidth >= 1920 ? 32 : (screenWidth >= 1440 ? 24 : (screenWidth >= 800 ? 18 : 12)),
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: "PrimaryImageAspectRatio",
|
Fields: "PrimaryImageAspectRatio",
|
||||||
Filters: "IsUnplayed"
|
Filters: "IsUnplayed",
|
||||||
|
CollapseBoxSetItems: false
|
||||||
};
|
};
|
||||||
|
|
||||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
||||||
|
@ -34,7 +35,8 @@
|
||||||
Limit: screenWidth >= 1920 ? 8 : (screenWidth >= 1440 ? 8 : 6),
|
Limit: screenWidth >= 1920 ? 8 : (screenWidth >= 1440 ? 8 : 6),
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: "PrimaryImageAspectRatio",
|
Fields: "PrimaryImageAspectRatio",
|
||||||
Filters: "IsUnplayed"
|
Filters: "IsUnplayed",
|
||||||
|
CollapseBoxSetItems: false
|
||||||
};
|
};
|
||||||
|
|
||||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
||||||
|
|
|
@ -49,7 +49,8 @@
|
||||||
Filters: "IsResumable",
|
Filters: "IsResumable",
|
||||||
Limit: screenWidth >= 1920 ? 4 : (screenWidth >= 1440 ? 4 : 3),
|
Limit: screenWidth >= 1920 ? 4 : (screenWidth >= 1440 ? 4 : 3),
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: "PrimaryImageAspectRatio"
|
Fields: "PrimaryImageAspectRatio",
|
||||||
|
CollapseBoxSetItems: false
|
||||||
};
|
};
|
||||||
|
|
||||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
||||||
|
|
169
dashboard-ui/scripts/notificationsetting.js
Normal file
169
dashboard-ui/scripts/notificationsetting.js
Normal file
|
@ -0,0 +1,169 @@
|
||||||
|
(function () {
|
||||||
|
|
||||||
|
function fillItems(elem, items, cssClass, idPrefix, disabledList) {
|
||||||
|
|
||||||
|
var html = '<div data-role="controlgroup">';
|
||||||
|
|
||||||
|
html += items.map(function (u) {
|
||||||
|
|
||||||
|
var id = idPrefix + u.Id;
|
||||||
|
|
||||||
|
var checkedHtml = disabledList.indexOf(u.Id) != -1 ? '' : ' checked="checked"';
|
||||||
|
|
||||||
|
return '<label for="' + id + '">' + u.Name + '</label><input class="' + cssClass + '" type="checkbox" data-itemid="' + u.Id + '" data-mini="true" id="' + id + '"' + checkedHtml + ' />';
|
||||||
|
|
||||||
|
}).join('');
|
||||||
|
|
||||||
|
html += '</div>';
|
||||||
|
|
||||||
|
elem.html(html).trigger('create');
|
||||||
|
}
|
||||||
|
|
||||||
|
function reload(page) {
|
||||||
|
|
||||||
|
var type = getParameterByName('type');
|
||||||
|
|
||||||
|
var promise1 = ApiClient.getUsers();
|
||||||
|
var promise2 = ApiClient.getServerConfiguration();
|
||||||
|
var promise3 = $.getJSON(ApiClient.getUrl("Notifications/Types"));
|
||||||
|
var promise4 = $.getJSON(ApiClient.getUrl("Notifications/Services"));
|
||||||
|
|
||||||
|
$.when(promise1, promise2, promise3, promise4).done(function (response1, response2, response3, response4) {
|
||||||
|
|
||||||
|
var users = response1[0];
|
||||||
|
var config = response2[0];
|
||||||
|
var types = response3[0];
|
||||||
|
var services = response4[0];
|
||||||
|
|
||||||
|
var notificationConfig = config.NotificationOptions.Options.filter(function (n) {
|
||||||
|
|
||||||
|
return n.Type == type;
|
||||||
|
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
var typeInfo = types.filter(function (n) {
|
||||||
|
|
||||||
|
return n.Type == type;
|
||||||
|
|
||||||
|
})[0] || {};
|
||||||
|
|
||||||
|
if (typeInfo.IsBasedOnUserEvent) {
|
||||||
|
$('.monitorUsers', page).show();
|
||||||
|
} else {
|
||||||
|
$('.monitorUsers', page).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeInfo.Variables.length) {
|
||||||
|
$('.tokenHelp', page).show();
|
||||||
|
|
||||||
|
$('.tokenList', page).html(typeInfo.Variables.map(function (v) {
|
||||||
|
|
||||||
|
return '{' + v + '}';
|
||||||
|
|
||||||
|
}).join(', '));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('.tokenHelp', page).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.notificationType', page).html(typeInfo.Name || 'Unknown Notification');
|
||||||
|
|
||||||
|
if (!notificationConfig) {
|
||||||
|
|
||||||
|
notificationConfig = {
|
||||||
|
DisabledMonitorUsers: [],
|
||||||
|
DisabledSendToUsers: [],
|
||||||
|
DisabledServices: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
fillItems($('.monitorUsersList', page), users, 'chkMonitor', 'chkMonitor', notificationConfig.DisabledMonitorUsers);
|
||||||
|
fillItems($('.sendToUsersList', page), users, 'chkSendTo', 'chkSendTo', notificationConfig.DisabledSendToUsers);
|
||||||
|
fillItems($('.servicesList', page), services, 'chkService', 'chkService', notificationConfig.DisabledServices);
|
||||||
|
|
||||||
|
$('#chkEnabled', page).checked(notificationConfig.Enabled || false).checkboxradio('refresh');
|
||||||
|
|
||||||
|
$('#txtTitle', page).val(notificationConfig.Title || typeInfo.DefaultTitle);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function save(page) {
|
||||||
|
|
||||||
|
var type = getParameterByName('type');
|
||||||
|
|
||||||
|
var promise1 = ApiClient.getServerConfiguration();
|
||||||
|
var promise2 = $.getJSON(ApiClient.getUrl("Notifications/Types"));
|
||||||
|
|
||||||
|
$.when(promise1, promise2).done(function (response1, response2) {
|
||||||
|
|
||||||
|
var config = response1[0];
|
||||||
|
var types = response2[0];
|
||||||
|
|
||||||
|
var notificationOptions = config.NotificationOptions;
|
||||||
|
|
||||||
|
var notificationConfig = config.NotificationOptions.Options.filter(function (n) {
|
||||||
|
|
||||||
|
return n.Type == type;
|
||||||
|
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
if (!notificationConfig) {
|
||||||
|
notificationConfig = {
|
||||||
|
Type: type
|
||||||
|
};
|
||||||
|
notificationOptions.Options.push(notificationConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
var typeInfo = types.filter(function (n) {
|
||||||
|
|
||||||
|
return n.Type == type;
|
||||||
|
|
||||||
|
})[0] || {};
|
||||||
|
|
||||||
|
notificationConfig.Enabled = $('#chkEnabled', page).checked();
|
||||||
|
notificationConfig.Title = $('#txtTitle', page).val();
|
||||||
|
|
||||||
|
// Don't persist if it's just the default
|
||||||
|
if (notificationConfig.Title == typeInfo.DefaultTitle) {
|
||||||
|
notificationConfig.Title = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
notificationConfig.DisabledMonitorUsers = $('.chkMonitor:not(:checked)', page).get().map(function (c) {
|
||||||
|
return c.getAttribute('data-itemid');
|
||||||
|
});
|
||||||
|
|
||||||
|
notificationConfig.DisabledSendToUsers = $('.chkSendTo:not(:checked)', page).get().map(function (c) {
|
||||||
|
return c.getAttribute('data-itemid');
|
||||||
|
});
|
||||||
|
|
||||||
|
notificationConfig.DisabledServices = $('.chkService:not(:checked)', page).get().map(function (c) {
|
||||||
|
return c.getAttribute('data-itemid');
|
||||||
|
});
|
||||||
|
|
||||||
|
ApiClient.updateServerConfiguration(config).done(function(r) {
|
||||||
|
|
||||||
|
Dashboard.navigate('notificationsettings.html');
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).on('pageshow', "#notificationSettingPage", function () {
|
||||||
|
|
||||||
|
var page = this;
|
||||||
|
|
||||||
|
reload(page);
|
||||||
|
});
|
||||||
|
|
||||||
|
window.NotificationSettingPage = {
|
||||||
|
|
||||||
|
onSubmit: function () {
|
||||||
|
|
||||||
|
var page = $(this).parents('.page');
|
||||||
|
save(page);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
})(jQuery, window);
|
|
@ -2,44 +2,50 @@
|
||||||
|
|
||||||
function reload(page) {
|
function reload(page) {
|
||||||
|
|
||||||
ApiClient.getServerConfiguration().done(function (config) {
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
var notificationOptions = config.NotificationOptions;
|
$.getJSON(ApiClient.getUrl("Notifications/Types")).done(function (list) {
|
||||||
|
|
||||||
$('#chkNewLibraryContent', page).checked(notificationOptions.SendOnNewLibraryContent).checkboxradio('refresh');
|
|
||||||
$('#chkFailedTasks', page).checked(notificationOptions.SendOnFailedTasks).checkboxradio('refresh');
|
|
||||||
$('#chkUpdates', page).checked(notificationOptions.SendOnUpdates).checkboxradio('refresh');
|
|
||||||
|
|
||||||
$('#chkServerRestartRequired', page).checked(notificationOptions.SendOnServerRestartRequired).checkboxradio('refresh');
|
|
||||||
|
|
||||||
$('#chkVideoPlayback', page).checked(notificationOptions.SendOnVideoPlayback).checkboxradio('refresh');
|
var html = '<ul data-role="listview" data-inset="true">';
|
||||||
$('#chkAudioPlayback', page).checked(notificationOptions.SendOnAudioPlayback).checkboxradio('refresh');
|
|
||||||
$('#chkGamePlayback', page).checked(notificationOptions.SendOnGamePlayback).checkboxradio('refresh');
|
|
||||||
|
|
||||||
|
var lastCategory = "";
|
||||||
|
|
||||||
|
html += list.map(function (i) {
|
||||||
|
|
||||||
|
var itemHtml = '';
|
||||||
|
|
||||||
|
if (i.Category != lastCategory) {
|
||||||
|
lastCategory = i.Category;
|
||||||
|
itemHtml += '<li data-role="list-divider">';
|
||||||
|
itemHtml += i.Category;
|
||||||
|
itemHtml += '</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
itemHtml += '<li>';
|
||||||
|
itemHtml += '<a href="notificationsetting.html?type=' + i.Type + '">';
|
||||||
|
itemHtml += '<h3>' + i.Name + '</h3>';
|
||||||
|
|
||||||
|
if (i.Enabled) {
|
||||||
|
itemHtml += '<p style="color:#009F00;">Enabled</p>';
|
||||||
|
} else {
|
||||||
|
itemHtml += '<p style="color:#cc0000;">Disabled</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
itemHtml += '</a>';
|
||||||
|
itemHtml += '</li>';
|
||||||
|
|
||||||
|
return itemHtml;
|
||||||
|
|
||||||
|
}).join('');
|
||||||
|
|
||||||
|
html += '</ul>';
|
||||||
|
|
||||||
|
$('.notificationList', page).html(html).trigger('create');
|
||||||
|
|
||||||
|
Dashboard.hideLoadingMsg();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function save(page) {
|
|
||||||
|
|
||||||
ApiClient.getServerConfiguration().done(function (config) {
|
|
||||||
|
|
||||||
var notificationOptions = config.NotificationOptions;
|
|
||||||
|
|
||||||
notificationOptions.SendOnNewLibraryContent = $('#chkNewLibraryContent', page).checked();
|
|
||||||
notificationOptions.SendOnFailedTasks = $('#chkFailedTasks', page).checked();
|
|
||||||
notificationOptions.SendOnUpdates = $('#chkUpdates', page).checked();
|
|
||||||
|
|
||||||
notificationOptions.SendOnServerRestartRequired = $('#chkServerRestartRequired', page).checked();
|
|
||||||
|
|
||||||
notificationOptions.SendOnVideoPlayback = $('#chkVideoPlayback', page).checked();
|
|
||||||
notificationOptions.SendOnAudioPlayback = $('#chkAudioPlayback', page).checked();
|
|
||||||
notificationOptions.SendOnGamePlayback = $('#chkGamePlayback', page).checked();
|
|
||||||
|
|
||||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).on('pageshow', "#notificationSettingsPage", function () {
|
$(document).on('pageshow', "#notificationSettingsPage", function () {
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
@ -47,14 +53,4 @@
|
||||||
reload(page);
|
reload(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
window.NotificationSettingsPage = {
|
|
||||||
|
|
||||||
onSubmit: function () {
|
|
||||||
|
|
||||||
var page = $(this).parents('.page');
|
|
||||||
save(page);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
})(jQuery, window);
|
})(jQuery, window);
|
671
dashboard-ui/thirdparty/mediabrowser.apiclient.js
vendored
671
dashboard-ui/thirdparty/mediabrowser.apiclient.js
vendored
|
@ -1104,102 +1104,6 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.refreshArtist = function (name, force) {
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Artists/" + self.encodeName(name) + "/Refresh", {
|
|
||||||
forced: force || false
|
|
||||||
});
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.refreshGenre = function (name, force) {
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Genres/" + self.encodeName(name) + "/Refresh", {
|
|
||||||
forced: force || false
|
|
||||||
});
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.refreshMusicGenre = function (name, force) {
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("MusicGenres/" + self.encodeName(name) + "/Refresh", {
|
|
||||||
forced: force || false
|
|
||||||
});
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.refreshGameGenre = function (name, force) {
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("GameGenres/" + self.encodeName(name) + "/Refresh", {
|
|
||||||
forced: force || false
|
|
||||||
});
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.refreshPerson = function (name, force) {
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Persons/" + self.encodeName(name) + "/Refresh", {
|
|
||||||
forced: force || false
|
|
||||||
});
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.refreshStudio = function (name, force) {
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Studios/" + self.encodeName(name) + "/Refresh", {
|
|
||||||
forced: force || false
|
|
||||||
});
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs or updates a new plugin
|
* Installs or updates a new plugin
|
||||||
*/
|
*/
|
||||||
|
@ -1660,34 +1564,13 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.deleteItemImage = function (itemId, itemType, itemName, imageType, imageIndex) {
|
self.deleteItemImage = function (itemId, imageType, imageIndex) {
|
||||||
|
|
||||||
if (!imageType) {
|
if (!imageType) {
|
||||||
throw new Error("null imageType");
|
throw new Error("null imageType");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!itemType) {
|
var url = self.getUrl("Items/" + itemId + "/Images");
|
||||||
throw new Error("null itemType");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url;
|
|
||||||
|
|
||||||
if (itemType == "Artist") {
|
|
||||||
url = self.getUrl("Artists/" + self.encodeName(itemName) + "/Images");
|
|
||||||
}
|
|
||||||
else if (itemType == "Genre") {
|
|
||||||
url = self.getUrl("Genres/" + self.encodeName(itemName) + "/Images");
|
|
||||||
} else if (itemType == "GameGenre") {
|
|
||||||
url = self.getUrl("GameGenres/" + self.encodeName(itemName) + "/Images");
|
|
||||||
} else if (itemType == "MusicGenre") {
|
|
||||||
url = self.getUrl("MusicGenres/" + self.encodeName(itemName) + "/Images");
|
|
||||||
} else if (itemType == "Person") {
|
|
||||||
url = self.getUrl("Persons/" + self.encodeName(itemName) + "/Images");
|
|
||||||
} else if (itemType == "Studio") {
|
|
||||||
url = self.getUrl("Studios/" + self.encodeName(itemName) + "/Images");
|
|
||||||
} else {
|
|
||||||
url = self.getUrl("Items/" + itemId + "/Images");
|
|
||||||
}
|
|
||||||
|
|
||||||
url += "/" + imageType;
|
url += "/" + imageType;
|
||||||
|
|
||||||
|
@ -1738,36 +1621,15 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.updateItemImageIndex = function (itemId, itemType, itemName, imageType, imageIndex, newIndex) {
|
self.updateItemImageIndex = function (itemId, imageType, imageIndex, newIndex) {
|
||||||
|
|
||||||
if (!imageType) {
|
if (!imageType) {
|
||||||
throw new Error("null imageType");
|
throw new Error("null imageType");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!itemType) {
|
|
||||||
throw new Error("null itemType");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url;
|
|
||||||
|
|
||||||
var options = { newIndex: newIndex };
|
var options = { newIndex: newIndex };
|
||||||
|
|
||||||
if (itemType == "Artist") {
|
var url = self.getUrl("Items/" + itemId + "/Images/" + imageType + "/" + imageIndex + "/Index", options);
|
||||||
url = self.getUrl("Artists/" + self.encodeName(itemName) + "/Images/" + imageType + "/" + imageIndex + "/Index", options);
|
|
||||||
}
|
|
||||||
else if (itemType == "Genre") {
|
|
||||||
url = self.getUrl("Genres/" + self.encodeName(itemName) + "/Images/" + imageType + "/" + imageIndex + "/Index", options);
|
|
||||||
} else if (itemType == "GameGenre") {
|
|
||||||
url = self.getUrl("GameGenres/" + self.encodeName(itemName) + "/Images/" + imageType + "/" + imageIndex + "/Index", options);
|
|
||||||
} else if (itemType == "MusicGenre") {
|
|
||||||
url = self.getUrl("MusicGenres/" + self.encodeName(itemName) + "/Images/" + imageType + "/" + imageIndex + "/Index", options);
|
|
||||||
} else if (itemType == "Person") {
|
|
||||||
url = self.getUrl("Persons/" + self.encodeName(itemName) + "/Images/" + imageType + "/" + imageIndex + "/Index", options);
|
|
||||||
} else if (itemType == "Studio") {
|
|
||||||
url = self.getUrl("Studios/" + self.encodeName(itemName) + "/Images/" + imageType + "/" + imageIndex + "/Index", options);
|
|
||||||
} else {
|
|
||||||
url = self.getUrl("Items/" + itemId + "/Images/" + imageType + "/" + imageIndex + "/Index", options);
|
|
||||||
}
|
|
||||||
|
|
||||||
return self.ajax({
|
return self.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
@ -1775,30 +1637,9 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getItemImageInfos = function (itemId, itemType, itemName) {
|
self.getItemImageInfos = function (itemId) {
|
||||||
|
|
||||||
if (!itemType) {
|
var url = self.getUrl("Items/" + itemId + "/Images");
|
||||||
throw new Error("null itemType");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url;
|
|
||||||
|
|
||||||
if (itemType == "Artist") {
|
|
||||||
url = self.getUrl("Artists/" + self.encodeName(itemName) + "/Images");
|
|
||||||
}
|
|
||||||
else if (itemType == "Genre") {
|
|
||||||
url = self.getUrl("Genres/" + self.encodeName(itemName) + "/Images");
|
|
||||||
} else if (itemType == "GameGenre") {
|
|
||||||
url = self.getUrl("GameGenres/" + self.encodeName(itemName) + "/Images");
|
|
||||||
} else if (itemType == "MusicGenre") {
|
|
||||||
url = self.getUrl("MusicGenres/" + self.encodeName(itemName) + "/Images");
|
|
||||||
} else if (itemType == "Person") {
|
|
||||||
url = self.getUrl("Persons/" + self.encodeName(itemName) + "/Images");
|
|
||||||
} else if (itemType == "Studio") {
|
|
||||||
url = self.getUrl("Studios/" + self.encodeName(itemName) + "/Images");
|
|
||||||
} else {
|
|
||||||
url = self.getUrl("Items/" + itemId + "/Images");
|
|
||||||
}
|
|
||||||
|
|
||||||
return self.ajax({
|
return self.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
|
@ -1897,7 +1738,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
};
|
};
|
||||||
|
|
||||||
self.uploadItemImage = function (itemId, itemType, itemName, imageType, file) {
|
self.uploadItemImage = function (itemId, imageType, file) {
|
||||||
|
|
||||||
if (!itemId) {
|
if (!itemId) {
|
||||||
throw new Error("null itemId");
|
throw new Error("null itemId");
|
||||||
|
@ -1915,24 +1756,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
throw new Error("File must be an image.");
|
throw new Error("File must be an image.");
|
||||||
}
|
}
|
||||||
|
|
||||||
var url;
|
var url = self.getUrl("Items/" + itemId + "/Images");
|
||||||
|
|
||||||
if (itemType == "Artist") {
|
|
||||||
url = self.getUrl("Artists/" + self.encodeName(itemName) + "/Images");
|
|
||||||
}
|
|
||||||
else if (itemType == "Genre") {
|
|
||||||
url = self.getUrl("Genres/" + self.encodeName(itemName) + "/Images");
|
|
||||||
} else if (itemType == "GameGenre") {
|
|
||||||
url = self.getUrl("GameGenres/" + self.encodeName(itemName) + "/Images");
|
|
||||||
} else if (itemType == "MusicGenre") {
|
|
||||||
url = self.getUrl("MusicGenres/" + self.encodeName(itemName) + "/Images");
|
|
||||||
} else if (itemType == "Person") {
|
|
||||||
url = self.getUrl("Persons/" + self.encodeName(itemName) + "/Images");
|
|
||||||
} else if (itemType == "Studio") {
|
|
||||||
url = self.getUrl("Studios/" + self.encodeName(itemName) + "/Images");
|
|
||||||
} else {
|
|
||||||
url = self.getUrl("Items/" + itemId + "/Images");
|
|
||||||
}
|
|
||||||
|
|
||||||
url += "/" + imageType;
|
url += "/" + imageType;
|
||||||
|
|
||||||
|
@ -2583,102 +2407,6 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.updateArtist = function (item) {
|
|
||||||
|
|
||||||
if (!item) {
|
|
||||||
throw new Error("null item");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Artists/" + self.encodeName(item.Name));
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url,
|
|
||||||
data: JSON.stringify(item),
|
|
||||||
contentType: "application/json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updatePerson = function (item) {
|
|
||||||
|
|
||||||
if (!item) {
|
|
||||||
throw new Error("null item");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Persons/" + self.encodeName(item.Name));
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url,
|
|
||||||
data: JSON.stringify(item),
|
|
||||||
contentType: "application/json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updateStudio = function (item) {
|
|
||||||
|
|
||||||
if (!item) {
|
|
||||||
throw new Error("null item");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Studios/" + self.encodeName(item.Name));
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url,
|
|
||||||
data: JSON.stringify(item),
|
|
||||||
contentType: "application/json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updateGenre = function (item) {
|
|
||||||
|
|
||||||
if (!item) {
|
|
||||||
throw new Error("null item");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Genres/" + self.encodeName(item.Name));
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url,
|
|
||||||
data: JSON.stringify(item),
|
|
||||||
contentType: "application/json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updateMusicGenre = function (item) {
|
|
||||||
|
|
||||||
if (!item) {
|
|
||||||
throw new Error("null item");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("MusicGenres/" + self.encodeName(item.Name));
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url,
|
|
||||||
data: JSON.stringify(item),
|
|
||||||
contentType: "application/json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updateGameGenre = function (item) {
|
|
||||||
|
|
||||||
if (!item) {
|
|
||||||
throw new Error("null item");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("GameGenres/" + self.encodeName(item.Name));
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url,
|
|
||||||
data: JSON.stringify(item),
|
|
||||||
contentType: "application/json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates plugin security info
|
* Updates plugin security info
|
||||||
*/
|
*/
|
||||||
|
@ -3171,389 +2899,6 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates a user's favorite status for an item by name.
|
|
||||||
* @param {String} userId
|
|
||||||
* @param {String} name
|
|
||||||
* @param {Boolean} isFavorite
|
|
||||||
*/
|
|
||||||
self.updateFavoriteArtistStatus = function (userId, name, isFavorite) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Favorites/Artists/" + self.encodeName(name));
|
|
||||||
|
|
||||||
var method = isFavorite ? "POST" : "DELETE";
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: method,
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updateFavoritePersonStatus = function (userId, name, isFavorite) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Favorites/Persons/" + self.encodeName(name));
|
|
||||||
|
|
||||||
var method = isFavorite ? "POST" : "DELETE";
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: method,
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updateFavoriteStudioStatus = function (userId, name, isFavorite) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Favorites/Studios/" + self.encodeName(name));
|
|
||||||
|
|
||||||
var method = isFavorite ? "POST" : "DELETE";
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: method,
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updateFavoriteGenreStatus = function (userId, name, isFavorite) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Favorites/Genres/" + self.encodeName(name));
|
|
||||||
|
|
||||||
var method = isFavorite ? "POST" : "DELETE";
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: method,
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updateFavoriteMusicGenreStatus = function (userId, name, isFavorite) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Favorites/MusicGenres/" + self.encodeName(name));
|
|
||||||
|
|
||||||
var method = isFavorite ? "POST" : "DELETE";
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: method,
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updateFavoriteGameGenreStatus = function (userId, name, isFavorite) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Favorites/GameGenres/" + self.encodeName(name));
|
|
||||||
|
|
||||||
var method = isFavorite ? "POST" : "DELETE";
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: method,
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates a user's rating for an item by name.
|
|
||||||
* @param {String} userId
|
|
||||||
* @param {String} name
|
|
||||||
* @param {Boolean} likes
|
|
||||||
*/
|
|
||||||
self.updateArtistRating = function (userId, name, likes) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Ratings/Artists/" + self.encodeName(name), {
|
|
||||||
likes: likes
|
|
||||||
});
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updatePersonRating = function (userId, name, likes) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Ratings/Persons/" + self.encodeName(name), {
|
|
||||||
likes: likes
|
|
||||||
});
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updateStudioRating = function (userId, name, likes) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Ratings/Studios/" + self.encodeName(name), {
|
|
||||||
likes: likes
|
|
||||||
});
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updateGenreRating = function (userId, name, likes) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Ratings/Genres/" + self.encodeName(name), {
|
|
||||||
likes: likes
|
|
||||||
});
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updateMusicGenreRating = function (userId, name, likes) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Ratings/MusicGenres/" + self.encodeName(name), {
|
|
||||||
likes: likes
|
|
||||||
});
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.updateGameGenreRating = function (userId, name, likes) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Ratings/GameGenres/" + self.encodeName(name), {
|
|
||||||
likes: likes
|
|
||||||
});
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears a user's rating for an item by name.
|
|
||||||
* @param {String} userId
|
|
||||||
* @param {String} name
|
|
||||||
*/
|
|
||||||
self.clearArtistRating = function (userId, name) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Ratings/Artists/" + self.encodeName(name));
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "DELETE",
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.clearPersonRating = function (userId, name) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Ratings/Persons/" + self.encodeName(name));
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "DELETE",
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.clearStudioRating = function (userId, name) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Ratings/Studios/" + self.encodeName(name));
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "DELETE",
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.clearGenreRating = function (userId, name) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Ratings/Genres/" + self.encodeName(name));
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "DELETE",
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.clearMusicGenreRating = function (userId, name) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Ratings/MusicGenres/" + self.encodeName(name));
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "DELETE",
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.clearGameGenreRating = function (userId, name) {
|
|
||||||
|
|
||||||
if (!userId) {
|
|
||||||
throw new Error("null userId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
throw new Error("null name");
|
|
||||||
}
|
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Ratings/GameGenres/" + self.encodeName(name));
|
|
||||||
|
|
||||||
return self.ajax({
|
|
||||||
type: "DELETE",
|
|
||||||
url: url,
|
|
||||||
dataType: "json"
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.getItemCounts = function (userId) {
|
self.getItemCounts = function (userId) {
|
||||||
|
|
||||||
var options = {};
|
var options = {};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue