1300

移行用のテストです

google_news_preview(WordPress.comAPI版)

var result = document.evaluate('//a[@class="hBookmark-widget-counter"]/img[1]',document, null, 7, null);
var result2 = document.evaluate('//a[@class="hBookmark-widget-counter"]',document, null, 7, null);
//var result2 = document.evaluate('//div[@class="g"]/div/a',document, null, 7, null);
for(var i=0;i<result.snapshotLength;i++)
{
    var n_url=result.snapshotItem(i).src;
    var n_train=n_url.split("/image/");

    var thum="https://s.wordpress.com/mshots/v1/"+encodeURIComponent(n_train[1]);
    result2.snapshotItem(i).href=thum;
    result2.snapshotItem(i).title="このエントリをサムネイルで表示";

    result.snapshotItem(i).src="https://cdn-ak.f.st-hatena.com/images/fotolife/j/jigendaddy/20180622/20180622174633.png"

}
.hBookmark-widget-counter>img{display:inline-block !important;}

はてブ維持版

var result = document.evaluate('//a[@class="hBookmark-widget-counter"]/img[1]',document, null, 7, null);
var result2 = document.evaluate('//a[@class="hBookmark-widget-counter"]',document, null, 7, null);
//var result3 = document.evaluate('//div[./a[@class="hBookmark-widget-counter"]]',document, null, 7, null);
//var result2 = document.evaluate('//div[@class="g"]/div/a',document, null, 7, null);
for(var i=0;i<result.snapshotLength;i++)
{
    var n_url=result.snapshotItem(i).src;
    var n_train=n_url.split("/image/");

    //console.log(encodeURIComponent(n_train[1]));

    var thum_link="https://s.wordpress.com/mshots/v1/"+encodeURIComponent(n_train[1]);
    var thum = document.createElement("a");
    thum.href=thum_link;
    thum.title="このエントリをサムネイルで表示";
    /*result2.snapshotItem(i).href=thum;
    result2.snapshotItem(i).title="このエントリをサムネイルで表示";*/

    var thum_img = document.createElement("img");
    thum_img.src="https://cdn-ak.f.st-hatena.com/images/fotolife/j/jigendaddy/20180622/20180622174633.png"
    thum.appendChild(thum_img);
    result2.snapshotItem(i).parentNode.insertBefore(thum,result2.snapshotItem(i));
    //result3.snapshotItem(i).appendChild(thum);
    /*result.snapshotItem(i).appendChild(thum_link);
    result.snapshotItem(i).src="https://cdn-ak.f.st-hatena.com/images/fotolife/j/jigendaddy/20180622/20180622174633.png"*/

}
.hBookmark-widget-counter>img{display:inline-block !important;}