Skip to content
Snippets Groups Projects
Commit 963c2977 authored by Demian Katz's avatar Demian Katz
Browse files

Fixed some subtle problems with hash handling.

parent f9bada00
No related merge requests found
...@@ -173,6 +173,7 @@ function ajaxLoadTab(tabid) { ...@@ -173,6 +173,7 @@ function ajaxLoadTab(tabid) {
if(typeof syn_get_widget === "function") { if(typeof syn_get_widget === "function") {
syn_get_widget(); syn_get_widget();
} }
window.location.hash = tabid;
} }
}); });
return false; return false;
...@@ -224,15 +225,17 @@ function ajaxTagUpdate(tag, remove) { ...@@ -224,15 +225,17 @@ function ajaxTagUpdate(tag, remove) {
function applyRecordTabHash() function applyRecordTabHash()
{ {
var activeTab = $('ul.recordTabs li.active a').attr('id');
var newTab = typeof window.location.hash !== 'undefined'
? window.location.hash.toLowerCase() : '';
// Open tag in url hash // Open tag in url hash
if ($(window.location.hash.toLowerCase()).length > 0) { if (newTab.length > 0 && '#' + activeTab != newTab) {
$(window.location.hash.toLowerCase()).click(); $(window.location.hash.toLowerCase()).click();
} }
} }
$(window).bind('hashchange', function(){ $(window).on('hashchange', applyRecordTabHash);
applyRecordTabHash();
});
$(document).ready(function(){ $(document).ready(function(){
var id = $('.hiddenId')[0].value; var id = $('.hiddenId')[0].value;
...@@ -243,11 +246,11 @@ $(document).ready(function(){ ...@@ -243,11 +246,11 @@ $(document).ready(function(){
return true; return true;
} }
var tabid = $(this).attr('id').toLowerCase(); var tabid = $(this).attr('id').toLowerCase();
window.location.hash = tabid;
if($('#'+tabid+'-tab').length > 0) { if($('#'+tabid+'-tab').length > 0) {
$('#record-tabs .tab-pane.active').removeClass('active'); $('#record-tabs .tab-pane.active').removeClass('active');
$('#'+tabid+'-tab').addClass('active'); $('#'+tabid+'-tab').addClass('active');
$('#'+tabid).tab('show'); $('#'+tabid).tab('show');
window.location.hash = tabid;
return false; return false;
} else { } else {
$('#record-tabs').append('<div class="tab-pane" id="'+tabid+'-tab"><i class="fa fa-spinner fa-spin"></i> '+vufindString['loading']+'...</div>'); $('#record-tabs').append('<div class="tab-pane" id="'+tabid+'-tab"><i class="fa fa-spinner fa-spin"></i> '+vufindString['loading']+'...</div>');
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment