(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 += ''; html += '

' + Globalize.translate('HeaderShare') + '

'; html += '
'; html += '
'; // We can only do facebook if we can guarantee that the current page is available over the internet, since FB will try to probe it. if (Dashboard.isConnectMode()) { html += ''; } html += '
'; html += '
'; html += '
'; html += Globalize.translate('ButtonShareHelp'); html += '
'; html += '
'; html += '' + Globalize.translate('ButtonCancel') + ''; html += '
'; html += '
'; $(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 }; })();