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

Moved document ready to bottom (for better jslint compliance).

parent c013d178
Branches
Tags
No related merge requests found
...@@ -2,31 +2,6 @@ var _CART_COOKIE = 'vufind_cart'; ...@@ -2,31 +2,6 @@ var _CART_COOKIE = 'vufind_cart';
var _CART_COOKIE_SOURCES = 'vufind_cart_src'; var _CART_COOKIE_SOURCES = 'vufind_cart_src';
var _CART_COOKIE_DELIM = "\t"; var _CART_COOKIE_DELIM = "\t";
$(document).ready(function() {
var cartRecordId = $('#cartId').val();
$('#cartItems').hide();
$('#viewCart, #updateCart, #bottom_updateCart').removeClass('offscreen');
// Record
$('#recordCart').removeClass('offscreen').click(function() {
if(cartRecordId != undefined) {
if ($(this).hasClass('bookbagAdd')) {
updateCartSummary(addItemToCartCookie(cartRecordId));
$(this).html(vufindString.removeBookBag).removeClass('bookbagAdd').addClass('bookbagDelete');
} else {
updateCartSummary(removeItemFromCartCookie(cartRecordId));
$(this).html(vufindString.addBookBag).removeClass('bookbagDelete').addClass('bookbagAdd');
}
}
return false;
});
redrawCartStatus()
var $form = $('form[name="bulkActionForm"]');
registerUpdateCart($form);
});
function registerUpdateCart($form) { function registerUpdateCart($form) {
if($form) { if($form) {
$("#updateCart, #bottom_updateCart").unbind('click').click(function(){ $("#updateCart, #bottom_updateCart").unbind('click').click(function(){
...@@ -192,4 +167,27 @@ function removeCartCheckbox() { ...@@ -192,4 +167,27 @@ function removeCartCheckbox() {
$('.checkbox_ui, .selectAllCheckboxes').each(function(){ $('.checkbox_ui, .selectAllCheckboxes').each(function(){
$(this).attr('checked', false); $(this).attr('checked', false);
}); });
} }
\ No newline at end of file
$(document).ready(function() {
var cartRecordId = $('#cartId').val();
$('#cartItems').hide();
$('#viewCart, #updateCart, #bottom_updateCart').removeClass('offscreen');
// Record
$('#recordCart').removeClass('offscreen').click(function() {
if(cartRecordId != undefined) {
if ($(this).hasClass('bookbagAdd')) {
updateCartSummary(addItemToCartCookie(cartRecordId));
$(this).html(vufindString.removeBookBag).removeClass('bookbagAdd').addClass('bookbagDelete');
} else {
updateCartSummary(removeItemFromCartCookie(cartRecordId));
$(this).html(vufindString.addBookBag).removeClass('bookbagDelete').addClass('bookbagAdd');
}
}
return false;
});
redrawCartStatus()
var $form = $('form[name="bulkActionForm"]');
registerUpdateCart($form);
});
\ 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