No regular expressions were active.
1 |
|
//
|
|
|
2 |
|
|
|
|
3 |
|
var defaul
tDocTypes
=
|
|
|
4 |
|
'XHTML
1.0 Trans
itional=<!
DOCTYPE ht
ml PUBLIC
"-//W3C//D
TD XHTML 1
.0 Transit
ional//EN"
"http://w
ww.w3.org/
TR/xhtml1/
DTD/xhtml1
-transitio
nal.dtd">,
' +
|
|
|
5 |
|
'XHTML
1.0 Frame
set=<!DOCT
YPE html P
UBLIC "-//
W3C//DTD X
HTML 1.0 F
rameset//E
N" "http:/
/www.w3.or
g/TR/xhtml
1/DTD/xhtm
l1-framese
t.dtd">,'
+
|
|
|
6 |
|
'XHTML
1.0 Stric
t=<!DOCTYP
E html PUB
LIC "-//W3
C//DTD XHT
ML 1.0 Str
ict//EN" "
http://www
.w3.org/TR
/xhtml1/DT
D/xhtml1-s
trict.dtd"
>,' +
|
|
|
7 |
|
'XHTML
1.1=<!DOC
TYPE html
PUBLIC "-/
/W3C//DTD
XHTML 1.1/
/EN" "http
://www.w3.
org/TR/xht
ml11/DTD/x
html11.dtd
">,' +
|
|
|
8 |
|
'HTML
4.01 Trans
itional=<!
DOCTYPE HT
ML PUBLIC
"-//W3C//D
TD HTML 4.
01 Transit
ional//EN"
>,' +
|
|
|
9 |
|
'HTML
4.01 Stric
t=<!DOCTYP
E HTML PUB
LIC "-//W3
C//DTD HTM
L 4.01//EN
" "http://
www.w3.org
/TR/html4/
strict.dtd
">,' +
|
|
|
10 |
|
'HTML
4.01 Frame
set=<!DOCT
YPE HTML P
UBLIC "-//
W3C//DTD H
TML 4.01 F
rameset//E
N" "http:/
/www.w3.or
g/TR/html4
/frameset.
dtd">';
|
|
|
11 |
|
|
|
|
12 |
|
var defaul
tEncodings
=
|
|
|
13 |
|
'Weste
rn europea
n (iso-885
9-1)=iso-8
859-1,' +
|
|
|
14 |
|
'Centr
al Europea
n (iso-885
9-2)=iso-8
859-2,' +
|
|
|
15 |
|
'Unico
de (UTF-8)
=utf-8,' +
|
|
|
16 |
|
'Chine
se traditi
onal (Big5
)=big5,' +
|
|
|
17 |
|
'Cyril
lic (iso-8
859-5)=iso
-8859-5,'
+
|
|
|
18 |
|
'Japan
ese (iso-2
022-jp)=is
o-2022-jp,
' +
|
|
|
19 |
|
'Greek
(iso-8859
-7)=iso-88
59-7,' +
|
|
|
20 |
|
'Korea
n (iso-202
2-kr)=iso-
2022-kr,'
+
|
|
|
21 |
|
'ASCII
(us-ascii
)=us-ascii
';
|
|
|
22 |
|
|
|
|
23 |
|
var defaul
tMediaType
s =
|
|
|
24 |
|
'all=a
ll,' +
|
|
|
25 |
|
'scree
n=screen,'
+
|
|
|
26 |
|
'print
=print,' +
|
|
|
27 |
|
'tty=t
ty,' +
|
|
|
28 |
|
'tv=tv
,' +
|
|
|
29 |
|
'proje
ction=proj
ection,' +
|
|
|
30 |
|
'handh
eld=handhe
ld,' +
|
|
|
31 |
|
'brail
le=braille
,' +
|
|
|
32 |
|
'aural
=aural';
|
|
|
33 |
|
|
|
|
34 |
|
var defaul
tFontNames
= 'Arial=
arial,helv
etica,sans
-serif;Cou
rier New=c
ourier new
,courier,m
onospace;G
eorgia=geo
rgia,times
new roman
,times,ser
if;Tahoma=
tahoma,ari
al,helveti
ca,sans-se
rif;Times
New Roman=
times new
roman,time
s,serif;Ve
rdana=verd
ana,arial,
helvetica,
sans-serif
;Impact=im
pact;WingD
ings=wingd
ings';
|
|
|
35 |
|
var defaul
tFontSizes
= '10px,1
1px,12px,1
3px,14px,1
5px,16px';
|
|
|
36 |
|
|
|
|
37 |
|
var addMen
uLayer = n
ew MCLayer
("addmenu"
);
|
|
|
38 |
|
var lastEl
ementType
= null;
|
|
|
39 |
|
var topDoc
;
|
|
|
40 |
|
|
|
|
41 |
|
function i
nit() {
|
|
|
42 |
|
var f
= document
.forms['fu
llpage'];
|
|
|
43 |
|
var i,
p, doctyp
es, encodi
ngs, media
Types, fon
ts;
|
|
|
44 |
|
var in
st = tinyM
CE.getInst
anceById(t
inyMCE.get
WindowArg(
'editor_id
'));
|
|
|
45 |
|
|
|
|
46 |
|
// Set
up doctype
select bo
x
|
|
|
47 |
|
doctyp
es = tinyM
CE.getPara
m("fullpag
e_doctypes
", default
DocTypes).
split(',')
;
|
|
|
48 |
|
for (i
=0; i<doct
ypes.lengt
h; i++) {
|
|
|
49 |
|
p
= doctypes
[i].split(
'=');
|
|
|
50 |
|
|
|
|
51 |
|
if
(p.length
> 1)
|
|
|
52 |
|
addSelec
tValue(f,
'doctypes'
, p[0], p[
1]);
|
|
|
53 |
|
}
|
|
|
54 |
|
|
|
|
55 |
|
// Set
up fonts s
elect box
|
|
|
56 |
|
fonts
= tinyMCE.
getParam("
fullpage_f
onts", def
aultFontNa
mes).split
(';');
|
|
|
57 |
|
for (i
=0; i<font
s.length;
i++) {
|
|
|
58 |
|
p
= fonts[i]
.split('='
);
|
|
|
59 |
|
|
|
|
60 |
|
if
(p.length
> 1)
|
|
|
61 |
|
addSelec
tValue(f,
'fontface'
, p[0], p[
1]);
|
|
|
62 |
|
}
|
|
|
63 |
|
|
|
|
64 |
|
// Set
up fontsiz
e select b
ox
|
|
|
65 |
|
fonts
= tinyMCE.
getParam("
fullpage_f
ontsizes",
defaultFo
ntSizes).s
plit(',');
|
|
|
66 |
|
for (i
=0; i<font
s.length;
i++)
|
|
|
67 |
|
ad
dSelectVal
ue(f, 'fon
tsize', fo
nts[i], fo
nts[i]);
|
|
|
68 |
|
|
|
|
69 |
|
// Set
up mediaty
pe select
boxs
|
|
|
70 |
|
mediaT
ypes = tin
yMCE.getPa
ram("fullp
age_media_
types", de
faultMedia
Types).spl
it(',');
|
|
|
71 |
|
for (i
=0; i<medi
aTypes.len
gth; i++)
{
|
|
|
72 |
|
p
= mediaTyp
es[i].spli
t('=');
|
|
|
73 |
|
|
|
|
74 |
|
if
(p.length
> 1) {
|
|
|
75 |
|
addSelec
tValue(f,
'element_s
tyle_media
', p[0], p
[1]);
|
|
|
76 |
|
addSelec
tValue(f,
'element_l
ink_media'
, p[0], p[
1]);
|
|
|
77 |
|
}
|
|
|
78 |
|
}
|
|
|
79 |
|
|
|
|
80 |
|
// Set
up encodin
gs select
box
|
|
|
81 |
|
encodi
ngs = tiny
MCE.getPar
am("fullpa
ge_encodin
gs", defau
ltEncoding
s).split('
,');
|
|
|
82 |
|
for (i
=0; i<enco
dings.leng
th; i++) {
|
|
|
83 |
|
p
= encoding
s[i].split
('=');
|
|
|
84 |
|
|
|
|
85 |
|
if
(p.length
> 1) {
|
|
|
86 |
|
addSelec
tValue(f,
'docencodi
ng', p[0],
p[1]);
|
|
|
87 |
|
addSelec
tValue(f,
'element_s
cript_char
set', p[0]
, p[1]);
|
|
|
88 |
|
addSelec
tValue(f,
'element_l
ink_charse
t', p[0],
p[1]);
|
|
|
89 |
|
}
|
|
|
90 |
|
}
|
|
|
91 |
|
|
|
|
92 |
|
docume
nt.getElem
entById('b
gcolor_pic
kcontainer
').innerHT
ML = getCo
lorPickerH
TML('bgcol
or_pick','
bgcolor');
|
|
|
93 |
|
docume
nt.getElem
entById('l
ink_color_
pickcontai
ner').inne
rHTML = ge
tColorPick
erHTML('li
nk_color_p
ick','link
_color');
|
|
|
94 |
|
//docu
ment.getEl
ementById(
'hover_col
or_pickcon
tainer').i
nnerHTML =
getColorP
ickerHTML(
'hover_col
or_pick','
hover_colo
r');
|
|
|
95 |
|
docume
nt.getElem
entById('v
isited_col
or_pickcon
tainer').i
nnerHTML =
getColorP
ickerHTML(
'visited_c
olor_pick'
,'visited_
color');
|
|
|
96 |
|
docume
nt.getElem
entById('a
ctive_colo
r_pickcont
ainer').in
nerHTML =
getColorPi
ckerHTML('
active_col
or_pick','
active_col
or');
|
|
|
97 |
|
docume
nt.getElem
entById('t
extcolor_p
ickcontain
er').inner
HTML = get
ColorPicke
rHTML('tex
tcolor_pic
k','textco
lor');
|
|
|
98 |
|
docume
nt.getElem
entById('s
tylesheet_
browsercon
tainer').i
nnerHTML =
getBrowse
rHTML('sty
lesheetbro
wser','sty
lesheet','
file','ful
lpage');
|
|
|
99 |
|
docume
nt.getElem
entById('l
ink_href_p
ickcontain
er').inner
HTML = get
BrowserHTM
L('link_hr
ef_browser
','element
_link_href
','file','
fullpage')
;
|
|
|
100 |
|
docume
nt.getElem
entById('s
cript_src_
pickcontai
ner').inne
rHTML = ge
tBrowserHT
ML('script
_src_brows
er','eleme
nt_script_
src','file
','fullpag
e');
|
|
|
101 |
|
docume
nt.getElem
entById('b
gimage_pic
kcontainer
').innerHT
ML = getBr
owserHTML(
'bgimage_b
rowser','b
gimage','i
mage','ful
lpage');
|
|
|
102 |
|
|
|
|
103 |
|
// Res
ize some e
lements
|
|
|
104 |
|
if (is
Visible('s
tylesheetb
rowser'))
|
|
|
105 |
|
do
cument.get
ElementByI
d('stylesh
eet').styl
e.width =
'220px';
|
|
|
106 |
|
|
|
|
107 |
|
if (is
Visible('l
ink_href_b
rowser'))
|
|
|
108 |
|
do
cument.get
ElementByI
d('element
_link_href
').style.w
idth = '23
0px';
|
|
|
109 |
|
|
|
|
110 |
|
if (is
Visible('b
gimage_bro
wser'))
|
|
|
111 |
|
do
cument.get
ElementByI
d('bgimage
').style.w
idth = '21
0px';
|
|
|
112 |
|
|
|
|
113 |
|
// Cre
ate iframe
|
|
|
114 |
|
var if
rame = doc
ument.crea
teElement(
'iframe');
|
|
|
115 |
|
|
|
|
116 |
|
iframe
.id = 'tem
pFrame';
|
|
|
117 |
|
iframe
.style.dis
play = 'no
ne';
|
|
|
118 |
|
iframe
.src = tin
yMCE.baseU
RL + "/plu
gins/fullp
age/blank.
htm";
|
|
|
119 |
|
|
|
|
120 |
|
docume
nt.body.ap
pendChild(
iframe);
|
|
|
121 |
|
|
|
|
122 |
|
tinyMC
EPopup.res
izeToInner
Size();
|
|
|
123 |
|
}
|
|
|
124 |
|
|
|
|
125 |
|
function s
etupIframe
(doc) {
|
|
|
126 |
|
var in
st = tinyM
CE.getInst
anceById(t
inyMCE.get
WindowArg(
'editor_id
'));
|
|
|
127 |
|
var hc
= inst.fu
llpageTopC
ontent;
|
|
|
128 |
|
var f
= document
.forms[0];
|
|
|
129 |
|
var xm
lVer, xmlE
nc, docTyp
e;
|
|
|
130 |
|
var no
des, i, x,
name, val
ue, tmp, l
;
|
|
|
131 |
|
|
|
|
132 |
|
// Kee
p it from
not loadin
g/executin
g stuff
|
|
|
133 |
|
hc = h
c.replace(
/<script>/
gi, '<scri
pt type="t
ext/javasc
ript">');
|
|
|
134 |
|
hc = h
c.replace(
/\ssrc=/gi
, " mce_sr
c=");
|
|
|
135 |
|
hc = h
c.replace(
/\shref=/g
i, " mce_h
ref=");
|
|
|
136 |
|
hc = h
c.replace(
/\stype=/g
i, " mce_t
ype=");
|
|
|
137 |
|
hc = h
c.replace(
/<script/g
i, '<scrip
t type="te
xt/unknown
" ');
|
|
|
138 |
|
|
|
|
139 |
|
// Add
end to ma
ke it DOM
parseable
|
|
|
140 |
|
hc +=
'</body></
html>';
|
|
|
141 |
|
|
|
|
142 |
|
topDoc
= doc;
|
|
|
143 |
|
doc.op
en();
|
|
|
144 |
|
doc.wr
ite(hc);
|
|
|
145 |
|
doc.cl
ose();
|
|
|
146 |
|
|
|
|
147 |
|
// ---
---- Setup
options f
or genral
tab
|
|
|
148 |
|
|
|
|
149 |
|
// Par
se xml and
doctype
|
|
|
150 |
|
xmlVer
= getReIt
em(/<\?\s*
?xml.*?ver
sion\s*?=\
s*?"(.*?)"
.*?\?>/gi,
hc, 1);
|
|
|
151 |
|
xmlEnc
= getReIt
em(/<\?\s*
?xml.*?enc
oding\s*?=
\s*?"(.*?)
".*?\?>/gi
, hc, 1);
|
|
|
152 |
|
docTyp
e = getReI
tem(/<\!DO
CTYPE.*?>/
gi, hc, 0)
;
|
|
|
153 |
|
f.lang
code.value
= getReIt
em(/lang="
(.*?)"/gi,
hc, 1);
|
|
|
154 |
|
|
|
|
155 |
|
// Get
title
|
|
|
156 |
|
f.meta
title.valu
e = tinyMC
E.entityDe
code(getRe
Item(/<tit
le>(.*?)<\
/title>/gi
, hc, 1));
|
|
|
157 |
|
|
|
|
158 |
|
// Che
ck for met
a encoding
|
|
|
159 |
|
nodes
= doc.getE
lementsByT
agName("me
ta");
|
|
|
160 |
|
for (i
=0; i<node
s.length;
i++) {
|
|
|
161 |
|
na
me = tinyM
CE.getAttr
ib(nodes[i
], 'name')
;
|
|
|
162 |
|
va
lue = tiny
MCE.getAtt
rib(nodes[
i], 'conte
nt');
|
|
|
163 |
|
ht
tpEquiv =
tinyMCE.ge
tAttrib(no
des[i], 'h
ttpEquiv')
;
|
|
|
164 |
|
|
|
|
165 |
|
sw
itch (name
.toLowerCa
se()) {
|
|
|
166 |
|
case "ke
ywords":
|
|
|
167 |
|
f.me
takeywords
.value = v
alue;
|
|
|
168 |
|
brea
k;
|
|
|
169 |
|
|
|
|
170 |
|
case "de
scription"
:
|
|
|
171 |
|
f.me
tadescript
ion.value
= value;
|
|
|
172 |
|
brea
k;
|
|
|
173 |
|
|
|
|
174 |
|
case "au
thor":
|
|
|
175 |
|
f.me
taauthor.v
alue = val
ue;
|
|
|
176 |
|
brea
k;
|
|
|
177 |
|
|
|
|
178 |
|
case "co
pyright":
|
|
|
179 |
|
f.me
tacopyrigh
t.value =
value;
|
|
|
180 |
|
brea
k;
|
|
|
181 |
|
|
|
|
182 |
|
case "ro
bots":
|
|
|
183 |
|
sele
ctByValue(
f, 'metaro
bots', val
ue, true,
true);
|
|
|
184 |
|
brea
k;
|
|
|
185 |
|
}
|
|
|
186 |
|
|
|
|
187 |
|
sw
itch (http
Equiv.toLo
werCase())
{
|
|
|
188 |
|
case "co
ntent-type
":
|
|
|
189 |
|
tmp
= getReIte
m(/charset
\s*=\s*(.*
)\s*/gi, v
alue, 1);
|
|
|
190 |
|
|
|
|
191 |
|
// O
verride XM
L encoding
|
|
|
192 |
|
if (
tmp != "")
|
|
|
193 |
|
xmlEnc = t
mp;
|
|
|
194 |
|
|
|
|
195 |
|
brea
k;
|
|
|
196 |
|
}
|
|
|
197 |
|
}
|
|
|
198 |
|
|
|
|
199 |
|
select
ByValue(f,
'doctypes
', docType
, true, tr
ue);
|
|
|
200 |
|
select
ByValue(f,
'docencod
ing', xmlE
nc, true,
true);
|
|
|
201 |
|
select
ByValue(f,
'langdir'
, tinyMCE.
getAttrib(
doc.body,
'dir'), tr
ue, true);
|
|
|
202 |
|
|
|
|
203 |
|
if (xm
lVer != ''
)
|
|
|
204 |
|
f.
xml_pi.che
cked = tru
e;
|
|
|
205 |
|
|
|
|
206 |
|
// ---
---- Setup
options f
or appeara
nce tab
|
|
|
207 |
|
|
|
|
208 |
|
// Get
primary s
tylesheet
|
|
|
209 |
|
nodes
= doc.getE
lementsByT
agName("li
nk");
|
|
|
210 |
|
for (i
=0; i<node
s.length;
i++) {
|
|
|
211 |
|
l
= nodes[i]
;
|
|
|
212 |
|
tm
p = tinyMC
E.getAttri
b(l, 'medi
a');
|
|
|
213 |
|
|
|
|
214 |
|
if
(tinyMCE.
getAttrib(
l, 'mce_ty
pe') == "t
ext/css" &
& (tmp ==
"" || tmp
== "screen
" || tmp =
= "all") &
& tinyMCE.
getAttrib(
l, 'rel')
== "styles
heet") {
|
|
|
215 |
|
f.styles
heet.value
= tinyMCE
.getAttrib
(l, 'mce_h
ref');
|
|
|
216 |
|
break;
|
|
|
217 |
|
}
|
|
|
218 |
|
}
|
|
|
219 |
|
|
|
|
220 |
|
// Get
from styl
e elements
|
|
|
221 |
|
nodes
= doc.getE
lementsByT
agName("st
yle");
|
|
|
222 |
|
for (i
=0; i<node
s.length;
i++) {
|
|
|
223 |
|
tm
p = parseS
tyleElemen
t(nodes[i]
);
|
|
|
224 |
|
|
|
|
225 |
|
fo
r (x=0; x<
tmp.length
; x++) {
|
|
|
226 |
|
//
if (tmp[
x].rule.in
dexOf('a:h
over') !=
-1 && tmp[
x].data['c
olor'])
|
|
|
227 |
|
//
f.ho
ver_color.
value = tm
p[x].data[
'color'];
|
|
|
228 |
|
|
|
|
229 |
|
if (tmp[
x].rule.in
dexOf('a:v
isited') !
= -1 && tm
p[x].data[
'color'])
|
|
|
230 |
|
f.vi
sited_colo
r.value =
tmp[x].dat
a['color']
;
|
|
|
231 |
|
|
|
|
232 |
|
if (tmp[
x].rule.in
dexOf('a:l
ink') != -
1 && tmp[x
].data['co
lor'])
|
|
|
233 |
|
f.li
nk_color.v
alue = tmp
[x].data['
color'];
|
|
|
234 |
|
|
|
|
235 |
|
if (tmp[
x].rule.in
dexOf('a:a
ctive') !=
-1 && tmp
[x].data['
color'])
|
|
|
236 |
|
f.ac
tive_color
.value = t
mp[x].data
['color'];
|
|
|
237 |
|
}
|
|
|
238 |
|
}
|
|
|
239 |
|
|
|
|
240 |
|
// Get
from body
attribs
|
|
|
241 |
|
|
|
|
242 |
|
/* f.left
margin.val
ue = tinyM
CE.getAttr
ib(doc.bod
y, "leftma
rgin");
|
|
|
243 |
|
f.righ
tmargin.va
lue = tiny
MCE.getAtt
rib(doc.bo
dy, "right
margin");
|
|
|
244 |
|
f.topm
argin.valu
e = tinyMC
E.getAttri
b(doc.body
, "topmarg
in");
|
|
|
245 |
|
f.bott
ommargin.v
alue = tin
yMCE.getAt
trib(doc.b
ody, "bott
ommargin")
;*/
|
|
|
246 |
|
f.text
color.valu
e = conver
tRGBToHex(
tinyMCE.ge
tAttrib(do
c.body, "t
ext"));
|
|
|
247 |
|
f.acti
ve_color.v
alue = con
vertRGBToH
ex(tinyMCE
.getAttrib
(doc.body,
"alink"))
;
|
|
|
248 |
|
f.link
_color.val
ue = conve
rtRGBToHex
(tinyMCE.g
etAttrib(d
oc.body, "
link"));
|
|
|
249 |
|
f.visi
ted_color.
value = co
nvertRGBTo
Hex(tinyMC
E.getAttri
b(doc.body
, "vlink")
);
|
|
|
250 |
|
f.bgco
lor.value
= convertR
GBToHex(ti
nyMCE.getA
ttrib(doc.
body, "bgc
olor"));
|
|
|
251 |
|
f.bgim
age.value
= convertR
GBToHex(ti
nyMCE.getA
ttrib(doc.
body, "bac
kground"))
;
|
|
|
252 |
|
|
|
|
253 |
|
// Get
from styl
e info
|
|
|
254 |
|
var st
yle = tiny
MCE.parseS
tyle(tinyM
CE.getAttr
ib(doc.bod
y, 'style'
));
|
|
|
255 |
|
|
|
|
256 |
|
if (st
yle['font-
family'])
|
|
|
257 |
|
se
lectByValu
e(f, 'font
face', sty
le['font-f
amily'], t
rue, true)
;
|
|
|
258 |
|
else
|
|
|
259 |
|
se
lectByValu
e(f, 'font
face', tin
yMCE.getPa
ram("fullp
age_defaul
t_fontface
", ""), tr
ue, true);
|
|
|
260 |
|
|
|
|
261 |
|
if (st
yle['font-
size'])
|
|
|
262 |
|
se
lectByValu
e(f, 'font
size', sty
le['font-s
ize'], tru
e, true);
|
|
|
263 |
|
else
|
|
|
264 |
|
se
lectByValu
e(f, 'font
size', tin
yMCE.getPa
ram("fullp
age_defaul
t_fontsize
", ""), tr
ue, true);
|
|
|
265 |
|
|
|
|
266 |
|
if (st
yle['color
'])
|
|
|
267 |
|
f.
textcolor.
value = co
nvertRGBTo
Hex(style[
'color']);
|
|
|
268 |
|
|
|
|
269 |
|
if (st
yle['backg
round-imag
e'])
|
|
|
270 |
|
f.
bgimage.va
lue = styl
e['backgro
und-image'
].replace(
new RegExp
("url\\('?
([^']*)'?\
\)", 'gi')
, "$1");
|
|
|
271 |
|
|
|
|
272 |
|
if (st
yle['backg
round-colo
r'])
|
|
|
273 |
|
f.
bgcolor.va
lue = conv
ertRGBToHe
x(style['b
ackground-
color']);
|
|
|
274 |
|
|
|
|
275 |
|
if (st
yle['margi
n']) {
|
|
|
276 |
|
tm
p = style[
'margin'].
replace(/[
^0-9 ]/g,
'');
|
|
|
277 |
|
tm
p = tmp.sp
lit(/ +/);
|
|
|
278 |
|
f.
topmargin.
value = tm
p.length >
0 ? tmp[0
] : '';
|
|
|
279 |
|
f.
rightmargi
n.value =
tmp.length
> 1 ? tmp
[1] : tmp[
0];
|
|
|
280 |
|
f.
bottommarg
in.value =
tmp.lengt
h > 2 ? tm
p[2] : tmp
[0];
|
|
|
281 |
|
f.
leftmargin
.value = t
mp.length
> 3 ? tmp[
3] : tmp[0
];
|
|
|
282 |
|
}
|
|
|
283 |
|
|
|
|
284 |
|
if (st
yle['margi
n-left'])
|
|
|
285 |
|
f.
leftmargin
.value = s
tyle['marg
in-left'].
replace(/[
^0-9]/g, '
');
|
|
|
286 |
|
|
|
|
287 |
|
if (st
yle['margi
n-right'])
|
|
|
288 |
|
f.
rightmargi
n.value =
style['mar
gin-right'
].replace(
/[^0-9]/g,
'');
|
|
|
289 |
|
|
|
|
290 |
|
if (st
yle['margi
n-top'])
|
|
|
291 |
|
f.
topmargin.
value = st
yle['margi
n-top'].re
place(/[^0
-9]/g, '')
;
|
|
|
292 |
|
|
|
|
293 |
|
if (st
yle['margi
n-bottom']
)
|
|
|
294 |
|
f.
bottommarg
in.value =
style['ma
rgin-botto
m'].replac
e(/[^0-9]/
g, '');
|
|
|
295 |
|
|
|
|
296 |
|
f.styl
e.value =
tinyMCE.se
rializeSty
le(style);
|
|
|
297 |
|
|
|
|
298 |
|
update
Color('tex
tcolor_pic
k', 'textc
olor');
|
|
|
299 |
|
update
Color('bgc
olor_pick'
, 'bgcolor
');
|
|
|
300 |
|
update
Color('vis
ited_color
_pick', 'v
isited_col
or');
|
|
|
301 |
|
update
Color('act
ive_color_
pick', 'ac
tive_color
');
|
|
|
302 |
|
update
Color('lin
k_color_pi
ck', 'link
_color');
|
|
|
303 |
|
//upda
teColor('h
over_color
_pick', 'h
over_color
');
|
|
|
304 |
|
}
|
|
|
305 |
|
|
|
|
306 |
|
function u
pdateActio
n() {
|
|
|
307 |
|
var in
st = tinyM
CE.getInst
anceById(t
inyMCE.get
WindowArg(
'editor_id
'));
|
|
|
308 |
|
var f
= document
.forms[0];
|
|
|
309 |
|
var nl
, i, h, v,
s, head,
html, l, t
mp, addlin
k = true;
|
|
|
310 |
|
|
|
|
311 |
|
head =
topDoc.ge
tElementsB
yTagName('
head')[0];
|
|
|
312 |
|
|
|
|
313 |
|
// Fix
scripts w
ithout a t
ype
|
|
|
314 |
|
nl = t
opDoc.getE
lementsByT
agName('sc
ript');
|
|
|
315 |
|
for (i
=0; i<nl.l
ength; i++
) {
|
|
|
316 |
|
if
(tinyMCE.
getAttrib(
nl[i], 'mc
e_type') =
= '')
|
|
|
317 |
|
nl[i].se
tAttribute
('mce_type
', 'text/j
avascript'
);
|
|
|
318 |
|
}
|
|
|
319 |
|
|
|
|
320 |
|
// Get
primary s
tylesheet
|
|
|
321 |
|
nl = t
opDoc.getE
lementsByT
agName("li
nk");
|
|
|
322 |
|
for (i
=0; i<nl.l
ength; i++
) {
|
|
|
323 |
|
l
= nl[i];
|
|
|
324 |
|
|
|
|
325 |
|
tm
p = tinyMC
E.getAttri
b(l, 'medi
a');
|
|
|
326 |
|
|
|
|
327 |
|
if
(tinyMCE.
getAttrib(
l, 'mce_ty
pe') == "t
ext/css" &
& (tmp ==
"" || tmp
== "screen
" || tmp =
= "all") &
& tinyMCE.
getAttrib(
l, 'rel')
== "styles
heet") {
|
|
|
328 |
|
addlink
= false;
|
|
|
329 |
|
|
|
|
330 |
|
if (f.st
ylesheet.v
alue == ''
)
|
|
|
331 |
|
l.pa
rentNode.r
emoveChild
(l);
|
|
|
332 |
|
else
|
|
|
333 |
|
l.se
tAttribute
('mce_href
', f.style
sheet.valu
e);
|
|
|
334 |
|
|
|
|
335 |
|
break;
|
|
|
336 |
|
}
|
|
|
337 |
|
}
|
|
|
338 |
|
|
|
|
339 |
|
// Add
new link
|
|
|
340 |
|
if (f.
stylesheet
.value !=
'') {
|
|
|
341 |
|
l
= topDoc.c
reateEleme
nt('link')
;
|
|
|
342 |
|
|
|
|
343 |
|
l.
setAttribu
te('mce_ty
pe', 'text
/css');
|
|
|
344 |
|
l.
setAttribu
te('mce_hr
ef', f.sty
lesheet.va
lue);
|
|
|
345 |
|
l.
setAttribu
te('rel',
'styleshee
t');
|
|
|
346 |
|
|
|
|
347 |
|
he
ad.appendC
hild(l);
|
|
|
348 |
|
}
|
|
|
349 |
|
|
|
|
350 |
|
setMet
a(head, 'k
eywords',
f.metakeyw
ords.value
);
|
|
|
351 |
|
setMet
a(head, 'd
escription
', f.metad
escription
.value);
|
|
|
352 |
|
setMet
a(head, 'a
uthor', f.
metaauthor
.value);
|
|
|
353 |
|
setMet
a(head, 'c
opyright',
f.metacop
yright.val
ue);
|
|
|
354 |
|
setMet
a(head, 'r
obots', ge
tSelectVal
ue(f, 'met
arobots'))
;
|
|
|
355 |
|
setMet
a(head, 'C
ontent-Typ
e', getSel
ectValue(f
, 'docenco
ding'));
|
|
|
356 |
|
|
|
|
357 |
|
topDoc
.body.dir
= getSelec
tValue(f,
'langdir')
;
|
|
|
358 |
|
topDoc
.body.styl
e.cssText
= f.style.
value;
|
|
|
359 |
|
|
|
|
360 |
|
topDoc
.body.setA
ttribute('
vLink', f.
visited_co
lor.value)
;
|
|
|
361 |
|
topDoc
.body.setA
ttribute('
link', f.l
ink_color.
value);
|
|
|
362 |
|
topDoc
.body.setA
ttribute('
text', f.t
extcolor.v
alue);
|
|
|
363 |
|
topDoc
.body.setA
ttribute('
aLink', f.
active_col
or.value);
|
|
|
364 |
|
|
|
|
365 |
|
topDoc
.body.styl
e.fontFami
ly = getSe
lectValue(
f, 'fontfa
ce');
|
|
|
366 |
|
topDoc
.body.styl
e.fontSize
= getSele
ctValue(f,
'fontsize
');
|
|
|
367 |
|
topDoc
.body.styl
e.backgrou
ndColor =
f.bgcolor.
value;
|
|
|
368 |
|
|
|
|
369 |
|
if (f.
leftmargin
.value !=
'')
|
|
|
370 |
|
to
pDoc.body.
style.marg
inLeft = f
.leftmargi
n.value +
'px';
|
|
|
371 |
|
|
|
|
372 |
|
if (f.
rightmargi
n.value !=
'')
|
|
|
373 |
|
to
pDoc.body.
style.marg
inRight =
f.rightmar
gin.value
+ 'px';
|
|
|
374 |
|
|
|
|
375 |
|
if (f.
bottommarg
in.value !
= '')
|
|
|
376 |
|
to
pDoc.body.
style.marg
inBottom =
f.bottomm
argin.valu
e + 'px';
|
|
|
377 |
|
|
|
|
378 |
|
if (f.
topmargin.
value != '
')
|
|
|
379 |
|
to
pDoc.body.
style.marg
inTop = f.
topmargin.
value + 'p
x';
|
|
|
380 |
|
|
|
|
381 |
|
html =
topDoc.ge
tElementsB
yTagName('
html')[0];
|
|
|
382 |
|
html.s
etAttribut
e('lang',
f.langcode
.value);
|
|
|
383 |
|
html.s
etAttribut
e('xml:lan
g', f.lang
code.value
);
|
|
|
384 |
|
|
|
|
385 |
|
if (f.
bgimage.va
lue != '')
|
|
|
386 |
|
to
pDoc.body.
style.back
groundImag
e = "url('
" + f.bgim
age.value
+ "')";
|
|
|
387 |
|
else
|
|
|
388 |
|
to
pDoc.body.
style.back
groundImag
e = '';
|
|
|
389 |
|
|
|
|
390 |
|
inst.c
leanup.add
RuleStr('-
title,meta
[http-equi
v|name|con
tent],base
[href|targ
et],link[h
ref|rel|ty
pe|title|m
edia],styl
e[type],sc
ript[type|
language|s
rc],html[l
ang|xml:la
ng|xmlns],
body[style
|dir|vlink
|link|text
|alink],he
ad');
|
|
|
391 |
|
|
|
|
392 |
|
h = in
st.cleanup
.serialize
NodeAsHTML
(topDoc.do
cumentElem
ent);
|
|
|
393 |
|
|
|
|
394 |
|
h = h.
substring(
0, h.lastI
ndexOf('</
body>'));
|
|
|
395 |
|
|
|
|
396 |
|
if (h.
indexOf('<
title>') =
= -1)
|
|
|
397 |
|
h
= h.replac
e(/<head.*
?>/, '$&\n
' + '<titl
e>' + inst
.cleanup.x
mlEncode(f
.metatitle
.value) +
'</title>'
);
|
|
|
398 |
|
else
|
|
|
399 |
|
h
= h.replac
e(/<title>
(.*?)<\/ti
tle>/, '<t
itle>' + i
nst.cleanu
p.xmlEncod
e(f.metati
tle.value)
+ '</titl
e>');
|
|
|
400 |
|
|
|
|
401 |
|
if ((v
= getSele
ctValue(f,
'doctypes
')) != '')
|
|
|
402 |
|
h
= v + '\n'
+ h;
|
|
|
403 |
|
|
|
|
404 |
|
if (f.
xml_pi.che
cked) {
|
|
|
405 |
|
s
= '<?xml v
ersion="1.
0"';
|
|
|
406 |
|
|
|
|
407 |
|
if
((v = get
SelectValu
e(f, 'doce
ncoding'))
!= '')
|
|
|
408 |
|
s += ' e
ncoding="'
+ v + '"'
;
|
|
|
409 |
|
|
|
|
410 |
|
s
+= '?>\n';
|
|
|
411 |
|
h
= s + h;
|
|
|
412 |
|
}
|
|
|
413 |
|
|
|
|
414 |
|
inst.f
ullpageTop
Content =
h;
|
|
|
415 |
|
|
|
|
416 |
|
tinyMC
EPopup.exe
cCommand('
mceFullPag
eUpdate',
false, '')
;
|
|
|
417 |
|
tinyMC
EPopup.clo
se();
|
|
|
418 |
|
}
|
|
|
419 |
|
|
|
|
420 |
|
function s
etMeta(he,
k, v) {
|
|
|
421 |
|
var nl
, i, m;
|
|
|
422 |
|
|
|
|
423 |
|
nl = h
e.getEleme
ntsByTagNa
me('meta')
;
|
|
|
424 |
|
for (i
=0; i<nl.l
ength; i++
) {
|
|
|
425 |
|
if
(k == 'Co
ntent-Type
' && tinyM
CE.getAttr
ib(nl[i],
'http-equi
v') == k)
{
|
|
|
426 |
|
if (v ==
'')
|
|
|
427 |
|
nl[i
].parentNo
de.removeC
hild(nl[i]
);
|
|
|
428 |
|
else
|
|
|
429 |
|
nl[i
].setAttri
bute('cont
ent', "tex
t/html; ch
arset=" +
v);
|
|
|
430 |
|
|
|
|
431 |
|
return;
|
|
|
432 |
|
}
|
|
|
433 |
|
|
|
|
434 |
|
if
(tinyMCE.
getAttrib(
nl[i], 'na
me') == k)
{
|
|
|
435 |
|
if (v ==
'')
|
|
|
436 |
|
nl[i
].parentNo
de.removeC
hild(nl[i]
);
|
|
|
437 |
|
else
|
|
|
438 |
|
nl[i
].setAttri
bute('cont
ent', v);
|
|
|
439 |
|
return;
|
|
|
440 |
|
}
|
|
|
441 |
|
}
|
|
|
442 |
|
|
|
|
443 |
|
if (v
== '')
|
|
|
444 |
|
re
turn;
|
|
|
445 |
|
|
|
|
446 |
|
m = to
pDoc.creat
eElement('
meta');
|
|
|
447 |
|
|
|
|
448 |
|
if (k
== 'Conten
t-Type')
|
|
|
449 |
|
m.
httpEquiv
= k;
|
|
|
450 |
|
else
|
|
|
451 |
|
m.
setAttribu
te('name',
k);
|
|
|
452 |
|
|
|
|
453 |
|
m.setA
ttribute('
content',
v);
|
|
|
454 |
|
he.app
endChild(m
);
|
|
|
455 |
|
}
|
|
|
456 |
|
|
|
|
457 |
|
function p
arseStyleE
lement(e)
{
|
|
|
458 |
|
var v
= e.innerH
TML;
|
|
|
459 |
|
var p,
i, r;
|
|
|
460 |
|
|
|
|
461 |
|
v = v.
replace(/<
!--/gi, ''
);
|
|
|
462 |
|
v = v.
replace(/-
->/gi, '')
;
|
|
|
463 |
|
v = v.
replace(/[
\n\r]/gi,
'');
|
|
|
464 |
|
v = v.
replace(/\
s+/gi, ' '
);
|
|
|
465 |
|
|
|
|
466 |
|
r = ne
w Array();
|
|
|
467 |
|
p = v.
split(/{|}
/);
|
|
|
468 |
|
|
|
|
469 |
|
for (i
=0; i<p.le
ngth; i+=2
) {
|
|
|
470 |
|
if
(p[i] !=
"")
|
|
|
471 |
|
r[r.leng
th] = {rul
e : tinyMC
E.trim(p[i
]), data :
tinyMCE.p
arseStyle(
p[i+1])};
|
|
|
472 |
|
}
|
|
|
473 |
|
|
|
|
474 |
|
return
r;
|
|
|
475 |
|
}
|
|
|
476 |
|
|
|
|
477 |
|
function s
erializeSt
yleElement
(d) {
|
|
|
478 |
|
var i,
s, st;
|
|
|
479 |
|
|
|
|
480 |
|
s = '<
!--\n';
|
|
|
481 |
|
|
|
|
482 |
|
for (i
=0; i<d.le
ngth; i++)
{
|
|
|
483 |
|
s
+= d[i].ru
le + ' {\n
';
|
|
|
484 |
|
|
|
|
485 |
|
st
= tinyMCE
.serialize
Style(d[i]
.data);
|
|
|
486 |
|
|
|
|
487 |
|
if
(st != ''
)
|
|
|
488 |
|
st += ';
';
|
|
|
489 |
|
|
|
|
490 |
|
s
+= st.repl
ace(/;/g,
';\n');
|
|
|
491 |
|
s
+= '}\n';
|
|
|
492 |
|
|
|
|
493 |
|
if
(i != d.l
ength - 1)
|
|
|
494 |
|
s += '\n
';
|
|
|
495 |
|
}
|
|
|
496 |
|
|
|
|
497 |
|
s += '
\n-->';
|
|
|
498 |
|
|
|
|
499 |
|
return
s;
|
|
|
500 |
|
}
|
|
|
501 |
|
|
|
|
502 |
|
function g
etReItem(r
, s, i) {
|
|
|
503 |
|
var c
= r.exec(s
);
|
|
|
504 |
|
|
|
|
505 |
|
if (c
&& c.lengt
h > i)
|
|
|
506 |
|
re
turn c[i];
|
|
|
507 |
|
|
|
|
508 |
|
return
'';
|
|
|
509 |
|
}
|
|
|
510 |
|
|
|
|
511 |
|
function c
hangedStyl
eField(fie
ld) {
|
|
|
512 |
|
//aler
t(field.id
);
|
|
|
513 |
|
}
|
|
|
514 |
|
|
|
|
515 |
|
function s
howAddMenu
() {
|
|
|
516 |
|
var re
= documen
t.getEleme
ntById('ad
dbutton');
|
|
|
517 |
|
|
|
|
518 |
|
addMen
uLayer.mov
eRelativeT
o(re, 'tr'
);
|
|
|
519 |
|
if (ad
dMenuLayer
.isMSIE)
|
|
|
520 |
|
ad
dMenuLayer
.moveBy(2,
0);
|
|
|
521 |
|
|
|
|
522 |
|
addMen
uLayer.sho
w();
|
|
|
523 |
|
addMen
uLayer.set
AutoHide(t
rue, hideA
ddMenu);
|
|
|
524 |
|
addMen
uLayer.add
CSSClass(r
e, 'select
ed');
|
|
|
525 |
|
}
|
|
|
526 |
|
|
|
|
527 |
|
function h
ideAddMenu
(l, e, mx,
my) {
|
|
|
528 |
|
var re
= documen
t.getEleme
ntById('ad
dbutton');
|
|
|
529 |
|
addMen
uLayer.rem
oveCSSClas
s(re, 'sel
ected');
|
|
|
530 |
|
}
|
|
|
531 |
|
|
|
|
532 |
|
function a
ddHeadElm(
type) {
|
|
|
533 |
|
var le
= documen
t.getEleme
ntById('he
adlist');
|
|
|
534 |
|
var re
= documen
t.getEleme
ntById('ad
dbutton');
|
|
|
535 |
|
var te
= documen
t.getEleme
ntById(typ
e + '_elem
ent');
|
|
|
536 |
|
|
|
|
537 |
|
if (la
stElementT
ype)
|
|
|
538 |
|
la
stElementT
ype.style.
display =
'none';
|
|
|
539 |
|
|
|
|
540 |
|
te.sty
le.display
= 'block'
;
|
|
|
541 |
|
|
|
|
542 |
|
lastEl
ementType
= te;
|
|
|
543 |
|
|
|
|
544 |
|
addMen
uLayer.hid
e();
|
|
|
545 |
|
addMen
uLayer.rem
oveCSSClas
s(re, 'sel
ected');
|
|
|
546 |
|
|
|
|
547 |
|
docume
nt.getElem
entById(ty
pe + '_upd
ateelement
').value =
tinyMCE.g
etLang('la
ng_insert'
, 'Insert'
, true);
|
|
|
548 |
|
|
|
|
549 |
|
le.siz
e = 10;
|
|
|
550 |
|
}
|
|
|
551 |
|
|
|
|
552 |
|
function u
pdateHeadE
lm(item) {
|
|
|
553 |
|
var ty
pe = item.
substring(
0, item.in
dexOf('_')
);
|
|
|
554 |
|
var le
= documen
t.getEleme
ntById('he
adlist');
|
|
|
555 |
|
var re
= documen
t.getEleme
ntById('ad
dbutton');
|
|
|
556 |
|
var te
= documen
t.getEleme
ntById(typ
e + '_elem
ent');
|
|
|
557 |
|
|
|
|
558 |
|
if (la
stElementT
ype)
|
|
|
559 |
|
la
stElementT
ype.style.
display =
'none';
|
|
|
560 |
|
|
|
|
561 |
|
te.sty
le.display
= 'block'
;
|
|
|
562 |
|
|
|
|
563 |
|
lastEl
ementType
= te;
|
|
|
564 |
|
|
|
|
565 |
|
addMen
uLayer.hid
e();
|
|
|
566 |
|
addMen
uLayer.rem
oveCSSClas
s(re, 'sel
ected');
|
|
|
567 |
|
|
|
|
568 |
|
docume
nt.getElem
entById(ty
pe + '_upd
ateelement
').value =
tinyMCE.g
etLang('la
ng_update'
, 'Update'
, true);
|
|
|
569 |
|
|
|
|
570 |
|
le.siz
e = 10;
|
|
|
571 |
|
}
|
|
|
572 |
|
|
|
|
573 |
|
function c
ancelEleme
ntUpdate()
{
|
|
|
574 |
|
var le
= documen
t.getEleme
ntById('he
adlist');
|
|
|
575 |
|
|
|
|
576 |
|
if (la
stElementT
ype)
|
|
|
577 |
|
la
stElementT
ype.style.
display =
'none';
|
|
|
578 |
|
|
|
|
579 |
|
le.siz
e = 26;
|
|
|
580 |
|
}
|
|
|