mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add new sharing function
This commit is contained in:
parent
d1842ae4e3
commit
c8eb5f2b0c
14 changed files with 504 additions and 8 deletions
78
dashboard-ui/scripts/sharingwidget.js
Normal file
78
dashboard-ui/scripts/sharingwidget.js
Normal file
|
@ -0,0 +1,78 @@
|
|||
(function () {
|
||||
|
||||
function showMenu(options, successCallback, cancelCallback) {
|
||||
|
||||
Dashboard.importCss('thirdparty/social-share-kit-1.0.4/dist/css/social-share-kit.css');
|
||||
|
||||
require(['paperbuttonstyle', 'thirdparty/social-share-kit-1.0.4/dist/js/social-share-kit.min'], function () {
|
||||
|
||||
var id = 'dlg' + new Date().getTime();
|
||||
var html = '';
|
||||
|
||||
html += '<paper-dialog id="' + id + '" entry-animation="fade-in-animation" exit-animation="fade-out-animation" with-backdrop>';
|
||||
|
||||
html += '<h2>' + Globalize.translate('HeaderShare') + '</h2>';
|
||||
|
||||
html += '<div>';
|
||||
html += '<div class="ssk-group ssk-round ssk-lg"><a href="" class="ssk ssk-facebook"></a><a href="" class="ssk ssk-twitter"></a><a href="" class="ssk ssk-google-plus"></a><a href="" class="ssk ssk-pinterest"></a><a href="" class="ssk ssk-tumblr"></a></div>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div style="max-width:240px;">';
|
||||
html += Globalize.translate('ButtonShareHelp');
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="buttons">';
|
||||
html += '<paper-button class="btnCancel" dialog-dismiss>' + Globalize.translate('ButtonCancel') + '</paper-button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '</paper-dialog>';
|
||||
|
||||
$(document.body).append(html);
|
||||
|
||||
var isShared = false;
|
||||
|
||||
setTimeout(function () {
|
||||
|
||||
var dlg = document.getElementById(id);
|
||||
|
||||
dlg.open();
|
||||
|
||||
var shareInfo = options.share;
|
||||
|
||||
SocialShareKit.init({
|
||||
selector: '#' + id + ' .ssk',
|
||||
url: shareInfo.Url,
|
||||
title: shareInfo.Name,
|
||||
text: shareInfo.Overview,
|
||||
image: shareInfo.ImageUrl,
|
||||
via: 'Emby'
|
||||
});
|
||||
|
||||
// Has to be assigned a z-index after the call to .open()
|
||||
$(dlg).on('iron-overlay-closed', function () {
|
||||
$(this).remove();
|
||||
|
||||
if (isShared) {
|
||||
successCallback(options);
|
||||
} else {
|
||||
cancelCallback(options);
|
||||
}
|
||||
});
|
||||
|
||||
// Has to be assigned a z-index after the call to .open()
|
||||
$('.ssk', dlg).on('click', function () {
|
||||
isShared = true;
|
||||
dlg.close();
|
||||
});
|
||||
|
||||
}, 100);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
window.SharingWidget = {
|
||||
showMenu: showMenu
|
||||
};
|
||||
|
||||
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue