PageSourceSearch

https://shadai-ss.com/wp/wp-content/themes/shadai/js/prevent-image-save.js

js shadai-ss.com collected 2026-10-02 18:33:42 UTC 1,257 bytes, 38 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2
3    // インスタ画像の画像を保護
4    setTimeout(() => {
5        document.querySelectorAll('img[alt="instagram"]').forEach(protectImage);
6    }, 2000);
7
8    // 最初に img-protect クラスの画像を保護
9    document.querySelectorAll('.img-protect').forEach(protectImage);
10
11    // rel="lightbox" をクリックしたとき → Lightbox対策
12    document.body.addEventListener('click', function (e) {
13        const lightboxLink = e.target.closest('a[rel="lightbox"]');
14        if (lightboxLink) {
15            setTimeout(() => {
16                protectLightboxImages();
17            }, 300);
18        }
19    });
20
21    // Lightbox 用画像保護
22    function protectLightboxImages() {
23        document.querySelectorAll('.lb-image').forEach(protectImage);
24    }
25
26    // 共通:右クリック・ドラッグなどの無効化処理
27    function protectImage(img) {
28        if (img.dataset.protected) return;
29        img.dataset.protected = 'true';
30
31        img.onselectstart = () => false;
32        img.onmousedown = () => false;
33        img.addEventListener('contextmenu', (e) => e.preventDefault());
34        img.addEventListener('dragstart', (e) => e.preventDefault());
35    }
36
37
38});

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.