PageSourceSearch

https://www.caritascatalunya.cat/main-files/themes/101wp-child/modules/social/social-build.js?ver=1.0.0

js caritascatalunya.cat collected 2026-09-26 11:31:07 UTC 3,038 bytes, 92 lines download raw bytes

1var Social = function(){
2
3    'use strict';
4
5    var $ = jQuery,
6        instances = [];
7
8    function onReady() {
9        $('.module.social').each(function () {
10            instances.push(new Social($(this)));
11        });
12    }
13
14    function Social(view) {
15
16        var $view = view,
17        url = $view.find('.tpl-social').data('url'),
18        title = $view.find('.tpl-social').data('title');
19
20        function init() {
21            bind()
22            return this;
23        }
24
25        function onClick(e) {
26            e.preventDefault();
27
28            if($(this).hasClass('fb')) {
29                var socialWeb = 'fb';
30            } else if($(this).hasClass('tw')) {
31                var socialWeb = 'tw'; 
32            } else if($(this).hasClass('gp')) {
33                var socialWeb = 'gp';
34            } else if($(this).hasClass('whatsapp')) {
35                var socialWeb = 'whatsapp';
36            } else {
37                var socialWeb = 'mail';
38            }
39
40            var winFeatures = "menubar=no,location=no,resizable=yes,scrollbars=no,status=no,width=650,height=450";
41            var formatedURL = '';
42
43            if (socialWeb === 'fb') {
44                formatedURL = 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(url);
45                var win = window.open(formatedURL, 'social' + socialWeb, winFeatures);
46            }
47            else if (socialWeb === 'tw') {
48                formatedURL = 'https://twitter.com/intent/tweet?&text=' + encodeURIComponent(title) + '&url=' + encodeURIComponent(url);
49                var win = window.open(formatedURL, 'social' + socialWeb, winFeatures);
50            }
51            else if (socialWeb === 'mail') {
52                location.href = 'mailto:?subject=' + title + ' &body=Mira este contenido que he encontrado en Cáritas:  ' + url;
53                return false;
54            }
55            else if (socialWeb === 'gp') {
56                formatedURL = 'https://plus.google.com/share?url=' + encodeURIComponent(url);
57                var win = window.open(formatedURL, 'social' + socialWeb, winFeatures);
58            }
59            else if (socialWeb === 'whatsapp') {
60                location.href = 'whatsapp://send?text=Te comparto este contenido de Cáritas: ' + url;
61                return false;
62            }
63        }
64
65        function bind() {
66            $view.find('a').on('click', onClick);
67            var top = $view.offset().top;
68            
69            if ($('body').hasClass('t-desktop')) {
70                $(window).scroll(function () {
71                    if ($(window).scrollTop() + ($('#menu').height() + 10) >= top) {
72                        $view.addClass('sticky');
73                    }
74                    else if ($(window).scrollTop() < top) {
75                        $view.removeClass('sticky');
76                    }
77                });
78            }
79        }
80
81        this.url = url;
82        this.title = title;
83        this.init = init;
84        return this.init();
85    }
86
87    // DOMContentLoaded
88    $(onReady);
89
90}
91
92Social();

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.