Last active
August 29, 2015 14:17
-
-
Save asm256/62be76c49e099bcbcb8a to your computer and use it in GitHub Desktop.
なろうの閲覧履歴から削除された小説の手がかりを探す
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name NarouScavenger | |
// @namespace @asm__ | |
// @description 削除された小説の情報を探す | |
// @include http://yomou.syosetu.com/rireki/list/ | |
// @include http://noc.syosetu.com/rireki/list/ | |
// @include http://mnlt.syosetu.com/rireki/list/ | |
// @version 1.02 | |
// @grant none | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js | |
// ==/UserScript== | |
function f_log(mes){ | |
console.log(mes); | |
} | |
function n2s(n){ | |
var a = n / 9999; | |
var as = ""; | |
do{ | |
var x = a % 26 + 0x61; | |
as = String.fromCharCode(x) + as; | |
a /= 26; | |
} while(a > 1) | |
return "n" + n % 9999 + as; | |
} | |
$(function(){ | |
var gugure = function(){ | |
//ncodeの数値表現をncode | |
// /n[0-9]{4}[a-z]+/表現をncode_str と、とりあえずしとく | |
// <= "/rireki/delete/?ncode=123456" | |
var href = $(this).attr("href"); | |
var nr = href.match(/\\?ncode=(\d+)(?:&.*)?$/); | |
if(nr == null){ | |
f_log("ncode取得失敗"); | |
return; | |
} | |
//f_log(nr); | |
var ncode = nr[1]; | |
var ncode_str = n2s(ncode); | |
$(this).before($( | |
"<div><a href=https://www.google.co.jp/search?q=" + ncode_str + ">ぐぐる</a></div>" | |
)); | |
}; | |
$('p.rireki_deadlink ~ a').each(gugure); | |
$(".rireki_deadlink > a").each(gugure); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment