Sha256: 81ae0b33d0697a7169637ef71415f01085d051e56b00893df4308560a01bee2c

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 KB

Contents

tinyMCEPopup.requireLangPack();

var AddvideoDialog = {
	init : function() {
		var f = document.forms[0];

		// Get the selected contents as text and place it in the input
		f.videourl.value = tinyMCEPopup.editor.selection.getContent({format : 'text'});
		f.videtitle.value = tinyMCEPopup.editor.selection.getContent({format : 'text'});
	},

  insert : function() {
    // Insert the contents from the input into the document
    
    // VIDEO URL
    var url = document.forms[0].videourl.value;
    
    // VIDEO Title
    var title = document.forms[0].videotitle.value;
    
    // REGEXP
    var re=new RegExp(/http:\/\/([^\s\.]+).(youtube.com\/watch\?v=)([A-Za-z0-9\-]+)([^\s]*)/);
    
    // VIDEO ID
    var videoid = re.exec(url);

    // Add Link and img to the body

    tinyMCEPopup.editor.execCommand('mceInsertContent', false, "<a href='" + url + "' title='" + title + "' class='fancy-youtube'><img src='http://img.youtube.com/vi/" +  videoid[3] + videoid[4] + "/1.jpg' alt='" + title + "' /></a>");
    tinyMCEPopup.close();
  }
};

tinyMCEPopup.onInit.add(AddvideoDialog.init, AddvideoDialog);

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
noodall-ui-0.3.20 public/javascripts/tiny_mce/plugins/addvideo/js/dialog.js
noodall-ui-0.3.19 public/javascripts/tiny_mce/plugins/addvideo/js/dialog.js
noodall-ui-0.3.17 public/javascripts/tiny_mce/plugins/addvideo/js/dialog.js
noodall-ui-0.3.16 public/javascripts/tiny_mce/plugins/addvideo/js/dialog.js
noodall-ui-0.3.15 public/javascripts/tiny_mce/plugins/addvideo/js/dialog.js
noodall-ui-0.3.14 public/javascripts/tiny_mce/plugins/addvideo/js/dialog.js
noodall-ui-0.3.13 public/javascripts/tiny_mce/plugins/addvideo/js/dialog.js
noodall-ui-0.3.12 public/javascripts/tiny_mce/plugins/addvideo/js/dialog.js
noodall-ui-0.3.11 public/javascripts/tiny_mce/plugins/addvideo/js/dialog.js
noodall-ui-0.3.8 public/javascripts/tiny_mce/plugins/addvideo/js/dialog.js
noodall-ui-0.3.7 public/javascripts/tiny_mce/plugins/addvideo/js/dialog.js