jellyfin-web/dashboard-ui/scripts/sharingmanager.js

59 lines
1.3 KiB
JavaScript
Raw Normal View History

2015-06-30 16:59:45 -07:00
(function () {
function onSharingSuccess(options) {
2015-12-23 10:46:01 -07:00
console.log('share success. shareId: ' + options.share.Id);
2015-06-30 16:59:45 -07:00
}
function onSharingCancel(options) {
var shareId = options.share.Id;
2015-12-23 10:46:01 -07:00
console.log('share cancelled. shareId: ' + shareId);
2015-06-30 16:59:45 -07:00
// Delete the share since it was cancelled
ApiClient.ajax({
type: 'DELETE',
url: ApiClient.getUrl('Social/Shares/' + shareId)
});
}
function showMenu(userId, itemId) {
Dashboard.showLoadingMsg();
2015-12-14 08:43:03 -07:00
require(['sharingwidget'], function (SharingWidget) {
2015-06-30 16:59:45 -07:00
ApiClient.ajax({
type: 'POST',
url: ApiClient.getUrl('Social/Shares', {
ItemId: itemId,
UserId: userId
}),
dataType: "json"
2015-12-14 08:43:03 -07:00
}).then(function (share) {
2015-06-30 16:59:45 -07:00
var options = {
share: share
};
Dashboard.hideLoadingMsg();
SharingWidget.showMenu(options, onSharingSuccess, onSharingCancel);
2015-12-14 08:43:03 -07:00
}, function () {
2015-06-30 16:59:45 -07:00
Dashboard.hideLoadingMsg();
});
});
}
window.SharingManager = {
showMenu: showMenu
};
})();