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

Replace iframe with Ajax page loading :) :)

This commit is contained in:
Afterster 2014-08-08 01:36:07 +02:00
parent 1ed9fde59f
commit 49cd42562b
47 changed files with 607 additions and 574 deletions

View file

@ -76,10 +76,6 @@ html, body {
margin-bottom: 10px;
background: url(images/icecast.png) no-repeat left center;
}
.main iframe {
width: 100%;
border: 0;
}
.news {
font-family: Verdana, sans-serif;
text-decoration: none;

View file

@ -22,12 +22,6 @@
require_once 'lib/init.php';
if (AmpConfig::get('iframes')) {
if (!isset($_GET['framed'])) {
UI::show_mainframes();
exit;
}
}
UI::show_header();
$action = isset($_REQUEST['action']) ? scrub_in($_REQUEST['action']) : null;

View file

@ -65,10 +65,15 @@ class Ajax
$observe = "<script type=\"text/javascript\">";
$methodact = (($method == 'click') ? "update_action();" : "");
if (!empty($confirm)) {
$observe .= "$(".$source_txt.").on('".$method."', function(){ ".$methodact." if (confirm(\"".$confirm."\")) { ".$action." }});";
if (AmpConfig::get('ajax_load') && $method == 'load') {
$source_txt = "$( document ).ready(";
} else {
$observe .= "$(".$source_txt.").on('".$method."', function(){ ".$methodact." ".$action.";});";
$source_txt = "$(".$source_txt.").on('".$method."', ";
}
if (!empty($confirm)) {
$observe .= $source_txt . "function(){ ".$methodact." if (confirm(\"".$confirm."\")) { ".$action." }});";
} else {
$observe .= $source_txt . "function(){ ".$methodact." ".$action.";});";
}
$observe .= "</script>";

View file

@ -234,7 +234,7 @@ class AutoUpdate
echo T_('See') . ' <a href="https://github.com/ampache/ampache/' . (self::is_develop() ? 'compare/' . self::get_current_version() . '...' . self::get_latest_version() : 'blob/master/docs/CHANGELOG.md') . '" target="_blank">' . T_('changes') . '</a> ';
echo T_('or') . ' <a href="https://github.com/ampache/ampache/archive/' . (self::is_develop() ? 'develop.zip' : self::get_latest_version() . '.zip') . '" target="_blank"><b>' . T_('download') . '</b></a>.';
if (self::is_git_repository()) {
echo ' | <a href="' . AmpConfig::get('web_path') . '/update.php?type=sources&action=update">.:: Update ::.</a>';
echo ' | <a rel="nohtml" href="' . AmpConfig::get('web_path') . '/update.php?type=sources&action=update">.:: Update ::.</a>';
}
echo '</div>';
}

View file

@ -298,4 +298,9 @@ class Core
{
return self::is_class_typeof($classname, 'media');
}
public static function get_reloadutil()
{
return (AmpConfig::get('play_type') == "stream") ? "reloadUtil" : "reloadDivUtil";
}
} // Core

View file

@ -407,7 +407,7 @@ class Stream
// Load our javascript
echo "<script type=\"text/javascript\">";
echo "reloadUtil('".$_SESSION['iframe']['target']."');";
echo Core::get_reloadutil() . "('".$_SESSION['iframe']['target']."');";
echo "</script>";
} // run_playlist_method

View file

@ -181,7 +181,7 @@ class Stream_Playlist
public static function check_autoplay_append()
{
// For now, only iframed web player support media append in the currently played playlist
return ((AmpConfig::get('iframes') && AmpConfig::get('play_type') == 'web_player') ||
return ((AmpConfig::get('ajax_load') && AmpConfig::get('play_type') == 'web_player') ||
AmpConfig::get('play_type') == 'localplay'
);
}
@ -450,7 +450,7 @@ class Stream_Playlist
*/
public function create_web_player()
{
if (AmpConfig::get("iframes")) {
if (AmpConfig::get("ajax_load")) {
require AmpConfig::get('prefix') . '/templates/create_web_player_embedded.inc.php';
} else {
require AmpConfig::get('prefix') . '/templates/create_web_player.inc.php';

View file

@ -277,16 +277,6 @@ END;
require_once AmpConfig::get('prefix') . '/templates/header.inc.php';
}
/**
* show_mainframes
*
* For now this just shows the mainframes template
*/
public static function show_mainframes()
{
require_once AmpConfig::get('prefix') . '/templates/mainframes.inc.php';
}
/**
* show_footer
*

View file

@ -437,6 +437,9 @@ class Update
$update_string = '- Add metadata information to albums / songs / videos.<br />';
$version[] = array('version' => '370012','description' => $update_string);
$update_string = '- Replace iframe with ajax page load.<br />';
$version[] = array('version' => '370013','description' => $update_string);
return $version;
}
@ -2891,4 +2894,26 @@ class Update
return $retval;
}
/**
* update_370013
*
* Replace iframe with ajax page load
*/
public static function update_370013()
{
$retval = true;
$sql = "DELETE FROM `preference` WHERE `name` = 'iframes'";
$retval = Dba::write($sql) ? $retval : false;
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('ajax_load','1','Ajax page load',25,'boolean','interface')";
$retval = Dba::write($sql) ? $retval : false;
$id = Dba::insert_id();
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'1')";
$retval = Dba::write($sql, array($id)) ? $retval : false;
return $retval;
}
}

View file

@ -276,7 +276,7 @@ class WebPlayer
$js['filetype'] = $types['player'];
$js['url'] = $url;
if ($urlinfo['type'] == 'song') {
$js['poster'] = $item->image_url . (!AmpConfig::get('iframes') ? '&thumb=4' : '');
$js['poster'] = $item->image_url . (!AmpConfig::get('ajax_load') ? '&thumb=4' : '');
}
debug_event("webplayer.class.php", "Return get_media_js_param {".json_encode($js)."}", 5);

View file

@ -101,6 +101,14 @@ function reloadUtil(target) {
$('#util_iframe').prop('src', target);
}
function reloadDivUtil(target) {
var $util = $("#util_div");
$.get(target, function (data, status, xhr) {
var $response = $(data);
$util.empty().append($response);
});
}
// reloadRedirect
// Send them elsewhere
function reloadRedirect(target) {

View file

@ -0,0 +1,83 @@
function loadContentData(data, status, jqXHR)
{
var $mainContent = $("#content");
var $pageWrap = $("#guts");
var $response = $(data);
$mainContent.empty().append($response.find("#guts"));
$mainContent.fadeIn(200, function() {
$pageWrap.animate({
height: $mainContent.height() + "px"
});
});
$("a[rel^='prettyPhoto']").prettyPhoto({social_tools:false});
}
function loadContentPage(url)
{
var $mainContent = $("#content");
$mainContent
.find("#guts")
.fadeOut(200, function() {
$.get(url, function (data, status, jqXHR) {
loadContentData(data, status, jqXHR);
}, 'html');
});
}
$(function() {
var newHash = "";
$("body").delegate("a", "click", function() {
var link = $(this).attr("href");
if (link != "" && link.indexOf("javascript:") != 0 && link != "#" && link != undefined && $(this).attr("onclick") == undefined && $(this).attr("rel") != "nohtml" && $(this).attr("target") != "_blank") {
if ($(this).attr("rel") != "prettyPhoto") {
var href = $(this).attr("href");
window.location.hash = href.substring(jsWebPath.length + 1);
return false;
} else {
window.location.hash = $(this).attr("rel");
return false;
}
}
});
$("body").delegate("form", "submit", function(e) {
// We do not support ajax post with files
var $file = $(this).find("input[type=file]");
if (!$file || !$file.val() || $file.val() == "") {
var postData = $(this).serializeArray();
var formURL = $(this).attr("action");
$.ajax(
{
url : formURL,
type: "POST",
data : postData,
success:function(data, status, jqXHR)
{
loadContentData(data, status, jqXHR);
},
error: function(jqXHR, status, errorThrown)
{
// Display error here?
}
});
e.preventDefault();
}
});
$(window).bind('hashchange', function(){
newHash = window.location.hash.substring(1);
if (newHash && newHash.indexOf("prettyPhoto") != 0) {
loadContentPage(jsWebPath + '/' + newHash);
};
return false;
});
$(window).trigger('hashchange');
});

View file

@ -154,7 +154,7 @@ function create_preference_input($name,$value)
case 'rio_track_stats':
case 'rio_global_stats':
case 'direct_link':
case 'iframes':
case 'ajax_load':
case 'now_playing_per_user':
case 'show_played_times':
case 'song_page_title':

View file

@ -1,16 +1,17 @@
#uberviz {
visibility: hidden;
z-index: 99999;
}
#uberviz #viz {
position:absolute;
position:fixed;
background-color: #000;
}
#uberviz #controls{
position:absolute;
background-color: #000;
top: 0px;
bottom: 0px;
right:0px;
width:250px;
height:100%;
@ -48,12 +49,13 @@
}
#uberviz #audioDebug{
position:absolute;
position:fixed;
background-color: #000;
width: 250px;
top:0px;
bottom:0px;
right:0px;
opacity: 0.9;
opacity: 0.5;
z-index: 9999;
}
#uberviz #settings{

