PageSourceSearch

https://welcometotwinpeaks.com/wp-content/plugins/wpc-coupon-listing/assets/js/frontend.js?ver=1.4.1

js welcometotwinpeaks.com collected 2026-10-02 03:10:23 UTC 2,614 bytes, 91 lines download raw bytes

1'use strict';
2
3(function($) {
4  $(document).on('click touch', '.wpccl-coupon', function() {
5    let $link = $(this), coupon = $link.data('coupon');
6
7    if ($link.hasClass('wpccl-coupon-plain')) {
8      return;
9    }
10
11    if ($link.hasClass('wpccl-coupon-applied')) {
12      return;
13    }
14
15    if ($link.hasClass('wpccl-coupon-disabled')) {
16      return;
17    }
18
19    $link.addClass('wpccl-coupon-loading');
20
21    $.ajax({
22      type: 'POST', url: wpccl_vars.wc_ajax_url.toString().
23          replace('%%endpoint%%', 'wpccl_apply_coupon'), data: {
24        action: 'wpccl_apply_coupon',
25        coupon_code: coupon,
26        nonce: wpccl_vars.nonce,
27      }, dataType: 'json', success: function(response) {
28        if (response) {
29          $link.removeClass('wpccl-coupon-loading');
30          $('#wpccl-popup [data-coupon="' + coupon + '"]').
31              addClass('wpccl-coupon-applied');
32        }
33      }, complete: function() {
34        if ($link.closest('.wpccl-popup').length) {
35          // popup
36          var current = $.featherlight.current();
37          current.close();
38
39          $(document.body).
40              trigger('wc_update_cart').
41              trigger('wc_fragment_refresh');
42
43          if (wpccl_vars.is_checkout) {
44            $(document.body).trigger('update_checkout');
45          }
46        } else {
47          // shortcode
48          location.reload();
49        }
50      },
51    });
52  });
53})(jQuery);
54
55function wpccl_load_coupons() {
56  jQuery('#wpccl-popup .wpccl-coupons').addClass('wpccl-coupons-loading');
57
58  jQuery.ajax({
59    type: 'POST', url: wpccl_vars.wc_ajax_url.toString().
60        replace('%%endpoint%%', 'wpccl_load_coupons'), data: {
61      action: 'wpccl_load_coupons', nonce: wpccl_vars.nonce,
62    }, success: function(response) {
63      jQuery('#wpccl-popup .wpccl-coupons').
64          html(response).
65          removeClass('wpccl-coupons-loading');
66      wpccl_countdown();
67    },
68  });
69}
70
71function wpccl_countdown() {
72  if (wpccl_vars.countdown !== 'yes') {
73    return;
74  }
75
76  jQuery('.wpccl-coupon-expiry').each(function() {
77    let $this = jQuery(this), date = $this.attr('data-date'),
78        date_tz = moment.tz(date, 'YYYY-MM-DD', wpccl_vars.timezone),
79        date_format = '<span>%D %!D:' + wpccl_vars.day + ',' + wpccl_vars.days +
80            ';</span> <span>%H</span>:<span>%M</span>:<span>%S</span>';
81
82    if (date !== '') {
83      $this.countdown(date_tz.toDate(), function(event) {
84        $this.html(
85            wpccl_vars.active_in.replace('%s', event.strftime(date_format)));
86      }).on('finish.countdown', function() {
87        $this.remove();
88      });
89    }
90  });
91}

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.