fix encoding escape quotes

This commit is contained in:
Luke Pulverenti 2015-06-07 23:16:42 -04:00
parent 3920d73045
commit 1dd2833ed7
17 changed files with 387 additions and 341 deletions

View File

@ -151,6 +151,14 @@
</select>
</div>
<div>
<br />
<div>
<label for="chkEnableChromecastAc3">${LabelEnableChromecastAc3Passthrough}</label>
<input type="checkbox" id="chkEnableChromecastAc3" />
</div>
</div>
<br />
<div>
<fieldset data-role="controlgroup">

View File

@ -24,6 +24,14 @@
return parseInt(store.getItem('chromecastBitrate') || '') || 3000000;
},
enableChromecastAc3: function (val) {
if (val != null) {
update('enablechromecastac3', val.toString());
}
return store.getItem('enablechromecastac3') == 'true';
},
enableExternalPlayers: function (val) {
if (val != null) {

View File

@ -344,7 +344,8 @@
accessToken: ApiClient.accessToken(),
serverAddress: ApiClient.serverAddress(),
maxBitrate: bitrateSetting,
receiverName: receiverName
receiverName: receiverName,
supportsAc3: AppSettings.enableChromecastAc3()
});
getEndpointInfo().done(function (endpoint) {

View File

@ -0,0 +1,266 @@
(function () {
function htmlMediaRenderer(type) {
var mediaElement;
var self = this;
function onEnded() {
$(self).trigger('ended');
}
function onTimeUpdate() {
$(self).trigger('timeupdate');
}
function onVolumeChange() {
$(self).trigger('volumechange');
}
function onOneAudioPlaying() {
$('.mediaPlayerAudioContainer').hide();
}
function onPlaying() {
$(self).trigger('playing');
}
function onPlay() {
$(self).trigger('play');
}
function onPause() {
$(self).trigger('pause');
}
function onClick() {
$(self).trigger('click');
}
function onDblClick() {
$(self).trigger('dblclick');
}
function onError() {
var errorCode = this.error ? this.error.code : '';
console.log('Media element error code: ' + errorCode);
$(self).trigger('error');
}
function onLoadedMetadata() {
// The IE video player won't autoplay without this
if ($.browser.msie) {
this.play();
}
}
function onOneVideoPlaying() {
var requiresNativeControls = !MediaPlayer.enableCustomVideoControls();
if (requiresNativeControls) {
$(this).attr('controls', 'controls');
}
var currentSrc = (this.currentSrc || '').toLowerCase();
var parts = currentSrc.split('#');
if (parts.length > 1) {
parts = parts[parts.length - 1].split('=');
if (parts.length == 2) {
var startPositionInSeekParam = parseFloat(parts[1]);
// Appending #t=xxx to the query string doesn't seem to work with HLS
if (startPositionInSeekParam && currentSrc.indexOf('.m3u8') != -1) {
var element = this;
setTimeout(function () {
element.currentTime = startPositionInSeekParam;
}, 3000);
}
}
}
}
function createAudioElement() {
var elem = $('.mediaPlayerAudio');
if (!elem.length) {
var html = '';
var requiresControls = !MediaPlayer.canAutoPlayAudio();
if (requiresControls) {
html += '<div class="mediaPlayerAudioContainer"><div class="mediaPlayerAudioContainerInner">';;
} else {
html += '<div class="mediaPlayerAudioContainer" style="display:none;"><div class="mediaPlayerAudioContainerInner">';;
}
html += '<audio class="mediaPlayerAudio" crossorigin="anonymous" controls>';
html += '</audio></div></div>';
$(document.body).append(html);
elem = $('.mediaPlayerAudio');
}
return $(elem)
.on('timeupdate', onTimeUpdate)
.on('ended', onEnded)
.on('volumechange', onVolumeChange)
.one('playing', onOneAudioPlaying)
.on('play', onPlay)
.on('pause', onPause)
.on('playing', onPlaying)
.on('error', onError)[0];
}
function createVideoElement() {
var elem = $('.itemVideo');
return $(elem)
.one('.loadedmetadata')
.one('playing', onOneVideoPlaying)
.on('timeupdate', onTimeUpdate)
.on('ended', onEnded)
.on('volumechange', onVolumeChange)
.on('play', onPlay)
.on('pause', onPause)
.on('playing', onPlaying)
.on('error', onError)[0];
}
self.currentTime = function (val) {
if (mediaElement) {
if (val != null) {
mediaElement.currentTime = val;
return;
}
return mediaElement.currentTime;
}
};
self.duration = function (val) {
if (mediaElement) {
return mediaElement.duration;
}
return null;
};
self.pause = function () {
if (mediaElement) {
mediaElement.pause();
}
};
self.unpause = function () {
if (mediaElement) {
mediaElement.play();
}
};
self.volume = function (val) {
if (mediaElement) {
if (val != null) {
mediaElement.volume = val;
return;
}
return mediaElement.volume;
}
};
self.setCurrentSrc = function (val) {
var elem = mediaElement;
if (!elem) {
return;
}
if (!val) {
elem.src = null;
elem.src = "";
// When the browser regains focus it may start auto-playing the last video
if ($.browser.safari) {
elem.src = 'files/dummy.mp4';
elem.play();
}
return;
}
elem.src = val;
if (elem.tagName.toLowerCase() == 'audio') {
elem.play();
}
else {
$(elem).one("loadedmetadata.mediaplayerevent", onLoadedMetadata);
}
};
self.currentSrc = function () {
if (mediaElement) {
return mediaElement.currentSrc;
}
};
self.paused = function () {
if (mediaElement) {
return mediaElement.paused;
}
return false;
};
self.destroy = function () {
self.setCurrentSrc(null);
var elem = mediaElement;
if (elem) {
$(elem).off();
if (elem.tagName.toLowerCase() != 'audio') {
$(elem).remove();
}
}
};
self.setPoster = function (url) {
var elem = mediaElement;
if (elem) {
elem.poster = url;
}
};
if (type == 'audio') {
mediaElement = createAudioElement();
}
else {
mediaElement = createVideoElement();
}
}
window.HtmlMediaRenderer = htmlMediaRenderer;
})();

View File

@ -518,6 +518,15 @@
GroupItems: false
};
var target = $(e.target);
if (target.is('a') || target.is('button')) {
return;
}
if (target.parents('a').length || target.parents('button').length) {
return;
}
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) {
if (items.length == 1) {
@ -774,7 +783,8 @@
function onCardClick(e) {
if ($(e.target).is('.itemSelectionPanel') || $('.itemSelectionPanel', this).length) {
var target = $(e.target);
if (target.is('.itemSelectionPanel') || $('.itemSelectionPanel', this).length) {
return false;
}
@ -800,6 +810,14 @@
return;
}
if (target.is('a') || target.is('button')) {
return;
}
if (target.parents('a').length || target.parents('button').length) {
return;
}
if (AppSettings.enableItemPreviews()) {
showItemsOverlay({
ids: [itemId],

View File

@ -2,7 +2,6 @@
function createVideoPlayer(self) {
var timeout;
var initialVolume;
var idleState = true;
@ -1051,29 +1050,31 @@
self.playVideo = function (item, mediaSource, startPosition) {
var streamInfo = self.createStreamInfo('Video', item, mediaSource, startPosition);
requirejs(['scripts/htmlmediarenderer'], function () {
// Huge hack alert. Safari doesn't seem to like if the segments aren't available right away when playback starts
// This will start the transcoding process before actually feeding the video url into the player
if ($.browser.safari && !mediaSource.RunTimeTicks) {
var streamInfo = self.createStreamInfo('Video', item, mediaSource, startPosition);
Dashboard.showLoadingMsg();
// Huge hack alert. Safari doesn't seem to like if the segments aren't available right away when playback starts
// This will start the transcoding process before actually feeding the video url into the player
if ($.browser.safari && !mediaSource.RunTimeTicks) {
ApiClient.ajax({
type: 'GET',
url: streamInfo.url.replace('master.m3u8', 'live.m3u8')
}).always(function () {
Dashboard.showLoadingMsg();
Dashboard.hideLoadingMsg();
ApiClient.ajax({
type: 'GET',
url: streamInfo.url.replace('master.m3u8', 'live.m3u8')
}).always(function () {
}).done(function () {
Dashboard.hideLoadingMsg();
}).done(function () {
self.playVideoInternal(item, mediaSource, startPosition, streamInfo);
});
} else {
self.playVideoInternal(item, mediaSource, startPosition, streamInfo);
});
} else {
self.playVideoInternal(item, mediaSource, startPosition, streamInfo);
}
}
});
};
function supportsContentOverVideoPlayer() {
@ -1107,7 +1108,10 @@
var requiresNativeControls = !self.enableCustomVideoControls();
// Can't autoplay in these browsers so we need to use the full controls
if (requiresNativeControls) {
if (requiresNativeControls && AppInfo.isNativeApp && $.browser.android) {
html += '<video data-viblast-key="N8FjNTQ3NDdhZqZhNGI5NWU5ZTI=" class="itemVideo" id="itemVideo" preload="metadata" autoplay="autoplay" crossorigin="anonymous" ' + posterCode + ' webkit-playsinline>';
}
else if (requiresNativeControls) {
html += '<video data-viblast-key="N8FjNTQ3NDdhZqZhNGI5NWU5ZTI=" class="itemVideo" id="itemVideo" preload="metadata" autoplay="autoplay" crossorigin="anonymous" controls="controls"' + posterCode + ' webkit-playsinline>';
}
else {

View File

@ -902,8 +902,7 @@
} else if (item.MediaType === "Audio") {
self.currentMediaRenderer = playAudio(item, self.currentMediaSource, startPosition);
self.currentDurationTicks = self.currentMediaSource.RunTimeTicks;
playAudio(item, self.currentMediaSource, startPosition);
}
if (callback) {
@ -1638,6 +1637,13 @@
function playAudio(item, mediaSource, startPositionTicks) {
requirejs(['scripts/htmlmediarenderer'], function () {
playAudioInternal(item, mediaSource, startPositionTicks);
});
}
function playAudioInternal(item, mediaSource, startPositionTicks) {
var streamInfo = self.createStreamInfo('Audio', item, mediaSource, startPositionTicks);
var audioUrl = streamInfo.url;
self.startTimeTicksOffset = streamInfo.startTimeTicksOffset;
@ -1685,8 +1691,9 @@
}).on("timeupdate.mediaplayerevent", onTimeUpdate);
return mediaRenderer;
};
self.currentMediaRenderer = mediaRenderer;
self.currentDurationTicks = self.currentMediaSource.RunTimeTicks;
}
var getItemFields = "MediaSources,Chapters";
@ -1706,265 +1713,4 @@
});
})(document, setTimeout, clearTimeout, screen, window.appStorage, $, setInterval, window);
(function () {
function htmlMediaRenderer(type) {
var mediaElement;
var self = this;
function onEnded() {
$(self).trigger('ended');
}
function onTimeUpdate() {
$(self).trigger('timeupdate');
}
function onVolumeChange() {
$(self).trigger('volumechange');
}
function onOneAudioPlaying() {
$('.mediaPlayerAudioContainer').hide();
}
function onPlaying() {
$(self).trigger('playing');
}
function onPlay() {
$(self).trigger('play');
}
function onPause() {
$(self).trigger('pause');
}
function onClick() {
$(self).trigger('click');
}
function onDblClick() {
$(self).trigger('dblclick');
}
function onError() {
var errorCode = this.error ? this.error.code : '';
console.log('Media element error code: ' + errorCode);
$(self).trigger('error');
}
function onLoadedMetadata() {
// The IE video player won't autoplay without this
if ($.browser.msie) {
this.play();
}
}
function onOneVideoPlaying() {
var currentSrc = (this.currentSrc || '').toLowerCase();
var parts = currentSrc.split('#');
if (parts.length > 1) {
var parts = parts[parts.length - 1].split('=');
if (parts.length == 2) {
var startPositionInSeekParam = parseFloat(parts[1]);
// Appending #t=xxx to the query string doesn't seem to work with HLS
if (startPositionInSeekParam && currentSrc.indexOf('.m3u8') != -1) {
var element = this;
setTimeout(function () {
element.currentTime = startPositionInSeekParam;
}, 3000);
}
}
}
}
function createAudioElement() {
var elem = $('.mediaPlayerAudio');
if (!elem.length) {
var html = '';
var requiresControls = !MediaPlayer.canAutoPlayAudio();
if (requiresControls) {
html += '<div class="mediaPlayerAudioContainer"><div class="mediaPlayerAudioContainerInner">';;
} else {
html += '<div class="mediaPlayerAudioContainer" style="display:none;"><div class="mediaPlayerAudioContainerInner">';;
}
html += '<audio class="mediaPlayerAudio" crossorigin="anonymous" controls>';
html += '</audio></div></div>';
$(document.body).append(html);
elem = $('.mediaPlayerAudio');
}
return $(elem)
.on('timeupdate', onTimeUpdate)
.on('ended', onEnded)
.on('volumechange', onVolumeChange)
.one('playing', onOneAudioPlaying)
.on('play', onPlay)
.on('pause', onPause)
.on('playing', onPlaying)
.on('error', onError)[0];
}
function createVideoElement() {
var elem = $('.itemVideo');
return $(elem)
.one('.loadedmetadata')
.one('playing', onOneVideoPlaying)
.on('timeupdate', onTimeUpdate)
.on('ended', onEnded)
.on('volumechange', onVolumeChange)
.on('play', onPlay)
.on('pause', onPause)
.on('playing', onPlaying)
.on('error', onError)[0];
}
self.currentTime = function (val) {
if (mediaElement) {
if (val != null) {
mediaElement.currentTime = val;
return;
}
return mediaElement.currentTime;
}
};
self.duration = function (val) {
if (mediaElement) {
return mediaElement.duration;
}
return null;
};
self.pause = function () {
if (mediaElement) {
mediaElement.pause();
}
};
self.unpause = function () {
if (mediaElement) {
mediaElement.play();
}
};
self.volume = function (val) {
if (mediaElement) {
if (val != null) {
mediaElement.volume = val;
return;
}
return mediaElement.volume;
}
};
self.setCurrentSrc = function (val) {
var elem = mediaElement;
if (!elem) {
return;
}
if (!val) {
elem.src = null;
elem.src = "";
// When the browser regains focus it may start auto-playing the last video
if ($.browser.safari) {
elem.src = 'files/dummy.mp4';
elem.play();
}
return;
}
elem.src = val;
if (elem.tagName.toLowerCase() == 'audio') {
elem.play();
}
else {
$(elem).one("loadedmetadata.mediaplayerevent", onLoadedMetadata);
}
};
self.currentSrc = function () {
if (mediaElement) {
return mediaElement.currentSrc;
}
};
self.paused = function () {
if (mediaElement) {
return mediaElement.paused;
}
return false;
};
self.destroy = function () {
self.setCurrentSrc(null);
var elem = mediaElement;
if (elem) {
$(elem).off();
if (elem.tagName.toLowerCase() != 'audio') {
$(elem).remove();
}
}
};
self.setPoster = function (url) {
var elem = mediaElement;
if (elem) {
elem.poster = url;
}
};
if (type == 'audio') {
mediaElement = createAudioElement();
}
else {
mediaElement = createVideoElement();
}
}
window.HtmlMediaRenderer = htmlMediaRenderer;
})();
})(document, setTimeout, clearTimeout, screen, window.appStorage, $, setInterval, window);

View File

@ -18,7 +18,9 @@
$('#selectEnableItemPreviews', page).val(AppSettings.enableItemPreviews().toString().toLowerCase()).selectmenu("refresh");
$('#chkEnableLibraryTileNames', page).checked(displayPreferences.CustomPrefs.enableLibraryTileNames != '0').checkboxradio("refresh");
$('#chkEnableFullScreen', page).checked(AppSettings.enableFullScreen().toString().toLowerCase() == 'true').checkboxradio("refresh");
$('#chkEnableFullScreen', page).checked(AppSettings.enableFullScreen()).checkboxradio("refresh");
$('#chkEnableChromecastAc3', page).checked(AppSettings.enableChromecastAc3()).checkboxradio("refresh");
Dashboard.hideLoadingMsg();
}
@ -55,6 +57,8 @@
AppSettings.enableItemPreviews($('#selectEnableItemPreviews', page).val() == 'true');
AppSettings.enableFullScreen($('#chkEnableFullScreen', page).checked());
AppSettings.enableChromecastAc3($('#chkEnableChromecastAc3', page).checked());
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
ApiClient.getDisplayPreferences('home', userId, 'webclient').done(function (result) {

View File

@ -150,26 +150,22 @@
});
}
window.LibraryAccessPage = {
function onSubmit() {
var page = $(this).parents('.page');
onSubmit: function () {
Dashboard.showLoadingMsg();
var page = $(this).parents('.page');
var userId = getParameterByName("userId");
Dashboard.showLoadingMsg();
ApiClient.getUser(userId).done(function (result) {
saveUser(result, page);
});
var userId = getParameterByName("userId");
// Disable default form submission
return false;
}
ApiClient.getUser(userId).done(function (result) {
saveUser(result, page);
});
// Disable default form submission
return false;
}
};
$(document).on('pageinit', "#userLibraryAccessPage", function () {
$(document).on('pageinitdepends', "#userLibraryAccessPage", function () {
var page = this;
@ -203,7 +199,9 @@
});
}).on('pageshow', "#userLibraryAccessPage", function () {
$('.userLibraryAccessForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#userLibraryAccessPage", function () {
var page = this;

View File

@ -367,7 +367,7 @@
$('#txtBlockedTag', page).val('').focus();
}
$(document).on('pageinit', "#userParentalControlPage", function () {
$(document).on('pageinitdepends', "#userParentalControlPage", function () {
var page = this;
@ -384,7 +384,11 @@
populateHours(page);
}).on('pageshow', "#userParentalControlPage", function () {
$('.blockedTagForm').off('submit', UserParentalControlPage.onBlockedTagFormSubmit).on('submit', UserParentalControlPage.onBlockedTagFormSubmit);
$('.scheduleForm').off('submit', UserParentalControlPage.onScheduleFormSubmit).on('submit', UserParentalControlPage.onScheduleFormSubmit);
$('.userParentalControlForm').off('submit', UserParentalControlPage.onSubmit).on('submit', UserParentalControlPage.onSubmit);
}).on('pageshowready', "#userParentalControlPage", function () {
var page = this;

View File

@ -28,7 +28,12 @@
});
}
$(document).on('pagebeforeshow', "#userPasswordPage", function () {
$(document).on('pageinitdepends', "#userPasswordPage", function () {
$('.adminUpdatePasswordForm').off('submit', UpdatePasswordPage.onSubmit).on('submit', UpdatePasswordPage.onSubmit);
$('.adminLocalAccessForm').off('submit', UpdatePasswordPage.onLocalAccessSubmit).on('submit', UpdatePasswordPage.onLocalAccessSubmit);
}).on('pagebeforeshowready', "#userPasswordPage", function () {
var page = this;

View File

@ -22,7 +22,7 @@
config.UICulture = $('#selectLocalizationLanguage', page).val();
apiClient.ajax({
type: 'POST',
data: config,
url: apiClient.getUrl('Startup/Configuration')
@ -36,7 +36,17 @@
}
$(document).on('pageshow', "#wizardStartPage", function () {
function onSubmit() {
save($(this).parents('.page'));
return false;
}
$(document).on('pageinitdepends', "#wizardStartPage", function () {
$('.wizardStartForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#wizardStartPage", function () {
Dashboard.showLoadingMsg();
var page = this;
@ -54,14 +64,4 @@
});
});
window.WizardStartPage = {
onSubmit: function () {
save($(this).parents('.page'));
return false;
}
};
})(window, jQuery);

View File

@ -84,7 +84,8 @@
accessToken: ApiClient.accessToken(),
serverAddress: ApiClient.serverAddress(),
maxBitrate: bitrateSetting,
receiverName: currentDevice.getFriendlyName()
receiverName: currentDevice.getFriendlyName(),
supportsAc3: AppSettings.enableChromecastAc3()
});
getEndpointInfo().done(function (endpoint) {

View File

@ -4,7 +4,7 @@
<title></title>
</head>
<body>
<div id="userLibraryAccessPage" data-role="page" class="page type-interior userProfilesPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Users">
<div id="userLibraryAccessPage" data-role="page" class="page type-interior userProfilesPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Users" data-require="scripts/userlibraryaccess">
<div data-role="content">
<div class="content-primary">
@ -71,9 +71,6 @@
</form>
</div>
</div>
<script type="text/javascript">
$('.userLibraryAccessForm').off('submit', LibraryAccessPage.onSubmit).on('submit', LibraryAccessPage.onSubmit);
</script>
</div>
</body>
</html>

View File

@ -4,7 +4,7 @@
<title></title>
</head>
<body>
<div id="userParentalControlPage" data-role="page" class="page type-interior userProfilesPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Users">
<div id="userParentalControlPage" data-role="page" class="page type-interior userProfilesPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Users" data-require="scripts/userparentalcontrol">
<div data-role="content">
<div class="content-primary">
@ -139,11 +139,6 @@
</div>
</div>
</div>
<script type="text/javascript">
$('.blockedTagForm').off('submit', UserParentalControlPage.onBlockedTagFormSubmit).on('submit', UserParentalControlPage.onBlockedTagFormSubmit);
$('.scheduleForm').off('submit', UserParentalControlPage.onScheduleFormSubmit).on('submit', UserParentalControlPage.onScheduleFormSubmit);
$('.userParentalControlForm').off('submit', UserParentalControlPage.onSubmit).on('submit', UserParentalControlPage.onSubmit);
</script>
</div>
</body>
</html>

View File

@ -4,7 +4,7 @@
<title></title>
</head>
<body>
<div id="userPasswordPage" data-role="page" class="page type-interior userProfilesPage userPasswordPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Users" data-require="scripts/myprofile">
<div id="userPasswordPage" data-role="page" class="page type-interior userProfilesPage userPasswordPage" data-helpurl="https://github.com/MediaBrowser/Wiki/wiki/Users" data-require="scripts/myprofile,scripts/userpassword">
<div data-role="content">
<div class="content-primary">
@ -86,11 +86,6 @@
</div>
</div>
</form>
<script type="text/javascript">
$('.adminUpdatePasswordForm').off('submit', UpdatePasswordPage.onSubmit).on('submit', UpdatePasswordPage.onSubmit);
$('.adminLocalAccessForm').off('submit', UpdatePasswordPage.onLocalAccessSubmit).on('submit', UpdatePasswordPage.onLocalAccessSubmit);
</script>
</div>
</div>
</div>

View File

@ -4,7 +4,7 @@
<title>Emby</title>
</head>
<body>
<div id="wizardStartPage" data-role="page" class="page standalonePage wizardPage">
<div id="wizardStartPage" data-role="page" class="page standalonePage wizardPage" data-require="scripts/wizardstartpage">
<div data-role="content">
@ -35,10 +35,6 @@
</div>
</div>
<script type="text/javascript">
$('.wizardStartForm').off('submit', WizardStartPage.onSubmit).on('submit', WizardStartPage.onSubmit);
</script>
</div>
</body>
</html>