|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 % m8 Z Q8 m9 W) S& @$ }! Q
& ~* W6 a5 ]. D0 z% `0 a火狐插件,用猴子
# ?2 ~2 u& D2 h# i
& i9 F$ \0 r2 \2 s3 B2 @6 g4 Zvar debug=false; / y2 ?- Q. s" t% l, j( D# |9 c/ d
var CleanHideObj=new CleanHideClass();
" J* ?- E2 s" B/ w/ m
: R1 \. E8 i0 P' K4 C9 Afunction CleanHideClass() 9 ]% J7 E4 V+ u
{ + N% I9 C" Q/ k" J' r
+ K/ v+ q" e. V6 R+ X, l this.on=function(id,bMZ)8 |' E. N$ h& F4 {7 l
{
; y1 W- ]4 F' ?$ p8 r 9 `. y; t6 Y8 C/ x
if(id == 0); f+ C3 b+ w i9 q$ d
{
5 n# H+ i! A2 `* a7 w var page=/* document.getElementById("content").contentDocument */document; % [* w; f; {1 l$ y H
this.RemoveHide(page,"span");
+ t6 I* g5 Q1 Y; o2 v1 M, X this.RemoveHide(page,"font");
- \, z* U. q/ |; c# O8 u1 W1 `, z this.RemoveHide(page,"div");
5 w. Q& e9 o0 f+ X7 l+ C+ S! u this.RemoveHide(page,"p");
( A% p! t# J! u/ Q* W7 [
; E+ R( V8 h* v+ P }4 J5 U- T: ^* ^; M5 U, p0 u
0 F, {/ o( d& K& ?) j3 y }8 p2 f6 }; K+ x- b
this.getobjstyle=function(node,prop); M9 z2 Z0 ?; P& ], q: `
{
. h3 w; g7 Z ~2 Y$ `& U8 ~ try) [. U' c6 [& w5 ~8 l. L
{
, l2 B$ M% S+ F* T* D4 x. ^ return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop); M4 W/ D! o6 l0 G; S( y
}2 ]6 C; X; P# K- ` _; I
catch(e)
; i; b" }6 ]7 s {& N9 `9 n/ y2 ~, Y6 F
if(debug)
/ G/ O0 A3 c# ^4 d* ?* P {9 r# Q' |) c5 y# y! G
alert(e.message);
3 i+ {7 ^% r% D' x }3 W) J$ I2 s! ]9 h1 y
0 n$ K0 X ]2 E2 _9 y return "200";
$ ]. V& {5 ?6 n W2 j$ F9 _ M4 { }
* x! H, A ]' g/ C# x; U2 X1 F k$ O }
& ~0 f) V8 n! a/ w1 z- P, L 0 q+ N0 k) }4 o2 K8 b4 ^) e
this.RemoveHide=function(page,objname)! [# g! v3 l7 N3 w4 K' b5 O
{
! d! G8 y8 b) J: K9 F1 Z try) ]8 a+ c8 g4 ^% g
{
. I! V! `- x) {7 C( c# d# ^ K4 W var minValue=15;
5 q% C$ h- @. b var objs=page.getElementsByTagName(objname); 8 w) M/ j: b# S3 ?# h( t/ f
0 M6 I6 M8 Q- w1 x, _
if(objs.length == 0)
* n# ]2 F/ U- V- _% K/ ~ V {. I! ~1 T6 Z- f
if(debug), M9 t* }' |% p ]5 ^
{
2 y4 F$ ]6 W0 _4 ]$ C" U7 g alert("no object found!:"+objname);# j) o0 u" m' U0 I B2 ] O
}
( q& f2 u: U0 R" R6 N }
2 C) a6 w }: a" ^6 A$ O else
7 f$ l& Y, w1 [0 d4 S {/ t q, G- C F* k
7 q, x6 ]2 z3 w3 z7 L/ H% [3 P: W for(var i=objs.length-1;i>=0;i--) 4 [" x/ G2 [: Z1 K% i
{2 a8 ]* V& _5 e) J
var node=objs.item(i);
! a* g6 j p4 z% r/ j R : @' d' x! }( l" k; _1 {1 O# \( L
& X& v6 `" L" n if(this.getobjstyle(node,"display") == "none" ||
# ]7 u# u/ ]8 {) W* C this.getobjstyle(node,"visibility") =="hidden" ||
* J) a3 Z9 d! u" l parseInt(this.getobjstyle(node,"font-size")) == 0) & g0 W1 w1 ~" H& R1 ^$ w V3 k- o& B
{
' q! r" A& e$ r1 X. _$ T if(debug)
T1 l# r3 A% e" ^% L7 F% T { U0 H6 f' l2 {- ? E; n
alert("remove invisiable!");
4 b1 a0 _* U" d# i }$ }6 ?( I$ h9 \0 v0 g+ B
node.parentNode.removeChild(node);
4 g. L; T, Q/ H* p' l. F8 E p
8 T9 J4 T: L! k! L }$ S' O4 I0 E! r; m
else
% a9 c$ m4 ]; t* {6 Y0 L {0 ^+ m }3 i9 P$ m3 |
if(node.parentNode) & c# C3 A# b% {% ^
{
2 U% I- Y3 e) w var orgNode=node;
" b$ k0 o* q o- s6 w var orgColor=this.getobjstyle(orgNode,"color")1 x0 g, g3 y! X5 p0 A
var orgRGB=getRGB(orgColor);
9 [! @% y4 N) P8 n ! m) M+ H. @" A( Y( W& @/ R
var parentNode=node.parentNode
6 G( |! n) X/ u6 E2 t1 g var parentBgColor=this.getobjstyle(parentNode,"background-color");
: ]3 q6 h/ ]" ~3 O
0 B5 z6 r' V1 R X3 i3 Z var isLast=false;
) W2 e4 b; C: R. u! s6 c& a
8 z! N. C7 R N" P: Q while(parentBgColor == "transparent") / k) {# ?0 a% v0 y
{+ J1 v, T6 @# x/ G
" T' P9 @8 F ~" }+ l
# r$ V+ W. j+ u4 M5 K
if(parentNode.parentNode == null)9 U/ ^3 m: L! o7 h( D- R
{
' P% H3 Q! Q9 K3 o3 _5 T4 B& J isLast=true;
8 v2 R( H2 Q: P, W, D# W+ T break;
5 C, N8 F, K# g- w/ t }
8 ~, c: T" V' G1 f/ X0 f parentNode=parentNode.parentNode;
( i! i; S# l4 ^7 M parentBgColor=this.getobjstyle(parentNode,"background-color");
^5 C6 d' k+ g5 j1 }2 j0 ^1 u8 w; w: t3 p# n( A- l
if(parentBgColor != "transparent")
) f( h" Q$ v: e" U8 i {$ X% t5 q# v) `3 L" D& I( i2 _
break;& q# j0 K% _3 K
}5 N% |: M& R; q! B& S% E* H7 o X
}
" O9 }1 p# F3 u7 X2 | if(isLast)
/ a0 m. N4 T+ O {
' @% H8 }, u6 t. z5 X# B if(debug)
# r0 w6 v& @% s {3 b! L: @8 b ?. k. P
alert("last!!");
: k1 I" g0 ?( e) G% G! c. Q }) I; }' Z2 A4 g1 B
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
& G( X! o7 {$ w; S* m& O! Y" X# y {% S1 I" D! |) ?
orgNode.parentNode.removeChild(orgNode);
- w; r+ Y; u4 I3 o }
7 f# A5 O$ @: S: s) s }% d) h/ d9 r8 I8 L' X
else% s6 l5 C' Y: I* l' {
{
8 N8 J. R2 Y# i+ v0 b if(debug); G& a5 }/ r2 ~; P$ H, B$ P
{5 B3 P. o! \0 ~3 c9 {0 {
alert("compare color and parent bgcolor!");
8 l5 o6 }3 W$ L0 C' p) e. G( N }
0 y$ t, {, M8 m/ b, u% s- d parentBgRGB=getRGB(parentBgColor);9 W$ T5 e. M4 `6 a$ ]
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
( R6 @ \; |& S v- ]5 j" N {- H" G7 G: U2 P! a
orgNode.parentNode.removeChild(orgNode); S1 D7 P; [2 }4 r, |$ C" @6 s3 a4 t
}# n+ Z" g7 w2 e) q7 k8 ]
}
# v/ V. [7 A3 M& c/ n+ S2 E' M }" w5 E. J4 b+ A1 B. Z
}6 K% N# p1 E0 ^5 f( `7 J% l
}
) q$ r2 ^; q9 a }* y+ C( c: g9 t0 H m
# s: w7 b8 a- @1 I
& Z- s" y( \; S% K, a var itemFrames = page.getElementsByTagName("frame");. y, N- t: d8 k0 K
var itemiFrames = page.getElementsByTagName("iframe");" v( t4 U5 N p. ?' T% c
. D, {0 F3 o$ J
var frame, iframe;
, i' s& @+ P! Z: d( `& k) i+ H2 ^ if (itemFrames.length > 0)
* [0 R g/ P" V2 [, K, |& p" Y {
8 p' G( p! o/ C% F) H' @0 Y, j for (var i = 0 ; i< itemFrames.length ; i++) ) Y/ l+ \& T4 J, ?% t
{. V. [! o( A/ |
frame = itemFrames.contentDocument;6 A% E. \# q! g9 x% n) O' U
this.RemoveHide(frame,objname);
' D) s1 l" A+ \ }
8 y5 m- D# U$ o3 R }# o- c0 d0 H' B
if (itemiFrames.length > 0)! B5 C0 N; g6 C: T) \
{ z( F" }, w/ d! A
for (var i = 0 ; i < itemiFrames.length ; i++)
: g! w/ U& S6 H8 N {
) _; h4 k% u- L( T6 [; Z iframe = itemiFrames.contentDocument;
( `( @' |: r) t4 x! c2 i2 \0 u this.RemoveHide(iframe,objname); ) [+ T3 h" G3 g( a }. o( q
}
! g' Q( l9 F# G% g+ g5 u }
: x2 o* _4 T* ^& b1 X$ o% I& r }# P, a' X2 X. N1 \9 j
catch(e); J8 E5 S. U! l3 ~# d& i" m
{2 ~! M( B6 \* ?% Y
if(debug)
, ^0 E, }( x: |: M {5 ?4 p6 i. S, b6 q" Y: r7 {
alert(e.message);
8 G% F+ s$ t: P& c3 Y3 f6 Q }
# O) {! M# b3 l+ T* t }
- s8 @( P1 w9 {3 I" n }
4 x1 g* j- o3 M l4 J
3 Q- ?9 s" F, q}: G" f6 R4 y* r% {+ J+ k( u" v
; z _$ t! }* x0 e) v" efunction getRGB(colorString)
: s- r1 X( N" T5 k! Q1 h{& X4 z- p5 y" V# q
var RGB = new Array;
f9 z2 M5 X' k5 N- O var tempSting=colorString.substring(4,colorString.length-1);1 P; d- _8 u0 c, R% Z8 U- _! S
var tempArray=tempSting.split(",");
Z2 ]8 ?5 O) C
& u. A9 X9 t6 f% M" Y" [9 f RGB[0]=parseInt(tempArray[0]);
, K" d+ k4 G( | RGB[1]=parseInt(tempArray[1]);0 m, o* M, t) u6 j1 y: W* t' s
RGB[2]=parseInt(tempArray[2]);- M. q% K/ B4 F' L2 r3 b! R7 J( z
) l5 h- F( O4 T
return RGB;6 t; h( J: Q* q3 N- M
}
* r9 t- [- R3 X9 k+ V4 q2 X# efunction keys(evt) . [; ]. o* _- L
{
! @ Q4 n* u' p1 n& H; [ if(evt.ctrlKey && evt.keyCode=="81") 9 i* K7 b. |0 O+ d4 P
{ ! b D! @0 P% Y A8 U5 m
CleanHideObj.on(0,1);; A5 f7 \( v. K/ S' v
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
# C: r& [* i+ e: c6 x9 p ^+ K" L6 P0 ^$ i3 {: _8 r/ F
} % \" ~1 ^: _8 r C
} - }7 |0 C. o( r
document.addEventListener('keydown', keys, false); : F8 G3 F( [' ?
GM_registerMenuCommand ('Clean Hide',7 i P! u0 J- t) I! Z! l; Q1 Y; I
function(e){) M9 V1 ]" [! C/ o/ w
CleanHideObj.on(0,1)
! g+ E' W- n1 N/ I( x8 Q- ]' m( nalert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
4 g, ^$ K. i7 i/ l- J$ r});: T$ c! e. Q( Q2 r# R2 q* @
|
评分
-
查看全部评分
|