Open Discuz Link in new tab

Discuz论坛链接默认新链接打开,支持autopager和Super_preloader

目前為 2014-04-07 提交的版本,檢視 最新版本

// ==UserScript==
// @name			Open Discuz Link in new tab
// @description		Discuz论坛链接默认新链接打开,支持autopager和Super_preloader
// @namespace	Lkytal
// @icon			http://lkytal.qiniudn.com/ic.ico
// @include		http://*/forum-*-*
// @include		http://*/forum-*-*.html
// @include		http://*/showforum-*.html
// @include		http://*/forum.php?mod=forumdisplay*
// @include		http://*/forum/viewforum.php?f=*
// @include		http://*/forum/search.php?*
// @include		https://*/forum-*-*
// @include		https://*/forum-*-*.html
// @include		https://*/showforum-*.html
// @include		https://*/forum.php?mod=forumdisplay*
// @include		https://*/forum/viewforum.php?f=*
// @include		https://*/forum/search.php?*
// @exclude		http://tieba.baidu.com/*
// @require 		http://libs.baidu.com/jquery/2.0.0/jquery.min.js
// @version		1.2.2
// @grant			GM_xmlhttpRequest
// @grant			GM_addStyle
// @grant			unsafeWindow
// ==/UserScript==

if (window != window.top || window.document.title == "") {
	return;
}
	
var x = document.getElementById('atarget');

if( x )
{
	//x.click();
	unsafeWindow.setatarget(1);
}
else
{
	$('a[onClick="atarget(this)"]').attr("target", "_blank").removeAttr("onClick");

	document.addEventListener('AutoPagerAfterInsert',function()
		{
			$('div[id*=apBreakStart]').last().nextAll().find('a[onClick="atarget(this)"]').attr("target", "_blank").removeAttr("onClick");
		}
	);

	document.addEventListener('Super_preloaderPageLoaded', function()
	    {
			$('div.sp-separator').last().nextAll().find('a[onClick="atarget(this)"]').attr("target", "_blank").removeAttr("onClick");
	    }
	);	
}