PageSourceSearch

https://www.diariovasco.com/contentfactory/post/wp-content/themes/cms-native/js/contentshare.js?816

js diariovasco.com collected 2026-09-24 08:46:45 UTC 3,256 bytes, 82 lines download raw bytes

1/*
2 * @build  : 24 Aug, 2013
3 * @author : Ram swaroop
4 * @company: Compzets.com
5 */
6(function ($) {
7    $.fn.contentshare = function (options) {
8        // fetch options
9        var opts = $.extend({}, $.fn.contentshare.defaults, options);
10
11        $.extend($.fn.contentshare, {
12
13            init: function (shareable) {
14                $.fn.contentshare.defaults.shareable = shareable;
15            },
16            getContent: function () {
17                var content = "";
18                for (var i = 0; i < opts.shareLinks.length; i++) {
19                    content += '<a href="' + opts.shareLinks[i] + this.getSelection() + '" ' + ((opts.newTab) ? "target=\"_blank\"" : "") + '><img src="' + opts.shareIcons[i] + '" ' + ((i != 0) ? "style=\"margin-left:5px\"" : "") + '/></a>';
20                }
21                return content;
22            },
23            getSelection: function (option) {
24                if (window.getSelection) {
25                    return (option == 'string') ? encodeURIComponent($.trim(window.getSelection().getRangeAt(0).toString())) : window.getSelection().getRangeAt(0);
26                }
27                else if (document.selection) {
28                    return (option == 'string') ? encodeURIComponent($.trim(document.selection.createRange().text)) : document.selection.createRange();
29                }
30            },
31            showTooltip: function () {
32                this.clear();
33                if (this.getSelection('string').length < opts.minLength)
34                    return;
35                this.preloadShareIcons(opts.shareIcons);
36                var range = this.getSelection();
37                var newNode = document.createElement("mark");
38                range.surroundContents(newNode);
39                $('mark').addClass(opts.className);
40                $('.' + opts.className).tooltipster({ trigger: 'custom', interactive: true, content: this.getContent(), animation: opts.animation });
41                $('.' + opts.className).tooltipster('show');
42            },
43            preloadShareIcons: function (array) {
44                for (var i = 0; i < array.length; i++) {
45                    var img = new Image();
46                    img.src = array[i];
47                }
48            },
49            clear: function () {
50                $('.' + opts.className).tooltipster('hide');
51                $('mark').contents().unwrap();
52                $('mark').remove();
53            }
54        });
55
56        // initialize the awesome plugin
57        $.fn.contentshare.init(this);
58    };
59
60    // default options
61    $.fn.contentshare.defaults = {
62        shareable: {},
63        shareIcons: ["/contentfactory/post/wp-content/themes/cms-native/img/fb.svg", "/contentfactory/post/wp-content/themes/cms-native/img/tw.svg"],
64        shareLinks: ["http://www.facebook.com/sharer.php?u=" + document.URL + "&quote=", "http://twitter.com/intent/tweet?text=" + document.URL + ""],
65        minLength: 2,
66        newTab: true,
67        className: "contentshare",
68        animation: "grow"
69    };
70
71}(jQuery));
72
73// calling the plugin on DOM ready
74$(document).ready(function () {
75
76    $("p").contentshare();
77    $.fn.contentshare.defaults.shareable.on('mouseup', function () {
78        $.fn.contentshare.showTooltip();
79    });
80
81
82});

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.