Twitterで下書きを保存

このスクリプトFirefoxで動作を保証しないものとします
http://let.hatelabo.jp/jigendaddy/let/hJmd3o2Zm8Q7.js

// ==UserScript==
// @name         twitter_draft
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://twitter.com/*
// @grant        none
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js
// ==/UserScript==
var result = document.evaluate('id("global-new-tweet-button")', document, null, 7, null);
result.snapshotItem(0).insertAdjacentHTML('afterend', '<input type="button" id="draft" value="下書き">');
document.getElementById("draft").addEventListener('click', function () {
  localStorage.setItem("n_url", location.href);
  history.pushState(null, null, "/koko_nanimo_naidesuyo");
  document.body.innerHTML = "";
  document.body.insertAdjacentHTML("beforeend", "<textarea>戻るボタンなどのブラウザバックで元のページに戻ります</textarea><br><input type='button' value='save'><input type='button' value='load'><span class='count'>0</span>");
  var result2 = document.evaluate('//input', document, null, 7, null);
  result2.snapshotItem(0).addEventListener('click', sample, false);
  result2.snapshotItem(1).addEventListener('click', sample2, false);

  function sample() {
    var result3 = document.evaluate('//textarea', document, null, 7, null);
    localStorage.setItem('draft', result3.snapshotItem(0).value);
  }

  function sample2() {
    var result3 = document.evaluate('//textarea', document, null, 7, null);
    var draft = localStorage.getItem('draft');
    result3.snapshotItem(0).value = draft;
  }
  $('textarea').bind('keydown keyup keypress change', function () {
    var thisValueLength = $(this).val().length;
    $('.count').html(thisValueLength + "/140");
  });
  window.addEventListener('popstate', function (event) {
    location.href = localStorage.getItem("n_url");
  });
});

これまで作成したgreasemonkeyスクリプト

  1. nishino_ameblo_kdiv 西野ブログで不要な空divを削除
  2. nishino_ameblo_br 西野ブログで不要な改行を削除
  3. ameblo_link アメブロの内部リンクをJavaScriptで実行
  4. nishino_ameblo_easy 西野ブログ実験版
  5. google_search_blist Google検索でブラックリストを設定
  6. nishino_ameblo_fbi 西野ブログでフォントを削除
  7. katsumaweb_ad 勝間和代オフィシャルサイトで広告削除
  8. save_video_currentime Youtubeで再生中の動画において再生時間を保存する
  9. youtube_watchtime Youtubeで再生した動画の数を保存して表示
  10. google_copy_url Googleウェブ検索でURLをまとめてコピー するアイコン設置
  11. 2nn_sc 2NNで2ch.netのリンクを2ch.scに置き換える
  12. youtube_skip_button Youtubeで再生中の動画を終わらせる
  13. nico_skip_button ニコニコ動画の再生前広告を飛ばすアイコン設置
  14. nico_history_copy ニコニコ動画の履歴ページから動画のURLをコピー
  15. abema_update_check AbemaTVの更新チェック
  16. nico_history_ago ニコニコ動画の履歴ページに何日前に再生した動画か表示
  17. twitter_draft Twitterで下書きを保存する
  18. twitter_jump_user TwitterのTLでユーザーを指定して最後のツイートに飛ぶ
  19. abema_url_list AbemaTVでURLリストを作成
  20. newtopi_link_open_same ニュートピ!のリンクを同じタブで開くボタン設置
  21. nico_auto_load ニコニコ動画の動画終了時に次の動画に自動的に飛ぶ
  22. newspicks_save_link NewsPicksで「続きを読む」リンクのURLを保存してコピー
  23. newtopi_link_exchange ニュートピ!のリンクを入れ替える
  24. togetter_simple  Togetterにコメント欄へ飛ぶリンクを追加
  25. insta_movie インスタグラムで動画再生時に長さと音量調整スライダーを表示
  26. newtopi_img2twitter ニュートピ!で画像付きツイートのクリック時に画像のみを表示
  27. youtube_history_abema  Youtube履歴ページで指定したチャンネルの動画を表示
  28. insta_url_list インスタグラムでURLリストを作成
  29. insta_count インスタグラムで複数投稿の場合投稿数を表示
  30. youtube_history_ago Youtubeの履歴ページに何日前に再生した動画か表示
  31. mofu_ameblo アメブロ旦那観察日記の画像をインスタグラムと同じサイズで表示
  32. youtube_volume_alert Youtubeで音量調整が必要そうな場合に警告を表示
  33. twitter_acc_list 登録したTwitterのアカウントを一覧リストで表示
  34. spot_search  SPOTで記事を探しやすくする
  35. twitter2hatena Twitterのツイートをはてなブログに埋め込む形式でリストを表示
  36. youtube2hatena YoutubeでURLメモ用のテキストエリアを表示
  37. twitter_date Twitterで今日の予定をメモ
  38. twitter_moment_list  Twitterで登録したモーメントを一覧リストで表示
  39. renban_load_zero  画像のみ表示時に連番画像を生成

