Files
moodle/lib/editor/tinymce/jscripts/patch-tinymce_plugin_media.txt
T
dongsheng 942995292e HTML_EDITOR, REPOSITORY/MDL-16650
media type should be returned.
2008-11-25 12:20:13 +00:00

53 lines
1.5 KiB
Plaintext

Index: tiny_mce/plugins/media/js/media.js
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/editor/tinymce/jscripts/tiny_mce/plugins/media/js/media.js,v
retrieving revision 1.3
diff -u -r1.3 media.js
--- tiny_mce/plugins/media/js/media.js 23 Sep 2008 04:10:42 -0000 1.3
+++ tiny_mce/plugins/media/js/media.js 25 Nov 2008 10:39:39 -0000
@@ -263,6 +263,11 @@
h += ' />';
+ var is_youtube = repo_hook(f.src.value);
+ if (is_youtube) {
+ h = '<a href="'+f.src.value+'">youtube video</a>';
+ }
+
ed.execCommand('mceInsertContent', false, h);
}
@@ -305,12 +310,14 @@
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(';');
// YouTube
- if (v.match(/watch\?v=(.+)(.*)/)) {
+ if (v.match(/watch\?v=(.+)(.*)/)) {
f.width.value = '425';
f.height.value = '350';
- }
+ } else if (v.match(/v\/(.+)(.*)/)) {
+ f.width.value = '425';
+ f.height.value = '350';
+ return 'flash';
+ }
// Google video
if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) {
@@ -625,4 +632,15 @@
p.innerHTML = "<!-- x --->" + h;
}
+function repo_hook(url){
+ var f = document.forms[0];
+ if (url.match(/v\/(.+)(.*)/)) {
+ f.width.value = '425';
+ f.height.value = '350';
+ return true;
+ } else {
+ return false;
+ }
+}
+
tinyMCEPopup.onInit.add(init);