1300

移行用のテストです

google_news_preview_key(テキストエリア生成版)

bookmarkletA

var result = document.evaluate('//a[@class="hBookmark-widget-counter"]/img',document, null, 7, null);
var t =document.createElement("textarea");
t.id="test";
document.getElementById("appbar").appendChild(t);

for(var i=0;i<result.snapshotLength;i++)
{
    var n_url=result.snapshotItem(i).src;
    var n_train=n_url.split("/image/");
    var t_url=n_train[1];
    var txt=t.value+"\n"+t_url;
    t.value=txt;   
}

bookmarkletB

var input_text = document.getElementById('test').value;
var arr = input_text.split(/\r\n|\r|\n/);	
var result = document.evaluate('//div[@class="g"]/descendant::a[1]/img',document, null, 7, null);
for(var i=0;i<result.snapshotLength;i++)
{
    result.snapshotItem(i).src=arr[i];
}

userscript

// ==UserScript==
// @name         image_key_set
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @include      https://*
// @include      http://*
// @grant        none
// ==/UserScript==
var result = document.evaluate('//meta[@property="og:image"]',document, null, 7, null);
location.href=result.snapshotItem(0).content;

css

.g img{object-fit: cover;}