PageSourceSearch

https://www.ilmattino.it/js/desktop/articolo.js?m209782

js ilmattino.it collected 2026-09-24 08:37:29 UTC 12,797 bytes, 360 lines download raw bytes

1$(function() {
2
3    $('.share-item .msg-art-fb').each(function() {
4        $(this).bind("click", function() {
5            url = $("meta[property='og:url']").attr("content");
6            t = $("meta[property='og:title']").attr("content");
7            console.log(url);
8            window.open('https://www.facebook.com/sharer.php?u=' + encodeURIComponent(url) + '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436');
9            return false;
10        })
11    });
12
13
14    $('.share-item .msg-art-tw').each(function() {
15        $(this).bind("click", function() {
16            u = $("meta[property='og:url']").attr("content");
17            t = $("meta[property='og:title']").attr("content");
18            sU = $("meta[name='shortenUrl']").attr("content");
19            var maxLength = 140;
20            if (t.length > maxLength) {
21                t = t.substr(0, (140 - 3)) + '...';
22            }
23            window.open('https://twitter.com/intent/tweet?text=' + encodeURIComponent(t + ' ' + u + " @mattinodinapoli"), 'sharer',"toolbar=0,status=0,width=626,height=436");
24        })
25    });
26
27
28    $('.share-item .msg-art-gp').each(function() {
29        $(this).bind("click", function() {
30            u = $("meta[property='og:url']").attr("content");
31            window.open('https://plus.google.com/share?url=' + encodeURIComponent(u),'sharer',"toolbar=0,status=0,width=626,height=436");
32        })
33    });
34
35    $('.share-item .msg-art-com').each(function() {
36        $(this).bind("click", function() {
37            var commenti = $('#commenti_articolo');
38            if (commenti.length) {
39                $("html, body").delay(2000).animate({scrollTop:commenti.offset().top},'slow' );
40            }
41        })
42    });
43
44    $('.share-item .msg-art-em').each(function() {
45        $(this).bind("click", function() {
46            var email = '';
47            var subject = $("meta[property='og:title']").attr("content");
48            var emailBody = $("meta[property='og:url']").attr("content");
49            window.location = 'mailto:' + email + '?subject=' + subject + '&body=' +   emailBody;
50        });
51    });
52
53});
54
55
56$(function() {
57
58
59    window.Clipboard = (function(window, document, navigator) {
60        var textArea,
61            copy;
62    
63        function isOS() {
64            return navigator.userAgent.match(/ipad|iphone/i);
65        }
66    
67        function createTextArea(text) {
68            textArea = document.createElement('textArea');
69            textArea.value = text;
70            document.body.appendChild(textArea);
71        }
72    
73        function selectText() {
74            var range,
75                selection;
76    
77            if (isOS()) {
78                range = document.createRange();
79                range.selectNodeContents(textArea);
80                selection = window.getSelection();
81                selection.removeAllRanges();
82                selection.addRange(range);
83                textArea.setSelectionRange(0, 999999);
84            } else {
85                textArea.select();
86            }
87        }
88    
89        function copyToClipboard() {        
90            document.execCommand('copy');
91            document.body.removeChild(textArea);
92        }
93    
94        copy = function(text) {
95            createTextArea(text);
96            selectText();
97            copyToClipboard();
98        };
99    
100        return {
101            copy: copy
102        };
103    })(window, document, navigator);
104
105
106    $('.share_bar_btn').each(function() {
107
108        var activeShare = 'active-share';
109
110        var shareBox = $('.share-box');
111
112        $(this).bind("click", function() {
113            $(this).parent().children(shareBox).toggleClass(activeShare);
114        })
115    });
116
117
118    $('.shareFacebook').each(function() {
119        $(this).bind("click", function() {
120            url = $("meta[property='og:url']").attr("content");
121            t = $("meta[property='og:title']").attr("content");
122            //console.log(url);
123            window.open('https://www.facebook.com/sharer.php?u=' + encodeURIComponent(url) + '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436');
124            return false;
125        })
126    });
127
128
129    $('.shareWa').each(function() {
130        $(this).bind("click", function() {
131            url = $("meta[property='og:url']").attr("content");
132            title = $("meta[property='og:title']").attr("content");
133            window.open('https://api.whatsapp.com/send?text=Ciao! Ti consiglio di vedere questo : ' + encodeURIComponent(title) +' '+ encodeURIComponent(url));
134            return false;
135        })
136
137    });
138
139    $('.shareTwitter').each(function() {
140        $(this).bind("click", function() {
141            u = $("meta[property='og:url']").attr("content");
142            t = $("meta[property='og:title']").attr("content");
143            sU = $("meta[name='shortenUrl']").attr("content");
144            twS = $("meta[name='twitter:site']").attr("content");
145            var maxLength = 140;
146            if (t.length > maxLength) {
147                t = t.substr(0, (140 - 3)) + '...';
148            }
149            window.open('https://twitter.com/intent/tweet?text=' + encodeURIComponent(t + ' ' + u + ' ' + twS), 'sharer',"toolbar=0,status=0,width=626,height=436");
150        })
151    });
152
153
154    $('.copyUrlId').each(function () {
155
156        $(this).bind("click", function () {
157            
158            var url = $("meta[property='og:url']").attr("content");
159            var testo =  $('.copyUrltext');
160            
161            Clipboard.copy(url);
162        
163            $(this).find(testo).text('Link Copiato !') ;
164            $(this).addClass('active');
165
166            setTimeout(function () { 
167                testo.text('Copia Link') ;
168                $('.copyUrlId').removeClass('active');
169
170            }, 4000);
171
172        })
173    });
174
175
176  /*   $('.share-item .msg-art-com').each(function() {
177        $(this).bind("click", function() {
178            var commenti = $('#commenti_articolo');
179            if (commenti.length) {
180                $("html, body").delay(2000).animate({scrollTop:commenti.offset().top},'slow' );
181            }
182        })
183    }); */
184
185    $('.shareEm').each(function() {
186        $(this).bind("click", function() {
187            var email = '';
188            var subject = $("meta[property='og:title']").attr("content");
189            var emailBody = $("meta[property='og:url']").attr("content");
190            window.location = 'mailto:' + email + '?subject=' + subject + '&body=' +   emailBody;
191        });
192    });    
193    
194
195});
196_waitOnceFor('jqueryloaded', function(){
197    if ($('#share_bar').length){
198        loadScript(impostazioni_testata.assets_domain + '/js/sidebarSticky.js', function(){
199            _trigger('sidebarSticky.loaded');
200            _waitOnceFor('sidebarSticky.loaded', function(){
201                $('body.articolo #share_bar').sidebarSticky();
202            });
203        });
204    };
205});
206
207
208/*** Video ***/
209
210var resize_video = function() {
211
212    // ridimensiono l'iframe in proporzione, ma devo anche richiamarlo con le nuove dimensioni altrimenti viene tagliato.
213    // width=640&height=405
214    // la dim massima deve essere pari a P.width();
215
216    var P = $('.contenuto');
217    var I = $(".contenuto iframe[src^='http://vid']");
218
219    if (!(P.length > 0 && I.length > 0))
220        return;
221    var rapporto = 1.45;
222
223    var new_w = parseInt(P.width(), 10);
224    var new_h = parseInt(P.width() / rapporto, 10);
225
226    //console.log('W:'+new_w+' H:'+new_h+' RATIO:'+rapporto);
227    var new_src = I.attr('src').replace(/width=(.+)&height=(.+)&/, 'width=' + new_w + '&height=' + new_h + '&');
228    // var new_src = I.attr('src').replace(/width=(.+)&height=(.+)&aplay(.+)/, 'width=' + new_w + '&height=' + new_h + '&aplay=false');
229
230
231    if (I.attr('src') == new_src)
232        return; // non � cambiato nulla, evito
233    I.width(new_w).height(new_h).attr('src', new_src);
234};
235
236
237
238
239$(document).ready(function() {
240    resize_video();
241    var embed_video = $("#multimedias .embed_video");
242
243    var video_top_url = $("#multimedias .embed_video iframe[data-src^='http://vid']").attr("data-src");
244
245    if (typeof video_top_url == 'undefined') return; //
246
247    // firefox ha un problema con il player html5 (viene muto).
248    /*if ($.browser.mozilla) {
249     var video_src = $('.video_player iframe').attr('src');
250     $('.video_player iframe').attr('src', video_src.replace(/forceHtml5=true/, ''));
251     }*/
252
253    $.ajax({
254        url: 'https://widgets.outbrain.com/outbrain.js',
255        dataType: "script",
256        success: function() {
257
258        }
259    });
260
261});
262
263
264$(document).ready(function(){
265    // carico il floater solo se c'è un embed video
266    if ($('.embed_video').length) {
267        // video floater
268        $.ajax({
269            url: impostazioni_testata.assets_domain + '/js/videoFloater.js',
270            dataType: "script",
271            cache: true,
272            success: function () {
273
274            }
275        });
276    }
277
278    /*** SLIDER correlati in articolo***/
279    if ($(".slider-items-correlati").length > 0) {
280        try {
281            var slideShow =  $(".slider-items-correlati").data("slidestoshow");
282            $('.slider-items-correlati').slick({
283                infinite: true,
284                slidesToShow: slideShow,
285                slidesToScroll: slideShow
286            });
287        }
288        catch(err) {}
289    }
290});
291
292
293/* --- video embeddato tracking Analytics --- */
294(function($){var g,d,j=1,a,b=this,f=!1,h="postMessage",e="addEventListener",c,i=b[h]&&!($.browser&&$.browser.opera);$[h]=function(k,l,m){if(!l){return}k=typeof k==="string"?k:$.param(k);m=m||parent;if(i){m[h](k,l.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))}else{if(l){m.location=l.replace(/#.*$/,"")+"#"+(+new Date)+(j++)+"&"+k}}};$.receiveMessage=c=function(l,m,k){if(i){if(l){a&&c();a=function(n){if((typeof m==="string"&&n.origin!==m)||($.isFunction(m)&&m(n.origin)===f)){return f}l(n)}}if(b[e]){b[l?e:"removeEventListener"]("message",a,f)}else{b[l?"attachEvent":"detachEvent"]("onmessage",a)}}else{g&&clearInterval(g);g=null;if(l){k=typeof m==="number"?m:typeof k==="number"?k:100;g=setInterval(function(){var o=document.location.hash,n=/^#?\d+&/;if(o!==d&&n.test(o)){d=o;l({data:o.replace(n,"")})}},k)}}}})(jQuery);
295
296$(function(){
297    try {
298        /*
299		console.log("########### MSGR video embed ###########");
300        ogurl = $("meta[property='og:url']").attr("content");
301        try {		
302            dataLayer.push({
303                'event': 'video preroll',
304                'eventCategory': 'Video',
305                'eventAction': 'embed caricato',
306                'eventLabel': ogurl
307            });			
308        } catch (e) {}  
309		*/
310        $.receiveMessage(function(e){
311            // console.log(e.data);
312            switch (e.data) {
313                case 'PRE_START':
314                case 'PRE_END':
315                    try {
316                        dataLayer.push({
317                            'event': 'video preroll',
318                            'eventCategory': 'Video',
319                            'eventAction': 'Preroll',
320                            'eventLabel': e.data
321                        });
322                    } catch (e) {}
323                    break;
324            }
325        }, $('.embed_video iframe').attr('src').match(/https?:\/\/[^\/]+/) );
326    }
327    catch (e) {}
328});
329
330//Disabilita tasto destro sulle immagini
331document.addEventListener("contextmenu", function (e) {
332    if (e.target.nodeName === "IMG") {
333        e.preventDefault();
334        CED.log("Per motivi legali, è disabilitato il tasto destro sulle immagini");
335    }
336}, false);
337
338
339
340_waitOnceFor('jqueryloaded', function(){
341    $(document).ready(function(){
342        if (document.body.classList.contains("articolo") || document.body.classList.contains("foto")  ) {
343            var lazyEmbeds = document.querySelectorAll('.wnv-lazy');
344            // CED.log("WNV elements",lazyEmbeds);
345            if (lazyEmbeds) {
346                for (var i=0; i<lazyEmbeds.length; i++) {
347                    (function(k){
348                        // CED.log(lazyEmbeds[k]);
349                        CedsWNV.watch(lazyEmbeds[k], function () {
350                            // CED.log(lazyEmbeds, k);
351                            lazyEmbeds[k].src = lazyEmbeds[k].getAttribute('data-src');
352                            lazyEmbeds[k].removeAttribute('data-src');
353                            CED.log("WNV Lazy", lazyEmbeds[k].src);
354                        });
355                    })(i)
356                }
357            }
358        }
359    });
360});

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.