<script type="text/Javascript">
function commenthtml(string)
{
normaltitle = document.getElementById(string).innerHTML;
fattitle = "";
yy = normaltitle.length;
yy = yy+5
for( var xx = 0; xx < yy; xx++ )
{
nextone = normaltitle.slice(0,1)
normaltitle = normaltitle.slice(1)
if ( nextone=="[") {
if (normaltitle.indexOf("img]")=="0") {
if (normaltitle.indexOf("[/img]")!="-1") {
find=normaltitle.indexOf("[/img]");
doinsert = normaltitle.slice(0,find);
normaltitle = normaltitle.slice(find);
normaltitle = normaltitle.slice(6);
if (doinsert.indexOf("\"")=="-1") {
nextone="image";doinsert = doinsert.slice(4); doinsert = "<img src=\""+doinsert+"\">";
}}}
};
if (nextone=="image"){nextone=doinsert}
fattitle = fattitle.concat(nextone);
}
document.getElementById(string).innerHTML = fattitle;
}
</script>
Kemudian ganti dengan javascript berikut ini...function commenthtml(string)
{
normaltitle = document.getElementById(string).innerHTML;
fattitle = "";
yy = normaltitle.length;
yy = yy+5
for( var xx = 0; xx < yy; xx++ )
{
nextone = normaltitle.slice(0,1)
normaltitle = normaltitle.slice(1)
if ( nextone=="[") {
if (normaltitle.indexOf("img]")=="0") {
if (normaltitle.indexOf("[/img]")!="-1") {
find=normaltitle.indexOf("[/img]");
doinsert = normaltitle.slice(0,find);
normaltitle = normaltitle.slice(find);
normaltitle = normaltitle.slice(6);
if (doinsert.indexOf("\"")=="-1") {
nextone="image";doinsert = doinsert.slice(4); doinsert = "<img src=\""+doinsert+"\">";
}}}
};
if (nextone=="image"){nextone=doinsert}
fattitle = fattitle.concat(nextone);
}
document.getElementById(string).innerHTML = fattitle;
}
</script>
<script type='text/Javascript'>
//<![CDATA[
function commenthtml(string) {
normaltitle = document.getElementById(string).innerHTML;
fattitle = "";
yy = normaltitle.length;
yy = yy + 5
for (var xx = 0; xx < yy; xx++) {
nextone = normaltitle.slice(0, 1)
normaltitle = normaltitle.slice(1)
if (nextone == "[") {
if (normaltitle.indexOf("img]") == "0") {
if (normaltitle.indexOf("[/img]") != "-1") {
find = normaltitle.indexOf("[/img]");
doinsert = normaltitle.slice(0, find);
normaltitle = normaltitle.slice(find);
normaltitle = normaltitle.slice(6);
if (doinsert.indexOf("\"") == "-1") {
nextone = "image";
doinsert = doinsert.slice(4);
doinsert = "<img src=\"" + doinsert + "\">";
}
}
}
if (normaltitle.indexOf("video]") == "0") {
if (normaltitle.indexOf("[/video]") != "-1") {
find = normaltitle.indexOf("[/video]");
doinsert = normaltitle.slice(0, find);
normaltitle = normaltitle.slice(find);
normaltitle = normaltitle.slice(8);
if (doinsert.indexOf("\"") == "-1") {
nextone = "image";
doinsert = doinsert.slice(6);
doinsert = "<iframe width=\"468px\" height=\"350px\" src=\"" + doinsert + "\">your browser doesn\'t support iframes today.</iframe>";
}
}
}
};
if (nextone == "image") {
nextone = doinsert
}
fattitle = fattitle.concat(nextone);
}
document.getElementById(string).innerHTML = fattitle;
} //]]>
</script>
Gantilah tulisan berwarna width dan height pada script diatas sesuai dengan kolom komentar template sobat :) Setelah itu, jika mau menampilkan embed video pada komentar caranya sama dengan menampilkan gambar juga kok! Sobat tinggal melakukan tag link embed video menjadi seperti ini//<![CDATA[
function commenthtml(string) {
normaltitle = document.getElementById(string).innerHTML;
fattitle = "";
yy = normaltitle.length;
yy = yy + 5
for (var xx = 0; xx < yy; xx++) {
nextone = normaltitle.slice(0, 1)
normaltitle = normaltitle.slice(1)
if (nextone == "[") {
if (normaltitle.indexOf("img]") == "0") {
if (normaltitle.indexOf("[/img]") != "-1") {
find = normaltitle.indexOf("[/img]");
doinsert = normaltitle.slice(0, find);
normaltitle = normaltitle.slice(find);
normaltitle = normaltitle.slice(6);
if (doinsert.indexOf("\"") == "-1") {
nextone = "image";
doinsert = doinsert.slice(4);
doinsert = "<img src=\"" + doinsert + "\">";
}
}
}
if (normaltitle.indexOf("video]") == "0") {
if (normaltitle.indexOf("[/video]") != "-1") {
find = normaltitle.indexOf("[/video]");
doinsert = normaltitle.slice(0, find);
normaltitle = normaltitle.slice(find);
normaltitle = normaltitle.slice(8);
if (doinsert.indexOf("\"") == "-1") {
nextone = "image";
doinsert = doinsert.slice(6);
doinsert = "<iframe width=\"468px\" height=\"350px\" src=\"" + doinsert + "\">your browser doesn\'t support iframes today.</iframe>";
}
}
}
};
if (nextone == "image") {
nextone = doinsert
}
fattitle = fattitle.concat(nextone);
}
document.getElementById(string).innerHTML = fattitle;
} //]]>
</script>
[video]http://www.youtube.com/v/xf9cT2Y7RCw?fs=1&hl=en_US[/video]
How to get embed from YouTube website Screenshot for get a link embed from youtubeTinggal ambil saja tulisan berwarna merah itu. Lalu lakukan tag [video]...link embed...[/video]<object width="480" height="385">
<param name="movie" value="http://www.youtube.com/v/xf9cT2Y7RCw?fs=1&hl=en_US"></param>
<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/xf9cT2Y7RCw?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed>
</object>
Original posted: http://categories.blogspot.com/2006/05/google-video-in-blogspot-comments.html
Tidak ada komentar:
Posting Komentar