PageSourceSearch

https://madamefigaro.jp/wp-content/themes/madamefigaro-jp/assets/js/sns-copy-link.js?ver=1.0.153

js madamefigaro.jp collected 2026-09-24 19:19:13 UTC 1,228 bytes, 37 lines download raw bytes

1/**
2 * SNSシェア: URLコピー機能
3 *
4 * イベント委譲で動的追加要素(.js-copy-link)にも対応
5 *
6 * @package madameFIGARO.jp
7 */
8document.addEventListener('click', function (e) {
9    var link = e.target.closest('.js-copy-link');
10    if (!link) return;
11    e.preventDefault();
12
13    var url = link.getAttribute('data-copy-url');
14
15    if (navigator.clipboard && navigator.clipboard.writeText) {
16        navigator.clipboard.writeText(url).then(function () {
17            alert('URLをコピーしました');
18        }).catch(function (err) {
19            console.error('コピーに失敗しました:', err);
20        });
21    } else {
22        // Clipboard API 非対応ブラウザ用フォールバック
23        var textarea = document.createElement('textarea');
24        textarea.value = url;
25        textarea.style.position = 'fixed';
26        textarea.style.opacity = '0';
27        document.body.appendChild(textarea);
28        textarea.select();
29        try {
30            document.execCommand('copy');
31            alert('URLをコピーしました');
32        } catch (err) {
33            console.error('コピーに失敗しました:', err);
34        }
35        document.body.removeChild(textarea);
36    }
37});

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.