HD Images with Creative Commons License Search

Automatically search for HD images with Creative Commons license on Google Images.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         HD Images with Creative Commons License Search
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Automatically search for HD images with Creative Commons license on Google Images.
// @author       iamnobody
// @license      MIT
// @match        *://www.google.com/searchbyimage*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to click the "Tools" button to show image search filters
    function clickToolsButton() {
        var toolsButton = document.querySelector('div[data-ved="0ahUKEwi1qJG3h5P1AhURlIsKHddTAJQQ7eoBCEQ"]'); // Update with appropriate selector
        if (toolsButton) {
            toolsButton.click();
        }
    }

    // Function to select "Usage rights" dropdown and choose "Creative Commons licenses"
    function selectCreativeCommons() {
        var usageRightsDropdown = document.querySelector('div[data-ved="0ahUKEwi1qJG3h5P1AhURlIsKHddTAJQQ7e0BCEc"]'); // Update with appropriate selector
        if (usageRightsDropdown) {
            usageRightsDropdown.click();
            var creativeCommonsOption = document.querySelector('span:contains("Creative Commons licenses")');
            if (creativeCommonsOption) {
                creativeCommonsOption.click();
            }
        }
    }

    // Function to select "Size" dropdown and choose "Large"
    function selectSize() {
        var sizeDropdown = document.querySelector('div[data-ved="0ahUKEwi1qJG3h5P1AhURlIsKHddTAJQQ7e4BCEk"]'); // Update with appropriate selector
        if (sizeDropdown) {
            sizeDropdown.click();
            var largeSizeOption = document.querySelector('span:contains("Large")');
            if (largeSizeOption) {
                largeSizeOption.click();
            }
        }
    }

    // Function to click "Tools" button and apply filters
    function applyFilters() {
        clickToolsButton();
        setTimeout(selectCreativeCommons, 1000);
        setTimeout(selectSize, 2000);
    }

    // Run the function to apply filters when the page is loaded
    window.onload = function() {
        applyFilters();
    };

})();