Startpage Direct Image URL

Allow direct linking to images from Startpage, without a proxy

目前为 2022-11-08 提交的版本。查看 最新版本

// ==UserScript==
// @name         Startpage Direct Image URL
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  Allow direct linking to images from Startpage, without a proxy
// @author       YXXXXNN
// @license      GPL

// @match        http*://*.startpage.com/*

// @match        https://startpage.com/sp/search*
// @match        https://www.startpage.com/sp/search*
// @match        https://eu.startpage.com/sp/search*
// @match        https://us.startpage.com/sp/search*
// @match        https://*.startpage.com/sp/search*

// @match        https://startpage.com/do/dsearch*
// @match        https://www.startpage.com/do/dsearch*
// @match        https://eu.startpage.com/do/dsearch*
// @match        https://us.startpage.com/do/dsearch*
// @match        https://*.startpage.com/do/dsearch*

// @match        https://startpage.com/do/search*
// @match        https://www.startpage.com/do/search*
// @match        https://eu.startpage.com/do/search*
// @match        https://us.startpage.com/do/search*
// @match        https://*.startpage.com/do/search*

// @icon         https://www.google.com/s2/favicons?domain=startpage.com
// @grant        none
// @require      http://code.jquery.com/jquery-3.4.1.min.js

// ==/UserScript==

// Add direct image link to image search
const directImgLink = function() {
    'use strict';
    $(".expanded-details-link").append(`
        <a rel="noopener nofollow noreferrer" target="_blank" aria-label="link"
        class="css-dirimg451" href="#" style="color: #7f869f; font-size: 13px; text-decoration: none; margin-top: 10px; margin-bottom: 0px;">
            View direct image
        </a>
    `);
};
window.addEventListener('load', directImgLink, false);
// Update URL on link update
var imgbtn = document.getElementsByClassName('css-dhfft7')[0];
var observer = new MutationObserver(function(mutations) {
    let url = $(".css-dhfft7").attr("href");
    url = url.substring(52);
    url = url.substring(0, url.indexOf('&'));
    url = decodeURIComponent(url);
    $(".css-dirimg451").attr("href", url);
});
observer.observe(imgbtn, {
    attributes: true,
    attributeFilter: ['href'] });
imgbtn.dataset.selectContentVal = 1;

QingJ © 2025

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