PageSourceSearch

https://www.replanter-notre-foret-provencale.com/Ext/Resources?a=b…74LUEPQZtTwomg0BGmq_b1EhFSKVKrMo_akm9W9DeE,

js replanter-notre-foret-provencale.com collected 2026-10-06 13:59:04 UTC 7,077 bytes, 195 lines download raw bytes

1WS.Namespace.Create("WS.Store.Cart", (function () {
2    var _instance = null;
3
4    var _class = function (element) {
5        if (!element || element.length === 0) throw "the element cannot be null.";
6        if (_instance) throw "Cannot create more than one instance (store cart)";
7        _instance = this;
8
9        init.call(this, element);
10    };
11
12    (function (_static) {
13        _static.gotoCheckout = function () {
14            var param = "?visit-checkout=true";
15            var wsbt = "";
16
17            var consentCookieName = "wsDataConsent";
18            var consentCookieValue;
19
20            // find from cookie
21            var cookies = window.document.cookie;
22            if (cookies) {
23                cookies = cookies.getKeyValue(";");
24
25                var cartCookieName = "wbst-cart";
26                if (cookies[cartCookieName]) wsbt = cookies[cartCookieName];
27
28                consentCookieValue = cookies[consentCookieName];
29            }
30
31            // find from query string.
32            if (!wsbt) wsbt = getIdFromQueryString();
33
34            if (wsbt) param += "&wbst-id=" + window.encodeURIComponent(wsbt);
35            if (consentCookieValue) param += "&" + consentCookieName + "=" + window.encodeURIComponent(consentCookieValue);
36
37            var newLocation = WS.MappingUrl.WebStoreCheckout + param
38                + (pageData.xkey ? "&previewid=" + window.encodeURIComponent(pageData.xkey) + (window.WS.IsMobile ? "&ismobile=true" : "") : "");
39
40            location.assign(newLocation);
41        };
42    })(_class);
43
44    var init = function (element) {
45        var _body = $("body");
46        _body.find(".def-cart").remove();
47        _body.append(element);
48
49        this._internal = {};
50        this._internal.element = element;
51
52        this._internal.preventClose = false;
53        this._internal.popupVisible = false;
54
55        this._internal.ui = {};
56        this._internal.ui.iconwrapper = element.find(".def-cart-iconwrapper");
57        this._internal.ui.popup = element.find(".def-cart-popup");
58        this._internal.ui.productsCount = element.find(".def-cart-nbproducts");
59        this._internal.ui.items = element.find(".def-cart-popupitem");
60        this._internal.ui.checkoutwrapper = element.find(".def-cart-checkout");
61        this._internal.ui.checkout = element.find(".def-cart-popup [name=checkout]");
62
63        addEvents.apply(this);
64    };
65
66    var addEvents = function () {
67        var me = this;
68
69        // Hover
70
71        var popupHover = false;
72        var iconHover = false;
73        this._internal.element.hover(function () {
74            iconHover = true;
75            me.togglePopup(true);
76        }, function () {
77            iconHover = false;
78            window.setTimeout(function () {
79
80                if (!popupHover && !iconHover) {
81                    me.togglePopup(false);
82                }
83            }, 500);
84        });
85        this._internal.ui.popup.hover(function () {
86            popupHover = true;
87            me.togglePopup(true);
88        }, function () {
89            popupHover = false;
90            window.setTimeout(function () {
91
92                if (!popupHover && !iconHover) {
93                    me.togglePopup(false);
94                }
95            }, 500);
96        });
97
98        // Remove item
99        var removeItem = this._internal.ui.items.find("[data-name=removeItem]");
100        removeItem.off("click");
101        removeItem.on("click", function () {
102            var _element = $(this).closest(".def-cart-popupitem");
103            var _id = parseFloat(_element.attr("data-id"));
104            me._internal.preventClose = true;
105            AjaxManager.Post("/Ext/Store/RemoveCartItem", { Id: _id }, function (data, elements) {
106                _element.remove();
107                me._internal.ui.productsCount.text(data.ProductsCount);
108                if (me._internal.element.find(".def-cart-popupitem:not(.empty)").length == 0) {
109                    me._internal.ui.checkoutwrapper.remove();
110                }
111
112                me._internal.preventClose = false;
113                window.setTimeout(function () { me.togglePopup(false); }, 3000);
114            });
115        });
116
117        this._internal.ui.checkout.off("click");
118        this._internal.ui.checkout.on("click", function () { WS.Store.Cart.gotoCheckout(); });
119        this._internal.ui.iconwrapper.off('click');
120        this._internal.ui.iconwrapper.on("click", function () { WS.Store.Cart.gotoCheckout(); });
121    };
122
123    var getIdFromQueryString = function () {
124        var wbstid = null;
125        var queryString = GetQueryString(location);
126        var name = "wbst-id";
127        if (queryString[name] && queryString[name].length > 0) wbstid = window.decodeURIComponent(queryString[name]);
128
129        return wbstid;
130    };
131
132    (function (method) {
133        method.bind = function (showPopup) {
134            if (showPopup == undefined) showPopup = true;
135            this._internal.preventClose = true;
136
137            var me = this;
138            var HasCartContent = $(".Block.Type_WebStoreCart").length > 0;
139            var HasCartInHeaderMobile = $("#HeaderContentZone .Block.Type_WebStoreCart").length > 0 && window.WS.IsMobile;
140            var wbstid = getIdFromQueryString();
141
142            AjaxManager.Get("/Ext/Store/LoadCart", {
143                Lang: pageData.lang,
144                HasCartContent: HasCartContent,
145                Flagged: pageData.flagged === true,
146                IsMobile: window.WS.IsMobile,
147                "wbst-id": wbstid,
148                HasCartInHeaderMobile: HasCartInHeaderMobile
149            }, function (data, elements) {
150                if (elements[0].length > 0) {
151                    init.call(me, elements[0]);
152                    me._internal.preventClose = false;
153                    if (!me._internal.popupVisible && showPopup) me.showPopup();
154                    window.setTimeout(function () { me.togglePopup(false); }, 3000);
155                }
156            });
157        };
158
159        method.show = function () {
160            this._internal.element.show();
161            this.hidePopup();
162        };
163
164        method.hide = function () {
165            this._internal.element.hide();
166            this._internal.popupVisible = false;
167        };
168
169        method.showPopup = function () {
170            this._internal.ui.popup.show();
171            this._internal.popupVisible = true;
172        };
173
174        method.hidePopup = function () {
175            if (!this._internal.preventClose) {
176                this._internal.ui.popup.css("display", "");
177                this._internal.popupVisible = false;
178            }
179        };
180
181        method.togglePopup = function (value) {
182            if (value) {
183                this.showPopup();
184            }
185            else this.hidePopup();
186        };
187
188        method.Delete = function () {
189            this._internal.element.remove();
190        };
191
192    })(_class.prototype);
193
194    return _class;
195})());

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.