Greasy Fork is available in English.
Allow direct linking to images from Startpage, without a proxy
当前为
// ==UserScript==
// @name Startpage Direct Image URL
// @namespace http://tampermonkey.net/
// @version 1.01
// @description Allow direct linking to images from Startpage, without a proxy
// @author YXXXXNN
// @license GPL
// @match https://startpage.com/sp/search*
// @match https://startpage.com/do/dsearch*
// @match https://www.startpage.com/sp/search*
// @match https://www.startpage.com/do/dsearch*
// @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-site-links").append(`
<a rel="noopener nofollow noreferrer" target="_blank" aria-label="link"
class="css-dirimg451" href="#" style="color: #7f869f; font-size: 13px; text-decoration: none;">
View direct image
</a>
`);
};
window.addEventListener('load', directImgLink, false);
// Update URL on link update
var imgbtn = document.getElementsByClassName('css-kvj32h')[0];
var observer = new MutationObserver(function(mutations) {
let url = $(".css-kvj32h").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;