|
Answer» Hello,
(sorry, nub here)
I'd like to implement a BB Code button into my AJAX Chat (php/js chatbox) whereby a video is played within the chat USING [VIDEO] TAGS, as one would similarly use [IMG] tags to display an image within the chat.
I've found where I need to add the JS code, and I have the HTML replacement code (which I use in my PHPBB forum) I just need to know what JS code I add to the chats JS file?
To give you a better idea, heres the chats JS [IMG] code:
Code: [Select] replaceBBCodeImage: function(url) { if(this.settings['bbCodeImages']) { if (!arguments.callee.regExpUrl) { arguments.callee.regExpUrl = new RegExp( this.regExpMediaUrl, '' ); } if(!url || !url.match(arguments.callee.regExpUrl)) return url; url = url.replace(/\s/gm, this.encodeText(' ')); var maxWidth = this.dom['chatList'].offsetWidth-50; var maxHeight = this.dom['chatList'].offsetHeight-50; return '<a href="' +url +'" onclick="window.open(this.href); return FALSE;">' +'<img class="bbCodeImage" style="max-width:' +maxWidth +'px; max-height:' +maxHeight +'px;" src="' +url +'" alt="" onload="ajaxChat.updateChatlistView();"/></a>'; } return url; }, Heres what I added, using the [IMG] as a sort of template:
Code: [Select] replaceBBCodeVideo: function(url) { if(this.settings['bbCodeVideo']) { if (!arguments.callee.regExpUrl) { arguments.callee.regExpUrl = new RegExp( this.regExpMediaUrl, '' ); } if(!url || !url.match(arguments.callee.regExpUrl)) return url; url = url.replace(/\s/gm, this.encodeText(' ')); var maxWidth = this.dom['chatList'].offsetWidth-50; var maxHeight = this.dom['chatList'].offsetHeight-50; return '<a href="' +url +'" onclick="window.open(this.href); return false;">' +'<img class="bbCodeVideo" style="max-width:' +maxWidth +'px; max-height:' +maxHeight +'px;" src="video.php?link={URL}">' +url +'" alt="" onload="ajaxChat.updateChatlistView();"/></a>'; } return url; }, And heres the HTML replacement that I'd like to implement somehow:
Code: [Select]<script type="text/javascript" src="video.php?link={URL}"></script> the BBcode buttons are all ready, the [VIDEO] tags are DISPLAYED in chat when I hit the button and everything, I just need to FIGURE out where/how to add the HTML replacement.
Thanks for any help
|