ニコニコ動画の視聴履歴に何日前に見た動画か記載

http://let.hatelabo.jp/jigendaddy/let/hLHV2dCKgN0j.js

// ==UserScript==
// @name         nico_history_ago
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.nicovideo.jp/my/history
// @grant        none
// @require      http://momentjs.com/downloads/moment.js
// ==/UserScript==
var result = document.evaluate('//p[@class="posttime"]/text()', document, null, 7, null);
var g_time;
var d_time = [];
for (var i = 0; i < result.snapshotLength; i++) {
  g_time = result.snapshotItem(i).nodeValue.replace("年", "");
  g_time = g_time.replace("月", "");
  g_time = g_time.replace("日", "");
  g_time = g_time.replace(" 視聴", "");
  if (moment(g_time, "YYYYMMDD").fromNow() == moment().startOf('day').fromNow()) {
    d_time[i] = "今日";
  } else {
    d_time[i] = moment(g_time, "YYYYMMDD").fromNow();
  }
}
for (i = 0; i < d_time.length; i++) {
  d_time[i] = d_time[i].replace(" ago", "前");
  d_time[i] = d_time[i].replace("a day", "1日");
  d_time[i] = d_time[i].replace("days", "日");
  d_time[i] = d_time[i].replace("a month", "1ヶ月");
  d_time[i] = d_time[i].replace("months", "ヶ月");
  d_time[i] = d_time[i].replace(" ", "");
}
var result2 = document.evaluate('//p[@class="posttime"]/span', document, null, 7, null);
for (i = 0; i < d_time.length; i++) {
  result2.snapshotItem(i).insertAdjacentHTML("beforebegin", "(" + d_time[i] + ")");
}

AbemaTVでページを開くたびに更新があるかチェック

このスクリプトFirefoxで動作を保証しないものとします
http://let.hatelabo.jp/jigendaddy/let/hLHV2Mz_nPIk.js

// ==UserScript==
// @name         abema_update_check
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://abema.tv/video/title/*
// @grant        none
// ==/UserScript==
var result = document.evaluate('//div[@role="listitem"][.//img]//a[not(.//img)]', document, null, 7, null);
var flag = 0;
if (!("update_time" in localStorage)) {
  var now1 = Math.floor((new Date).getTime() / 1000);
  localStorage.setItem('update_time', now1);
  localStorage.setItem("check_update", result.snapshotItem(0).href);
  alert("最終更新動画をチェック対象に設定しました");
} else {
  var now2 = Math.floor((new Date).getTime() / 1000);
  var l_update_time = Number(localStorage.getItem('update_time'));
  if (now2 - l_update_time > 24 * 60 * 60) {
    for (var i = 0; i < result.snapshotLength; i++) {
      var n_url = result.snapshotItem(i).href;
      var l_url = localStorage.getItem('check_update');
      if (n_url == l_url) {
        flag = 1;
        localStorage.setItem('update_time', now2);
        if (i == 0) {
          alert("更新はありません");
          break;
        } else {
          alert(i + "本の更新があります");
          localStorage.setItem('check_update', result.snapshotItem(0).href);
          break;
        }
      }
    }
    if (flag == 0) {
      alert("20本以上の更新があります");
      localStorage.setItem('update_time', now2);
      localStorage.setItem('check_update', result.snapshotItem(0).href);
    }
  } /*else {
    var sec = now2 - l_update_time;
    alert("前回の更新から" + sec + "秒が経過しています");
    localStorage.setItem('update_time', now2);
  }*/
}

