futaba log search

img,dat,mayのスレが消えた時に過去ログを表示しちゃう

当前为 2015-03-16 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name           futaba log search
// @namespace      https://github.com/himuro-majika
// @description    img,dat,mayのスレが消えた時に過去ログを表示しちゃう
// @include        http://img.2chan.net/b/res/*.htm
// @include        http://dat.2chan.net/b/res/*.htm
// @include        http://may.2chan.net/b/res/*.htm
// @require     http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js
// @grant       none
// @version 0.0.1.20150316073043
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);

(function ($) {
	var t = document.title;															//ページタイトル
	
	//ログ保管サービスジャンプ先URL(数字以外)
	//var logServiceURL = "http://peka.sakura.ne.jp/futaba/logbox/detail.html?no=";			//虹裏のログを数日分だけ閲覧できるサイト
	var logServiceURL_dat = "http://appsweets.net/tatelog/dat/thread/";						//リッチー(dat)
	var logServiceURL_img1 = "http://imgbako.com/";											//ふたろぐばこ(img)
	var logServiceURL_img2 = "http://parupunte.net/logbox/detail.html?no=";					//虹裏のログを数日分だけ閲覧できるサイト(img)
	var logServiceURL_may = "http://futalog.com/";											//ふたろぐばこ(may)
	
	//パターン:http://dat.2chan.net/b/res/68646178.htm
	var saba = document.domain.match(/^[^.]+/);		//鯖名(dat)
	var f = location.pathname.match(/\d+\.htm/);	//ファイル名(68646178.htm)
	var fd = f[0].match(/\d+/);						//ファイル名の数字(68646178)

	var r;						//ジャンプ先URL(フルパス)
	
	//鯖毎の振り分け
	if ( saba == "dat" )
	{
		r = logServiceURL_dat + fd;
	}
	else if ( saba == "img" )
	{
		//r = logServiceURL_img1 + f;
		r = logServiceURL_img2 + fd;
	}
	else if ( saba == "may" )
	{
		r = logServiceURL_may + f;
	}
	
	//スレが消えた時
	var waitnum = 3;	//sec
	function redirect() {
		location.href = r;								//ログ保管先にジャンプ	
	}
	if (t == "404 File Not Found")
	{
		$("body > h1").before( waitnum + "秒後に<a href='" + r + "' target='_blank'>外部ログサイト*</a>に移動します");
		setTimeout(redirect, waitnum * 1000);

	}
	else
	{
		$("body > table").before("<a href='" + r + "' target='_blank'>外部ログサイト*</a>");
	}



})(jQuery);