インスタグラムで黒背景の段階を飛ばす
// ==UserScript== // @name insta_open_blackout_curtain // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://www.instagram.com/* // @exclude https://www.instagram.com/p/* // @grant none // ==/UserScript== var result = document.evaluate('//article//a', document, null, 7, null); for (var i = 0; i < result.snapshotLength; i++) { result.snapshotItem(i).addEventListener('click', sample, false); result.snapshotItem(i).dataset.href = result.snapshotItem(i).href; result.snapshotItem(i).href = "javascript:void(0);"; } function sample() { //ダミーの履歴を追加 history.pushState(null, null, "#"); location.href = this.dataset.href; }
Youtube履歴ページで指定したチャンネルの動画を表示
// ==UserScript== // @name youtube_history_abema // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://www.youtube.com/feed/history // @grant none // ==/UserScript== var result2 = document.evaluate('//input[@id="search"]', document, null, 7, null); result2.snapshotItem(0).addEventListener('change', function () { if (result2.snapshotItem(0).value == "acc") { var sign = window.prompt("検索するチャンネル名を入力してください", "AbemaTV"); var reg = new RegExp(sign); var result = document.evaluate('//ytd-video-renderer[.//yt-formatted-string[@id="byline"]]', document, null, 7, null); var result4 = document.evaluate('//ytd-video-renderer//yt-formatted-string[@id="byline"]', document, null, 7, null); for (var i = 0; i < result.snapshotLength; i++) { if (reg.test(result4.snapshotItem(i).title)) { result.snapshotItem(i).classList.add("kore"); } } var result3 = document.evaluate('//ytd-video-renderer[not(contains(@class,"kore"))]', document, null, 7, null); for (var j = 0; j < result3.snapshotLength; j++) { result3.snapshotItem(j).style.display = 'none'; } } else if (result2.snapshotItem(0).value == "copy") { var result5 = document.evaluate('//ytd-video-renderer[contains(@class,"kore")]//a[@id="video-title"]', document, null, 7, null); var buf = ""; for (var k = 0; k < result5.snapshotLength; k++) { buf = buf + " " + result5.snapshotItem(k).href; } var sign2 = window.prompt("url_list", buf); } });
ニュートピ!で画像付きツイートのクリック時に画像のみを表示
このスクリプトは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; });
インスタグラムで動画再生時に長さと音量調整用スライダーを表示
このスクリプトは一つの投稿に複数の画像または動画が存在する場合正しく機能しません。またインスタグラムで黒背景の段階を飛ばすgreasemonkeyスクリプトと併用することをお勧めします
// ==UserScript== // @name insta_movie // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://www.instagram.com/* // @grant none // ==/UserScript== var result = document.evaluate('//video', document, null, 7, null); var video = result.snapshotItem(0); video.addEventListener('loadedmetadata', function () { var result2 = document.evaluate('//time', document, null, 7, null); result2.snapshotItem(0).insertAdjacentHTML("afterbegin", Math.floor(this.duration) + "秒 "); result2.snapshotItem(0).insertAdjacentHTML('afterend', '<input type="range" name="example" step="5" max="100" id="hoge">'); document.getElementById("hoge").addEventListener('change', function () { for (var i = 0; i < result.snapshotLength; i++) { result.snapshotItem(i).volume = document.getElementById("hoge").value / 100; this.title = document.getElementById("hoge").value + "%"; } }, false); }); var result3 = document.evaluate('//a[./time]', document, null, 7, null); result3.snapshotItem(0).insertAdjacentHTML('afterend', '<form name="form1"><input type="button" id="v_open" value="動画を別のタブで開く"></form>'); document.getElementById("v_open").addEventListener('click', function () { window.open(video.src); });
Togetterにコメント欄へ飛ぶリンクを追加
// ==UserScript== // @name togetter_simple // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://togetter.com/li/* // @grant none // ==/UserScript== var result = document.evaluate('//div[@class="feedback_box"]', document, null, 7, null); result.snapshotItem(0).insertAdjacentHTML('afterbegin', '<a href="#comment_box" id="j_come">コメント欄に飛ぶ</a>'); var result2 = document.evaluate('//div[@class="title_box"]/h2', document, null, 7, null); result2.snapshotItem(0).insertAdjacentHTML('afterend', '<input type="button" class="simple" value="簡易版">'); var result3 = document.evaluate('id("j_come")', document, null, 7, null); result3.snapshotItem(0).insertAdjacentHTML('afterend', '<input type="button" class="simple" value="簡易版">'); $(function () { $('.simple').click(function () { for (var j = 10; j <= 20; j++) { $('.f' + j).css({ "font-size": "108%", "line-height": "1.4em", "color": "#000", "font-weight": "normal", }); } }, ); });
.simple { font-size: 100%; } .list_tweet_box .user_link, .list_tweet_box .user_link a { color: #333 !important; }
日本将棋連盟公式サイトまいにち詰将棋から3手詰め以外の問題を消す
// ==UserScript== // @name tsume_shogi_everyday_3 // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://www.shogi.or.jp/tsume_shogi/everyday/* // @grant none // ==/UserScript== var result = document.evaluate('//ul[contains(@class,"section04")]/li[.//*[contains(text(),"3手詰")]]', document, null, 7, null); for (var i = 0; i < result.snapshotLength; i++) { result.snapshotItem(i).classList.add("mate3"); }
.section04>li:not(.mate3){display:none}
ニュートピ!の記事へのリンクと「記事をすぐ読む」リンクを入れ替える
// ==UserScript== // @name newtopi_link_exchange // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://newstopics.jp/* // @grant none // ==/UserScript== var result = document.evaluate('//a[@class="title"]', document, null, 7, null); var tmp = []; for (var i = 0; i < result.snapshotLength; i++) { tmp[i] = result.snapshotItem(i).href; } var result2 = document.evaluate('//div[contains(@class,"comment")]/a[1]', document, null, 7, null); for (i = 0; i < result.snapshotLength; i++) { result.snapshotItem(i).href = result2.snapshotItem(i).href; } for (i = 0; i < result.snapshotLength; i++) { result2.snapshotItem(i).href = tmp[i]; } var result3 = document.evaluate('//div[@class="content" or @class="top_content"]//span[@class="comment_link"]/i/following-sibling::text()[1]', document, null, 7, null); for (var k = 0; k < result3.snapshotLength; k++) { result3.snapshotItem(k).nodeValue = "ツイートを見る"; } var result5 = document.evaluate('//div[@class="sidebar_content"]//span[@class="comment_link"]/i/following-sibling::text()[1]', document, null, 7, null); for (var x = 0; x < result5.snapshotLength; x++) { result5.snapshotItem(x).nodeValue = "ツイート"; } var result4 = document.evaluate('//span[@class="comment_link"]/i/following-sibling::text()[1]/following-sibling::node()', document, null, 7, null); for (var j = 0; j < result4.snapshotLength; j++) { result4.snapshotItem(j).remove(); }