|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 8 ]9 f0 i N% l
, d# F- `" S% J! t' d. h
火狐插件,用猴子; K8 ^0 _ j4 Y3 M4 {; e
0 w" `* T) W( @, p
var debug=false;
8 L g9 j& L* R2 a: ^, pvar CleanHideObj=new CleanHideClass();. C1 o( }8 f5 L' z9 L
, V6 {+ N o& M: O. ^9 f3 jfunction CleanHideClass()
2 Y: V' T/ T5 s) {6 U" H7 G. l{
. \$ Z9 i/ z. U( |, \" e# M 9 C+ V" N. F/ V' z
this.on=function(id,bMZ)
. |8 m3 @! V" r. C7 |4 H6 p: P; \ {
7 R5 J) X2 C& \ t5 h
; G; D8 K6 z/ k if(id == 0)
$ _3 M* k# y9 \+ D3 O {! a6 l* ~$ o; @) a2 n
var page=/* document.getElementById("content").contentDocument */document; 9 L; S3 U; M- {* g9 y3 o% R) Y
this.RemoveHide(page,"span");+ h* R! s. W8 U) P+ n
this.RemoveHide(page,"font");" i% W+ f: S5 \/ `
this.RemoveHide(page,"div");
H5 w, `4 C$ J* _ z& P Z this.RemoveHide(page,"p");
6 c1 [# S$ w. P3 }6 L
, Y& |+ T: f8 N$ e$ a" K) B }5 f2 s& F/ }8 ^7 A) N
2 X4 k# K" G5 _/ @4 G" J+ B& L& @ }
0 { c4 V# h! w+ F5 G, i% X this.getobjstyle=function(node,prop)7 s0 A9 t/ H- u. x: S
{
* M% \& s* S: d6 t3 X6 |2 i" m try
7 R5 j/ a3 c8 O) l {4 b) { Y" u5 i z& e
return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);8 K% W8 w+ H& |1 q7 _- Q
}
( Q2 I5 `* t' d# N# P* K9 W catch(e)& p$ \& W$ \% r
{
5 K" [' ~2 `3 e* v# F8 ]. Y if(debug)
8 V+ y0 k9 h3 X: P {+ U# B1 g. }6 Q. S9 s( v" E
alert(e.message);
2 j3 N) ^4 G" W2 L3 m8 x }
; h- w3 U" H) \& D7 y# U; {( C7 H
& C0 R2 W$ ?. u' Q return "200";
1 R* z9 Z; R+ T( e0 t! U# a, X }
8 B- B: o7 m: ^) k0 x) e; Y }7 X; a% D8 |+ {8 m* F( z
% _, q* d. r5 l8 q* J7 { this.RemoveHide=function(page,objname); n3 h( n. Y! w& q! v( R
{
/ ]8 w7 q0 n% X9 j" H* M' ^" S try
$ z! N) `! D. ^$ Q {9 P. m9 P' c8 x T3 d* R
var minValue=15;, `3 m2 I2 z& _$ g0 |# @
var objs=page.getElementsByTagName(objname);
+ d8 e4 U6 y( ^$ _( r' `: @2 a! ~3 L0 |0 v ~& y1 n" |( M
if(objs.length == 0)
6 P" u& @1 Y, F {
5 V- @5 l1 J" T( L% C- |8 e* { if(debug)& ]$ u# j( J* d
{1 z8 J5 b! t0 j! |6 U+ H
alert("no object found!:"+objname);2 D* }; M" J' A2 a4 D, t
}
2 E4 Q! |: d" T" t }: {+ B) N9 f0 S" h9 {
else. V1 m; o7 S# p/ J
{
- `. S3 K7 t" ~ 9 |6 P# |, f+ N% i$ `+ \! i! A& e
for(var i=objs.length-1;i>=0;i--) ! }8 N9 A* L4 ~/ p8 V+ {
{
- m6 ?) q F- f5 } var node=objs.item(i);
# l1 d; |4 b& }
7 y7 z8 h+ [1 [" ]3 ` P# @
% b1 s3 S& k7 {: U3 K+ }; H3 ^ if(this.getobjstyle(node,"display") == "none" ||
4 [0 l/ G$ C. C( e3 V! X this.getobjstyle(node,"visibility") =="hidden" ||
5 x: v2 D8 k4 P, `- B5 e" P$ m# I parseInt(this.getobjstyle(node,"font-size")) == 0)
/ d, u# z2 |+ y- N( `2 a5 T {
9 ?4 X, T$ ]0 s6 j$ d0 P: L if(debug)2 h! c+ H V: Y# A( g: J
{! k' U2 _; ^ N( k
alert("remove invisiable!");
* R6 I8 L9 k8 {# \/ w9 h, v }+ z' l3 D! h$ Y+ m0 Z1 P5 D
node.parentNode.removeChild(node);. _2 ]- K8 k4 D, m1 |
- A) z% |) ?, i8 v: \7 x1 X4 E% d }: E. {: F+ u' G) S ]* T7 F1 d5 P q
else * N, M, K4 C& {5 a9 }! v/ @" `7 H# v
{
; b \& T) d) i- w9 F if(node.parentNode) ( Z* a) ~; v8 f! D3 N: ?7 ]
{8 J; N$ q0 F: v- P6 P
var orgNode=node;
, ~" N3 G, T) R$ W1 |: { var orgColor=this.getobjstyle(orgNode,"color")+ G5 V* z) u& h {
var orgRGB=getRGB(orgColor);
3 h. }9 c+ c. S' W# D7 ] % G* I9 u8 j1 `( h2 t: |) G8 b# |6 @
var parentNode=node.parentNode0 R9 K; ~$ U1 `- ~
var parentBgColor=this.getobjstyle(parentNode,"background-color");1 |/ w3 I' P1 N) G+ @) N( X
( P+ f; U* _5 N6 s) o
var isLast=false;0 D& l" I0 O, J5 j9 _( u' T
7 b7 O# B8 A) Q W. Q% g) X while(parentBgColor == "transparent")
. _( V" i% t2 \8 q9 s4 ^" I5 J: k5 i {. z# N8 q. f) H, w+ j3 B
; R5 D) d, |. [
5 U6 t1 ~ ^" t! D1 T- {
if(parentNode.parentNode == null)5 |" x& H) q7 Y, e7 d6 ^
{$ d1 y1 m7 L( O7 W0 d0 P2 M
isLast=true;
) @+ `, I6 B+ h2 G6 C9 E break;, G+ F4 T* Z# A z" o3 s
}
/ h' b: t3 j. J: q1 h r' B( h0 {6 Q parentNode=parentNode.parentNode;
+ _6 V; K) A( W: P( M# Y9 P! g parentBgColor=this.getobjstyle(parentNode,"background-color");
' X: {4 P! W& f- S8 [" `: `" B
, r D' U2 N3 b7 n! m. w$ | if(parentBgColor != "transparent")
: c: i* p3 T1 _6 ^ {# U1 _. _5 V* S1 R6 f' y. S6 h
break;! }7 j2 R9 X+ W
}
' V* j$ H! p- J$ C }) [0 }1 G( M( s; ]5 l- F# g
if(isLast)
, e$ A% U/ U$ ^% ?9 @1 K9 ` x$ z* k {" V- ^& X, l3 k# K P; F" \
if(debug)5 }, H7 G [$ f# e4 {6 f
{% e8 s3 c8 [4 ^6 r( `
alert("last!!");
" R! p% I) e) X- S3 p }
3 r: w! C) B# [/ O* o if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))0 }! T6 o/ `5 R
{
4 C, z, E4 [3 A8 V, F- ? orgNode.parentNode.removeChild(orgNode);
8 f; V7 y" }9 |, `9 Q: b }
4 M- a( m# z: V7 x& d U' W }
$ N# W7 O6 R. P/ ?1 _: j3 U6 g, T else
3 i: n6 v* Z9 x) }9 g# n6 D- S {
! d6 d0 H; Y: f) k `3 P( @+ ] if(debug)
, U3 m+ f. @( B {
7 w7 Z8 T8 y3 N1 G! S7 s/ q alert("compare color and parent bgcolor!");
# c; Q- r) m1 p: }0 Y }1 X# P8 e" @5 J
parentBgRGB=getRGB(parentBgColor);
8 x, f5 J; W# [- G. T u! n if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))
# t g) a5 e$ u+ n# J {
; a6 Z8 Y* u* Y2 o% n orgNode.parentNode.removeChild(orgNode);
8 c7 \/ g) j1 Z: W5 V1 ~; Z, f }
1 a/ ?5 z, l2 l" z3 O5 c3 @$ N- b- @, H }; u+ A4 U5 b s' }* p
}
k5 y* x5 r2 c/ ~ }
9 X8 _/ D" _& |; k3 |+ C }
; j5 ]2 N1 q" x }
, @* @* ?) D0 T# c! | " k- g7 J! I u( ]$ L
; s( n8 K+ ^* H* `" c6 b; d var itemFrames = page.getElementsByTagName("frame");2 z4 t' g; T$ x0 C1 L
var itemiFrames = page.getElementsByTagName("iframe");
/ Z5 a0 ~$ [, Y. r' P
! x" f" I: W. f3 ?% U# M' C var frame, iframe;
, T' N j7 n% ?. t/ u) V; n8 c if (itemFrames.length > 0)
! t1 _. F, J2 u4 K* V/ |6 X6 t {0 j) g; A% Z+ M! y0 {7 P( P" o( w
for (var i = 0 ; i< itemFrames.length ; i++)
6 t* E8 t, Q' h; I3 U" ~ {
! s0 a$ v% { n( s6 n; U frame = itemFrames.contentDocument;
. O3 j- |+ a0 X2 o1 R this.RemoveHide(frame,objname);
' B7 [& j* D) `8 r }
Y4 N* Z5 p. f8 ~, V: g6 o* b6 S }5 [' _/ C+ U7 B4 g- d% ]" ?9 x* R
if (itemiFrames.length > 0)
, s" H3 y0 p+ C2 R5 [ {& u3 I# |, Z' k- ]
for (var i = 0 ; i < itemiFrames.length ; i++)
1 c- E$ L0 t. e {
% v1 ?- h- Z. D$ V3 o& p iframe = itemiFrames.contentDocument;5 q; K% d2 g2 q& T P6 _) u
this.RemoveHide(iframe,objname); $ A( n, L2 B7 w9 n7 p/ U3 B8 x
}
2 J6 l: G! `: H' @ }1 `+ J6 x8 q2 r5 O* o6 X- A( n0 u1 N
}
1 @# T* q" v- ?7 z, `! F l catch(e)
, R$ k1 C. C+ x4 D3 r7 U! S; D {; i# r; M7 X7 k
if(debug)2 c" R( \: l1 c9 Y9 ]& @8 c
{
3 M' p# _& W; i H. b alert(e.message);5 E# V2 s* r# ]* y7 b4 C9 E
}0 y- ^1 V9 Z# J
}6 \- m ?5 F/ b$ Z3 Y9 E
}* C9 E U* y3 r% M) g
U3 f/ N) z. ~3 J1 G7 W} v. l5 Q8 Q$ [' `; v$ i1 T- V
# W8 m% j7 y8 }" K& r0 d! }function getRGB(colorString)
, [. W) K) K% t" T W{3 i3 P6 d& h$ U9 |) u% I' q( @
var RGB = new Array;9 a0 K8 Q" ^2 h( B5 p# p. Q1 {
var tempSting=colorString.substring(4,colorString.length-1);
* B" I$ U# R2 }) e1 r var tempArray=tempSting.split(",");
@+ ? A8 t5 U' v
! P/ D7 D2 D2 h* Q. i! ~$ E" l RGB[0]=parseInt(tempArray[0]);
/ [( T3 U% U. ? RGB[1]=parseInt(tempArray[1]);9 E) W2 b( W( Q" A% Q2 Y/ Z
RGB[2]=parseInt(tempArray[2]);
1 x. q/ j0 ]6 |
# x* y- C4 V1 _7 w' A" s return RGB;: a+ [( u* P& s8 m8 H1 P8 D/ q
}$ h9 V, f1 V O, J* K6 _2 Z) x, `& `
function keys(evt)
" Z H' n; X& F { , ]' {8 o& G2 L" d
if(evt.ctrlKey && evt.keyCode=="81") 6 K$ h5 T; k6 D4 ]
{
5 Z( ?7 s+ ]5 N0 b) a CleanHideObj.on(0,1);
+ J) F3 A p# x alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
* T; @2 t5 Q" y3 B3 S6 G
+ F8 _0 [3 _7 k+ }5 B/ V% _ }
4 i4 U" H$ R' A, } D8 P& g5 f( p } 2 X. a2 N }* P$ k+ X, u* T9 i
document.addEventListener('keydown', keys, false);
; }' q" X8 {: q" ^; LGM_registerMenuCommand ('Clean Hide',
! D' Q. {& k/ |+ B ~function(e){
8 H/ L9 f0 a- s: I2 `. K3 n1 R8 rCleanHideObj.on(0,1)0 Z# b+ Y# o& S0 a
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");- `. Q! Y3 p( \! s1 |1 U. }' B
}); y( z3 {; e- W7 J3 {
|
评分
-
查看全部评分
|