New button on sceditor (facebook Videos)
Page 1 of 1
New button on sceditor (facebook Videos)
Forum version : Phpbb2
Position : Administrator
Concerned browser(s) : Google Chrome
Who the problem concerns : all
Forum link : http://gamemunity.team-talk.net/
So i want similar to youtube button but i want to add html code because youtube videos so i made this code but its kinda wrong ( im learning javascript im not that good xD) so here's the code i have:
I need some help to finish
Position : Administrator
Concerned browser(s) : Google Chrome
Who the problem concerns : all
Forum link : http://gamemunity.team-talk.net/
So i want similar to youtube button but i want to add html code because youtube videos so i made this code but its kinda wrong ( im learning javascript im not that good xD) so here's the code i have:
- Code:
$(function() {
if ($.sceditor) {
$.sceditor.command.set("vid-facebook", {
// drop down
_dropDown: function(editor, caller, handleIdFunc) {
var matches, content = $('<div><div><label for="youtubeurl">' + editor._("URL:") + '</label> <input type="text" id="youtubeurl" class="url" placeholder="http://" value="" /></div><div><input type="button" value="' + editor._("Insert") + '" class="button"></div>');
content.find('.button').click(function(e) {
var val = content.find("#youtubeurl").val().replace("http://", "");
if (val !== "") {
matches = val.match(/(?:v=|v\/|embed\/|youtu.be\/)(.{11})/);
if (matches) {
val = matches[1]
}
if (/^[a-zA-Z0-9_\-]{11}$/.test(val)) {
handleIdFunc(val)
} else {
alert(editor._('Invalid YouTube video'))
}
}
editor.closeDropDown(true);
e.preventDefault()
});
editor.createDropDown(caller, "insertlink", content)
},
// wysiwyg mode
exec: function(caller) {
var editor = this;
$.sceditor.command.get('vid-facebook')._dropDown(editor, caller, function(id) {
editor.wysiwygEditorInsertHtml('<iframe width="560" height="315" src="http://www.youtube.com/embed/' + id + '?wmode=opaque" data-youtube-id="' + id + '" frameborder="0" allowfullscreen></iframe>')
})
},
// source mode
txtExec : function(caller) {
var editor = this;
$.sceditor.command.get('vid-facebook')._dropDown(editor, caller, function(id) {
editor.insert('[youtube]' + id + '[/youtube]')
})
},
tooltip: "Insert a YouTube video"
});
// add button to editor toolbar
toolbar += ',vid-facebook';
}
});
I need some help to finish
Similar topics
» facebook button to connect to facebook page
» New button on sceditor
» How to post videos I find on facebook to my forum
» button of time on sceditor
» facebook connect doesn't work + facebook share button
» New button on sceditor
» How to post videos I find on facebook to my forum
» button of time on sceditor
» facebook connect doesn't work + facebook share button
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum