share youtube videos

This commit is contained in:
Mike Macgirvin 2010-08-19 20:52:49 -07:00
parent 0ea5e7fc95
commit f9f284ba70
4 changed files with 78 additions and 60 deletions

View File

@ -1,8 +1,8 @@
<?php <?php
// BBcode 2 HTML was written by WAY2WEB.net // BBcode 2 HTML was written by WAY2WEB.net
// Made to work with Mistpark - Mike Macgirvin
function bbcode($Text) function bbcode($Text) {
{
// Replace any html brackets with HTML Entities to prevent executing HTML or script // Replace any html brackets with HTML Entities to prevent executing HTML or script
// Don't use strip_tags here because it breaks [url] search by replacing & with amp // Don't use strip_tags here because it breaks [url] search by replacing & with amp
$Text = str_replace("<", "&lt;", $Text); $Text = str_replace("<", "&lt;", $Text);
@ -74,5 +74,9 @@
// [img=widthxheight]image source[/img] // [img=widthxheight]image source[/img]
$Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.+?)\[\/img\]/", '<img src="$3" height="$2" width="$1">', $Text); $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.+?)\[\/img\]/", '<img src="$3" height="$2" width="$1">', $Text);
// Youtube extensions
$Text = preg_replace("/\[youtube\]http:\/\/www.youtube.com\/watch\?v\=(.+?)\[\/youtube\]/",'[youtube]$1[/youtube]',$Text);
$Text = preg_replace("/\[youtube\](.+?)\[\/youtube\]/", '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>', $Text);
return $Text; return $Text;
} }

View File

@ -73,6 +73,13 @@ tinyMCE.init({
} }
} }
function jotGetVideo() {
reply = prompt("Please enter a YouTube link:");
if(reply && reply.length) {
tinyMCE.execCommand('mceInsertRawHTML',false,'[youtube]' + reply + '[/youtube]');
}
}
function linkdropper(event) { function linkdropper(event) {
var linkFound = event.dataTransfer.types.contains("text/uri-list"); var linkFound = event.dataTransfer.types.contains("text/uri-list");
if(linkFound) if(linkFound)

View File

@ -21,6 +21,9 @@
<div id="profile-link-wrapper" style="display: $visitor;" ondragenter="linkdropper(event);" ondragover="linkdropper(event);" ondrop="linkdrop(event);" > <div id="profile-link-wrapper" style="display: $visitor;" ondragenter="linkdropper(event);" ondragover="linkdropper(event);" ondrop="linkdrop(event);" >
<img id="profile-link" src="images/link-icon.gif" alt="Insert web link" title="Insert web link" ondragenter="return linkdropper(event);" ondragover="return linkdropper(event);" ondrop="linkdrop(event);" onclick="jotGetLink();" /> <img id="profile-link" src="images/link-icon.gif" alt="Insert web link" title="Insert web link" ondragenter="return linkdropper(event);" ondragover="return linkdropper(event);" ondrop="linkdrop(event);" onclick="jotGetLink();" />
</div> </div>
<div id="profile-youtube-wrapper" style="display: $visitor;" >
<img id="profile-video" src="images/youtube_icon.gif" alt="Insert YouTube video" title="Insert YouTube video" onclick="jotGetVideo();" />
</div>
<div id="profile-rotator-wrapper" style="display: $visitor;" > <div id="profile-rotator-wrapper" style="display: $visitor;" >
<img id="profile-rotator" src="images/rotator.gif" alt="Please wait" title="Please wait" style="display: none;" /> <img id="profile-rotator" src="images/rotator.gif" alt="Please wait" title="Please wait" style="display: none;" />
</div> </div>

View File

@ -716,6 +716,10 @@ input#dfrn-url {
float: left; float: left;
margin-left: 20px; margin-left: 20px;
} }
#profile-youtube-wrapper {
float: left;
margin-left: 20px;
}
#profile-jot-perms { #profile-jot-perms {
float: left; float: left;