1 |
|
// Copyrig
ht (c) 200
0-2003 Qua
dralay Cor
poration.
All right
s reserved
.
|
|
1 |
|
// Copyrig
ht (c) 200
0-2003 Qua
dralay Cor
poration.
All right
s reserved
.
|
2 |
|
//
|
|
2 |
|
//
|
3 |
|
|
|
3 |
|
|
4 |
|
function
WWHHighlig
htWords_Ob
ject()
|
|
4 |
|
function
WWHHighlig
htWords_Ob
ject()
|
5 |
|
{
|
|
5 |
|
{
|
6 |
|
this.mWo
rdList = n
ull;
|
|
6 |
|
this.mWo
rdList = n
ull;
|
7 |
|
|
|
7 |
|
|
8 |
|
this.fSe
tWordList
= WWHHighl
ightWords_
SetWordLis
t;
|
|
8 |
|
this.fSe
tWordList
= WWHHighl
ightWords_
SetWordLis
t;
|
9 |
|
this.fEx
ec
= WWHHighl
ightWords_
Exec;
|
|
9 |
|
this.fEx
ec
= WWHHighl
ightWords_
Exec;
|
10 |
|
}
|
|
10 |
|
}
|
11 |
|
|
|
11 |
|
|
12 |
|
function
WWHHighlig
htWords_Se
tWordList(
ParamWordL
ist)
|
|
12 |
|
function
WWHHighlig
htWords_Se
tWordList(
ParamWordL
ist)
|
13 |
|
{
|
|
13 |
|
{
|
14 |
|
this.mWo
rdList = P
aramWordLi
st;
|
|
14 |
|
this.mWo
rdList = P
aramWordLi
st;
|
15 |
|
}
|
|
15 |
|
}
|
16 |
|
|
|
16 |
|
|
17 |
|
function
WWHHighlig
htWords_Ex
ec()
|
|
17 |
|
function
WWHHighlig
htWords_Ex
ec()
|
18 |
|
{
|
|
18 |
|
{
|
19 |
|
var Max
Index;
|
|
19 |
|
var Max
Index;
|
20 |
|
var Ind
ex;
|
|
20 |
|
var Ind
ex;
|
21 |
|
var Wor
dExpressio
ns;
|
|
21 |
|
var Wor
dExpressio
ns;
|
22 |
|
var Lon
gestWordEx
pression;
|
|
22 |
|
var Lon
gestWordEx
pression;
|
23 |
|
var Max
Expression
Index;
|
|
23 |
|
var Max
Expression
Index;
|
24 |
|
var Exp
ressionInd
ex;
|
|
24 |
|
var Exp
ressionInd
ex;
|
25 |
|
var Exp
ressionHas
h = null;
|
|
25 |
|
var Exp
ressionHas
h = null;
|
26 |
|
var Exp
ressionEnt
ry;
|
|
26 |
|
var Exp
ressionEnt
ry;
|
27 |
|
var Exp
ression;
|
|
27 |
|
var Exp
ression;
|
28 |
|
var Var
DocumentFr
ame;
|
|
28 |
|
var Var
DocumentFr
ame;
|
29 |
|
var Lon
gestWordEx
pressionKe
y;
|
|
29 |
|
var Lon
gestWordEx
pressionKe
y;
|
30 |
|
var New
Highlighte
dWords = n
ull;
|
|
30 |
|
var New
Highlighte
dWords = n
ull;
|
31 |
|
var Hig
hlightedWo
rds = null
;
|
|
31 |
|
var Hig
hlightedWo
rds = null
;
|
32 |
|
var Tex
tRange;
|
|
32 |
|
var Tex
tRange;
|
33 |
|
var Las
tCharTextR
ange;
|
|
33 |
|
var Las
tCharTextR
ange;
|
34 |
|
var bMa
tchFound;
|
|
34 |
|
var bMa
tchFound;
|
35 |
|
var bFi
rstMatch;
|
|
35 |
|
var bFi
rstMatch;
|
36 |
|
var New
Highlighte
dWordsKey;
|
|
36 |
|
var New
Highlighte
dWordsKey;
|
37 |
|
|
|
37 |
|
|
38 |
|
|
|
38 |
|
|
39 |
|
if ((WWH
Frame.WWHH
elp.mSetti
ngs.mbHigh
lightingEn
abled) &&
|
|
39 |
|
if ((WWH
Frame.WWHH
elp.mSetti
ngs.mbHigh
lightingEn
abled) &&
|
40 |
|
(thi
s.mWordLis
t != null)
)
|
|
40 |
|
(thi
s.mWordLis
t != null)
)
|
41 |
|
{
|
|
41 |
|
{
|
42 |
|
// Onl
y works un
der IE on
Windows
|
|
42 |
|
// Onl
y works un
der IE on
Windows
|
43 |
|
//
|
|
43 |
|
//
|
44 |
|
if ((W
WHFrame.WW
HBrowser.m
Browser ==
2) && //
Shorthand
for IE
|
|
44 |
|
if ((W
WHFrame.WW
HBrowser.m
Browser ==
2) && //
Shorthand
for IE
|
45 |
|
(W
WHFrame.WW
HBrowser.m
Platform =
= 1)) //
Shorthand
for Windo
ws
|
|
45 |
|
(W
WHFrame.WW
HBrowser.m
Platform =
= 1)) //
Shorthand
for Windo
ws
|
46 |
|
{
|
|
46 |
|
{
|
47 |
|
Expr
essionHash
= new W
WHHighligh
tWords_Exp
ressionHas
h_Object()
;
|
|
47 |
|
Expr
essionHash
= new W
WHHighligh
tWords_Exp
ressionHas
h_Object()
;
|
48 |
|
High
lightedWor
ds = new W
WHHighligh
tWords_Hig
hlightedWo
rds_Object
();
|
|
48 |
|
High
lightedWor
ds = new W
WHHighligh
tWords_Hig
hlightedWo
rds_Object
();
|
49 |
|
bFir
stMatch =
true;
|
|
49 |
|
bFir
stMatch =
true;
|
50 |
|
|
|
50 |
|
|
51 |
|
// A
ccess sear
ch words
|
|
51 |
|
// A
ccess sear
ch words
|
52 |
|
//
|
|
52 |
|
//
|
53 |
|
for
(MaxIndex
= this.mWo
rdList.len
gth, Index
= 0 ; Ind
ex < MaxIn
dex ; Inde
x++)
|
|
53 |
|
for
(MaxIndex
= this.mWo
rdList.len
gth, Index
= 0 ; Ind
ex < MaxIn
dex ; Inde
x++)
|
54 |
|
{
|
|
54 |
|
{
|
55 |
|
if
(this.mWo
rdList[Ind
ex].length
> 0)
|
|
55 |
|
if
(this.mWo
rdList[Ind
ex].length
> 0)
|
56 |
|
{
|
|
56 |
|
{
|
57 |
|
// Determi
ne longest
sub-expre
ssion betw
een '*'
|
|
57 |
|
// Determi
ne longest
sub-expre
ssion betw
een '*'
|
58 |
|
//
|
|
58 |
|
//
|
59 |
|
WordExpres
sions = th
is.mWordLi
st[Index].
split("*")
;
|
|
59 |
|
WordExpres
sions = th
is.mWordLi
st[Index].
split("*")
;
|
60 |
|
LongestWor
dExpressio
n = "";
|
|
60 |
|
LongestWor
dExpressio
n = "";
|
61 |
|
for (MaxEx
pressionIn
dex = Word
Expression
s.length,
Expression
Index = 0
; Expressi
onIndex <
MaxExpress
ionIndex ;
Expressio
nIndex++)
|
|
61 |
|
for (MaxEx
pressionIn
dex = Word
Expression
s.length,
Expression
Index = 0
; Expressi
onIndex <
MaxExpress
ionIndex ;
Expressio
nIndex++)
|
62 |
|
{
|
|
62 |
|
{
|
63 |
|
if (Word
Expression
s[Expressi
onIndex].l
ength > Lo
ngestWordE
xpression.
length)
|
|
63 |
|
if (Word
Expression
s[Expressi
onIndex].l
ength > Lo
ngestWordE
xpression.
length)
|
64 |
|
{
|
|
64 |
|
{
|
65 |
|
Longes
tWordExpre
ssion = Wo
rdExpressi
ons[Expres
sionIndex]
;
|
|
65 |
|
Longes
tWordExpre
ssion = Wo
rdExpressi
ons[Expres
sionIndex]
;
|
66 |
|
}
|
|
66 |
|
}
|
67 |
|
}
|
|
67 |
|
}
|
68 |
|
|
|
68 |
|
|
69 |
|
// Store s
earch expr
ession key
ed by long
est sub-ex
pression
|
|
69 |
|
// Store s
earch expr
ession key
ed by long
est sub-ex
pression
|
70 |
|
//
|
|
70 |
|
//
|
71 |
|
Expression
Entry = Ex
pressionHa
sh[Longest
WordExpres
sion + "~"
];
|
|
71 |
|
Expression
Entry = Ex
pressionHa
sh[Longest
WordExpres
sion + "~"
];
|
72 |
|
if (typeof
(Expressio
nEntry) ==
"undefine
d")
|
|
72 |
|
if (typeof
(Expressio
nEntry) ==
"undefine
d")
|
73 |
|
{
|
|
73 |
|
{
|
74 |
|
Expressi
onEntry =
new WWHHig
hlightWord
s_Expressi
onEntry_Ob
ject();
|
|
74 |
|
Expressi
onEntry =
new WWHHig
hlightWord
s_Expressi
onEntry_Ob
ject();
|
75 |
|
Expressi
onHash[Lon
gestWordEx
pression +
"~"] = Ex
pressionEn
try;
|
|
75 |
|
Expressi
onHash[Lon
gestWordEx
pression +
"~"] = Ex
pressionEn
try;
|
76 |
|
}
|
|
76 |
|
}
|
77 |
|
Expression
= WWHStri
ngUtilitie
s_WordToRe
gExpWithSp
acePattern
(this.mWor
dList[Inde
x]);
|
|
77 |
|
Expression
= WWHStri
ngUtilitie
s_WordToRe
gExpWithSp
acePattern
(this.mWor
dList[Inde
x]);
|
78 |
|
Expression
Entry.mExp
ressions[E
xpressionE
ntry.mExpr
essions.le
ngth] = ne
w RegExp(E
xpression,
"i");
|
|
78 |
|
Expression
Entry.mExp
ressions[E
xpressionE
ntry.mExpr
essions.le
ngth] = ne
w RegExp(E
xpression,
"i");
|
79 |
|
}
|
|
79 |
|
}
|
80 |
|
}
|
|
80 |
|
}
|
81 |
|
|
|
81 |
|
|
82 |
|
// E
nsure docu
ment windo
w has focu
s to avoid
"Incompat
ible marku
p pointers
" error
|
|
82 |
|
// E
nsure docu
ment windo
w has focu
s to avoid
"Incompat
ible marku
p pointers
" error
|
83 |
|
// h
ttp://xopu
s.com/devb
log/2008/i
nvalid-mar
kup-pointe
rs-revisit
ed
|
|
83 |
|
// h
ttp://xopu
s.com/devb
log/2008/i
nvalid-mar
kup-pointe
rs-revisit
ed
|
84 |
|
//
|
|
84 |
|
//
|
85 |
|
VarD
ocumentFra
me = eval(
WWHFrame.W
WHHelp.fGe
tFrameRefe
rence("WWH
DocumentFr
ame"));
|
|
85 |
|
VarD
ocumentFra
me = eval(
WWHFrame.W
WHHelp.fGe
tFrameRefe
rence("WWH
DocumentFr
ame"));
|
86 |
|
VarD
ocumentFra
me.focus()
;
|
|
86 |
|
VarD
ocumentFra
me.focus()
;
|
87 |
|
|
|
87 |
|
|
88 |
|
// S
earch docu
ment based
on longes
t sub-expr
essions
|
|
88 |
|
// S
earch docu
ment based
on longes
t sub-expr
essions
|
89 |
|
//
|
|
89 |
|
//
|
90 |
|
for
(LongestWo
rdExpressi
onKey in E
xpressionH
ash)
|
|
90 |
|
for
(LongestWo
rdExpressi
onKey in E
xpressionH
ash)
|
91 |
|
{
|
|
91 |
|
{
|
92 |
|
Lo
ngestWordE
xpression
= LongestW
ordExpress
ionKey.sub
string(0,
LongestWor
dExpressio
nKey.lengt
h - 1);
|
|
92 |
|
Lo
ngestWordE
xpression
= LongestW
ordExpress
ionKey.sub
string(0,
LongestWor
dExpressio
nKey.lengt
h - 1);
|
93 |
|
Ne
wHighlight
edWords =
new WWHHig
hlightWord
s_Highligh
tedWords_O
bject();
|
|
93 |
|
Ne
wHighlight
edWords =
new WWHHig
hlightWord
s_Highligh
tedWords_O
bject();
|
94 |
|
|
|
94 |
|
|
95 |
|
Te
xtRange =
VarDocumen
tFrame.doc
ument.body
.createTex
tRange();
|
|
95 |
|
Te
xtRange =
VarDocumen
tFrame.doc
ument.body
.createTex
tRange();
|
96 |
|
Te
xtRange.co
llapse();
|
|
96 |
|
Te
xtRange.co
llapse();
|
97 |
|
wh
ile (TextR
ange.findT
ext(Longes
tWordExpre
ssion, 1))
|
|
97 |
|
wh
ile (TextR
ange.findT
ext(Longes
tWordExpre
ssion, 1))
|
98 |
|
{
|
|
98 |
|
{
|
99 |
|
TextRange.
expand("wo
rd");
|
|
99 |
|
TextRange.
expand("wo
rd");
|
100 |
|
Expression
Entry = Ex
pressionHa
sh[Longest
WordExpres
sion + "~"
];
|
|
100 |
|
Expression
Entry = Ex
pressionHa
sh[Longest
WordExpres
sion + "~"
];
|
101 |
|
|
|
101 |
|
|
102 |
|
// Check w
ord agains
t search e
xpression
|
|
102 |
|
// Check w
ord agains
t search e
xpression
|
103 |
|
//
|
|
103 |
|
//
|
104 |
|
bMatchFoun
d = false;
|
|
104 |
|
bMatchFoun
d = false;
|
105 |
|
MaxExpress
ionIndex =
Expressio
nEntry.mEx
pressions.
length;
|
|
105 |
|
MaxExpress
ionIndex =
Expressio
nEntry.mEx
pressions.
length;
|
106 |
|
Expression
Index = 0;
|
|
106 |
|
Expression
Index = 0;
|
107 |
|
while (( !
bMatchFou
nd) &&
|
|
107 |
|
while (( !
bMatchFou
nd) &&
|
108 |
|
(Ex
pressionIn
dex < MaxE
xpressionI
ndex))
|
|
108 |
|
(Ex
pressionIn
dex < MaxE
xpressionI
ndex))
|
109 |
|
{
|
|
109 |
|
{
|
110 |
|
if (Expr
essionEntr
y.mExpress
ions[Expre
ssionIndex
].test(Tex
tRange.tex
t))
|
|
110 |
|
if (Expr
essionEntr
y.mExpress
ions[Expre
ssionIndex
].test(Tex
tRange.tex
t))
|
111 |
|
{
|
|
111 |
|
{
|
112 |
|
// Hig
hlight tex
t if not p
rocessed a
lready
|
|
112 |
|
// Hig
hlight tex
t if not p
rocessed a
lready
|
113 |
|
//
|
|
113 |
|
//
|
114 |
|
if (ty
peof(Highl
ightedWord
s[TextRang
e.text + "
~"]) == "u
ndefined")
|
|
114 |
|
if (ty
peof(Highl
ightedWord
s[TextRang
e.text + "
~"]) == "u
ndefined")
|
115 |
|
{
|
|
115 |
|
{
|
116 |
|
// R
ecord text
highlight
ed for thi
s expressi
on
|
|
116 |
|
// R
ecord text
highlight
ed for thi
s expressi
on
|
117 |
|
//
|
|
117 |
|
//
|
118 |
|
NewH
ighlighted
Words[Text
Range.text
+ "~"] =
true;
|
|
118 |
|
NewH
ighlighted
Words[Text
Range.text
+ "~"] =
true;
|
119 |
|
|
|
119 |
|
|
120 |
|
// T
ry to trim
off trail
ing whites
pace or .s
|
|
120 |
|
// T
ry to trim
off trail
ing whites
pace or .s
|
121 |
|
//
|
|
121 |
|
//
|
122 |
|
Last
CharTextRa
nge = Text
Range.dupl
icate();
|
|
122 |
|
Last
CharTextRa
nge = Text
Range.dupl
icate();
|
123 |
|
Last
CharTextRa
nge.moveSt
art("chara
cter", Tex
tRange.tex
t.length -
1);
|
|
123 |
|
Last
CharTextRa
nge.moveSt
art("chara
cter", Tex
tRange.tex
t.length -
1);
|
124 |
|
|
|
124 |
|
|
125 |
|
if (
(LastCharT
extRange.t
ext == " "
) ||
|
|
125 |
|
if (
(LastCharT
extRange.t
ext == " "
) ||
|
126 |
|
(LastCharT
extRange.t
ext == ","
) ||
|
|
126 |
|
(LastCharT
extRange.t
ext == ","
) ||
|
127 |
|
(LastCharT
extRange.t
ext == "."
))
|
|
127 |
|
(LastCharT
extRange.t
ext == "."
))
|
128 |
|
{
|
|
128 |
|
{
|
129 |
|
//
Prevent i
nfinite lo
ops if sea
rch is for
"," or ".
"
|
|
129 |
|
//
Prevent i
nfinite lo
ops if sea
rch is for
"," or ".
"
|
130 |
|
//
|
|
130 |
|
//
|
131 |
|
if
(LastChar
TextRange.
text != Lo
ngestWordE
xpression)
|
|
131 |
|
if
(LastChar
TextRange.
text != Lo
ngestWordE
xpression)
|
132 |
|
{
|
|
132 |
|
{
|
133 |
|
TextRange.
moveEnd("c
haracter",
-1);
|
|
133 |
|
TextRange.
moveEnd("c
haracter",
-1);
|
134 |
|
}
|
|
134 |
|
}
|
135 |
|
}
|
|
135 |
|
}
|
136 |
|
|
|
136 |
|
|
137 |
|
Text
Range.
past
e
HTML("<spa
n styl
e
='ba
c
kgr
o
und: " + W
WHFra
m
e.WWHHelp.
mSettings.
m
Highlighti
n
g
Back
ground
Color
+
"
; co
l
or: " +
WWHFrame.
WWHHelp.mS
ettings.mH
ighlightin
g
Fore
groundColo
r
+ "'>" +
TextRange.
htmlText +
"</span>"
);
|
|
137 |
|
// H
ighlight w
ords in te
xt range
|
|
|
|
|
138 |
|
//
|
|
|
|
|
139 |
|
Text
Range.exec
Command("F
oreColor",
false, WW
HFrame.WWH
Help.mSett
ings.mHigh
lightingFo
regroundCo
lor);
|
|
|
|
|
140 |
|
Text
Range.
e
x
e
c
C
o
m
m
a
n
d("
Back
Color
"
,
fa
l
se,
WWHFrame.
WWHHelp.mS
ettings.mH
ighlightin
g
Back
groundColo
r
);
|
138 |
|
|
|
141 |
|
|
139 |
|
if (
bFirstMatc
h)
|
|
142 |
|
if (
bFirstMatc
h)
|
140 |
|
{
|
|
143 |
|
{
|
141 |
|
Te
xtRange.sc
rollIntoVi
ew();
|
|
144 |
|
Te
xtRange.sc
rollIntoVi
ew();
|
142 |
|
|
|
145 |
|
|
143 |
|
bF
irstMatch
= false;
|
|
146 |
|
bF
irstMatch
= false;
|
144 |
|
}
|
|
147 |
|
}
|
145 |
|
|
|
148 |
|
|
146 |
|
bMat
chFound =
true;
|
|
149 |
|
bMat
chFound =
true;
|
147 |
|
}
|
|
150 |
|
}
|
148 |
|
}
|
|
151 |
|
}
|
149 |
|
|
|
152 |
|
|
150 |
|
Expressi
onIndex++;
|
|
153 |
|
Expressi
onIndex++;
|
151 |
|
}
|
|
154 |
|
}
|
152 |
|
|
|
155 |
|
|
153 |
|
TextRange.
collapse(f
alse);
|
|
156 |
|
TextRange.
collapse(f
alse);
|
154 |
|
}
|
|
157 |
|
}
|
155 |
|
|
|
158 |
|
|
156 |
|
//
Add highl
ighted wor
ds to hash
|
|
159 |
|
//
Add highl
ighted wor
ds to hash
|
157 |
|
//
|
|
160 |
|
//
|
158 |
|
fo
r (NewHigh
lightedWor
dsKey in N
ewHighligh
tedWords)
|
|
161 |
|
fo
r (NewHigh
lightedWor
dsKey in N
ewHighligh
tedWords)
|
159 |
|
{
|
|
162 |
|
{
|
160 |
|
Highlighte
dWords[New
Highlighte
dWordsKey]
= true;
|
|
163 |
|
Highlighte
dWords[New
Highlighte
dWordsKey]
= true;
|
161 |
|
}
|
|
164 |
|
}
|
162 |
|
}
|
|
165 |
|
}
|
163 |
|
}
|
|
166 |
|
}
|
164 |
|
}
|
|
167 |
|
}
|
165 |
|
|
|
168 |
|
|
166 |
|
// Highl
ight words
only once
|
|
169 |
|
// Highl
ight words
only once
|
167 |
|
//
|
|
170 |
|
//
|
168 |
|
this.mWo
rdList = n
ull;
|
|
171 |
|
this.mWo
rdList = n
ull;
|
169 |
|
}
|
|
172 |
|
}
|
170 |
|
|
|
173 |
|
|
171 |
|
function
WWHHighlig
htWords_Ex
pressionHa
sh_Object(
)
|
|
174 |
|
function
WWHHighlig
htWords_Ex
pressionHa
sh_Object(
)
|
172 |
|
{
|
|
175 |
|
{
|
173 |
|
}
|
|
176 |
|
}
|
174 |
|
|
|
177 |
|
|
175 |
|
function
WWHHighlig
htWords_Ex
pressionEn
try_Object
()
|
|
178 |
|
function
WWHHighlig
htWords_Ex
pressionEn
try_Object
()
|
176 |
|
{
|
|
179 |
|
{
|
177 |
|
this.mEx
pressions
= new Arra
y();
|
|
180 |
|
this.mEx
pressions
= new Arra
y();
|
178 |
|
}
|
|
181 |
|
}
|
179 |
|
|
|
182 |
|
|
180 |
|
function
WWHHighlig
htWords_Hi
ghlightedW
ords_Objec
t()
|
|
183 |
|
function
WWHHighlig
htWords_Hi
ghlightedW
ords_Objec
t()
|
181 |
|
{
|
|
184 |
|
{
|
182 |
|
}
|
|
185 |
|
}
|
Araxis Merge (but not the data content of this report) is Copyright © 1993-2007 Araxis Ltd (www.araxis.com). All rights reserved.