PageSourceSearch

https://www.akashicbooks.com/wp-content/themes/akashic/js/application.js

js akashicbooks.com collected 2026-10-01 10:14:52 UTC 7,172 bytes, 229 lines download raw bytes

1(function($) {
2
3  'use strict';
4
5  var akashicSliderHome;
6
7  var akashicCart = {
8    init: function() {
9      $('tr.total td.grand-total-amount').prepend('<div id="loader" data-loader></div>');
10
11      $('#shipping_country_code, #shipping_method_id').change(this.showLoader);
12      $('.purAddToCart.ajax-button').on('click', this.increaseCartCount);
13    },
14    increaseCartCount: function() {
15      var currentCount = $('#cart-info a').text().trim() || 0;
16      setTimeout(function() {
17        $('#cart-info a').text(parseInt(currentCount, 10) + 1);
18      }, 2000);
19    },
20    showLoader: function() {
21      $('tr.shipping td.cart66-align-right').html("");
22
23      $('tr.total td.grand-total-amount')
24        .html('<div id="loader" data-loader style="display:block;"></div> Calculating&hellip;');
25
26      $('#PayPalExpressCheckoutButton').css('opacity', '0.25');
27    }
28  };
29
30  var akashicFancybox = {
31    init: function() {
32      // Add Fancybox data group
33      $('dt.gallery-icon a').attr('data-fancybox-group', 'gallery');
34
35      this.addZoom();
36    },
37    addZoom: function() {
38      // Fancybox
39      $('[data-fancybox-group]').fancybox({
40        margin: 50,
41        helpers: {
42          title: { type: 'inside' }
43        }
44      });
45    }
46  };
47
48  var akashicInputs = {
49    init: function() {
50      this.mailingList();
51      this.search();
52    },
53    mailingList: function() {
54      var mailingInput = $('[data-mailing-list-widget]').find('.cform input[type=text]');
55
56      mailingInput.val('E-mail address').addClass('input-inactive');
57
58      mailingInput.on({
59        focus: function() {
60          if (mailingInput.val() === 'E-mail address') {
61            mailingInput.val("");
62          }
63          mailingInput.removeClass('input-inactive');
64        },
65        blur: function() {
66          if (mailingInput.val() === "") {
67            mailingInput.val('E-mail address');
68            mailingInput.addClass('input-inactive');
69          }
70        }
71      });
72
73      $('#cf_field_2-1').trigger('click');
74      $('input[type=radio]').each(function() {
75        $(this).next('label').andSelf().wrapAll('<span />');
76      });
77    },
78    search: function() {
79      // Search
80      var searchInput = $('[data-search-term]');
81
82      searchInput.val('Search term…').addClass('input-inactive');
83
84      searchInput.on({
85        focus: function() {
86          if (searchInput.val() === 'Search term…') {
87            searchInput.val("");
88          }
89          searchInput.removeClass('input-inactive');
90        },
91        blur: function() {
92          if (searchInput.val() === "") {
93            searchInput.val('Search term…');
94            searchInput.addClass('input-inactive');
95          }
96        }
97      });
98
99      $('[data-search-form]').find('input[type=submit]').click(function(e) {
100        e.preventDefault();
101        var input = searchInput.val();
102        if (input !== "" && input !== 'Search term…') {
103          $('[data-search-form]').submit();
104        }
105      });
106    }
107  };
108
109  var akashicMobileNav = {
110    init: function() {
111      $('li.menu-item-has-children').prepend('<a href="#sub-nav" class="dropdown-click" data-dropdown-click>&gt;</a>');
112      $('[data-dropdown-click]').click(this.dropdownMobileNav);
113
114      $('[data-close-mobile-nav]').click(this.closeMobileNav);
115      $('[data-open-mobile-nav]').click(this.openMobileNav);
116
117    },
118    dropdownMobileNav: function(e) {
119      e.preventDefault();
120      $(this).toggleClass('clicked');
121      if ($(this).hasClass('clicked')) {
122        $(this).text('X');
123      } else {
124        $(this).text('>');
125      }
126      $(this).parent().toggleClass('show-dropdown');
127    },
128    closeMobileNav: function(e) {
129      e.preventDefault();
130      $('[data-body]').toggleClass('nav-open');
131      $(this).hide();
132      $('[data-open-mobile-nav]').removeClass('open').text('|||');
133      $('.menu-item-has-children').removeClass('show-dropdown');
134      $('[data-dropdown-click]').removeClass('clicked').text('>');
135
136      setTimeout(function() {
137        $('[data-body]').animate({ scrollTop: 0 }, '300', 'linear');
138      }, 1);
139
140      if (akashicSliderHome) {
141        akashicSliderHome.startAuto();
142      }
143    },
144    openMobileNav: function(e) {
145      e.preventDefault();
146      $('[data-body]').toggleClass('nav-open');
147      $('[data-close-mobile-nav]').show();
148      $(this).addClass('open').text('X');
149
150      if (akashicSliderHome) {
151        akashicSliderHome.stopAuto();
152      }
153    }
154  };
155
156  var akashicReviews = {
157    init: function() {
158      // Count of reviews
159      var reviewsCount = $('[data-reviews-container]').find('p').length;
160      // Collapse only more than one review
161      if (reviewsCount > 1) {
162        this.setupReviews(reviewsCount);
163      }
164
165      $('body').on('click', '[data-read-more-reviews-toggle="closed"]', function() { akashicReviews.expandReviews(reviewsCount) });
166      $('body').on('click', '[data-read-more-reviews-toggle="open"]', function() { akashicReviews.collapseReviews(reviewsCount) });
167    },
168    collapseReviews: function(reviewsCount) {
169      var reviewsContainer = $('[data-reviews-container]'),
170        // Height of first review
171        minHeight = reviewsContainer.find('p:first-child').css('height');
172
173      reviewsContainer.animate({
174        height: minHeight
175      }, 300, function() {
176        $('[data-read-more-reviews]').find('[data-read-more-reviews-toggle]').attr('data-read-more-reviews-toggle', 'closed').html('Read More (' + (reviewsCount - 1) + ')');
177        reviewsContainer.css('height', minHeight).css('overflow', 'hidden');
178      });
179    },
180    expandReviews: function(reviewsCount) {
181      var reviewsContainer = $('[data-reviews-container]'),
182        // Height of reviews container
183        maxHeight = reviewsContainer.css('height');
184
185      reviewsContainer.animate({
186        height: maxHeight
187      }, 300, function() {
188        $('[data-read-more-reviews]').find('[data-read-more-reviews-toggle]').attr('data-read-more-reviews-toggle', 'open').html('Close');
189        reviewsContainer.css('height', "").css('overflow', 'visible');
190      });
191    },
192    setupReviews: function(reviewsCount) {
193      var reviewsContainer = $('[data-reviews-container]'),
194        //  Height of first review
195        minHeight = reviewsContainer.find('p:first-child').css('height');
196
197      $('[data-reviews]')
198        .append('<div id="read-more-reviews" data-read-more-reviews><button data-read-more-reviews-toggle="closed" type="button">Read More (' + (reviewsCount - 1) + ')</button></div>')
199        .css('margin-bottom', '35px');
200
201      reviewsContainer.css('height', minHeight).css('overflow', 'hidden');
202
203      reviewsContainer.animate({
204        height: minHeight
205      }, 300);
206    }
207  };
208
209  var akashicSliders = {
210    init: function() {
211      $('.carousel-item:first-of-type').addClass('active');
212      $('.carousel').each(function() {
213        var items = $(this).find('.carousel-item');
214        if (!items.length) {
215          $(this).hide();
216        }
217      });
218    }
219  };
220
221  $(function() {
222    akashicCart.init();
223    akashicFancybox.init();
224    akashicInputs.init();
225    akashicMobileNav.init();
226    akashicReviews.init();
227    akashicSliders.init();
228  });
229})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.