PageSourceSearch

https://support.a8.net/a8/as/faq/wp-content/themes/a8faq_2021/js/copyParam.js

js a8.net collected 2026-09-24 08:25:44 UTC 1,525 bytes, 44 lines download raw bytes

1// ============================
2// パラメータ計測の使い方
3// コピーボタンでパラメータをコピー処理
4// ============================
5document.addEventListener('DOMContentLoaded', function () {
6    let toast = document.createElement('div');
7    toast.className = 'copyToast';
8    document.body.appendChild(toast);
9
10    const buttons = document.querySelectorAll('.copyBtn');
11
12    buttons.forEach(function (btn) {
13        btn.addEventListener('click', function () {
14            // このボタンを囲っている .copyArea 内の .copyTarget を探す
15            const copyArea = btn.closest('.copyArea');
16            const copyTarget = copyArea.querySelector('.copyTarget');
17
18            if (!copyTarget) {
19                showToast('コピー対象が見つかりません。');
20                return;
21            }
22
23            const text = copyTarget.getAttribute('data-copy');
24            if (!text) {
25                showToast('コピーする値が設定されていません。');
26                return;
27            }
28
29            navigator.clipboard.writeText(text).then(() => {
30                showToast('パラメータをコピーしました。');
31            }).catch(() => {
32                showToast('コピーに失敗しました。');
33            });
34        });
35    });
36
37    function showToast(message) {
38        toast.textContent = message;
39        toast.classList.add('show');
40        setTimeout(() => {
41            toast.classList.remove('show');
42        }, 2000);
43    }
44});

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.