From 48dfdb8a1d1386794712481615af67df7c2d0643 Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Mon, 26 Sep 2016 15:19:44 +0300
Subject: [PATCH] ajaxLoadTab domain name bug fix (#808)

- Fix a problem where ajaxLoadTab fails to load a tab when the domain name begins with the VuFind path (e.g. http://vufind2.local/vufind2/Record/something).
---
 themes/bootstrap3/js/record.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/themes/bootstrap3/js/record.js b/themes/bootstrap3/js/record.js
index b6f90e60dbe..04ca8f2d523 100644
--- a/themes/bootstrap3/js/record.js
+++ b/themes/bootstrap3/js/record.js
@@ -164,7 +164,7 @@ function ajaxLoadTab($newTab, tabid, setHash) {
     urlroot = '/' + chunks[3] + '/' + chunks[4];
   } else {
     // standard case -- VuFind has its own path under site:
-    var pathInUrl = urlWithoutFragment.indexOf(path);
+    var pathInUrl = urlWithoutFragment.indexOf(path, urlWithoutFragment.indexOf('//') + 2);
     var parts = urlWithoutFragment.substring(pathInUrl + path.length + 1).split('/');
     urlroot = '/' + parts[0] + '/' + parts[1];
   }
-- 
GitLab