ニコニコ動画の視聴履歴に何日前に見た動画か記載
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] + ")"); }