View file

@ -60,7 +60,7 @@ switch ($_REQUEST['action']) {
}
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=democratic&democratic_id=' . scrub_out($_REQUEST['democratic_id']);
$results['rfc3514'] = '<script type="text/javascript">reloadUtil("'.$_SESSION['iframe']['target'].'")</script>';
$results['rfc3514'] = '<script type="text/javascript">' . Core::get_reloadutil() . '("'.$_SESSION['iframe']['target'].'")</script>';
break;
case 'clear_playlist':
if (!Access::check('interface','100')) {

View file

@ -95,7 +95,7 @@ switch ($_REQUEST['action']) {
unset($_SESSION['iframe']['subtitle']);
}
}
$results['rfc3514'] = '<script type="text/javascript">reloadUtil(\''. AmpConfig::get('web_path') . '/util.php\');</script>';
$results['rfc3514'] = '<script type="text/javascript">' . Core::get_reloadutil() . '(\''. AmpConfig::get('web_path') . '/util.php\');</script>';
}
break;
case 'basket':
@ -110,7 +110,7 @@ switch ($_REQUEST['action']) {
// We need to set the basket up!
$_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=basket&playlist_method=' . scrub_out($_REQUEST['playlist_method']);
$results['rfc3514'] = '<script type="text/javascript">reloadUtil(\''. AmpConfig::get('web_path') . '/util.php\');</script>';
$results['rfc3514'] = '<script type="text/javascript">' . Core::get_reloadutil() . '(\''. AmpConfig::get('web_path') . '/util.php\');</script>';
break;
default:
$results['rfc3514'] = '0x1';

View file

@ -27,15 +27,9 @@
<script language="javascript" type="text/javascript">
function PlayerFrame()
{
var ff = parent.parent.document.getElementById('frame_footer');
var maindiv = parent.parent.document.getElementById('maindiv');
var appendmedia = false;
if (ff.getAttribute('className') != 'frame_footer_visible') {
ff.setAttribute('className', 'frame_footer_visible');
ff.setAttribute('class', 'frame_footer_visible');
maindiv.style.height = (parent.parent.innerHeight - 105) + "px";
} else {
var $webplayer = $("#webplayer");
if ($webplayer.is(':visible')) {
<?php
if ($_REQUEST['append']) {
?>
@ -46,19 +40,24 @@ if ($_REQUEST['append']) {
}
<?php if (AmpConfig::get('webplayer_confirmclose')) { ?>
parent.parent.onbeforeunload = null;
document.onbeforeunload = null;
<?php } ?>
if (appendmedia) {
<?php echo WebPlayer::add_media_js($this, "ff.contentWindow."); ?>
<?php echo WebPlayer::add_media_js($this); ?>
} else {
ff.setAttribute('src', '<?php echo AmpConfig::get('web_path'); ?>/web_player_embedded.php?playlist_id=<?php echo $this->id; ?>');
window.location = '<?php echo return_referer() ?>';
$webplayer.show();
$.get('<?php echo AmpConfig::get('web_path'); ?>/web_player_embedded.php?playlist_id=<?php echo $this->id; ?>', function (data) {
var $response = $(data);
$webplayer.empty().append($response);
},'html');
}
return false;
}
PlayerFrame();
</script>
</head>
<body onLoad="javascript:PlayerFrame();">
<body>
</body>
</html>

View file

@ -20,6 +20,7 @@
*
*/
?>
</div>
<div style="clear:both;">
</div>
</div>
@ -34,7 +35,7 @@
?>
<div id="footer" class="<?php echo (($count_temp_playlist || AmpConfig::get('play_type') == 'localplay') ? '' : 'footer-wild'); ?>">
<?php if (AmpConfig::get('show_donate')) { ?>
<a id="donate" href="//ampache.github.io/donate.html" title="Donate"><?php echo ".:: " . T_('Donate') . " ::."; ?></a> |
<a id="donate" href="//ampache.github.io/donate.html" title="Donate" target="_blank"><?php echo ".:: " . T_('Donate') . " ::."; ?></a> |
<?php } ?>
<a href="https://github.com/ampache/ampache#readme" target="_blank" title="Copyright © 2001 - 2014 Ampache.org">Ampache <?php echo AmpConfig::get('version'); ?></a>
<br />
@ -45,5 +46,11 @@
?>
| <?php echo T_('Load time:'); ?><?php echo $load_time; ?>
</div>
<?php if (AmpConfig::get('ajax_load') && (!isset($_SESSION['login']) || !$_SESSION['login'])) { ?>
<div id="webplayer"></div>
<?php
require_once AmpConfig::get('prefix') . '/templates/uberviz.inc.php';
}
?>
</body>
</html>

View file

@ -38,7 +38,7 @@ $_SESSION['login'] = false;
<link rel="alternate" type="application/rss+xml" title="<?php echo T_('Recently Played'); ?>" href="<?php echo $web_path; ?>/rss.php?type=recently_played" />
<?php } ?>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=<?php echo AmpConfig::get('site_charset'); ?>" />
<title><?php echo htmlspecialchars_decode(scrub_out(AmpConfig::get('site_title')), ENT_QUOTES); ?> - <?php echo $location['title']; ?></title>
<title><?php echo AmpConfig::get('site_title'); ?> - <?php echo $location['title']; ?></title>
<?php require_once AmpConfig::get('prefix') . '/templates/stylesheets.inc.php'; ?>
<link rel="stylesheet" href="<?php echo $web_path; ?>/templates/jquery-editdialog.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo $web_path; ?>/modules/jquery-ui/jquery-ui.min.css" type="text/css" media="screen" />
@ -65,18 +65,14 @@ $_SESSION['login'] = false;
<script src="<?php echo $web_path; ?>/lib/javascript/ajax.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo $web_path; ?>/lib/javascript/tools.js" language="javascript" type="text/javascript"></script>
<?php
// If iframes, we check in javascript that parent container exist, otherwise we redirect to index. Otherwise iframed Web Player will look broken.
if (AmpConfig::get('iframes') && $_SERVER['REQUEST_METHOD'] != 'POST') {
if (AmpConfig::get('ajax_load')) {
$iframed = true;
?>
<script language="javascript" type="text/javascript">
function forceIframe()
{
if (self == top) {
document.location = '<?php echo $web_path; ?>?target_link=' + encodeURIComponent(document.location);
<script src="<?php echo $web_path; ?>/lib/javascript/dynamicpage.js" language="javascript" type="text/javascript"></script>
<?php
require_once AmpConfig::get('prefix') . '/templates/show_html5_player_headers.inc.php';
}
}
</script>
<?php } ?>
?>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$("a[rel^='prettyPhoto']").prettyPhoto({social_tools:false});
@ -177,9 +173,7 @@ $_SESSION['login'] = false;
}
function init_slideshow_refresh()
{
var ff = window.parent.document.getElementById('frame_footer');
var maindiv = window.parent.document.getElementById('maindiv');
if (ff != null && ff.getAttribute('className') == 'frame_footer_visible') {
if ($("#webplayer").is(":visible")) {
clearTimeout(tSlideshow);
tSlideshow = null;
@ -221,7 +215,7 @@ $_SESSION['login'] = false;
});
</script>
</head>
<body <?php echo (AmpConfig::get('iframes')) ? "onLoad='forceIframe();'" : ""; ?>>
<body>
<?php if (AmpConfig::get('sociable') && AmpConfig::get('notify')) { ?>
<script type="text/javascript" language="javascript">
var lastrefresh = new Date().getTime();
@ -255,7 +249,7 @@ $_SESSION['login'] = false;
<div id="maincontainer">
<div id="header" class="header-<?php echo AmpConfig::get('ui_fixed') ? 'fixed' : 'float'; ?>"><!-- This is the header -->
<h1 id="headerlogo">
<a href="<?php echo $web_path . ((AmpConfig::get('iframes')) ? '/?framed=1' : ''); ?>">
<a href="<?php echo $web_path; ?>/index.php">
<img src="<?php echo $web_path; ?><?php echo AmpConfig::get('theme_path'); ?>/images/ampache.png" title="<?php echo AmpConfig::get('site_title'); ?>" alt="<?php echo AmpConfig::get('site_title'); ?>" />
</a>
</h1>
@ -263,7 +257,7 @@ $_SESSION['login'] = false;
<?php UI::show_box_top('','box box_headerbox'); ?>
<?php require_once AmpConfig::get('prefix') . '/templates/show_search_bar.inc.php'; ?>
<?php require_once AmpConfig::get('prefix') . '/templates/show_playtype_switch.inc.php'; ?>
<span id="loginInfo"><a href="<?php echo $web_path; ?>/preferences.php?tab=account"><?php echo $GLOBALS['user']->fullname; ?></a> <a target="_top" href="<?php echo $web_path; ?>/logout.php">[<?php echo T_('Log out'); ?>]</a></span>
<span id="loginInfo"><a href="<?php echo $web_path; ?>/preferences.php?tab=account"><?php echo $GLOBALS['user']->fullname; ?></a> <a rel="nohtml" href="<?php echo $web_path; ?>/logout.php">[<?php echo T_('Log out'); ?>]</a></span>
<span id="updateInfo">
<?php
if (AmpConfig::get('autoupdate') && Access::check('interface','100')) {
@ -281,7 +275,7 @@ $_SESSION['login'] = false;
<?php if (AmpConfig::get('topmenu')) { ?>
<div id="topmenu_container">
<div id="topmenu_item">
<a href="<?php echo $web_path . ((AmpConfig::get('iframes')) ? '/?framed=1' : ''); ?>">
<a href="<?php echo $web_path; ?>">
<img src="<?php echo $web_path; ?>/images/topmenu-home.png" />
<span><?php echo T_('Home'); ?></span>
</a>
@ -354,8 +348,9 @@ $_SESSION['login'] = false;
<?php require_once AmpConfig::get('prefix') . '/templates/rightbar.inc.php'; ?>
</div>
<!-- Tiny little iframe, used to cheat the system -->
<!-- Tiny little div, used to cheat the system -->
<div id="ajax-loading">Loading . . .</div>
<div id="util_div" style="display:none;"></div>
<iframe name="util_iframe" id="util_iframe" style="display:none;" src="<?php echo $web_path; ?>/util.php"></iframe>
<div id="content" class="content-<?php echo AmpConfig::get('ui_fixed') ? 'fixed' : 'float'; ?> <?php echo (($count_temp_playlist || AmpConfig::get('play_type') == 'localplay') ? '' : 'content-right-wild'); echo $isCollapsed ? ' content-left-wild' : ''; ?>">
@ -365,3 +360,4 @@ $_SESSION['login'] = false;
<a href="<?php echo $web_path; ?>/admin/system.php?action=generate_config"><?php echo T_('Generate New Config'); ?></a>
</div>
<?php } ?>
<div id="guts">

View file

@ -15,12 +15,6 @@
* Date: October 2nd, 2013
*/
body {
background: none !important;
background-color: rgb(25, 25, 25) !important;
height: auto !important;
}
div.jp-area {
margin-left: auto;
margin-right: auto;
@ -860,4 +854,14 @@ a.jp-shuffle-off:hover {
.slideshow {
}
#webplayer {
position: fixed;
z-index: 9999;
display: none;
bottom: 0px;
width: 100%;
height: 100px;
background-color: rgb(25, 25, 25) !important;
}
/* @end */

View file

@ -119,7 +119,7 @@
}
.edit_dialog_content input[type=text] , .edit_dialog_content select {
width: 450px;
width: 430px;
height: 30px;
color: #fff;
background: #333;

View file

@ -1,67 +0,0 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
if (INIT_LOADED != '1') { exit; }
$web_path = AmpConfig::get('web_path');
$htmllang = str_replace("_","-",AmpConfig::get('lang'));
$location = get_location();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $htmllang; ?>" lang="<?php echo $htmllang; ?>" dir="<?php echo is_rtl(AmpConfig::get('lang')) ? 'rtl' : 'ltr';?>">
<head>
<link rel="shortcut icon" href="<?php echo $web_path; ?>/favicon.ico" />
<link rel="search" type="application/opensearchdescription+xml" title="<?php echo scrub_out(AmpConfig::get('site_title')); ?>" href="<?php echo $web_path; ?>/search.php?action=descriptor" />
<?php
if (AmpConfig::get('use_rss')) { ?>
<link rel="alternate" type="application/rss+xml" title="<?php echo T_('Now Playing'); ?>" href="<?php echo $web_path; ?>/rss.php" />
<link rel="alternate" type="application/rss+xml" title="<?php echo T_('Recently Played'); ?>" href="<?php echo $web_path; ?>/rss.php?type=recently_played" />
<?php } ?>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=<?php echo AmpConfig::get('site_charset'); ?>" />
<title><?php echo AmpConfig::get('site_title'); ?> - <?php echo $location['title']; ?></title>
<style type="text/css">
#wrap { position:fixed; left:0; width:100%; top:0; height:100%; }
.frame_main_full { display: block; width:100%; height: 100%; }
.frame_footer_hide { width:100%; height:0%; border:1px solid black; display:none; }
.frame_footer_visible { width:100%; height:100px; border:1px solid black; display:inline; position:fixed; bottom:0; z-index:999999;}
</style>
</head>
<body style="height: 100%;">
<div id="wrap">
<div id="maindiv" style="width:100%; height: 100%;">
<iframe id="frame_main" class="frame_main_full" src="<?php
if (isset($_GET['target_link'])) {
echo $_GET['target_link'];
} else {
echo $web_path . "/index.php?framed=1";
}
?>"></iframe>
</div>
<iframe id="frame_footer" class="frame_footer_hide" src="" webkitAllowFullScreen="true" mozAllowFullScreen="true" allowFullScreen="true"></iframe>
</div>
<script language="javascript" type="text/javascript">
// This to prevent unwanted browser cache reloading
document.getElementById('frame_footer').setAttribute('src', '');
</script>
</body>
</html>

View file

@ -45,7 +45,7 @@
</li>
<?php if (Access::check_function('batch_download')) { ?>
<li>
<a href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=tmp_playlist&amp;id=<?php echo $GLOBALS['user']->playlist->id; ?>">
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=tmp_playlist&amp;id=<?php echo $GLOBALS['user']->playlist->id; ?>">
<?php echo UI::get_icon('batch_download', T_('Batch Download')); ?>
</a>
</li>
@ -128,7 +128,7 @@
<?php } ?>
</ul>
<?php
// We do a little magic here to force a iframe reload depending on preference
// We do a little magic here to force a reload depending on preference
// We do this last because we want it to load, and we want to know if there is anything
// to even pass
if (count($objects)) {

View file

@ -117,8 +117,8 @@ if (AmpConfig::get('show_played_times')) {
<?php } ?>
<?php if (Access::check_function('batch_download')) { ?>
<li>
<a href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $album->get_http_album_query_ids('id'); ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a>
<a href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $album->get_http_album_query_ids('id'); ?>"><?php echo T_('Download'); ?></a>
<a rel="nohtml" href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $album->get_http_album_query_ids('id'); ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a>
<a rel="nohtml" href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $album->get_http_album_query_ids('id'); ?>"><?php echo T_('Download'); ?></a>
</li>
<?php } ?>
</ul>

View file

@ -65,8 +65,8 @@ $title = scrub_out($album->name) . '&nbsp;(' . $album->year . ')&nbsp;-&nbsp;' .
</li>
<?php if (Access::check_function('batch_download')) { ?>
<li>
<a href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $album->get_http_album_query_ids('id'); ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a>
<a href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $album->get_http_album_query_ids('id'); ?>"><?php echo T_('Download'); ?></a>
<a rel="nohtml" href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $album->get_http_album_query_ids('id'); ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a>
<a rel="nohtml" href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $album->get_http_album_query_ids('id'); ?>"><?php echo T_('Download'); ?></a>
</li>
<?php } ?>
</ul>
@ -105,7 +105,7 @@ $title = scrub_out($album->name) . '&nbsp;(' . $album->year . ')&nbsp;-&nbsp;' .
<a href="<?php echo $web_path; ?>/share.php?action=show_create&type=album&id=<?php echo $c_album->id; ?>"><?php echo UI::get_icon('share', T_('Share')); ?></a>
<?php } ?>
<?php if (Access::check_function('batch_download')) { ?>
<a href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $c_album->get_http_album_query_ids('id'); ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a>
<a rel="nohtml" href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $c_album->get_http_album_query_ids('id'); ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a>
<?php } ?>
<?php if (Access::check('interface','50')) { ?>
<a id="<?php echo 'edit_album_'.$c_album->id ?>" onclick="showEditDialog('album_row', '<?php echo $c_album->id ?>', '<?php echo 'edit_album_'.$c_album->id ?>', '<?php echo T_('Album edit') ?>', '')">

View file

@ -71,7 +71,7 @@ if (Art::is_enabled()) {
<a href="<?php echo $web_path; ?>/share.php?action=show_create&type=album&id=<?php echo $libitem->id; ?>"><?php echo UI::get_icon('share', T_('Share')); ?></a>
<?php } ?>
<?php if (Access::check_function('batch_download')) { ?>
<a href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=album&<?php echo $libitem->get_http_album_query_ids('id'); ?>">
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=album&<?php echo $libitem->get_http_album_query_ids('id'); ?>">
<?php echo UI::get_icon('batch_download', T_('Batch Download')); ?>
</a>
<?php } ?>

View file

@ -108,8 +108,8 @@ if (AmpConfig::get('show_played_times')) {
<?php } ?>-->
<?php if (Access::check_function('batch_download')) { ?>
<li>
<a href="<?php echo $web_path; ?>/batch.php?action=artist&id=<?php echo $artist->id; ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a>
<a href="<?php echo $web_path; ?>/batch.php?action=artist&id=<?php echo $artist->id; ?>"><?php echo T_('Download'); ?></a>
<a rel="nohtml" href="<?php echo $web_path; ?>/batch.php?action=artist&id=<?php echo $artist->id; ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a>
<a rel="nohtml" href="<?php echo $web_path; ?>/batch.php?action=artist&id=<?php echo $artist->id; ?>"><?php echo T_('Download'); ?></a>
</li>
<?php } ?>
<?php if (Access::check('interface','50')) { ?>

View file

@ -53,7 +53,7 @@
<?php } ?>
<td class="cel_action">
<?php if (Access::check_function('batch_download')) { ?>
<a href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=artist&amp;id=<?php echo $libitem->id; ?>">
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=artist&amp;id=<?php echo $libitem->id; ?>">
<?php echo UI::get_icon('batch_download','', T_('Batch Download')); ?>
</a>
<?php } ?>

View file

@ -1,131 +1,6 @@
<?php
if ($iframed) {
?>
<link rel="stylesheet" href="<?php echo AmpConfig::get('web_path'); ?>/templates/jplayer.midnight.black-iframed.css" type="text/css" />
<?php
} else {
?>
<link rel="stylesheet" href="<?php echo AmpConfig::get('web_path'); ?>/templates/jplayer.midnight.black.css" type="text/css" />
<?php
}
require_once AmpConfig::get('prefix') . '/templates/stylesheets.inc.php';
?>
<link rel="stylesheet" href="<?php echo AmpConfig::get('web_path'); ?>/templates/jquery-editdialog.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo AmpConfig::get('web_path'); ?>/modules/jquery-ui/jquery-ui.min.css" type="text/css" media="screen" />
<link href="<?php echo AmpConfig::get('web_path'); ?>/modules/UberViz/style.css" rel="stylesheet" type="text/css">
<script src="<?php echo AmpConfig::get('web_path'); ?>/modules/jquery/jquery.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/modules/jquery-ui/jquery-ui.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/modules/noty/packaged/jquery.noty.packaged.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/modules/jquery/jquery.cookie.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/modules/jquery-jplayer/jquery.jplayer.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/modules/jquery-jplayer/jplayer.playlist.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/modules/jquery-jplayer/jplayer.playlist.ext.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/base.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/ajax.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tools.js" language="javascript" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
var jsAjaxServer = "<?php echo AmpConfig::get('ajax_server') ?>";
var jsAjaxUrl = "<?php echo AmpConfig::get('ajax_url') ?>";
function update_action()
{
// Stub
}
</script>
<?php
if ($iframed) {
?>
<script type="text/javascript">
function NavigateTo(url)
{
window.parent.document.getElementById('frame_main').setAttribute('src', url);
}
function NotifyOfNewSong()
{
window.parent.document.getElementById('frame_main').contentWindow.refresh_slideshow();
}
function SwapSlideshow()
{
window.parent.document.getElementById('frame_main').contentWindow.swap_slideshow();
}
function isVisualizerEnabled()
{
return ($('#uberviz').css('visibility') == 'visible');
}
var vizInitialized = false;
function ShowVisualizer()
{
if (isVisualizerEnabled()) {
$('#uberviz').css('visibility', 'hidden');
$('#equalizer').css('visibility', 'hidden');
$('.jp-interface').css('background-color', 'rgb(25, 25, 25)');
$.removeCookie('jp_visualizer', { path: '/' });
} else {
// Resource not yet initialized? Do it.
if (!vizInitialized) {
if ((typeof AudioContext !== 'undefined') || (typeof webkitAudioContext !== 'undefined')) {
UberVizMain.init();
vizInitialized = true;
AudioHandler.loadMediaSource(document.getElementById("jp_audio_0"));
}
}
if (vizInitialized) {
$('#uberviz').css('visibility', 'visible');
$('.jp-interface').css('background-color', 'transparent');
$.cookie('jp_visualizer', true, { expires: 7, path: '/'});
} else {
alert("<?php echo T_('Your browser doesn\'t support this feature.'); ?>");
}
}
}
function ShowVisualizerFullScreen()
{
if (!isVisualizerEnabled()) {
ShowVisualizer();
}
var element = document.getElementById("viz");
if (element.requestFullScreen) {
element.requestFullScreen();
} else if (element.webkitRequestFullScreen) {
element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else {
alert('Full-Screen not supported by your browser.');
}
}
function ShowEqualizer()
{
if (isVisualizerEnabled()) {
if ($('#equalizer').css('visibility') == 'visible') {
$('#equalizer').css('visibility', 'hidden');
} else {
$('#equalizer').css('visibility', 'visible');
}
}
}
function SavePlaylist()
{
var url = "<?php echo AmpConfig::get('ajax_url'); ?>?page=playlist&action=append_item&item_type=song&item_id=";
for (var i = 0; i < jplaylist['playlist'].length; i++) {
url += "," + jplaylist['playlist'][i]["song_id"];
}
handlePlaylistAction(url, 'rb_append_dplaylist_new');
}
</script>
<?php
if (!$iframed || $is_share || true) {
require_once AmpConfig::get('prefix') . '/templates/show_html5_player_headers.inc.php';
}
?>
<script type="text/javascript">
@ -294,12 +169,7 @@ if (!$isVideo && !$isRadio && !$is_share) {
}
}
if (AmpConfig::get('song_page_title') && !$is_share) {
if ($iframed) {
echo "window.parent.document";
} else {
echo "document";
}
echo ".title = obj.title + ' - ' + obj.artist + ' | " . addslashes(AmpConfig::get('site_title')) . "';";
echo "document.title = obj.title + ' - ' + obj.artist + ' | " . addslashes(AmpConfig::get('site_title')) . "';";
}
?>
}
@ -371,212 +241,7 @@ if ($isVideo) {
});
<?php echo WebPlayer::add_media_js($playlist); ?>
if ($.cookie('jp_visualizer') == "true") {
ShowVisualizer();
}
});
<?php if (AmpConfig::get('waveform') && !$is_share) { ?>
var wavclicktimer = null;
var shouts = {};
function WaveformClick(songid, time)
{
// Double click
if (wavclicktimer != null) {
clearTimeout(wavclicktimer);
wavclicktimer = null;
NavigateTo('<?php echo AmpConfig::get('web_path') ?>/shout.php?action=show_add_shout&type=song&id=' + songid + '&offset=' + time);
} else {
// Single click
if (brconn == null) {
wavclicktimer = setTimeout(function() {
wavclicktimer = null;
$("#jquery_jplayer_1").data("jPlayer").play(time);
}, 250);
}
}
}
function ClickTimeOffset(e)
{
var parrentOffset = $(".waveform").offset().left;
var offset = e.pageX - parrentOffset;
var duration = $("#jquery_jplayer_1").data("jPlayer").status.duration;
var time = duration * (offset / 400);
return time;
}
function ShowWaveform()
{
$('.waveform').css('visibility', 'visible');
}
function HideWaveform()
{
$('.waveform').css('visibility', 'hidden');
}
<?php } ?>
var brkey = '';
var brconn = null;
function startBroadcast(key)
{
brkey = key;
listenBroadcast();
brconn.onopen = function(e) {
sendBroadcastMessage('AUTH_SID', '<?php echo session_id(); ?>');
sendBroadcastMessage('REGISTER_BROADCAST', brkey);
sendBroadcastMessage('SONG', currentjpitem.attr("data-song_id"));
};
}
function startBroadcastListening(broadcast_id)
{
listenBroadcast();
// Hide few UI information on listening mode
$('.jp-previous').css('visibility', 'hidden');
$('.jp-play').css('visibility', 'hidden');
$('.jp-pause').css('visibility', 'hidden');
$('.jp-next').css('visibility', 'hidden');
$('.jp-stop').css('visibility', 'hidden');
$('.jp-toggles').css('visibility', 'hidden');
$('.jp-playlist').css('visibility', 'hidden');
$('#broadcast').css('visibility', 'hidden');
$('.jp-seek-bar').css('pointer-events', 'none');
brconn.onopen = function(e) {
sendBroadcastMessage('AUTH_SID', '<?php echo Stream::$session; ?>');
sendBroadcastMessage('REGISTER_LISTENER', broadcast_id);
};
}
function listenBroadcast()
{
if (brconn != null) {
stopBroadcast();
}
brconn = new WebSocket('<?php echo Broadcast_Server::get_address(); ?>');
brconn.onmessage = receiveBroadcastMessage;
}
var brLoadingSong = false;
var brBufferingSongPos = -1;
function receiveBroadcastMessage(e)
{
var jp = $("#jquery_jplayer_1").data("jPlayer");
var msgs = e.data.split(';');
for (var i = 0; i < msgs.length; ++i) {
var msg = msgs[i].split(':');
if (msg.length == 2) {
switch (msg[0]) {
case 'PLAYER_PLAY':
if (msg[1] == '1') {
if (jp.status.paused) {
jp.play();
}
} else {
if (!jp.status.paused) {
jp.pause();
}
}
break;
case 'SONG':
addMedia($.parseJSON(atob(msg[1])));
brLoadingSong = true;
// Buffering song position in case it is asked in the next sec.
// Otherwise we will move forward on the previous song instead of the new currently loading one
setTimeout(function() {
if (brBufferingSongPos > -1) {
jp.play(brBufferingSongPos);
brBufferingSongPos = -1;
}
brLoadingSong = false;
}, 1000);
jplaylist.next();
break;
case 'SONG_POSITION':
if (brLoadingSong) {
brBufferingSongPos = parseFloat(msg[1]);
} else {
jp.play(parseFloat(msg[1]));
}
break;
case 'NB_LISTENERS':
$('#broadcast_listeners').html(msg[1]);
break;
case 'INFO':
// Display information notification to user here
break;
case 'ENDED':
jp.stop();
break;
default:
alert('Unknown message code.');
break;
}
}
}
}
function sendBroadcastMessage(cmd, value)
{
if (brconn != null && brconn.readyState == 1) {
var msg = cmd + ':' + value + ';';
brconn.send(msg);
}
}
function stopBroadcast()
{
brkey = '';
if (brconn != null && brconn.readyState == 1) {
brconn.close();
}
brconn = null;
}
<?php if ($iframed && AmpConfig::get('webplayer_confirmclose') && !$is_share) { ?>
window.parent.onbeforeunload = function (evt) {
if (!$("#jquery_jplayer_1").data("jPlayer").status.paused) {
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;
}
if (evt) {
evt.returnValue = message;
}
return message;
}
return null;
}
<?php } ?>
<?php if ($iframed && AmpConfig::get('webplayer_confirmclose') && !$is_share) { ?>
window.addEventListener('storage', function (event) {
if (event.key == 'ampache-current-webplayer') {
// The latest used webplayer is not this player, pause song if playing
if (event.newValue != jpuqid) {
if (!$("#jquery_jplayer_1").data("jPlayer").status.paused) {
$("#jquery_jplayer_1").data("jPlayer").pause();
}
}
}
});
<?php } ?>
</script>
</head>
<body>
@ -743,6 +408,10 @@ if ($isVideo) {
</div>
</div>
</div>
<?php require_once AmpConfig::get('prefix') . '/templates/uberviz.inc.php'; ?>
<?php
if (!$iframed || $is_share) {
require_once AmpConfig::get('prefix') . '/templates/uberviz.inc.php';
}
?>
</body>
</html>

View file

@ -0,0 +1,375 @@
<?php
if ($iframed) {
?>
<link rel="stylesheet" href="<?php echo AmpConfig::get('web_path'); ?>/templates/jplayer.midnight.black-iframed.css" type="text/css" />
<?php
} else {
?>
<link rel="stylesheet" href="<?php echo AmpConfig::get('web_path'); ?>/templates/jplayer.midnight.black.css" type="text/css" />
<?php
require_once AmpConfig::get('prefix') . '/templates/stylesheets.inc.php';
?>
<link rel="stylesheet" href="<?php echo AmpConfig::get('web_path'); ?>/templates/jquery-editdialog.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo AmpConfig::get('web_path'); ?>/modules/jquery-ui/jquery-ui.min.css" type="text/css" media="screen" />
<script src="<?php echo AmpConfig::get('web_path'); ?>/modules/jquery/jquery.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/modules/jquery-ui/jquery-ui.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/modules/noty/packaged/jquery.noty.packaged.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/modules/jquery/jquery.cookie.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/base.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/ajax.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/lib/javascript/tools.js" language="javascript" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
var jsAjaxServer = "<?php echo AmpConfig::get('ajax_server') ?>";
var jsAjaxUrl = "<?php echo AmpConfig::get('ajax_url') ?>";
function update_action()
{
// Stub
}
</script>
<?php
}
?>
<link href="<?php echo AmpConfig::get('web_path'); ?>/modules/UberViz/style.css" rel="stylesheet" type="text/css">
<script src="<?php echo AmpConfig::get('web_path'); ?>/modules/jquery-jplayer/jquery.jplayer.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/modules/jquery-jplayer/jplayer.playlist.min.js" language="javascript" type="text/javascript"></script>
<script src="<?php echo AmpConfig::get('web_path'); ?>/modules/jquery-jplayer/jplayer.playlist.ext.js" language="javascript" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
var jplaylist = new Array();
var jtypes = new Array();
function addMedia(media)
{
var jpmedia = {};
jpmedia['title'] = media['title'];
jpmedia['artist'] = media['artist'];
jpmedia[media['filetype']] = media['url'];
jpmedia['poster'] = media['poster'];
jpmedia['artist_id'] = media['artist_id'];
jpmedia['album_id'] = media['album_id'];
jpmedia['song_id'] = media['song_id'];
jplaylist.add(jpmedia);
}
</script>
<script language="javascript" type="text/javascript">
function ExitPlayer()
{
$webplayer = $("#webplayer");
$webplayer.text('');
$webplayer.hide();
<?php
if (AmpConfig::get('song_page_title')) {
echo "window.parent.document.title = '" . addslashes(AmpConfig::get('site_title')) . "';";
}
?>
document.onbeforeunload = null;
}
</script>
<?php
if ($iframed) {
?>
<script type="text/javascript">
function NavigateTo(url)
{
window.location.hash = url;
}
function NotifyOfNewSong()
{
refresh_slideshow();
}
function SwapSlideshow()
{
swap_slideshow();
}
function isVisualizerEnabled()
{
return ($('#uberviz').css('visibility') == 'visible');
}
var vizInitialized = false;
var vizPrevHeaderColor = "#000";
var vizPrevPlayerColor = "#000";
function ShowVisualizer()
{
if (isVisualizerEnabled()) {
$('#uberviz').css('visibility', 'hidden');
$('#equalizer').css('visibility', 'hidden');
$('#header').css('background-color', vizPrevHeaderColor);
$('#webplayer').css('background-color', vizPrevPlayerColor);
$('.jp-interface').css('background-color', 'rgb(25, 25, 25)');
$('.jp-playlist').css('background-color', 'rgb(20, 20, 20)');
} else {
// Resource not yet initialized? Do it.
if (!vizInitialized) {
if ((typeof AudioContext !== 'undefined') || (typeof webkitAudioContext !== 'undefined')) {
UberVizMain.init();
vizInitialized = true;
AudioHandler.loadMediaSource(document.getElementById("jp_audio_0"));
}
}
if (vizInitialized) {
$('#uberviz').css('visibility', 'visible');
vizPrevHeaderColor = $('#header').css('background-color');
$('#header').css('background-color', 'transparent');
vizPrevPlayerColor = $('#webplayer').css('background-color');
$('#webplayer').css('cssText', 'background-color: #000 !important;');
$('#webplayer').show();
$('.jp-interface').css('background-color', '#000');
$('.jp-playlist').css('background-color', '#000');
} else {
alert("<?php echo T_('Your browser doesn\'t support this feature.'); ?>");
}
}
}
function ShowVisualizerFullScreen()
{
if (!isVisualizerEnabled()) {
ShowVisualizer();
}
var element = document.getElementById("viz");
if (element.requestFullScreen) {
element.requestFullScreen();
} else if (element.webkitRequestFullScreen) {
element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else {
alert('Full-Screen not supported by your browser.');
}
}
function ShowEqualizer()
{
if (isVisualizerEnabled()) {
if ($('#equalizer').css('visibility') == 'visible') {
$('#equalizer').css('visibility', 'hidden');
} else {
$('#equalizer').css('visibility', 'visible');
}
}
}
function SavePlaylist()
{
var url = "<?php echo AmpConfig::get('ajax_url'); ?>?page=playlist&action=append_item&item_type=song&item_id=";
for (var i = 0; i < jplaylist['playlist'].length; i++) {
url += "," + jplaylist['playlist'][i]["song_id"];
}
handlePlaylistAction(url, 'rb_append_dplaylist_new');
}
</script>
<?php
}
?>
<script type="text/javascript">
<?php if (AmpConfig::get('waveform') && !$is_share) { ?>
var wavclicktimer = null;
var shouts = {};
function WaveformClick(songid, time)
{
// Double click
if (wavclicktimer != null) {
clearTimeout(wavclicktimer);
wavclicktimer = null;
NavigateTo('<?php echo AmpConfig::get('web_path') ?>/shout.php?action=show_add_shout&type=song&id=' + songid + '&offset=' + time);
} else {
// Single click
if (brconn == null) {
wavclicktimer = setTimeout(function() {
wavclicktimer = null;
$("#jquery_jplayer_1").data("jPlayer").play(time);
}, 250);
}
}
}
function ClickTimeOffset(e)
{
var parrentOffset = $(".waveform").offset().left;
var offset = e.pageX - parrentOffset;
var duration = $("#jquery_jplayer_1").data("jPlayer").status.duration;
var time = duration * (offset / 400);
return time;
}
function ShowWaveform()
{
$('.waveform').css('visibility', 'visible');
}
function HideWaveform()
{
$('.waveform').css('visibility', 'hidden');
}
<?php } ?>
var brkey = '';
var brconn = null;
function startBroadcast(key)
{
brkey = key;
listenBroadcast();
brconn.onopen = function(e) {
sendBroadcastMessage('AUTH_SID', '<?php echo session_id(); ?>');
sendBroadcastMessage('REGISTER_BROADCAST', brkey);
sendBroadcastMessage('SONG', currentjpitem.attr("data-song_id"));
};
}
function startBroadcastListening(broadcast_id)
{
listenBroadcast();
// Hide few UI information on listening mode
$('.jp-previous').css('visibility', 'hidden');
$('.jp-play').css('visibility', 'hidden');
$('.jp-pause').css('visibility', 'hidden');
$('.jp-next').css('visibility', 'hidden');
$('.jp-stop').css('visibility', 'hidden');
$('.jp-toggles').css('visibility', 'hidden');
$('.jp-playlist').css('visibility', 'hidden');
$('#broadcast').css('visibility', 'hidden');
$('.jp-seek-bar').css('pointer-events', 'none');
brconn.onopen = function(e) {
sendBroadcastMessage('AUTH_SID', '<?php echo Stream::$session; ?>');
sendBroadcastMessage('REGISTER_LISTENER', broadcast_id);
};
}
function listenBroadcast()
{
if (brconn != null) {
stopBroadcast();
}
brconn = new WebSocket('<?php echo Broadcast_Server::get_address(); ?>');
brconn.onmessage = receiveBroadcastMessage;
}
var brLoadingSong = false;
var brBufferingSongPos = -1;
function receiveBroadcastMessage(e)
{
var jp = $("#jquery_jplayer_1").data("jPlayer");
var msgs = e.data.split(';');
for (var i = 0; i < msgs.length; ++i) {
var msg = msgs[i].split(':');
if (msg.length == 2) {
switch (msg[0]) {
case 'PLAYER_PLAY':
if (msg[1] == '1') {
if (jp.status.paused) {
jp.play();
}
} else {
if (!jp.status.paused) {
jp.pause();
}
}
break;
case 'SONG':
addMedia($.parseJSON(atob(msg[1])));
brLoadingSong = true;
// Buffering song position in case it is asked in the next sec.
// Otherwise we will move forward on the previous song instead of the new currently loading one
setTimeout(function() {
if (brBufferingSongPos > -1) {
jp.play(brBufferingSongPos);
brBufferingSongPos = -1;
}
brLoadingSong = false;
}, 1000);
jplaylist.next();
break;
case 'SONG_POSITION':
if (brLoadingSong) {
brBufferingSongPos = parseFloat(msg[1]);
} else {
jp.play(parseFloat(msg[1]));
}
break;
case 'NB_LISTENERS':
$('#broadcast_listeners').html(msg[1]);
break;
case 'INFO':
// Display information notification to user here
break;
case 'ENDED':
jp.stop();
break;
default:
alert('Unknown message code.');
break;
}
}
}
}
function sendBroadcastMessage(cmd, value)
{
if (brconn != null && brconn.readyState == 1) {
var msg = cmd + ':' + value + ';';
brconn.send(msg);
}
}
function stopBroadcast()
{
brkey = '';
if (brconn != null && brconn.readyState == 1) {
brconn.close();
}
brconn = null;
}
<?php if ($iframed && AmpConfig::get('webplayer_confirmclose') && !$is_share) { ?>
window.parent.onbeforeunload = function (evt) {
if (!$("#jquery_jplayer_1").data("jPlayer").status.paused) {
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;
}
if (evt) {
evt.returnValue = message;
}
return message;
}
return null;
}
<?php } ?>
<?php if ($iframed && AmpConfig::get('webplayer_confirmclose') && !$is_share) { ?>
window.addEventListener('storage', function (event) {
if (event.key == 'ampache-current-webplayer') {
// The latest used webplayer is not this player, pause song if playing
if (event.newValue != jpuqid) {
if (!$("#jquery_jplayer_1").data("jPlayer").status.paused) {
$("#jquery_jplayer_1").data("jPlayer").pause();
}
}
}
});
<?php } ?>
</script>

View file

@ -45,27 +45,9 @@ $_SESSION['login'] = true;
<script type="text/javascript" language="javascript">
function focus(){ document.login.username.focus(); }
</script>
<?php
// If iframes, we check in javascript that parent container doesn't exist, otherwise we redirect to the page without frame.
if (AmpConfig::get('iframes')) {
?>
<script language="javascript" type="text/javascript">
function forceNoframe()
{
if (self != top) {
var frame = top.document.getElementById('frame_footer');
if (frame != null) {
parent.location = document.location;
}
}
}
</script>
<?php
}
?>
</head>
<body id="loginPage" onload="focus();<?php echo (AmpConfig::get('iframes')) ? "forceNoframe();" : ""; ?>">
<body id="loginPage" onload="focus();">
<div id="maincontainer">
<div id="header"><!-- This is the header -->
<h1 id="headerlogo">

View file

@ -37,7 +37,7 @@ if ($album != T_('Unknown (Orphaned)')) {
<div class="np_group">
<div class="np_cell cel_song">
<label><?php echo T_('Song'); ?>:</label>
<a title="<?php echo scrub_out($song->title); ?>" href="<?php echo $web_path; ?>/stream.php?action=play_item&object_type=song&object_id=<?php echo $song->id; ?>">
<a rel="nohtml" title="<?php echo scrub_out($song->title); ?>" href="<?php echo $web_path; ?>/stream.php?action=play_item&object_type=song&object_id=<?php echo $song->id; ?>">
<?php echo $title; ?>
</a>
</div>

View file

@ -48,7 +48,7 @@ UI::show_box_top('<div id="playlist_row_' . $playlist->id . '">' . $title . '</d
</li>
<?php if (Access::check_function('batch_download')) { ?>
<li>
<a href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=playlist&amp;id=<?php echo $playlist->id; ?>">
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=playlist&amp;id=<?php echo $playlist->id; ?>">
<?php echo UI::get_icon('batch_download', T_('Batch Download')); ?>
&nbsp;&nbsp;<?php echo T_('Batch Download'); ?>
</a>

View file

@ -46,7 +46,7 @@
<td class="cel_owner"><?php echo scrub_out($libitem->f_user); ?></td>
<td class="cel_action">
<?php if (Access::check_function('batch_download')) { ?>
<a href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=playlist&amp;id=<?php echo $libitem->id; ?>">
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=playlist&amp;id=<?php echo $libitem->id; ?>">
<?php echo UI::get_icon('batch_download', T_('Batch Download')); ?>
</a>
<?php } ?>

View file

@ -52,7 +52,7 @@
<?php } ?>
<td class="cel_action">
<?php if (AmpConfig::get('download')) { ?>
<a href="<?php echo AmpConfig::get('web_path'); ?>/stream.php?action=download&amp;song_id=<?php echo $libitem->id; ?>">
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/stream.php?action=download&amp;song_id=<?php echo $libitem->id; ?>">
<?php echo UI::get_icon('download', T_('Download')); ?>
</a>
<?php } ?>

View file

@ -31,7 +31,7 @@ UI::show_box_top('<div id="smartplaylist_row_' . $playlist->id . '">' . $title .
<ul>
<?php if (Access::check_function('batch_download')) { ?>
<li>
<a href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=search&amp;id=<?php echo $playlist->id; ?>"><?php echo UI::get_icon('batch_download', T_('Batch Download')); ?></a>
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=search&amp;id=<?php echo $playlist->id; ?>"><?php echo UI::get_icon('batch_download', T_('Batch Download')); ?></a>
<?php echo T_('Batch Download'); ?>
</li>
<?php } ?>

View file

@ -29,7 +29,7 @@
</li>
<?php if (Access::check_function('batch_download')) { ?>
<li>
<a href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=browse&amp;type=<?php echo scrub_out($_REQUEST['type']); ?>&amp;browse_id=<?php echo $browse->id; ?>"><?php echo UI::get_icon('batch_download', T_('Batch Download')); ?></a>
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=browse&amp;type=<?php echo scrub_out($_REQUEST['type']); ?>&amp;browse_id=<?php echo $browse->id; ?>"><?php echo UI::get_icon('batch_download', T_('Batch Download')); ?></a>
<?php echo T_('Batch Download'); ?>
</li>
<?php } ?>

View file

@ -46,7 +46,7 @@
<td class="cel_owner"><?php echo scrub_out($libitem->f_user); ?></td>
<td class="cel_action">
<?php if (Access::check_function('batch_download')) { ?>
<a href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=search&amp;id=<?php echo $libitem->id; ?>">
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/batch.php?action=search&amp;id=<?php echo $libitem->id; ?>">
<?php echo UI::get_icon('batch_download', T_('Batch Download')); ?>
</a>
<?php } ?>

View file

@ -72,8 +72,8 @@ $button_flip_state_id = 'button_flip_state_' . $song->id;
<a href="<?php echo AmpConfig::get('web_path'); ?>/share.php?action=show_create&type=song&id=<?php echo $song->id; ?>"><?php echo UI::get_icon('share', T_('Share')); ?></a>
<?php } ?>
<?php if (Access::check_function('download')) { ?>
<a href="<?php echo Song::play_url($song->id); ?>"><?php echo UI::get_icon('link', T_('Link')); ?></a>
<a href="<?php echo AmpConfig::get('web_path'); ?>/stream.php?action=download&amp;song_id=<?php echo $song->id; ?>"><?php echo UI::get_icon('download', T_('Download')); ?></a>
<a rel="nohtml" href="<?php echo Song::play_url($song->id); ?>"><?php echo UI::get_icon('link', T_('Link')); ?></a>
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/stream.php?action=download&amp;song_id=<?php echo $song->id; ?>"><?php echo UI::get_icon('download', T_('Download')); ?></a>
<?php } ?>
<?php if (Access::check('interface','50')) { ?>
<a onclick="showEditDialog('song_row', '<?php echo $song->id ?>', '<?php echo 'edit_song_'.$song->id ?>', '<?php echo T_('Edit') ?>', '')">

View file

@ -65,7 +65,7 @@
<a href="<?php echo $web_path; ?>/share.php?action=show_create&type=song&id=<?php echo $libitem->id; ?>"><?php echo UI::get_icon('share', T_('Share')); ?></a>
<?php } ?>
<?php if (Access::check_function('download')) { ?>
<a href="<?php echo AmpConfig::get('web_path'); ?>/stream.php?action=download&song_id=<?php echo $libitem->id; ?>"><?php echo UI::get_icon('download', T_('Download')); ?></a><?php } ?>
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/stream.php?action=download&song_id=<?php echo $libitem->id; ?>"><?php echo UI::get_icon('download', T_('Download')); ?></a><?php } ?>
<?php if (Access::check('interface','50') || ($libitem->user_upload == $GLOBALS['user']->id && AmpConfig::get('upload_allow_edit'))) { ?>
<a id="<?php echo 'edit_song_'.$libitem->id ?>" onclick="showEditDialog('song_row', '<?php echo $libitem->id ?>', '<?php echo 'edit_song_'.$libitem->id ?>', '<?php echo T_('Song edit') ?>', 'song_')">
<?php echo UI::get_icon('edit', T_('Edit')); ?>

View file

@ -87,8 +87,8 @@ foreach ($subtitles as $subtitle) {
<a href="<?php echo AmpConfig::get('web_path'); ?>/share.php?action=show_create&type=video&id=<?php echo $video->id; ?>"><?php echo UI::get_icon('share', T_('Share')); ?></a>
<?php } ?>
<?php if (Access::check_function('download')) { ?>
<a href="<?php echo Video::play_url($video->id); ?>"><?php echo UI::get_icon('link', T_('Link')); ?></a>
<a href="<?php echo AmpConfig::get('web_path'); ?>/stream.php?action=download&video_id=<?php echo $video->id; ?>"><?php echo UI::get_icon('download', T_('Download')); ?></a>
<a rel="nohtml" href="<?php echo Video::play_url($video->id); ?>"><?php echo UI::get_icon('link', T_('Link')); ?></a>
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/stream.php?action=download&video_id=<?php echo $video->id; ?>"><?php echo UI::get_icon('download', T_('Download')); ?></a>
<?php } ?>
<?php if (Access::check('interface','50')) { ?>
<a onclick="showEditDialog('video_row', '<?php echo $video->id ?>', '<?php echo 'edit_video_'.$video->id ?>', '<?php echo T_('Edit') ?>', '')">

View file

@ -79,7 +79,7 @@ if ($video_type != 'video') {
<a href="<?php echo $web_path; ?>/share.php?action=show_create&type=video&id=<?php echo $libitem->id; ?>"><?php echo UI::get_icon('share', T_('Share')); ?></a>
<?php } ?>
<?php if (Access::check_function('download')) { ?>
<a href="<?php echo AmpConfig::get('web_path'); ?>/stream.php?action=download&video_id=<?php echo $libitem->id; ?>"><?php echo UI::get_icon('download', T_('Download')); ?></a>
<a rel="nohtml" href="<?php echo AmpConfig::get('web_path'); ?>/stream.php?action=download&video_id=<?php echo $libitem->id; ?>"><?php echo UI::get_icon('download', T_('Download')); ?></a>
<?php } ?>
<?php if (Access::check('interface','50')) { ?>
<a id="<?php echo 'edit_video_'.$libitem->id ?>" onclick="showEditDialog('video_row', '<?php echo $libitem->id ?>', '<?php echo 'edit_video_'.$libitem->id ?>', '<?php echo T_('Video edit') ?>', 'video_')">

View file

@ -33,47 +33,7 @@ header('Expires: ' . gmdate(DATE_RFC1123, time()-1));
if (!$is_share) {
$playlist = new Stream_Playlist(scrub_in($_REQUEST['playlist_id']));
}
?>
<script language="javascript" type="text/javascript">
var jplaylist = new Array();
var jtypes = new Array();
function addMedia(media)
{
var jpmedia = {};
jpmedia['title'] = media['title'];
jpmedia['artist'] = media['artist'];
jpmedia[media['filetype']] = media['url'];
jpmedia['poster'] = media['poster'];
jpmedia['artist_id'] = media['artist_id'];
jpmedia['album_id'] = media['album_id'];
jpmedia['song_id'] = media['song_id'];
jplaylist.add(jpmedia);
}
</script>
<script language="javascript" type="text/javascript">
function ExitPlayer()
{
var ff = parent.parent.document.getElementById('frame_footer');
var maindiv = parent.parent.document.getElementById('maindiv');
if (ff.getAttribute('className') == 'frame_footer_visible') {
ff.setAttribute('className', 'frame_footer_hide');
ff.setAttribute('class', 'frame_footer_hide');
maindiv.style.height = parent.parent.innerHeight + "px";
<?php
if (AmpConfig::get('song_page_title')) {
echo "window.parent.document.title = '" . addslashes(AmpConfig::get('site_title')) . "';";
}
?>
}
window.parent.onbeforeunload = null;
ff.setAttribute('src', '');
return false;
}
</script>
<?php
$isRadio = false;
$isVideo = false;
$radio = null;

View file

@ -24,7 +24,7 @@ $web_path = AmpConfig::get('web_path');
?>
<ul id="sidebar-light">
<li><a href="<?php echo $web_path . ((AmpConfig::get('iframes')) ? '/?framed=1' : ''); ?>"><img src="<?php echo $web_path; ?>/images/topmenu-home.png" title="<?php echo T_('Home'); ?>" /></a></li>
<li><a href="<?php echo $web_path; ?>"><img src="<?php echo $web_path; ?>/images/topmenu-home.png" title="<?php echo T_('Home'); ?>" /></a></li>
<li><a href="<?php echo $web_path; ?>/browse.php?action=artist"><img src="<?php echo $web_path; ?>/images/topmenu-music.png" title="<?php echo T_('Artists'); ?>" /></a></li>
<li><a href="<?php echo $web_path; ?>/browse.php?action=playlist"><img src="<?php echo $web_path; ?>/images/topmenu-playlist.png" title="<?php echo T_('Playlists'); ?>" /></a></li>
<li><a href="<?php echo $web_path; ?>/stats.php?action=userflag"><img src="<?php echo $web_path; ?>/images/topmenu-favorite.png" title="<?php echo T_('Favorites'); ?>" /></a></li>

View file

@ -61,7 +61,7 @@
<li>
<h4 class="header"><span class="sidebar-header-title" title="<?php echo T_('Playlist'); ?>"><?php echo T_('Playlist'); ?></span><span class="sprite sprite-icon_all <?php echo isset($_COOKIE['sb_home_playlist']) ? $_COOKIE['sb_home_playlist'] : 'expanded'; ?>" id="playlist" alt="<?php echo T_('Expand/Collapse'); ?>" title="<?php echo T_('Expand/Collapse'); ?>"></span></h4>
<ul class="sb3" id="sb_home_playlist">
<li id="sb_home_playlist_currentlyPlaying"><a href="<?php echo AmpConfig::get('web_path') . ((AmpConfig::get('iframes')) ? '/?framed=1' : ''); ?>"><?php echo T_('Currently Playing'); ?></a></li>
<li id="sb_home_playlist_currentlyPlaying"><a href="<?php echo AmpConfig::get('web_path'); ?>"><?php echo T_('Currently Playing'); ?></a></li>
<?php if (AmpConfig::get('allow_democratic_playback')) { ?>
<li id="sb_home_playlist_playlist"><a href="<?php echo $web_path; ?>/democratic.php?action=show_playlist"><?php echo T_('Democratic'); ?></a></li>
<?php } ?>