4
'XHTML 1.0 Transitional=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">,' +
5
'XHTML 1.0 Frameset=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">,' +
6
'XHTML 1.0 Strict=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">,' +
7
'XHTML 1.1=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">,' +
8
'HTML 4.01 Transitional=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">,' +
9
'HTML 4.01 Strict=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">,' +
10
'HTML 4.01 Frameset=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">';
12
var defaultEncodings =
13
'Western european (iso-8859-1)=iso-8859-1,' +
14
'Central European (iso-8859-2)=iso-8859-2,' +
15
'Unicode (UTF-8)=utf-8,' +
16
'Chinese traditional (Big5)=big5,' +
17
'Cyrillic (iso-8859-5)=iso-8859-5,' +
18
'Japanese (iso-2022-jp)=iso-2022-jp,' +
19
'Greek (iso-8859-7)=iso-8859-7,' +
20
'Korean (iso-2022-kr)=iso-2022-kr,' +
21
'ASCII (us-ascii)=us-ascii';
23
var defaultMediaTypes =
29
'projection=projection,' +
30
'handheld=handheld,' +
34
var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';
35
var defaultFontSizes = '10px,11px,12px,13px,14px,15px,16px';
37
var addMenuLayer = new MCLayer("addmenu");
38
var lastElementType = null;
42
var f = document.forms['fullpage'];
43
var i, p, doctypes, encodings, mediaTypes, fonts;
44
var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
46
// Setup doctype select box
47
doctypes = tinyMCE.getParam("fullpage_doctypes", defaultDocTypes).split(',');
48
for (i=0; i<doctypes.length; i++) {
49
p = doctypes[i].split('=');
52
addSelectValue(f, 'doctypes', p[0], p[1]);
55
// Setup fonts select box
56
fonts = tinyMCE.getParam("fullpage_fonts", defaultFontNames).split(';');
57
for (i=0; i<fonts.length; i++) {
58
p = fonts[i].split('=');
61
addSelectValue(f, 'fontface', p[0], p[1]);
64
// Setup fontsize select box
65
fonts = tinyMCE.getParam("fullpage_fontsizes", defaultFontSizes).split(',');
66
for (i=0; i<fonts.length; i++)
67
addSelectValue(f, 'fontsize', fonts[i], fonts[i]);
69
// Setup mediatype select boxs
70
mediaTypes = tinyMCE.getParam("fullpage_media_types", defaultMediaTypes).split(',');
71
for (i=0; i<mediaTypes.length; i++) {
72
p = mediaTypes[i].split('=');
75
addSelectValue(f, 'element_style_media', p[0], p[1]);
76
addSelectValue(f, 'element_link_media', p[0], p[1]);
80
// Setup encodings select box
81
encodings = tinyMCE.getParam("fullpage_encodings", defaultEncodings).split(',');
82
for (i=0; i<encodings.length; i++) {
83
p = encodings[i].split('=');
86
addSelectValue(f, 'docencoding', p[0], p[1]);
87
addSelectValue(f, 'element_script_charset', p[0], p[1]);
88
addSelectValue(f, 'element_link_charset', p[0], p[1]);
92
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
93
document.getElementById('link_color_pickcontainer').innerHTML = getColorPickerHTML('link_color_pick','link_color');
94
//document.getElementById('hover_color_pickcontainer').innerHTML = getColorPickerHTML('hover_color_pick','hover_color');
95
document.getElementById('visited_color_pickcontainer').innerHTML = getColorPickerHTML('visited_color_pick','visited_color');
96
document.getElementById('active_color_pickcontainer').innerHTML = getColorPickerHTML('active_color_pick','active_color');
97
document.getElementById('textcolor_pickcontainer').innerHTML = getColorPickerHTML('textcolor_pick','textcolor');
98
document.getElementById('stylesheet_browsercontainer').innerHTML = getBrowserHTML('stylesheetbrowser','stylesheet','file','fullpage');
99
document.getElementById('link_href_pickcontainer').innerHTML = getBrowserHTML('link_href_browser','element_link_href','file','fullpage');
100
document.getElementById('script_src_pickcontainer').innerHTML = getBrowserHTML('script_src_browser','element_script_src','file','fullpage');
101
document.getElementById('bgimage_pickcontainer').innerHTML = getBrowserHTML('bgimage_browser','bgimage','image','fullpage');
103
// Resize some elements
104
if (isVisible('stylesheetbrowser'))
105
document.getElementById('stylesheet').style.width = '220px';
107
if (isVisible('link_href_browser'))
108
document.getElementById('element_link_href').style.width = '230px';
110
if (isVisible('bgimage_browser'))
111
document.getElementById('bgimage').style.width = '210px';
114
var iframe = document.createElement('iframe');
116
iframe.id = 'tempFrame';
117
iframe.style.display = 'none';
118
iframe.src = tinyMCE.baseURL + "/plugins/fullpage/blank.htm";
120
document.body.appendChild(iframe);
122
tinyMCEPopup.resizeToInnerSize();
125
function setupIframe(doc) {
126
var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
127
var hc = inst.fullpageTopContent;
128
var f = document.forms[0];
129
var xmlVer, xmlEnc, docType;
130
var nodes, i, x, name, value, tmp, l;
132
// Keep it from not loading/executing stuff
133
hc = hc.replace(/<script>/gi, '<script type="text/javascript">');
134
hc = hc.replace(/\ssrc=/gi, " mce_src=");
135
hc = hc.replace(/\shref=/gi, " mce_href=");
136
hc = hc.replace(/\stype=/gi, " mce_type=");
137
hc = hc.replace(/<script/gi, '<script type="text/unknown" ');
139
// Add end to make it DOM parseable
140
hc += '</body></html>';
147
// ------- Setup options for genral tab
149
// Parse xml and doctype
150
xmlVer = getReItem(/<\?\s*?xml.*?version\s*?=\s*?"(.*?)".*?\?>/gi, hc, 1);
151
xmlEnc = getReItem(/<\?\s*?xml.*?encoding\s*?=\s*?"(.*?)".*?\?>/gi, hc, 1);
152
docType = getReItem(/<\!DOCTYPE.*?>/gi, hc, 0);
153
f.langcode.value = getReItem(/lang="(.*?)"/gi, hc, 1);
156
f.metatitle.value = tinyMCE.entityDecode(getReItem(/<title>(.*?)<\/title>/gi, hc, 1));
158
// Check for meta encoding
159
nodes = doc.getElementsByTagName("meta");
160
for (i=0; i<nodes.length; i++) {
161
name = tinyMCE.getAttrib(nodes[i], 'name');
162
value = tinyMCE.getAttrib(nodes[i], 'content');
163
httpEquiv = tinyMCE.getAttrib(nodes[i], 'httpEquiv');
165
switch (name.toLowerCase()) {
167
f.metakeywords.value = value;
171
f.metadescription.value = value;
175
f.metaauthor.value = value;
179
f.metacopyright.value = value;
183
selectByValue(f, 'metarobots', value, true, true);
187
switch (httpEquiv.toLowerCase()) {
189
tmp = getReItem(/charset\s*=\s*(.*)\s*/gi, value, 1);
191
// Override XML encoding
199
selectByValue(f, 'doctypes', docType, true, true);
200
selectByValue(f, 'docencoding', xmlEnc, true, true);
201
selectByValue(f, 'langdir', tinyMCE.getAttrib(doc.body, 'dir'), true, true);
204
f.xml_pi.checked = true;
206
// ------- Setup options for appearance tab
208
// Get primary stylesheet
209
nodes = doc.getElementsByTagName("link");
210
for (i=0; i<nodes.length; i++) {
212
tmp = tinyMCE.getAttrib(l, 'media');
214
if (tinyMCE.getAttrib(l, 'mce_type') == "text/css" && (tmp == "" || tmp == "screen" || tmp == "all") && tinyMCE.getAttrib(l, 'rel') == "stylesheet") {
215
f.stylesheet.value = tinyMCE.getAttrib(l, 'mce_href');
220
// Get from style elements
221
nodes = doc.getElementsByTagName("style");
222
for (i=0; i<nodes.length; i++) {
223
tmp = parseStyleElement(nodes[i]);
225
for (x=0; x<tmp.length; x++) {
226
// if (tmp[x].rule.indexOf('a:hover') != -1 && tmp[x].data['color'])
227
// f.hover_color.value = tmp[x].data['color'];
229
if (tmp[x].rule.indexOf('a:visited') != -1 && tmp[x].data['color'])
230
f.visited_color.value = tmp[x].data['color'];
232
if (tmp[x].rule.indexOf('a:link') != -1 && tmp[x].data['color'])
233
f.link_color.value = tmp[x].data['color'];
235
if (tmp[x].rule.indexOf('a:active') != -1 && tmp[x].data['color'])
236
f.active_color.value = tmp[x].data['color'];
240
// Get from body attribs
242
/* f.leftmargin.value = tinyMCE.getAttrib(doc.body, "leftmargin");
243
f.rightmargin.value = tinyMCE.getAttrib(doc.body, "rightmargin");
244
f.topmargin.value = tinyMCE.getAttrib(doc.body, "topmargin");
245
f.bottommargin.value = tinyMCE.getAttrib(doc.body, "bottommargin");*/
246
f.textcolor.value = convertRGBToHex(tinyMCE.getAttrib(doc.body, "text"));
247
f.active_color.value = convertRGBToHex(tinyMCE.getAttrib(doc.body, "alink"));
248
f.link_color.value = convertRGBToHex(tinyMCE.getAttrib(doc.body, "link"));
249
f.visited_color.value = convertRGBToHex(tinyMCE.getAttrib(doc.body, "vlink"));
250
f.bgcolor.value = convertRGBToHex(tinyMCE.getAttrib(doc.body, "bgcolor"));
251
f.bgimage.value = convertRGBToHex(tinyMCE.getAttrib(doc.body, "background"));
253
// Get from style info
254
var style = tinyMCE.parseStyle(tinyMCE.getAttrib(doc.body, 'style'));
256
if (style['font-family'])
257
selectByValue(f, 'fontface', style['font-family'], true, true);
259
selectByValue(f, 'fontface', tinyMCE.getParam("fullpage_default_fontface", ""), true, true);
261
if (style['font-size'])
262
selectByValue(f, 'fontsize', style['font-size'], true, true);
264
selectByValue(f, 'fontsize', tinyMCE.getParam("fullpage_default_fontsize", ""), true, true);
267
f.textcolor.value = convertRGBToHex(style['color']);
269
if (style['background-image'])
270
f.bgimage.value = style['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
272
if (style['background-color'])
273
f.bgcolor.value = convertRGBToHex(style['background-color']);
275
if (style['margin']) {
276
tmp = style['margin'].replace(/[^0-9 ]/g, '');
277
tmp = tmp.split(/ +/);
278
f.topmargin.value = tmp.length > 0 ? tmp[0] : '';
279
f.rightmargin.value = tmp.length > 1 ? tmp[1] : tmp[0];
280
f.bottommargin.value = tmp.length > 2 ? tmp[2] : tmp[0];
281
f.leftmargin.value = tmp.length > 3 ? tmp[3] : tmp[0];
284
if (style['margin-left'])
285
f.leftmargin.value = style['margin-left'].replace(/[^0-9]/g, '');
287
if (style['margin-right'])
288
f.rightmargin.value = style['margin-right'].replace(/[^0-9]/g, '');
290
if (style['margin-top'])
291
f.topmargin.value = style['margin-top'].replace(/[^0-9]/g, '');
293
if (style['margin-bottom'])
294
f.bottommargin.value = style['margin-bottom'].replace(/[^0-9]/g, '');
296
f.style.value = tinyMCE.serializeStyle(style);
298
updateColor('textcolor_pick', 'textcolor');
299
updateColor('bgcolor_pick', 'bgcolor');
300
updateColor('visited_color_pick', 'visited_color');
301
updateColor('active_color_pick', 'active_color');
302
updateColor('link_color_pick', 'link_color');
303
//updateColor('hover_color_pick', 'hover_color');
306
function updateAction() {
307
var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
308
var f = document.forms[0];
309
var nl, i, h, v, s, head, html, l, tmp, addlink = true;
311
head = topDoc.getElementsByTagName('head')[0];
313
// Fix scripts without a type
314
nl = topDoc.getElementsByTagName('script');
315
for (i=0; i<nl.length; i++) {
316
if (tinyMCE.getAttrib(nl[i], 'mce_type') == '')
317
nl[i].setAttribute('mce_type', 'text/javascript');
320
// Get primary stylesheet
321
nl = topDoc.getElementsByTagName("link");
322
for (i=0; i<nl.length; i++) {
325
tmp = tinyMCE.getAttrib(l, 'media');
327
if (tinyMCE.getAttrib(l, 'mce_type') == "text/css" && (tmp == "" || tmp == "screen" || tmp == "all") && tinyMCE.getAttrib(l, 'rel') == "stylesheet") {
330
if (f.stylesheet.value == '')
331
l.parentNode.removeChild(l);
333
l.setAttribute('mce_href', f.stylesheet.value);
340
if (f.stylesheet.value != '') {
341
l = topDoc.createElement('link');
343
l.setAttribute('mce_type', 'text/css');
344
l.setAttribute('mce_href', f.stylesheet.value);
345
l.setAttribute('rel', 'stylesheet');
350
setMeta(head, 'keywords', f.metakeywords.value);
351
setMeta(head, 'description', f.metadescription.value);
352
setMeta(head, 'author', f.metaauthor.value);
353
setMeta(head, 'copyright', f.metacopyright.value);
354
setMeta(head, 'robots', getSelectValue(f, 'metarobots'));
355
setMeta(head, 'Content-Type', getSelectValue(f, 'docencoding'));
357
topDoc.body.dir = getSelectValue(f, 'langdir');
358
topDoc.body.style.cssText = f.style.value;
360
topDoc.body.setAttribute('vLink', f.visited_color.value);
361
topDoc.body.setAttribute('link', f.link_color.value);
362
topDoc.body.setAttribute('text', f.textcolor.value);
363
topDoc.body.setAttribute('aLink', f.active_color.value);
365
topDoc.body.style.fontFamily = getSelectValue(f, 'fontface');
366
topDoc.body.style.fontSize = getSelectValue(f, 'fontsize');
367
topDoc.body.style.backgroundColor = f.bgcolor.value;
369
if (f.leftmargin.value != '')
370
topDoc.body.style.marginLeft = f.leftmargin.value + 'px';
372
if (f.rightmargin.value != '')
373
topDoc.body.style.marginRight = f.rightmargin.value + 'px';
375
if (f.bottommargin.value != '')
376
topDoc.body.style.marginBottom = f.bottommargin.value + 'px';
378
if (f.topmargin.value != '')
379
topDoc.body.style.marginTop = f.topmargin.value + 'px';
381
html = topDoc.getElementsByTagName('html')[0];
382
html.setAttribute('lang', f.langcode.value);
383
html.setAttribute('xml:lang', f.langcode.value);
385
if (f.bgimage.value != '')
386
topDoc.body.style.backgroundImage = "url('" + f.bgimage.value + "')";
388
topDoc.body.style.backgroundImage = '';
390
inst.cleanup.addRuleStr('-title,meta[http-equiv|name|content],base[href|target],link[href|rel|type|title|media],style[type],script[type|language|src],html[lang|xml:lang|xmlns],body[style|dir|vlink|link|text|alink],head');
392
h = inst.cleanup.serializeNodeAsHTML(topDoc.documentElement);
394
h = h.substring(0, h.lastIndexOf('</body>'));
396
if (h.indexOf('<title>') == -1)
397
h = h.replace(/<head.*?>/, '$&\n' + '<title>' + inst.cleanup.xmlEncode(f.metatitle.value) + '</title>');
399
h = h.replace(/<title>(.*?)<\/title>/, '<title>' + inst.cleanup.xmlEncode(f.metatitle.value) + '</title>');
401
if ((v = getSelectValue(f, 'doctypes')) != '')
404
if (f.xml_pi.checked) {
405
s = '<?xml version="1.0"';
407
if ((v = getSelectValue(f, 'docencoding')) != '')
408
s += ' encoding="' + v + '"';
414
inst.fullpageTopContent = h;
416
tinyMCEPopup.execCommand('mceFullPageUpdate', false, '');
417
tinyMCEPopup.close();
420
function setMeta(he, k, v) {
423
nl = he.getElementsByTagName('meta');
424
for (i=0; i<nl.length; i++) {
425
if (k == 'Content-Type' && tinyMCE.getAttrib(nl[i], 'http-equiv') == k) {
427
nl[i].parentNode.removeChild(nl[i]);
429
nl[i].setAttribute('content', "text/html; charset=" + v);
434
if (tinyMCE.getAttrib(nl[i], 'name') == k) {
436
nl[i].parentNode.removeChild(nl[i]);
438
nl[i].setAttribute('content', v);
446
m = topDoc.createElement('meta');
448
if (k == 'Content-Type')
451
m.setAttribute('name', k);
453
m.setAttribute('content', v);
457
function parseStyleElement(e) {
461
v = v.replace(/<!--/gi, '');
462
v = v.replace(/-->/gi, '');
463
v = v.replace(/[\n\r]/gi, '');
464
v = v.replace(/\s+/gi, ' ');
469
for (i=0; i<p.length; i+=2) {
471
r[r.length] = {rule : tinyMCE.trim(p[i]), data : tinyMCE.parseStyle(p[i+1])};
477
function serializeStyleElement(d) {
482
for (i=0; i<d.length; i++) {
483
s += d[i].rule + ' {\n';
485
st = tinyMCE.serializeStyle(d[i].data);
490
s += st.replace(/;/g, ';\n');
493
if (i != d.length - 1)
502
function getReItem(r, s, i) {
505
if (c && c.length > i)
511
function changedStyleField(field) {
515
function showAddMenu() {
516
var re = document.getElementById('addbutton');
518
addMenuLayer.moveRelativeTo(re, 'tr');
519
if (addMenuLayer.isMSIE)
520
addMenuLayer.moveBy(2, 0);
523
addMenuLayer.setAutoHide(true, hideAddMenu);
524
addMenuLayer.addCSSClass(re, 'selected');
527
function hideAddMenu(l, e, mx, my) {
528
var re = document.getElementById('addbutton');
529
addMenuLayer.removeCSSClass(re, 'selected');
532
function addHeadElm(type) {
533
var le = document.getElementById('headlist');
534
var re = document.getElementById('addbutton');
535
var te = document.getElementById(type + '_element');
538
lastElementType.style.display = 'none';
540
te.style.display = 'block';
542
lastElementType = te;
545
addMenuLayer.removeCSSClass(re, 'selected');
547
document.getElementById(type + '_updateelement').value = tinyMCE.getLang('lang_insert', 'Insert', true);
552
function updateHeadElm(item) {
553
var type = item.substring(0, item.indexOf('_'));
554
var le = document.getElementById('headlist');
555
var re = document.getElementById('addbutton');
556
var te = document.getElementById(type + '_element');
559
lastElementType.style.display = 'none';
561
te.style.display = 'block';
563
lastElementType = te;
566
addMenuLayer.removeCSSClass(re, 'selected');
568
document.getElementById(type + '_updateelement').value = tinyMCE.getLang('lang_update', 'Update', true);
573
function cancelElementUpdate() {
574
var le = document.getElementById('headlist');
577
lastElementType.style.display = 'none';
b'\\ No newline at end of file'