1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 17:59:21 +02:00

fixed up the playlist and the auto refresh with jquery

This commit is contained in:
John Moore 2013-07-27 11:30:17 -05:00
parent de35a43d54
commit 6b40e833ea
4 changed files with 34 additions and 22 deletions

View file

@ -49,7 +49,12 @@ function ajaxState(url, input) {
// processContents
// Iterate over a response and do any updates we received.
function processContents(data, status) {
$(data).find("content").each(function () {
$(data).find('content').each(function () {
$('#' + $(this).attr('div')).html($(this).text())
var text = $.parseHTML($(this).text(), document, true);
var dom = $(text);
dom.filter('script').each(function(){
$.globalEval(this.text || this.textContent || this.innerHtml || '');
});
})
} // processContents

View file

@ -17,6 +17,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
$(document).ready(function () {
$('.default_hidden').hide();
});
// flipField
// Toggles the disabled property on the specifed field
@ -67,16 +70,7 @@ function delayRun(element, time, method, page, source) {
// IE issue fixed by Spocky, we have to use the iframe for Democratic Play &
// Localplay, which don't actually prompt for a new file
function reloadUtil(target) {
if (navigator.appName == 'Opera') {
$('util_iframe').contentWindow.location.reload(true);
}
else if (navigator.appName == 'Konqueror') {
$('util_iframe').contentDocument.location.reload(true);
}
else {
$('util_iframe').src = $('util_iframe').src;
}
$('#util_iframe').prop('src', target);
} // reloadUtil
// reloadRedirect
@ -102,10 +96,21 @@ function check_inline_song_edit(type, song) {
// really should be using jquery ui and have something nice looking
function showAddTagDialog(id, type, path) {
var tagName = window.prompt('Enter Tag:', '');
var url = path + '/server/ajax.server.php?page=tag&action=add_tag_by_name&type=' + type + '&object_id=' + id + '&tag_name=' + tagName;
$('#dialog_tag_item').dialog({
modal: true,
buttons: [
{
text: 'ok',
click: function () {
var tagName = $('#dialog_tag_item_tag_name').val();
if (tagName != null || tagName != '') {
ajaxPut(url);
ajaxPut(path + '/server/ajax.server.php?page=tag&action=add_tag_by_name&type=' + type + '&object_id=' + id + '&tag_name=' + tagName);
}
$('#dialog_tag_item_tag_name').val('');
$(this).dialog('close');
}
}
]
}).show();
}

View file

@ -40,6 +40,7 @@ if (Config::get('use_rss')) { ?>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=<?php echo Config::get('site_charset'); ?>" />
<title><?php echo scrub_out(Config::get('site_title')); ?> - <?php echo $location['title']; ?></title>
<?php require_once Config::get('prefix') . '/templates/stylesheets.inc.php'; ?>
<link rel="stylesheet" href="<?php echo $web_path; ?>/modules/jquery/jquery-ui-1.10.3.min.css" type="text/css" media="screen" />
</head>
<body>
<script src="<?php echo $web_path; ?>/modules/jquery/jquery-1.9.1.js" language="javascript" type="text/javascript"></script>
@ -48,6 +49,7 @@ if (Config::get('use_rss')) { ?>
<script src="<?php echo $web_path; ?>/lib/javascript/ajax.js" language="javascript" type="text/javascript"></script>
<!-- rfc3514 implementation -->
<div id="rfc3514" style="display:none;">0x0</div>
<div id="dialog_tag_item" class="default_hidden"><span><?php echo T_('Enter tag:')?></span><br /><input type="text" id="dialog_tag_item_tag_name"/></div>
<div id="maincontainer">
<div id="header"><!-- This is the header -->
<h1 id="headerlogo">

View file

@ -31,6 +31,6 @@ function refresh()
<?php echo Ajax::action($ajax_url, ''); ?>;
}
$(document).ready(function() {
window.setInterval(refresh(), refreshInterval);
window.setInterval(function(){refresh();}, refreshInterval * 1000);
});
</script>