ニュートピ!で画像付きツイートのクリック時に画像のみを表示
このスクリプトはTwitter 原寸びゅーとの併用を前提とします。ブラウザ拡張版のインストールをお勧めします
// ==UserScript== // @name newtopi_img2twitter // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://twitter.com/*/status/*/photo/*?ref_src=*newstopics.jp* // @grant none // ==/UserScript== var result = document.evaluate('//div[@class="permalink-inner permalink-tweet-container"]//img[@class="twOpenOriginalImage_touched"]', document, null, 7, null); var tmp = []; for (var i = 0; i < result.snapshotLength; i++) { tmp[i] = result.snapshotItem(i).src; } if (result.snapshotLength > 0) { if (window.confirm("このツイートには画像が含まれています。\n画像のみを表示してよろしいですか?")) { var now1 = (new Date).getTime(); history.pushState(null, null, "/gazou_" + now1); document.body.innerHTML = ""; for (i = 0; i < result.snapshotLength; i++) { document.body.insertAdjacentHTML("beforeend", "<img src=" + tmp[i] + ">"); } } } window.addEventListener('popstate', function (event) { var n_url = location.href; n_url = n_url.replace(/\/photo\/(\d).+/g, "/photo/$1"); location.href = n_url; });