includes/clientside/tinymce/plugins/media/editor_plugin_src.js
changeset 459 31c23016ab62
parent 395 fa4c5ecb7c9a
child 543 dffcbfbc4e59
--- a/includes/clientside/tinymce/plugins/media/editor_plugin_src.js	Fri Feb 22 12:51:53 2008 -0500
+++ b/includes/clientside/tinymce/plugins/media/editor_plugin_src.js	Sun Feb 24 12:50:52 2008 -0500
@@ -1,5 +1,5 @@
 /**
- * $Id: editor_plugin_src.js 561 2008-01-23 15:18:19Z spocke $
+ * $Id: editor_plugin_src.js 615 2008-02-20 23:18:01Z spocke $
  *
  * @author Moxiecode
  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
@@ -76,7 +76,7 @@
 				var h = o.content;
 
 				h = h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) {
-					var o = eval("({" + c + "})");
+					var o = t._parse(c);
 
 					return '<img class="mceItem' + b + '" title="' + ed.dom.encode(c) + '" src="' + url + '/img/trans.gif" width="' + o.width + '" height="' + o.height + '" />'
 				});
@@ -84,7 +84,7 @@
 				h = h.replace(/<object([^>]*)>/gi, '<span class="mceItemObject" $1>');
 				h = h.replace(/<embed([^>]*)>/gi, '<span class="mceItemEmbed" $1>');
 				h = h.replace(/<\/(object|embed)([^>]*)>/gi, '</span>');
-				h = h.replace(/<param([^>]*)>/gi, function(a, b) {return '<span ' + b.replace(/value=/g, '_value=') + ' class="mceItemParam"></span>'});
+				h = h.replace(/<param([^>]*)>/gi, function(a, b) {return '<span ' + b.replace(/value=/gi, '_value=') + ' class="mceItemParam"></span>'});
 				h = h.replace(/\/ class=\"mceItemParam\"><\/span>/gi, 'class="mceItemParam"></span>');
 
 				o.content = h;
@@ -223,7 +223,7 @@
 				p.src = ed.convertURL(p.src, 'src', n);
 
 			each (p, function(v, k) {
-				if (v && !/^(width|height|codebase|classid)$/.test(k))
+				if (!/^(width|height|codebase|classid)$/.test(k))
 					dom.add(ob, 'span', {mce_name : 'param', name : k, '_value' : v});
 			});
 
@@ -266,7 +266,37 @@
 						default:
 							dom.replace(t._createImg('mceItemFlash', n), n);
 					}
+					
+					return;
 				}
+
+				// Convert embed into image
+				if (dom.getAttrib(n, 'class') == 'mceItemEmbed') {
+					switch (dom.getAttrib(n, 'type')) {
+						case 'application/x-shockwave-flash':
+							dom.replace(t._createImg('mceItemFlash', n), n);
+							break;
+
+						case 'application/x-director':
+							dom.replace(t._createImg('mceItemShockWave', n), n);
+							break;
+
+						case 'application/x-mplayer2':
+							dom.replace(t._createImg('mceItemWindowsMedia', n), n);
+							break;
+
+						case 'video/quicktime':
+							dom.replace(t._createImg('mceItemQuickTime', n), n);
+							break;
+
+						case 'audio/x-pn-realaudio-plugin':
+							dom.replace(t._createImg('mceItemRealMedia', n), n);
+							break;
+
+						default:
+							dom.replace(t._createImg('mceItemFlash', n), n);
+					}
+				}			
 			});
 		},
 
@@ -282,11 +312,11 @@
 			});
 
 			// Setup base parameters
-			each(['id', 'name', 'width', 'height', 'bgcolor', 'align'], function(n) {
-				var v = dom.getAttrib(n, 'align');
+			each(['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode'], function(na) {
+				var v = dom.getAttrib(n, na);
 
 				if (v)
-					pa[v] = v;
+					pa[na] = v;
 			});
 
 			// Add optional parameters