PageSourceSearch

https://shop.mundfein.de/theme/js/Widgets/voucher-widget.js?v=84c8c8c96969e44393eea0c972613d1c69fc8c21.1421

js mundfein.de collected 2026-10-07 11:13:29 UTC 2,860 bytes, 117 lines download raw bytes

1var $voucher;
2var $voucherInput;
3var $voucherCash;
4var $voucherCashButton;
5
6window.voucherWidgetExist = true;
7
8$(function () {
9
10  $voucher = $("#voucher-widget");
11  $voucherInput = $voucher.find("input");
12  $voucherCash = $voucher.find(".voucher-cash");
13  $voucherCashButton = $voucher.find(".btn");
14
15
16  $voucherInput.on("keyup", function () {
17
18    var self = $(this);
19
20    if (self.val() != "") {
21
22      $voucherCash.slideDown("fast");
23
24    } else {
25
26      $voucherCash.slideUp("fast");
27
28    }
29
30  });
31
32
33  $voucherCashButton.on("click", function () {
34    checkVoucher($voucherInput.val());
35  });
36
37  if (window.silentVoucherCode && !window.silentVoucherCodeHandled) {
38    window.silentVoucherCodeHandled = true;
39    checkVoucher(window.silentVoucherCode, window.silentVoucherCodeReferer, true);
40  } else {
41    // Beim Starten Gutschein-Artikel überprüfen
42    if (window.basketVoucherList && window.basketVoucherList.length) {
43      checkVoucherArticle(window.basketVoucherList);
44    }
45  }
46
47  // mehrfaches Einlösen von Gutscheincodes
48  var $shoppingCartWidget = $("#shopping-cart-widget");
49  if ($shoppingCartWidget.length > 0) {
50    $shoppingCartWidget.on('click', '.btn-cash-voucher', function () {
51      var self = $(this);
52      if (self.data('voucher-code')) {
53        checkVoucher(self.data('voucher-code'));
54      }
55    });
56  }
57
58});
59
60
61function checkVoucher(voucher_code, silentVoucherCodeReferer, silent) {
62
63  $.ajax({
64    type: "POST",
65    async: false,
66    dataType: "json",
67    url: "/storedata/checkVoucher",
68    data: {
69      voucher_code: voucher_code,
70      silentVoucherCodeReferer: silentVoucherCodeReferer,
71    },
72    success: function (response) {
73
74      if (response.basketList) {
75        window.basketList = response.basketList;
76      }
77      if (response.basketVouchers) {
78        window.basketVoucherList = response.basketVouchers;
79      }
80
81      var voucherCheck = false;
82
83      if (response.success) {
84        var voucherModalOpen = checkVoucherArticle(response.basketVouchers);
85        if (!voucherModalOpen) {
86          $('[data-rel="voucher-success-modal"]').modal();
87          voucherCheck = true;
88        }
89      } else {
90        var $modal = $('[data-rel="voucher-error-modal"]');
91        var error_text = '';
92        if (response.error && response.error.length > 0) {
93          error_text = response.error.join('<br />');
94        }
95        $modal.find('[data-rel="info"]').html(error_text);
96        $modal.find('[data-rel="info-desc"]').hide();
97        if (error_text === '') {
98          $modal.find('[data-rel="info-desc"]').show();
99        }
100        $modal.modal();
101      }
102
103      if (!silent) {
104        setTimeout(function () {
105          updateShoppingCartWidget(response, voucherCheck);
106        }, 500);
107      }
108
109      $voucherInput.val("");
110
111    },
112    error: function () {
113      console.log("ajax error");
114    }
115  });
116
117}

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.