--- /dev/null
+function FluidbookCartThiriet(cart) {
+ this.cart = cart;
+ this.fluidbook = this.cart.fluidbook;
+ this.handleClicks = true;
+ this.init();
+}
+
+FluidbookCartThiriet.prototype = {
+ init: function () {
+ $(document).on(this.fluidbook.input.clickEvent, '[data-cart-ref] .add', function () {
+ try {
+ plusProduct($(this).data('cart-ref'));
+ } catch (e) {
+ console.warn('plusProduct() is unavailable');
+ console.error(e);
+ }
+ });
+ $(document).on(this.fluidbook.input.clickEvent, '[data-cart-ref] .remove', function () {
+ try {
+ minusProduct($(this).data('cart-ref'));
+ } catch (e) {
+ console.warn('minusProduct() is unavailable');
+ console.error(e);
+ }
+ });
+
+ $(document).on(this.fluidbook.input.clickEvent, '[data-cart-ref] .info', function () {
+ try {
+ infoProduct($(this).data('cart-ref'));
+ } catch (e) {
+ console.warn('infoProduct() is unavailable');
+ console.error(e);
+ }
+ });
+ },
+};
\ No newline at end of file
this.enabled = true;
this.instance = this.createInstance();
- $(document).on(this.fluidbook.input.clickEvent, '[data-cart-delete]', function () {
- if ($(this).closest('.override-delete').length > 0) {
- return true;
- }
- $this.instance.removeFromCart($(this).data('cart-delete'));
- $this.instance.updateCart(false);
- return false;
- });
-
- $(document).on(this.fluidbook.input.clickEvent, '[data-cart-ref]', function () {
- try {
- var qty = 1;
- if ($(this).data('cart-qty') !== null) {
- qty = parseInt($(this).attr('data-cart-qty'));
+ if (this.instance.handleClicks !== true) {
+ $(document).on(this.fluidbook.input.clickEvent, '[data-cart-delete]', function () {
+ if ($(this).closest('.override-delete').length > 0) {
+ return true;
}
+ $this.instance.removeFromCart($(this).data('cart-delete'));
+ $this.instance.updateCart(false);
+ return false;
+ });
- var ref = $(this).data('cart-ref');
-
- $this.fluidbook.stats.track(15, $this.fluidbook.currentPage, ref);
-
- var tooltipStyle = '';
+ $(document).on(this.fluidbook.input.clickEvent, '[data-cart-ref]', function () {
try {
- tooltipStyle = $this.instance.getTooltipStyle();
+ var qty = 1;
+ if ($(this).data('cart-qty') !== null) {
+ qty = parseInt($(this).attr('data-cart-qty'));
+ }
+
+ var ref = $(this).data('cart-ref');
+
+ $this.fluidbook.stats.track(15, $this.fluidbook.currentPage, ref);
+
+ var tooltipStyle = '';
+ try {
+ tooltipStyle = $this.instance.getTooltipStyle();
+ } catch (e) {
+
+ }
+ var tooltip = $this.instance.addToCart(ref, qty);
+ if (tooltip === undefined || tooltip === null || !tooltip || tooltip === true || tooltip === false || tooltip === 'true' || tooltip === 'false') {
+ tooltip = $this.fluidbook.l10n.__("the item has been added to your cart");
+ }
+ $this.fluidbook.tooltip.displayTooltip(tooltip, tooltipStyle);
+ setTimeout(function () {
+ $this.fluidbook.tooltip.hideTooltip();
+ }, 2500);
} catch (e) {
}
- var tooltip = $this.instance.addToCart(ref, qty);
- if (tooltip === undefined || tooltip === null || !tooltip || tooltip === true || tooltip === false || tooltip === 'true' || tooltip === 'false') {
- tooltip = $this.fluidbook.l10n.__("the item has been added to your cart");
- }
- $this.fluidbook.tooltip.displayTooltip(tooltip, tooltipStyle);
- setTimeout(function () {
- $this.fluidbook.tooltip.hideTooltip();
- }, 2500);
- } catch (e) {
-
- }
- return false;
- });
+ return false;
+ });
+ }
$(this.fluidbook).on('fluidbook.links.ready', function () {
$this.updateLinks();