PageSourceSearch

https://humansmart.com.mx/articulos/js/social_share_script.js?v=2.1

js humansmart.com.mx collected 2026-10-02 11:47:31 UTC 2,088 bytes, 63 lines download raw bytes

1/**
2 * social_share_script.js - Script para copiar al portapapeles
3 */
4
5(function() {
6    'use strict';
7
8    window.SocialShareOptimizer = {
9        copyToClipboard: function(text) {
10            // Decodificar URL si está codificada
11            var decodedText = decodeURIComponent(text);
12
13            // Usar Clipboard API moderno
14            if (navigator.clipboard && window.isSecureContext) {
15                navigator.clipboard.writeText(decodedText).then(function() {
16                    SocialShareOptimizer.showCopySuccess();
17                }).catch(function() {
18                    SocialShareOptimizer.fallbackCopy(decodedText);
19                });
20            } else {
21                // Fallback para navegadores antiguos
22                SocialShareOptimizer.fallbackCopy(decodedText);
23            }
24        },
25
26        fallbackCopy: function(text) {
27            var textArea = document.createElement('textarea');
28            textArea.value = text;
29            textArea.style.position = 'fixed';
30            textArea.style.left = '-9999px';
31            document.body.appendChild(textArea);
32            textArea.focus();
33            textArea.select();
34
35            try {
36                var successful = document.execCommand('copy');
37                if (successful) {
38                    SocialShareOptimizer.showCopySuccess();
39                }
40            } catch (err) {
41                console.error('Unable to copy', err);
42            }
43
44            document.body.removeChild(textArea);
45        },
46
47        showCopySuccess: function() {
48            // Usar SweetAlert si está disponible
49            if (typeof swal !== 'undefined') {
50                swal({
51                    title: '¡Enlace copiado!',
52                    text: 'El enlace ha sido copiado al portapapeles',
53                    type: 'success',
54                    timer: 2000,
55                    showConfirmButton: false
56                });
57            } else {
58                // Fallback a alert nativo
59                alert('Enlace copiado al portapapeles');
60            }
61        }
62    };
63})();

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.