1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
This commit is contained in:
Luke Pulverenti 2017-01-27 18:07:14 -05:00
parent 82bcca376f
commit 8a6884abef
494 changed files with 256 additions and 120180 deletions

View file

@ -1,59 +1 @@
define(['connectionManager', 'sharingMenu', 'loading'], function (connectionManager, sharingMenu, loading) {
'use strict';
function onSharingCancel(options, apiClient) {
var shareId = options.share.Id;
console.log('share cancelled. shareId: ' + shareId);
// Delete the share since it was cancelled
apiClient.ajax({
type: 'DELETE',
url: apiClient.getUrl('Social/Shares/' + shareId)
});
}
function showMenu(options) {
loading.show();
var itemId = options.itemId;
var apiClient = connectionManager.getApiClient(options.serverId);
var userId = apiClient.getCurrentUserId();
return apiClient.getItem(userId, itemId).then(function () {
return apiClient.ajax({
type: 'POST',
url: apiClient.getUrl('Social/Shares', {
ItemId: itemId,
UserId: userId
}),
dataType: "json"
}).then(function (share) {
var options = {
share: share
};
loading.hide();
return sharingMenu.showMenu(options).then(function () {
console.log('share success. shareId: ' + options.share.Id);
}, function () {
onSharingCancel(options, apiClient);
});
}, function () {
loading.hide();
});
});
}
return {
showMenu: showMenu
};
});
define(["connectionManager","sharingMenu","loading"],function(connectionManager,sharingMenu,loading){"use strict";function onSharingCancel(options,apiClient){var shareId=options.share.Id;console.log("share cancelled. shareId: "+shareId),apiClient.ajax({type:"DELETE",url:apiClient.getUrl("Social/Shares/"+shareId)})}function showMenu(options){loading.show();var itemId=options.itemId,apiClient=connectionManager.getApiClient(options.serverId),userId=apiClient.getCurrentUserId();return apiClient.getItem(userId,itemId).then(function(){return apiClient.ajax({type:"POST",url:apiClient.getUrl("Social/Shares",{ItemId:itemId,UserId:userId}),dataType:"json"}).then(function(share){var options={share:share};return loading.hide(),sharingMenu.showMenu(options).then(function(){console.log("share success. shareId: "+options.share.Id)},function(){onSharingCancel(options,apiClient)})},function(){loading.hide()})})}return{showMenu:showMenu}});