PageSourceSearch

https://www.berrys-cafe.jp/assets/1.0.971/js/buyBtnDel.js

js berrys-cafe.jp collected 2026-10-02 14:40:28 UTC 2,393 bytes, 77 lines download raw bytes

1/**
2 * 外部電子書店の購入/レンタル/定期購読リンクをアプリ内で非表示にする
3 * (Google Play / App Store 決済ポリシー対応)
4 * NOTE: 記事・コンテスト等、head/body末尾どちらからも読み込まれるため、
5 *       scriptタグの挿入位置に依存しないようにしている
6 */
7(function () {
8    'use strict';
9
10    // 電子書籍・電子コンテンツの購入/レンタル/定期購読を扱う外部ストアのドメイン
11    const STORE_DOMAINS = [
12        'amazon.co.jp',
13        'amzn.asia',
14        'amzn.to',
15        'audible.co.jp',
16        'booklive.jp',
17        'bookwalker.jp',
18        'cmoa.jp',
19        'comic-walker.com',
20        'comico.jp',
21        'comicomi-studio.com',
22        'comicride.jp',
23        'comirela.com',
24        'cuugal.jp',
25        'dbook.docomo.ne.jp',
26        'digitalmargaret.jp',
27        'dokusho-ojikan.jp',
28        'ebookjapan.yahoo.co.jp',
29        'ebookstore.sony.jp',
30        'eeo.today',
31        'honto.jp',
32        'jumptoon.com',
33        'manga-zegra.com',
34        'manga.line.me',
35        'mecha.cc',
36        'mechacomic.jp',
37        'mibon.jp',
38        'papy.co.jp',
39        'piccoma.com',
40        'r10.to',
41        'rakuten.co.jp',
42        'rakuten.ne.jp',
43        'shop.tsutaya.co.jp',
44        'sonymusicshop.jp',
45        'to-corona-ex.com',
46        'tsugimanga.jp',
47        'web-ace.jp'
48    ];
49
50    function hideExternalStoreLinks() {
51        // WebViewは必ずUAにWebViewRequestが付与される
52        if (navigator.userAgent.indexOf('WebViewRequest') === -1) {
53            return;
54        }
55
56        // 本スクリプト読込ページに存在する外部ストアの購入リンクを非表示にする
57        const links = document.getElementsByTagName('a');
58        for (let i = 0; i < links.length; i++) {
59            const href = links[i].getAttribute('href');
60            if (!href) {
61                continue;
62            }
63            for (let j = 0; j < STORE_DOMAINS.length; j++) {
64                if (href.indexOf(STORE_DOMAINS[j]) !== -1) {
65                    links[i].style.display = 'none';
66                    break;
67                }
68            }
69        }
70    }
71
72    if (document.readyState === 'loading') {
73        document.addEventListener('DOMContentLoaded', hideExternalStoreLinks);
74    } else {
75        hideExternalStoreLinks();
76    }
77})();

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.