The Gitlab instance will be restarted on Monday April 28th at 2AM. There will be a short interruption of service.

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

Moved document ready functions to ends of files for jslint compliance (avoid undeclared errors).

parent 5f798ef2
No related merge requests found
$(document).ready(function(){
registerBulkActions();
});
function registerBulkActions() {
$('form[name="bulkActionForm"] input[type="submit"]').unbind('click').click(function(){
var ids = $.map($(this.form).find('input.checkbox_ui:checked'), function(i) {
......@@ -70,3 +66,7 @@ function registerBulkActions() {
return false;
});
}
$(document).ready(function(){
registerBulkActions();
});
\ No newline at end of file
$(document).ready(function() {
checkItemStatuses();
});
function checkItemStatuses() {
var id = $.map($('.ajaxItemId'), function(i) {
return $(i).find('.hiddenId')[0].value;
......@@ -77,3 +73,7 @@ function checkItemStatuses() {
});
}
}
$(document).ready(function() {
checkItemStatuses();
});
\ No newline at end of file
$(document).ready(function() {
checkSaveStatuses();
// attach click event to the save record link
$('a.saveRecord').click(function() {
var id = $(this).parents('.recordId').find('.hiddenId');
if (id.length > 0) {
// search results:
id = id[0].value;
} else {
// record view:
id = document.getElementById('record_id').value;
}
var controller = extractController(this);
var $dialog = getLightbox(controller, 'Save', id, null, this.title, controller, 'Save', id);
return false;
});
});
function checkSaveStatuses() {
var data = $.map($('.recordId'), function(i) {
return {'id':$(i).find('.hiddenId')[0].value, 'source':extractSource(i)};
......@@ -54,3 +36,21 @@ function checkSaveStatuses() {
});
}
}
$(document).ready(function() {
checkSaveStatuses();
// attach click event to the save record link
$('a.saveRecord').click(function() {
var id = $(this).parents('.recordId').find('.hiddenId');
if (id.length > 0) {
// search results:
id = id[0].value;
} else {
// record view:
id = document.getElementById('record_id').value;
}
var controller = extractController(this);
var $dialog = getLightbox(controller, 'Save', id, null, this.title, controller, 'Save', id);
return false;
});
});
\ No newline at end of file
$(document).ready(function() {
showMoreInfoToggle();
});
function showMoreInfoToggle() {
toggleCollectionInfo();
$("#moreInfoToggle").show();
......@@ -14,3 +10,7 @@ function showMoreInfoToggle() {
function toggleCollectionInfo() {
$("#collectionInfo").toggle();
}
$(document).ready(function() {
showMoreInfoToggle();
});
\ No newline at end of file
var hierarchyID;
var baseTreeSearchFullURL;
$(document).ready(function()
{
hierarchyID = $("#hierarchyTree").find(".hiddenHierarchyId")[0].value;
var recordID = $("#hierarchyTree").find(".hiddenRecordId")[0].value;
var scroller = hierarchySettings.lightboxMode ? '#modalDialog' : '#hierarchyTree';
var context = $("#hierarchyTree").find(".hiddenContext")[0].value;
if (!hierarchySettings.fullHierarchy) {
// Set Up Partial Hierarchy View Toggle
$('#hierarchyTree').parent().prepend('<a href="#" id="toggleTree" class="closed">' + vufindString.showTree + '</a>');
$('#toggleTree').click(function(e)
{
e.preventDefault();
$(this).toggleClass("open");
$(this).hasClass("open") ? scroll(scroller, "show") : scroll(scroller, "hide");
$("#hierarchyTree").jstree("toggle_dots");
});
}
$("#hierarchyTree")
.bind("loaded.jstree", function (event, data)
{
var idList = $('#hierarchyTree .JSTreeID');
$(idList).each(function()
{
var id = $.trim($(this).text());
$(this).before('<input type="hidden" class="jsTreeID '+context+ '" value="'+id+'" />');
$(this).remove();
});
$(".Collection").each(function()
{
var id = $(this).attr("value");
$(this).next("a").click(function(e)
{
e.preventDefault();
$("#hierarchyTree a").removeClass("jstree-clicked");
$(this).addClass("jstree-clicked");
// Open this node
$(this).parent().removeClass("jstree-closed").addClass("jstree-open");
getRecord(id);
return false;
});
});
$("#hierarchyTree a").click(function(e)
{
e.preventDefault();
if (context == "Record") {
window.location = $(this).attr("href");
}
if ($('#toggleTree').length > 0 && !$('#toggleTree').hasClass("open")) {
hideFullHierarchy($(this).parent());
}
});
var jsTreeNode = $(".jsTreeID:input[value='"+recordID+"']").parent();
// Open Nodes to Current Path
jsTreeNode.parents("li").removeClass("jstree-closed").addClass("jstree-open");
// Initially Open Current node too
jsTreeNode.removeClass("jstree-closed").addClass("jstree-open");
// Add clicked class
$("> a", jsTreeNode).addClass("jstree-clicked");
// Add highlight class to parents
jsTreeNode.parents("li").children("a").addClass("jstree-highlight");
if (!hierarchySettings.fullHierarchy) {
// Initial hide of nodes outside current path
hideFullHierarchy(jsTreeNode);
$("#hierarchyTree").jstree("toggle_dots");
}
// Scroll to the current record
$(scroller).delay(250).animate({
scrollTop: jsTreeNode.offset().top - $(scroller).offset().top + $(scroller).scrollTop()
});
})
.jstree({
"xml_data" : {
"ajax" : {
"url" : path + '/Hierarchy/GetTree?' + $.param({'hierarchyID': hierarchyID, 'id': recordID, 'context': context, mode: "Tree"}),
success: function(data)
{
// Necessary as data is a string
var dataAsXML = $.parseXML(data);
if(dataAsXML) {
var error = $(dataAsXML).find("error");
if (error.length > 0) {
showTreeError($(error).text());
return false;
} else {
return data;
}
} else {
showTreeError("Unable to Parse XML");
}
},
failure: function()
{
showTreeError("Unable to Load Tree");
}
},
"xsl" : "nest"
},
"plugins" : [ "themes", "xml_data", "ui" ],
"themes" : {
"url": path + '/themes/blueprint/js/jsTree/themes/vufind/style.css'
}
}).bind("open_node.jstree close_node.jstree", function (e, data)
{
$(data.args[0]).find("li").show();
});
$('#treeSearch').show();
$('#treeSearchText').bind('keypress', function(e)
{
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) {
// Enter keycode should call the search code
doTreeSearch();
}
});
});
function showTreeError(msg)
{
......@@ -257,4 +135,127 @@ $(function ()
break;
}
});
});
$(document).ready(function()
{
hierarchyID = $("#hierarchyTree").find(".hiddenHierarchyId")[0].value;
var recordID = $("#hierarchyTree").find(".hiddenRecordId")[0].value;
var scroller = hierarchySettings.lightboxMode ? '#modalDialog' : '#hierarchyTree';
var context = $("#hierarchyTree").find(".hiddenContext")[0].value;
if (!hierarchySettings.fullHierarchy) {
// Set Up Partial Hierarchy View Toggle
$('#hierarchyTree').parent().prepend('<a href="#" id="toggleTree" class="closed">' + vufindString.showTree + '</a>');
$('#toggleTree').click(function(e)
{
e.preventDefault();
$(this).toggleClass("open");
$(this).hasClass("open") ? scroll(scroller, "show") : scroll(scroller, "hide");
$("#hierarchyTree").jstree("toggle_dots");
});
}
$("#hierarchyTree")
.bind("loaded.jstree", function (event, data)
{
var idList = $('#hierarchyTree .JSTreeID');
$(idList).each(function()
{
var id = $.trim($(this).text());
$(this).before('<input type="hidden" class="jsTreeID '+context+ '" value="'+id+'" />');
$(this).remove();
});
$(".Collection").each(function()
{
var id = $(this).attr("value");
$(this).next("a").click(function(e)
{
e.preventDefault();
$("#hierarchyTree a").removeClass("jstree-clicked");
$(this).addClass("jstree-clicked");
// Open this node
$(this).parent().removeClass("jstree-closed").addClass("jstree-open");
getRecord(id);
return false;
});
});
$("#hierarchyTree a").click(function(e)
{
e.preventDefault();
if (context == "Record") {
window.location = $(this).attr("href");
}
if ($('#toggleTree').length > 0 && !$('#toggleTree').hasClass("open")) {
hideFullHierarchy($(this).parent());
}
});
var jsTreeNode = $(".jsTreeID:input[value='"+recordID+"']").parent();
// Open Nodes to Current Path
jsTreeNode.parents("li").removeClass("jstree-closed").addClass("jstree-open");
// Initially Open Current node too
jsTreeNode.removeClass("jstree-closed").addClass("jstree-open");
// Add clicked class
$("> a", jsTreeNode).addClass("jstree-clicked");
// Add highlight class to parents
jsTreeNode.parents("li").children("a").addClass("jstree-highlight");
if (!hierarchySettings.fullHierarchy) {
// Initial hide of nodes outside current path
hideFullHierarchy(jsTreeNode);
$("#hierarchyTree").jstree("toggle_dots");
}
// Scroll to the current record
$(scroller).delay(250).animate({
scrollTop: jsTreeNode.offset().top - $(scroller).offset().top + $(scroller).scrollTop()
});
})
.jstree({
"xml_data" : {
"ajax" : {
"url" : path + '/Hierarchy/GetTree?' + $.param({'hierarchyID': hierarchyID, 'id': recordID, 'context': context, mode: "Tree"}),
success: function(data)
{
// Necessary as data is a string
var dataAsXML = $.parseXML(data);
if(dataAsXML) {
var error = $(dataAsXML).find("error");
if (error.length > 0) {
showTreeError($(error).text());
return false;
} else {
return data;
}
} else {
showTreeError("Unable to Parse XML");
}
},
failure: function()
{
showTreeError("Unable to Load Tree");
}
},
"xsl" : "nest"
},
"plugins" : [ "themes", "xml_data", "ui" ],
"themes" : {
"url": path + '/themes/blueprint/js/jsTree/themes/vufind/style.css'
}
}).bind("open_node.jstree close_node.jstree", function (e, data)
{
$(data.args[0]).find("li").show();
});
$('#treeSearch').show();
$('#treeSearchText').bind('keypress', function(e)
{
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) {
// Enter keycode should call the search code
doTreeSearch();
}
});
});
\ No newline at end of file
$(document).ready(function() {
// assign action to the openUrlWindow link class
$('a.openUrlWindow').click(function(){
var params = extractParams($(this).attr('class'));
var settings = params.window_settings;
window.open($(this).attr('href'), 'openurl', settings);
return false;
});
// assign action to the openUrlEmbed link class
$('a.openUrlEmbed').click(function(){
var params = extractParams($(this).attr('class'));
var openUrl = $(this).children('span.openUrl:first').attr('title');
$(this).hide();
loadResolverLinks($('#openUrlEmbed'+params.openurl_id).show(), openUrl);
return false;
});
});
function loadResolverLinks($target, openUrl) {
$target.addClass('ajax_availability');
var url = path + '/AJAX/JSON?' + $.param({method:'getResolverLinks',openurl:openUrl});
......@@ -34,3 +15,22 @@ function loadResolverLinks($target, openUrl) {
}
});
}
$(document).ready(function() {
// assign action to the openUrlWindow link class
$('a.openUrlWindow').click(function(){
var params = extractParams($(this).attr('class'));
var settings = params.window_settings;
window.open($(this).attr('href'), 'openurl', settings);
return false;
});
// assign action to the openUrlEmbed link class
$('a.openUrlEmbed').click(function(){
var params = extractParams($(this).attr('class'));
var openUrl = $(this).children('span.openUrl:first').attr('title');
$(this).hide();
loadResolverLinks($('#openUrlEmbed'+params.openurl_id).show(), openUrl);
return false;
});
});
\ No newline at end of file
$(document).ready(function() {
if (!Array.prototype.indexOf) {
setIndexOf();
}
getBookPreviews();
});
function getBookPreviews() {
var skeys = '';
$('.previewBibkeys').each(function(){
......@@ -158,4 +151,11 @@ function setIndexOf() {
}
return -1;
}
}
\ No newline at end of file
}
$(document).ready(function() {
if (!Array.prototype.indexOf) {
setIndexOf();
}
getBookPreviews();
});
\ No newline at end of file
$(document).ready(function(){
// create the slider for the publish date facet
$('.dateSlider').each(function(i) {
var myId = $(this).attr('id');
var prefix = myId.substr(0, myId.length - 6);
makePublishDateSlider(prefix);
});
});
function makePublishDateSlider(prefix) {
// create the slider widget
$('#' + prefix + 'Slider').slider({
......@@ -49,4 +40,13 @@ function updatePublishDateSlider(prefix) {
$('#' + prefix + 'Slider').slider('option', {
min: min, max: max, values: [from, to]
});
}
\ No newline at end of file
}
$(document).ready(function(){
// create the slider for the publish date facet
$('.dateSlider').each(function(i) {
var myId = $(this).attr('id');
var prefix = myId.substr(0, myId.length - 6);
makePublishDateSlider(prefix);
});
});
\ No newline at end of file
/**
* Functions and event handlers specific to record pages.
*/
$(document).ready(function(){
// register the record comment form to be submitted via AJAX
registerAjaxCommentRecord();
// bind click action to export record menu
$('a.exportMenu').click(function(){
toggleMenu('exportMenu');
return false;
});
var id = document.getElementById('record_id').value;
// bind click action on toolbar links
$('a.citeRecord').click(function() {
var controller = extractController(this);
var $dialog = getLightbox(controller, 'Cite', id, null, this.title);
return false;
});
$('a.smsRecord').click(function() {
var controller = extractController(this);
var $dialog = getLightbox(controller, 'SMS', id, null, this.title);
return false;
});
$('a.mailRecord').click(function() {
var controller = extractController(this);
var $dialog = getLightbox(controller, 'Email', id, null, this.title, controller, 'Email', id);
return false;
});
$('a.tagRecord').click(function() {
var controller = extractController(this);
var $dialog = getLightbox(controller, 'AddTag', id, null, this.title, controller, 'AddTag', id);
return false;
});
$('a.deleteRecordComment').click(function() {
var commentId = this.id.substr('recordComment'.length);
var recordSource = extractSource(this);
deleteRecordComment(id, recordSource, commentId);
return false;
});
// add highlighting to subject headings when mouseover
$('a.subjectHeading').mouseover(function() {
var subjectHeadings = $(this).parent().children('a.subjectHeading');
for(var i = 0; i < subjectHeadings.length; i++) {
$(subjectHeadings[i]).addClass('highlight');
if ($(this).text() == $(subjectHeadings[i]).text()) {
break;
}
}
});
$('a.subjectHeading').mouseout(function() {
$('.subjectHeading').removeClass('highlight');
});
$('.checkRequest').each(function(i) {
if($(this).hasClass('checkRequest')) {
$(this).addClass('ajax_hold_availability');
}
});
setUpCheckRequest();
});
function setUpCheckRequest() {
$('.checkRequest').each(function(i) {
......@@ -170,3 +108,66 @@ function deleteRecordComment(recordId, recordSource, commentId) {
}
});
}
$(document).ready(function(){
// register the record comment form to be submitted via AJAX
registerAjaxCommentRecord();
// bind click action to export record menu
$('a.exportMenu').click(function(){
toggleMenu('exportMenu');
return false;
});
var id = document.getElementById('record_id').value;
// bind click action on toolbar links
$('a.citeRecord').click(function() {
var controller = extractController(this);
var $dialog = getLightbox(controller, 'Cite', id, null, this.title);
return false;
});
$('a.smsRecord').click(function() {
var controller = extractController(this);
var $dialog = getLightbox(controller, 'SMS', id, null, this.title);
return false;
});
$('a.mailRecord').click(function() {
var controller = extractController(this);
var $dialog = getLightbox(controller, 'Email', id, null, this.title, controller, 'Email', id);
return false;
});
$('a.tagRecord').click(function() {
var controller = extractController(this);
var $dialog = getLightbox(controller, 'AddTag', id, null, this.title, controller, 'AddTag', id);
return false;
});
$('a.deleteRecordComment').click(function() {
var commentId = this.id.substr('recordComment'.length);
var recordSource = extractSource(this);
deleteRecordComment(id, recordSource, commentId);
return false;
});
// add highlighting to subject headings when mouseover
$('a.subjectHeading').mouseover(function() {
var subjectHeadings = $(this).parent().children('a.subjectHeading');
for(var i = 0; i < subjectHeadings.length; i++) {
$(subjectHeadings[i]).addClass('highlight');
if ($(this).text() == $(subjectHeadings[i]).text()) {
break;
}
}
});
$('a.subjectHeading').mouseout(function() {
$('.subjectHeading').removeClass('highlight');
});
$('.checkRequest').each(function(i) {
if($(this).hasClass('checkRequest')) {
$(this).addClass('ajax_hold_availability');
}
});
setUpCheckRequest();
});
\ No newline at end of file
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