futaba log search

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

目前為 2015-03-16 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);