1300

移行用のテストです

Twitterで今日の予定をメモ

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

// ==UserScript==
// @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");
  window.addEventListener('beforeunload', function (e) {
    e.returnValue = '本当に移動してよろしいですか?';
  }, false);
  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', sample2, false);
  result.snapshotItem(1).addEventListener('click', sample3, false);

  function sample2() {
    var result4 = document.evaluate('//textarea', document, null, 7, null);
    localStorage.setItem('draft2', result4.snapshotItem(0).value);
  }

  function sample3() {
    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");
  });
}