PageSourceSearch

https://bbooks.co.il/js/flashy.js?v=20260825

js bbooks.co.il collected 2026-10-02 20:12:56 UTC 3,408 bytes, 116 lines download raw bytes

1/*
2    התממשקות עם פלאשי - צד קליינט.
3    הפיקסל הבסיסי מוטמע ב-_Pixels.cshtml (מודל 1), ו-PageView נשלח בכל תבנית בנפרד (מודל 5),
4    למעט דף מוצר ששולח ViewContent במקומו.
5    תיעוד: https://flashy.app/docs/installation-pixels/
6*/
7
8function flashyIsReady() {
9    return typeof (window.flashy) == "function";
10}
11
12/*
13    מזהה המוצר בפלאשי - חייב להיות זהה למזהה שבקטלוג: productId_variationId
14*/
15function flashyContentId(productId, variationId) {
16    return productId + "_" + variationId;
17}
18
19/*
20    ViewContent של הואריאציה הראשונה בעמוד המוצר.
21*/
22function flashyViewContent() {
23    if (!flashyIsReady()) {
24        return;
25    }
26    var button = $(".single-product-add-to-cart[data-product-id][data-variation-id]").first();
27    if ($(button).length == 0) {
28        return;
29    }
30    flashy('ViewContent', {
31        'content_ids': [flashyContentId($(button).attr("data-product-id"), $(button).attr("data-variation-id"))]
32    });
33}
34
35/*
36    UpdateCart עם כל המוצרים וכל המחירים שבסל.
37*/
38function flashyUpdateCart(contentIds, value) {
39    if (!flashyIsReady() || !contentIds) {
40        return;
41    }
42    try {
43        flashy('UpdateCart', {
44            'content_ids': contentIds,
45            'value': value * 1,
46            'currency': 'ILS'
47        });
48    }
49    catch (ex) { }
50}
51
52/*
53    תוכן הסל מוחזר בתשובת ה-AJAX של פעולות הסל (הוספה, שינוי כמות, הסרה),
54    כדי לחסוך קריאת רשת נוספת.
55*/
56function flashyUpdateCartFromResponse(moreData) {
57    if (typeof (moreData) == "undefined" || typeof (moreData.flashyContentIds) == "undefined") {
58        return;
59    }
60    flashyUpdateCart(flashySplitIds(moreData.flashyContentIds), moreData.flashyValue);
61}
62
63/*
64    בדף הסל תוכן הסל נקרא ישירות מהטבלה, ללא קריאה לשרת.
65*/
66function flashyUpdateCartFromDom() {
67    var rows = $(".basket-row[data-prodid][data-variation]");
68    if ($(rows).length == 0) {
69        return;
70    }
71    var contentIds = [];
72    var total = 0;
73    $(rows).each(function () {
74        var id = flashyContentId($(this).attr("data-prodid"), $(this).attr("data-variation"));
75        if (contentIds.indexOf(id) < 0) {
76            contentIds.push(id);
77        }
78        total += parseFloat($(this).attr("data-row-sum")) || 0;
79    });
80    flashyUpdateCart(contentIds, total);
81}
82
83function flashySplitIds(ids) {
84    return (ids || "").split(",").filter(function (id) { return id != ""; });
85}
86
87/*
88    Purchase - נשלח לאחר קבלת מספר ההזמנה מהשרת ולפני התשלום.
89*/
90function flashyPurchase(orderNumber, contentIds, value) {
91    if (!flashyIsReady() || !orderNumber) {
92        return;
93    }
94    try {
95        flashy('Purchase', {
96            'order_id': "" + orderNumber,
97            'content_ids': contentIds,
98            'value': value * 1,
99            'currency': 'ILS'
100        });
101    }
102    catch (ex) { }
103}
104
105/*
106    צביעת הלקוח. נשלח בכל דף ללקוח מחובר, וכן מיד לאחר רישום או התחברות.
107*/
108function flashySetCustomer(email) {
109    if (!flashyIsReady() || !email) {
110        return;
111    }
112    try {
113        flashy('setCustomer', { "email": email });
114    }
115    catch (ex) { }
116}

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.