PageSourceSearch

https://www.batiment-entretien.fr/d961092f.js?rev=86

js batiment-entretien.fr collected 2026-10-08 22:50:59 UTC 6,102 bytes, 193 lines download raw bytes

1
2(function () {
3
4    this.AdSlide = new Class({
5        Implements: [Events],
6
7        initialize : function (position, pubs) {
8            var container = document.id("p"+position);
9            if (container) {
10                this.id = "p"+position;
11                this.container = container;
12                this.pubs = pubs;
13                this.current = 0;
14                this.ad_displayed = null;
15                this.oldElement = null;
16                this.currentElement = null;
17
18                this.container.setStyle("position", "relative");
19                this.preload();
20            }
21        },
22
23        preload : function () {
24            var imgs = [];
25            var type;
26            for (var i = 0; i < this.pubs.length; i++) {
27                if (this.pubs[i].resource) {
28                    type = this.pubs[i].resource.match(/([^.]+)$/);
29                    if (type.length > 1 && ["png", "jpg", "jpeg", "gif", "webp"].contains(type[1])) {
30                        imgs.push("/media/pubs/"+this.pubs[i].resource);
31                    }
32                }
33            }
34            if (imgs.length > 0) {
35                var myImages = Asset.images(imgs, {
36                    onComplete: function () {
37                        this.start();
38                    }.bind(this)
39                });
40            } else {
41                this.start();
42            }
43        },
44
45        start : function () {
46            this.gotoNext();
47        },
48
49        gotoNext : function (count) {
50            if (this.ad_displayed) {
51                this.ad_displayed = null;
52            }
53
54            var next_ad = this.pubs[this.current];
55
56            this.current++;
57
58            if (this.current >= this.pubs.length) {
59                this.current = 0;
60            }
61
62            this.ad_displayed = next_ad;
63
64            this.render(next_ad);
65
66            var display_duration = next_ad.display_duration;
67
68            if (this.pubs.length > 1) {
69                this.gotoNext.delay(display_duration, this);
70            }
71        },
72
73        render : function (pub) {
74            var animate = false;
75            if (this.currentElement) {
76                this.oldElement = this.currentElement;
77                this.oldElement.set("id", this.id+ "-old")
78                    .setStyle("z-index", 1);
79                animate = true;
80            }
81            this.currentElement = new Element("div", {id: this.id+ "-current"});
82            this.currentElement.setStyles({position: "absolute", top: 0, left: 0,
83                "z-index": 2, opacity: 0});
84            this.currentElement.inject(this.container, "bottom");
85            if (pub.code) {
86                this.currentElement.set("html", pub.code);
87            } else if (pub.resource) {
88                var type = pub.resource.match(/([^.]+)$/);
89                type = type[1];
90                if (["png", "jpg", "jpeg", "gif", "webp"].contains(type)) {
91                    var element = new Element("img", {src: "/media/pubs/"+pub.resource});
92                    if (pub.width) {
93                        element.setStyle("max-width", pub.width);
94                        this.currentElement.setStyle("width", pub.width);
95                    }
96                    if (pub.height) {
97                        element.setStyle("max-height", pub.height);
98                        this.currentElement.setStyle("height", pub.height);
99                    }
100                    if (pub.link) {
101                        element = new Element("a", {href: pub.link, target: "_blank"})
102                            .adopt(element);
103                    }
104                    this.currentElement.adopt(element);
105                }
106            } else {
107                return;
108            }
109            if (this.oldElement) {
110                this.oldElement.set("tween", {duration: 1000, onComplete : function () {
111                    if (this.oldElement) {
112                        this.oldElement.destroy();
113                        this.oldElement = null;
114                    }
115                }.bind(this)}).tween("opacity", 0);
116            }
117            if (animate) {
118                this.currentElement.set("tween", {duration: 1000}).tween("opacity", 1);
119            } else {
120                this.currentElement.setStyle("opacity", 1);
121            }
122
123            (function () {
124                var sizes = this.currentElement.getComputedSize({
125                    styles: ["border", "margin", "padding"]
126                });
127                if (animate) {
128                    this.container.morph({
129                        width: sizes["totalWidth"],
130                        height: sizes["totalHeight"]
131                    });
132                } else {
133                    this.container.setStyles({
134                        width: sizes["totalWidth"],
135                        height: sizes["totalHeight"]
136                    });
137                }
138            }.bind(this)).delay(100);
139
140            this.fireEvent("ad_displayed", [this, pub.id]);
141        }
142    });
143
144})();
145
146window.addEvent("domready", function () {
147    if ("undefined" == window.p_u_b_s) {
148        return;
149    }
150
151    var positions = JSON.decode(window.p_u_b_s);
152
153    var pingUrl = window.advPingUrl ? window.advPingUrl : "/pingpub";
154
155    var request_ping = new Request({
156        url : pingUrl,
157        method: "post"
158    });
159
160    var pinged = [];
161    var timer_send = null;
162    var ping_ids = [];
163
164    var sp;
165    for (position in positions) {
166        sp = new AdSlide(position, positions[position]);
167
168        sp.addEvent("ad_displayed", function (slide, id) {
169            if (pinged.contains(id)) {
170                return;
171            }
172
173            if (ping_ids.contains(id)) {
174                return;
175            }
176
177            ping_ids.push(id);
178            pinged.push(id);
179
180            clearTimeout(timer_send);
181            timer_send = (function () {
182                request_ping.send({
183                    data: {
184                        "ids": ping_ids
185                    }
186                });
187
188                ping_ids = [];
189
190            }).delay(100);
191        });
192    }
193});

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.