1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-05 19:41:55 +02:00

Avoid JavaScript error when closing page if no player started x2

This commit is contained in:
Afterster 2015-04-21 20:39:05 +02:00
parent 5af007c721
commit 7f1e7db305

View file

@ -471,7 +471,8 @@ function stopBroadcast()
<?php if ($iframed && AmpConfig::get('webplayer_confirmclose') && !$is_share) { ?>
window.parent.onbeforeunload = function (evt) {
if ($("#jquery_jplayer_1") !== undefined && !$("#jquery_jplayer_1").data("jPlayer").status.paused && (document.activeElement === undefined || (document.activeElement.href.indexOf('/batch.php') < 0 && document.activeElement.href.indexOf('/stream.php') < 0))) {
if ($("#jquery_jplayer_1") !== undefined && $("#jquery_jplayer_1").data("jPlayer") !== undefined && !$("#jquery_jplayer_1").data("jPlayer").status.paused &&
(document.activeElement === undefined || (document.activeElement.href.indexOf('/batch.php') < 0 && document.activeElement.href.indexOf('/stream.php') < 0))) {
var message = '<?php echo T_('Media is currently playing. Are you sure you want to close') . ' ' . AmpConfig::get('site_title') . '?'; ?>';
if (typeof evt == 'undefined') {
evt = window.event;