|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑
/ i! |) F, a% ~: [: f. R
6 S5 P/ _0 p: P+ X; p火狐插件,用猴子
) K8 R R6 S1 _3 k6 ^2 w9 X! T# z9 [6 z6 ]
var debug=false;
, @9 O6 B" l6 w' j% F( }) Mvar CleanHideObj=new CleanHideClass();
9 i l2 P' m) K9 O+ b6 Q
. ?7 t) b# J$ L8 }2 I$ t: Afunction CleanHideClass() 2 V+ c# O) }) ^4 W
{ 3 u: I) M* K. ]
* K3 W( F$ w+ {0 {9 C# r: R4 b/ | F this.on=function(id,bMZ)
# s4 }4 i0 z$ A( v( r w {
! j1 r, j/ u7 L+ n' F! ` 1 F/ G2 S( h h( o" X8 V3 L
if(id == 0)
8 K7 L$ b+ b4 }8 S1 z! V0 e {/ ?- R' ]; q9 M6 g7 Y3 f
var page=/* document.getElementById("content").contentDocument */document; 9 x/ W& |7 h' J7 Q+ B8 l! J
this.RemoveHide(page,"span");
7 h# ~4 n# h! B0 J; E this.RemoveHide(page,"font");
t% w9 T6 A3 B# g this.RemoveHide(page,"div");" F$ B: F. ]: V! ~/ R
this.RemoveHide(page,"p");
2 g. v8 s" F! |; H 9 i4 Y# O' ?$ h# N
}5 U! F7 E* D$ F& M
& z- z e: g. F0 M }0 \% n- a/ r7 }7 _
this.getobjstyle=function(node,prop)% y( ] z$ b6 h2 M
{
) q! {+ M" h7 P7 Y: T try
) \ c% x1 A% o4 o( L6 P+ _( r( k {4 _: V# j; _2 d# j. V( y. @
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);9 K% m6 t# P7 Z9 {. u0 M- T3 ^0 t
}! W+ I* }- C5 X' ]! I
catch(e)8 H: d4 p& ?7 a+ o) o
{
1 U7 V, |/ N0 L7 h1 I; n- J if(debug)1 u2 q L9 G9 M# X, W
{
* c! A) @# a+ O$ \3 b alert(e.message);" q8 a. S+ k5 m' Y1 N
}
- Q/ o7 h2 p" n8 b" y, c w 1 }* O; s0 y0 j {+ M
return "200"; q q: i" K, Z
}4 K6 Y ?! f+ {* U, D) x+ _+ C
}
5 k! P3 _7 o! I, Y6 v0 L ; P, E1 B2 g/ k2 k- j& _9 s
this.RemoveHide=function(page,objname)
0 C: }, k( k3 A4 q {) A. g' [4 [: L8 s$ M3 {
try+ q( a6 g5 L0 g
{- w( q5 s! s* R7 |' Q- Q! \: d
var minValue=15;
5 R1 b1 W4 ]( q: a5 l2 H& } var objs=page.getElementsByTagName(objname); 3 Q2 O' o4 W! e
7 w! I! h' t2 r3 @1 J if(objs.length == 0)
, a$ @( _* u' N {- v" D* A/ Z* @: \/ ]- p5 i$ j
if(debug)
' [% u! j+ H7 D- r: q5 R1 F {
# q0 |3 f+ d+ b. \, P1 U alert("no object found!:"+objname);
& T) ~0 ]2 Z/ y' l6 @" B }
5 s; s3 D6 Y2 ]. X }
; ~ o; ^ A: M" `1 s' Z! G else x& U" R4 e+ s7 H3 h1 F
{0 B: `+ _1 z, @1 q! b' n2 y
, H n7 H& Z' \4 a for(var i=objs.length-1;i>=0;i--) 0 Q! k; P( ]! q4 y! z* K0 y
{/ q0 X) l- a4 O' g7 I& y: c: q8 Q! U
var node=objs.item(i); 1 T- D3 o8 X h7 U9 }
: f! Q; g/ q& L7 ^/ G: E1 G
) d1 O k4 V6 s) M' D
if(this.getobjstyle(node,"display") == "none" ||, J! a0 T+ F' p, l0 i
this.getobjstyle(node,"visibility") =="hidden" ||) u. H- S. N* \% o0 \
parseInt(this.getobjstyle(node,"font-size")) == 0)
. f% \( C, Z; E* V( f6 P9 L' z1 m {4 E8 S* m, v% d, b1 n, X. W
if(debug). a! ? w( z5 S! {" ]) `0 x
{- Z- @* J9 F) e0 w7 E! R
alert("remove invisiable!");1 g% b3 y5 k! k& e- ~
}& a2 a/ ?6 T8 v1 U" h4 ~
node.parentNode.removeChild(node);
- ]* s- C0 w! f5 e! L/ _9 M3 Z( M( w" S
/ k* I- e8 i3 l4 v+ c }
2 ?( C' R5 ?. |6 w [; x/ Y else 0 s/ E% P+ o# @$ q+ l* R/ T
{
/ w% C% ]* @5 o1 i* D- U2 d if(node.parentNode)
3 w; I4 H# v- M7 Z; M {# f/ H) ?, `+ @ T; R s
var orgNode=node;
" M3 W% w$ u4 I- F: T( U var orgColor=this.getobjstyle(orgNode,"color")& @- b! c* P! f$ u
var orgRGB=getRGB(orgColor);
' k, x. x z3 j* u' G/ x
" Z+ M; _2 R, r" [1 ? var parentNode=node.parentNode
# W! U- i4 l" x: F; e+ Q1 D var parentBgColor=this.getobjstyle(parentNode,"background-color");& ]; _! L6 }" h% ^( N% s$ s" |1 H
) {% Z" |5 `3 O" P2 f0 {2 t2 C
var isLast=false;
+ W- e/ V: A; \5 H 2 x3 a# Y0 m& K$ R/ P
while(parentBgColor == "transparent") & z( H6 E) J: L9 t" N
{
1 W, |+ a, l; W; E
8 c+ O8 D$ f' R) |2 E0 G ! W: j0 d+ f$ u4 |
if(parentNode.parentNode == null)
. E; h! [, T, \3 ~$ G) ~: P {
" R7 w1 Y8 n4 z! h( L2 {: N8 k isLast=true;5 { a# L) @6 m0 E! j' ?+ ?. b
break;
( l/ O5 f. I( K' s+ T) J( R }/ z& U: `" J8 z3 M
parentNode=parentNode.parentNode;
& R3 u2 B% v* A( V7 m parentBgColor=this.getobjstyle(parentNode,"background-color");
' E# G+ o% ~! R9 a/ n6 p, ]8 [. @1 U: @ Y+ ~8 D6 Y
if(parentBgColor != "transparent") . S$ ^+ K9 `, {' _/ @) s
{
$ ^0 V5 m' j& c" M. ^, W break;3 [; D. _6 B5 j+ Y/ E+ A
}; c$ U$ U: I$ U9 h0 w' D
}
[% |: c" {% C, }4 J; Q5 D2 g. { if(isLast)
- W8 A$ k4 G* a; z, | {
7 _* ^! n O+ R5 a5 { if(debug)$ h. e8 P+ z' w3 m: d/ E4 F
{- y6 u& R5 U- a# e5 {
alert("last!!");
# I |- m/ V; D6 m: X }% D; \- W. r: U) w$ F( [6 T
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))) L/ `% M( _1 P. O3 \) D @ s
{
: N+ l x- Y/ ^7 V3 l orgNode.parentNode.removeChild(orgNode);
. I+ J9 l) C& i }% Y% g, \, Q0 E
}
1 y4 Y* O, u: [+ m6 I9 y else
. {& ^+ B; X/ N* M1 b {5 l" U7 c0 e% {; @3 T
if(debug)
N) @& A9 _# y! s1 Z+ t {
; @" [0 y$ ]8 ?! o6 \ alert("compare color and parent bgcolor!");
$ N( ?' {: T% A: S. ]9 h* o- Q }
# e! q) y! Q" J% |' L parentBgRGB=getRGB(parentBgColor);/ R+ o9 N, y9 z/ ]7 `9 ?% j) ?
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
/ m$ f; f3 p8 T+ b' ]( H7 { {) @( u2 E0 j9 \) P
orgNode.parentNode.removeChild(orgNode);
8 i* p' v- Y2 n2 n6 Q! j }9 b* L0 l& X1 W& |( \
}
$ a% c1 H7 c. q8 C* V }
1 O5 D: V+ I. X6 V: b4 ^' _: g }- o2 s3 G* x& g; s8 G' r2 M, O- c
}& {9 J8 F# W7 z- U" G1 ^
}
) Y' X& P" W' `8 m1 M
4 S( e* c/ |$ w& E# r4 S" B. g
4 ]0 H. O7 }8 i h0 n' A* @ var itemFrames = page.getElementsByTagName("frame");
: B, Z5 k; c1 E8 M: ~. V var itemiFrames = page.getElementsByTagName("iframe");; {0 B# R- w; }/ X8 }- Z$ j
/ y( h1 x9 M- @
var frame, iframe;3 U7 _6 \7 }/ `2 @' _, ?' {
if (itemFrames.length > 0)( S$ |. x, ?1 a& J% J
{
! W/ ]+ t7 T: B$ G `4 k p for (var i = 0 ; i< itemFrames.length ; i++) . Z+ G0 p4 P) `& J
{, ^6 a$ N% ~( g$ j: B# u
frame = itemFrames.contentDocument;
. A" `8 ?+ N2 e this.RemoveHide(frame,objname);
2 t. h1 m5 K/ n$ ]& Y( u4 ?7 H }
/ f- Q$ r2 Z6 P* P7 _4 }. s, D7 E1 x }" I6 L& {) @% m' G
if (itemiFrames.length > 0)
. l* l* c1 C2 U% t# ? c/ d {4 E2 o. ]& ]5 h' M4 \* M3 z. b
for (var i = 0 ; i < itemiFrames.length ; i++)
2 M0 B- w7 s/ P) o. g, l {
, z$ k5 Z$ Z$ q iframe = itemiFrames.contentDocument;% }) q5 E+ X# W- t" C7 l& u
this.RemoveHide(iframe,objname);
- H/ L0 P; ]2 l0 R3 t M# b }
7 {, s3 p6 [! [8 K+ s/ I }
6 x: y3 ?" H, ]3 f* r/ u- k+ C) L/ @ }2 P/ |5 B9 w% x( j& |
catch(e)- [, r0 A- Z2 i) m
{
' _. N1 Z. M" \) r, x$ w5 o9 u if(debug)
7 F, ~, U: y% K# S {
0 |$ q7 {5 w8 D alert(e.message);- q* u6 G+ s- u; Q3 J3 Y
}
6 C) Q1 U. P6 l G$ I& B& l0 ^ }
' l# o& g8 c' _: y3 } t* i' Z# Z/ J' d }5 s6 n' N& N9 t" ~( ^
* U4 S1 V& F1 M4 Q, w4 d% |) C}9 R; m6 X+ R" r( p: I# X
8 T1 ]5 v2 M2 |function getRGB(colorString)
7 Z5 ^1 U0 K9 S; @6 H) }' ~: C/ E{
0 y! Q' Y, T ~/ k: k' C var RGB = new Array;
; d+ W" f$ Z+ K* B" s9 l4 ~ var tempSting=colorString.substring(4,colorString.length-1);
4 x' g: G- ~9 l$ ` var tempArray=tempSting.split(",");
% w7 N7 f, k( Y# w6 D6 v
+ D3 o. T, R" v" O' N, [4 o/ T. r RGB[0]=parseInt(tempArray[0]);' r" l& Z, O8 l1 d# f7 O) c4 n
RGB[1]=parseInt(tempArray[1]);
7 S* ~% ^$ H+ T" E2 w! Z; U8 b: C RGB[2]=parseInt(tempArray[2]);) _/ j- j* o S# o% H5 A$ K0 n& k
# [7 B8 ?/ [% q4 {2 _
return RGB;
H! l7 U" j( J- J8 L' c}2 s( w9 l6 F/ |2 U1 z3 Q
function keys(evt)
" c2 E3 X P+ k$ ]1 o. j/ C {
4 c$ \! V4 p- ^! ^4 M B if(evt.ctrlKey && evt.keyCode=="81")
1 d- K% H0 p% j. R7 d {
( k: i! E% {! x CleanHideObj.on(0,1);" l3 k9 N. ^! e0 L
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
& P* @1 R) h+ o9 W1 U
' ]7 J- }& w2 k- T1 Q }
2 |- L4 t6 z; k }
5 d* |) G0 U8 V. ~' n$ o8 T' P# ~$ p1 adocument.addEventListener('keydown', keys, false); , ?* y% f: b7 c8 I
GM_registerMenuCommand ('Clean Hide',
* A; A, r+ }& K' @4 }function(e){
/ Q4 `* G" w L" Y! cCleanHideObj.on(0,1)
& I: `: i1 \7 W, f( }% F4 galert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
4 i$ H9 ^1 H0 Z$ b `6 F});! K( g; J+ _' I: _, n
|
评分
-
查看全部评分
|