ニコニコ動画で視聴終了後自動的に次の動画に移動
// ==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; }
TwitterのTLで指定したユーザーの最新ツイートに移動
http://let.hatelabo.jp/jigendaddy/let/hJmd3o2kls49.js
// ==UserScript== // @name twitter_jump_user // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://twitter.com/* // @grant none // ==/UserScript== var result4 = document.evaluate('id("global-new-tweet-button")', document, null, 7, null); result4.snapshotItem(0).insertAdjacentHTML('afterend', '<input type="button" value="jump_user" id="jump">'); var result5 = document.evaluate('id("jump")', document, null, 7, null); result5.snapshotItem(0).addEventListener('click', sample, false); function sample() { var sign = window.prompt("誰のツイートに飛びますか", "アカウント名の@以下を入力してください"); var result = document.evaluate('//div[@class="stream-item-header"]/descendant::span[contains(@class,"username")][1]/b/text()', document, null, 7, null); var result2 = document.evaluate('//div[@class="stream-item-header"]/descendant::span[contains(@class,"username")][1]', document, null, 7, null); var flag = 0; for (var i = 0; i < result.snapshotLength; i++) { if (result.snapshotItem(i).nodeValue == sign) { result2.snapshotItem(i).id = "hoge"; flag = 1; break; } } if (flag == 1) { var result3 = document.evaluate('id("hoge")/ancestor::li[1]', document, null, 7, null); var l_url = location.href; l_url = l_url.replace(location.hash, ""); location.href = l_url + "#" + result3.snapshotItem(0).id; } else { alert("該当するユーザーのツイートがありません"); } }
videoタグのsrc要素を開く
var result = document.evaluate('//video', document, null, 7, null); window.open(result.snapshotItem(0).src);