PageSourceSearch

https://www.giorgiosancristoforo.net/wp-content/plugins/auto-terms…/js/wpautoterms.js?ver=3.0.5

js giorgiosancristoforo.net collected 2026-10-02 05:52:54 UTC 5,579 bytes, 151 lines download raw bytes

1wpAutoTermsDomReady(function ($) {
2    var COOKIE_EXPIRE_DAYS = 100 * 365;
3
4    function maxZIndex() {
5        return Math.max.apply(null,
6            $.map($('body *'), function (e, n) {
7                if ($(e).css('position') !== 'static')
8                    return parseInt($(e).css('z-index')) || 1;
9            }));
10    }
11
12    function getShadowProperty(e, modifier, prop, def) {
13        var v = window.getComputedStyle($(e)[0], modifier)
14            .getPropertyValue(prop);
15        return typeof v === "undefined" ? def : v;
16    }
17
18    var oldBottomValue = parseInt(getShadowProperty("body", ":after", "bottom", 0));
19    var topContainer = $("#wpautoterms-top-fixed-container");
20    var bottomContainer = $("#wpautoterms-bottom-fixed-container");
21    var z = maxZIndex();
22    topContainer.css('z-index', z - (-1));
23    bottomContainer.css('z-index', z - (-2));
24    var topStaticContainer = $("#wpautoterms-top-static-container");
25    $("body").prepend(topStaticContainer);
26    topStaticContainer.css("margin-top", parseInt(getShadowProperty("body", ":before", "height", 0)) + "px");
27    $("#wpautoterms-bottom-static-container").css("margin-bottom", parseInt(getShadowProperty("body", ":after", "height", 0)) + "px");
28
29    function recalcContainers() {
30        $("#wpautoterms-top-fixed-style,#wpautoterms-bottom-fixed-style").remove();
31        var h = $("head");
32        var topContainer = $("#wpautoterms-top-fixed-container");
33        var bottomContainer = $("#wpautoterms-bottom-fixed-container");
34        if (topContainer.length) {
35            h.append('<style id="wpautoterms-top-fixed-style">body:before{top:' +
36                parseInt(topContainer.height()) + 'px !important;}</style>');
37        }
38        if (bottomContainer.length) {
39            h.append('<style id="wpautoterms-bottom-fixed-style">body:after{bottom:' +
40                (oldBottomValue + parseInt(bottomContainer.height())) + 'px !important;}</style>');
41        }
42    }
43
44    function setCookie(name, value, expire) {
45        var d = new Date();
46        var names = String(name).split(',');
47        var values = String(value).split(',');
48        d.setTime(d.getTime() + (expire * 24 * 60 * 60 * 1000));
49        for (var idx in names) {
50            name = names[idx];
51            value = values[idx];
52            document.cookie = name + "=" + encodeURIComponent(value) + "; expires=" + d.toUTCString() + "; path=/";
53        }
54    }
55
56    function getCookie(name) {
57        name = name.toLowerCase();
58        var cookies = document.cookie.split(';');
59        for (var k in cookies) {
60            var el = cookies[k].split('=');
61            if (el[0].trim().toLowerCase() === name) {
62                return el[1];
63            }
64        }
65        return null;
66    }
67
68    function populateUpdateBox(data) {
69        var TEMPLATE = wp.template("wpautoterms-update-notice");
70        var container = $("#wpautoterms-update-notice-placeholder");
71        container.show();
72        for (var k in data) {
73            $(TEMPLATE(data[k])).appendTo(container);
74        }
75        $(document.body).trigger("post-load");
76    }
77
78    function handleUpdatesBox() {
79        if (typeof wpautoterms_js_update_notice === "undefined") {
80            return;
81        }
82        if (wpautoterms_js_update_notice.disable) {
83            return;
84        }
85        var dc = getCookie(wpautoterms_js_update_notice.cache_detector_cookie);
86        var isCached = dc === null || dc == wpautoterms_js_update_notice.cache_detected;
87        setCookie(wpautoterms_js_update_notice.cache_detector_cookie,
88            wpautoterms_js_update_notice.cache_detected,
89            COOKIE_EXPIRE_DAYS);
90        if (isCached) {
91            $.post(wpautoterms_js_update_notice.ajaxurl, {
92                action: wpautoterms_js_update_notice.action
93            }).done(function (response) {
94                if (typeof response !== "object") {
95                    console.error("[WPAutoTerms][UpdateNotice] Response is not an object", response);
96                } else {
97                    populateUpdateBox(response.data);
98                    bindClose();
99                }
100            }).fail(function (error) {
101                console.error("[WPAutoTerms][UpdateNotice] Query error", error);
102            });
103        } else {
104            var data = wpautoterms_js_update_notice.data;
105            if (data == null || typeof data === "undefined") {
106                return;
107            }
108            populateUpdateBox(data);
109        }
110    }
111
112    recalcContainers();
113    handleUpdatesBox();
114
115    function handleClose() {
116        var t = $(this);
117        setCookie(t.data("cookie"), t.data("value"), COOKIE_EXPIRE_DAYS);
118        var p1 = $(this).parent();
119        var p2 = p1.parent();
120        p1.remove();
121        try {
122            if (p2.html().length < 1) {
123                p2.remove();
124            }
125        } catch(e){
126
127        }
128
129        recalcContainers();
130    }
131
132    function bindClose() {
133        $(".wpautoterms-notice-close").off("click", handleClose).on("click", handleClose);
134    }
135
136    function closeCookieNotice() {
137        if (typeof wpautoterms_js_cookies_notice === "undefined") {
138            return;
139        }
140        if (!wpautoterms_js_cookies_notice.disable && getCookie(wpautoterms_js_cookies_notice.cookie_name) != 1) {
141            var entries = document.querySelectorAll("." + wpautoterms_js_cookies_notice.class);
142            for (var k = 0; k < entries.length; ++k) {
143                var el = entries[k];
144                el.style.display = null;
145            }
146        }
147    }
148
149    bindClose();
150    closeCookieNotice();
151});

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.