diff --git a/themes/bootstrap3/js/common.js b/themes/bootstrap3/js/common.js index c19527cad4854220743dcc87cee98da197cab590..f2aa4983560b89a0cc2fbeb1dde742dde504ce77 100644 --- a/themes/bootstrap3/js/common.js +++ b/themes/bootstrap3/js/common.js @@ -4,14 +4,14 @@ function VuFindNamespace(p, s) { var path = p; var strings = s; - var getPath = function() { return path; } - var translate = function(op) { return strings[op]; } + var getPath = function() { return path; }; + var translate = function(op) { return strings[op]; }; return { getPath: getPath, translate: translate }; -}; +} /* --- GLOBAL FUNCTIONS --- */ function htmlEncode(value) { @@ -184,7 +184,7 @@ function newAccountHandler(html) { Lightbox.getByUrl(Lightbox.openingURL); Lightbox.openingURL = false; } - return valid == true; + return false; } // This is a full handler for the login form @@ -346,7 +346,7 @@ function keyboardShortcuts() { if ($('.pager').length > 0) { $(window).keydown(function(e) { if (!$searchform.is(':focus')) { - $target = null; + var $target = null; switch (e.keyCode) { case 37: // left arrow key $target = $('.pager').find('a.previous'); diff --git a/themes/bootstrap3/js/lightbox.js b/themes/bootstrap3/js/lightbox.js index a0176a5ea464038234f1f72f5b5b0bf2b74c9e50..26900eac3e9762bacf3317be1d09f97f84a44df7 100644 --- a/themes/bootstrap3/js/lightbox.js +++ b/themes/bootstrap3/js/lightbox.js @@ -1,4 +1,4 @@ -/*global checkSaveStatuses, console, deparam, Recaptcha, VuFind */ +/*global ajaxLogin, checkSaveStatuses, console, deparam, newAccountHandler, Recaptcha, refreshPageForLogin, registerLightboxEvents, VuFind */ var Lightbox = { /** diff --git a/themes/bootstrap3/js/record.js b/themes/bootstrap3/js/record.js index fb0ab767abb6c8dee099e1a033047c363cea3bc9..540c983fe7a8b55745714cbaae3052d920238c0c 100644 --- a/themes/bootstrap3/js/record.js +++ b/themes/bootstrap3/js/record.js @@ -140,15 +140,16 @@ function ajaxLoadTab($newTab, tabid, setHash) { var urlParts = document.URL.split(/[?#]/); var urlWithoutFragment = urlParts[0]; var path = VuFind.getPath(); + var urlroot = null; if (path === '') { // special case -- VuFind installed at site root: var chunks = urlWithoutFragment.split('/'); - var urlroot = '/' + chunks[3] + '/' + chunks[4]; + urlroot = '/' + chunks[3] + '/' + chunks[4]; } else { // standard case -- VuFind has its own path under site: var pathInUrl = urlWithoutFragment.indexOf(path); - var chunks = urlWithoutFragment.substring(pathInUrl + path.length + 1).split('/'); - var urlroot = '/' + chunks[0] + '/' + chunks[1]; + var parts = urlWithoutFragment.substring(pathInUrl + path.length + 1).split('/'); + urlroot = '/' + parts[0] + '/' + parts[1]; } // Request the tab via AJAX: diff --git a/themes/bootstrap3/templates/layout/layout.phtml b/themes/bootstrap3/templates/layout/layout.phtml index 4f8140b14255970dd3c37a5b7c3bfb1e40eb91ec..1a39cce24496c7c564fded42adb593998eda020f 100644 --- a/themes/bootstrap3/templates/layout/layout.phtml +++ b/themes/bootstrap3/templates/layout/layout.phtml @@ -95,12 +95,12 @@ } ?> <?=$this->headScript()?> - <script> - var VuFind = new VuFindNamespace( - '<?=rtrim($this->url('home'), '/') ?>', - <?=$this->jsTranslations()->getJSON() ?> - ); - </script> + <? + $root = rtrim($this->url('home'), '/'); + $translations = $this->jsTranslations()->getJSON(); + $setupJS = "var VuFind = new VuFindNamespace('{$root}', {$translations});"; + ?> + <?=$this->inlineScript(\Zend\View\Helper\HeadScript::SCRIPT, $setupJS, 'SET'); ?> </head> <body class="<?=$this->layoutClass('offcanvas-row')?><? if ($this->layout()->rtl): ?> rtl<? endif; ?>"> <? // Set up the search box -- there are three possible cases: