PageSourceSearch

https://www.cutyhoney.net/js/shop/target_blank_a_click.js

js cutyhoney.net collected 2026-10-07 14:42:25 UTC 3,097 bytes, 73 lines download raw bytes

1import { config } from './pageConfig.js';
2
3const newTabSetting = {urls: [], girls: []};
4if (!window.isLoadLinkSetting) {
5    // 取ってくるまで直近のキャッシュを利用する
6    try {
7        Object.assign(newTabSetting, JSON.parse(localStorage.newTabSetting));
8    // データ無しか破損の場合、潰してOK
9    } catch(ex) { }
10
11    // 現在設定をなるはやで取ってくる
12    fetch(config.api.url.target_blank_all, { method: 'GET'})
13    .then(response => response.json())
14    .then(json => {
15        Object.assign(newTabSetting, json);
16        // 次回からAPI未取得でもすぐに使えるキャッシュを作っておく
17        localStorage.newTabSetting = JSON.stringify(newTabSetting);
18    })
19    .catch(console.error);
20}
21
22window.isLoadLinkSetting = true;
23
24export const aClickTargetBlank = function(){
25    $(document).on('click', 'a', function(e) {
26        var a_tag = $(this);
27
28        // 除外対象
29        var child_check_classes = ['.textbutton','.basicimg','.arrows','.sborder','.vborder'];
30        var parent_check_classes = ['.html','.richtext','.slidebanner','.image-upload','#fb_area','.sa-slider','.image-slider','.bx-controls','.paging'];
31        var return_check = 0;
32        child_check_classes.forEach(function(child_check_class){
33            if(a_tag.find(child_check_class).length){
34                return return_check = 1;
35            }
36        });
37        parent_check_classes.forEach(function(parent_check_class){
38            if(a_tag.closest(parent_check_class).length){
39                return return_check = 1;
40            }
41        });
42        if(return_check == 1){ return; }
43
44        const aTag   = a_tag[0];
45        // hrefの生値と絶対URLを個々に取得
46        const href   = aTag.getAttribute('href');
47        // href がセットされていない場合やページング用の場合、常に対象外なので終わる
48        // 上記除外では直近しか見ないので、抜けるものもあるため
49        if (!href || href.startsWith('?page=')) { return; }
50        const url    = new URL(aTag.href);
51        const path   = url.pathname.replace(/^\//, '');
52
53        if (path == 'girls_detail') {
54            // 女の子詳細の場合のみ特殊処理
55            const params  = url.searchParams;
56            const girlsId = parseInt(params.get('id'));
57            if (
58                // 共通で別タブ開く設定をチェック
59                newTabSetting.urls.includes('girls_detail')
60                // 個別で別タブ開く設定をチェック
61                || newTabSetting.girls.includes(girlsId)
62            ) {
63                e.preventDefault();
64                window.open(href, '_blank');
65            }
66        } else if (newTabSetting.urls.includes(path) || newTabSetting.urls.includes(href)) {
67            // 相対パス(内部用)、または絶対URLが別タブ設定かチェック
68            e.preventDefault();
69            window.open(href, '_blank');
70        }
71        // 別タブで無ければ、スルーすることで、既存タブで開く
72    });
73}

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.