site:検索 h

Execute UserScript

当前为 2025-04-10 提交的版本,查看 最新版本

// ==UserScript==
// @name        site:検索 h
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Execute UserScript
// @author       Your Name
// @match      https://*
// @grant       none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    
    document.addEventListener('keydown', (e) => {
        
                if (e.key === 'h') {
                    javascript:(function() {
    // 選択中のテキストを取得
    const selectedText = window.getSelection().toString();
    
    // ポップアップウィンドウ作成
    const popup = document.createElement('div');
    popup.style.position = 'fixed';
    popup.style.top = '50%';
    popup.style.left = '50%';
    popup.style.transform = 'translate(-50%, -50%)';
    popup.style.width = '250px';
    popup.style.padding = '20px';
    popup.style.background = '#f4f4f4';
    popup.style.color = '#333';
    popup.style.border = '2px solid #888';
    popup.style.borderRadius = '10px';
    popup.style.boxShadow = '0 0 10px rgba(0,0,0,0.2)';
    popup.style.fontFamily = 'Arial, sans-serif';
    popup.style.zIndex = '10000';
    
    // 閉じるボタン作成
    const closeButton = document.createElement('span');
    closeButton.textContent = '☒';
    closeButton.style.position = 'absolute';
    closeButton.style.top = '10px';
    closeButton.style.right = '10px';
    closeButton.style.cursor = 'pointer';
    closeButton.onclick = () => document.body.removeChild(popup);
    popup.appendChild(closeButton);
    
    // サイトリスト定義
    const sites = [
        { name: "モモンガ", url: "site:momon-ga.com" },
        { name: "ヒトミラ", url: "site:hitomi.la" },
        { name: "ケモノ", url: "site:kemono.su" },
        { name: "ダンボール", url: "site:danbooru.donmai.us" },
        { name: "MissAV", url: "site:missav.ws" },
        { name: "ZOZOアニメ", url: "site:zozovideo.com" },
        { name: "原神GameWith", url: "site:gamewith.jp" },
        { name: "原神wiki", url: "site:wikiwiki.jp" },
        { name: "gsmarena", url: "site:gsmarena.com" },
        { name: "ガルマックス", url: "site:garumax.com" },
        { name: "the比較", url: "site:thehikaku.net" },
        { name: "モバイルドットコム", url: "site:mobile-com.ne.jp" }
    ];
    
    // サイト選択用チェックボックスの追加
    const checkboxes = sites.map(site => {
        const label = document.createElement('label');
        const checkbox = document.createElement('input');
        checkbox.type = 'checkbox';
        checkbox.value = site.url;
        label.appendChild(checkbox);
        label.appendChild(document.createTextNode(site.name));
        popup.appendChild(label);
        popup.appendChild(document.createElement('br'));
        return checkbox;
    });
    
    // 検索キーワード入力欄作成(選択テキストがある場合は初期値に設定)
    const searchBox = document.createElement('input');
    searchBox.type = 'text';
    searchBox.placeholder = '検索キーワード';
    searchBox.style.width = '100%';
    searchBox.style.marginTop = '10px';
    searchBox.style.padding = '5px';
    if (selectedText) {
        searchBox.value = selectedText;
    }
    popup.appendChild(searchBox);
    
    // 検索ボタン作成
    const searchButton = document.createElement('button');
    searchButton.textContent = '検索';
    searchButton.style.position = 'absolute';
    searchButton.style.right = '10px';
    searchButton.style.bottom = '10px';
    searchButton.style.padding = '5px';
    searchButton.style.cursor = 'pointer';
    searchButton.onclick = function() {
        const selectedSites = checkboxes
            .filter(checkbox => checkbox.checked)
            .map(checkbox => checkbox.value);
        if (selectedSites.length > 0 && searchBox.value) {
            const query = selectedSites.join(' OR ') + ' ' + searchBox.value;
            window.open('https://www.google.com/search?q=' + encodeURIComponent(query));
        } else {
            alert('少なくとも1つのサイトを選択し、検索キーワードを入力してください。');
        }
    };
    popup.appendChild(searchButton);
    
    // ポップアップウィンドウをページに追加
    document.body.appendChild(popup);
})();
                }
            
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址