No regular expressions were active.
|
|
1 |
|
tinyMCEPop
up.require
LangPack()
;
|
|
|
2 |
|
|
|
|
3 |
|
var doc;
|
|
|
4 |
|
|
|
|
5 |
|
var defaul
tDocTypes
=
|
|
|
6 |
|
'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">,
' +
|
|
|
7 |
|
'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">,'
+
|
|
|
8 |
|
'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"
>,' +
|
|
|
9 |
|
'XHTML
1.1=<!DOC
TYPE html
PUBLIC "-/
/W3C//DTD
XHTML 1.1/
/EN" "http
://www.w3.
org/TR/xht
ml11/DTD/x
html11.dtd
">,' +
|
|
|
10 |
|
'HTML
4.01 Trans
itional=<!
DOCTYPE HT
ML PUBLIC
"-//W3C//D
TD HTML 4.
01 Transit
ional//EN"
>,' +
|
|
|
11 |
|
'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
">,' +
|
|
|
12 |
|
'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">';
|
|
|
13 |
|
|
|
|
14 |
|
var defaul
tEncodings
=
|
|
|
15 |
|
'Weste
rn europea
n (iso-885
9-1)=iso-8
859-1,' +
|
|
|
16 |
|
'Centr
al Europea
n (iso-885
9-2)=iso-8
859-2,' +
|
|
|
17 |
|
'Unico
de (UTF-8)
=utf-8,' +
|
|
|
18 |
|
'Chine
se traditi
onal (Big5
)=big5,' +
|
|
|
19 |
|
'Cyril
lic (iso-8
859-5)=iso
-8859-5,'
+
|
|
|
20 |
|
'Japan
ese (iso-2
022-jp)=is
o-2022-jp,
' +
|
|
|
21 |
|
'Greek
(iso-8859
-7)=iso-88
59-7,' +
|
|
|
22 |
|
'Korea
n (iso-202
2-kr)=iso-
2022-kr,'
+
|
|
|
23 |
|
'ASCII
(us-ascii
)=us-ascii
';
|
|
|
24 |
|
|
|
|
25 |
|
var defaul
tMediaType
s =
|
|
|
26 |
|
'all=a
ll,' +
|
|
|
27 |
|
'scree
n=screen,'
+
|
|
|
28 |
|
'print
=print,' +
|
|
|
29 |
|
'tty=t
ty,' +
|
|
|
30 |
|
'tv=tv
,' +
|
|
|
31 |
|
'proje
ction=proj
ection,' +
|
|
|
32 |
|
'handh
eld=handhe
ld,' +
|
|
|
33 |
|
'brail
le=braille
,' +
|
|
|
34 |
|
'aural
=aural';
|
|
|
35 |
|
|
|
|
36 |
|
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';
|
|
|
37 |
|
var defaul
tFontSizes
= '10px,1
1px,12px,1
3px,14px,1
5px,16px';
|
|
|
38 |
|
|
|
|
39 |
|
function i
nit() {
|
|
|
40 |
|
var f
= document
.forms['fu
llpage'],
el = f.ele
ments, e,
i, p, doct
ypes, enco
dings, med
iaTypes, f
onts, ed =
tinyMCEPo
pup.editor
, dom = ti
nyMCEPopup
.dom, styl
e;
|
|
|
41 |
|
|
|
|
42 |
|
// Set
up doctype
select bo
x
|
|
|
43 |
|
doctyp
es = ed.ge
tParam("fu
llpage_doc
types", de
faultDocTy
pes).split
(',');
|
|
|
44 |
|
for (i
=0; i<doct
ypes.lengt
h; i++) {
|
|
|
45 |
|
p
= doctypes
[i].split(
'=');
|
|
|
46 |
|
|
|
|
47 |
|
if
(p.length
> 1)
|
|
|
48 |
|
addSelec
tValue(f,
'doctypes'
, p[0], p[
1]);
|
|
|
49 |
|
}
|
|
|
50 |
|
|
|
|
51 |
|
// Set
up fonts s
elect box
|
|
|
52 |
|
fonts
= ed.getPa
ram("fullp
age_fonts"
, defaultF
ontNames).
split(';')
;
|
|
|
53 |
|
for (i
=0; i<font
s.length;
i++) {
|
|
|
54 |
|
p
= fonts[i]
.split('='
);
|
|
|
55 |
|
|
|
|
56 |
|
if
(p.length
> 1)
|
|
|
57 |
|
addSelec
tValue(f,
'fontface'
, p[0], p[
1]);
|
|
|
58 |
|
}
|
|
|
59 |
|
|
|
|
60 |
|
// Set
up fontsiz
e select b
ox
|
|
|
61 |
|
fonts
= ed.getPa
ram("fullp
age_fontsi
zes", defa
ultFontSiz
es).split(
',');
|
|
|
62 |
|
for (i
=0; i<font
s.length;
i++)
|
|
|
63 |
|
ad
dSelectVal
ue(f, 'fon
tsize', fo
nts[i], fo
nts[i]);
|
|
|
64 |
|
|
|
|
65 |
|
// Set
up mediaty
pe select
boxs
|
|
|
66 |
|
mediaT
ypes = ed.
getParam("
fullpage_m
edia_types
", default
MediaTypes
).split(',
');
|
|
|
67 |
|
for (i
=0; i<medi
aTypes.len
gth; i++)
{
|
|
|
68 |
|
p
= mediaTyp
es[i].spli
t('=');
|
|
|
69 |
|
|
|
|
70 |
|
if
(p.length
> 1) {
|
|
|
71 |
|
addSelec
tValue(f,
'element_s
tyle_media
', p[0], p
[1]);
|
|
|
72 |
|
addSelec
tValue(f,
'element_l
ink_media'
, p[0], p[
1]);
|
|
|
73 |
|
}
|
|
|
74 |
|
}
|
|
|
75 |
|
|
|
|
76 |
|
// Set
up encodin
gs select
box
|
|
|
77 |
|
encodi
ngs = ed.g
etParam("f
ullpage_en
codings",
defaultEnc
odings).sp
lit(',');
|
|
|
78 |
|
for (i
=0; i<enco
dings.leng
th; i++) {
|
|
|
79 |
|
p
= encoding
s[i].split
('=');
|
|
|
80 |
|
|
|
|
81 |
|
if
(p.length
> 1) {
|
|
|
82 |
|
addSelec
tValue(f,
'docencodi
ng', p[0],
p[1]);
|
|
|
83 |
|
addSelec
tValue(f,
'element_s
cript_char
set', p[0]
, p[1]);
|
|
|
84 |
|
addSelec
tValue(f,
'element_l
ink_charse
t', p[0],
p[1]);
|
|
|
85 |
|
}
|
|
|
86 |
|
}
|
|
|
87 |
|
|
|
|
88 |
|
docume
nt.getElem
entById('b
gcolor_pic
kcontainer
').innerHT
ML = getCo
lorPickerH
TML('bgcol
or_pick','
bgcolor');
|
|
|
89 |
|
docume
nt.getElem
entById('l
ink_color_
pickcontai
ner').inne
rHTML = ge
tColorPick
erHTML('li
nk_color_p
ick','link
_color');
|
|
|
90 |
|
//docu
ment.getEl
ementById(
'hover_col
or_pickcon
tainer').i
nnerHTML =
getColorP
ickerHTML(
'hover_col
or_pick','
hover_colo
r');
|
|
|
91 |
|
docume
nt.getElem
entById('v
isited_col
or_pickcon
tainer').i
nnerHTML =
getColorP
ickerHTML(
'visited_c
olor_pick'
,'visited_
color');
|
|
|
92 |
|
docume
nt.getElem
entById('a
ctive_colo
r_pickcont
ainer').in
nerHTML =
getColorPi
ckerHTML('
active_col
or_pick','
active_col
or');
|
|
|
93 |
|
docume
nt.getElem
entById('t
extcolor_p
ickcontain
er').inner
HTML = get
ColorPicke
rHTML('tex
tcolor_pic
k','textco
lor');
|
|
|
94 |
|
docume
nt.getElem
entById('s
tylesheet_
browsercon
tainer').i
nnerHTML =
getBrowse
rHTML('sty
lesheetbro
wser','sty
lesheet','
file','ful
lpage');
|
|
|
95 |
|
docume
nt.getElem
entById('l
ink_href_p
ickcontain
er').inner
HTML = get
BrowserHTM
L('link_hr
ef_browser
','element
_link_href
','file','
fullpage')
;
|
|
|
96 |
|
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');
|
|
|
97 |
|
docume
nt.getElem
entById('b
gimage_pic
kcontainer
').innerHT
ML = getBr
owserHTML(
'bgimage_b
rowser','b
gimage','i
mage','ful
lpage');
|
|
|
98 |
|
|
|
|
99 |
|
// Res
ize some e
lements
|
|
|
100 |
|
if (is
Visible('s
tylesheetb
rowser'))
|
|
|
101 |
|
do
cument.get
ElementByI
d('stylesh
eet').styl
e.width =
'220px';
|
|
|
102 |
|
|
|
|
103 |
|
if (is
Visible('l
ink_href_b
rowser'))
|
|
|
104 |
|
do
cument.get
ElementByI
d('element
_link_href
').style.w
idth = '23
0px';
|
|
|
105 |
|
|
|
|
106 |
|
if (is
Visible('b
gimage_bro
wser'))
|
|
|
107 |
|
do
cument.get
ElementByI
d('bgimage
').style.w
idth = '21
0px';
|
|
|
108 |
|
|
|
|
109 |
|
// Add
iframe
|
|
|
110 |
|
dom.ad
d(document
.body, 'if
rame', {id
: 'docume
ntIframe',
src : 'ja
vascript:"
"', style
: {display
: 'none'}
});
|
|
|
111 |
|
doc =
dom.get('d
ocumentIfr
ame').cont
entWindow.
document;
|
|
|
112 |
|
h = ti
nyMCEPopup
.getWindow
Arg('head_
html');
|
|
|
113 |
|
|
|
|
114 |
|
// Pre
process th
e HTML dis
able scrip
ts and url
s
|
|
|
115 |
|
h = h.
replace(/<
script>/gi
, '<script
type="tex
t/javascri
pt">');
|
|
|
116 |
|
h = h.
replace(/t
ype=([\"\'
])?/gi, 't
ype=$1-mce
-');
|
|
|
117 |
|
h = h.
replace(/(
src=|href=
)/g, 'mce_
$1');
|
|
|
118 |
|
|
|
|
119 |
|
// Wri
te in the
content in
the ifram
e
|
|
|
120 |
|
doc.wr
ite(h + '<
/body></ht
ml>');
|
|
|
121 |
|
doc.cl
ose();
|
|
|
122 |
|
|
|
|
123 |
|
// Par
se xml and
doctype
|
|
|
124 |
|
xmlVer
= getReIt
em(/<\?\s*
?xml.*?ver
sion\s*?=\
s*?"(.*?)"
.*?\?>/gi,
h, 1);
|
|
|
125 |
|
xmlEnc
= getReIt
em(/<\?\s*
?xml.*?enc
oding\s*?=
\s*?"(.*?)
".*?\?>/gi
, h, 1);
|
|
|
126 |
|
docTyp
e = getReI
tem(/<\!DO
CTYPE.*?>/
gi, h, 0);
|
|
|
127 |
|
f.lang
code.value
= getReIt
em(/lang="
(.*?)"/gi,
h, 1);
|
|
|
128 |
|
|
|
|
129 |
|
// Par
se title
|
|
|
130 |
|
if (e
= doc.getE
lementsByT
agName('ti
tle')[0])
|
|
|
131 |
|
el
.metatitle
.value = e
.textConte
nt || e.te
xt;
|
|
|
132 |
|
|
|
|
133 |
|
// Par
se meta
|
|
|
134 |
|
tinymc
e.each(doc
.getElemen
tsByTagNam
e('meta'),
function(
n) {
|
|
|
135 |
|
va
r na = (n.
getAttribu
te('name',
2) || '')
.toLowerCa
se(), va =
n.getAttr
ibute('con
tent', 2),
eq = n.ge
tAttribute
('httpEqui
v', 2) ||
'';
|
|
|
136 |
|
|
|
|
137 |
|
e
= el['meta
' + na];
|
|
|
138 |
|
|
|
|
139 |
|
if
(na == 'r
obots') {
|
|
|
140 |
|
selectBy
Value(f, '
metarobots
', tinymce
.trim(va),
true, tru
e);
|
|
|
141 |
|
return;
|
|
|
142 |
|
}
|
|
|
143 |
|
|
|
|
144 |
|
sw
itch (eq.t
oLowerCase
()) {
|
|
|
145 |
|
case "co
ntent-type
":
|
|
|
146 |
|
tmp
= getReIte
m(/charset
\s*=\s*(.*
)\s*/gi, v
alue, 1);
|
|
|
147 |
|
|
|
|
148 |
|
// O
verride XM
L encoding
|
|
|
149 |
|
if (
tmp != "")
|
|
|
150 |
|
xmlEnc = t
mp;
|
|
|
151 |
|
|
|
|
152 |
|
retu
rn;
|
|
|
153 |
|
}
|
|
|
154 |
|
|
|
|
155 |
|
if
(e)
|
|
|
156 |
|
e.value
= va;
|
|
|
157 |
|
});
|
|
|
158 |
|
|
|
|
159 |
|
select
ByValue(f,
'doctypes
', docType
, true, tr
ue);
|
|
|
160 |
|
select
ByValue(f,
'docencod
ing', xmlE
nc, true,
true);
|
|
|
161 |
|
select
ByValue(f,
'langdir'
, doc.body
.getAttrib
ute('dir',
2) || '',
true, tru
e);
|
|
|
162 |
|
|
|
|
163 |
|
if (xm
lVer != ''
)
|
|
|
164 |
|
el
.xml_pi.ch
ecked = tr
ue;
|
|
|
165 |
|
|
|
|
166 |
|
// Par
se appeara
nce
|
|
|
167 |
|
|
|
|
168 |
|
// Par
se primary
styleshee
t
|
|
|
169 |
|
tinymc
e.each(doc
.getElemen
tsByTagNam
e("link"),
function(
l) {
|
|
|
170 |
|
va
r m = l.ge
tAttribute
('media',
2) || '',
t = l.getA
ttribute('
type', 2)
|| '';
|
|
|
171 |
|
|
|
|
172 |
|
if
(t == "-m
ce-text/cs
s" && (m =
= "" || m
== "screen
" || m ==
"all") &&
(l.getAttr
ibute('rel
', 2) || '
') == "sty
lesheet")
{
|
|
|
173 |
|
f.styles
heet.value
= l.getAt
tribute('m
ce_href',
2) || '';
|
|
|
174 |
|
return f
alse;
|
|
|
175 |
|
}
|
|
|
176 |
|
});
|
|
|
177 |
|
|
|
|
178 |
|
// Get
from styl
e elements
|
|
|
179 |
|
tinymc
e.each(doc
.getElemen
tsByTagNam
e("style")
, function
(st) {
|
|
|
180 |
|
va
r tmp = pa
rseStyleEl
ement(st);
|
|
|
181 |
|
|
|
|
182 |
|
fo
r (x=0; x<
tmp.length
; x++) {
|
|
|
183 |
|
if (tmp[
x].rule.in
dexOf('a:v
isited') !
= -1 && tm
p[x].data[
'color'])
|
|
|
184 |
|
f.vi
sited_colo
r.value =
tmp[x].dat
a['color']
;
|
|
|
185 |
|
|
|
|
186 |
|
if (tmp[
x].rule.in
dexOf('a:l
ink') != -
1 && tmp[x
].data['co
lor'])
|
|
|
187 |
|
f.li
nk_color.v
alue = tmp
[x].data['
color'];
|
|
|
188 |
|
|
|
|
189 |
|
if (tmp[
x].rule.in
dexOf('a:a
ctive') !=
-1 && tmp
[x].data['
color'])
|
|
|
190 |
|
f.ac
tive_color
.value = t
mp[x].data
['color'];
|
|
|
191 |
|
}
|
|
|
192 |
|
});
|
|
|
193 |
|
|
|
|
194 |
|
f.text
color.valu
e = tinyMC
EPopup.dom
.getAttrib
(doc.body,
"text");
|
|
|
195 |
|
f.acti
ve_color.v
alue = tin
yMCEPopup.
dom.getAtt
rib(doc.bo
dy, "alink
");
|
|
|
196 |
|
f.link
_color.val
ue = tinyM
CEPopup.do
m.getAttri
b(doc.body
, "link");
|
|
|
197 |
|
f.visi
ted_color.
value = ti
nyMCEPopup
.dom.getAt
trib(doc.b
ody, "vlin
k");
|
|
|
198 |
|
f.bgco
lor.value
= tinyMCEP
opup.dom.g
etAttrib(d
oc.body, "
bgcolor");
|
|
|
199 |
|
f.bgim
age.value
= tinyMCEP
opup.dom.g
etAttrib(d
oc.body, "
background
");
|
|
|
200 |
|
|
|
|
201 |
|
// Get
from styl
e info
|
|
|
202 |
|
style
= tinyMCEP
opup.dom.p
arseStyle(
tinyMCEPop
up.dom.get
Attrib(doc
.body, 'st
yle'));
|
|
|
203 |
|
|
|
|
204 |
|
if (st
yle['font-
family'])
|
|
|
205 |
|
se
lectByValu
e(f, 'font
face', sty
le['font-f
amily'], t
rue, true)
;
|
|
|
206 |
|
else
|
|
|
207 |
|
se
lectByValu
e(f, 'font
face', ed.
getParam("
fullpage_d
efault_fon
tface", ""
), true, t
rue);
|
|
|
208 |
|
|
|
|
209 |
|
if (st
yle['font-
size'])
|
|
|
210 |
|
se
lectByValu
e(f, 'font
size', sty
le['font-s
ize'], tru
e, true);
|
|
|
211 |
|
else
|
|
|
212 |
|
se
lectByValu
e(f, 'font
size', ed.
getParam("
fullpage_d
efault_fon
tsize", ""
), true, t
rue);
|
|
|
213 |
|
|
|
|
214 |
|
if (st
yle['color
'])
|
|
|
215 |
|
f.
textcolor.
value = co
nvertRGBTo
Hex(style[
'color']);
|
|
|
216 |
|
|
|
|
217 |
|
if (st
yle['backg
round-imag
e'])
|
|
|
218 |
|
f.
bgimage.va
lue = styl
e['backgro
und-image'
].replace(
new RegExp
("url\\('?
([^']*)'?\
\)", 'gi')
, "$1");
|
|
|
219 |
|
|
|
|
220 |
|
if (st
yle['backg
round-colo
r'])
|
|
|
221 |
|
f.
bgcolor.va
lue = styl
e['backgro
und-color'
];
|
|
|
222 |
|
|
|
|
223 |
|
if (st
yle['margi
n']) {
|
|
|
224 |
|
tm
p = style[
'margin'].
replace(/[
^0-9 ]/g,
'');
|
|
|
225 |
|
tm
p = tmp.sp
lit(/ +/);
|
|
|
226 |
|
f.
topmargin.
value = tm
p.length >
0 ? tmp[0
] : '';
|
|
|
227 |
|
f.
rightmargi
n.value =
tmp.length
> 1 ? tmp
[1] : tmp[
0];
|
|
|
228 |
|
f.
bottommarg
in.value =
tmp.lengt
h > 2 ? tm
p[2] : tmp
[0];
|
|
|
229 |
|
f.
leftmargin
.value = t
mp.length
> 3 ? tmp[
3] : tmp[0
];
|
|
|
230 |
|
}
|
|
|
231 |
|
|
|
|
232 |
|
if (st
yle['margi
n-left'])
|
|
|
233 |
|
f.
leftmargin
.value = s
tyle['marg
in-left'].
replace(/[
^0-9]/g, '
');
|
|
|
234 |
|
|
|
|
235 |
|
if (st
yle['margi
n-right'])
|
|
|
236 |
|
f.
rightmargi
n.value =
style['mar
gin-right'
].replace(
/[^0-9]/g,
'');
|
|
|
237 |
|
|
|
|
238 |
|
if (st
yle['margi
n-top'])
|
|
|
239 |
|
f.
topmargin.
value = st
yle['margi
n-top'].re
place(/[^0
-9]/g, '')
;
|
|
|
240 |
|
|
|
|
241 |
|
if (st
yle['margi
n-bottom']
)
|
|
|
242 |
|
f.
bottommarg
in.value =
style['ma
rgin-botto
m'].replac
e(/[^0-9]/
g, '');
|
|
|
243 |
|
|
|
|
244 |
|
f.styl
e.value =
tinyMCEPop
up.dom.ser
ializeStyl
e(style);
|
|
|
245 |
|
|
|
|
246 |
|
// Upd
ate colors
|
|
|
247 |
|
update
Color('tex
tcolor_pic
k', 'textc
olor');
|
|
|
248 |
|
update
Color('bgc
olor_pick'
, 'bgcolor
');
|
|
|
249 |
|
update
Color('vis
ited_color
_pick', 'v
isited_col
or');
|
|
|
250 |
|
update
Color('act
ive_color_
pick', 'ac
tive_color
');
|
|
|
251 |
|
update
Color('lin
k_color_pi
ck', 'link
_color');
|
|
|
252 |
|
}
|
|
|
253 |
|
|
|
|
254 |
|
function g
etReItem(r
, s, i) {
|
|
|
255 |
|
var c
= r.exec(s
);
|
|
|
256 |
|
|
|
|
257 |
|
if (c
&& c.lengt
h > i)
|
|
|
258 |
|
re
turn c[i];
|
|
|
259 |
|
|
|
|
260 |
|
return
'';
|
|
|
261 |
|
}
|
|
|
262 |
|
|
|
|
263 |
|
function u
pdateActio
n() {
|
|
|
264 |
|
var f
= document
.forms[0],
nl, i, h,
v, s, hea
d, html, l
, tmp, add
link = tru
e, ser;
|
|
|
265 |
|
|
|
|
266 |
|
head =
doc.getEl
ementsByTa
gName('hea
d')[0];
|
|
|
267 |
|
|
|
|
268 |
|
// Fix
scripts w
ithout a t
ype
|
|
|
269 |
|
nl = d
oc.getElem
entsByTagN
ame('scrip
t');
|
|
|
270 |
|
for (i
=0; i<nl.l
ength; i++
) {
|
|
|
271 |
|
if
(tinyMCEP
opup.dom.g
etAttrib(n
l[i], 'mce
_type') ==
'')
|
|
|
272 |
|
nl[i].se
tAttribute
('mce_type
', 'text/j
avascript'
);
|
|
|
273 |
|
}
|
|
|
274 |
|
|
|
|
275 |
|
// Get
primary s
tylesheet
|
|
|
276 |
|
nl = d
oc.getElem
entsByTagN
ame("link"
);
|
|
|
277 |
|
for (i
=0; i<nl.l
ength; i++
) {
|
|
|
278 |
|
l
= nl[i];
|
|
|
279 |
|
|
|
|
280 |
|
tm
p = tinyMC
EPopup.dom
.getAttrib
(l, 'media
');
|
|
|
281 |
|
|
|
|
282 |
|
if
(tinyMCEP
opup.dom.g
etAttrib(l
, 'mce_typ
e') == "te
xt/css" &&
(tmp == "
" || tmp =
= "screen"
|| tmp ==
"all") &&
tinyMCEPo
pup.dom.ge
tAttrib(l,
'rel') ==
"styleshe
et") {
|
|
|
283 |
|
addlink
= false;
|
|
|
284 |
|
|
|
|
285 |
|
if (f.st
ylesheet.v
alue == ''
)
|
|
|
286 |
|
l.pa
rentNode.r
emoveChild
(l);
|
|
|
287 |
|
else
|
|
|
288 |
|
l.se
tAttribute
('mce_href
', f.style
sheet.valu
e);
|
|
|
289 |
|
|
|
|
290 |
|
break;
|
|
|
291 |
|
}
|
|
|
292 |
|
}
|
|
|
293 |
|
|
|
|
294 |
|
// Add
new link
|
|
|
295 |
|
if (f.
stylesheet
.value !=
'') {
|
|
|
296 |
|
l
= doc.crea
teElement(
'link');
|
|
|
297 |
|
|
|
|
298 |
|
l.
setAttribu
te('type',
'text/css
');
|
|
|
299 |
|
l.
setAttribu
te('mce_hr
ef', f.sty
lesheet.va
lue);
|
|
|
300 |
|
l.
setAttribu
te('rel',
'styleshee
t');
|
|
|
301 |
|
|
|
|
302 |
|
he
ad.appendC
hild(l);
|
|
|
303 |
|
}
|
|
|
304 |
|
|
|
|
305 |
|
setMet
a(head, 'k
eywords',
f.metakeyw
ords.value
);
|
|
|
306 |
|
setMet
a(head, 'd
escription
', f.metad
escription
.value);
|
|
|
307 |
|
setMet
a(head, 'a
uthor', f.
metaauthor
.value);
|
|
|
308 |
|
setMet
a(head, 'c
opyright',
f.metacop
yright.val
ue);
|
|
|
309 |
|
setMet
a(head, 'r
obots', ge
tSelectVal
ue(f, 'met
arobots'))
;
|
|
|
310 |
|
setMet
a(head, 'C
ontent-Typ
e', getSel
ectValue(f
, 'docenco
ding'));
|
|
|
311 |
|
|
|
|
312 |
|
doc.bo
dy.dir = g
etSelectVa
lue(f, 'la
ngdir');
|
|
|
313 |
|
doc.bo
dy.style.c
ssText = f
.style.val
ue;
|
|
|
314 |
|
|
|
|
315 |
|
doc.bo
dy.setAttr
ibute('vLi
nk', f.vis
ited_color
.value);
|
|
|
316 |
|
doc.bo
dy.setAttr
ibute('lin
k', f.link
_color.val
ue);
|
|
|
317 |
|
doc.bo
dy.setAttr
ibute('tex
t', f.text
color.valu
e);
|
|
|
318 |
|
doc.bo
dy.setAttr
ibute('aLi
nk', f.act
ive_color.
value);
|
|
|
319 |
|
|
|
|
320 |
|
doc.bo
dy.style.f
ontFamily
= getSelec
tValue(f,
'fontface'
);
|
|
|
321 |
|
doc.bo
dy.style.f
ontSize =
getSelectV
alue(f, 'f
ontsize');
|
|
|
322 |
|
doc.bo
dy.style.b
ackgroundC
olor = f.b
gcolor.val
ue;
|
|
|
323 |
|
|
|
|
324 |
|
if (f.
leftmargin
.value !=
'')
|
|
|
325 |
|
do
c.body.sty
le.marginL
eft = f.le
ftmargin.v
alue + 'px
';
|
|
|
326 |
|
|
|
|
327 |
|
if (f.
rightmargi
n.value !=
'')
|
|
|
328 |
|
do
c.body.sty
le.marginR
ight = f.r
ightmargin
.value + '
px';
|
|
|
329 |
|
|
|
|
330 |
|
if (f.
bottommarg
in.value !
= '')
|
|
|
331 |
|
do
c.body.sty
le.marginB
ottom = f.
bottommarg
in.value +
'px';
|
|
|
332 |
|
|
|
|
333 |
|
if (f.
topmargin.
value != '
')
|
|
|
334 |
|
do
c.body.sty
le.marginT
op = f.top
margin.val
ue + 'px';
|
|
|
335 |
|
|
|
|
336 |
|
html =
doc.getEl
ementsByTa
gName('htm
l')[0];
|
|
|
337 |
|
html.s
etAttribut
e('lang',
f.langcode
.value);
|
|
|
338 |
|
html.s
etAttribut
e('xml:lan
g', f.lang
code.value
);
|
|
|
339 |
|
|
|
|
340 |
|
if (f.
bgimage.va
lue != '')
|
|
|
341 |
|
do
c.body.sty
le.backgro
undImage =
"url('" +
f.bgimage
.value + "
')";
|
|
|
342 |
|
else
|
|
|
343 |
|
do
c.body.sty
le.backgro
undImage =
'';
|
|
|
344 |
|
|
|
|
345 |
|
ser =
tinyMCEPop
up.editor.
plugins.fu
llpage._cr
eateSerial
izer();
|
|
|
346 |
|
ser.se
tRules('-t
itle,meta[
http-equiv
|name|cont
ent],base[
href|targe
t],link[hr
ef|rel|typ
e|title|me
dia],style
[type],scr
ipt[type|l
anguage|sr
c],html[la
ng|xml::la
ng|xmlns],
body[style
|dir|vlink
|link|text
|alink],he
ad');
|
|
|
347 |
|
|
|
|
348 |
|
h = se
r.serializ
e(doc.docu
mentElemen
t);
|
|
|
349 |
|
h = h.
substring(
0, h.lastI
ndexOf('</
body>'));
|
|
|
350 |
|
|
|
|
351 |
|
if (h.
indexOf('<
title>') =
= -1)
|
|
|
352 |
|
h
= h.replac
e(/<head.*
?>/, '$&\n
' + '<titl
e>' + tiny
MCEPopup.d
om.encode(
f.metatitl
e.value) +
'</title>
');
|
|
|
353 |
|
else
|
|
|
354 |
|
h
= h.replac
e(/<title>
(.*?)<\/ti
tle>/, '<t
itle>' + t
inyMCEPopu
p.dom.enco
de(f.metat
itle.value
) + '</tit
le>');
|
|
|
355 |
|
|
|
|
356 |
|
if ((v
= getSele
ctValue(f,
'doctypes
')) != '')
|
|
|
357 |
|
h
= v + '\n'
+ h;
|
|
|
358 |
|
|
|
|
359 |
|
if (f.
xml_pi.che
cked) {
|
|
|
360 |
|
s
= '<?xml v
ersion="1.
0"';
|
|
|
361 |
|
|
|
|
362 |
|
if
((v = get
SelectValu
e(f, 'doce
ncoding'))
!= '')
|
|
|
363 |
|
s += ' e
ncoding="'
+ v + '"'
;
|
|
|
364 |
|
|
|
|
365 |
|
s
+= '?>\n';
|
|
|
366 |
|
h
= s + h;
|
|
|
367 |
|
}
|
|
|
368 |
|
|
|
|
369 |
|
h = h.
replace(/t
ype=\"\-mc
e\-/gi, 't
ype="');
|
|
|
370 |
|
|
|
|
371 |
|
tinyMC
EPopup.edi
tor.plugin
s.fullpage
.head = h;
|
|
|
372 |
|
tinyMC
EPopup.edi
tor.plugin
s.fullpage
._setBodyA
ttribs(tin
yMCEPopup.
editor, {}
);
|
|
|
373 |
|
tinyMC
EPopup.clo
se();
|
|
|
374 |
|
}
|
|
|
375 |
|
|
|
|
376 |
|
function c
hangedStyl
eField(fie
ld) {
|
|
|
377 |
|
//aler
t(field.id
);
|
|
|
378 |
|
}
|
|
|
379 |
|
|
|
|
380 |
|
function s
etMeta(he,
k, v) {
|
|
|
381 |
|
var nl
, i, m;
|
|
|
382 |
|
|
|
|
383 |
|
nl = h
e.getEleme
ntsByTagNa
me('meta')
;
|
|
|
384 |
|
for (i
=0; i<nl.l
ength; i++
) {
|
|
|
385 |
|
if
(k == 'Co
ntent-Type
' && tinyM
CEPopup.do
m.getAttri
b(nl[i], '
http-equiv
') == k) {
|
|
|
386 |
|
if (v ==
'')
|
|
|
387 |
|
nl[i
].parentNo
de.removeC
hild(nl[i]
);
|
|
|
388 |
|
else
|
|
|
389 |
|
nl[i
].setAttri
bute('cont
ent', "tex
t/html; ch
arset=" +
v);
|
|
|
390 |
|
|
|
|
391 |
|
return;
|
|
|
392 |
|
}
|
|
|
393 |
|
|
|
|
394 |
|
if
(tinyMCEP
opup.dom.g
etAttrib(n
l[i], 'nam
e') == k)
{
|
|
|
395 |
|
if (v ==
'')
|
|
|
396 |
|
nl[i
].parentNo
de.removeC
hild(nl[i]
);
|
|
|
397 |
|
else
|
|
|
398 |
|
nl[i
].setAttri
bute('cont
ent', v);
|
|
|
399 |
|
return;
|
|
|
400 |
|
}
|
|
|
401 |
|
}
|
|
|
402 |
|
|
|
|
403 |
|
if (v
== '')
|
|
|
404 |
|
re
turn;
|
|
|
405 |
|
|
|
|
406 |
|
m = do
c.createEl
ement('met
a');
|
|
|
407 |
|
|
|
|
408 |
|
if (k
== 'Conten
t-Type')
|
|
|
409 |
|
m.
httpEquiv
= k;
|
|
|
410 |
|
else
|
|
|
411 |
|
m.
setAttribu
te('name',
k);
|
|
|
412 |
|
|
|
|
413 |
|
m.setA
ttribute('
content',
v);
|
|
|
414 |
|
he.app
endChild(m
);
|
|
|
415 |
|
}
|
|
|
416 |
|
|
|
|
417 |
|
function p
arseStyleE
lement(e)
{
|
|
|
418 |
|
var v
= e.innerH
TML;
|
|
|
419 |
|
var p,
i, r;
|
|
|
420 |
|
|
|
|
421 |
|
v = v.
replace(/<
!--/gi, ''
);
|
|
|
422 |
|
v = v.
replace(/-
->/gi, '')
;
|
|
|
423 |
|
v = v.
replace(/[
\n\r]/gi,
'');
|
|
|
424 |
|
v = v.
replace(/\
s+/gi, ' '
);
|
|
|
425 |
|
|
|
|
426 |
|
r = []
;
|
|
|
427 |
|
p = v.
split(/{|}
/);
|
|
|
428 |
|
|
|
|
429 |
|
for (i
=0; i<p.le
ngth; i+=2
) {
|
|
|
430 |
|
if
(p[i] !=
"")
|
|
|
431 |
|
r[r.leng
th] = {rul
e : tinymc
e.trim(p[i
]), data :
tinyMCEPo
pup.dom.pa
rseStyle(p
[i+1])};
|
|
|
432 |
|
}
|
|
|
433 |
|
|
|
|
434 |
|
return
r;
|
|
|
435 |
|
}
|
|
|
436 |
|
|
|
|
437 |
|
function s
erializeSt
yleElement
(d) {
|
|
|
438 |
|
var i,
s, st;
|
|
|
439 |
|
|
|
|
440 |
|
s = '<
!--\n';
|
|
|
441 |
|
|
|
|
442 |
|
for (i
=0; i<d.le
ngth; i++)
{
|
|
|
443 |
|
s
+= d[i].ru
le + ' {\n
';
|
|
|
444 |
|
|
|
|
445 |
|
st
= tinyMCE
.serialize
Style(d[i]
.data);
|
|
|
446 |
|
|
|
|
447 |
|
if
(st != ''
)
|
|
|
448 |
|
st += ';
';
|
|
|
449 |
|
|
|
|
450 |
|
s
+= st.repl
ace(/;/g,
';\n');
|
|
|
451 |
|
s
+= '}\n';
|
|
|
452 |
|
|
|
|
453 |
|
if
(i != d.l
ength - 1)
|
|
|
454 |
|
s += '\n
';
|
|
|
455 |
|
}
|
|
|
456 |
|
|
|
|
457 |
|
s += '
\n-->';
|
|
|
458 |
|
|
|
|
459 |
|
return
s;
|
|
|
460 |
|
}
|
|
|
461 |
|
|
|
|
462 |
|
tinyMCEPop
up.onInit.
add(init);
|