ニュートピ!の記事へのリンクと「記事をすぐ読む」リンクを入れ替える
// ==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(); }
NewsPicksで「続きを読む」リンクのURLを保存してコピー
このスクリプトはFirefoxで動作を保証しないものとします
http://let.hatelabo.jp/jigendaddy/let/hLHV3o2-44oT.js
// ==UserScript== // @name newspicks_save_link // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://newspicks.com/news/* // @grant none // ==/UserScript== var result = document.evaluate('//div[@class="meta-block clear"]', document, null, 7, null); result.snapshotItem(0).insertAdjacentHTML('beforeend', '<div><input type="button" value="保存"><input type="button" value="開く"><input type="button" value="削除"></div>'); var result2 = document.evaluate('//div[@class="meta-block clear"]/div[last()]/input[1]', document, null, 7, null); result2.snapshotItem(0).addEventListener('click', sample, false); var result3 = document.evaluate('//div[@class="meta-block clear"]/div[last()]/input[2]', document, null, 7, null); result3.snapshotItem(0).addEventListener('click', sample2, false); var result4 = document.evaluate('//div[@class="meta-block clear"]/div[last()]/input[3]', document, null, 7, null); result4.snapshotItem(0).addEventListener('click', sample3, false); function sample() { var result5 = document.evaluate('//a[@class="read-more center"]', document, null, 7, null); var result6 = document.evaluate('//link[@rel="canonical"]', document, null, 7, null); var pattern = /body\/\?ref\=index/g; for (var i = 0; i < 128; i++) { if (!("url" + (i + 1) in localStorage)) { if (i == 127) { alert("保存できるURLの数は128までに制限しています。\nローカルストレージから登録したキーを削除してください"); break; } var cb = list_check(i + 1, result6.snapshotItem(0).href); if (cb != 1) { localStorage.setItem("url" + (i + 1), result6.snapshotItem(0).href); localStorage.setItem(result6.snapshotItem(0).href, result5.snapshotItem(0).href); alert("「続きを読む」リンクのURLを保存しました"); } break; } } } function list_check(lp, n_url) { var flag = 0; for (var i = 0; i < lp; i++) { if (localStorage.getItem("url" + i) == n_url) { alert("このページは既に登録されています"); flag = 1; break; } } return flag; } function sample2() { var buf = ""; var result6 = document.evaluate('//link[@rel="canonical"]', document, null, 7, null); for (var i = 0; i < 128; i++) { if ("url" + (i + 1) in localStorage) { var tmp = localStorage.getItem(localStorage.getItem("url" + (i + 1))); buf = buf + " " + tmp; } else { break; } } var sign = prompt("url_list", buf); } function sample3() { var result6 = document.evaluate('//link[@rel="canonical"]', document, null, 7, null); if (result6.snapshotItem(0).href in localStorage) { for (var i = 0; i < 128; i++) { if (localStorage.getItem("url" + (i + 1)) == result6.snapshotItem(0).href) { localStorage.removeItem("url" + (i + 1)); localStorage.removeItem(result6.snapshotItem(0).href); alert("このページをキーから削除しました"); break; } } } else { alert("このページのキーが登録されていません"); } }
irorio.jpで改行をシンプルに
// ==UserScript== // @name irorio_br // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://irorio.jp/takumiurushidate/20170716/408611/ // @grant none // ==/UserScript== var result = document.evaluate('//div[@class="post-body"]/p[./span]', document, null, 7, null); for (var i = 0; i < result.snapshotLength; i++) { result.snapshotItem(i).classList.add("i_name"); }
.post-body {padding:0 !important;} .post-body {padding-left:6px !important;} .post-body p{margin:0 !important;} .post-body p+.i_name{margin-top:20px !important;}
ニコニコ動画で視聴終了後自動的に次の動画に移動
// ==UserScript== // @name nico_auto_load // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://www.nicovideo.jp/watch/sm* // @grant none // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js // ==/UserScript== var result3 = document.evaluate('//ul[@class="TagList"]', document, null, 7, null); result3.snapshotItem(0).insertAdjacentHTML('beforeend', '<select id="auto_load"><option value="">位置</option><option value="1">1番目</option><option value="2">2番目</option></select>'); var result4 = document.evaluate('id("auto_load")', document, null, 7, null); result4.snapshotItem(0).addEventListener('change', function () { var selectedValue = $("#auto_load").val(); if (!('load_order' in localStorage) || Number(localStorage.getItem('load_order')) != selectedValue) { localStorage.setItem('load_order', selectedValue); alert("読み込む動画の位置をローカルストレージに書き込みました"); } }); var result = document.evaluate('//video', document, null, 7, null); result.snapshotItem(0).addEventListener('ended', function () { if (Number(localStorage.getItem('load_order')) == 1) { //動画説明文の1番目にリンクがある場合 var result2 = document.evaluate('//div[@class="VideoDescription-html"]/a[1][contains(@href,"watch/sm")]', document, null, 7, null); location.href = result2.snapshotItem(0).href; } else if (Number(localStorage.getItem('load_order')) == 2) { //動画説明文の2番目にリンクがある場合 var result5 = document.evaluate('//div[@class="VideoDescription-html"]/a[2][contains(@href,"watch/sm")]', document, null, 7, null); location.href = result5.snapshotItem(0).href; } });
ニュートピ!の「記事を読む」リンクを同じタブで開くリンク設置
// ==UserScript== // @name newtopi_link_open_same // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://newstopics.jp/url/* // @grant none // ==/UserScript== var result = document.evaluate('//div[@class="article_link"]/a[1]', document, null, 7, null); result.snapshotItem(0).insertAdjacentHTML('afterend', '<a href="' + result.snapshotItem(0).href + '">同じタブで開く</a>'); result.snapshotItem(1).insertAdjacentHTML('afterend', '<a href="' + result.snapshotItem(1).href + '">同じタブで開く</a>');
.article_link { display: flex; justify-content: space-around; }
AbemaTVで移動用のURLリストを作成
このスクリプトはFirefoxで動作を保証しないものとします
http://let.hatelabo.jp/jigendaddy/let/hJmd3o2xrq5o.js
// ==UserScript== // @name abema_url_list // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://abema.tv/* // @grant none // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js // ==/UserScript== function k_set() { var d_url = window.prompt("URLを入力してください", ""); var d_title = window.prompt("タイトルを入力してください", ""); if (window.confirm("タイトルは" + d_title + "\nURLは" + d_url + "でよろしいですか?\n一つでも違う場合はキャンセルを押してください")) { for (var i = 0; i < 128; i++) { if (!("v_url" + (i + 1) in localStorage)) { localStorage.setItem("v_url" + (i + 1), "v_" + d_title); localStorage.setItem("v_" + d_title, d_url); var flag = i + 1; break; } } } else { flag = 0; } return flag; } var result = document.evaluate('//input[@name="search"]', document, null, 7, null); result.snapshotItem(0).addEventListener('change', function () { if (result.snapshotItem(0).value == "set") { var f_lp = 0; f_lp = k_set(); if (f_lp != 0) { if ("v_null" in localStorage || "v_" in localStorage) { alert("登録処理を中断します"); localStorage.removeItem("v_null"); localStorage.removeItem("v_"); localStorage.removeItem("v_url" + f_lp); } } } else if (result.snapshotItem(0).value == "open") { var result2 = document.evaluate('//form[@role="search"]', document, null, 7, null); if (document.getElementById("select01") == null) { result2.snapshotItem(0).insertAdjacentHTML("beforeend", "<select id='select01'><option value='none'>選択してください</option></select>"); } var result3 = document.evaluate('id("select01")', document, null, 7, null); for (var i = 0; i < 128; i++) { if ("v_url" + (i + 1) in localStorage) { var d_title = localStorage.getItem("v_url" + (i + 1)) var d_url = localStorage.getItem(d_title); d_title = d_title.replace("v_", ""); result3.snapshotItem(0).insertAdjacentHTML("beforeend", "<option value='" + d_url + "'>" + d_title + "</option>"); } else { break; } } result3.snapshotItem(0).addEventListener('change', function () { var selectedValue = $("#select01").val(); location.href = selectedValue; }); } });
select { -moz-appearance: menulist; -webkit-appearance: menulist; }