インスタグラムでURLリストを作成

http://let.hatelabo.jp/jigendaddy/let/hJmd5b-10_Ne.js

// ==UserScript==
// @name         insta_url_list
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.instagram.com/*
// @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('//nav//a[./button[@type]]', document, null, 7, null);
result.snapshotItem(0).insertAdjacentHTML('beforebegin', '<input type="button" value="保存" id="save">');
result.snapshotItem(0).insertAdjacentHTML('beforebegin', '<input type="button" value="開く" id="open">');
result.snapshotItem(0).insertAdjacentHTML('beforebegin', '<input type="button" value="削除" id="remove">');
var result2 = document.evaluate('id("save")', document, null, 7, null);
result2.snapshotItem(0).addEventListener('click', function () {
  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 {
      alert("保存しました");
    }
  }
});
var result3 = document.evaluate('id("open")', document, null, 7, null);
result3.snapshotItem(0).addEventListener('click', function () {
  if (document.getElementById("select01") == null) {
    result2.snapshotItem(0).insertAdjacentHTML("beforebegin", "<select id='select01'><option value='none'>選択してください</option></select>");
  }
  var result5 = 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_", "");
      result5.snapshotItem(0).insertAdjacentHTML("beforeend", "<option value='" + d_url + "'>" + d_title + "</option>");
    } else {
      break;
    }
  }
  result5.snapshotItem(0).addEventListener('change', function () {
    var selectedValue = $("#select01").val();
    location.href = selectedValue;
  });
});
var result4 = document.evaluate('id("remove")', document, null, 7, null);
result4.snapshotItem(0).addEventListener('click', function () {
  for (var j = 0; j < 128; j++) {
    if (localStorage.getItem("v_url" + (j + 1)) in localStorage) {
      localStorage.removeItem(localStorage.getItem("v_url" + (j + 1)));
      localStorage.removeItem("v_url" + (j + 1));
      alert("削除しました");
      break;
    }
  }
});