重定向优化百度搜狗谷歌必应搜
! function ( ) {
let isdebug = false ;
let isLocalDebug = isdebug || false ;
let debug = isdebug ? console. log. bind ( console) : function ( ) { } ;
let acCssLoadFlag = false ;
let inExtMode = typeof ( isExtension) != "undefined" ;
let inGMMode = typeof ( GM_info. scriptHandler) != "undefined" ;
let isNewGM = typeof ( GM_info. scriptHandler) != "undefined" && GM_info. scriptHandler. toLowerCase ( ) == "greasemonkey" ;
let useCNLan = true ;
debug ( "程序开始" ) ;
if ( inExtMode == true && inGMMode == true ) {
console. log ( "扩展模式-脚本不启用" ) ;
return ;
}
if ( typeof ( GM ) == "undefined" ) {
GM = { } ;
GM . setValue = GM_setValue;
GM . getValue = GM_getValue;
}
( function ( ) {
debug ( "程序执行" ) ;
let needDisplayNewFun = true ;
if ( window. NodeList && ! NodeList. prototype. forEach) {
NodeList. prototype. forEach = function ( callback, thisArg) {
thisArg = thisArg || window;
for ( var i = 0 ; i < this . length; i++ ) {
callback. call ( thisArg, this [ i] , i, this ) ;
}
} ;
}
if ( ! Array. prototype. acpush) {
Array. prototype. acpush = function ( data, callback) {
if ( data == null ) return ;
if ( data. replace ( /({|}|,|\+|:|。|\n)/ ) != data) return ;
if ( this . findIndex ( m => m == data) < 0 ) {
this . push ( data) ;
callback && callback ( this ) ;
}
} ;
Array. prototype. acremove = function ( data, callback) {
let delId = this . findIndex ( m => m == data) ;
if ( delId >= 0 ) {
this . splice ( delId, 1 ) ;
callback && callback ( this ) ;
}
} ;
}
let ACConfig = { } ;
let DefaultConfig = {
isRedirectEnable: false ,
isAdsEnable: false ,
isAutopage: true ,
isBlockEnable: false ,
isBlockDisplay: false ,
isBlockBtnDisplay: true ,
AdsStyleEnable: true ,
AdsStyleMode_Baidu: 2 ,
AdsStyleMode_Google: 2 ,
AdsStyleMode_Bing: 3 ,
AdsStyleMode_SoGou: 3 ,
HuYan_Baidu: false ,
HuYan_Google: false ,
HuYan_Bing: false ,
HuYan_SoGou: false ,
Style_BaiduLite: false ,
defaultHuYanColor: "#DEF1EF" ,
isUserColorEnable: true ,
isFaviconEnable: true ,
defaultFaviconUrl: "https://ae01.alicdn.com/kf/HTB1dRY0X8OD3KVjSZFFq6An9pXay.jpg" ,
doDisableSug: true ,
isRightDisplayEnable: false ,
isCounterEnable: false ,
isALineEnable: false ,
isUserStyleEnable: false ,
isEnLang: false ,
isGooleInBaiduModeEnable: false ,
UserBlockList: [ ] ,
UserStyleText:
`/**计数器的颜色样式*/
div .AC-CounterT{
background: #FD9999;
}
/**右侧栏的样式-其实不开启更好看一些*/
#content_right{
padding: 20px 15px 15px;
border-radius: 5px;
background-color: #fff;
box-sizing: border-box;
box-shadow: 0 0 20px 2px rgba(0, 0, 0, .1);
-webkit-box-shadow: 0 0 20px 2px rgba(0, 0, 0, .1);
-moz-box-shadow: 0 0 20px 2px rgba(0, 0, 0, .1);
}
/****可以加一些自己的背景图片,替换引号内的内容为可外链的图片即可****/
body{
background-repeat: repeat-y;
background-size: 100%;
background-attachment:fixed;
background-image: url('https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1564756277250&di=868b9eac9be14df1dedd8c7d6a710844&imgtype=0&src=http%3A%2F%2Fphotocdn.sohu.com%2F20130530%2FImg377502333.jpg');
}
/*****窗口背景的透明虚化效果*****/
body>#wrapper,body>.wrap,body>#main,body #appbar,body #hdtbSum{
background: rgba(225,225,225,0.8);
}
/**隐藏首页的大图标-修复可能导致外援样式异常**/
body[baidu] #s_lg_img_new{
display:none !important;
}
#wrapper #content_left .result, #wrapper #content_left .c-container{
border-radius: 5px;
}` ,
oldVersion: "" ,
lastSaveTime: new Date ( ) . getTime ( ) ,
} ;
let CONST = {
hasNewFuncNeedDisplay: true ,
sortIndex: 1 ,
isGoogleImageUrl: false ,
AdsStyleMode: ACConfig. AdsStyleMode_Baidu,
keySite: "baidu" ,
StyleManger: function ( ) { } ,
curHosts: [ ] ,
} ;
let curSite = {
SiteTypeID: 1 ,
MainType: "" ,
Stype_Normal: "" ,
FaviconType: "" ,
FaviconAddTo: "" ,
CounterType: "" ,
BlockType: "" ,
} ;
let DBSite = {
baidu: {
SiteTypeID: 1 ,
MainType: "#content_left .c-container" ,
Stype_Normal: "h3.t>a, #results .c-container>.c-blocka" ,
FaviconType: ".result-op, .c-showurl" ,
FaviconAddTo: "h3" ,
CounterType: "#content_left>#double>div[srcid] *[class~=t],[class~=op_best_answer_question],#content_left>div[srcid] *[class~=t],[class~=op_best_answer_question]" ,
BlockType: "h3 a" ,
pager: {
nextLink: '//div[@id="page"]/a[contains(text(),"下一页")][@href]' ,
pageElement: "css;div#content_left > *" ,
HT_insert: [ "css;div#content_left" , 2 ] ,
replaceE: "css;#page" ,
stylish: ".autopagerize_page_info, div.sp-separator {margin-bottom: 10px !important;}" ,
}
} ,
sogou: {
SiteTypeID: 2 ,
MainType: "#main .results>div" ,
Stype_Normal: "h3.pt>a, h3.vrTitle>a" ,
FaviconType: "cite[id*='cacheresult_info_']" ,
FaviconAddTo: "h3" ,
CounterType: ".results>div" ,
BlockType: "h3 a" ,
pager: {
nextLink: "//div[@id=\"pagebar_container\"]/a[@id=\"sogou_next\"]" ,
pageElement: "//div[@class=\"results\"]" ,
HT_insert: [ "//div[@class=\"results\"]" , 2 ] ,
replaceE: "id(\"pagebar_container\")"
}
} ,
haosou: {
SiteTypeID: 3 ,
MainType: ".res-list" ,
Stype_Normal: ".res-list h3>a" ,
FaviconType: ".res-linkinfo cite" ,
FaviconAddTo: "h3" ,
CounterType: ".results>div" ,
BlockType: "h3 a" ,
pager: {
nextLink: "//div[@id=\"page\"]/a[text()=\"下一页>\"] | id(\"snext\")" ,
pageElement: "//div[@id=\"container\"]/div" ,
HT_insert: [ "//div[@id=\"container\"]" , 1 ] ,
replaceE: "id(\"page\")"
}
} ,
google: {
SiteTypeID: 4 ,
MainType: "#rso .g *[class~=rc]" ,
FaviconType: ".iUh30" ,
FaviconAddTo: "h3" ,
CounterType: "#rso .g *[class~=r] h3,._yE>div[class~=_kk] h3" ,
BlockType: ".rc>.r>a" ,
pager: {
nextLink: 'id("pnnext") | id("navbar navcnt nav")//td[span]/following-sibling::td[1]/a | id("nn")/parent::a' ,
pageElement: '//div[@id="res"]' ,
HT_insert: [ "css;#res" , 2 ] ,
replaceE: '//div[@id="navcnt"] | //div[@id="foot"][@role="navigation"]'
}
} ,
bing: {
SiteTypeID: 5 ,
MainType: "#b_results>li" ,
FaviconType: ".b_attribution>cite" ,
FaviconAddTo: "h2" ,
CounterType: "#b_results>li[class~=b_ans]>h2,#b_results>li[class~=b_algo]>h2,#b_results>li[class~=b_algo]>h2" ,
BlockType: "h2 a" ,
pager: {
nextLink: "//a[contains(@class,\"sb_pagN\")]" ,
pageElement: "id(\"b_results\")/li[not(contains(@class,\"b_pag\") or contains(@class,\"b_ans b_top\"))]" ,
HT_insert: [ "id(\"b_results\")/li[@class=\"b_pag\"]" , 1 ] ,
replaceE: "id(\"b_results\")//nav[@role=\"navigation\"]" ,
}
} ,
mBaidu: {
SiteTypeID: 6 ,
MainType: "#b_results>li" ,
FaviconType: ".b_attribution>cite" ,
FaviconAddTo: "h2" ,
CounterType: "#b_results>li[class~=b_ans]>h2,#b_results>li[class~=b_algo]>h2,#b_results>li[class~=b_algo]>h2" ,
BlockType: "h2 a" ,
} ,
zhihu: {
SiteTypeID: 7 ,
} ,
baidu_xueshu: {
SiteTypeID: 8 ,
MainType: "#content_left .result" ,
Stype_Normal: "h3.t>a, #results .c-container>.c-blocka" ,
FaviconType: ".result-op, .c-showurl" ,
FaviconAddTo: "h3" ,
CounterType: "#content_left>#double>div[srcid] *[class~=t],[class~=op_best_answer_question],#content_left>div[srcid] *[class~=t],[class~=op_best_answer_question]" ,
BlockType: "h3 a" ,
} ,
other: {
SiteTypeID: 9 ,
}
} ;
let SiteType = {
BAIDU : DBSite. baidu. SiteTypeID,
MBAIDU : DBSite. mBaidu. SiteTypeID,
SOGOU : DBSite. sogou. SiteTypeID,
SO : DBSite. haosou. SiteTypeID,
GOOGLE : DBSite. google. SiteTypeID,
BING : DBSite. bing. SiteTypeID,
ZHIHU : DBSite. zhihu. SiteTypeID,
BAIDU_XUESHU : DBSite. baidu_xueshu. SiteTypeID,
OTHERS : 8
} ;
Promise. all ( [ GM . getValue ( "Config" ) ] ) . then ( function ( data) {
if ( data[ 0 ] != null ) {
try {
ACConfig = JSON . parse ( data[ 0 ] ) ;
} catch ( e ) {
ACConfig = data[ 0 ] ;
}
} else {
ACConfig = DefaultConfig;
}
for ( var key in DefaultConfig) {
if ( typeof ( ACConfig[ key] ) == "undefined" ) {
ACConfig[ key] = DefaultConfig[ key] ;
}
}
if ( ACConfig. isUserStyleEnable == false && ( new Date ( ) . getTime ( ) - ACConfig. lastSaveTime > 2592000000 ) ) {
console. log ( "ac-baidu css reset for time" ) ;
ACConfig. lastSaveTime = new Date ( ) . getTime ( ) ;
ACConfig. UserStyleText = DefaultConfig. UserStyleText;
}
useCNLan = ! ACConfig. isEnLang;
callback ( ) ;
} ) . catch ( function ( except) {
console. log ( except) ;
} ) ;
function Reg_Get ( HTML , reg) {
let RegE = new RegExp ( reg) ;
try {
return RegE. exec ( HTML ) [ 1 ] ;
} catch ( e ) {
return "" ;
}
}
function getElementByXpath ( e, t, r) {
r = r || document, t = t || r;
try {
return r. evaluate ( e, t, null , XPathResult. FIRST_ORDERED_NODE_TYPE , null ) . singleNodeValue;
} catch ( t ) {
return void console. error ( "无效的xpath" ) ;
}
}
function getAllElementsByXpath ( e, t, r) {
return r = r || document, t = t || r, r. evaluate ( e, t, null , XPathResult. ORDERED_NODE_SNAPSHOT_TYPE , null ) ;
}
function getAllElements ( e, t, r, n, o) {
var i, s = [ ] ;
if ( ! e) return s;
if ( r = r || document, n = n || window, o = o || void 0 , t = t || r, "string" == typeof e) i = 0 === e. search ( /^css;/i ) ? function getAllElementsByCSS ( e, t) {
return ( t || document) . querySelectorAll ( e) ;
} ( e. slice ( 4 ) , t) : getAllElementsByXpath ( e, t, r) ; else {
if ( ! ( i = e ( r, n, o) ) ) return s;
if ( i. nodeType) return s[ 0 ] = i, s;
}
return function makeArray ( e) {
var t, r, n, o = [ ] ;
if ( e. pop) {
for ( t = 0 , r = e. length; t < r; t++ ) ( n = e[ t] ) && ( n. nodeType ? o. push ( n) : o = o. concat ( makeArray ( n) ) ) ;
return a ( ) ( o) ;
}
if ( e. item) {
for ( t = e. length; t; ) o[ -- t] = e[ t] ;
return o;
}
if ( e. iterateNext) {
for ( t = e. snapshotLength; t; ) o[ -- t] = e. snapshotItem ( t) ;
return o;
}
} ( i) ;
}
function callback ( ) {
if ( ACConfig. oldVersion == GM_info. script. version) {
CONST . hasNewFuncNeedDisplay = false ;
} else {
CONST . hasNewFuncNeedDisplay = needDisplayNewFun;
}
! function ( ) {
let BaiduVersion = " V" + GM_info. script. version;
let insertLocked = false ;
if ( GM_getResourceText) {
let config = GM_getResourceText ( "SiteConfigRules" ) ;
eval ( config) ;
if ( typeof ( onlineDB) != "undefined" ) DBSite = onlineDB;
}
if ( location. host. indexOf ( "xueshu.baidu.com" ) > - 1 ) {
curSite = DBSite. baidu_xueshu;
} else if ( location. host. indexOf ( ".baidu.com" ) > - 1 ) {
if ( navigator. userAgent. replace ( /(android|mobile|iphone)/igm , "" ) != navigator. userAgent) {
curSite = DBSite. mBaidu;
} else {
curSite = DBSite. baidu;
}
} else if ( location. host. indexOf ( "zhihu.com" ) > - 1 ) {
curSite = DBSite. zhihu;
} else if ( location. host. indexOf ( "sogou" ) > - 1 ) {
curSite = DBSite. sogou;
} else if ( location. host. indexOf ( "so.com" ) > - 1 ) {
curSite = DBSite. haosou;
} else if ( location. host. indexOf ( "google" ) > - 1 ) {
curSite = DBSite. google;
} else if ( location. host. indexOf ( "bing" ) > - 1 ) {
curSite = DBSite. bing;
} else {
curSite = DBSite. other;
}
curSite. pageNum = 1 ;
curSite. pageLoading = false ;
curSite. pageUrl = "" ;
if ( curSite. SiteTypeID == SiteType. GOOGLE && location. href. replace ( /tbm=(isch|lcl|shop|flm)/ , "" ) != location. href) {
console. log ( "特殊站,不加载样式,不添加menu" ) ;
CONST . isGoogleImageUrl = true ;
}
if ( ACConfig. AdsStyleEnable) {
if ( curSite. SiteTypeID == SiteType. BAIDU ) {
CONST . AdsStyleMode = ACConfig. AdsStyleMode_Baidu;
CONST . HuYanMode = ACConfig. HuYan_Baidu;
CONST . keySite = "baidu" ;
} else if ( curSite. SiteTypeID == SiteType. GOOGLE ) {
CONST . AdsStyleMode = ACConfig. AdsStyleMode_Google;
CONST . HuYanMode = ACConfig. HuYan_Google;
CONST . keySite = "google" ;
} else if ( curSite. SiteTypeID == SiteType. BING ) {
CONST . AdsStyleMode = ACConfig. AdsStyleMode_Bing;
CONST . HuYanMode = ACConfig. HuYan_Bing;
CONST . keySite = "bing" ;
} else if ( curSite. SiteTypeID == SiteType. SOGOU ) {
CONST . AdsStyleMode = ACConfig. AdsStyleMode_SoGou;
CONST . HuYanMode = ACConfig. HuYan_SoGou;
CONST . keySite = "sogou" ;
} else if ( curSite. SiteTypeID == SiteType. BAIDU_XUESHU ) {
CONST . AdsStyleMode = 2 ;
}
CONST . StyleManger = FSBaidu ( ) ;
}
console. log ( "%c[AC-Redirect] %cLet Me Introduce you a Very Good Search Engine:%c %s %cSearch Engine." , "font-weight:bold;color:cornflowerblue" , "color:0" , "font-weight:bold;color:darkorange" , CONST . keySite. replace ( CONST . keySite[ 0 ] , CONST . keySite[ 0 ] . toUpperCase ( ) ) , "font-weight:normal;color:0" ) ;
let bodyNameresetTimer = setInterval ( function ( ) {
if ( document. body != null ) {
document. body. setAttribute ( CONST . keySite, "1" ) ;
if ( curSite. SiteTypeID == SiteType. BAIDU && location. href. indexOf ( "tn=news" ) >= 0 ) {
document. body. setAttribute ( "news" , "1" ) ;
} else {
document. body. removeAttribute ( "news" ) ;
}
}
} , 300 ) ;
let SiteBlock = {
initStyle: function ( ) {
AC_addStyle ( "button.ghhider.ghhb[ac-user-alter='1']::before{content:'取消 - ';}#sp-ac-container .ac-block-item{color:#AAA;margin-left:48px;}#sp-ac-container .ac-block-itemdel{float:right;margin-left:0;padding:0 20px;cursor:pointer;}#sp-ac-container .ac-block-itemdel:hover{color:red;}#sp-ac-container .ac-block-high{color:#000;}.ac-blockList li:hover{background-color:#a3caff;color:white !important;cursor:pointer;} *[ac-needhide] *{display:none} *[ac-needhide] .blockShow{display:unset;cursor:pointer;} *[ac-needhide] .blockShow:hover{border:1px solid #DDD}button.ghhider{color:#555;background-color:#fcfcfc;font-family:sans-serif;font-size:.85em;margin:auto 2px;border:1px solid #ccc;border-radius:4px;padding:2px 3px}h3>button.ghhider{font-size:.75em}button.ghhider:hover{color:#006aff;background:#fff}" ,
"AC-BlockStyle" ) ;
} ,
init: function ( ) {
let checkNodes = document. querySelectorAll ( curSite. MainType+ ":not([acblock])" ) ;
for ( let i = 0 ; i < checkNodes. length; i++ ) {
try {
let curNode = checkNodes[ i] ;
let faviconNode = curNode. querySelector ( curSite. FaviconType) ;
let host = getBaiduHost ( faviconNode) ;
let faNode = curNode. querySelector ( curSite. BlockType) ;
let nodeStyle = "display:unset;" ;
if ( ! ACConfig. isBlockBtnDisplay) {
nodeStyle = "display:none;" ;
}
faNode. insertAdjacentHTML ( "afterend" , `${ faviconNode. href || faviconNode. innerText} " meta=" ${ host} " data-host=" ${ host} " title='点击即可屏蔽 ${ host} 放开,需要在自定义中手动配置放开'>block` ) ;
curNode. setAttribute ( "acblock" , "0" ) ;
curNode. setAttribute ( "acblock" , "0" ) ;
} catch ( e ) {
}
}
this . initListener ( ) ;
this . renderDisplay ( ) ;
} ,
initListener: function ( ) {
let checkNodes = document. querySelectorAll ( "button.ghhider:not([acEnv])" ) ;
for ( let i = 0 ; i < checkNodes. length; i++ ) {
checkNodes[ i] . addEventListener ( "click" , this . doHideEnv) ;
checkNodes[ i] . setAttribute ( "acEnv" , "0" ) ;
}
} ,
doHideEnv: function ( env) {
let node = env. sourceTarget || env. target;
let host = node. dataset. host;
if ( node. getAttribute ( "ac-user-alter" ) == 1 ) {
node. removeAttribute ( "ac-user-alter" ) ;
ACConfig. UserBlockList. acremove ( host) ;
GM . setValue ( "Config" , JSON . stringify ( ACConfig) ) ;
} else {
node. removeAttribute ( "ac-user-alter" ) ;
ACConfig. UserBlockList. acpush ( host) ;
GM . setValue ( "Config" , JSON . stringify ( ACConfig) ) ;
}
reloadBlockList ( ) ;
SiteBlock. renderDisplay ( ) ;
env. stopPropagation ( ) ;
} ,
renderDisplay: function ( ) {
let checkNodes = document. querySelectorAll ( curSite. MainType) ;
let flag = "ac-needhide" ;
for ( let i = 0 ; i < checkNodes. length; i++ ) {
try {
let curNode = checkNodes[ i] ;
let curHost = getBaiduHost ( curNode. querySelector ( curSite. FaviconType) ) ;
if ( curHost == null ) continue ;
{
let BlockBtn = curNode. querySelector ( ".ghhider.ghhb" ) ;
BlockBtn. dataset. host = BlockBtn. dataset. meta = curHost;
}
if ( curNode. querySelector ( "button[ac-user-alter]" ) != null ) continue ;
if ( ACConfig. UserBlockList. findIndex (
m => {
try {
return new RegExp ( m. replace ( "*" , ".*" ) ) . test ( curHost) ;
} catch ( e) {
return m == curHost;
}
}
) >= 0 ) {
if ( ! curNode. hasAttribute ( flag) ) {
if ( ACConfig. isBlockDisplay) {
curNode. remove ( ) ;
continue ;
}
let curTitle = curNode. querySelector ( curSite. BlockType) ;
curTitle = curTitle. innerText || curTitle. textContent;
curNode. insertAdjacentHTML ( "afterBegin" , `${ curTitle} -block by ${ curHost} ` ) ;
curNode. setAttribute ( flag, "1" ) ;
( function ( xcur) {
xcur. querySelector ( ".blockShow" ) . addEventListener ( "click" , function ( env) {
this . parentNode. querySelector ( "button.ghhider" ) . setAttribute ( "ac-user-alter" , "1" ) ;
xcur. removeAttribute ( flag) ;
safeFunction ( function ( ) {
xcur. querySelector ( ".blockShow" ) . remove ( ) ;
} ) ;
env. stopPropagation ( ) ;
} ) ;
} ) ( curNode) ;
}
} else {
curNode. removeAttribute ( flag) ;
safeFunction ( function ( ) {
curNode. querySelector ( ".blockShow" ) . remove ( ) ;
} ) ;
}
} catch ( e ) {
}
}
}
} ;
function addStyle ( css) {
let pi = document. createProcessingInstruction (
'xml-stylesheet' ,
'type="text/css" must="false" href="data:text/css;utf-8,' + encodeURIComponent ( css) + '"'
) ;
return document. insertBefore ( pi, document. documentElement) ;
}
if ( ACConfig. isAdsEnable) {
addStyle ( "#bottomads{display:none;} #content_left>div:not([id])>div[cmatchid], #content_left>div[id*='300']:not([class*='result']),#content_right td>div:not([id]),#content_right>br{position:absolute;top:-6666px;}" ) ;
}
if ( curSite. SiteTypeID == SiteType. GOOGLE && ACConfig. isGooleInBaiduModeEnable) {
safeWaitFunc ( "#logo img, #logocont img" , function ( node) {
let faNode = node. parentNode. parentNode;
faNode. classList. add ( "baidu" ) ;
node. removeAttribute ( "src" ) ;
node. src = "https://pic.rmb.bdstatic.com/c86255e8028696139d3e3e4bb44c047b.png" ;
node. width = "125" ;
node. removeAttribute ( "height" ) ;
} ) ;
safeWaitFunc ( "#main .logo img[alt='Google']" , function ( node) {
node. removeAttribute ( "srcset" ) ;
node. src = "https://www.baidu.com/img/bd_logo1.png?where=super" ;
node. setAttribute ( "height" , "129" ) ;
node. style = "padding-top: 59px;" ;
} , 300 ) ;
safeWaitFunc ( "form[role='search'] .logo img" , function ( node) {
node. removeAttribute ( "srcset" ) ;
node. src = "https://www.baidu.com/img/bd_logo1.png?where=super" ;
node. setAttribute ( "height" , "129" ) ;
node. style = "padding-top: 59px;" ;
} , 300 ) ;
document. title = document. title. replace ( /^Google/ , "百度一下,你就知道" )
. replace ( / - Google 搜索/ , "_百度搜索" )
. replace ( / - Google Search/ , "_百度搜索" ) ;
safeWaitFunc ( "head" , function ( ) {
console. log ( "缇欧换" ) ;
let linkTarget = document. querySelector ( "link[type='image/x-icon']" ) || document. createElement ( 'link' ) ;
linkTarget. type = 'image/x-icon' ;
linkTarget. rel = 'shortcut icon' ;
linkTarget. href = 'https://www.baidu.com/favicon.ico' ;
document. head. appendChild ( linkTarget) ;
} )
}
try {
if ( curSite. SiteTypeID != SiteType. OTHERS ) {
document. addEventListener ( 'DOMNodeInserted' , MainCallback, false ) ;
document. addEventListener ( 'keyup' , MainCallback, false ) ;
RAFFunction ( function ( ) {
rapidDeal ( ) ;
} , 800 ) ;
}
} catch ( e ) {
console. log ( e) ;
}
function MainCallback ( e) {
if ( e. target != null && typeof ( e. target. className) == "string" && e. target. className. toUpperCase ( ) . indexOf ( "AC-" ) == 0 ) {
return ;
}
rapidDeal ( ) ;
}
function ShowSearchBox ( ) {
}
function ac_spfunc ( e) {
e. stopPropagation ( ) ;
var t, r = e. currentTarget;
var Tween = {
Linear: function Linear ( e, t, r, n) {
return r * e / n + t;
} ,
Quad: {
easeIn: function easeIn ( e, t, r, n) {
return r * ( e /= n) * e + t;
} ,
easeOut: function easeOut ( e, t, r, n) {
return - r * ( e /= n) * ( e - 2 ) + t;
} ,
easeInOut: function easeInOut ( e, t, r, n) {
return ( e /= n / 2 ) < 1 ? r / 2 * e * e + t : - r / 2 * ( -- e * ( e - 2 ) - 1 ) + t;
}
} ,
Cubic: {
easeIn: function easeIn ( e, t, r, n) {
return r * ( e /= n) * e * e + t;
} ,
easeOut: function easeOut ( e, t, r, n) {
return r * ( ( e = e / n - 1 ) * e * e + 1 ) + t;
} ,
easeInOut: function easeInOut ( e, t, r, n) {
return ( e /= n / 2 ) < 1 ? r / 2 * e * e * e + t : r / 2 * ( ( e -= 2 ) * e * e + 2 ) + t;
}
} ,
Quart: {
easeIn: function easeIn ( e, t, r, n) {
return r * ( e /= n) * e * e * e + t;
} ,
easeOut: function easeOut ( e, t, r, n) {
return - r * ( ( e = e / n - 1 ) * e * e * e - 1 ) + t;
} ,
easeInOut: function easeInOut ( e, t, r, n) {
return ( e /= n / 2 ) < 1 ? r / 2 * e * e * e * e + t : - r / 2 * ( ( e -= 2 ) * e * e * e - 2 ) + t;
}
} ,
Quint: {
easeIn: function easeIn ( e, t, r, n) {
return r * ( e /= n) * e * e * e * e + t;
} ,
easeOut: function easeOut ( e, t, r, n) {
return r * ( ( e = e / n - 1 ) * e * e * e * e + 1 ) + t;
} ,
easeInOut: function easeInOut ( e, t, r, n) {
return ( e /= n / 2 ) < 1 ? r / 2 * e * e * e * e * e + t : r / 2 * ( ( e -= 2 ) * e * e * e * e + 2 ) + t;
}
} ,
Sine: {
easeIn: function easeIn ( e, t, r, n) {
return - r * Math. cos ( e / n * ( Math. PI / 2 ) ) + r + t;
} ,
easeOut: function easeOut ( e, t, r, n) {
return r * Math. sin ( e / n * ( Math. PI / 2 ) ) + t;
} ,
easeInOut: function easeInOut ( e, t, r, n) {
return - r / 2 * ( Math. cos ( Math. PI * e / n) - 1 ) + t;
}
} ,
Expo: {
easeIn: function easeIn ( e, t, r, n) {
return 0 == e ? t : r * Math. pow ( 2 , 10 * ( e / n - 1 ) ) + t;
} ,
easeOut: function easeOut ( e, t, r, n) {
return e == n ? t + r : r * ( 1 - Math. pow ( 2 , - 10 * e / n) ) + t;
} ,
easeInOut: function easeInOut ( e, t, r, n) {
return 0 == e ? t : e == n ? t + r : ( e /= n / 2 ) < 1 ? r / 2 * Math. pow ( 2 , 10 * ( e - 1 ) ) + t : r / 2 * ( 2 - Math. pow ( 2 , - 10 * -- e) ) + t;
}
} ,
Circ: {
easeIn: function easeIn ( e, t, r, n) {
return - r * ( Math. sqrt ( 1 - ( e /= n) * e) - 1 ) + t;
} ,
easeOut: function easeOut ( e, t, r, n) {
return r * Math. sqrt ( 1 - ( e = e / n - 1 ) * e) + t;
} ,
easeInOut: function easeInOut ( e, t, r, n) {
return ( e /= n / 2 ) < 1 ? - r / 2 * ( Math. sqrt ( 1 - e * e) - 1 ) + t : r / 2 * ( Math. sqrt ( 1 - ( e -= 2 ) * e) + 1 ) + t;
}
} ,
Elastic: {
easeIn: function easeIn ( e, t, r, n, a, o) {
return 0 == e ? t : 1 == ( e /= n) ? t + r : ( o || ( o = .3 * n) , ! a || a < Math. abs ( r) ? ( a = r,
i = o / 4 ) : i = o / ( 2 * Math. PI ) * Math. asin ( r / a) , - a * Math. pow ( 2 , 10 * ( e -= 1 ) ) * Math. sin ( ( e * n - i) * ( 2 * Math. PI ) / o) + t) ;
var i;
} ,
easeOut: function easeOut ( e, t, r, n, a, o) {
return 0 == e ? t : 1 == ( e /= n) ? t + r : ( o || ( o = .3 * n) , ! a || a < Math. abs ( r) ? ( a = r,
i = o / 4 ) : i = o / ( 2 * Math. PI ) * Math. asin ( r / a) , a * Math. pow ( 2 , - 10 * e) * Math. sin ( ( e * n - i) * ( 2 * Math. PI ) / o) + r + t) ;
var i;
} ,
easeInOut: function easeInOut ( e, t, r, n, a, o) {
return 0 == e ? t : 2 == ( e /= n / 2 ) ? t + r : ( o || ( o = n * ( .3 * 1.5 ) ) , ! a || a < Math. abs ( r) ? ( a = r,
i = o / 4 ) : i = o / ( 2 * Math. PI ) * Math. asin ( r / a) , e < 1 ? a * Math. pow ( 2 , 10 * ( e -= 1 ) ) * Math. sin ( ( e * n - i) * ( 2 * Math. PI ) / o) * - .5 + t : a * Math. pow ( 2 , - 10 * ( e -= 1 ) ) * Math. sin ( ( e * n - i) * ( 2 * Math. PI ) / o) * .5 + r + t) ;
var i;
}
} ,
Back: {
easeIn: function easeIn ( e, t, r, n, a) {
return null == a && ( a = 1.70158 ) , r * ( e /= n) * e * ( ( a + 1 ) * e - a) + t;
} ,
easeOut: function easeOut ( e, t, r, n, a) {
return null == a && ( a = 1.70158 ) , r * ( ( e = e / n - 1 ) * e * ( ( a + 1 ) * e + a) + 1 ) + t;
} ,
easeInOut: function easeInOut ( e, t, r, n, a) {
return null == a && ( a = 1.70158 ) , ( e /= n / 2 ) < 1 ? r / 2 * ( e * e * ( ( 1 + ( a *= 1.525 ) ) * e - a) ) + t : r / 2 * ( ( e -= 2 ) * e * ( ( 1 + ( a *= 1.525 ) ) * e + a) + 2 ) + t;
}
} ,
Bounce: {
easeIn: function easeIn ( e, t, r, n) {
return r - Tween. Bounce. easeOut ( n - e, 0 , r, n) + t;
} ,
easeOut: function easeOut ( e, t, r, n) {
return ( e /= n) < 1 / 2.75 ? r * ( 7.5625 * e * e) + t : e < 2 / 2.75 ? r * ( 7.5625 * ( e -= 1.5 / 2.75 ) * e + .75 ) + t : e < 2.5 / 2.75 ? r * ( 7.5625 * ( e -= 2.25 / 2.75 ) * e + .9375 ) + t : r * ( 7.5625 * ( e -= 2.625 / 2.75 ) * e + .984375 ) + t;
} ,
easeInOut: function easeInOut ( e, t, r, n) {
return e < n / 2 ? .5 * Tween. Bounce. easeIn ( 2 * e, 0 , r, n) + t : .5 * Tween. Bounce. easeOut ( 2 * e - n, 0 , r, n) + .5 * r + t;
}
}
} , TweenM = [ "Linear" , "Quad" , "Cubic" , "Quart" , "Quint" , "Sine" , "Expo" , "Circ" , "Elastic" , "Back" , "Bounce" ] , TweenEase = [ "easeIn" , "easeOut" , "easeInOut" ] ;
var prefs = {
s_method: 3 ,
s_ease: 2 ,
s_FPS: 60 ,
s_duration: 333 ,
} ;
function getRelativeDiv ( e) {
var t = r. id;
return ( t = t. replace ( /(sp-separator-)(.+)/ , ( function ( t, r, n) {
return r + String ( Number ( n) + ( "pre" == e ? - 1 : 1 ) ) ;
} ) ) ) ? document. getElementById ( t) : null ;
}
function sp_transition ( e, t) {
var r = sp_transition. TweenF;
r || ( r = ( r = Tween[ TweenM[ prefs. s_method] ] ) [ TweenEase[ prefs. s_ease] ] || r, sp_transition. TweenF = r) ;
var n = 1e3 / prefs. s_FPS, a = 0 , o = e, i = t - e, s = Math. ceil ( prefs. s_duration / n) , c = window. scrollX;
! function transition ( ) {
var e = Math. ceil ( r ( a, o, i, s) ) ;
window. scroll ( c, e) , a < s && ( a++ , setTimeout ( transition, n) ) ;
} ( ) ;
}
function scrollIt ( e, t) {
sp_transition ( e, t) ;
}
switch ( e. target. id) {
case "sp-sp-gotop" :
scrollIt ( window. scrollY, 0 ) ;
break ;
case "sp-sp-gopre" :
var n = getRelativeDiv ( "pre" ) ;
if ( ! n) return ;
t = window. scrollY;
var a = n. getBoundingClientRect ( ) . top;
a = t - ( r. getBoundingClientRect ( ) . top - a) ;
scrollIt ( t, a) ;
break ;
case "sp-sp-gonext" :
var o = getRelativeDiv ( "next" ) ;
if ( ! o) return ;
t = window. scrollY;
var i = o. getBoundingClientRect ( ) . top;
i = t + ( - r. getBoundingClientRect ( ) . top + i) ;
scrollIt ( t, i) ;
break ;
case "sp-sp-gobottom" :
scrollIt ( window. scrollY, Math. max ( document. documentElement. scrollHeight, document. body. scrollHeight) ) ;
}
}
function windowscroll ( fn ) {
var beforeScrollTop = document. documentElement. scrollTop,
fn = fn || function ( ) { } ;
window. addEventListener ( "scroll" , function ( e) {
var afterScrollTop = document. documentElement. scrollTop,
delta = afterScrollTop - beforeScrollTop;
if ( delta === 0 ) return false ;
fn ( delta > 0 ? "down" : "up" , e) ;
beforeScrollTop = afterScrollTop;
} , false ) ;
}
windowscroll ( function ( direction, e) {
if ( direction === "down" ) {
let spl = document. querySelector ( "#sp-fw-a_enable" ) ;
if ( ACConfig. isAutopage == true && ! ( spl && spl. checked == true ) ) {
var scrollTop = document. documentElement. scrollTop || window. pageYOffset || document. body. scrollTop;
let scrollDelta = 666 ;
if ( curSite. SiteTypeID == SiteType. GOOGLE ) scrollDelta = 1024 ;
if ( document. documentElement. scrollHeight <= document. documentElement. clientHeight + scrollTop + scrollDelta && curSite. pageLoading == false ) {
curSite. pageLoading = true ;
ShowPager. loadMorePage ( ) ;
}
}
}
} ) ;
var ShowPager = {
getFullHref: function ( e) {
"string" != typeof e && ( e = e. getAttribute ( "href" ) ) ;
var t = this . getFullHref. a;
return t || ( this . getFullHref. a = t = document. createElement ( "a" ) ) , t. href = e, t. href;
} ,
createDocumentByString : function ( e) {
if ( e) {
if ( "HTML" != document. documentElement. nodeName) return ( new DOMParser ) . parseFromString ( e, "application/xhtml+xml" ) ;
var t;
try {
t = ( new DOMParser ) . parseFromString ( e, "text/html" ) ;
} catch ( e ) { }
if ( t) return t;
if ( document. implementation. createHTMLDocument) t = document. implementation. createHTMLDocument ( "superPreloader" ) ; else try {
( t = document. cloneNode ( ! 1 ) ) . appendChild ( t. importNode ( document. documentElement, ! 1 ) ) ,
t. documentElement. appendChild ( t. createElement ( "head" ) ) , t. documentElement. appendChild ( t. createElement ( "body" ) ) ;
} catch ( e ) { }
if ( t) {
var r = document. createRange ( ) ;
r. selectNodeContents ( document. body) ;
var n = r. createContextualFragment ( e) ;
t. body. appendChild ( n) ;
for ( var a, o = {
TITLE : ! 0 ,
META : ! 0 ,
LINK : ! 0 ,
STYLE : ! 0 ,
BASE : ! 0
} , i = t. body, s = i. childNodes, c = s. length - 1 ; c >= 0 ; c-- ) o[ ( a = s[ c] ) . nodeName] && i. removeChild ( a) ;
return t;
}
} else console. error ( "[AC-Script]" , "没有找到要转成DOM的字符串" ) ;
} ,
loadMorePage : function ( ) {
if ( curSite. pager) {
let curPageEle = getElementByXpath ( curSite. pager. nextLink) ;
var url = this . getFullHref ( curPageEle) ;
var sepImgs = {
top: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNrclE0rRGEUx8c1GUpRJIVIZGdhZCVr38GGhaI0ZXwCkliglChZEcvJxhdgYWOjLEUpm/EyiLzze+o8dTzdO3PljoVTv7rPc8/5d+6555xYrEhWop6boda5+6l9wjWcWpF+WIbqCJJ9hFRcDr3QAIkIhKugz5PDfkSixkphz5aiAnqgE8rgWRxGoSOPyBkswQuUwyscw4HrmFCZL8Kt/JAg7mEFPEmo4FdPwk0BUcsdzIap0TQ8qMAPuICcEjLnd+VjSjcfJNgIc/DkZGSymYGsnK9EZMrxe4MFaNGiZjC2fT5zQ3p7QDK1dR2GSljziclAvRUe8nHYVA4jjvC43NfAuk/smB2QNqcsWxKcLbAKTFnS0hWD6n27Fd6FLqiDI5iQmQ9jpiVT0sNJ6aYd7dAE3QHBbinSAX5JWWaxuLo8F35jh/bBK9Y+/r/Cl6pLcnna8NvuDGMnslpbZRpXZYT/3r4EGACZL3ZL2afNFAAAAABJRU5ErkJggg==" ,
bottom: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAXFJREFUeNrM1c8rBGEcx/FdtCEkLqYtpdwkKSUHUhxwITdK+Z3yM2cOLnJ39Cc44SgHScmJwlFxsIdlCScO6/2t76Onp52dXTtbnno1M8+Pz84+zzMzkcg/KA3oRTzM0A4cI4VTdIUVPIM3pPGO5aABJTkGx1BqjYmFFZxW7nnBwXmXogWX6bEGc2jEIU7+kNWDUSSwZyqndSvJ3N1g2Bm0oLtB2j+w7rQP4MpqXzRT0YRaPW/BthMedYLs60HsoE2vq9BsPwAJa8XFLUa0fUrvROo/saT1Q9adGimdlt8yj6TT6Q6d2vaida9YRbtP6EqmBZC5fHA6X+AAz1bwEc6cfk9+oaZM4NoZJL70+J2hTaZtNpet041zK8yP/Mgl+rOF1emr0UM1xnAfEPyISd0Jno6vtx+QuM6PZ22lpO7dbEV2Siv6rPeIjNs1HdYC7ixfG+YBqdTVDqPIv6iIWvO7iXGUFxAqi72PraJ9IH8EGACQcYjYRd5GHwAAAABJRU5ErkJggg==" ,
pre: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAASlJREFUeNpiYBjOoBiIrwJxFRAzUsvQViD+CMT/gfgTEPdRy9BPUENh+AsQ91JiaAuSS9HxZ3INb8Hi0v+UurwF6qL/ROBvQNxDrKFfkTT+A+JnQPwBKfJA/L9Ian7ic7kMEHcC8Q80F3UAcRsQv4by30INaUJT9weaWhSQDRUB4uVYvLkYiAWAOBopvEFBlArEPEA8G4ue9UAsATM4EYuCJUgKMtAMLoSKCwPxXCx6c1igClTQgmUZVPNrHMEGy3mgYCkCYiYgTkCSV4UZvA2IjYBYDIgvQbPvOyJTECid5wHxbyA2BuL3QLwRWYEsEJvg0IweFEU41IEMlgcxWJAEH0MxJeAsjMFEq6Jw+Br8BimVfMCTDEkG7EBcA8T3oWUJx4DVYwABBgCannnSzbgwIQAAAABJRU5ErkJggg==" ,
next: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAT1JREFUeNrc1b1KA0EYheEl/iARFFEkKl6D0UK8CrEVrCwEexFCtBIlRWIjsfEiLL0FKzs7QUWxM2piFMUkvhPOwLAs2TGuCn7wkNll5jC7+w0Jgv9avdjAObbQn1TwCu7QwhWW4xakPIOHMKzxGCaSCm6ioXHLZ0Hqpz7KrwRPIvvNvBlM2zYyNY8cMjhDHo9fCBzErnIqKNjgRSxpvIABbOLes2MKWHfuXdhXcR2avKrJ4zGhI9gLhQbq9XaZgGO1kutIOzIHpKp7NawhjYOINSeY6lFwHacw17P6NTWHd4xqnNbcS83LObtsaCPbEW+gXUW8ODswC27xoOsn3ODDmfOGss9XLuE54jGjvPqGuuG1mFDzZIfdNHynnde7DbW1r5DwTstJHP2iE55YqD36ebXZDvr+7L/sU4ABAIpVZWnoA5GkAAAAAElFTkSuQmCC" ,
next_gray: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAtxJREFUeNrclc9L2mEcx7/6NbVZqRVj7pIOlIUuZ1HMgv0BDcqT7JrskH13ELPBF7eTvz10HznWQBlBRIfBXIfBLmqXscvYZWPKrMNIU9Apmrr34/w6i0ovMZjw+H0+z/N8Xt+Pn/fn80hR/+WHYRhBIpFwRKPRz/F4/KnD4RB28xH0Ah4cHHyoUCjsIpFIIZPJHkml0m9Yfn2ZD78XcL1eH6rValIMCmMUtqKbD7/HbNQxaq15oxcH/lXpcmXgtnh2u/2mXC6/DqE+sSxLlUqlniE0TVPBYJAqFot6+GV9Pt+PJthms80sLS2xEonkhlgs/jgwMOBcXV3N5fP5rlCcp9bX1yWLi4uecrk8U6lUshDY3wRbLJYFGKZsNksq4N78/LwY9hOn05k5Ojqi+PzTGePxeFwZUl6vd8hkMvkPDg6sZJ2M5eXlr1wqUu2kA5JOpy2IAO+oO9fW1n5mMpk2nDjmcjkKNU25XC652Wx2pVIp65mXJ2nyjUPpqakpNZxuA8Y5T87OzsobjcYHpVKpGhsbe1CtVkXYqxQKhTdqtfqL1Wr1JpPJxxyU5Lq/vz8aCoX8TTDatYiFhF6vxx5tAJwm8OPj48m5ubmKSqUaAWwSa9eQw6JGo/luNBoNh4eHbAe0JhAINsLh8LNAIJCiudhxB+Qh2ludTifDAQLvI3AIch+Rkl8jJlrhCbOqgfoLmDepOF/BfGNra2sFFZFtvqgzMbFYjAiyp9Vqh4VC4cTJyYmQ90epIQJtHRO1bA5aRhAvdnZ2GI/H87cEz5YPgeOS2RsfHx9B7u+gOi68yQAtYX9zd3eXgZCna/s8By5ypGUUzhOISHgO9BfWXwG6chZ6IbiVc6LwnsFgGIVAepLzjk4rYW1ze3ubcbvd53fjZV2FaqGQ63fT09PDMO9i9BEoon0J9Rm/339xm3dr2f39fVLX7wFvoMVvoYWfRyIRFndD/Z/8nf0WYAA8EC1Z/ZNm4gAAAABJRU5ErkJggg==" ,
pre_gray: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAslJREFUeNrclTtMWmEUxz/uvTzlIUhpNMR0aGNjrNHSmHTqRJyadujQDbSGRwJUaYCmDizqUEw6ODVNGgbpYCfSpFINCQzFR9oyMXRsXFCsAXkIKNL/R7gGWxOsSdPEk5zc3O+e87vn+59zv0vIpbSJiQmyubn5LBKJpNbX11+4XC5Buxy2XYDNZiMOh2OW4ziPTCbTi8XikeHh4SsSieQTXnIxsN1uJ1ardVYgEDgPDw+V9Xqd1Go1Mcuyg7AuuVy+sra29ndgVEnGx8dnhEKhs1qtKgE/eXZ8fCzC+q3+/n6tSqVaSSQS5wM7nU5iMplmsF1XpVI5BeXt6OhIBFkGAe9SKpV/wNmzKjWbzRT6tFwuK86CUqPrkIVWPjQwMKBWKBSn4Ozv0LGxsRmRSDSFSjua0Do8TRWAS+B5+B68g/IhixCNvQPN1WjuieZsS/f1aNQ0wzBuaCqlUCQRtVr9Es1K4kVDWJNhrQjAIiqMlkqle804FnkjBoOhEzv4vrGxkW2ALRaLFrq+QoAV2nE8tLe3dzEYDE5vb2939vX1PcBkiKVSaQ1jForFYq+NRqMum83ebsYzmJq7sGu4xhkKxsDfB/AxnO860ev1oeXlZU8gEMgmk0kFqmw8o9dUKiWfn58vhMPh54h7S+OpQXNSLBYfejyeR1yzw9dbRon09PS8W11dnfL5fJl8Pk+0Wi3hk5vyCNBY4vV6f0Im9+joKJNOp818o8G70ah4aWnpIzSKYCa/dXd3B+PxuHNycjKzs7NzAms1+qFQy+VydDRz0WjUpdPp3tB8TFM0FAqFGxXPzc19plJrNJqraMoXt9tNt3Suc+Tg4ICeJfmFhQVLoVAwoKG7fr//B8cHAL6Fy9ZFDinaG/r5w77ya8y/OhEvKRhjtIup2YMTeBb3mXY53HnAmNkP+/v7NzHTTwAO4f79f/ud/RJgAOLcRNZqLojMAAAAAElFTkSuQmCC" ,
} ;
AC_addStyle ( ".sp-separator{line-height:1.8 !important;opacity:1 !important;position:relative !important;float:none !important;top:0 !important;left:0 !important;min-width:366px;width:auto;text-align:center !important;font-size:14px !important;display:block !important;padding:3px 0 !important;margin:5px 10px 8px;clear:both !important;border-style:solid !important;border-color:#cccccc !important;border-width:1px !important;-moz-border-radius:30px !important;border-radius:30px !important;background-color:#ffffff !important;}.sp-separator:hover{box-shadow:0 0 11px rgba(33,33,33,0.2);}#sp-separator-hover{display:none;}.sp-separator:hover #sp-separator-hover{display:block;}.sp-separator .sp-someinfo{position:absolute !important;right:10px !important;font-size:12px !important;font-style:italic !important;background:none !important;}.sp-separator span{vertical-align: middle;cursor: pointer;padding: 0;margin: 0 5px;display: inline-block; width:22px;height:22px;}.sp-separator a{margin:0 20px 0 -6px !important;display:inline !important;text-shadow:#fff 0 1px 0 !important;background:none !important;color:#595959 !important;}.sp-separator input{padding:0 !important;line-height:23px !important;}.sp-separator .sp-md-span{font-weight:bold !important;margin:0 20px !important;}#sp-sp-md-number{width:6ch !important;vertical-align:middle !important;display:inline-block !important;text-align:left !important;}" +
`.ac_sp_top{background-image:url(' ${ sepImgs. top} ')}` +
`.ac_sp_pre{background-image:url(' ${ sepImgs. pre} ')}` +
`.ac_sp_next{background-image:url(' ${ sepImgs. next} ')}` +
`.ac_sp_bottom{background-image:url(' ${ sepImgs. bottom} ')}` +
`.ac_sp_next_gray{background-image:url(' ${ sepImgs. next_gray} ')}` +
`.ac_sp_pre_gray{background-image:url(' ${ sepImgs. pre_gray} ')}` ,
"AC-Preload" )
if ( curSite. pageUrl === url) {
console. error ( "[AC-Script]" , "翻页到达底部了 - 或者异常 - 出现异常请直接反馈作者修改" ) ;
return ;
}
curSite. pageUrl = url;
curSite. pager. startFilter && curSite. pager. startFilter ( ) ;
GM_xmlhttpRequest ( {
url: url,
method: "GET" ,
timeout: 5000 ,
onload: function ( response) {
try {
var newBody = ShowPager. createDocumentByString ( response. responseText) ;
let pageElems = getAllElements ( curSite. pager. pageElement, newBody) ;
let toElement = getAllElements ( curSite. pager. HT_insert[ 0 ] ) [ 0 ] ;
if ( pageElems. length >= 0 ) {
let nextEs = document. querySelectorAll ( "#sp-sp-gonext" ) ;
if ( nextEs. length > 0 ) {
let lastE = nextEs[ nextEs. length- 1 ] ;
lastE. classList. replace ( "ac_sp_next_gray" , "ac_sp_next" ) ;
}
curSite. pageNum++ ;
let addTo = "beforeend" ;
if ( curSite. pager. HT_insert[ 1 ] == 1 ) addTo = "beforebegin" ;
toElement. insertAdjacentHTML ( addTo, ``
. replace ( /ACX/gm , curSite. pageNum) ) ;
pageElems. forEach ( function ( one) {
toElement. insertAdjacentElement ( addTo, one) ;
} ) ;
document. querySelectorAll ( ".sp-separator.AC:not([bind])" ) . forEach ( function ( per) {
per. setAttribute ( "bind" , 1 ) ;
per. addEventListener ( "click" , ac_spfunc) ;
} ) ;
try {
let oriE = getAllElements ( curSite. pager. replaceE) ;
let repE = getAllElements ( curSite. pager. replaceE, newBody) ;
if ( oriE. length == repE. length) {
for ( var i = 0 ; i < oriE. length; i++ ) {
oriE[ i] . innerHTML = repE[ i] . innerHTML;
}
}
} catch ( e ) {
console. log ( e) ;
}
}
} catch ( e ) {
console. log ( e) ;
}
curSite. pageLoading = false ;
} ,
onerror: function ( ) {
curSite. pageLoading = false ;
}
} ) ;
}
} ,
} ;
function AutoRefresh ( ) {
if ( ! ACConfig. isRightDisplayEnable) {
AC_addStyle ( "#content_right{display:none !important;}#content_right td>div:not([id]){display:none;}#content_right .result-op:not([id]){display:none!important;}#rhs{display:none;}" ,
"AC-RightRemove" ) ;
} else {
if ( CONST . AdsStyleMode == 2 ) {
AC_addStyle ( "@media screen and (min-width: 1250px) {#container{width: 80% !important;}.container_l #content_right{margin-right: calc(18% - 210px);position: absolute;right: -200px;display:block !important;overflow:hidden;width: 22vw !important;}" ,
"AC-RightRemove" ) ;
}
}
if ( ! ACConfig. isALineEnable) {
AC_addStyle ( "a,a em{text-decoration:none}" , "AC-NoLine" ) ;
}
if ( ACConfig. isUserStyleEnable) {
AC_addStyle ( ACConfig. UserStyleText, "AC-userStyle" ) ;
}
AC_addStyle (
".opr-recommends-merge-imgtext{display:none!important;}" +
".res_top_banner{display:none!important;}" +
".headBlock, body>div.result-op{display:none;}"
, "AC-special-BAIDU"
) ;
AC_addStyle ( ".newFuncHighLight{color:red;font-weight: 100;background-color: yellow;font-weight: 600;}#sp-ac-container label{display:inline;}#u{width:319px}#u #myuser{display:inline}#myuser,#myuser .myuserconfig{padding:0;margin:0}#myuser{display:inline-block;}#myuser .myuserconfig{display:inline-block;line-height:1.5;background:#2866bd;color:#fff;font-weight:700;text-align:center;padding:6px;border:2px solid #E5E5E5;}#myuser .myuserconfig{box-shadow:0 0 10px 3px rgba(0,0,0,.1)}#myuser .myuserconfig:hover{background:#2970d4 !important;color:#fff;cursor:pointer;border:2px solid #73A6F8;}" ,
"AC-MENU_Btn" ) ;
AC_addStyle ( 'body[baidu] #sp-ac-container .container-label:not([class*="baidu"])>label,\n' +
' body[google] #sp-ac-container .container-label:not([class*="google"])>label,\n' +
' body[bing] #sp-ac-container .container-label:not([class*="bing"])>label,\n' +
' body[sogou] #sp-ac-container .container-label:not([class*="sogou"])>label,\n' +
' body[baidu] #sp-ac-container .container-label:not([class*="baidu"])>br,\n' +
' body[google] #sp-ac-container .container-label:not([class*="google"])>br,\n' +
' body[bing] #sp-ac-container .container-label:not([class*="bing"])>br,\n' +
' body[sogou] #sp-ac-container .container-label:not([class*="sogou"])>br,\n' +
' body[baidu] #sp-ac-container .container-label[class*="baidu"]>labelhide,\n' +
' body[google] #sp-ac-container .container-label[class*="google"]>labelhide,\n' +
' body[bing] #sp-ac-container .container-label[class*="bing"]>labelhide,\n' +
' body[sogou] #sp-ac-container .container-label[class*="sogou"]>labelhide\n' +
'{' +
'display:none;\n' +
'}#sp-ac-container labelHide{cursor:pointer;margin-left:8%;color:blue}#sp-ac-container .linkhref,#sp-ac-container labelHide:hover{color:red}#sp-ac-container .linkhref:hover{font-weight:bold}#sp-ac-container label.menu-box-small{max-width:16px;max-height:16px;cursor:pointer;display:inline-block}.AC-CounterT{background:#FD9999}body > #sp-ac-container{position:fixed;top:3.9vw;right:8.8vw}#sp-ac-container{z-index:999999;text-align:left;background-color:white}#sp-ac-container *{font-size:13px;color:black;float:none}#sp-ac-main-head{position:relative;top:0;left:0}#sp-ac-span-info{position:absolute;right:1px;top:0;font-size:10px;line-height:10px;background:none;font-style:italic;color:#5a5a5a;text-shadow:white 0px 1px 1px}#sp-ac-container input{vertical-align:middle;display:inline-block;outline:none;height:auto;padding:0px;margin-bottom:0px;margin-top:0px}#sp-ac-container input[type="number"]{width:50px;text-align:left}#sp-ac-container input[type="checkbox"]{border:1px solid #B4B4B4;padding:1px;margin:3px;width:13px;height:13px;background:none;cursor:pointer;visibility:visible;position:static}#sp-ac-container input[type="button"]{border:1px solid #ccc;cursor:pointer;background:none;width:auto;height:auto}#sp-ac-container li{list-style:none;margin:3px 0;border:none;float:none;cursor:default;}#sp-ac-container fieldset{border:2px groove #ccc;-moz-border-radius:3px;border-radius:3px;padding:4px 9px 6px 9px;margin:2px;display:block;width:auto;height:auto}#sp-ac-container legend{line-height:20px;margin-bottom:0px}#sp-ac-container fieldset > ul{padding:0;margin:0}#sp-ac-container ul#sp-ac-a_useiframe-extend{padding-left:40px}#sp-ac-rect{position:relative;top:0;left:0;float:right;height:10px;width:10px;padding:0;margin:0;-moz-border-radius:3px;border-radius:3px;border:1px solid white;-webkit-box-shadow:inset 0 5px 0 rgba(255,255,255,0.3),0 0 3px rgba(0,0,0,0.8);-moz-box-shadow:inset 0 5px 0 rgba(255,255,255,0.3),0 0 3px rgba(0,0,0,0.8);box-shadow:inset 0 5px 0 rgba(255,255,255,0.3),0 0 3px rgba(0,0,0,0.8);opacity:0.8}#sp-ac-dot,#sp-ac-cur-mode{position:absolute;z-index:9999;width:5px;height:5px;padding:0;-moz-border-radius:3px;border-radius:3px;border:1px solid white;opacity:1;-webkit-box-shadow:inset 0 -2px 1px rgba(0,0,0,0.3),inset 0 2px 1px rgba(255,255,255,0.3),0px 1px 2px rgba(0,0,0,0.9);-moz-box-shadow:inset 0 -2px 1px rgba(0,0,0,0.3),inset 0 2px 1px rgba(255,255,255,0.3),0px 1px 2px rgba(0,0,0,0.9);box-shadow:inset 0 -2px 1px rgba(0,0,0,0.3),inset 0 2px 1px rgba(255,255,255,0.3),0px 1px 2px rgba(0,0,0,0.9)}#sp-ac-dot{right:-3px;top:-3px}#sp-ac-cur-mode{left:-3px;top:-3px;width:6px;height:6px}#sp-ac-content{padding:0;margin:0px;-moz-border-radius:3px;border-radius:3px;border:1px solid #A0A0A0;-webkit-box-shadow:-2px 2px 5px rgba(0,0,0,0.3);-moz-box-shadow:-2px 2px 5px rgba(0,0,0,0.3);box-shadow:-2px 2px 5px rgba(0,0,0,0.3)}#sp-ac-main{padding:5px;border:1px solid white;-moz-border-radius:3px;border-radius:3px;background-color:#F2F2F7;background:-moz-linear-gradient(top,#FCFCFC,#F2F2F7 100%);background:-webkit-gradient(linear,0 0,0 100%,from(#FCFCFC),to(#F2F2F7))}#sp-ac-foot{position:relative;left:0;right:0;min-height:20px}#sp-ac-savebutton{position:absolute;top:0;right:2px}#sp-ac-container .endbutton{margin-top:8px}#sp-ac-container .sp-ac-spanbutton{border:1px solid #ccc;-moz-border-radius:3px;border-radius:3px;padding:2px 3px;cursor:pointer;background-color:#F9F9F9;-webkit-box-shadow:inset 0 10px 5px white;-moz-box-shadow:inset 0 10px 5px white;box-shadow:inset 0 10px 5px white}#sp-ac-container .sp-ac-spanbutton:hover{background-color:#DDD}label[class="newFunc"]{color:blue}' ,
"AC-MENU_Page" ) ;
}
AutoRefresh ( ) ;
try {
GM_registerMenuCommand ( 'AC-重定向脚本设置' , function ( ) {
document. querySelector ( "#sp-ac-content" ) . style. display = 'block' ;
} ) ;
} catch ( e ) {
}
function getSearchValue ( ) {
let kvl = location. search. substr ( 1 ) . split ( "&" ) ;
let searchV = "" ;
for ( let i = 0 ; i < kvl. length; i++ ) {
let value = kvl[ i] . replace ( /^(wd|query|q)=/ , "" ) ;
if ( value != kvl[ i] ) {
searchV = value;
}
}
searchV = searchV. replace ( "+" , " " ) ;
return searchV;
}
function rapidDeal ( ) {
try {
if ( insertLocked == false && curSite. SiteTypeID != SiteType. OTHERS ) {
insertLocked = true ;
InsertSettingMenu ( ) ;
ShowSetting ( ) ;
ACHandle ( ) ;
if ( ACConfig. isAdsEnable) {
removeAD_baidu_sogou ( ) ;
}
if ( ACConfig. AdsStyleEnable) {
FSBaidu ( ) ;
}
if ( ACConfig. isFaviconEnable) {
addFavicon ( document. querySelectorAll ( curSite. FaviconType) ) ;
}
if ( ACConfig. doDisableSug) {
acSetCookie ( "ORIGIN" , 2 , "www.baidu.com" ) ;
acSetCookie ( "ISSW" , 1 ) ;
acSetCookie ( "ISSW" , 1 , "www.baidu.com" ) ;
} else {
acSetCookie ( "ORIGIN" , 1 , "www.baidu.com" ) ;
acSetCookie ( "ISSW" , 1 ) ;
acSetCookie ( "ISSW" , 1 , "www.baidu.com" ) ;
}
if ( ACConfig. isAdsEnable) {
removeAD_baidu_sogou ( ) ;
}
if ( ACConfig. isCounterEnable) {
addCounter ( document. querySelectorAll ( curSite. CounterType) ) ;
}
if ( ACConfig. isBlockEnable && curSite. SiteTypeID != SiteType. SOGOU ) {
SiteBlock. initStyle ( ) ;
SiteBlock. init ( ) ;
}
setTimeout ( function ( ) {
insertLocked = false ;
} , 200 ) ;
}
} catch ( e ) {
console. log ( e) ;
}
function acSetCookie ( cname, cvalue, domain, exdays) {
exdays = exdays || 30 ;
let d = new Date ( ) ;
domain = ( domain ? "domain=" + domain : "" ) + ";" ;
d. setTime ( d. getTime ( ) + ( exdays * 24 * 60 * 60 * 1000 ) ) ;
let expires = "expires=" + d. toUTCString ( ) ;
document. cookie = cname + "=" + cvalue + "; " + domain + expires + ";path=/" ;
}
}
function AutoLoadCustomCSS ( ) {
var cssValue = document. querySelector ( "#sp-ac-userstyleTEXT" ) . value;
AC_addStyle ( cssValue, "AC-userStyle" , "head" , true ) ;
}
function getBaiduHost ( sitetpNode) {
if ( curSite. SiteTypeID == SiteType. BAIDU ) {
var href = null ;
if ( sitetpNode instanceof HTMLElement ) {
href = sitetpNode. getAttribute ( "href" )
}
if ( href != null && href. indexOf ( "baidu.com/link" ) < 0 ) {
return getHost ( href) ;
}
}
return getHost ( sitetpNode. innerText || sitetpNode. textContent) ;
}
function ACHandle ( ) {
if ( curSite. SiteTypeID == SiteType. OTHERS || curSite. SiteTypeID == SiteType. SOGOU ) return ;
if ( ACConfig. isRedirectEnable) {
if ( curSite. Stype_Normal != null && curSite. Stype_Normal != "" ) {
resetURLNormal ( document. querySelectorAll ( curSite. Stype_Normal) ) ;
if ( checkISBaiduMain ( ) ) {
document. querySelectorAll ( ".s_form .index-logo-src[src*='gif'], .s_form .index-logo-srcnew[src*='gif']" ) . forEach ( function ( per) {
per. src = "https://pic.rmb.bdstatic.com/c86255e8028696139d3e3e4bb44c047b.png" ;
} ) ;
}
}
if ( curSite. SiteTypeID == SiteType. GOOGLE ) removeOnMouseDownFunc ( ) ;
if ( curSite. SiteTypeID == SiteType. MBAIDU ) removeMobileBaiduDirectLink ( ) ;
removeRedirectLinkTarget ( ) ;
safeRemove ( ".res_top_banner" ) ;
}
try {
if ( ! document. querySelector ( "#sp-ac-style" ) . checked) {
document. querySelectorAll ( "input[name*='sp-ac-a_force_style_']" ) . forEach ( per => { per. setAttribute ( "disabled" , "disabled" ) ; per. parentNode. setAttribute ( "title" , "请开启自定义样式" ) } ) ;
} else {
document. querySelectorAll ( "input[name*='sp-ac-a_force_style_']" ) . forEach ( per => { per. removeAttribute ( "disabled" ) ; per. parentNode. setAttribute ( "title" , "AC-自定义样式内容" ) } ) ;
}
if ( ! document. querySelector ( "#sp-ac-block" ) . checked) {
document. querySelectorAll ( "#sp-ac-removeBlock, #sp-ac-blockBtnDisplay" ) . forEach ( per => { per. setAttribute ( "disabled" , "disabled" ) ; per. parentNode. setAttribute ( "title" , "请开启自定义样式" ) } ) ;
} else {
document. querySelectorAll ( "#sp-ac-removeBlock, #sp-ac-blockBtnDisplay" ) . forEach ( per => { per. removeAttribute ( "disabled" ) ; per. parentNode. setAttribute ( "title" , "AC-自主拦截功能" ) } ) ;
}
} catch ( e ) {
}
}
function ACtoggleSettingDisplay ( e) {
e. stopPropagation ( ) ;
if ( document. querySelector ( ".iframe-father iframe" ) == null ) {
document. querySelector ( ".iframe-father" ) . insertAdjacentHTML ( "beforeend" , "" ) ;
}
setTimeout ( function ( ) {
if ( document. querySelector ( "#sp-ac-content" ) . style. display == 'block' ) {
document. querySelector ( "#sp-ac-content" ) . style. display = 'none' ;
} else {
ACConfig. oldVersion = GM_info. script. version;
GM . setValue ( "Config" , JSON . stringify ( ACConfig) ) ;
document. querySelector ( ".ac-newversionDisplay" ) . style. display = 'none' ;
document. querySelector ( "#sp-ac-content" ) . style. display = 'block' ;
}
} , 100 ) ;
return false ;
}
function getBlockList ( ) {
let insHTML = "" ;
for ( let i = 0 ; i < ACConfig. UserBlockList. length; i++ ) {
let insClass = CONST . curHosts. findIndex ( m => {
try {
return new RegExp ( ACConfig. UserBlockList[ i] . replace ( "*" , ".*" ) ) . test ( m) ;
} catch ( e) {
return m == ACConfig. UserBlockList[ i] ;
}
} ) >= 0 ? " ac-block-high" : "" ;
insHTML += `${ insClass} " data-host=" ${ ACConfig. UserBlockList[ i] } "> ${ ACConfig. UserBlockList[ i] } ${ ACConfig. UserBlockList[ i] } ">x\n` ;
}
return insHTML;
}
function reloadBlockList ( ) {
document. querySelector ( ".ac-blockList ul" ) . innerHTML = getBlockList ( ) ;
}
function initBlockPage ( ) {
try {
if ( useCNLan) {
document. querySelector ( ".setting-second" ) . innerHTML = `<-返回 拦截列表 想要生效的话需要手动保存 ${ getBlockList ( ) } 全匹配拦截:新增 `;
} else {
document. querySelector ( ".setting-second" ) . innerHTML = `<-Back Block List Click Save Button if you want wo save the list ${ getBlockList ( ) } Same host Insert :Insert `;
}
document. querySelector ( "#sp-ac-blockdiybutton-back" ) . addEventListener ( "click" , function ( ) {
document. querySelector ( ".setting-main" ) . style = "" ;
document. querySelector ( ".setting-second" ) . style = "display:none;" ;
} ) ;
document. querySelector ( ".ac-blockList" ) . addEventListener ( "click" , function ( e) {
let target = e. srcElement || e. target;
if ( target. tagName. toLowerCase ( ) == "label" ) {
let host = target. dataset. host;
ACConfig. UserBlockList. acremove ( host, function ( ) {
document. querySelectorAll ( "button[ac-user-alter]" ) . forEach ( function ( perNode) {
perNode. removeAttribute ( "ac-user-alter" ) ;
} ) ;
SiteBlock. renderDisplay ( ) ;
reloadBlockList ( ) ;
} ) ;
}
} ) ;
function ckAddRule ( ) {
let inputN = document. querySelector ( ".sp-ac-addRuleOne" ) ;
ACConfig. UserBlockList. acpush ( inputN. value, reloadBlockList) ;
inputN. value = "" ;
}
document. querySelector ( "#sp-ac-addRulebutton" ) . addEventListener ( "click" , ckAddRule) ;
document. querySelector ( ".sp-ac-addRuleOne" ) . addEventListener ( "keypress" , function ( evt) {
let e = evt || window. event;
if ( e. keyCode == 13 ) ckAddRule ( ) ;
} ) ;
} catch ( e ) {
}
}
function ShowSetting ( ) {
if ( curSite. SiteTypeID == SiteType. OTHERS ) return ;
if ( document. body != null && document. querySelector ( "#sp-ac-container" ) == null ) {
let Container = document. createElement ( 'div' ) ;
Container. id = "sp-ac-container" ;
if ( useCNLan) {
Container. innerHTML =
" " ;
} else {
Container. innerHTML =
" " ;
}
try {
document. body. appendChild ( Container) ;
} catch ( e ) {
console. log ( e) ;
}
try {
document. querySelector ( "#sp-ac-savebutton" ) . addEventListener ( "click" , function ( ) {
ACConfig. isRedirectEnable = document. querySelector ( "#sp-ac-redirect" ) . checked;
ACConfig. isEnLang = document. querySelector ( "#sp-ac-isEnLang" ) . checked;
ACConfig. isAdsEnable = document. querySelector ( "#sp-ac-ads" ) . checked;
ACConfig. isAutopage = document. querySelector ( "#sp-ac-isAutopage" ) . checked;
ACConfig. isBlockEnable = document. querySelector ( "#sp-ac-block" ) . checked;
ACConfig. isBlockDisplay = document. querySelector ( "#sp-ac-removeBlock" ) . checked;
ACConfig. isBlockBtnDisplay = ! document. querySelector ( "#sp-ac-blockBtnDisplay" ) . checked;
ACConfig. AdsStyleEnable = document. querySelector ( "#sp-ac-style" ) . checked;
ACConfig. AdsStyleMode_Baidu = document. querySelector ( 'input[name="sp-ac-a_force_style_baidu"]:checked' ) . value;
ACConfig. AdsStyleMode_Google = document. querySelector ( 'input[name="sp-ac-a_force_style_google"]:checked' ) . value;
ACConfig. AdsStyleMode_Bing = document. querySelector ( 'input[name="sp-ac-a_force_style_bing"]:checked' ) . value;
ACConfig. AdsStyleMode_SoGou = document. querySelector ( 'input[name="sp-ac-a_force_style_sogou"]:checked' ) . value;
ACConfig. HuYan_Baidu = document. querySelector ( 'input[name="sp-ac-huyan_style_baidu"]' ) . checked;
ACConfig. Style_BaiduLite = document. querySelector ( 'input[name="sp-ac-a_force_style_baidulite"]' ) . checked;
ACConfig. HuYan_Google = document. querySelector ( 'input[name="sp-ac-huyan_style_google"]' ) . checked;
ACConfig. isGooleInBaiduModeEnable = document. querySelector ( 'input[name="sp-ac-google_in_baidumode"]' ) . checked;
ACConfig. HuYan_Bing = document. querySelector ( 'input[name="sp-ac-huyan_style_bing"]' ) . checked;
ACConfig. HuYan_SoGou = document. querySelector ( 'input[name="sp-ac-huyan_style_sogou"]' ) . checked;
let imgurl = document. querySelector ( "#sp-ac-faviconUrl" ) . value. trim ( ) ;
imgurl = ( imgurl == "https://ws1.sinaimg.cn/large/6a155794ly1foijtdzhxhj200w00wjr5.jpg" ) ? "" : imgurl;
imgurl = ( imgurl == "" || imgurl == null ) ? "https://ae01.alicdn.com/kf/HTB1dRY0X8OD3KVjSZFFq6An9pXay.jpg" : imgurl;
ACConfig. isUserColorEnable = document. querySelector ( "#sp-ac-usercolor" ) . checked;
ACConfig. defaultHuYanColor = document. querySelector ( ".sp-ac-menuhuyanColor" ) . value;
ACConfig. isFaviconEnable = document. querySelector ( "#sp-ac-favicon" ) . checked;
ACConfig. defaultFaviconUrl = imgurl;
ACConfig. doDisableSug = document. querySelector ( "#sp-ac-sug_origin" ) . checked;
ACConfig. isRightDisplayEnable = document. querySelector ( "#sp-ac-right" ) . checked;
ACConfig. isCounterEnable = document. querySelector ( "#sp-ac-counter" ) . checked;
ACConfig. isALineEnable = document. querySelector ( "#sp-ac-aline" ) . checked;
ACConfig. isUserStyleEnable = document. querySelector ( "#sp-ac-userstyle" ) . checked;
if ( ACConfig. isUserStyleEnable) {
ACConfig. UserStyleText = document. querySelector ( "#sp-ac-userstyleTEXT" ) . value. trim ( ) ;
}
ACConfig. lastSaveTime = new Date ( ) . getTime ( ) ;
GM . setValue ( "Config" , JSON . stringify ( ACConfig) ) ;
setTimeout ( function ( ) {
window. location. reload ( ) ;
} , 400 ) ;
} , false ) ;
initBlockPage ( ) ;
document. querySelector ( "#sp-ac-blockdiybutton" ) . addEventListener ( "click" , function ( ) {
document. querySelector ( ".setting-main" ) . style = "display:none;" ;
document. querySelector ( ".setting-second" ) . style = "" ;
} ) ;
document. querySelector ( ".menu-box-container" ) . addEventListener ( "click" , function ( e) {
let cur = e. srcElement || e. target;
if ( typeof ( cur. dataset. color) != "undefined" ) {
document. querySelector ( ".sp-ac-menuhuyanColor" ) . value = cur. dataset. color;
CONST . StyleManger. loadHuYanStyle ( cur. dataset. color) ;
}
e. stopPropagation ( ) ;
} ) ;
document. querySelector ( ".sp-ac-menuhuyanColor" ) . addEventListener ( "input" , function ( e) {
CONST . StyleManger. loadHuYanStyle ( document. querySelector ( ".sp-ac-menuhuyanColor" ) . value) ;
e. stopPropagation ( ) ;
} ) ;
document. querySelectorAll ( "labelHide" ) . forEach ( function ( per) {
per. addEventListener ( "click" , function ( e) {
let cur = e. srcElement || e. target;
let className = cur. parentNode. className. replace ( "container-label " , "" ) ;
AC_addStyle ( ".XX>label,.XX>br{display:unset !important;}.XX>labelhide{display:none !important;}" . replace ( /XX/gm , className) ,
"AC-ShowHideItem-" + className, "body" ) ;
e. stopPropagation ( ) ;
} ) ;
} ) ;
if ( ACConfig. isUserStyleEnable) {
document. querySelector ( "#sp-ac-userstyleTEXT" ) . addEventListener ( "paste" , AutoLoadCustomCSS) ;
document. querySelector ( "#sp-ac-userstyleTEXT" ) . addEventListener ( "keyup" , AutoLoadCustomCSS) ;
document. querySelector ( "#sp-ac-userstyleTEXT" ) . addEventListener ( "change" , AutoLoadCustomCSS) ;
}
} catch ( e ) {
}
}
let allNodes = document. querySelectorAll ( ".AC-faviconT, .AC-CounterT" ) ;
for ( let i = 0 ; i < allNodes. length; i++ ) {
if ( allNodes[ i] . getAttribute ( 'acClick' ) == null ) {
allNodes[ i] . setAttribute ( 'acClick' , '1' ) ;
try {
allNodes[ i] . addEventListener ( 'click' , function ( e) {
return ACtoggleSettingDisplay ( e) ;
} , true ) ;
} catch ( e ) {
console. log ( e) ;
}
}
}
try {
document. querySelector ( "body>#sp-ac-container" ) . addEventListener ( 'click' , function ( e) {
e. stopPropagation ( ) ;
} , false ) ;
document. querySelector ( "body" ) . addEventListener ( 'click' , function ( e) {
safeRemove ( function ( ) {
document. querySelector ( "#sp-ac-content" ) . style. display = 'none' ;
} ) ;
} , false ) ;
document. querySelector ( "#sp-ac-cancelbutton" ) . addEventListener ( 'click' , function ( e) {
safeRemove ( function ( ) {
document. querySelector ( "#sp-ac-content" ) . style. display = 'none' ;
e. stopPropagation ( ) ;
} ) ;
} , false ) ;
} catch ( e ) {
}
}
function removeMobileBaiduDirectLink ( ) {
let nodes = document. querySelectorAll ( "#page #page-bd #results .result:not([ac_redirectStatus])" ) ;
for ( let i = 0 ; i < nodes. length; i++ ) {
let curNode = nodes[ i] ;
safeFunction ( function ( ) {
let curData = JSON . parse ( curNode. dataset. log. replace ( /'/gm , "\"" ) ) ;
let trueLink = curData. mu;
curNode. querySelector ( "article" ) . setAttribute ( "rl-link-href" , trueLink) ;
curNode. querySelectorAll ( "a" ) . forEach ( function ( per) {
per. setAttribute ( "href" , trueLink) ;
} ) ;
} ) ;
curNode. setAttribute ( "ac_redirectStatus" , "1" ) ;
}
}
function removeOnMouseDownFunc ( ) {
try {
let resultNodes = document. querySelectorAll ( ".g .rc .r a" ) ;
for ( let i = 0 ; i < resultNodes. length; i++ ) {
let one = resultNodes[ i] ;
one. setAttribute ( "onmousedown" , "" ) ;
one. setAttribute ( "target" , "_blank" ) ;
}
} catch ( e ) {
console. log ( e) ;
}
}
function removeRedirectLinkTarget ( ) {
if ( curSite. SiteTypeID == SiteType. ZHIHU ) {
let nodes = document. querySelectorAll ( ".RichText a[href*='//link.zhihu.com/?target']" ) ;
for ( let i = 0 ; i < nodes. length; i++ ) {
let url = decodeURIComponent ( nodes[ i] . href. replace ( /https?:\/\/link\.zhihu\.com\/\?target=/ , "" ) ) ;
nodes[ i] . href = url;
}
} else if ( curSite. SiteTypeID == SiteType. BAIDU_XUESHU ) {
let xnodes = document. querySelectorAll ( "a[href*='sc_vurl=http']" ) ;
for ( let j = 0 ; i < xnodes. length; j++ ) {
let xurl = getUrlAttribute ( xnodes[ j] . href, "sc_vurl" , true ) ;
xnodes[ j] . href = xurl;
}
}
}
function getUrlAttribute ( url, attribute, needDecode) {
let searchValueS = ( url. substr ( 1 ) + "" ) . split ( "&" ) ;
for ( let i = 0 ; i < searchValueS. length; i++ ) {
let key_value = searchValueS[ i] . split ( "=" ) ;
let reg = new RegExp ( "^" + attribute + "$" ) ;
if ( reg. test ( key_value[ 0 ] ) ) {
let searchWords = key_value[ 1 ] ;
return needDecode ? decodeURIComponent ( searchWords) : searchWords;
}
}
}
function resetURLNormal ( list) {
for ( var i = 0 ; i < list. length; i++ ) {
let curNode = list[ i] ;
let curhref = curNode. href;
if ( list[ i] != null && list[ i] . getAttribute ( "ac_redirectStatus" ) == null ) {
list[ i] . setAttribute ( "ac_redirectStatus" , "0" ) ;
if ( curhref. indexOf ( "www.baidu.com/link" ) > - 1 ||
curhref. indexOf ( "m.baidu.com/from" ) > - 1 ||
curhref. indexOf ( "www.sogou.com/link" ) > - 1 ||
curhref. indexOf ( "so.com/link" ) > - 1 ) {
( function ( c_curnode, c_curhref) {
let url = c_curhref. replace ( /^http:/ , "https:" ) ;
if ( curSite. SiteTypeID == SiteType. BAIDU && url. indexOf ( "eqid" ) < 0 ) {
url = url + "&wd=&eqid=" ;
}
let gmRequestNode = GM_xmlhttpRequest ( {
extData: c_curhref,
url: url,
headers: { "Accept" : "*/*" , "Referer" : c_curhref. replace ( /^http:/ , "https:" ) } ,
method: "GET" ,
timeout: 5000 ,
onreadystatechange: function ( response) {
DealRedirect ( gmRequestNode, c_curhref, response. responseText, "URL='([^']+)'" )
/ / 这个是在上面无法处理的情况下,备用的 tm- finalurldhdg tm- finalurlmfdh
if ( response. responseHeaders. indexOf ( "tm-finalurl" ) >= 0 ) {
let relURL = Reg_Get ( response. responseHeaders, "tm-finalurl\\w+: ([^\\s]+)" ) ;
if ( relURL == null || relURL == "" || relURL. indexOf ( "www.baidu.com/search/error" ) > 0 ) return ;
DealRedirect ( gmRequestNode, c_curhref, relURL) ;
}
}
} ) ;
} ) ( curNode, curhref) ; / / 传递旧的网址过去,读作c_curhref
}
}
}
}
var DealRedirect = function ( request, curNodeHref, respText, RegText) {
if ( respText == null || typeof ( respText) == "undefined" ) return ;
let resultResponseUrl = "" ;
if ( RegText != null ) {
resultResponseUrl = Reg_Get ( respText, RegText) ;
} else {
resultResponseUrl = respText;
}
if ( resultResponseUrl != null && resultResponseUrl != "" && resultResponseUrl. indexOf ( "www.baidu.com/link" ) < 0 ) {
try {
if ( curSite. SiteTypeID == SiteType. SOGOU ) curNodeHref = curNodeHref. replace ( /^https:\/\/www.sogou.com/ , "" ) ;
let host = getHost ( resultResponseUrl) ;
document. querySelectorAll ( "*[href*='" + curNodeHref + "']" ) . forEach ( function ( per) {
if ( per. querySelector ( "span" ) != null ) {
per. lastChild. insertAdjacentHTML ( "beforeEnd" , " - " + host) ;
}
per. setAttribute ( "ac_redirectStatus" , "2" ) ;
per. setAttribute ( "href" , resultResponseUrl) ;
if ( per. hasAttribute ( "meta" ) ) {
per. setAttribute ( "meta" , host) ;
per. dataset. host = host;
}
} ) ;
CONST . curHosts. acpush ( host, reloadBlockList) ;
request. abort ( ) ;
} catch ( e ) {
/ / console. log ( e) ;
}
}
} ;
function removeAD_baidu_sogou ( ) { / / 移除网站自有广告
if ( curSite. SiteTypeID == SiteType. BAIDU ) {
/ / safeRemove ( ".c-container /deep/ .c-container" ) ;
/ / 移除shadowDOM广告;搜索关键字:淘宝;然后点击搜索框,广告会多次重现shadowdom
safeRemove ( function ( ) {
$ ( '.c-container /deep/ .c-container' ) . has ( '.f13>span:contains("广告")' ) . remove ( ) ;
} ) ;
safeRemove ( function ( ) {
$ ( '#content_right>div' ) . has ( 'a:contains("广告")' ) . remove ( ) ;
} ) ;
/ / 移除标准广告
safeRemove ( function ( ) {
$ ( '#content_left>div' ) . has ( 'span:contains("广告")' ) . remove ( ) ;
} ) ;
/ / 移除右侧栏顶部- 底部无用广告
safeRemove ( function ( ) {
$ ( "#content_right td>div:not([id]),#content_right>br" ) . remove ( ) ;
} ) ;
} else if ( curSite. SiteTypeID == SiteType. MBAIDU ) {
safeRemove ( function ( ) {
$ ( '#page-bd #results>div:not([class*="result"])' ) . remove ( ) ;
} ) ;
safeRemove ( function ( ) {
$ ( '#page-bd #results>div:not([class])' ) . remove ( ) ;
} ) ;
} else if ( curSite. SiteTypeID == SiteType. SOGOU ) {
safeRemove ( "#promotion_adv_container" ) ;
safeRemove ( "#kmap_business_title" ) ;
safeRemove ( "#kmap_business_ul" ) ;
safeRemove ( ".sponsored" ) ;
try {
document. querySelector ( ".rvr-model[style='width:250px;']" ) . style = "display:none" ;
} catch ( e ) {
}
} else if ( curSite. SiteTypeID == SiteType. SO ) {
safeRemove ( "#so_kw-ad" ) ;
safeRemove ( "#m-spread-left" ) ;
safeRemove ( "#m-spread-bottom" ) ;
} else if ( curSite. SiteTypeID == SiteType. BING ) {
safeRemove ( ".b_ad" ) ;
} else if ( curSite. SiteTypeID == SiteType. GOOGLE ) {
safeRemove ( "#bottomads" ) ;
}
}
function IsNumber ( val) {
if ( val === "" || val == null ) {
return false ;
}
if ( ! isNaN ( val) ) {
return true ;
} else {
return false ;
}
}
function addCounter ( citeList) {
let cssText = "position:relative;z-index:1;margin-right:4px;display:inline-block;color:white;font-family:'微软雅黑';font-size:16px;text-align:center;width:22px;line-height:22px;border-radius:50%;" ;
let div = document. createElement ( 'div' ) ;
for ( let i = 0 ; i < citeList. length; i++ ) {
let index = citeList[ i] . getAttribute ( 'SortIndex' ) ;
if ( index== null || typeof ( index) == "undefined" ) {
citeList[ i] . setAttribute ( 'SortIndex' , CONST . sortIndex) ;
citeList[ i] . inner = citeList[ i] . innerHTML;
div. innerHTML = "+ cssText + ">" + CONST . sortIndex + "" ;
citeList[ i] . innerHTML = div. innerHTML + citeList[ i] . inner;
CONST . sortIndex++ ;
} else {
if ( index != ( i + 1 ) % 100 ) {
citeList[ i] . querySelector ( ".AC-CounterT" ) . innerText = ( i + 1 ) % 100 ;
}
}
}
}
function getHost ( sbefore) {
sbefore = ( sbefore && sbefore. trim ( ) ) || "" ;
let send;
let result = sbefore. split ( '-' ) ;
if ( ( result. length > 1 && new RegExp ( "[\\u4E00-\\u9FFF]+" , "g" ) . test ( sbefore) ) && ( curSite. SiteTypeID == SiteType. BAIDU || curSite. SiteTypeID == SiteType. SOGOU ) ) {
sbefore = result[ 1 ] ;
}
send = sbefore. replace ( /(\/[^/]*|\s*)/ , "" ) . replace ( /<[^>]*>/g , "" ) . replace ( /https?:\/\//g , "" ) . replace ( /<\/?strong>/g , "" ) . replace ( /<\/?b>/g , "" ) . replace ( />?/g , "" ) . replace ( /( |\/).*/g , "" ) . replace ( /\.\..*/ , "" ) ;
if ( send. indexOf ( "." ) < 0 ) return null ;
if ( send. indexOf ( "↵" ) >= 0 ) return null ;
return send. trim ( ) ;
}
function addFavicon ( citeList) {
for ( let index = 0 ; index < citeList. length; index++ ) {
if ( null == citeList[ index] . getAttribute ( "ac_faviconStatus" ) ) {
let curNode = citeList[ index] ;
let targetNode = curNode;
let url = getBaiduHost ( targetNode) ;
if ( url == null ) {
continue ;
} else {
CONST . curHosts. acpush ( url) ;
}
let faviconUrl = url;
let II = 0 ;
for ( ; II <= 5 ; II ++ ) {
targetNode = targetNode. parentNode;
if ( targetNode != null && targetNode. querySelector ( curSite. FaviconAddTo) != null ) {
break ;
}
}
if ( II <= 5 ) {
let tmpHTML = targetNode. innerHTML;
let pos = tmpHTML. indexOf ( "fav-url" )
& tmpHTML. indexOf ( "favurl" )
& tmpHTML. indexOf ( "tit-ico" )
& tmpHTML. indexOf ( "img_fav rms_img" )
& tmpHTML. indexOf ( "c-tool-" )
& tmpHTML. indexOf ( "span class=\"c-icon c-icon-" )
& tmpHTML. indexOf ( "img class=\"xA33Gc" ) ;
if ( pos > - 1 ) {
curNode. setAttribute ( "ac_faviconStatus" , "-2" ) ;
continue ;
}
targetNode = targetNode. querySelector ( curSite. FaviconAddTo) ;
let host = faviconUrl. replace ( /[^.]+\.([^.]+)\.([^.]+)/ , "$1.$2" ) ;
if ( targetNode. querySelector ( ".AC-faviconT" ) == null && host. length > 3 ) {
let insNode = document. createElement ( "img" ) ;
curNode. setAttribute ( "ac_faviconStatus" , "1" ) ;
insNode. className = "AC-faviconT" ;
insNode. setAttribute ( "referrerpolicy" , "no-referrer" ) ;
insNode. style = "position:relative;z-index:1;vertical-align:sub;height:16px;width:16px;margin-right:5px;margin-bottom: 2px;" ;
insNode. src = "https://favicon.yandex.net/favicon/" + host;
insNode. setAttribute ( "faviconID" , "0" ) ;
let beforeIndex = 0 ;
if ( targetNode. childNodes[ beforeIndex] . className == "AC-CounterT" ) { beforeIndex = 1 ; }
targetNode. insertBefore ( insNode, targetNode. childNodes[ beforeIndex] ) ;
( function ( xcur) {
insNode. onload = function ( env) {
let imgNode = xcur. querySelector ( ".AC-faviconT" ) ;
if ( imgNode. naturalWidth < 10 ) {
imgNode. setAttribute ( "old-src" , imgNode. src) ;
imgNode. src = ACConfig. defaultFaviconUrl;
}
imgNode. onload = "javascript:void(0);" ;
} ;
} ) ( targetNode) ;
}
}
}
}
}
function InsertSettingMenu ( ) {
if ( ( curSite. SiteTypeID != SiteType. OTHERS ) && document. querySelector ( "#myuser" ) == null ) {
try {
let parent = document. querySelector ( "#u, #gb>div>div>div, #b_header>#id_h, .top-bar .sogou-set-box" ) ;
parent. style = "width: auto;" ;
let userAdiv = document. createElement ( "div" ) ;
userAdiv. id = "myuser" ;
if ( useCNLan) {
userAdiv. innerHTML = " " ;
} else {
userAdiv. innerHTML = " " ;
}
parent. insertBefore ( userAdiv, parent. childNodes[ 0 ] ) ;
document. querySelector ( "#myuser .myuserconfig" ) . addEventListener ( "click" , function ( e) {
return ACtoggleSettingDisplay ( e) ;
} , true ) ;
} catch ( e ) {
}
}
}
} ( ) ;
function RAFFunction ( callback, period) {
let needCount = period / 1000 * 60 ;
let times = 0 ;
let hasFinish = false ;
function step ( ) {
if ( ! hasFinish) requestAnimationFrame ( step) ;
if ( times == 0 ) {
times = needCount;
hasFinish = callback ( ) ;
}
times-- ;
}
requestAnimationFrame ( step) ;
}
function safeFunction ( func) {
safeRemove ( func) ;
}
function safeWaitFunc ( selector, callbackFunc, time, notClear) {
time = time || 50 ;
notClear = notClear || false ;
let doClear = ! notClear;
RAFFunction ( function ( ) {
if ( ( typeof ( selector) == "string" && document. querySelector ( selector) != null ) ) {
callbackFunc ( document. querySelector ( selector) ) ;
if ( doClear) return true ;
} else if ( ( typeof ( selector) == "function" && selector ( ) . length > 0 ) ) {
callbackFunc ( selector ( ) [ 0 ] ) ;
if ( doClear) return true ;
}
} , time) ;
}
function AC_addStyle ( css, className, addToTarget, isReload, initType) {
RAFFunction ( function ( ) {
let addTo = document. querySelector ( addToTarget) ;
if ( typeof ( addToTarget) == "undefined" )
addTo = ( document. head || document. body || document. documentElement || document) ;
isReload = isReload || false ;
initType = initType || "text/css" ;
if ( typeof ( addToTarget) == "undefined" || ( typeof ( addToTarget) != "undefined" && document. querySelector ( addToTarget) != null ) ) {
if ( isReload == true ) {
safeRemove ( "." + className) ;
} else if ( isReload == false && document. querySelector ( "." + className) != null ) {
return true ;
}
let cssNode = document. createElement ( "style" ) ;
if ( className != null ) cssNode. className = className;
cssNode. setAttribute ( "type" , initType) ;
cssNode. innerHTML = css;
try {
addTo. appendChild ( cssNode) ;
} catch ( e ) {
console. log ( e. message) ;
}
return true ;
}
} , 20 ) ;
}
function safeRemove ( cssSelector_OR_NEWfunction) {
if ( typeof ( cssSelector_OR_NEWfunction) == "string" ) {
try {
let removeNodes = document. querySelectorAll ( cssSelector_OR_NEWfunction) ;
for ( let i = 0 ; i < removeNodes. length; i++ )
removeNodes[ i] . remove ( ) ;
} catch ( e ) {
}
} else if ( typeof ( cssSelector_OR_NEWfunction) == "function" ) {
try {
cssSelector_OR_NEWfunction ( ) ;
} catch ( e ) {
}
} else {
console. log ( "未知命令:" + cssSelector) ;
}
}
function checkISBaiduMain ( ) {
return ! ( curSite. SiteTypeID == SiteType. BAIDU && ! ( location. href. replace ( /(&|\?)(wd|word)=/ , "" ) != location. href || document. querySelector ( "#content_left" ) ||
( ( document. querySelector ( "#kw" ) && document. querySelector ( "#kw" ) . getAttribute ( "value" ) ) || "" ) != "" )
)
}
function FSBaidu ( ) {
debug ( "初始化FSBAIDU" ) ;
function checkDocmentHasNode ( nodeClass) {
for ( let i = 0 ; i < document. childNodes. length; i++ ) {
if ( document. childNodes[ i] . data && document. childNodes[ i] . data. indexOf ( nodeClass) > 0 )
return true ;
}
return false ;
}
CONST . StyleManger = {
importStyle: function ( data, toClassName, useNormalCSS, mustLoad) {
if ( typeof ( data) == "undefined" ) {
console. error ( "GM_getResourceText获取内容数据异常" ) ;
return
}
useNormalCSS = useNormalCSS || false ;
mustLoad = mustLoad || false ;
if ( ! useNormalCSS) {
if ( data. indexOf ( "http" ) != 0 ) data = "data:text/css;utf-8," + encodeURIComponent ( data) ;
if ( ! checkDocmentHasNode ( toClassName) ) {
let pi = document. createProcessingInstruction (
"xml-stylesheet" ,
`type="text/css" must=" ${ mustLoad} " class=" ${ toClassName} " href=" ${ data} "`
) ;
document. insertBefore ( pi, document. documentElement) ;
}
} else {
AC_addStyle ( data, toClassName, "head" , false , "text/css" ) ;
}
} ,
loadCommonStyle: function ( ) {
this . loadStyle ( CONST . keySite + "CommonStyle" , CONST . keySite + "CommonStyle" ) ;
} ,
loadBaiduLiteStyle: function ( ) {
CONST . StyleManger. loadStyle ( "baiduLiteStyle" , "baiduLiteStyle" , null , false , true ) ;
CONST . StyleManger. loadPlainToCSS ( "baiduLiteStyle" ) ;
} ,
loadStyle: function ( styleName, insClassName, setUrl, useNormalCSS, mustLoad) {
if ( isLocalDebug) {
debug ( "本地-加载样式:" + insClassName) ;
setUrl = setUrl || "http://127.0.0.1/" + styleName + ".css" ;
this . importStyle ( setUrl, "AC-" + insClassName, useNormalCSS, mustLoad) ;
} else if ( isNewGM == true ) {
debug ( "特殊模式-加载样式:" + insClassName) ;
setUrl = setUrl || "https://baidu.htt5.com/newcss/" + styleName + ".css" ;
this . importStyle ( setUrl, "AC-" + insClassName, useNormalCSS, mustLoad) ;
} else {
debug ( "加载样式:" + insClassName) ;
this . importStyle ( GM_getResourceText ( styleName) , "AC-" + insClassName, useNormalCSS, mustLoad) ;
}
} ,
loadHuYanStyle: function ( color) {
let style = "body[baidu],#wrapper #head,#wrapper #s_tab,form.fm .s_ipt_wr.bg{background-color:#fff}#container #content_left .result-op,#container #content_left .result,#container #rs,#container #content_right{background-color:#aaa;border:1px double #a2d7d4;border-radius:0}#container #content_left .result-op:hover,#container #content_left .result:hover{background-color:#ccc!important}#container #content_left .result-op h3,#container #content_left .c-container h3,#container #rs .tt{background-color:#bbb}.na_cnt .nws_itm,.nws_itmb,#b_content #b_results li,body #b_header{background-color:#aaa;border:1px double #a2d7d4;border-radius:0}#b_content #b_results li:hover{background-color:#ccc!important}#b_content #b_results li h2{background-color:#bbb}#rso .g,.bkWMgd>.g,.bkWMgd g-inner-card,#rhscol #rhs,#rhscol #rhs .g>div,.c2xzTb .g,.ruTcId .g,.fm06If .g,.cUnQKe .g,.HanQmf .g{background-color:#aaa;border:1px double #a2d7d4;border-radius:0}#rso .g:hover,.bkWMgd>.g:hover{background-color:#ccc!important}.bkWMgd .g div.r,#rso .g h3{background-color:#bbb}" ;
if ( ACConfig. isUserColorEnable) {
color = color || ACConfig. defaultHuYanColor || "#FFFFFF" ;
} else {
color = color || "#FFFFFF" ;
}
if ( color. indexOf ( "#" ) != 0 || color. length < 7 ) return ;
if ( isNewGM == false ) {
style = GM_getResourceText ( "MainHuYanStyle" ) ;
}
style = style
. replace ( /#aaa(a*)/igm , color)
. replace ( /#bbb(b*)/igm , this . Lighter ( color, - 40 ) )
. replace ( /#ccc(c*)/igm , this . Lighter ( color, 45 ) ) ;
AC_addStyle ( style, "AC-" + CONST . keySite + "HuYanStyle" + ( isNewGM ? "" : "-File" ) , "head" ) ;
} ,
clip255: function ( value) {
if ( value > 255 ) return 255 ;
if ( value < 0 ) return 0 ;
return value;
} ,
Lighter: function ( oriRGB, deltaY) {
let rgb = oriRGB. replace ( "#" , "" ) ;
let R = parseInt ( "0x" + rgb. substr ( 0 , 2 ) ) ;
let G = parseInt ( "0x" + rgb. substr ( 2 , 2 ) ) ;
let B = parseInt ( "0x" + rgb. substr ( 4 , 2 ) ) ;
let Y = ( ( 66 * R + 129 * G + 25 * B + 128 ) >> 8 ) + 16 ;
let U = ( ( - 38 * R - 74 * G + 112 * B + 128 ) >> 8 ) + 128 ;
let V = ( ( 112 * R - 94 * G - 18 * B + 128 ) >> 8 ) + 128 ;
Y = Y * ( 1 + 1.0 / deltaY) ;
R = this . clip255 ( ( 298 * ( Y - 16 ) + 409 * ( V - 128 ) + 128 ) >> 8 ) ;
G = this . clip255 ( ( 298 * ( Y - 16 ) - 100 * ( U - 128 ) - 208 * ( V - 128 ) + 128 ) >> 8 ) ;
B = this . clip255 ( ( 298 * ( Y - 16 ) + 516 * ( U - 128 ) + 128 ) >> 8 ) ;
return "#" + ( ( R << 16 ) + ( G << 8 ) + B ) . toString ( 16 ) ;
} ,
loadOnePageStyle: function ( ) {
this . loadStyle ( CONST . keySite + "OnePageStyle" , CONST . keySite + "OnePageStyle" ) ;
} ,
loadTwoPageStyle: function ( ) {
this . loadStyle ( CONST . keySite + "TwoPageStyle" , CONST . keySite + "TwoPageStyle" ) ;
} ,
loadThreePageStyle: function ( ) {
let cssHead = "" ;
if ( curSite. SiteTypeID == SiteType. BAIDU ) cssHead = "#container #content_left, body[news] #container #content_left>div:not([class]):not([id])" ;
if ( curSite. SiteTypeID == SiteType. GOOGLE ) cssHead = ".srg, #rso" ;
if ( curSite. SiteTypeID == SiteType. BING ) cssHead = "#b_content #b_results" ;
if ( curSite. SiteTypeID == SiteType. SOGOU ) cssHead = "#main .results" ;
AC_addStyle ( cssHead + "{grid-template-columns: repeat(auto-fit,minmax(33%,1fr));} #container #content_left>*:not([class*='result']):last-child, #rso>div:not(.g), #rso .srg{grid-column-end: 4;}" ,
"AC-ThreePageStyle" , "head" ) ;
} ,
loadFourPageStyle: function ( ) {
let cssHead = "" ;
if ( curSite. SiteTypeID == SiteType. BAIDU ) cssHead = "#container #content_left, body[news] #container #content_left>div:not([class]):not([id])" ;
if ( curSite. SiteTypeID == SiteType. GOOGLE ) cssHead = ".srg, #rso" ;
if ( curSite. SiteTypeID == SiteType. BING ) cssHead = "#b_content #b_results" ;
if ( curSite. SiteTypeID == SiteType. SOGOU ) cssHead = "#main .results" ;
AC_addStyle ( cssHead + "{grid-template-columns: repeat(auto-fit,minmax(25%,1fr));} #container #content_left>*:not([class*='result']), #rso>div:not(.g), #rso .srg{grid-column-end: 5;}" ,
"AC-FourPageStyle" , "head" ) ;
} ,
loadPlainToCSS: function ( ) {
for ( let i = 0 ; i < document. childNodes. length; i++ ) {
let curNode = document. childNodes[ i] ;
if ( curNode. del) curNode. remove ( ) ;
}
document. querySelectorAll ( "style[class*='AC'][del='1']" ) . forEach ( function ( per) {
per. remove ( ) ;
} ) ;
} ,
loadCSSToPlain: function ( ) {
for ( let i = 0 ; i < document. childNodes. length; i++ ) {
let curNode = document. childNodes[ i] ;
if ( curNode. target == "xml-stylesheet" && curNode. data. indexOf ( "must=\"true" ) < 0 ) {
curNode. data = "" ;
curNode. del = true ;
if ( navigator. userAgent. toLowerCase ( ) . indexOf ( "edge" ) > 0 || navigator. userAgent. toLowerCase ( ) . indexOf ( "safari" ) > 0 ) {
curNode. remove ( ) ;
}
}
}
}
} ;
let ControlManager = {
centerDisplay: function ( ) {
AC_addStyle ( ".minidiv #logo img{width: 100px;height: unset;margin-top: 0.3rem;}" , "AC-style-logo" , "head" ) ;
let result = CONST . AdsStyleMode || null ;
if ( acCssLoadFlag == false && document. querySelector ( ".ACExtension" ) == null ) {
debug ( "in样式即将加载:" + result) ;
let expandStyle = "#content_left .result-op:hover,#content_left .result:hover{box-shadow:0 0 2px gray;background:rgba(230,230,230,0.1)!important;}#wrapper #rs, #wrapper #content_left .result, #wrapper #content_left .c-container{min-width:670px;}.c-span18{width:78%!important;min-width:550px;}.c-span24{width: auto!important;}" ;
if ( result == 1 ) {
AC_addStyle ( expandStyle, "AC-Style-expand" , "head" ) ;
CONST . StyleManger. loadCommonStyle ( ) ;
} else if ( result == 2 ) {
AC_addStyle ( expandStyle, "AC-Style-expand" , "head" ) ;
CONST . StyleManger. loadCommonStyle ( ) ;
CONST . StyleManger. loadOnePageStyle ( ) ;
} else if ( result == 3 ) {
CONST . StyleManger. loadCommonStyle ( ) ;
CONST . StyleManger. loadTwoPageStyle ( ) ;
} else if ( result == 4 ) {
CONST . StyleManger. loadCommonStyle ( ) ;
CONST . StyleManger. loadTwoPageStyle ( ) ;
CONST . StyleManger. loadThreePageStyle ( ) ;
} else if ( result == 5 ) {
CONST . StyleManger. loadCommonStyle ( ) ;
CONST . StyleManger. loadTwoPageStyle ( ) ;
CONST . StyleManger. loadFourPageStyle ( ) ;
}
acCssLoadFlag = true ;
debug ( "in样式运行结束" ) ;
}
if ( curSite. SiteTypeID == SiteType. BAIDU && ACConfig. Style_BaiduLite == true ) {
CONST . StyleManger. loadBaiduLiteStyle ( ) ;
}
if ( curSite. SiteTypeID != SiteType. BAIDU && curSite. SiteTypeID != SiteType. BAIDU_XUESHU && curSite. SiteTypeID != SiteType. GOOGLE && curSite. SiteTypeID != SiteType. BING && curSite. SiteTypeID != SiteType. SOGOU ) return ;
if ( ! checkISBaiduMain ( ) ) {
CONST . StyleManger. loadCSSToPlain ( ) ;
return ;
}
if ( curSite. SiteTypeID == SiteType. GOOGLE && location. href. replace ( /tbm=(isch|lcl|shop|flm)/ , "" ) != location. href) {
CONST . StyleManger. loadCSSToPlain ( ) ;
return ;
}
if ( CONST . HuYanMode == true || document. querySelector ( "style[class*='darkreader']" ) != null ) CONST . StyleManger. loadHuYanStyle ( ) ;
CONST . StyleManger. loadPlainToCSS ( ) ;
} ,
init: function ( ) {
if ( CONST . isGoogleImageUrl) return ;
this . centerDisplay ( ) ;
}
} ;
debug ( "调用加载自定义css" ) ;
ControlManager. init ( ) ;
return CONST . StyleManger;
}
}
} ) ( ) ;
} ( ) ;