includes/clientside/tinymce/plugins/media/js/media.js
changeset 543 dffcbfbc4e59
parent 476 f26a69c40431
child 778 57ce13805b6f
equal deleted inserted replaced
542:5841df0ab575 543:dffcbfbc4e59
   178 }
   178 }
   179 
   179 
   180 function insertMedia() {
   180 function insertMedia() {
   181 	var fe, f = document.forms[0], h;
   181 	var fe, f = document.forms[0], h;
   182 
   182 
       
   183 	tinyMCEPopup.restoreSelection();
       
   184 
   183 	if (!AutoValidator.validate(f)) {
   185 	if (!AutoValidator.validate(f)) {
   184 		alert(ed.getLang('invalid_data'));
   186 		alert(ed.getLang('invalid_data'));
   185 		return false;
   187 		return false;
   186 	}
   188 	}
   187 
   189 
   301 	var fo, i, c, el, x, f = document.forms[0];
   303 	var fo, i, c, el, x, f = document.forms[0];
   302 
   304 
   303 	fo = ed.getParam("media_types", "flash=swf;flv=flv;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';');
   305 	fo = ed.getParam("media_types", "flash=swf;flv=flv;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';');
   304 
   306 
   305 	// YouTube
   307 	// YouTube
   306 	if (v.match(/v=(.+)(.*)/)) {
   308 	if (v.match(/watch\?v=(.+)(.*)/)) {
   307 		f.width.value = '425';
   309 		f.width.value = '425';
   308 		f.height.value = '350';
   310 		f.height.value = '350';
   309 		f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1];
   311 		f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1];
   310 		return 'flash';
   312 		return 'flash';
   311 	}
   313 	}
   594 	pl.height = !pl.height ? 100 : pl.height;
   596 	pl.height = !pl.height ? 100 : pl.height;
   595 	pl.id = !pl.id ? 'obj' : pl.id;
   597 	pl.id = !pl.id ? 'obj' : pl.id;
   596 	pl.name = !pl.name ? 'eobj' : pl.name;
   598 	pl.name = !pl.name ? 'eobj' : pl.name;
   597 	pl.align = !pl.align ? '' : pl.align;
   599 	pl.align = !pl.align ? '' : pl.align;
   598 
   600 
   599 	h += '<object classid="clsid:' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">';
   601 	// Avoid annoying warning about insecure items
   600 
   602 	if (!tinymce.isIE || document.location.protocol != 'https:') {
   601 	for (n in pl) {
   603 		h += '<object classid="clsid:' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">';
   602 		h += '<param name="' + n + '" value="' + pl[n] + '">';
   604 
   603 
   605 		for (n in pl) {
   604 		// Add extra url parameter if it's an absolute URL
   606 			h += '<param name="' + n + '" value="' + pl[n] + '">';
   605 		if (n == 'src' && pl[n].indexOf('://') != -1)
   607 
   606 			h += '<param name="url" value="' + pl[n] + '" />';
   608 			// Add extra url parameter if it's an absolute URL
       
   609 			if (n == 'src' && pl[n].indexOf('://') != -1)
       
   610 				h += '<param name="url" value="' + pl[n] + '" />';
       
   611 		}
   607 	}
   612 	}
   608 
   613 
   609 	h += '<embed type="' + type + '" ';
   614 	h += '<embed type="' + type + '" ';
   610 
   615 
   611 	for (n in pl)
   616 	for (n in pl)
   612 		h += n + '="' + pl[n] + '" ';
   617 		h += n + '="' + pl[n] + '" ';
   613 
   618 
   614 	h += '></embed></object>';
   619 	h += '></embed>';
       
   620 
       
   621 	// Avoid annoying warning about insecure items
       
   622 	if (!tinymce.isIE || document.location.protocol != 'https:')
       
   623 		h += '</object>';
   615 
   624 
   616 	p.innerHTML = "<!-- x --->" + h;
   625 	p.innerHTML = "<!-- x --->" + h;
   617 }
   626 }
   618 
   627 
   619 tinyMCEPopup.onInit.add(init);
   628 tinyMCEPopup.onInit.add(init);