ニコニコ動画の履歴ページから動画のURLをコピー

期間指定あり

// ==UserScript==
// @name         nico_history_copy
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.nicovideo.jp/my/history
// @grant        none
// ==/UserScript==
var result = document.evaluate('//p[@class="posttime"]/text()', document, null, 7, null);
var g_time;
var d_time = [];
for (var i = 0; i < result.snapshotLength; i++) {
  g_time = result.snapshotItem(i).nodeValue.replace("年", "/");
  g_time = g_time.replace("月", "/");
  g_time = g_time.replace("日", "");
  g_time = g_time.replace(" 視聴", "");
  var d1 = new Date(g_time).getTime();
  //console.log(Math.floor(d1/1000));
  d_time[i] = Math.floor(d1 / 1000);
}
var result2 = document.evaluate('//input[@class="miniSearchWord"]', document, null, 7, null);
var result3 = document.evaluate('//p[@class="posttime"]/following-sibling::h5/a', document, null, 7, null);
result2.snapshotItem(0).addEventListener('change', function () {
  if (result2.snapshotItem(0).value == "copy") {
    var s_time = window.prompt("start", "2010/1/23");
    var d2 = new Date(s_time).getTime();
    console.log(d2);
    var t_time = new Date();
    var yy = t_time.getFullYear();
    var mm = t_time.getMonth() + 1;
    var dd = t_time.getDate();
    var td_time = yy + "/" + mm + "/" + dd;
    var f_time = window.prompt("finish", td_time);
    var d3 = new Date(f_time).getTime();
    console.log(d3);
    var u_list = "";
    var flag = 0;
    for (i = 0; i < d_time.length; i++) {
      if (d_time[i] > Math.floor(d2 / 1000)) {
        if (d_time[i] < Math.floor(d3 / 1000)) {
          u_list = u_list + " " + result3.snapshotItem(i).href;
          flag = 1;
        }
      }
    }
    if (flag == 1) {
      var sign = window.prompt("url_list", u_list);
    } else {
      alert("なにかが変です");
    }
  }
});

期間指定なし

var result3 = document.evaluate('id("historyList")//h5/a', 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('//p[@class="posttime"]', document, null, 7, null);
result.snapshotItem(0).insertAdjacentHTML("beforeend", "<a href='javascript:void(0);'><img src='https://cdn-ak.f.st-hatena.com/images/fotolife/j/jigendaddy/20181023/20181023214613.png'></a>");
var result2 = document.evaluate('//p[@class="posttime"]/a', document, null, 7, null);
result2.snapshotItem(0).addEventListener('click', sample, false);

function sample() {
  var sign = window.prompt("url_list", u_list);
}

ニコニコ動画で再生前動画広告を飛ばすボタン設置

// ==UserScript==
// @name         nico_skip_button
// @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
// ==/UserScript==
var result = document.evaluate('//ul[@class="TagList"]', document, null, 7, null);
result.snapshotItem(0).insertAdjacentHTML("beforeend", "<a href='javascript:void(0);'><img src='https://cdn-ak.f.st-hatena.com/images/fotolife/j/jigendaddy/20181027/20181027181215.png'></a>");
var result2 = document.evaluate('//ul[@class="TagList"]/a', document, null, 7, null);
result2.snapshotItem(0).addEventListener('click', sample, false);

function sample() {
  var result3 = document.evaluate('descendant::video[2]', document, null, 7, null);
  result3.snapshotItem(0).src = "";
}

Youtubeで現在再生中の動画を終了させるボタン設置

// ==UserScript==
// @name         youtube_skip_button
// @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('id("head")/div[@id="upnext"]', 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/20181027/20181027181215.png'></a>");
var result2 = document.evaluate('id("head")/div[@id="upnext"]/following-sibling::a[1]', document, null, 7, null);
result2.snapshotItem(0).addEventListener('click', sample, false);

function sample() {
  var result3 = document.evaluate('//video', document, null, 7, null);
  result3.snapshotItem(0).currentTime = result3.snapshotItem(0).duration;
}