From 6d6840b485b1128ef37623b1aeedced190bb1297 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Thu, 17 Jan 2013 13:42:46 -0500 Subject: [PATCH] Moved document ready to bottom (for better jslint compliance). --- themes/blueprint/js/cart.js | 50 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/themes/blueprint/js/cart.js b/themes/blueprint/js/cart.js index 85a3bed5baa..5ff773997fc 100644 --- a/themes/blueprint/js/cart.js +++ b/themes/blueprint/js/cart.js @@ -2,31 +2,6 @@ var _CART_COOKIE = 'vufind_cart'; var _CART_COOKIE_SOURCES = 'vufind_cart_src'; 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) { if($form) { $("#updateCart, #bottom_updateCart").unbind('click').click(function(){ @@ -192,4 +167,27 @@ function removeCartCheckbox() { $('.checkbox_ui, .selectAllCheckboxes').each(function(){ $(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 -- GitLab