1
|
1 |
var url = tinyMCE.getParam("external_image_list_url");
|
|
2 |
if (url != null) {
|
|
3 |
// Fix relative
|
|
4 |
if (url.charAt(0) != '/' && url.indexOf('://') == -1)
|
|
5 |
url = tinyMCE.documentBasePath + "/" + url;
|
|
6 |
|
|
7 |
document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
|
|
8 |
}
|
|
9 |
|
|
10 |
function insertImage() {
|
|
11 |
var src = document.forms[0].src.value;
|
|
12 |
var alt = document.forms[0].alt.value;
|
|
13 |
var border = document.forms[0].border.value;
|
|
14 |
var vspace = document.forms[0].vspace.value;
|
|
15 |
var hspace = document.forms[0].hspace.value;
|
|
16 |
var width = document.forms[0].width.value;
|
|
17 |
var height = document.forms[0].height.value;
|
|
18 |
var align = document.forms[0].align.options[document.forms[0].align.selectedIndex].value;
|
|
19 |
|
|
20 |
tinyMCEPopup.restoreSelection();
|
|
21 |
tinyMCE.themes['advanced']._insertImage(src, alt, border, hspace, vspace, width, height, align);
|
|
22 |
tinyMCEPopup.close();
|
|
23 |
}
|
|
24 |
|
|
25 |
function init() {
|
|
26 |
tinyMCEPopup.resizeToInnerSize();
|
|
27 |
|
|
28 |
document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
|
|
29 |
|
|
30 |
var formObj = document.forms[0];
|
|
31 |
|
|
32 |
for (var i=0; i<document.forms[0].align.options.length; i++) {
|
|
33 |
if (document.forms[0].align.options[i].value == tinyMCE.getWindowArg('align'))
|
|
34 |
document.forms[0].align.options.selectedIndex = i;
|
|
35 |
}
|
|
36 |
|
|
37 |
formObj.src.value = tinyMCE.getWindowArg('src');
|
|
38 |
formObj.alt.value = tinyMCE.getWindowArg('alt');
|
|
39 |
formObj.border.value = tinyMCE.getWindowArg('border');
|
|
40 |
formObj.vspace.value = tinyMCE.getWindowArg('vspace');
|
|
41 |
formObj.hspace.value = tinyMCE.getWindowArg('hspace');
|
|
42 |
formObj.width.value = tinyMCE.getWindowArg('width');
|
|
43 |
formObj.height.value = tinyMCE.getWindowArg('height');
|
|
44 |
formObj.insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true);
|
|
45 |
|
|
46 |
// Handle file browser
|
|
47 |
if (isVisible('srcbrowser'))
|
|
48 |
document.getElementById('src').style.width = '180px';
|
|
49 |
|
|
50 |
// Auto select image in list
|
|
51 |
if (typeof(tinyMCEImageList) != "undefined" && tinyMCEImageList.length > 0) {
|
|
52 |
for (var i=0; i<formObj.image_list.length; i++) {
|
|
53 |
if (formObj.image_list.options[i].value == tinyMCE.getWindowArg('src'))
|
|
54 |
formObj.image_list.options[i].selected = true;
|
|
55 |
}
|
|
56 |
}
|
|
57 |
}
|
|
58 |
|
|
59 |
var preloadImg = new Image();
|
|
60 |
|
|
61 |
function resetImageData() {
|
|
62 |
var formObj = document.forms[0];
|
|
63 |
formObj.width.value = formObj.height.value = "";
|
|
64 |
}
|
|
65 |
|
|
66 |
function updateImageData() {
|
|
67 |
var formObj = document.forms[0];
|
|
68 |
|
|
69 |
if (formObj.width.value == "")
|
|
70 |
formObj.width.value = preloadImg.width;
|
|
71 |
|
|
72 |
if (formObj.height.value == "")
|
|
73 |
formObj.height.value = preloadImg.height;
|
|
74 |
}
|
|
75 |
|
|
76 |
function getImageData() {
|
|
77 |
preloadImg = new Image();
|
|
78 |
tinyMCE.addEvent(preloadImg, "load", updateImageData);
|
|
79 |
tinyMCE.addEvent(preloadImg, "error", function () {var formObj = document.forms[0];formObj.width.value = formObj.height.value = "";});
|
|
80 |
preloadImg.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], document.forms[0].src.value);
|
|
81 |
}
|