diff --git a/lib/javascript/base.js b/lib/javascript/base.js index e1faa4ca..47393d19 100644 --- a/lib/javascript/base.js +++ b/lib/javascript/base.js @@ -18,6 +18,11 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // $(document).ready(function () { + initTabs(); +}); + +function initTabs() +{ $('.default_hidden').hide(); $("#tabs li").click(function() { @@ -29,7 +34,7 @@ $(document).ready(function () { return false; }); -}); +} $(function() { var rightmenu = $("#rightbar"); diff --git a/lib/javascript/dynamicpage.js b/lib/javascript/dynamicpage.js index 3f8d187b..38314314 100644 --- a/lib/javascript/dynamicpage.js +++ b/lib/javascript/dynamicpage.js @@ -11,6 +11,7 @@ function loadContentData(data, status, jqXHR) }); }); $("a[rel^='prettyPhoto']").prettyPhoto({social_tools:false}); + initTabs(); } function loadContentPage(url) @@ -34,11 +35,11 @@ $(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") { - // Ajax load Ampache pages only - if (link.indexOf(jsWebPath) > -1) { - window.location.hash = link.substring(jsWebPath.length + 1); - return false; - } + // Ajax load Ampache pages only + if (link.indexOf(jsWebPath) > -1) { + window.location.hash = link.substring(jsWebPath.length + 1); + return false; + } } else { window.location.hash = $(this).attr("rel"); return false; @@ -76,8 +77,8 @@ $(function() { newHash = window.location.hash.substring(1); if (newHash && newHash.indexOf("prettyPhoto") != 0 && newHash.indexOf(".php") > -1) { loadContentPage(jsWebPath + '/' + newHash); + return false; }; - return false; }); $(window).trigger('hashchange'); diff --git a/lib/javascript/tools.js b/lib/javascript/tools.js index e5cf53d2..ddd6b1fc 100644 --- a/lib/javascript/tools.js +++ b/lib/javascript/tools.js @@ -196,7 +196,12 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_ro $('#' + parent.refreshRowPrefix + parent.editId).attr("id", parent.refreshRowPrefix + new_id); }); } else { - location.reload(true); + var reloadp = window.location; + var hash = window.location.hash.substring(1); + if (hash && hash.indexOf('.php') > -1) { + reloadp = jsWebPath + '/' + hash; + } + loadContentPage(reloadp); } }, error : function(resp){ diff --git a/templates/rightbar.inc.php b/templates/rightbar.inc.php index 6074b7fb..0f77cb1e 100644 --- a/templates/rightbar.inc.php +++ b/templates/rightbar.inc.php @@ -107,7 +107,8 @@ $normal_array = array('live_stream', 'song', 'video', 'random', 'song_preview'); - foreach ($objects as $uid=>$object_data) { + foreach ($objects as $object_data) { + $uid = $object_data['track_id']; $type = array_shift($object_data); if (in_array($type,$normal_array)) { $object = new $type(array_shift($object_data));