Skip to content
Snippets Groups Projects
Commit c3c21f3e authored by Chris Hallberg's avatar Chris Hallberg Committed by Robert Lange
Browse files

Fix eslint no-prototype-builtins.

parent 4d0554ad
No related merge requests found
/*global grecaptcha, isPhoneNumberValid */
/*exported VuFind, htmlEncode, deparam, moreFacets, lessFacets, getUrlRoot, phoneNumberFormHandler, recaptchaOnLoad, resetCaptcha, bulkFormHandler, setupMultiILSLoginFields */
/*exported VuFind, htmlEncode, deparam, moreFacets, lessFacets, getUrlRoot, phoneNumberFormHandler, recaptchaOnLoad, resetCaptcha, bulkFormHandler */
// IE 9< console polyfill
window.console = window.console || { log: function polyfillLog() {} };
......@@ -163,16 +163,13 @@ function getUrlRoot(url) {
var urlroot = null;
var urlParts = url.split(/[?#]/);
var urlWithoutFragment = urlParts[0];
var slashSlash = urlWithoutFragment.indexOf('//');
if (VuFind.path === '' || VuFind.path === '/') {
if (VuFind.path === '') {
// special case -- VuFind installed at site root:
var chunks = urlWithoutFragment.split('/');
// We need to extract different offsets if this is a full vs. relative URL:
urlroot = slashSlash > -1
? ('/' + chunks[3] + '/' + chunks[4])
: ('/' + chunks[1] + '/' + chunks[2]);
urlroot = '/' + chunks[3] + '/' + chunks[4];
} else {
// standard case -- VuFind has its own path under site:
var slashSlash = urlWithoutFragment.indexOf('//');
var pathInUrl = slashSlash > -1
? urlWithoutFragment.indexOf(VuFind.path, slashSlash + 2)
: urlWithoutFragment.indexOf(VuFind.path);
......@@ -358,26 +355,6 @@ function setupJumpMenus(_container) {
container.find('select.jumpMenu').change(function jumpMenu(){ $(this).parent('form').submit(); });
}
function setupMultiILSLoginFields(loginMethods, idPrefix) {
var searchPrefix = idPrefix ? '#' + idPrefix : '#';
$(searchPrefix + 'target').change(function onChangeLoginTarget() {
var target = $(this).val();
var $usernameGroup = $(searchPrefix + 'username').closest('.form-group');
var $password = $(searchPrefix + 'password');
if (loginMethods[target] === 'email') {
$usernameGroup.find('label.password-login').addClass('hidden');
$usernameGroup.find('label.email-login').removeClass('hidden');
$password.closest('.form-group').addClass('hidden');
// Set password to a dummy value so that any checks for username+password work
$password.val('****');
} else {
$usernameGroup.find('label.password-login').removeClass('hidden');
$usernameGroup.find('label.email-login').addClass('hidden');
$password.closest('.form-group').removeClass('hidden');
}
}).change();
}
$(document).ready(function commonDocReady() {
// Start up all of our submodules
VuFind.init();
......@@ -431,18 +408,21 @@ $(document).ready(function commonDocReady() {
if (url.indexOf('?' + 'print' + '=') !== -1 || url.indexOf('&' + 'print' + '=') !== -1) {
$("link[media='print']").attr("media", "all");
$(document).ajaxStop(function triggerPrint() {
// Print dialogs cause problems during testing, so disable them
// when the "test mode" cookie is set. This should never happen
// under normal usage outside of the Phing startup process.
if (document.cookie.indexOf('VuFindTestSuiteRunning=') === -1) {
window.print();
} else {
console.log("Printing disabled due to test mode."); // eslint-disable-line no-console
}
window.print();
});
// Make an ajax call to ensure that ajaxStop is triggered
$.getJSON(VuFind.path + '/AJAX/JSON', {method: 'keepAlive'});
}
// retain filter sessionStorage
$('.searchFormKeepFilters').click(function retainFiltersInSessionStorage() {
sessionStorage.setItem('vufind_retain_filters', this.checked ? 'true' : 'false');
$('.applied-filter').prop('checked', this.checked);
});
if (sessionStorage.getItem('vufind_retain_filters')) {
var state = (sessionStorage.getItem('vufind_retain_filters') === 'true');
$('.searchFormKeepFilters,.applied-filter').prop('checked', state);
}
setupIeSupport();
});
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