|
|
发表于 2013-4-7 23:47:38
|
显示全部楼层
本帖最后由 chenmeiyuan8 于 2013-4-8 00:01 编辑 " J: P- _0 W {0 q& Y
1 @- X8 M7 ]3 f火狐插件,用猴子
. ~. Z1 V2 [3 e- g) E& c, i5 }
4 ]2 y ]- V v8 n7 [% S8 m5 Y0 Bvar debug=false; $ l: H/ f& n( Y3 L2 e
var CleanHideObj=new CleanHideClass();
8 P& G. P0 @- [+ e7 x+ ]# D! @& x+ B( N* L- [8 u5 _- R
function CleanHideClass() ' I, _4 x9 P" _# u* K
{ * F+ R) l6 g% D. i9 m$ s# p
0 s3 k6 a+ A( K/ J# t this.on=function(id,bMZ)9 P" a7 V3 L$ N8 r" i
{" r+ t+ B; e; [7 @ y+ c- z
7 `$ ^( U- w# G& O, W if(id == 0)4 C& r8 ^* k% M7 k
{
% @) `, }/ I$ O8 H var page=/* document.getElementById("content").contentDocument */document;
d" s3 ?" k$ @) i+ Z6 y this.RemoveHide(page,"span");
7 p; O4 o2 s2 w+ c this.RemoveHide(page,"font");1 ]+ [ x# |1 s
this.RemoveHide(page,"div"); F) c( g) f* k. x Q$ f9 a% e
this.RemoveHide(page,"p");
" Z! Z# R9 s1 A% w# O. B& }3 q1 t" }
' o$ J0 y4 `4 ?* \% U }
# D W. T6 }. }3 H; m P5 a2 W
8 T4 y5 r4 [& |# i J, o }
) }4 R) K! f; H% E6 F this.getobjstyle=function(node,prop)
/ U) F+ P, w) M6 n {4 Y, w7 q% T, L% G' n# x' j2 W
try
# G! ?" N+ B, A, O6 B# E" b7 o {
: _! M* Z/ ]* ? return node.ownerDocument.defaultView.getComputedStyle(node, "").getPropertyValue(prop);
n1 ?4 E/ W( h9 Q }
% l0 G, c# T6 W- {2 W catch(e)
; m3 S. g' R# U {
3 }, N! n9 P3 w6 ` if(debug)0 s8 _3 j+ n1 y# |& y5 E7 F
{
' x2 s: c4 Q1 p alert(e.message);) t) W' D5 [- Q3 }, m
}
6 Q3 d$ T" B9 Z: d$ K
$ m: B3 D" B/ [( k; | return "200";9 R8 p8 g! ^. P9 \* P6 A5 h9 p- h
}
+ i0 K# i5 t6 T1 z }
$ X* C( K) J* q! M7 z2 B$ y. m4 G
. s K( `: b6 s. [ this.RemoveHide=function(page,objname)
- @! t8 w1 T9 o$ [4 f( R {( L9 I. Y0 x3 g6 D& O: E
try# s4 T" a, \( {/ x X* M
{
# ~' M3 @( ~- Q6 Q7 D var minValue=15;
3 G! G/ S3 Z1 m9 s var objs=page.getElementsByTagName(objname); - Q; c* ]* B: ^
7 {/ z6 n. Y" C$ Q6 X if(objs.length == 0) % R5 U% r6 D8 q/ x { R9 U7 B8 K% k
{
) w U7 K. j* Y/ g) Q6 }' F if(debug)6 L( j& Q! t2 r; n \
{
6 ~# i k5 ^2 S" X7 G4 f" w alert("no object found!:"+objname);
9 g+ S9 N6 x4 k W- u) i0 q }
2 c @/ O$ [: k% \4 c& T% } }$ O2 `; W f4 A. ~+ O1 E
else
+ u0 t: S% O# J0 c& z {
9 Z+ ?( u2 O; A" _0 z
& u! s+ V& M4 S' z: _ for(var i=objs.length-1;i>=0;i--) " w: i. `7 o3 i
{ {; V: j: E7 _& b4 ? S
var node=objs.item(i);
# Z+ a6 P( \7 ~3 j 6 q+ n" H& e, S$ T
' E* i( }+ v* l& F& r
if(this.getobjstyle(node,"display") == "none" ||# _5 S0 Q3 Q6 b% t
this.getobjstyle(node,"visibility") =="hidden" ||
( [. ~+ e, c# }& g4 n5 c0 K% n parseInt(this.getobjstyle(node,"font-size")) == 0)
3 i- d2 U* R* K {7 o' d6 M6 l" M3 C" @
if(debug): F$ h. A+ w, y" D; u- @
{& _; a5 N, s. h0 P. h
alert("remove invisiable!");
U' i0 } w, h7 W5 c }
1 r+ I) `8 N' @% H0 ?$ R node.parentNode.removeChild(node);
h# ^* Z4 {$ W. q3 L( d - ^: D+ a& _0 Z* b( q1 N
}
- o6 U3 \: G1 R+ A4 M, l/ p9 c else + w7 _ ]5 A7 J( e# e
{
# P% o# j' X% t/ s" w if(node.parentNode)
( t: f Y0 Q7 w" @7 U* [ {
/ y7 F. k- P/ `$ m' S- i var orgNode=node;
. O2 s. \$ Y: y2 S: ~ var orgColor=this.getobjstyle(orgNode,"color")7 G6 s& N0 M5 |$ F% S' H A( {
var orgRGB=getRGB(orgColor); ( j7 j1 p$ n0 m% U T
% }* n4 H' m# ]- c
var parentNode=node.parentNode' B, P* ~) @+ j# q2 z
var parentBgColor=this.getobjstyle(parentNode,"background-color");9 R! s% P' a. J. i% L
+ B4 R. C8 h- _5 p. y
var isLast=false;8 @" u5 ]' ~- n) R) J- Y' V8 Z
6 S1 l% X& S7 b9 C9 C/ ]# o$ N while(parentBgColor == "transparent")
- m; S; U& T: C7 t1 P& k1 |# M {/ H, ?; Q+ V- z0 Y+ o0 E. @
% k+ j! n3 u ]- K8 {
/ F! |5 o( [; K8 B
if(parentNode.parentNode == null)
) n1 ]. {7 n1 ]* e {$ X+ V p4 [& H( j) F& t% [, `
isLast=true;4 O2 P+ E4 I) e& X: c
break;
* p* Y% Y& R0 q; x' ~0 r9 V/ a }- Q4 b( @% \$ M: f# Y9 ~* n) b) F- M! O6 f
parentNode=parentNode.parentNode;
; g) i2 t7 N+ E; r1 U" e) `. F6 r8 } parentBgColor=this.getobjstyle(parentNode,"background-color");
" V6 v$ l* t. Y3 t& d9 ^) R' |! U1 j. f' O( K2 [4 {
if(parentBgColor != "transparent")
' u( L1 Y6 t( T9 W {
$ {) d* h- i( Z. P break;
* Z7 _$ c1 h7 h$ H }" {* F# J! H( {+ l% r' d
}$ z, A) q( I. y* F m5 m9 ^* _
if(isLast) : V( B( Q$ X: U* v# ` Z
{5 B' q( W0 ]5 ^! p0 W
if(debug)! X! Z: ?8 D# |: k P) k$ ]5 S
{
& |3 R5 T# Y$ `; `/ j6 g alert("last!!");' N( o* n5 j5 O, u- F& M
}
9 x7 _ d. T/ i3 f2 x if((Math.abs(orgRGB[0]-255)<=minValue)&&(Math.abs(orgRGB[1]-255)<=minValue)&&(Math.abs(orgRGB[2]-255)<=minValue))' c: I! L) f' Z( v
{
9 o3 g8 ^. F6 }* _ orgNode.parentNode.removeChild(orgNode);
1 l% A( c) ~2 W: ]7 [5 {3 N }* g0 c" D) c, ~/ ?7 ^& A* D4 z
}
7 v- w& t4 p: l/ y else8 z% e0 ~; u( O: H. r( q
{0 |& X- y; a* T$ }3 D" R4 S. ?
if(debug)4 ~8 T+ y; }4 o
{
" O) ]+ t5 J5 ~4 X) I alert("compare color and parent bgcolor!");
1 O) f2 s9 H4 P }3 Z% d% q- E/ d; V/ E6 q: G* B! U
parentBgRGB=getRGB(parentBgColor);' c* H2 @; {7 E+ p
if((Math.abs(orgRGB[0]-parentBgRGB[0])<=minValue)&&(Math.abs(orgRGB[1]-parentBgRGB[1])<=minValue)&&(Math.abs(orgRGB[2]-parentBgRGB[2])<=minValue))7 Q3 F: a: H t7 M8 v5 a
{
3 C- m( K( Y+ S( w3 U5 w orgNode.parentNode.removeChild(orgNode);
5 c. }$ E; P" E4 c }$ r$ P1 I) [% `7 I& e) [! ~
}$ B9 J+ m6 g1 F" ]. t& g
}
+ u7 V h: P0 B% k' ~6 c: A9 U, s8 z }9 \) d1 n$ m1 z- ?" l& V9 e
}6 V! T0 C! ^ T7 T+ a
}- [& e+ A' Q. r; n$ k
3 V7 `( Z% h) [ |
5 J; b3 D) u% u var itemFrames = page.getElementsByTagName("frame");! |4 _0 l, B- j k$ R
var itemiFrames = page.getElementsByTagName("iframe");" e& U) _; O7 Z/ x% w, A' A
5 ]3 n+ s2 Q+ `; U; H* ]
var frame, iframe;8 d7 V8 }3 |7 R9 |; Z
if (itemFrames.length > 0)) c$ n+ }- X$ H% z1 T* ~# ]0 X
{
& w: x" D* c/ k$ b7 Y; F" _5 u for (var i = 0 ; i< itemFrames.length ; i++) + t( M6 L# H9 t" l0 P
{
& o8 i3 r, ^2 U; V frame = itemFrames.contentDocument; _) }+ t8 Y& |* n# o) M* a+ w. Y
this.RemoveHide(frame,objname);
k8 w- z& o2 K/ X+ J }
4 k1 V* `6 h/ D! f& g" ^ }$ Y1 U3 d0 \; x; u, |7 s
if (itemiFrames.length > 0)
- y3 t' Q8 X; d. h {
) d5 h; \1 E) d+ @ for (var i = 0 ; i < itemiFrames.length ; i++) # q1 H. K0 ?3 `% L
{0 l5 O% j: G% q( P
iframe = itemiFrames.contentDocument;" J# Z8 E' A% z, H c& H5 u* U
this.RemoveHide(iframe,objname); ' v Q, y7 m3 i6 M
}! `9 Q0 F# _8 X1 w
}
/ N; k4 I9 @" `+ `) \6 o }
! x. E- u2 ]9 t7 J! _' g catch(e)
: ^6 [5 D8 d% m) [* b {7 u" F/ z& D5 w/ T6 @( k: l8 _" F
if(debug)
U e1 E, ~4 I: `* S% j {/ a, [; k' W. |# |
alert(e.message);
0 S5 _5 f v6 k# g8 v( |* i% N }
0 @1 @, G, |0 P) P4 {* N3 X' M! T }9 S$ N4 s1 Y# N* Z7 K: }, c1 R
}
; v, W6 |! a2 h; m2 | 9 J( p* m7 ~) @; M4 q1 W6 ]( X
}
' j k9 G" p, b) m) [# a6 G! w9 O$ Y) Z$ ^( G8 Q6 V
function getRGB(colorString)
2 n/ ?, b3 A% ]{! w# {) m9 n/ T e0 Z4 [
var RGB = new Array;0 e# |1 B* T0 C
var tempSting=colorString.substring(4,colorString.length-1);, M: b3 s' G' U8 a
var tempArray=tempSting.split(",");# ~; U7 s% b# |
2 x1 r7 N2 i: T, N8 ~9 ` RGB[0]=parseInt(tempArray[0]);9 P8 W5 t; W8 N7 n* ]4 H) s, ]
RGB[1]=parseInt(tempArray[1]);# s( X- I! D& A K: i
RGB[2]=parseInt(tempArray[2]);+ d1 `) n( E. b: E- g4 d* y
3 g; r5 S% J( d) h% K6 |/ _0 N) R) X return RGB;
3 D, p; C* b! P}
" m8 y/ R. `8 u9 j8 [; ]- O9 k0 {function keys(evt)
6 |! u9 L i ^( x! f {
: \" L" f9 o6 E$ N3 [; E O% G if(evt.ctrlKey && evt.keyCode=="81") 8 B$ h! P" R0 E7 Y3 S
{ * [, E8 }6 M0 o I- [/ v' C
CleanHideObj.on(0,1);: |( s8 p' C. o% H5 D
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q"); + w6 R9 Q, }1 J5 R5 t/ u* R8 R
! V0 o% j7 t3 f }
; N* N- k1 r& H# k4 k; o } 4 H; w: ?# B% y7 ^4 _' K8 n( g
document.addEventListener('keydown', keys, false);
: K- @4 \& E) A: v# C0 wGM_registerMenuCommand ('Clean Hide',
( V. @! b; M8 s5 P8 b4 s+ z& O( ~0 a4 N: Vfunction(e){2 J+ Y) t1 D% k/ ~7 Z
CleanHideObj.on(0,1); j4 q9 ^0 ?# O5 f5 Y7 B j& ?
alert("Clean Hide successfully! Remember Hotkeys: CTRL+Q");
0 m1 _& t! Z1 J});- ?- k. s5 ?2 M8 j5 w2 @
|
评分
-
查看全部评分
|