No regular expressions were active.
1 |
|
/**
|
|
|
2 |
|
* $Id: mc
windows.js
18 2006-0
6-29 14:11
:23Z spock
e $
|
|
|
3 |
|
*
|
|
|
4 |
|
* Moxieco
de DHTML W
indows scr
ipt.
|
|
|
5 |
|
*
|
|
|
6 |
|
* @author
Moxiecode
|
|
|
7 |
|
* @copyri
ght Copyri
ght © 2004
, Moxiecod
e Systems
AB, All ri
ghts reser
ved.
|
|
|
8 |
|
*/
|
|
|
9 |
|
|
|
|
10 |
|
// Windows
handler
|
|
|
11 |
|
function M
CWindows()
{
|
|
|
12 |
|
this.s
ettings =
new Array(
);
|
|
|
13 |
|
this.w
indows = n
ew Array()
;
|
|
|
14 |
|
this.i
sMSIE = (n
avigator.a
ppName ==
"Microsoft
Internet
Explorer")
;
|
|
|
15 |
|
this.i
sGecko = n
avigator.u
serAgent.i
ndexOf('Ge
cko') != -
1;
|
|
|
16 |
|
this.i
sSafari =
navigator.
userAgent.
indexOf('S
afari') !=
-1;
|
|
|
17 |
|
this.i
sMac = nav
igator.use
rAgent.ind
exOf('Mac'
) != -1;
|
|
|
18 |
|
this.i
sMSIE5_0 =
this.isMS
IE && (nav
igator.use
rAgent.ind
exOf('MSIE
5.0') !=
-1);
|
|
|
19 |
|
this.a
ction = "n
one";
|
|
|
20 |
|
this.s
electedWin
dow = null
;
|
|
|
21 |
|
this.z
index = 10
0;
|
|
|
22 |
|
this.m
ouseDownSc
reenX = 0;
|
|
|
23 |
|
this.m
ouseDownSc
reenY = 0;
|
|
|
24 |
|
this.m
ouseDownLa
yerX = 0;
|
|
|
25 |
|
this.m
ouseDownLa
yerY = 0;
|
|
|
26 |
|
this.m
ouseDownWi
dth = 0;
|
|
|
27 |
|
this.m
ouseDownHe
ight = 0;
|
|
|
28 |
|
};
|
|
|
29 |
|
|
|
|
30 |
|
MCWindows.
prototype.
init = fun
ction(sett
ings) {
|
|
|
31 |
|
this.s
ettings =
settings;
|
|
|
32 |
|
|
|
|
33 |
|
if (th
is.isMSIE)
|
|
|
34 |
|
th
is.addEven
t(document
, "mousemo
ve", mcWin
dows.event
Dispatcher
);
|
|
|
35 |
|
else
|
|
|
36 |
|
th
is.addEven
t(window,
"mousemove
", mcWindo
ws.eventDi
spatcher);
|
|
|
37 |
|
|
|
|
38 |
|
this.a
ddEvent(do
cument, "m
ouseup", m
cWindows.e
ventDispat
cher);
|
|
|
39 |
|
};
|
|
|
40 |
|
|
|
|
41 |
|
MCWindows.
prototype.
getParam =
function(
name, defa
ult_value)
{
|
|
|
42 |
|
var va
lue = null
;
|
|
|
43 |
|
|
|
|
44 |
|
value
= (typeof(
this.setti
ngs[name])
== "undef
ined") ? d
efault_val
ue : this.
settings[n
ame];
|
|
|
45 |
|
|
|
|
46 |
|
// Fix
bool valu
es
|
|
|
47 |
|
if (va
lue == "tr
ue" || val
ue == "fal
se")
|
|
|
48 |
|
re
turn (valu
e == "true
");
|
|
|
49 |
|
|
|
|
50 |
|
return
value;
|
|
|
51 |
|
};
|
|
|
52 |
|
|
|
|
53 |
|
MCWindows.
prototype.
eventDispa
tcher = fu
nction(e)
{
|
|
|
54 |
|
e = ty
peof(e) ==
"undefine
d" ? windo
w.event :
e;
|
|
|
55 |
|
|
|
|
56 |
|
if (mc
Windows.se
lectedWind
ow == null
)
|
|
|
57 |
|
re
turn;
|
|
|
58 |
|
|
|
|
59 |
|
// Swi
tch focus
|
|
|
60 |
|
if (mc
Windows.is
Gecko && e
.type == "
mousedown"
) {
|
|
|
61 |
|
va
r elm = e.
currentTar
get;
|
|
|
62 |
|
|
|
|
63 |
|
fo
r (var n i
n mcWindow
s.windows)
{
|
|
|
64 |
|
var win
= mcWindow
s.windows[
n];
|
|
|
65 |
|
if (type
of(win) ==
'function
')
|
|
|
66 |
|
cont
inue;
|
|
|
67 |
|
|
|
|
68 |
|
if (win.
headElemen
t == elm |
| win.resi
zeElement
== elm) {
|
|
|
69 |
|
win.
focus();
|
|
|
70 |
|
brea
k;
|
|
|
71 |
|
}
|
|
|
72 |
|
}
|
|
|
73 |
|
}
|
|
|
74 |
|
|
|
|
75 |
|
switch
(e.type)
{
|
|
|
76 |
|
ca
se "mousem
ove":
|
|
|
77 |
|
mcWindow
s.selected
Window.onM
ouseMove(e
);
|
|
|
78 |
|
break;
|
|
|
79 |
|
|
|
|
80 |
|
ca
se "mouseu
p":
|
|
|
81 |
|
mcWindow
s.selected
Window.onM
ouseUp(e);
|
|
|
82 |
|
break;
|
|
|
83 |
|
|
|
|
84 |
|
ca
se "moused
own":
|
|
|
85 |
|
mcWindow
s.selected
Window.onM
ouseDown(e
);
|
|
|
86 |
|
break;
|
|
|
87 |
|
|
|
|
88 |
|
ca
se "focus"
:
|
|
|
89 |
|
mcWindow
s.selected
Window.onF
ocus(e);
|
|
|
90 |
|
break;
|
|
|
91 |
|
}
|
|
|
92 |
|
}
|
|
|
93 |
|
|
|
|
94 |
|
MCWindows.
prototype.
addEvent =
function(
obj, name,
handler)
{
|
|
|
95 |
|
if (th
is.isMSIE)
|
|
|
96 |
|
ob
j.attachEv
ent("on" +
name, han
dler);
|
|
|
97 |
|
else
|
|
|
98 |
|
ob
j.addEvent
Listener(n
ame, handl
er, true);
|
|
|
99 |
|
};
|
|
|
100 |
|
|
|
|
101 |
|
MCWindows.
prototype.
cancelEven
t = functi
on(e) {
|
|
|
102 |
|
if (th
is.isMSIE)
{
|
|
|
103 |
|
e.
returnValu
e = false;
|
|
|
104 |
|
e.
cancelBubb
le = true;
|
|
|
105 |
|
} else
|
|
|
106 |
|
e.
preventDef
ault();
|
|
|
107 |
|
};
|
|
|
108 |
|
|
|
|
109 |
|
MCWindows.
prototype.
parseFeatu
res = func
tion(opts)
{
|
|
|
110 |
|
// Cle
anup the o
ptions
|
|
|
111 |
|
opts =
opts.toLo
werCase();
|
|
|
112 |
|
opts =
opts.repl
ace(/;/g,
",");
|
|
|
113 |
|
opts =
opts.repl
ace(/[^0-9
a-z=,]/g,
"");
|
|
|
114 |
|
|
|
|
115 |
|
var op
tionChunks
= opts.sp
lit(',');
|
|
|
116 |
|
var op
tions = ne
w Array();
|
|
|
117 |
|
|
|
|
118 |
|
option
s['left']
= 10;
|
|
|
119 |
|
option
s['top'] =
10;
|
|
|
120 |
|
option
s['width']
= 300;
|
|
|
121 |
|
option
s['height'
] = 300;
|
|
|
122 |
|
option
s['resizab
le'] = tru
e;
|
|
|
123 |
|
option
s['minimiz
able'] = t
rue;
|
|
|
124 |
|
option
s['maximiz
able'] = t
rue;
|
|
|
125 |
|
option
s['close']
= true;
|
|
|
126 |
|
option
s['movable
'] = true;
|
|
|
127 |
|
|
|
|
128 |
|
if (op
ts == "")
|
|
|
129 |
|
re
turn optio
ns;
|
|
|
130 |
|
|
|
|
131 |
|
for (v
ar i=0; i<
optionChun
ks.length;
i++) {
|
|
|
132 |
|
va
r parts =
optionChun
ks[i].spli
t('=');
|
|
|
133 |
|
|
|
|
134 |
|
if
(parts.le
ngth == 2)
|
|
|
135 |
|
options[
parts[0]]
= parts[1]
;
|
|
|
136 |
|
}
|
|
|
137 |
|
|
|
|
138 |
|
return
options;
|
|
|
139 |
|
};
|
|
|
140 |
|
|
|
|
141 |
|
MCWindows.
prototype.
open = fun
ction(url,
name, fea
tures) {
|
|
|
142 |
|
var wi
n = new MC
Window();
|
|
|
143 |
|
var wi
nDiv, html
= "", id;
|
|
|
144 |
|
|
|
|
145 |
|
featur
es = this.
parseFeatu
res(featur
es);
|
|
|
146 |
|
|
|
|
147 |
|
// Cre
ate div
|
|
|
148 |
|
id = "
mcWindow_"
+ name;
|
|
|
149 |
|
|
|
|
150 |
|
width
= parseInt
(features[
'width']);
|
|
|
151 |
|
height
= parseIn
t(features
['height']
)-12-19;
|
|
|
152 |
|
|
|
|
153 |
|
if (th
is.isMSIE)
|
|
|
154 |
|
wi
dth -= 2;
|
|
|
155 |
|
|
|
|
156 |
|
// Set
up first p
art of win
dow
|
|
|
157 |
|
win.id
= id;
|
|
|
158 |
|
win.ur
l = url;
|
|
|
159 |
|
win.na
me = name;
|
|
|
160 |
|
win.fe
atures = f
eatures;
|
|
|
161 |
|
this.w
indows[nam
e] = win;
|
|
|
162 |
|
|
|
|
163 |
|
iframe
Width = wi
dth;
|
|
|
164 |
|
iframe
Height = h
eight;
|
|
|
165 |
|
|
|
|
166 |
|
// Cre
ate inner
content
|
|
|
167 |
|
html +
= '<!DOCTY
PE html PU
BLIC "-//W
3C//DTD HT
ML 4.0 Tra
nsitional/
/EN">';
|
|
|
168 |
|
html +
= '<html>'
;
|
|
|
169 |
|
html +
= '<head>'
;
|
|
|
170 |
|
html +
= '<title>
Wrapper if
rame</titl
e>';
|
|
|
171 |
|
html +
= '<meta h
ttp-equiv=
"Content-T
ype" conte
nt="text/h
tml; chars
et=UTF-8">
';
|
|
|
172 |
|
html +
= '<link h
ref="../js
cripts/tin
y_mce/them
es/advance
d/css/edit
or_ui.css"
rel="styl
esheet" ty
pe="text/c
ss" />';
|
|
|
173 |
|
html +
= '</head>
';
|
|
|
174 |
|
html +
= '<body o
nload="par
ent.mcWind
ows.onLoad
(\'' + nam
e + '\');"
>';
|
|
|
175 |
|
|
|
|
176 |
|
html +
= '<div id
="' + id +
'_contain
er" class=
"mceWindow
">';
|
|
|
177 |
|
html +
= '<div id
="' + id +
'_head" c
lass="mceW
indowHead"
onmousedo
wn="parent
.mcWindows
.windows[\
'' + name
+ '\'].foc
us();">';
|
|
|
178 |
|
html +
= ' <div
id="' + id
+ '_title
" class="m
ceWindowTi
tle"';
|
|
|
179 |
|
html +
= ' onsel
ectstart="
return fal
se;" unsel
ectable="o
n" style="
-moz-user-
select: no
ne !import
ant;">No n
ame window
</div>';
|
|
|
180 |
|
html +
= ' <di
v class="m
ceWindowHe
adTools">'
;
|
|
|
181 |
|
html +
= ' <
a href="ja
vascript:p
arent.mcWi
ndows.wind
ows[\'' +
name + '\'
].close();
" onmoused
own="retur
n false;"
class="mce
WindowClos
e"><img bo
rder="0" s
rc="../jsc
ripts/tiny
_mce/theme
s/advanced
/images/wi
ndow_close
.gif" /></
a>';
|
|
|
182 |
|
// html +
= ' <
a href="ja
vascript:m
cWindows.w
indows[\''
+ name +
'\'].maxim
ize();" on
mousedown=
"return fa
lse;" clas
s="mceWind
owMaximize
"></a>';
|
|
|
183 |
|
// html +
= ' <
a href="ja
vascript:m
cWindows.w
indows[\''
+ name +
'\'].minim
ize();" on
mousedown=
"return fa
lse;" clas
s="mceWind
owMinimize
"></a>';
|
|
|
184 |
|
html +
= ' </d
iv>';
|
|
|
185 |
|
html +
= '</div><
div id="'
+ id + '_b
ody" class
="mceWindo
wBody" sty
le="width:
' + width
+ 'px; he
ight: ' +
height + '
px;">';
|
|
|
186 |
|
html +
= '<iframe
id="' + i
d + '_ifra
me" name="
' + id + '
_iframe" o
nfocus="pa
rent.mcWin
dows.windo
ws[\'' + n
ame + '\']
.focus();"
framebord
er="0" wid
th="' + if
rameWidth
+ '" heigh
t="' + ifr
ameHeight
+ '" src="
' + url +
'" class="
mceWindowB
odyIframe"
></iframe>
</div>';
|
|
|
187 |
|
html +
= '<div id
="' + id +
'_statusb
ar" class=
"mceWindow
Statusbar"
onmousedo
wn="parent
.mcWindows
.windows[\
'' + name
+ '\'].foc
us();">';
|
|
|
188 |
|
html +
= '<div id
="' + id +
'_resize"
class="mc
eWindowRes
ize"><img
onmousedow
n="parent.
mcWindows.
windows[\'
' + name +
'\'].focu
s();" bord
er="0" src
="../jscri
pts/tiny_m
ce/themes/
advanced/i
mages/wind
ow_resize.
gif" /></d
iv>';
|
|
|
189 |
|
html +
= '</div>'
;
|
|
|
190 |
|
html +
= '</div>'
;
|
|
|
191 |
|
|
|
|
192 |
|
html +
= '</body>
';
|
|
|
193 |
|
html +
= '</html>
';
|
|
|
194 |
|
|
|
|
195 |
|
// Cre
ate iframe
|
|
|
196 |
|
this.c
reateFloat
ingIFrame(
id, featur
es['left']
, features
['top'], f
eatures['w
idth'], fe
atures['he
ight'], ht
ml);
|
|
|
197 |
|
};
|
|
|
198 |
|
|
|
|
199 |
|
// Gets ca
lled when
wrapper if
rame is in
itialized
|
|
|
200 |
|
MCWindows.
prototype.
onLoad = f
unction(na
me) {
|
|
|
201 |
|
var wi
n = mcWind
ows.window
s[name];
|
|
|
202 |
|
var id
= "mcWind
ow_" + nam
e;
|
|
|
203 |
|
var wr
apperIfram
e = window
.frames[id
+ "_ifram
e"].frames
[0];
|
|
|
204 |
|
var wr
apperDoc =
window.fr
ames[id +
"_iframe"]
.document;
|
|
|
205 |
|
var do
c = window
.frames[id
+ "_ifram
e"].docume
nt;
|
|
|
206 |
|
var wi
nDiv = doc
ument.getE
lementById
("mcWindow
_" + name
+ "_div");
|
|
|
207 |
|
var re
alIframe =
window.fr
ames[id +
"_iframe"]
.frames[0]
;
|
|
|
208 |
|
|
|
|
209 |
|
// Set
window da
ta
|
|
|
210 |
|
win.id
= "mcWind
ow_" + nam
e + "_ifra
me";
|
|
|
211 |
|
win.wi
nElement =
winDiv;
|
|
|
212 |
|
win.bo
dyElement
= doc.getE
lementById
(id + '_bo
dy');
|
|
|
213 |
|
win.if
rameElemen
t = doc.ge
tElementBy
Id(id + '_
iframe');
|
|
|
214 |
|
win.he
adElement
= doc.getE
lementById
(id + '_he
ad');
|
|
|
215 |
|
win.ti
tleElement
= doc.get
ElementByI
d(id + '_t
itle');
|
|
|
216 |
|
win.re
sizeElemen
t = doc.ge
tElementBy
Id(id + '_
resize');
|
|
|
217 |
|
win.co
ntainerEle
ment = doc
.getElemen
tById(id +
'_contain
er');
|
|
|
218 |
|
win.le
ft = win.f
eatures['l
eft'];
|
|
|
219 |
|
win.to
p = win.fe
atures['to
p'];
|
|
|
220 |
|
win.fr
ame = wind
ow.frames[
id + '_ifr
ame'].fram
es[0];
|
|
|
221 |
|
win.wr
apperFrame
= window.
frames[id
+ '_iframe
'];
|
|
|
222 |
|
win.wr
apperIFram
eElement =
document.
getElement
ById(id +
"_iframe")
;
|
|
|
223 |
|
|
|
|
224 |
|
// Add
event han
dlers
|
|
|
225 |
|
mcWind
ows.addEve
nt(win.hea
dElement,
"mousedown
", mcWindo
ws.eventDi
spatcher);
|
|
|
226 |
|
mcWind
ows.addEve
nt(win.res
izeElement
, "mousedo
wn", mcWin
dows.event
Dispatcher
);
|
|
|
227 |
|
|
|
|
228 |
|
if (mc
Windows.is
MSIE) {
|
|
|
229 |
|
mc
Windows.ad
dEvent(rea
lIframe.do
cument, "m
ousemove",
mcWindows
.eventDisp
atcher);
|
|
|
230 |
|
mc
Windows.ad
dEvent(rea
lIframe.do
cument, "m
ouseup", m
cWindows.e
ventDispat
cher);
|
|
|
231 |
|
} else
{
|
|
|
232 |
|
mc
Windows.ad
dEvent(rea
lIframe, "
mousemove"
, mcWindow
s.eventDis
patcher);
|
|
|
233 |
|
mc
Windows.ad
dEvent(rea
lIframe, "
mouseup",
mcWindows.
eventDispa
tcher);
|
|
|
234 |
|
mc
Windows.ad
dEvent(rea
lIframe, "
focus", mc
Windows.ev
entDispatc
her);
|
|
|
235 |
|
}
|
|
|
236 |
|
|
|
|
237 |
|
for (v
ar i=0; i<
window.fra
mes.length
; i++) {
|
|
|
238 |
|
if
(!window.
frames[i].
_hasMouseH
andlers) {
|
|
|
239 |
|
if (mcWi
ndows.isMS
IE) {
|
|
|
240 |
|
mcWi
ndows.addE
vent(windo
w.frames[i
].document
, "mousemo
ve", mcWin
dows.event
Dispatcher
);
|
|
|
241 |
|
mcWi
ndows.addE
vent(windo
w.frames[i
].document
, "mouseup
", mcWindo
ws.eventDi
spatcher);
|
|
|
242 |
|
} else {
|
|
|
243 |
|
mcWi
ndows.addE
vent(windo
w.frames[i
], "mousem
ove", mcWi
ndows.even
tDispatche
r);
|
|
|
244 |
|
mcWi
ndows.addE
vent(windo
w.frames[i
], "mouseu
p", mcWind
ows.eventD
ispatcher)
;
|
|
|
245 |
|
}
|
|
|
246 |
|
|
|
|
247 |
|
window.f
rames[i]._
hasMouseHa
ndlers = t
rue;
|
|
|
248 |
|
}
|
|
|
249 |
|
}
|
|
|
250 |
|
|
|
|
251 |
|
if (mc
Windows.is
MSIE) {
|
|
|
252 |
|
mc
Windows.ad
dEvent(win
.frame.doc
ument, "mo
usemove",
mcWindows.
eventDispa
tcher);
|
|
|
253 |
|
mc
Windows.ad
dEvent(win
.frame.doc
ument, "mo
useup", mc
Windows.ev
entDispatc
her);
|
|
|
254 |
|
} else
{
|
|
|
255 |
|
mc
Windows.ad
dEvent(win
.frame, "m
ousemove",
mcWindows
.eventDisp
atcher);
|
|
|
256 |
|
mc
Windows.ad
dEvent(win
.frame, "m
ouseup", m
cWindows.e
ventDispat
cher);
|
|
|
257 |
|
mc
Windows.ad
dEvent(win
.frame, "f
ocus", mcW
indows.eve
ntDispatch
er);
|
|
|
258 |
|
}
|
|
|
259 |
|
|
|
|
260 |
|
this.s
electedWin
dow = win;
|
|
|
261 |
|
};
|
|
|
262 |
|
|
|
|
263 |
|
MCWindows.
prototype.
createFloa
tingIFrame
= functio
n(id_prefi
x, left, t
op, width,
height, h
tml) {
|
|
|
264 |
|
var if
rame = doc
ument.crea
teElement(
"iframe");
|
|
|
265 |
|
var di
v = docume
nt.createE
lement("di
v");
|
|
|
266 |
|
|
|
|
267 |
|
width
= parseInt
(width);
|
|
|
268 |
|
height
= parseIn
t(height)+
1;
|
|
|
269 |
|
|
|
|
270 |
|
// Cre
ate wrappe
r div
|
|
|
271 |
|
div.se
tAttribute
("id", id_
prefix + "
_div");
|
|
|
272 |
|
div.se
tAttribute
("width",
width);
|
|
|
273 |
|
div.se
tAttribute
("height",
(height))
;
|
|
|
274 |
|
div.st
yle.positi
on = "abso
lute";
|
|
|
275 |
|
div.st
yle.left =
left + "p
x";
|
|
|
276 |
|
div.st
yle.top =
top + "px"
;
|
|
|
277 |
|
div.st
yle.width
= width +
"px";
|
|
|
278 |
|
div.st
yle.height
= (height
) + "px";
|
|
|
279 |
|
div.st
yle.backgr
oundColor
= "white";
|
|
|
280 |
|
div.st
yle.displa
y = "none"
;
|
|
|
281 |
|
|
|
|
282 |
|
if (th
is.isGecko
) {
|
|
|
283 |
|
if
rameWidth
= width +
2;
|
|
|
284 |
|
if
rameHeight
= height
+ 2;
|
|
|
285 |
|
} else
{
|
|
|
286 |
|
if
rameWidth
= width;
|
|
|
287 |
|
if
rameHeight
= height
+ 1;
|
|
|
288 |
|
}
|
|
|
289 |
|
|
|
|
290 |
|
// Cre
ate iframe
|
|
|
291 |
|
iframe
.setAttrib
ute("id",
id_prefix
+ "_iframe
");
|
|
|
292 |
|
iframe
.setAttrib
ute("name"
, id_prefi
x + "_ifra
me");
|
|
|
293 |
|
iframe
.setAttrib
ute("borde
r", "0");
|
|
|
294 |
|
iframe
.setAttrib
ute("frame
Border", "
0");
|
|
|
295 |
|
iframe
.setAttrib
ute("margi
nWidth", "
0");
|
|
|
296 |
|
iframe
.setAttrib
ute("margi
nHeight",
"0");
|
|
|
297 |
|
iframe
.setAttrib
ute("leftM
argin", "0
");
|
|
|
298 |
|
iframe
.setAttrib
ute("topMa
rgin", "0"
);
|
|
|
299 |
|
iframe
.setAttrib
ute("width
", iframeW
idth);
|
|
|
300 |
|
iframe
.setAttrib
ute("heigh
t", iframe
Height);
|
|
|
301 |
|
// iframe
.setAttrib
ute("src",
"../jscri
pts/tiny_m
ce/blank.h
tm");
|
|
|
302 |
|
// ifr
ame.setAtt
ribute("al
lowtranspa
rency", "f
alse");
|
|
|
303 |
|
iframe
.setAttrib
ute("scrol
ling", "no
");
|
|
|
304 |
|
iframe
.style.wid
th = ifram
eWidth + "
px";
|
|
|
305 |
|
iframe
.style.hei
ght = ifra
meHeight +
"px";
|
|
|
306 |
|
iframe
.style.bac
kgroundCol
or = "whit
e";
|
|
|
307 |
|
div.ap
pendChild(
iframe);
|
|
|
308 |
|
|
|
|
309 |
|
docume
nt.body.ap
pendChild(
div);
|
|
|
310 |
|
|
|
|
311 |
|
// Fix
ed MSIE 5.
0 issue
|
|
|
312 |
|
div.in
nerHTML =
div.innerH
TML;
|
|
|
313 |
|
|
|
|
314 |
|
if (th
is.isSafar
i) {
|
|
|
315 |
|
//
Give Safa
ri some ti
me to setu
p
|
|
|
316 |
|
wi
ndow.setTi
meout(func
tion() {
|
|
|
317 |
|
doc = wi
ndow.frame
s[id_prefi
x + '_ifra
me'].docum
ent;
|
|
|
318 |
|
doc.open
();
|
|
|
319 |
|
doc.writ
e(html);
|
|
|
320 |
|
doc.clos
e();
|
|
|
321 |
|
},
10);
|
|
|
322 |
|
} else
{
|
|
|
323 |
|
do
c = window
.frames[id
_prefix +
'_iframe']
.window.do
cument
|
|
|
324 |
|
do
c.open();
|
|
|
325 |
|
do
c.write(ht
ml);
|
|
|
326 |
|
do
c.close();
|
|
|
327 |
|
}
|
|
|
328 |
|
|
|
|
329 |
|
div.st
yle.displa
y = "block
";
|
|
|
330 |
|
|
|
|
331 |
|
return
div;
|
|
|
332 |
|
};
|
|
|
333 |
|
|
|
|
334 |
|
// Window
instance
|
|
|
335 |
|
function M
CWindow()
{
|
|
|
336 |
|
};
|
|
|
337 |
|
|
|
|
338 |
|
MCWindow.p
rototype.f
ocus = fun
ction() {
|
|
|
339 |
|
this.w
inElement.
style.zInd
ex = mcWin
dows.zinde
x++;
|
|
|
340 |
|
mcWind
ows.select
edWindow =
this;
|
|
|
341 |
|
};
|
|
|
342 |
|
|
|
|
343 |
|
MCWindow.p
rototype.m
inimize =
function()
{
|
|
|
344 |
|
};
|
|
|
345 |
|
|
|
|
346 |
|
MCWindow.p
rototype.m
aximize =
function()
{
|
|
|
347 |
|
|
|
|
348 |
|
};
|
|
|
349 |
|
|
|
|
350 |
|
MCWindow.p
rototype.s
tartResize
= functio
n() {
|
|
|
351 |
|
mcWind
ows.action
= "resize
";
|
|
|
352 |
|
};
|
|
|
353 |
|
|
|
|
354 |
|
MCWindow.p
rototype.s
tartMove =
function(
e) {
|
|
|
355 |
|
mcWind
ows.action
= "move";
|
|
|
356 |
|
};
|
|
|
357 |
|
|
|
|
358 |
|
MCWindow.p
rototype.c
lose = fun
ction() {
|
|
|
359 |
|
docume
nt.body.re
moveChild(
this.winEl
ement);
|
|
|
360 |
|
mcWind
ows.window
s[this.nam
e] = null;
|
|
|
361 |
|
};
|
|
|
362 |
|
|
|
|
363 |
|
MCWindow.p
rototype.o
nMouseMove
= functio
n(e) {
|
|
|
364 |
|
var sc
rollX = 0;
//this.doc
.body.scro
llLeft;
|
|
|
365 |
|
var sc
rollY = 0;
//this.doc
.body.scro
llTop;
|
|
|
366 |
|
|
|
|
367 |
|
// Cal
culate rea
l X, Y
|
|
|
368 |
|
var dx
= e.scree
nX - mcWin
dows.mouse
DownScreen
X;
|
|
|
369 |
|
var dy
= e.scree
nY - mcWin
dows.mouse
DownScreen
Y;
|
|
|
370 |
|
|
|
|
371 |
|
switch
(mcWindow
s.action)
{
|
|
|
372 |
|
ca
se "resize
":
|
|
|
373 |
|
width =
mcWindows.
mouseDownW
idth + (e.
screenX -
mcWindows.
mouseDownS
creenX);
|
|
|
374 |
|
height =
mcWindows
.mouseDown
Height + (
e.screenY
- mcWindow
s.mouseDow
nScreenY);
|
|
|
375 |
|
|
|
|
376 |
|
width =
width < 10
0 ? 100 :
width;
|
|
|
377 |
|
height =
height <
100 ? 100
: height;
|
|
|
378 |
|
|
|
|
379 |
|
this.wra
pperIFrame
Element.st
yle.width
= width+2;
|
|
|
380 |
|
this.wra
pperIFrame
Element.st
yle.height
= height+
2;
|
|
|
381 |
|
this.wra
pperIFrame
Element.wi
dth = widt
h+2;
|
|
|
382 |
|
this.wra
pperIFrame
Element.he
ight = hei
ght+2;
|
|
|
383 |
|
this.win
Element.st
yle.width
= width;
|
|
|
384 |
|
this.win
Element.st
yle.height
= height;
|
|
|
385 |
|
|
|
|
386 |
|
height =
height-12
-19;
|
|
|
387 |
|
|
|
|
388 |
|
this.con
tainerElem
ent.style.
width = wi
dth;
|
|
|
389 |
|
|
|
|
390 |
|
this.ifr
ameElement
.style.wid
th = width
;
|
|
|
391 |
|
this.ifr
ameElement
.style.hei
ght = heig
ht;
|
|
|
392 |
|
this.bod
yElement.s
tyle.width
= width;
|
|
|
393 |
|
this.bod
yElement.s
tyle.heigh
t = height
;
|
|
|
394 |
|
this.hea
dElement.s
tyle.width
= width;
|
|
|
395 |
|
//this.s
tatusEleme
nt.style.w
idth = wid
th;
|
|
|
396 |
|
|
|
|
397 |
|
mcWindow
s.cancelEv
ent(e);
|
|
|
398 |
|
break;
|
|
|
399 |
|
|
|
|
400 |
|
ca
se "move":
|
|
|
401 |
|
this.lef
t = mcWind
ows.mouseD
ownLayerX
+ (e.scree
nX - mcWin
dows.mouse
DownScreen
X);
|
|
|
402 |
|
this.top
= mcWindo
ws.mouseDo
wnLayerY +
(e.screen
Y - mcWind
ows.mouseD
ownScreenY
);
|
|
|
403 |
|
this.win
Element.st
yle.left =
this.left
+ "px";
|
|
|
404 |
|
this.win
Element.st
yle.top =
this.top +
"px";
|
|
|
405 |
|
|
|
|
406 |
|
mcWindow
s.cancelEv
ent(e);
|
|
|
407 |
|
break;
|
|
|
408 |
|
}
|
|
|
409 |
|
};
|
|
|
410 |
|
|
|
|
411 |
|
MCWindow.p
rototype.o
nMouseUp =
function(
e) {
|
|
|
412 |
|
mcWind
ows.action
= "none";
|
|
|
413 |
|
};
|
|
|
414 |
|
|
|
|
415 |
|
MCWindow.p
rototype.o
nFocus = f
unction(e)
{
|
|
|
416 |
|
// Gec
ko only ha
ndler
|
|
|
417 |
|
var wi
nRef = e.c
urrentTarg
et;
|
|
|
418 |
|
|
|
|
419 |
|
for (v
ar n in mc
Windows.wi
ndows) {
|
|
|
420 |
|
va
r win = mc
Windows.wi
ndows[n];
|
|
|
421 |
|
if
(typeof(w
in) == 'fu
nction')
|
|
|
422 |
|
continue
;
|
|
|
423 |
|
|
|
|
424 |
|
if
(winRef.n
ame == win
.id) {
|
|
|
425 |
|
win.focu
s();
|
|
|
426 |
|
return;
|
|
|
427 |
|
}
|
|
|
428 |
|
}
|
|
|
429 |
|
};
|
|
|
430 |
|
|
|
|
431 |
|
MCWindow.p
rototype.o
nMouseDown
= functio
n(e) {
|
|
|
432 |
|
var el
m = mcWind
ows.isMSIE
? this.wr
apperFrame
.event.src
Element :
e.target;
|
|
|
433 |
|
|
|
|
434 |
|
var sc
rollX = 0;
//this.doc
.body.scro
llLeft;
|
|
|
435 |
|
var sc
rollY = 0;
//this.doc
.body.scro
llTop;
|
|
|
436 |
|
|
|
|
437 |
|
mcWind
ows.mouseD
ownScreenX
= e.scree
nX;
|
|
|
438 |
|
mcWind
ows.mouseD
ownScreenY
= e.scree
nY;
|
|
|
439 |
|
mcWind
ows.mouseD
ownLayerX
= this.lef
t;
|
|
|
440 |
|
mcWind
ows.mouseD
ownLayerY
= this.top
;
|
|
|
441 |
|
mcWind
ows.mouseD
ownWidth =
parseInt(
this.winEl
ement.styl
e.width);
|
|
|
442 |
|
mcWind
ows.mouseD
ownHeight
= parseInt
(this.winE
lement.sty
le.height)
;
|
|
|
443 |
|
|
|
|
444 |
|
if (el
m == this.
resizeElem
ent.firstC
hild)
|
|
|
445 |
|
th
is.startRe
size(e);
|
|
|
446 |
|
else
|
|
|
447 |
|
th
is.startMo
ve(e);
|
|
|
448 |
|
|
|
|
449 |
|
mcWind
ows.cancel
Event(e);
|
|
|
450 |
|
};
|
|
|
451 |
|
|
|
|
452 |
|
// Global
instance
|
|
|
453 |
|
var mcWind
ows = new
MCWindows(
);
|
|
|