2NNのリンクを2ch.scへ書き換え
http://let.hatelabo.jp/jigendaddy/let/hLHV2MzO2cFk.js
// ==UserScript== // @name 2nn_sc // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://www.2nn.jp/* // @grant none // ==/UserScript== var result = document.evaluate('//a[contains(@href,"/mnewsplus/")]', document, null, 7, null); for (var i = 0; i < result.snapshotLength; i++) { var r_url=result.snapshotItem(i).href; r_url=r_url.replace('hayabusa9.5ch.net', 'hayabusa3.2ch.sc'); result.snapshotItem(i).href=r_url; } var result2 = document.evaluate('//a[contains(@href,"/newsplus/")]', document, null, 7, null); for (var j = 0; j < result2.snapshotLength; j++) { r_url=result2.snapshotItem(j).href; r_url=r_url.replace('asahi.5ch.net', 'ai.2ch.sc'); result2.snapshotItem(j).href=r_url; } var result3 = document.evaluate('//a[contains(@href,"/seijinewsplus/")]', document, null, 7, null); for (var k = 0; k < result3.snapshotLength; k++) { r_url=result3.snapshotItem(k).href; r_url=r_url.replace('fate.5ch.net', 'nozomi.2ch.sc'); result3.snapshotItem(k).href=r_url; } var result4 = document.evaluate('//a[contains(@href,"/news4plus/")]', document, null, 7, null); for (var x = 0; x < result4.snapshotLength; x++) { r_url=result4.snapshotItem(x).href; r_url=r_url.replace('lavender.5ch.net', 'awabi.2ch.sc'); result4.snapshotItem(x).href=r_url; } var result5 = document.evaluate('//a[contains(@href,"/bizplus/") or contains(@href,"/news5plus/") or contains(@href,"/scienceplus/") or contains(@href,"/femnewsplus/") or contains(@href,"/moeplus/") or contains(@href,"/dqnplus/")]', document, null, 7, null); for (var y = 0; y < result5.snapshotLength; y++) { r_url=result5.snapshotItem(y).href; r_url=r_url.replace('egg.5ch.net', 'anago.2ch.sc'); result5.snapshotItem(y).href=r_url; }
Googleウェブ検索でURLをまとめてコピー
// ==UserScript== // @name google_copy_url // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://www.google.com/search?* // @grant none // ==/UserScript== var result3 = document.evaluate('//div[@class="r"]/a[1]', document, null, 7, null); var u_list = ""; for (var i = 0; i < result3.snapshotLength; i++) { u_list = u_list + " " + result3.snapshotItem(i).href; } var result = document.evaluate('//button[@aria-label]', document, null, 7, null); result.snapshotItem(0).insertAdjacentHTML("afterend", "<a href='javascript:void(0);'><img src='https://cdn-ak.f.st-hatena.com/images/fotolife/j/jigendaddy/20181118/20181118104702.png'></a>"); var result2 = document.evaluate('//button[@aria-label]/following-sibling::a', document, null, 7, null); result2.snapshotItem(0).addEventListener('click', sample, false); function sample() { var sign = window.prompt("url_list", u_list); }
Youtubeで今まで見た動画の数を確認
このスクリプトはローカルストレージを使用していますがFirefoxではタブ間でローカルストレージの同期に問題があるらしく複数のタブでYoutubeを開いている場合本来意図した動作をしない可能性があります。また再起動時ローカルストレージに本来保存されているはずのキーが保存されていない現象を確認しています。従ってFirefoxではYoutubeを単一のタブで開かれる環境を前提とします。また再起動時には動作を保証しないものとします
http://let.hatelabo.jp/jigendaddy/let/hLHV2My9o4NU.js
// ==UserScript== // @name youtube_watchtime // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://www.youtube.com/watch?v=* // @match https://www.youtube.com/feed/history // @grant none // ==/UserScript== var result = document.evaluate('//video', document, null, 7, null); var u_list = ""; //パラメータ削除用関数 function para_del(str) { var s_url = str + "&"; var array_url = s_url.split("&"); s_url = array_url[0]; return s_url; } // UNIX時間を取得する function u_time() { var date_obj = new Date(); var unix_time = Math.floor(date_obj.getTime() / 1000); return unix_time; } //24時間以上経過していたらアラート /*if ("v_play_first_time" in localStorage) { var tmp=localStorage.getItem("v_play_first_time"); var d_time=Number(tmp); var un_time=u_time(); if(un_time-d_time>24*60*60) { alert("最初に動画を見てから24時間以上が経過しています。\nこれまで見た動画を確認する場合は、履歴ページの検索バーにcheck\n設定したキーを削除する場合は検索バーにremoveと入力してください"); } }*/ //動画の上にある検索バーで入力文字の変更を感知してフォーカスアウト後作動 var result2 = document.evaluate('//input[@id="search"]', document, null, 7, null); result2.snapshotItem(0).addEventListener('change', function () { //watch?v=にてset入力でキー設定 if (result2.snapshotItem(0).value == "set") { alert("ローカルストレージに設定用のキーを保存します"); var d_url = location.href; var s_url = para_del(d_url); if (window.confirm("現在の動画のURLは" + s_url + "ですか?\nアドレスバーのURLと異なる場合はキャンセルを押してください")) { var un_time = u_time(); localStorage.setItem(s_url, un_time); alert("設定しました。\n履歴ページ移動後check入力前にリロードをお勧めします"); } else { alert("再読み込みを行います。\nお手数ですが読み込み終了後、もう一度setと入力してください"); location.reload(); } //feed/historyにてcheck入力でアラート } else if (result2.snapshotItem(0).value == "check") { var result3 = document.evaluate('//*[@is-history]//a[@id="video-title"]', document, null, 7, null); for (var i = 0; i < result3.snapshotLength; i++) { var n_url = result3.snapshotItem(i).href; var nr_url = para_del(n_url); if (nr_url in localStorage) { var tmp = localStorage.getItem(nr_url); var f_time = Number(tmp); var uni_time = u_time(); var d_time = uni_time - f_time; //console.log(i+1); if (d_time < 60) { alert("これまでに見た動画の数は" + (i + 1) + "本です。\n最初に動画を見てから" + d_time + "秒が経過しています"); } else if (d_time == 60 || d_time < 60 * 60) { alert("これまでに見た動画の数は" + (i + 1) + "本です。\n最初に動画を見てから" + Math.floor((d_time / 60)) + "分" + (d_time - (Math.floor((d_time / 60)) * 60)) + "秒が経過しています"); } else { alert("これまでに見た動画は" + (i + 1) + "本です。\n最初に動画を見てから" + Math.floor(Math.floor((d_time / 60)) / 60) + "時間" + Math.floor(Math.floor((d_time / 60)) - (Math.floor(Math.floor((d_time / 60)) / 60) * 60)) + "分が経過しています"); } break; } } } /*else if(result2.snapshotItem(0).value == "remove") { localStorage.removeItem('v_play_first_url'); localStorage.removeItem('v_play_first_time'); alert("削除しました"); }*/ //feed/historyにてcopy入力でurlコピー用プロンプトを出す else if (result2.snapshotItem(0).value == "copy") { result3 = document.evaluate('//*[@is-history]//a[@id="video-title"]', document, null, 7, null); for (i = 0; i < result3.snapshotLength; i++) { n_url = result3.snapshotItem(i).href; nr_url = para_del(n_url); if (nr_url in localStorage) { var loop = i + 1; break; } } for (i = 0; i < loop; i++) { n_url = result.snapshotItem(i).href; nr_url = para_del(n_url); u_list = u_list + " " + nr_url; var sign = window.prompt("url_list", u_list); } } });
Youtube等の動画サイトで現在の再生時間を保存
このスクリプトはローカルストレージを使用していますがFirefoxではタブ間でローカルストレージの同期に問題があるらしく複数のタブでYoutubeを開いている場合本来意図した動作をしない可能性があります。また再起動時ローカルストレージに本来保存されているはずのキーが保存されていない現象を確認しています。従ってFirefoxではYoutubeを単一のタブで開かれる環境を前提とします。また再起動時には動作を保証しないものとします
直近の動画のみ再生時間を保存
// ==UserScript== // @name save_video_currentime // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://www.youtube.com/watch?v=* // @grant none // ==/UserScript== var result = document.evaluate('//video', document, null, 7, null); var result2 = document.evaluate('//input[@id="search"]', document, null, 7, null); //動画の上にある検索バーで入力文字の変更を感知してフォーカスアウト後作動 result2.snapshotItem(0).addEventListener('change', function () { if ("v_savetime" in localStorage) { //動画の上にある検索バーでremoveと入力後フォーカスアウトでキー削除 if (result2.snapshotItem(0).value == "remove") { localStorage.removeItem('v_savetime'); alert("ローカルストレージから設定したキーを削除しました"); } //検索バーで入力文字の変更後フォーカスアウトで保存された再生時間から再生する、もしくは現在の再生時間を保存 var p_time = localStorage.getItem("v_savetime"); if (p_time < 60) { if (window.confirm(p_time + "秒から再生しますか?それとも現在の再生時間で保存しますか?\n前者であれば「OK」を、後者であれば「キャンセル」を押してください")) { result.snapshotItem(0).currentTime = p_time; result.snapshotItem(0).play(); } else { localStorage.setItem("v_savetime", Math.floor(result.snapshotItem(0).currentTime)); alert("ローカルストレージに保存しました"); } } else if (p_time == 60 || p_time < 60 * 60) { if (window.confirm(Math.floor((p_time / 60)) + "分" + (p_time - (Math.floor((p_time / 60)) * 60)) + "秒から再生しますか?それとも現在の再生時間で保存しますか?\n前者であれば「OK」を、後者であれば「キャンセル」を押してください")) { result.snapshotItem(0).currentTime = p_time; result.snapshotItem(0).play(); } else { localStorage.setItem("v_savetime", Math.floor(result.snapshotItem(0).currentTime)); alert("ローカルストレージに保存しました"); } } else { if (window.confirm(Math.floor(Math.floor((p_time / 60)) / 60) + "時間" + Math.floor(Math.floor((p_time / 60)) - (Math.floor(Math.floor((p_time / 60)) / 60) * 60)) + "分から再生しますか?それとも現在の再生時間で保存しますか?\n前者であれば「OK」を、後者であれば「キャンセル」を押してください")) { result.snapshotItem(0).currentTime = p_time; result.snapshotItem(0).play(); } else { localStorage.setItem("v_savetime", Math.floor(result.snapshotItem(0).currentTime)); alert("ローカルストレージに保存しました"); } } } else { //キーが存在しなければ現在の再生時間でキーを保存するか確認を取る if (result2.snapshotItem(0).value != "remove") { if (window.confirm("現在の再生時間で保存しますか?")) { localStorage.setItem("v_savetime", Math.floor(result.snapshotItem(0).currentTime)); alert("ローカルストレージに保存しました。\n削除する場合は動画の上にある検索バーで「remove」と入力するか\nv_savetimeキーを削除してください"); } } } });
動画ごとに再生時間を保存
var result = document.evaluate('//video', document, null, 7, null); if (location.href in localStorage) { var p_time = localStorage.getItem(location.href); if (p_time < 60) { if (window.confirm(p_time + "秒から再生します")) { result.snapshotItem(0).currentTime = p_time; result.snapshotItem(0).play(); } } else if (p_time == 60 || p_time < 60 * 60) { if (window.confirm(Math.floor((p_time / 60)) + "分" + (p_time - (Math.floor((p_time / 60)) * 60)) + "秒から再生します")) { result.snapshotItem(0).currentTime = p_time; result.snapshotItem(0).play(); } } else { if (window.confirm(Math.floor(Math.floor((p_time / 60)) / 60) + "時間" + Math.floor(Math.floor((p_time / 60)) - (Math.floor(Math.floor((p_time / 60)) / 60) * 60)) + "分から再生します")) { result.snapshotItem(0).currentTime = p_time; result.snapshotItem(0).play(); } } } else { localStorage.setItem(location.href, Math.floor(result.snapshotItem(0).currentTime)); alert("保存しました"); }
Youtubeに音量調節用スライダー設置
var result = document.evaluate('//video', document, null, 7, null); document.getElementById("info-text").insertAdjacentHTML('afterend', '<input type="range" name="example" step="5" max="100" id="hoge">'); document.getElementById("hoge").addEventListener('change', function () { result.snapshotItem(0).volume = document.getElementById("hoge").value/100; this.title = document.getElementById("hoge").value + "%"; }, false);
AbemaTVで音量調節用スライダー設置
var result = document.evaluate('//video', document, null, 7, null); var result2 = document.evaluate('//header/p', document, null, 7, null); if(document.getElementById("hoge") == null){ result2.snapshotItem(0).insertAdjacentHTML('afterend', '<input type="range" name="example" step="1" 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);
http://scratchpad.io/flaky-change-6919
input[type=range] { -webkit-appearance: none; appearance: none; background-color: #333333; height: 2px; width: 100%; border-radius: 6px; } /*for chrome*/ input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; cursor: pointer; position: relative; border: none; width: 16px; height: 16px; display: block; background-color: #51C300; border-radius: 50%; -webkit-border-radius: 50%; } /*for firefox*/ input[type=range]::-moz-range-thumb { -webkit-appearance: none; appearance: none; cursor: pointer; position: relative; border: none; width: 16px; height: 16px; display: block; background-color: #51C300; border-radius: 50%; -webkit-border-radius: 50%; } input[type=range]::-moz-range-track{ background-color: #333; }
勝間和代オフィシャルサイト オフィシャルメールマガジン広告対策
// ==UserScript== // @name katsumaweb_ad // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://www.katsumaweb.com/news.php?id=* // @grant none // ==/UserScript== document.body.innerHTML = document.body.innerHTML.split('---').join('<div class="ad">---</div>'); var result3 = document.evaluate('//div[@class="ad"]/following-sibling::node()', document, null, 7, null); for (var k = 0; k < result3.snapshotLength; k++) { result3.snapshotItem(k).remove(); } var result = document.evaluate('//div[@class="page_left"]//text()[string-length(normalize-space())>1]/following-sibling::br[1]', document, null, 7, null); for (var i = 0; i < result.snapshotLength; i++) { result.snapshotItem(i).classList.add("br_first"); } var listArray = document.querySelectorAll('.br_first+br:not(.br_first)+br:not(.br_first)'); for (var a = 0; a < listArray.length; a++) { listArray[a].classList.add("br_third"); } var result2 = document.evaluate('//br[@class="br_third"]/following-sibling::node()', document, null, 7, null); for (var j = 0; j < result2.snapshotLength; j++) { result2.snapshotItem(j).remove(); }
@-moz-document url-prefix("https://www.katsumaweb.com/news.php?id=") { .ad { display: none; } .back_btn2 { margin: 0; } }