diff --git a/src/bower_components/emby-webcomponents/fullscreen/fullscreenmanager.js b/src/bower_components/emby-webcomponents/fullscreen/fullscreenmanager.js index d39d8fd3b6..5773e57d07 100644 --- a/src/bower_components/emby-webcomponents/fullscreen/fullscreenmanager.js +++ b/src/bower_components/emby-webcomponents/fullscreen/fullscreenmanager.js @@ -29,11 +29,14 @@ define(['events', 'dom'], function (events, dom) { } if (element.webkitEnterFullscreen) { element.webkitEnterFullscreen(); - } + } }; fullscreenManager.prototype.exitFullscreen = function () { + if (!this.isFullScreen()) { + return; + } if (document.exitFullscreen) { document.exitFullscreen(); } else if (document.mozCancelFullScreen) { @@ -47,9 +50,15 @@ define(['events', 'dom'], function (events, dom) { } }; + // TODO: use screenfull.js fullscreenManager.prototype.isFullScreen = function () { - - return document.fullscreen || document.mozFullScreen || document.webkitIsFullScreen || document.msFullscreenElement ? true : false; + return document.fullscreen || + document.mozFullScreen || + document.webkitIsFullScreen || + document.msFullscreenElement || /* IE/Edge syntax */ + document.fullscreenElement || /* Standard syntax */ + document.webkitFullscreenElement || /* Chrome, Safari and Opera syntax */ + document.mozFullScreenElement; /* Firefox syntax */ }; var manager = new fullscreenManager(); @@ -71,4 +80,4 @@ define(['events', 'dom'], function (events, dom) { }); return manager; -}); \ No newline at end of file +}); diff --git a/src/bower_components/emby-webcomponents/htmlvideoplayer/plugin.js b/src/bower_components/emby-webcomponents/htmlvideoplayer/plugin.js index 19b075b622..d25b49163b 100644 --- a/src/bower_components/emby-webcomponents/htmlvideoplayer/plugin.js +++ b/src/bower_components/emby-webcomponents/htmlvideoplayer/plugin.js @@ -1,4 +1,4 @@ -define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackManager', 'appRouter', 'appSettings', 'connectionManager', 'htmlMediaHelper', 'itemHelper'], function (browser, require, events, appHost, loading, dom, playbackManager, appRouter, appSettings, connectionManager, htmlMediaHelper, itemHelper) { +define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackManager', 'appRouter', 'appSettings', 'connectionManager', 'htmlMediaHelper', 'itemHelper', 'fullscreenManager'], function (browser, require, events, appHost, loading, dom, playbackManager, appRouter, appSettings, connectionManager, htmlMediaHelper, itemHelper, fullscreenManager) { "use strict"; var mediaManager; @@ -692,6 +692,8 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa dlg.parentNode.removeChild(dlg); } + + fullscreenManager.exitFullscreen(); }; function onEnded() { diff --git a/src/opensubtitles.html b/src/opensubtitles.html new file mode 100644 index 0000000000..51e337ae63 --- /dev/null +++ b/src/opensubtitles.html @@ -0,0 +1,27 @@ +
+
+
+
+
+ +
+ +
+
+
+ + +
+
+ +
+
+ +
+
${SubtitleDownloadInstructions}
+
+
+
+
diff --git a/src/scripts/librarymenu.js b/src/scripts/librarymenu.js index 18fafa8bf6..8d65f9420b 100644 --- a/src/scripts/librarymenu.js +++ b/src/scripts/librarymenu.js @@ -297,6 +297,11 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", " icon: "swap_horiz", href: "encodingsettings.html", pageIds: ["encodingSettingsPage"] + }, { + name: "Open Subtitles", + href: "opensubtitles.html", + pageIds: ["openSubtitlesPage"], + icon: "closed_caption" }]; addPluginPagesToMainMenu(links, pluginItems, "server"); links.push({ diff --git a/src/scripts/opensubtitles.js b/src/scripts/opensubtitles.js new file mode 100644 index 0000000000..99ec982dc1 --- /dev/null +++ b/src/scripts/opensubtitles.js @@ -0,0 +1,36 @@ +define(["loading", "fnchecked", "emby-linkbutton", "emby-input", "emby-checkbox", "emby-button"], function (loading) { + "use strict"; + + function loadPage(page, config) { + page.querySelector("#txtOpenSubtitleUsername").value = config.OpenSubtitlesUsername; + page.querySelector("#txtOpenSubtitlePassword").value = config.OpenSubtitlesPasswordHash || ""; + loading.hide(); + } + + function onSubmit(evt) { + evt.preventDefault(); + loading.show(); + var form = this; + ApiClient.getNamedConfiguration("subtitles").then(function (config) { + config.OpenSubtitlesUsername = form.querySelector("#txtOpenSubtitleUsername").value; + var newPassword = form.querySelector("#txtOpenSubtitlePassword").value; + + if (newPassword) { + config.OpenSubtitlesPasswordHash = newPassword; + } + + ApiClient.updateNamedConfiguration("subtitles", config).then(Dashboard.processServerConfigurationUpdateResult); + }); + return false; + } + + $(document).on("pageinit", "#openSubtitlesPage", function() { + $(".metadataSubtitlesForm").off("submit", onSubmit).on("submit", onSubmit) + }).on("pageshow", "#openSubtitlesPage", function() { + loading.show(); + var page = this; + ApiClient.getNamedConfiguration("subtitles").then(function (response) { + loadPage(page, response); + }); + }); +}); diff --git a/src/scripts/site.js b/src/scripts/site.js index 885529cdff..573464ec2c 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -512,6 +512,11 @@ var Dashboard = { dependencies: [], autoFocus: !1, roles: "admin" + }), defineRoute({ + path: "/opensubtitles.html", + dependencies: [], + autoFocus: !1, + roles: "admin" }), defineRoute({ path: "/forgotpassword.html", dependencies: ["emby-input", "emby-button"], diff --git a/src/strings/en-us.json b/src/strings/en-us.json index 407683a655..c8a73f205a 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -159,6 +159,7 @@ "ButtonReenable": "Re-enable", "ButtonRefresh": "Refresh", "ButtonRefreshGuideData": "Refresh Guide Data", + "ButtonRegister": "Register", "ButtonReject": "Reject", "ButtonRemote": "Remote", "ButtonRemoteControl": "Remote Control",