PageSourceSearch

https://www.tsim.in/wp-content/plugins/woocommerce-multiple-free-gift/js/wfg-scripts.js?ver=6.9.4

js tsim.in collected 2026-10-01 16:36:00 UTC 2,628 bytes, 86 lines download raw bytes

1/**
2 * @file wfg-scripts.js
3 *
4 * Frontend core script for woocommerce free gift plugin.
5 *
6 * Copyright (c) 2015, Ankit Pokhrel <[email protected], http://ankitpokhrel.com.np>
7 */
8jQuery(document).ready(function ($) {
9    if ($('.wfg-popup, .wfg-overlay').length) {
10        setTimeout(function () {
11            $('.wfg-popup, .wfg-overlay').fadeIn(1300);
12        }, 700);
13
14        $('.wfg-no-thanks').click(function (e) {
15            e.preventDefault();
16
17            //set cookie if no thanks is clicked
18            if (WFG_SPECIFIC.cookie > 0) {
19              setCookie('_wfg_show', false, WFG_SPECIFIC.cookie);
20            }
21
22            $('.wfg-popup, .wfg-overlay').fadeOut(500, function () {
23                $(this).remove();
24            });
25        });
26
27        $('.wfg-add-gifts').click(function (e) {
28            e.preventDefault();
29            var form = $(this).closest('form');
30            $.ajax({
31                type: 'POST',
32                url: form.attr('action'),
33                data: form.serialize(),
34                success: function (response) {
35                    window.location.reload();
36                }
37            });
38        });
39
40        var wfgCheckboxes = $('.wfg-checkbox');
41        wfgCheckboxes.click(function () {
42            if (WFG_SPECIFIC.gifts_allowed <= 0) {
43                return;
44            }
45
46            if ($('.wfg-checkbox:checked').length >= WFG_SPECIFIC.gifts_allowed) {
47                wfgCheckboxes.not('.wfg-checkbox:checked').attr('disabled', 'disabled').parent().addClass("opaque");
48            } else {
49                wfgCheckboxes.removeAttr('disabled').parent().removeClass("opaque");
50            }
51        })
52    }
53
54    $('.wfg-fixed-notice-remove').click(function () {
55        $(this).closest('.wfg-fixed-notice').fadeOut(1000);
56    });
57});
58
59/* use as handler for resize*/
60jQuery(window).resize(wfgAdjustLayout);
61/* call function in ready handler*/
62jQuery(document).ready(function () {
63    wfgAdjustLayout();
64    /* Resize ma adjust garnay cod sabai yesma haalnay*/
65})
66
67function wfgAdjustLayout() {
68    jQuery('.wfg-popup').css({
69	       'position' : 'absolute',
70	       'left' : '50%',
71	       'top' : '50%',
72	       'margin-left' : -jQuery('.wfg-popup').outerWidth()/2,
73	       'margin-top' : -jQuery('.wfg-popup').outerHeight()/2
74    });
75}
76
77/* Set cookie */
78function setCookie(key, value, days) {
79  if (typeof days === 'undefined') {
80    days = 1;
81  }
82
83  var expires = new Date();
84  expires.setTime(expires.getTime() + (parseInt(days) * 24 * 60 * 60 * 1000));
85  document.cookie = key + '=' + value + ';expires=' + expires.toUTCString() + "; path=/";
86}

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.