diff --git a/dashboard-ui/scripts/registrationservices.js b/dashboard-ui/scripts/registrationservices.js index 836404a138..4caedba513 100644 --- a/dashboard-ui/scripts/registrationservices.js +++ b/dashboard-ui/scripts/registrationservices.js @@ -1,10 +1,10 @@ (function () { - var supporterPlaybackKey = 'lastSupporterPlaybackMessage2'; + var supporterPlaybackKey = 'lastSupporterPlaybackMessage4'; function validatePlayback(deferred) { - Dashboard.getPluginSecurityInfo().done(function (pluginSecurityInfo) { + Dashboard.getPluginSecurityInfo().then(function (pluginSecurityInfo) { if (pluginSecurityInfo.IsMBSupporter) { deferred.resolve(); @@ -97,48 +97,58 @@ function showPlaybackOverlay(deferred) { - require(['paperbuttonstyle']); + require(['components/paperdialoghelper'], function () { - var html = ''; - html += '
'; - html += '
'; - html += '
'; + var dlg = PaperDialogHelper.createDialog({}); - html += '

' + Globalize.translate('HeaderTryEmbyPremiere') + '

'; + var html = ''; + html += '

'; + html += ''; + html += '

'; - html += '

' + Globalize.translate('MessageDidYouKnowCinemaMode') + '

'; - html += '

' + Globalize.translate('MessageDidYouKnowCinemaMode2') + '

'; + html += '
'; - html += '
'; + html += '

' + Globalize.translate('HeaderTryEmbyPremiere') + '

'; - html += '

' + Globalize.translate('HeaderBenefitsEmbyPremiere') + '

'; + html += '

' + Globalize.translate('MessageDidYouKnowCinemaMode') + '

'; + html += '

' + Globalize.translate('MessageDidYouKnowCinemaMode2') + '

'; - html += '
'; - html += getSubscriptionBenefits().map(getSubscriptionBenefitHtml).join(''); - html += '
'; + html += '
'; - html += '
'; + html += '

' + Globalize.translate('HeaderBenefitsEmbyPremiere') + '

'; - html += '' + Globalize.translate('ButtonBecomeSupporter') + ''; - html += '' + Globalize.translate('ButtonClosePlayVideo') + ''; + html += '
'; + html += getSubscriptionBenefits().map(getSubscriptionBenefitHtml).join(''); + html += '
'; - html += '
'; - html += '
'; - html += '
'; + html += '
'; - $(document.body).append(html); + html += '' + Globalize.translate('ButtonBecomeSupporter') + ''; + html += '' + Globalize.translate('ButtonClosePlayVideo') + ''; - $('.btnCancelSupporterInfo').on('click', function () { + html += '
'; - $('.supporterInfoOverlay').remove(); - appStorage.setItem(supporterPlaybackKey, new Date().getTime()); - deferred.resolve(); + dlg.innerHTML = html; + document.body.appendChild(dlg); + + // Has to be assigned a z-index after the call to .open() + dlg.addEventListener('iron-overlay-closed', function(e) { + appStorage.setItem(supporterPlaybackKey, new Date().getTime()); + dlg.parentNode.removeChild(dlg); + deferred.resolve(); + }); + + PaperDialogHelper.openWithHash(dlg, 'premiere'); + + $('.btnCancelSupporterInfo').on('click', function () { + PaperDialogHelper.close(dlg); + }); }); } function validateSync(deferred) { - Dashboard.getPluginSecurityInfo().done(function (pluginSecurityInfo) { + Dashboard.getPluginSecurityInfo().then(function (pluginSecurityInfo) { if (pluginSecurityInfo.IsMBSupporter) { deferred.resolve(); @@ -147,7 +157,7 @@ Dashboard.showLoadingMsg(); - ApiClient.getRegistrationInfo('Sync').done(function (registrationInfo) { + ApiClient.getRegistrationInfo('Sync').then(function (registrationInfo) { Dashboard.hideLoadingMsg(); @@ -161,7 +171,7 @@ title: Globalize.translate('HeaderSync') }); - }).fail(function () { + }, function () { Dashboard.hideLoadingMsg(); @@ -276,4 +286,4 @@ } }; -})(); +})(); \ No newline at end of file