applied my changes - initial import
[boxroom-stian.git] / public / javascripts / tiny_mce / plugins / flash / jscripts / flash.js
blob4f08077268b09dc31e3c73fecba3223d8645e78b
1 var url = tinyMCE.getParam("flash_external_list_url");
2 if (url != null) {
3 // Fix relative
4 if (url.charAt(0) != '/' && url.indexOf('://') == -1)
5 url = tinyMCE.documentBasePath + "/" + url;
7 document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
10 function init() {
11 tinyMCEPopup.resizeToInnerSize();
13 document.getElementById("filebrowsercontainer").innerHTML = getBrowserHTML('filebrowser','file','flash','flash');
15 // Image list outsrc
16 var html = getFlashListHTML('filebrowser','file','flash','flash');
17 if (html == "")
18 document.getElementById("linklistrow").style.display = 'none';
19 else
20 document.getElementById("linklistcontainer").innerHTML = html;
22 var formObj = document.forms[0];
23 var swffile = tinyMCE.getWindowArg('swffile');
24 var swfwidth = '' + tinyMCE.getWindowArg('swfwidth');
25 var swfheight = '' + tinyMCE.getWindowArg('swfheight');
27 if (swfwidth.indexOf('%')!=-1) {
28 formObj.width2.value = "%";
29 formObj.width.value = swfwidth.substring(0,swfwidth.length-1);
30 } else {
31 formObj.width2.value = "px";
32 formObj.width.value = swfwidth;
35 if (swfheight.indexOf('%')!=-1) {
36 formObj.height2.value = "%";
37 formObj.height.value = swfheight.substring(0,swfheight.length-1);
38 } else {
39 formObj.height2.value = "px";
40 formObj.height.value = swfheight;
43 formObj.file.value = swffile;
44 formObj.insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true);
46 selectByValue(formObj, 'linklist', swffile);
48 // Handle file browser
49 if (isVisible('filebrowser'))
50 document.getElementById('file').style.width = '230px';
52 // Auto select flash in list
53 if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
54 for (var i=0; i<formObj.linklist.length; i++) {
55 if (formObj.linklist.options[i].value == tinyMCE.getWindowArg('swffile'))
56 formObj.linklist.options[i].selected = true;
61 function getFlashListHTML() {
62 if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
63 var html = "";
65 html += '<select id="linklist" name="linklist" style="width: 250px" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.file.value=this.options[this.selectedIndex].value;">';
66 html += '<option value="">---</option>';
68 for (var i=0; i<tinyMCEFlashList.length; i++)
69 html += '<option value="' + tinyMCEFlashList[i][1] + '">' + tinyMCEFlashList[i][0] + '</option>';
71 html += '</select>';
73 return html;
76 return "";
79 function insertFlash() {
80 var formObj = document.forms[0];
81 var html = '';
82 var file = formObj.file.value;
83 var width = formObj.width.value;
84 var height = formObj.height.value;
85 if (formObj.width2.value=='%') {
86 width = width + '%';
88 if (formObj.height2.value=='%') {
89 height = height + '%';
92 if (width == "")
93 width = 100;
95 if (height == "")
96 height = 100;
98 html += ''
99 + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" mce_src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
100 + 'width="' + width + '" height="' + height + '" '
101 + 'border="0" alt="' + file + '" title="' + file + '" class="mceItemFlash" />';
103 tinyMCEPopup.execCommand("mceInsertContent", true, html);
104 tinyMCE.selectedInstance.repaint();
106 tinyMCEPopup.close();