|
1 var url = tinyMCE.getParam("external_link_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 init() { |
|
11 tinyMCEPopup.resizeToInnerSize(); |
|
12 |
|
13 document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','theme_advanced_link'); |
|
14 |
|
15 // Handle file browser |
|
16 if (isVisible('hrefbrowser')) |
|
17 document.getElementById('href').style.width = '180px'; |
|
18 |
|
19 var formObj = document.forms[0]; |
|
20 |
|
21 for (var i=0; i<document.forms[0].target.options.length; i++) { |
|
22 var option = document.forms[0].target.options[i]; |
|
23 |
|
24 if (option.value == tinyMCE.getWindowArg('target')) |
|
25 option.selected = true; |
|
26 } |
|
27 |
|
28 document.forms[0].href.value = tinyMCE.getWindowArg('href'); |
|
29 document.forms[0].linktitle.value = tinyMCE.getWindowArg('title'); |
|
30 document.forms[0].insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true); |
|
31 |
|
32 addClassesToList('styleSelect', 'theme_advanced_link_styles'); |
|
33 selectByValue(formObj, 'styleSelect', tinyMCE.getWindowArg('className'), true); |
|
34 |
|
35 // Hide css select row if no CSS classes |
|
36 if (formObj.styleSelect && formObj.styleSelect.options.length <= 1) { |
|
37 var sr = document.getElementById('styleSelectRow'); |
|
38 sr.style.display = 'none'; |
|
39 sr.parentNode.removeChild(sr); |
|
40 } |
|
41 |
|
42 // Auto select link in list |
|
43 if (typeof(tinyMCELinkList) != "undefined" && tinyMCELinkList.length > 0) { |
|
44 var formObj = document.forms[0]; |
|
45 |
|
46 for (var i=0; i<formObj.link_list.length; i++) { |
|
47 if (formObj.link_list.options[i].value == tinyMCE.getWindowArg('href')) |
|
48 formObj.link_list.options[i].selected = true; |
|
49 } |
|
50 } |
|
51 } |
|
52 |
|
53 function insertLink() { |
|
54 var href = document.forms[0].href.value; |
|
55 var target = document.forms[0].target.options[document.forms[0].target.selectedIndex].value; |
|
56 var title = document.forms[0].linktitle.value; |
|
57 var style_class = document.forms[0].styleSelect ? document.forms[0].styleSelect.value : ""; |
|
58 var dummy; |
|
59 |
|
60 if (target == '_self') |
|
61 target = ''; |
|
62 |
|
63 tinyMCEPopup.restoreSelection(); |
|
64 tinyMCE.themes['advanced']._insertLink(href, target, title, dummy, style_class); |
|
65 tinyMCEPopup.close(); |
|
66 } |