|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 2 [+ l9 K, a' `( i
& h: f+ L# m: w) F: @火狐插件,用猴子
' n G! }; G, F+ E9 b& `
$ a- Z: a* M% o8 @0 F9 c* q! Gvar debug=false; # ~; z8 I% g6 t& e6 m B( T1 V" S
var CleanHideObj=new CleanHideClass();. i/ m6 j) g$ u3 B2 Z6 c$ S
* R% H2 O2 o( S
function CleanHideClass() 9 v9 e" q1 e8 U# B8 ~0 ~
{ 8 I; C3 W1 X7 P4 |% i% A$ D, p2 ~6 W
# T2 p0 K6 \% |) _! Z
this.on=function(id,bMZ)+ B+ v& R# d& |0 z V% q! p2 L' U
{
# [2 X2 W( ^% J( s4 e2 T + ?& B+ |) n. e& I! N& D" h7 _
if(id == 0). x3 ^6 W, v: h% O% M
{
( m( C* g% H+ y# u var page=/* document.getElementById("content").contentDocument */document; # c* L' v" z5 q
this.RemoveHide(page,"span");0 R# E: Y; t' k- y- W
this.RemoveHide(page,"font");
) v$ O8 |5 [' s this.RemoveHide(page,"div");7 L# G0 Q4 i4 u- q
this.RemoveHide(page,"p");: G+ X7 E+ C, }5 U
) f; B( S8 k' L' ]& @3 E! M
}
7 u4 ~4 A% q+ ?% f7 g 7 R. I& H2 @4 c# @9 Z
}2 U8 p1 W$ ~7 W: ?# }$ @' t
this.getobjstyle=function(node,prop), i! z; @( d! c
{
& ~1 E* S2 s% ]; @4 f9 ? try
2 l1 M" ?4 g' S4 Z8 w- z8 p {% v0 S; \7 `7 N2 e0 ?5 F+ v
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);, {& l, m* I) p1 [& u) e5 w' L( f; [
}8 x" C \3 O1 Y) ?0 M( u
catch(e)
! {$ O" S" M5 t2 l {
8 F" w$ k0 Y" Y1 ~ if(debug)
+ b9 R7 u0 ?/ y5 r {
( O/ r4 U. ? A6 a4 [! a alert(e.message);% ^) h- Y8 g4 i! E7 r
}" `. w( z6 N1 Z* Q7 L; G
$ t0 p7 N, g/ A9 }' V return "200";
1 F/ J# x+ H# H; A `5 b* x }$ ?% S7 p* f) A2 K# ^
}
& ~' L% ~# t* t5 T \
' n2 n [ k* I6 q) n this.RemoveHide=function(page,objname)) `( O8 |7 _2 y N
{& I5 j: ^8 ?: O; l/ v* u" N; l
try
5 ]7 y; Z( ^" X1 Z* a( \) Y6 `0 E {
" \: }/ s ]/ i/ j' X var minValue=15;
: G! j$ i9 P0 j& B var objs=page.getElementsByTagName(objname); / c' `; N$ @+ T% K/ n( L
, b2 u4 U* O9 i0 R$ W3 g+ S4 Z if(objs.length == 0)
4 e+ Z- } `( a) }7 K j3 e {
( P+ n4 o" \0 G: ^! T if(debug)
+ h& f! O% n+ ~2 ]- o {
# D0 Y8 G9 {5 {: r7 R alert("no object found!:"+objname);: k o% ]) x. N0 }; h- l
}
* C* J. L. M7 J( P }+ d, k; V( p9 @2 O: E7 `* q& @
else$ e* H; {. j* M2 y6 f
{- s& L5 d1 G! b$ K' a
7 S% M7 ?* _- G4 N5 M. ]- Y) k2 X for(var i=objs.length-1;i>=0;i--) 5 G3 B J# p! p# y7 C
{
# |+ c$ q3 y1 i3 b9 E var node=objs.item(i);
) w( v/ f" T7 O b& G$ Y
1 ~0 Z. n. p S6 i - I8 c4 k/ [. e* t# k
if(this.getobjstyle(node,"display") == "none" ||
! p1 [6 N* Q# h& ` this.getobjstyle(node,"visibility") =="hidden" ||; g; a8 \) c- b# F4 _$ A" f
parseInt(this.getobjstyle(node,"font-size")) == 0)
6 l( f n0 g6 ? {) b8 L. A: J. V/ T' }3 e
if(debug)
1 n- g2 c4 T, \$ q {" ]% Z6 m; k. g4 x4 \% L( v$ k) H
alert("remove invisiable!");
5 V4 i) @, u8 K$ }$ R4 P% _7 J% a, f }
& ~( b0 r$ W$ n* K* r Y node.parentNode.removeChild(node);/ a" q0 e2 v1 u c7 s t0 |& u3 U
6 H& X+ y7 D# K0 o7 M
}
' v: Z2 I0 O. S) r9 d else " s: N; m" x' q) e) r8 t
{3 v) `/ |) _' p
if(node.parentNode) 2 B1 r$ O1 m) n5 t, L5 g# r
{. ]7 p. c/ I V2 {
var orgNode=node;
0 Y2 n+ b& [! R& o a var orgColor=this.getobjstyle(orgNode,"color")
" W! A- l/ L y1 X8 x( ^& d var orgRGB=getRGB(orgColor);
6 X0 H0 P6 t! _. X9 k T
$ \- E' D0 X2 @ var parentNode=node.parentNode0 d( | b$ ~* t: i2 s* B% v+ ?1 k
var parentBgColor=this.getobjstyle(parentNode,"background-color");
& ?* i6 }( A. K# b
! x9 E1 ?, P/ X1 D9 A5 b1 y var isLast=false;( H* B* X$ F" d
q/ C% g' K0 S3 H# x while(parentBgColor == "transparent") , H8 V, a" V! Y( Z2 B. ~, G
{
8 c9 ?% E: S+ G* T2 y; d 2 x4 ?1 A2 z, N& M' `* K4 Q% |
7 a+ I1 ?# m/ X7 D2 f: z if(parentNode.parentNode == null) q! ]# V6 x' B
{. }4 w$ v. ?2 i) w m2 R7 |
isLast=true;
6 e, ?- ^7 P8 N; U8 S break;
% ~% ]( D( R; @& ?4 l, } }! r( K% O* \" X( m( x9 P3 A# l
parentNode=parentNode.parentNode;/ D/ `1 \: J& q2 I- j7 l" s
parentBgColor=this.getobjstyle(parentNode,"background-color");5 A" i9 e! @ d
! F* A# {' p4 z+ i5 D7 Y if(parentBgColor != "transparent")
5 x* c9 }' p \! N6 e {( `# T7 C8 U7 {& Z! w6 O" }4 w
break;" S4 o) e& A4 U( M8 e- l8 k9 L/ l1 h
}4 `4 P, U& x, x) h% D7 p
}3 p1 n1 l8 h) g( D- p c" Y
if(isLast) ' N: u9 x$ M9 r6 n
{
7 ?. M, b O! |6 j+ u' Q if(debug)8 _. v$ d% [$ N+ b7 Y
{
$ B+ f) s/ V1 o, a alert("last!!");, H+ y6 Y! n% y
}
6 ^0 B" j; {' y5 C4 X9 N l if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
* G' o& \5 H! ~4 l' H% ? {
: A# \' W( P+ k' T$ B# n0 f! W+ c( j orgNode.parentNode.removeChild(orgNode); / e1 \8 h! E; m, U/ Q
}% F: W4 C' S. x$ l, `9 k
}
; S+ e, B6 V$ r% w. m else
' N( K2 z( t3 P% {( X {
" Y* ~ d6 c F+ `5 i if(debug)
. N2 w: z3 R3 m/ d$ Z( B9 h; A {
+ Q( @7 P$ h9 @" k alert("compare color and parent bgcolor!");2 }5 Z3 M8 ]: f
}/ F1 \6 M% p! Z
parentBgRGB=getRGB(parentBgColor);
+ c: r! \5 [! t# l5 S+ K( A' T+ ~9 w if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue)): v2 l5 E; v! G# H
{
& @* j# Q. \8 y" B/ ~* D& e) L orgNode.parentNode.removeChild(orgNode);
@& G! ?/ x% M) P }4 w$ E6 s# [ }
_$ e1 B9 g5 M6 n) r8 K }
: X8 q# _# a$ @5 ] }
6 \3 w' K$ F: V+ z }5 X o& N/ Y$ @1 {0 Z8 f! v) |
}
1 ]4 U5 r* w( V }% l# p4 Y8 L' X6 S7 A2 |
) J# j5 L& B7 E 9 v; N, x! P9 }- l; }/ g
var itemFrames = page.getElementsByTagName("frame");4 v4 J: G! \# a7 y
var itemiFrames = page.getElementsByTagName("iframe");% h# k, M4 e7 O1 E
& h, x) M7 C9 H5 ?; x var frame, iframe;
# ?' W. R1 p& L# S$ k if (itemFrames.length > 0)
/ o" Z" N1 g7 M9 j" y {
" |, Z7 e0 | n for (var i = 0 ; i< itemFrames.length ; i++)
: d" `; z C+ g9 X; J s7 M {
% t7 M1 `5 ^- h4 r8 p& e6 G9 q frame = itemFrames.contentDocument;
9 h. [: r" A+ O this.RemoveHide(frame,objname); ' d0 f! ^1 X/ S& I) D) ~8 x
}5 f+ g- G9 W1 G' @) n l; y* q
}
5 W3 [ e2 X; M4 _: N6 ` if (itemiFrames.length > 0)
$ g: M* k8 D$ l+ P$ P8 R {
) O, m5 l8 A y" d for (var i = 0 ; i < itemiFrames.length ; i++)
- h* ^$ u9 ^) z) a) [ { G5 w; x9 t* S% Z& ^# u/ H3 a
iframe = itemiFrames.contentDocument;, G( ?( M) k2 Q$ Y5 J" f. O
this.RemoveHide(iframe,objname); - N1 f# t" @9 c
}0 o- K9 {$ e3 E! b5 `7 b7 n
}
1 E2 H! A$ L) y/ X7 {* ] }
6 L ?8 @! P6 \0 } catch(e)
7 \9 k2 l1 ]' e+ Y: ` {
3 z; K, h6 [$ o* Y% Q7 S( k+ d if(debug)
0 l8 {. ]- k: [1 y" Z, K* S: M; C {3 o; I3 v m1 o8 K" i
alert(e.message);
; h" l* r" o0 T8 r' d ]- J }
; t$ j9 n' _3 S/ E, K6 X# c2 t }
$ @+ f2 n; l' Z }. P5 ^# `# G$ R- j/ O/ r4 r& n
; H8 B" K+ R, T; H, u}9 Z0 }! x5 i. K7 w; d
- T7 o/ ^5 }5 G; J: U7 N* T
function getRGB(colorString)
& E( C/ P6 g. I{
8 x- h; _: C n: L5 t8 Q& g var RGB = new Array;* B8 U B8 k. h1 J: u* A6 k2 T
var tempSting=colorString.substring(4,colorString.length-1);
) K/ O- ~- j0 }4 O/ a3 p var tempArray=tempSting.split(",");: o; u7 |* a6 T3 g- d! S5 l
$ K; z3 H9 S6 c9 X2 |, y* }
RGB[0]=parseInt(tempArray[0]);& h2 ?) C6 C! i- L; `+ |4 d
RGB[1]=parseInt(tempArray[1]);! m, m5 m5 n' G
RGB[2]=parseInt(tempArray[2]);7 C3 A! v2 W$ H4 B8 c' H* y9 s/ ]1 Z
! q/ h) t |6 e7 Z
return RGB;6 l- \5 |0 T# P8 \
}% M9 f/ v4 K& @5 z, }5 P
function keys(evt)
w( W1 }( F( `9 H9 { { 0 G- w) s% b3 L a0 [
if(evt.ctrlKey && evt.keyCode=="81") - G1 }: h% h* V0 Q( I
{
' K. X; A4 I% i! X" `# U CleanHideObj.on(0,1);
5 Y3 X6 a& s" P+ D, b. l' f5 g alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
" m8 T3 o( u0 t& t- J( t5 J & u3 U3 V& @; Z) b# D9 \4 u
} 8 u( n" K$ f; @# ~& ~3 {3 z* Y
}
7 K) n( f/ H- i* ^2 adocument.addEventListener('keydown', keys, false);
& P f3 k1 D [4 n& j* r) d" B+ fGM_registerMenuCommand ('Clean Hide',
- ~( F3 z* p7 Z) Lfunction(e){
3 ?) ?' D N$ J* I$ a0 kCleanHideObj.on(0,1)1 x1 F! F4 x5 I# `( W$ |
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");( n$ ^' x! P4 J7 r# u$ z( L9 L
});
: o' ?9 ~8 P' S1 M( W* { |
评分
-
查看全部评分
|