This project has moved and is read-only. For the latest updates, please go here.

embed youtube button

Jan 23, 2015 at 6:58 PM
Hi there,
if anyone was interested, here is a custom toolbar button for youtube:
                        // YOUTUBE EMBED BUTTON
                        css: "youtube", //style it with "div.jHtmlArea .ToolBar ul li{...}" in style/jHtmlArea.css
                        text: "add YouTube video",
                        action: function( event ){
                        x = prompt("YouTube URL address:", "");
                        //strip vid id
                        var regExp = /^.*(\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;
                        var match = x.match(regExp);
                        if (match && match[2].length == 11) {
                        this.pasteHTML('<iframe width="420" height="315" src="//'+match[2]+'" frameborder="0" allowfullscreen></iframe>');
                        } else {