A tumblelog CMS built on AJAX, PHP and MySQL.

flash.js 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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;
  6. document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
  7. }
  8. function init() {
  9. tinyMCEPopup.resizeToInnerSize();
  10. document.getElementById("filebrowsercontainer").innerHTML = getBrowserHTML('filebrowser','file','flash','flash');
  11. // Image list outsrc
  12. var html = getFlashListHTML('filebrowser','file','flash','flash');
  13. if (html == "")
  14. document.getElementById("linklistrow").style.display = 'none';
  15. else
  16. document.getElementById("linklistcontainer").innerHTML = html;
  17. var formObj = document.forms[0];
  18. var swffile = tinyMCE.getWindowArg('swffile');
  19. var swfwidth = '' + tinyMCE.getWindowArg('swfwidth');
  20. var swfheight = '' + tinyMCE.getWindowArg('swfheight');
  21. if (swfwidth.indexOf('%')!=-1) {
  22. formObj.width2.value = "%";
  23. formObj.width.value = swfwidth.substring(0,swfwidth.length-1);
  24. } else {
  25. formObj.width2.value = "px";
  26. formObj.width.value = swfwidth;
  27. }
  28. if (swfheight.indexOf('%')!=-1) {
  29. formObj.height2.value = "%";
  30. formObj.height.value = swfheight.substring(0,swfheight.length-1);
  31. } else {
  32. formObj.height2.value = "px";
  33. formObj.height.value = swfheight;
  34. }
  35. formObj.file.value = swffile;
  36. formObj.insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true);
  37. selectByValue(formObj, 'linklist', swffile);
  38. // Handle file browser
  39. if (isVisible('filebrowser'))
  40. document.getElementById('file').style.width = '230px';
  41. // Auto select flash in list
  42. if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
  43. for (var i=0; i<formObj.linklist.length; i++) {
  44. if (formObj.linklist.options[i].value == tinyMCE.getWindowArg('swffile'))
  45. formObj.linklist.options[i].selected = true;
  46. }
  47. }
  48. }
  49. function getFlashListHTML() {
  50. if (typeof(tinyMCEFlashList) != "undefined" && tinyMCEFlashList.length > 0) {
  51. var html = "";
  52. 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;">';
  53. html += '<option value="">---</option>';
  54. for (var i=0; i<tinyMCEFlashList.length; i++)
  55. html += '<option value="' + tinyMCEFlashList[i][1] + '">' + tinyMCEFlashList[i][0] + '</option>';
  56. html += '</select>';
  57. return html;
  58. }
  59. return "";
  60. }
  61. function insertFlash() {
  62. var formObj = document.forms[0];
  63. var html = '';
  64. var file = formObj.file.value;
  65. var width = formObj.width.value;
  66. var height = formObj.height.value;
  67. if (formObj.width2.value=='%') {
  68. width = width + '%';
  69. }
  70. if (formObj.height2.value=='%') {
  71. height = height + '%';
  72. }
  73. if (width == "")
  74. width = 100;
  75. if (height == "")
  76. height = 100;
  77. html += ''
  78. + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" mce_src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
  79. + 'width="' + width + '" height="' + height + '" '
  80. + 'border="0" alt="' + file + '" title="' + file + '" class="mceItemFlash" />';
  81. tinyMCEPopup.execCommand("mceInsertContent", true, html);
  82. tinyMCE.selectedInstance.repaint();
  83. tinyMCEPopup.close();
  84. }