Merge remote-tracking branch 'upstream/master' into translate-everything
This commit is contained in:
commit
3543a60b8b
53 changed files with 1287 additions and 1116 deletions
|
@ -511,9 +511,16 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
|||
return baseRoute;
|
||||
}
|
||||
|
||||
var popstateOccurred = false;
|
||||
window.addEventListener('popstate', function () {
|
||||
popstateOccurred = true;
|
||||
});
|
||||
|
||||
function getHandler(route) {
|
||||
return function (ctx, next) {
|
||||
ctx.isBack = popstateOccurred;
|
||||
handleRoute(ctx, next, route);
|
||||
popstateOccurred = false;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
34
src/components/castSenderApi.js
Normal file
34
src/components/castSenderApi.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
define([], function() {
|
||||
'use strict';
|
||||
|
||||
if (window.appMode === "cordova" || window.appMode === "android") {
|
||||
return {
|
||||
load: function () {
|
||||
window.chrome = window.chrome || {};
|
||||
return Promise.resolve();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
var ccLoaded = false;
|
||||
return {
|
||||
load: function () {
|
||||
if (ccLoaded) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
var fileref = document.createElement("script");
|
||||
fileref.setAttribute("type", "text/javascript");
|
||||
|
||||
fileref.onload = function () {
|
||||
ccLoaded = true;
|
||||
resolve();
|
||||
};
|
||||
|
||||
fileref.setAttribute("src", "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js");
|
||||
document.querySelector("head").appendChild(fileref);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
|
@ -1,40 +1,65 @@
|
|||
define(['dialog', 'globalize'], function (dialog, globalize) {
|
||||
define(["browser", "dialog", "globalize"], function(browser, dialog, globalize) {
|
||||
'use strict';
|
||||
|
||||
return function (text, title) {
|
||||
function replaceAll(str, find, replace) {
|
||||
return str.split(find).join(replace);
|
||||
}
|
||||
|
||||
var options;
|
||||
if (typeof text === 'string') {
|
||||
options = {
|
||||
title: title,
|
||||
text: text
|
||||
};
|
||||
} else {
|
||||
options = text;
|
||||
}
|
||||
|
||||
var items = [];
|
||||
|
||||
items.push({
|
||||
name: options.cancelText || globalize.translate('ButtonCancel'),
|
||||
id: 'cancel',
|
||||
type: 'cancel'
|
||||
});
|
||||
|
||||
items.push({
|
||||
name: options.confirmText || globalize.translate('ButtonOk'),
|
||||
id: 'ok',
|
||||
type: options.primary === 'delete' ? 'delete' : 'submit'
|
||||
});
|
||||
|
||||
options.buttons = items;
|
||||
|
||||
return dialog(options).then(function (result) {
|
||||
if (result === 'ok') {
|
||||
return Promise.resolve();
|
||||
if (browser.tv && window.confirm) {
|
||||
// Use the native confirm dialog
|
||||
return function (options) {
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
title: '',
|
||||
text: options
|
||||
};
|
||||
}
|
||||
|
||||
return Promise.reject();
|
||||
});
|
||||
};
|
||||
var text = replaceAll(options.text || '', '<br/>', '\n');
|
||||
var result = confirm(text);
|
||||
|
||||
if (result) {
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
return Promise.reject();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
// Use our own dialog
|
||||
return function (text, title) {
|
||||
var options;
|
||||
if (typeof text === 'string') {
|
||||
options = {
|
||||
title: title,
|
||||
text: text
|
||||
};
|
||||
} else {
|
||||
options = text;
|
||||
}
|
||||
|
||||
var items = [];
|
||||
|
||||
items.push({
|
||||
name: options.cancelText || globalize.translate('ButtonCancel'),
|
||||
id: 'cancel',
|
||||
type: 'cancel'
|
||||
});
|
||||
|
||||
items.push({
|
||||
name: options.confirmText || globalize.translate('ButtonOk'),
|
||||
id: 'ok',
|
||||
type: options.primary === 'delete' ? 'delete' : 'submit'
|
||||
});
|
||||
|
||||
options.buttons = items;
|
||||
|
||||
return dialog(options).then(function (result) {
|
||||
if (result === 'ok') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return Promise.reject();
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
define([], function () {
|
||||
'use strict';
|
||||
|
||||
function replaceAll(str, find, replace) {
|
||||
|
||||
return str.split(find).join(replace);
|
||||
}
|
||||
|
||||
return function (options) {
|
||||
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
title: '',
|
||||
text: options
|
||||
};
|
||||
}
|
||||
|
||||
var text = replaceAll(options.text || '', '<br/>', '\n');
|
||||
var result = confirm(text);
|
||||
|
||||
if (result) {
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
return Promise.reject();
|
||||
}
|
||||
};
|
||||
});
|
|
@ -169,6 +169,15 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
|||
}, {
|
||||
passive: true
|
||||
});
|
||||
|
||||
dom.addEventListener((dlg.dialogContainer || backdrop), 'contextmenu', function (e) {
|
||||
if (e.target === dlg.dialogContainer) {
|
||||
// Close the application dialog menu
|
||||
close(dlg);
|
||||
// Prevent the default browser context menu from appearing
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function isHistoryEnabled(dlg) {
|
||||
|
|
|
@ -80,7 +80,6 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
|||
if (track) {
|
||||
var format = (track.Codec || '').toLowerCase();
|
||||
if (format === 'ssa' || format === 'ass') {
|
||||
// libjass is needed here
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1047,7 +1046,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
|||
lastCustomTrackMs = 0;
|
||||
}
|
||||
|
||||
function renderWithSubtitlesOctopus(videoElement, track, item) {
|
||||
function renderSsaAss(videoElement, track, item) {
|
||||
var attachments = self._currentPlayOptions.mediaSource.MediaAttachments || [];
|
||||
var options = {
|
||||
video: videoElement,
|
||||
|
@ -1066,82 +1065,6 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
|||
});
|
||||
}
|
||||
|
||||
function renderWithLibjass(videoElement, track, item) {
|
||||
|
||||
var rendererSettings = {};
|
||||
|
||||
if (browser.ps4) {
|
||||
// Text outlines are not rendering very well
|
||||
rendererSettings.enableSvg = false;
|
||||
} else if (browser.edge || browser.msie) {
|
||||
// svg not rendering at all
|
||||
rendererSettings.enableSvg = false;
|
||||
}
|
||||
|
||||
// probably safer to just disable everywhere
|
||||
rendererSettings.enableSvg = false;
|
||||
|
||||
require(['libjass', 'ResizeObserver'], function (libjass, ResizeObserver) {
|
||||
|
||||
libjass.ASS.fromUrl(getTextTrackUrl(track, item)).then(function (ass) {
|
||||
|
||||
var clock = new libjass.renderers.ManualClock();
|
||||
currentClock = clock;
|
||||
|
||||
// Create a DefaultRenderer using the video element and the ASS object
|
||||
var renderer = new libjass.renderers.WebRenderer(ass, clock, videoElement.parentNode, rendererSettings);
|
||||
|
||||
currentAssRenderer = renderer;
|
||||
|
||||
renderer.addEventListener("ready", function () {
|
||||
try {
|
||||
renderer.resize(videoElement.offsetWidth, videoElement.offsetHeight, 0, 0);
|
||||
|
||||
if (!self._resizeObserver) {
|
||||
self._resizeObserver = new ResizeObserver(onVideoResize, {});
|
||||
self._resizeObserver.observe(videoElement);
|
||||
}
|
||||
//clock.pause();
|
||||
} catch (ex) {
|
||||
//alert(ex);
|
||||
}
|
||||
});
|
||||
}, function () {
|
||||
htmlMediaHelper.onErrorInternal(self, 'mediadecodeerror');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function renderSsaAss(videoElement, track, item) {
|
||||
if (supportsCanvas() && supportsWebWorkers()) {
|
||||
console.debug('rendering subtitles with SubtitlesOctopus');
|
||||
renderWithSubtitlesOctopus(videoElement, track, item);
|
||||
} else {
|
||||
console.debug('rendering subtitles with libjass');
|
||||
renderWithLibjass(videoElement, track, item);
|
||||
}
|
||||
}
|
||||
|
||||
function onVideoResize() {
|
||||
if (browser.iOS) {
|
||||
// the new sizes will be delayed for about 500ms with wkwebview
|
||||
setTimeout(resetVideoRendererSize, 500);
|
||||
} else {
|
||||
resetVideoRendererSize();
|
||||
}
|
||||
}
|
||||
|
||||
function resetVideoRendererSize() {
|
||||
var renderer = currentAssRenderer;
|
||||
if (renderer) {
|
||||
var videoElement = self._mediaElement;
|
||||
var width = videoElement.offsetWidth;
|
||||
var height = videoElement.offsetHeight;
|
||||
console.debug('videoElement resized: ' + width + 'x' + height);
|
||||
renderer.resize(width, height, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function requiresCustomSubtitlesElement() {
|
||||
|
||||
// after a system update, ps4 isn't showing anything when creating a track element dynamically
|
||||
|
@ -1231,7 +1154,6 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
|||
if (!itemHelper.isLocalItem(item) || track.IsExternal) {
|
||||
var format = (track.Codec || '').toLowerCase();
|
||||
if (format === 'ssa' || format === 'ass') {
|
||||
// libjass is needed here
|
||||
renderSsaAss(videoElement, track, item);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -396,6 +396,12 @@ define(["globalize", "dom", "emby-checkbox", "emby-select", "emby-input"], funct
|
|||
parent.querySelector(".chkEnableEmbeddedTitlesContainer").classList.remove("hide");
|
||||
}
|
||||
|
||||
if (contentType === "tvshows") {
|
||||
parent.querySelector(".chkEnableEmbeddedEpisodeInfosContainer").classList.remove("hide");
|
||||
} else {
|
||||
parent.querySelector(".chkEnableEmbeddedEpisodeInfosContainer").classList.add("hide");
|
||||
}
|
||||
|
||||
return populateMetadataSettings(parent, contentType);
|
||||
}
|
||||
|
||||
|
@ -493,6 +499,7 @@ define(["globalize", "dom", "emby-checkbox", "emby-select", "emby-input"], funct
|
|||
SeasonZeroDisplayName: parent.querySelector("#txtSeasonZeroName").value,
|
||||
AutomaticRefreshIntervalDays: parseInt(parent.querySelector("#selectAutoRefreshInterval").value),
|
||||
EnableEmbeddedTitles: parent.querySelector("#chkEnableEmbeddedTitles").checked,
|
||||
EnableEmbeddedEpisodeInfos: parent.querySelector("#chkEnableEmbeddedEpisodeInfos").checked,
|
||||
SkipSubtitlesIfEmbeddedSubtitlesPresent: parent.querySelector("#chkSkipIfGraphicalSubsPresent").checked,
|
||||
SkipSubtitlesIfAudioTrackMatches: parent.querySelector("#chkSkipIfAudioTrackPresent").checked,
|
||||
SaveSubtitlesWithMedia: parent.querySelector("#chkSaveSubtitlesLocally").checked,
|
||||
|
@ -545,6 +552,7 @@ define(["globalize", "dom", "emby-checkbox", "emby-select", "emby-input"], funct
|
|||
parent.querySelector("#chkImportMissingEpisodes").checked = options.ImportMissingEpisodes;
|
||||
parent.querySelector(".chkAutomaticallyGroupSeries").checked = options.EnableAutomaticSeriesGrouping;
|
||||
parent.querySelector("#chkEnableEmbeddedTitles").checked = options.EnableEmbeddedTitles;
|
||||
parent.querySelector("#chkEnableEmbeddedEpisodeInfos").checked = options.EnableEmbeddedEpisodeInfos;
|
||||
parent.querySelector("#chkSkipIfGraphicalSubsPresent").checked = options.SkipSubtitlesIfEmbeddedSubtitlesPresent;
|
||||
parent.querySelector("#chkSaveSubtitlesLocally").checked = options.SaveSubtitlesWithMedia;
|
||||
parent.querySelector("#chkSkipIfAudioTrackPresent").checked = options.SkipSubtitlesIfAudioTrackMatches;
|
||||
|
|
|
@ -28,6 +28,13 @@
|
|||
</label>
|
||||
<div class="fieldDescription checkboxFieldDescription">${PreferEmbeddedTitlesOverFileNamesHelp}</div>
|
||||
</div>
|
||||
<div class="checkboxContainer checkboxContainer-withDescription chkEnableEmbeddedEpisodeInfosContainer hide advanced">
|
||||
<label>
|
||||
<input is="emby-checkbox" type="checkbox" id="chkEnableEmbeddedEpisodeInfos" />
|
||||
<span>${PreferEmbeddedEpisodeInfosOverFileNames}</span>
|
||||
</label>
|
||||
<div class="fieldDescription checkboxFieldDescription">${PreferEmbeddedEpisodeInfosOverFileNamesHelp}</div>
|
||||
</div>
|
||||
|
||||
<div class="checkboxContainer checkboxContainer-withDescription advanced">
|
||||
<label>
|
||||
|
|
|
@ -238,13 +238,6 @@
|
|||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.listItemMediaInfo {
|
||||
/* Don't display if flex not supported */
|
||||
display: none;
|
||||
align-items: center;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.listGroupHeader-first {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
|
|
@ -3162,7 +3162,8 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
|
||||
// User clicked stop or content ended
|
||||
var state = self.getPlayerState(player);
|
||||
var streamInfo = getPlayerData(player).streamInfo;
|
||||
var data = getPlayerData(player);
|
||||
var streamInfo = data.streamInfo;
|
||||
|
||||
var nextItem = self._playNextAfterEnded ? self._playQueueManager.getNextItemInfo() : null;
|
||||
|
||||
|
@ -3210,6 +3211,9 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
showPlaybackInfoErrorMessage(self, displayErrorCode, nextItem);
|
||||
} else if (nextItem) {
|
||||
self.nextTrack();
|
||||
} else {
|
||||
// Nothing more to play - clear data
|
||||
data.streamInfo = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
define([], function () {
|
||||
'use strict';
|
||||
|
||||
function replaceAll(str, find, replace) {
|
||||
|
||||
return str.split(find).join(replace);
|
||||
}
|
||||
|
||||
return function (options) {
|
||||
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
label: '',
|
||||
text: options
|
||||
};
|
||||
}
|
||||
|
||||
var label = replaceAll(options.label || '', '<br/>', '\n');
|
||||
|
||||
var result = prompt(label, options.text || '');
|
||||
|
||||
if (result) {
|
||||
return Promise.resolve(result);
|
||||
} else {
|
||||
return Promise.reject(result);
|
||||
}
|
||||
};
|
||||
});
|
|
@ -1,6 +1,10 @@
|
|||
define(['dialogHelper', 'layoutManager', 'scrollHelper', 'globalize', 'dom', 'require', 'material-icons', 'emby-button', 'paper-icon-button-light', 'emby-input', 'formDialogStyle'], function (dialogHelper, layoutManager, scrollHelper, globalize, dom, require) {
|
||||
define(["browser", 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize', 'dom', 'require', 'material-icons', 'emby-button', 'paper-icon-button-light', 'emby-input', 'formDialogStyle'], function(browser, dialogHelper, layoutManager, scrollHelper, globalize, dom, require) {
|
||||
'use strict';
|
||||
|
||||
function replaceAll(str, find, replace) {
|
||||
return str.split(find).join(replace);
|
||||
}
|
||||
|
||||
function setInputProperties(dlg, options) {
|
||||
var txtInput = dlg.querySelector('#txtInput');
|
||||
|
||||
|
@ -13,7 +17,6 @@ define(['dialogHelper', 'layoutManager', 'scrollHelper', 'globalize', 'dom', 're
|
|||
}
|
||||
|
||||
function showDialog(options, template) {
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
|
@ -71,34 +74,49 @@ define(['dialogHelper', 'layoutManager', 'scrollHelper', 'globalize', 'dom', 're
|
|||
dlg.style.minWidth = (Math.min(400, dom.getWindowSize().innerWidth - 50)) + 'px';
|
||||
|
||||
return dialogHelper.open(dlg).then(function () {
|
||||
|
||||
if (layoutManager.tv) {
|
||||
scrollHelper.centerFocus.off(dlg.querySelector('.formDialogContent'), false);
|
||||
}
|
||||
|
||||
var value = submitValue;
|
||||
|
||||
if (value) {
|
||||
return value;
|
||||
if (submitValue) {
|
||||
return submitValue;
|
||||
} else {
|
||||
return Promise.reject();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return function (options) {
|
||||
if ((browser.tv || browser.xboxOne) && window.confirm) {
|
||||
return function (options) {
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
label: '',
|
||||
text: options
|
||||
};
|
||||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
require(['text!./prompt.template.html'], function (template) {
|
||||
var label = replaceAll(options.label || '', '<br/>', '\n');
|
||||
var result = prompt(label, options.text || '');
|
||||
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
title: '',
|
||||
text: options
|
||||
};
|
||||
}
|
||||
showDialog(options, template).then(resolve, reject);
|
||||
if (result) {
|
||||
return Promise.resolve(result);
|
||||
} else {
|
||||
return Promise.reject(result);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return function (options) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
require(['text!./prompt.template.html'], function (template) {
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
title: '',
|
||||
text: options
|
||||
};
|
||||
}
|
||||
showDialog(options, template).then(resolve, reject);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
});
|
||||
|
|
|
@ -10,12 +10,6 @@ define([], function () {
|
|||
}
|
||||
|
||||
},
|
||||
canExec: false,
|
||||
exec: function (options) {
|
||||
// options.path
|
||||
// options.arguments
|
||||
return Promise.reject();
|
||||
},
|
||||
enableFullscreen: function () {
|
||||
if (window.NativeShell) {
|
||||
window.NativeShell.enableFullscreen();
|
||||
|
|
|
@ -264,17 +264,13 @@ define(["jQuery", "loading", "emby-checkbox", "listViewStyle", "emby-input", "em
|
|||
self.init = function () {
|
||||
options = options || {};
|
||||
|
||||
if (options.showCancelButton) {
|
||||
page.querySelector(".btnCancel").classList.remove("hide");
|
||||
} else {
|
||||
page.querySelector(".btnCancel").classList.add("hide");
|
||||
}
|
||||
// Only hide the buttons if explicitly set to false; default to showing if undefined or null
|
||||
// FIXME: rename this option to clarify logic
|
||||
var hideCancelButton = options.showCancelButton === false;
|
||||
page.querySelector(".btnCancel").classList.toggle("hide", hideCancelButton);
|
||||
|
||||
if (options.showSubmitButton) {
|
||||
page.querySelector(".btnSubmitListings").classList.remove("hide");
|
||||
} else {
|
||||
page.querySelector(".btnSubmitListings").classList.add("hide");
|
||||
}
|
||||
var hideSubmitButton = options.showSubmitButton === false;
|
||||
page.querySelector(".btnSubmitListings").classList.toggle("hide", hideSubmitButton);
|
||||
|
||||
$(".formLogin", page).on("submit", function () {
|
||||
submitLoginForm();
|
||||
|
|
|
@ -163,17 +163,13 @@ define(["jQuery", "loading", "emby-checkbox", "emby-input", "listViewStyle", "pa
|
|||
self.init = function () {
|
||||
options = options || {};
|
||||
|
||||
if (false !== options.showCancelButton) {
|
||||
page.querySelector(".btnCancel").classList.remove("hide");
|
||||
} else {
|
||||
page.querySelector(".btnCancel").classList.add("hide");
|
||||
}
|
||||
// Only hide the buttons if explicitly set to false; default to showing if undefined or null
|
||||
// FIXME: rename this option to clarify logic
|
||||
var hideCancelButton = options.showCancelButton === false;
|
||||
page.querySelector(".btnCancel").classList.toggle("hide", hideCancelButton);
|
||||
|
||||
if (false !== options.showSubmitButton) {
|
||||
page.querySelector(".btnSubmitListings").classList.remove("hide");
|
||||
} else {
|
||||
page.querySelector(".btnSubmitListings").classList.add("hide");
|
||||
}
|
||||
var hideSubmitButton = options.showSubmitButton === false;
|
||||
page.querySelector(".btnSubmitListings").classList.toggle("hide", hideSubmitButton);
|
||||
|
||||
$("form", page).on("submit", function () {
|
||||
submitListingsForm();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue