Greasy Fork镜像 支持简体中文。

iqdb Ctrl + V

在 iqdb 中使用 Ctrl + V 上传图片

目前為 2021-06-14 提交的版本,檢視 最新版本

// ==UserScript==
// @name            iqdb Ctrl + V
// @name:zh         iqdb Ctrl + V
// @name:en         iqdb Ctrl + V
// @namespace       http://tampermonkey.net/
// @version         0.1.1
// @description:zh  在 iqdb 中使用 Ctrl + V 上传图片
// @description:en  Upload image to iqdb by Ctrl + V
// @author          apkipa
// @match           https://www.iqdb.org
// @grant           none
// @description 在 iqdb 中使用 Ctrl + V 上传图片
// ==/UserScript==

(function() {
    'use strict';

    function handlePaste(e) {
        var clipboardData, pastedData;

        clipboardData = e.clipboardData || window.clipboardData;
        pastedData = clipboardData.items[0];

        if (pastedData.type.indexOf("image") !== -1) {
            e.stopPropagation();
            e.preventDefault();

            var fileInput = document.getElementById("file");
            var formUpload = document.querySelectorAll("input[type=submit]")[0];

            /* ? Not working here
            fileInput.addEventListener("change", () => {
                formUpload.form.submit();
            });
            */

            fileInput.files = clipboardData.files;

            // Automatically submit the pasted image
            // (If this is not desired, comment the next line)
            formUpload.form.submit();
        }
        else {
            console.log("Not an image, paste event propagated");
        }
    }

    window.addEventListener('paste', handlePaste);
})();

QingJ © 2025

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