|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 & y4 C" Q- V( _, a( v4 b4 n4 ]$ R
7 H4 V6 X* N- x. T& E
火狐插件,用猴子
# P- F* X1 S# V8 c$ `, a6 T/ U, d0 T+ [
var debug=false; ( ~- o5 _# {& t
var CleanHideObj=new CleanHideClass();, q- z3 b, |; ?9 f; n9 t
: j s4 A2 f" h" h4 z6 h- Vfunction CleanHideClass() # o, M0 }+ V/ W' j4 C) J( p
{
$ H! a6 d7 f) g" [; a+ F9 L* a6 X# [! C
( m% s! w" A( t [& y; o: Z this.on=function(id,bMZ)& ^0 I0 |& _9 X8 t
{
4 ~ r i0 h% |4 u: o # f0 a3 U& O# N2 S0 f7 m
if(id == 0); ^. { K0 C% f
{, |! O' H) Y+ w# {3 l
var page=/* document.getElementById("content").contentDocument */document;
$ {4 N3 A) E. ]" K! `" D this.RemoveHide(page,"span");
6 j6 G9 y, q7 I this.RemoveHide(page,"font"); x) ^3 o1 b/ d* y5 ~# k3 c
this.RemoveHide(page,"div");% b- R, d. j# l; X
this.RemoveHide(page,"p");6 l# `- T$ Z# p2 Y* M* P
9 ]# e3 v6 i5 f: E: O7 t }
6 U5 ~& y6 p$ Z; S7 A/ Z) d $ F: k+ o: I$ V! v6 b7 ?! j% }* g
}5 o1 ]8 A3 b1 N8 W1 j9 [, Q' N, ?
this.getobjstyle=function(node,prop)9 |+ X6 h5 H) R/ j+ S! [9 O v! q' q
{
+ s$ r9 {. N8 ^" b try9 w* H( B4 {5 X" J3 h
{# b6 T" U, d$ ^/ g4 v P
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
9 I. h( W! A. X6 z( G }
e7 d8 ]3 V/ T4 z catch(e)
/ a! N: F5 i7 N# y {
2 U4 z! V! z+ d7 V if(debug)3 v9 P6 H6 N O. E3 a, v) q m
{# {/ k" @% s' i6 K( R
alert(e.message);) F; K7 \: u3 K- R* g; n% B2 s
} P2 T9 C c% B w
& ?5 i. b+ g/ L0 d& X return "200";
! Y T) A7 n7 o4 h0 d& S }" k/ U g# e* f: o9 u! p. v% p
}! r* O2 U) b# n
7 ~% A4 H- c$ a. S# S, P4 R. U) _! ^ this.RemoveHide=function(page,objname): h8 [" [6 V* n. b% W- a. N& d
{
7 P2 \/ F# P; X/ L try/ E. Q( ?% ?" P6 Z: M# m) [( ?
{: |: X% ~/ f( [6 p
var minValue=15;% P; d' A. _5 f/ D" T; Z
var objs=page.getElementsByTagName(objname); 3 ~! Z* @- o/ v C" ]
, ~; ?: m. h+ B if(objs.length == 0) o3 P- _0 L: X1 h* v. B% y: K
{$ L4 `/ E r7 s, z
if(debug)
; }6 [( h' u( G O4 X {
" q# Z ]5 a0 o. P# N' d$ f( x alert("no object found!:"+objname);; }! Q( V7 \* X! s. I" d6 A
}
( E$ M9 E9 ?! M; L }; j3 |$ A& J& ]: U9 v1 J
else4 e3 X9 K" L E
{
8 v) ~& `! ~$ D# o4 I( N
; w( ~, D1 I' ~% H% a0 |* D for(var i=objs.length-1;i>=0;i--)
! p# j+ J7 V' P4 P; r( Q {
2 z! n, b1 w; x var node=objs.item(i); ; P2 X& N( h( `( F/ Q
3 ? A4 X& e4 b
1 `8 k0 w, ] X1 a" T if(this.getobjstyle(node,"display") == "none" ||
" I& N2 n1 {. J. G0 k' T this.getobjstyle(node,"visibility") =="hidden" ||' b M, ^7 P( `% \ p( Q1 P
parseInt(this.getobjstyle(node,"font-size")) == 0) 8 ]7 Z7 y# E' q' y w, o7 t& Q$ Y
{
( I. q ~; w, s! X if(debug)( z7 h. ~, t+ }6 p e$ P
{
& D* @8 d3 H/ m alert("remove invisiable!"); S# G+ t( X3 K& o
}
# L3 F& [7 L0 j, [ node.parentNode.removeChild(node);2 m& b' v; b ]/ ~
. X+ h' P6 z- X+ a0 [% s
}
% D; O0 N6 d6 n x else
( b8 Q( c0 G5 ^1 C5 k& A& w& A! Q {& k7 U) _) |, C4 ^3 w- d- c
if(node.parentNode) " p r- Q# V8 ] s1 o0 D
{
K) I8 O! M$ A5 f( L2 M+ p var orgNode=node;
3 s" k8 _! k5 z8 D* S( r var orgColor=this.getobjstyle(orgNode,"color")
; w1 C& ^! X' V* ^ var orgRGB=getRGB(orgColor);
6 P& T4 F. n2 o+ D" _$ v" { ' j( I9 C+ m9 k9 Y% n' z
var parentNode=node.parentNode8 h* q f+ W8 @0 z8 R
var parentBgColor=this.getobjstyle(parentNode,"background-color");
. x: @$ d8 D# \* X ; p" R; r/ ]2 O) }1 p; b6 }
var isLast=false;3 y- v2 e/ ?) c9 i% [
, K w3 e$ k8 x. g4 Z while(parentBgColor == "transparent")
; a b7 e3 S0 _5 {, f& i {
~: S- O1 f9 c% X7 O9 x
+ y& X% s9 ^* D* {2 E1 q; w0 B2 x; @ d 2 a' q& r ~. o
if(parentNode.parentNode == null)
9 C9 X6 h! f+ L1 o {1 ?# t Y% N7 r6 J
isLast=true;
; y. ~% w* h$ n7 F1 \ break;' w7 k1 X$ l( @! J/ N1 w9 M; R
}
/ Z# [4 ~ ^" L. W parentNode=parentNode.parentNode;
3 p2 r& k1 O+ Y: k6 K3 i parentBgColor=this.getobjstyle(parentNode,"background-color");
. u& h0 R! {) b, x+ F: \- i2 }# U& v/ I
! ~1 H" J+ [; _( p( Y' b+ K1 U if(parentBgColor != "transparent") : X" O# q6 s) O7 P3 V
{
5 F& K H) a* H1 c; [- q break;. q5 x7 I" N+ |
}# r" K2 M$ g" z* A1 t
}
; B- T4 ^7 l/ b+ O1 R if(isLast)
/ m# t. p4 Q# n: d" X2 c {5 k# l' l7 {) ~8 W
if(debug)
/ X( E2 [$ n% g2 K, h {: N4 i6 t, {7 p( x" Z8 U
alert("last!!");
& \1 ^) y( v' G- Z" M( C }( G' z* D5 Z6 n
if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))
6 ]* B" E+ }1 F4 f- Y {; y+ Q0 U; H' T5 c" ^! y
orgNode.parentNode.removeChild(orgNode); + |7 y" }8 K% {
}
. |' N5 ^3 q6 D$ p' Z7 T }
2 N7 j1 b8 S/ \# |9 d. F else$ {1 i: _6 i3 U- n+ K% ?
{; ?: r9 {/ k8 x+ z3 N) V( \/ J
if(debug); P) D/ s3 K* Z
{ k5 G- F! C: }' `, J$ D
alert("compare color and parent bgcolor!");
/ {3 X: s+ U9 k }
}: p) k$ S$ ?& y& J; u parentBgRGB=getRGB(parentBgColor);! `$ d" z. z9 W& I& W8 X
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
# r9 _, E7 d* {! Q% X {) I0 G# F8 a7 z5 [" a, q) I
orgNode.parentNode.removeChild(orgNode); " z+ A' R9 U$ l4 n
}
$ e5 H1 y" z& X* } }
$ v9 V+ n5 N( u }
7 g, T/ _% k) `2 Q } O& @9 I& \$ B" M& u8 w
}
2 Z8 r) t9 O9 e2 y" z+ s* I }; X5 O. M7 t+ t2 |, `
$ M4 V! a9 I# X! l O+ {7 k
: t- p* O3 R# j: c- P% e1 X7 i var itemFrames = page.getElementsByTagName("frame");, W$ }8 q2 e& H4 R
var itemiFrames = page.getElementsByTagName("iframe");7 e6 h) u) e( K( }7 u
1 o+ W, y: z: A% q1 o" L. C
var frame, iframe;
( W4 {1 Q' E6 s! X' S$ q3 d if (itemFrames.length > 0)
: G# m# ~0 I( }( w; e" P' _7 o {% q0 a* `. P: y! J: j2 q$ R1 g
for (var i = 0 ; i< itemFrames.length ; i++)
8 V/ Q+ {3 Z% \' |; {: A# N( G {! l2 w; g. w9 M: t8 D
frame = itemFrames.contentDocument;
# _) R& m* B' l, d2 i this.RemoveHide(frame,objname); 2 T6 K1 M/ J- ^4 c) n
}8 P6 I4 L) M5 r. f7 S9 o! v1 ]7 Q
}4 Z2 L8 R2 z3 W3 Y7 ~6 h/ C) \9 \
if (itemiFrames.length > 0)0 |) R5 }. L! S# N
{2 f$ F; T% O8 f* b, a6 c% r( r: e
for (var i = 0 ; i < itemiFrames.length ; i++)
; `* D, O! G7 m- m {1 ~8 [# _- J& [" J- G
iframe = itemiFrames.contentDocument;: {. R6 g! s. e( s
this.RemoveHide(iframe,objname);
/ ]! f" w" t5 F5 _6 `% K6 J }
4 ~0 i- \/ S! A7 S7 d- H }' L$ _$ n3 h$ Z) Y+ v
}' R& c# _5 L: j: q- n5 t
catch(e)
, T( A) z/ s, } {2 a. W8 `5 Y) `; Z! g- L, p, O
if(debug)3 \& H! l1 E5 `
{
3 t) J$ I0 w# H3 C6 A alert(e.message);+ s! g4 [+ B+ l1 m- _! e+ U8 P! z$ W
}
% Q2 q# J9 A2 F5 f% Y0 _3 L ? }( f+ q1 I6 E% I! u/ ^/ K
}
9 z- c; D3 t4 L ; o, q8 B8 R7 B, A! w
}
" _9 j' a. S- s! f! O. g
. }: p. L8 {- Z2 `& kfunction getRGB(colorString)
6 R3 q/ ] R6 H4 L{* e! a4 d+ ^# j5 o- M9 P
var RGB = new Array;' I2 [1 x) ]% O2 u+ A( w6 h Y+ c
var tempSting=colorString.substring(4,colorString.length-1);
; A5 u# B7 k" z8 a& x( |, s var tempArray=tempSting.split(",");
$ q7 J. A" m: u, R9 J( a% [5 J8 b6 j' J( L. S
RGB[0]=parseInt(tempArray[0]);9 U4 ^0 Y$ B- z1 z/ B+ \
RGB[1]=parseInt(tempArray[1]);
8 o8 ^5 [' F0 F6 ?5 m. m; v2 { RGB[2]=parseInt(tempArray[2]);
5 m4 e, F! h1 m ! T0 t# M5 P: f; t( |
return RGB;; r, X& `/ `" x% \; Z
}
$ S& S" A" S! I+ Z4 zfunction keys(evt)
; \) {$ s( R. s! i0 t { 3 j9 `3 f- j4 g* Z' z- r. c' e; E4 H4 I
if(evt.ctrlKey && evt.keyCode=="81")
% k+ a, q" U$ w; X {
% F6 H' q) O+ N2 ]. l$ U- O CleanHideObj.on(0,1);" F2 V7 k8 j: q9 W
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); / }4 Q& h# z ~% g
( _- V& R& F( |* g
}
& {' a0 }: p& C. I0 n+ N8 Y# W8 e }
% o- `. s5 @- f* ^8 kdocument.addEventListener('keydown', keys, false); & M' K& e* d# Z0 ]1 X, f3 |( |
GM_registerMenuCommand ('Clean Hide',
0 @+ K( Z6 I/ b0 n/ O6 g! ^; Ofunction(e){0 b) t/ K/ O9 h! w% p& Y; Z' f
CleanHideObj.on(0,1)9 Z1 Z5 k: l' M, F' N& m
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
; w$ ?$ _/ f( q});
, [: L6 d1 X4 [ Y0 x* e" b |
评分
-
查看全部评分
|