mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
use common sharing manager
This commit is contained in:
parent
190f70bb71
commit
3657bdf7b7
10 changed files with 80 additions and 79 deletions
|
@ -16,12 +16,12 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {},
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"version": "1.2.50",
|
"version": "1.2.51",
|
||||||
"_release": "1.2.50",
|
"_release": "1.2.51",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "1.2.50",
|
"tag": "1.2.51",
|
||||||
"commit": "b58b3517bb892e0cde54a8a5f5bf318248f0eb13"
|
"commit": "0de31178ecd029314513167a880a1cf645140917"
|
||||||
},
|
},
|
||||||
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
|
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
|
||||||
"_target": "^1.2.0",
|
"_target": "^1.2.0",
|
||||||
|
|
|
@ -378,7 +378,7 @@
|
||||||
.guideChannelName {
|
.guideChannelName {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
max-width: 50%;
|
max-width: 40%;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
60
dashboard-ui/bower_components/emby-webcomponents/sharing/sharingmanager.js
vendored
Normal file
60
dashboard-ui/bower_components/emby-webcomponents/sharing/sharingmanager.js
vendored
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
define(['connectionManager', 'sharingMenu', 'loading'], function (connectionManager, sharingMenu, loading) {
|
||||||
|
|
||||||
|
function onSharingSuccess(options) {
|
||||||
|
|
||||||
|
console.log('share success. shareId: ' + options.share.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
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(apiClient, itemId) {
|
||||||
|
|
||||||
|
loading.show();
|
||||||
|
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();
|
||||||
|
sharingMenu.showMenu(options, onSharingSuccess, function (options) {
|
||||||
|
onSharingCancel(options, apiClient);
|
||||||
|
});
|
||||||
|
|
||||||
|
}, function () {
|
||||||
|
|
||||||
|
loading.hide();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
showMenu: showMenu
|
||||||
|
};
|
||||||
|
});
|
|
@ -30,14 +30,14 @@
|
||||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||||
},
|
},
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"homepage": "https://github.com/PolymerElements/iron-a11y-keys-behavior",
|
"homepage": "https://github.com/polymerelements/iron-a11y-keys-behavior",
|
||||||
"_release": "1.1.2",
|
"_release": "1.1.2",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "v1.1.2",
|
"tag": "v1.1.2",
|
||||||
"commit": "0c2330c229a6fd3d200e2b84147ec6f94f17c22d"
|
"commit": "0c2330c229a6fd3d200e2b84147ec6f94f17c22d"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/PolymerElements/iron-a11y-keys-behavior.git",
|
"_source": "git://github.com/polymerelements/iron-a11y-keys-behavior.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.0.0",
|
||||||
"_originalSource": "PolymerElements/iron-a11y-keys-behavior"
|
"_originalSource": "polymerelements/iron-a11y-keys-behavior"
|
||||||
}
|
}
|
|
@ -26,14 +26,14 @@
|
||||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||||
},
|
},
|
||||||
"main": "iron-meta.html",
|
"main": "iron-meta.html",
|
||||||
"homepage": "https://github.com/polymerelements/iron-meta",
|
"homepage": "https://github.com/PolymerElements/iron-meta",
|
||||||
"_release": "1.1.1",
|
"_release": "1.1.1",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "v1.1.1",
|
"tag": "v1.1.1",
|
||||||
"commit": "e171ee234b482219c9514e6f9551df48ef48bd9f"
|
"commit": "e171ee234b482219c9514e6f9551df48ef48bd9f"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/polymerelements/iron-meta.git",
|
"_source": "git://github.com/PolymerElements/iron-meta.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.0.0",
|
||||||
"_originalSource": "polymerelements/iron-meta"
|
"_originalSource": "PolymerElements/iron-meta"
|
||||||
}
|
}
|
|
@ -34,6 +34,6 @@
|
||||||
"commit": "11c987b2eb3c73b388a79fc8aaea8ca01624f514"
|
"commit": "11c987b2eb3c73b388a79fc8aaea8ca01624f514"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/Polymer/polymer.git",
|
"_source": "git://github.com/Polymer/polymer.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.1.0",
|
||||||
"_originalSource": "Polymer/polymer"
|
"_originalSource": "Polymer/polymer"
|
||||||
}
|
}
|
|
@ -960,8 +960,8 @@
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
|
||||||
case 'share':
|
case 'share':
|
||||||
require(['sharingmanager'], function () {
|
require(['sharingmanager'], function (sharingManager) {
|
||||||
SharingManager.showMenu(Dashboard.getCurrentUserId(), itemId);
|
sharingManager.showMenu(ApiClient, itemId);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'addtocollection':
|
case 'addtocollection':
|
||||||
|
|
|
@ -576,8 +576,8 @@
|
||||||
LibraryBrowser.playInExternalPlayer(itemId);
|
LibraryBrowser.playInExternalPlayer(itemId);
|
||||||
break;
|
break;
|
||||||
case 'share':
|
case 'share':
|
||||||
require(['sharingmanager'], function () {
|
require(['sharingmanager'], function (sharingManager) {
|
||||||
SharingManager.showMenu(Dashboard.getCurrentUserId(), itemId);
|
sharingManager.showMenu(ApiClient, itemId);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'removefromplaylist':
|
case 'removefromplaylist':
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
define([], function () {
|
|
||||||
|
|
||||||
function onSharingSuccess(options) {
|
|
||||||
|
|
||||||
console.log('share success. shareId: ' + options.share.Id);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSharingCancel(options) {
|
|
||||||
|
|
||||||
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(userId, itemId) {
|
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
|
||||||
|
|
||||||
require(['sharingwidget'], function (SharingWidget) {
|
|
||||||
|
|
||||||
ApiClient.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: ApiClient.getUrl('Social/Shares', {
|
|
||||||
|
|
||||||
ItemId: itemId,
|
|
||||||
UserId: userId
|
|
||||||
}),
|
|
||||||
dataType: "json"
|
|
||||||
|
|
||||||
}).then(function (share) {
|
|
||||||
|
|
||||||
var options = {
|
|
||||||
share: share
|
|
||||||
};
|
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
|
||||||
SharingWidget.showMenu(options, onSharingSuccess, onSharingCancel);
|
|
||||||
|
|
||||||
}, function () {
|
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
window.SharingManager = {
|
|
||||||
showMenu: showMenu
|
|
||||||
};
|
|
||||||
|
|
||||||
});
|
|
|
@ -1651,12 +1651,12 @@ var AppInfo = {};
|
||||||
paths.hlsjs = bowerPath + "/hls.js/dist/hls.min";
|
paths.hlsjs = bowerPath + "/hls.js/dist/hls.min";
|
||||||
|
|
||||||
if (Dashboard.isRunningInCordova()) {
|
if (Dashboard.isRunningInCordova()) {
|
||||||
paths.sharingwidget = "cordova/sharingwidget";
|
paths.sharingMenu = "cordova/sharingwidget";
|
||||||
paths.serverdiscovery = "cordova/serverdiscovery";
|
paths.serverdiscovery = "cordova/serverdiscovery";
|
||||||
paths.wakeonlan = "cordova/wakeonlan";
|
paths.wakeonlan = "cordova/wakeonlan";
|
||||||
paths.actionsheet = "cordova/actionsheet";
|
paths.actionsheet = "cordova/actionsheet";
|
||||||
} else {
|
} else {
|
||||||
paths.sharingwidget = "components/sharingwidget";
|
paths.sharingMenu = "components/sharingwidget";
|
||||||
paths.serverdiscovery = apiClientBowerPath + "/serverdiscovery";
|
paths.serverdiscovery = apiClientBowerPath + "/serverdiscovery";
|
||||||
paths.wakeonlan = apiClientBowerPath + "/wakeonlan";
|
paths.wakeonlan = apiClientBowerPath + "/wakeonlan";
|
||||||
|
|
||||||
|
@ -1678,6 +1678,8 @@ var AppInfo = {};
|
||||||
return viewManager;
|
return viewManager;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
define("sharingmanager", [embyWebComponentsBowerPath + "/sharing/sharingmanager"], returnFirstDependency);
|
||||||
|
|
||||||
// hack for an android test before browserInfo is loaded
|
// hack for an android test before browserInfo is loaded
|
||||||
if (Dashboard.isRunningInCordova() && window.MainActivity) {
|
if (Dashboard.isRunningInCordova() && window.MainActivity) {
|
||||||
paths.appStorage = "cordova/android/appstorage";
|
paths.appStorage = "cordova/android/appstorage";
|
||||||
|
@ -2028,8 +2030,6 @@ var AppInfo = {};
|
||||||
define("detailtablecss", ['css!css/detailtable.css']);
|
define("detailtablecss", ['css!css/detailtable.css']);
|
||||||
define("tileitemcss", ['css!css/tileitem.css']);
|
define("tileitemcss", ['css!css/tileitem.css']);
|
||||||
|
|
||||||
define("sharingmanager", ["scripts/sharingmanager"]);
|
|
||||||
|
|
||||||
if (Dashboard.isRunningInCordova() && browserInfo.safari) {
|
if (Dashboard.isRunningInCordova() && browserInfo.safari) {
|
||||||
define("searchmenu", ["cordova/searchmenu"]);
|
define("searchmenu", ["cordova/searchmenu"]);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue