twitter_date

    @@ -5,7 +5,7 @@ // @version 0.1 // @description try to take over the world! // @author You -// @match https://twitter.com/kenzou_path/lists/news +// @match https://twitter.com/* // @grant none // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js // @require http://momentjs.com/downloads/moment.js
  • // ==UserScript==
    // @title        twitter_date
    // @name         twitter_date
    // @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
    // @require      http://momentjs.com/downloads/moment.js
    // ==/UserScript==
    var result2 = document.evaluate('id("global-new-tweet-button")', document, null, 7, null);
    result2.snapshotItem(0).insertAdjacentHTML('afterend', '<input type="button" value="メモ" id="task_list">');
    var result3 = document.evaluate('id("task_list")', document, null, 7, null);
    result3.snapshotItem(0).addEventListener('click', sample, false);
    
    function sample() {
      localStorage.setItem("n_url", location.href);
      history.pushState(null, null, "/koko_nanimo_naidesuyo4");
      var now = moment();
      var d_week = now.format("ddd");
      d_week = d_week.replace("Sun", "日");
      d_week = d_week.replace("Mon", "月");
      d_week = d_week.replace("Tue", "火");
      d_week = d_week.replace("Wed", "水");
      d_week = d_week.replace("Thu", "木");
      d_week = d_week.replace("Fri", "金");
      d_week = d_week.replace("Sat", "土");
      document.body.innerHTML = "<div><span>" + now.format("M月D日") + "</span><span>(" + d_week + ")</span></div>";
      if (!('draft2' in localStorage)) {
        document.body.insertAdjacentHTML("beforeend", "<textarea>戻るボタンなどのブラウザバックで元のページに戻ります</textarea><br>");
      } else {
        document.body.insertAdjacentHTML("beforeend", "<textarea>" + localStorage.getItem('draft2') + "</textarea><br>");
      }
      document.body.insertAdjacentHTML("beforeend", "<div><div><input type='button' value='save'><input type='button' value='load'><a href='https://www.jma.go.jp/jp/yoho/'>天気</a><a href='https://tv.so-net.ne.jp/'>TV</a></div></div>");
      var result = document.evaluate('//input', document, null, 7, null);
      result.snapshotItem(0).addEventListener('click', sample, false);
      result.snapshotItem(1).addEventListener('click', sample2, false);
    
      function sample() {
        var result4 = document.evaluate('//textarea', document, null, 7, null);
        localStorage.setItem('draft2', result4.snapshotItem(0).value);
      }
    
      function sample2() {
        var result4 = document.evaluate('//textarea', document, null, 7, null);
        var draft2 = localStorage.getItem('draft2');
        result4.snapshotItem(0).value = draft2;
      }
      var result5 = document.evaluate('//textarea/following-sibling::div', document, null, 7, null);
      result5.snapshotItem(0).style.width = "15%";
      result5.snapshotItem(0).classList.add("t_after");
      $('.t_after>div').css({
        "display": "flex",
        "justify-content": "space-between"
      });
      window.addEventListener('popstate', function (event) {
        location.href = localStorage.getItem("n_url");
      });
    }
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2018/12/05 21:18:04 - 2018-12-05
  2. 2018/12/05 21:17:44 - 2018-12-05
  3. 2018/12/05 13:32:09 - 2018-12-05
  4. 2018/12/04 19:08:49 - 2018-12-04