We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
[CODE] Allow bbcode in member titles; By Ultimater
Topic Started: Jan 23 2010, 01:03 AM (882 Views)
Reid
Member Avatar
È una trappola!

This topic has been moved from our official support board.

Originally posted by: Ultimater
[CODE
 
Allow bbcode in member titles]Code Name: Allow bbcode in member titles
Preview of it in Use:

Posted Image

http://z6.invisionfree.com/bbcode_member_t....php?showuser=1
Description:
Allows BBcode tags and smilies in Member Titles.
Supported BB Code tags:
Code:
 

[b]...[/b]
[i]...[/i]
[u]...[/u]
[s]...[/s]
[color=green]...[/color]
[color=#ff3f3d]...[/color]
[bgcolor=green]...[/bgcolor]
[bgcolor=#ff3f3d]...[/bgcolor]
[img=http://i1.ifrm.com/html/emoticons/biggrin.gif]
[url=http://i1.ifrm.com/html/emoticons/biggrin.gif]
[font=arial]...[/font]
[br]
[hr]

Supported emotions:
Code:
 

:mellow:
:huh:
^_^
:o
;)
:P
:D
:lol:
B)
:rolleyes:
-_-
<_<
:)
:wub:
:angry:
:sad:
:unsure:
:wacko:
:blink:
:ph43r:

Where it goes: Board Wrappers ==> Footer
(Best convert it to an external JavaScript file)
Code:
 

<script type="text/javascript"><!--//--><![CDATA[//><!--
/*
Programmer:
Ultimater at gmail.com on February 22nd 2007
http://webdeveloper.com/forum/member.php?u=30185
*/

function getEmotionHTML(e){
var u;
var basehref="http://209.85.48.9";
switch(e){
case ":mellow:":u="/html/emoticons/mellow.gif";break;
case ":huh:":u="/html/emoticons/huh.gif";break;
case "^_^":u="/html/emoticons/happy.gif";break;
case ":o":u="/html/emoticons/ohmy.gif";break;
case ";)":u="/html/emoticons/wink.gif";break;
case ":P":u="/html/emoticons/tongue.gif";break;
case ":D":u="/html/emoticons/biggrin.gif";break;
case ":lol:":u="/html/emoticons/laugh.gif";break;
case "B)":u="/html/emoticons/cool.gif";break;
case ":rolleyes:":u="/html/emoticons/rolleyes.gif";break;
case "-_-":u="/html/emoticons/sleep.gif";break;
case "<_<":u="/html/emoticons/dry.gif";break;
case ":)":u="/html/emoticons/smile.gif";break;
case ":wub:":u="/html/emoticons/wub.gif";break;
case ":angry:":u="/html/emoticons/angry.gif";break;
case ":sad:":u="/html/emoticons/sad.gif";break;
case ":unsure:":u="/html/emoticons/unsure.gif";break;
case ":wacko:":u="/html/emoticons/wacko.gif";break;
case ":blink:":u="/html/emoticons/blink.gif";break;
case ":ph43r:":u="/html/emoticons/ninja.gif";break;
}
if(!u)return e;
else return "<img src=\""+basehref+u+"\" alt=\""+u+"\">"
}

function allowBBCodeInMemberTitle(f){
if(!f)return;
var tmp=f.data;
var tm=tmp
.replace(/&/g,"&amp;")
.replace(/</g,"<")
.replace(/>/g,">")
.replace(/\[b\]/gi,"<b>")
.replace(/\[\/b\]/gi,"</b>")
.replace(/\[i\]/gi,"<i>")
.replace(/\[\/i\]/gi,"</i>")
.replace(/\[u\]/gi,"<u>")
.replace(/\[\/u\]/gi,"</u>")
.replace(/\[s\]/gi,"<s>")
.replace(/\[\/s\]/gi,"</s>")
.replace(/\[br\]/gi,"<br>")
.replace(/\[hr\]/gi,"<hr>")
.replace(/\[\/u\]/gi,"</u>")
.replace(/\[color\=(\#?\w+)\]/gi,function(a,b){return "<span style=\"color: "+b+"\">"})
.replace(/\[\/color\]/gi,"</span>")
.replace(/\[bgcolor\=(\#?\w+)\]/gi,function(a,b){return "<span style=\"background-color: "+b+"\">"})
.replace(/\[\/bgcolor\]/gi,"</span>")
.replace(/\[img\=([\w\/\:\&\=\x3F\.]+)\]/gi,function(a,b){if(!(/^https?\:/i.test(b)))return "<span>HTTP and HTTPS images allowed only!</span>";return "<img src=\""+b+"\">"})
.replace(/\[url\=([\w\/\:\&\=\x3F\.]+)\]/gi,function(a,b){if(!(/^https?\:/i.test(b)))return "<span>HTTP and HTTPS links allowed only!</span>";return "<a target=\"new\" href=\""+b+"\"> [ link ] </a>"})
.replace(/\[font\=([\s\w\-\,]+)\]/gi,function(a,b){return "<span style=\"font-family: "+b+"\">"})
.replace(/\[\/font\]/gi,"</span>")
.replace(/:mellow:|:huh:|\^_\^|:o|;\)|:P|:D|:lol:|B\)|:rolleyes:|\-_\-|\<_\<|:\)|:wub:|:angry:|:sad:|:unsure:|:wacko:|:blink:|:ph43r:/g,getEmotionHTML)
;f.parentNode.innerHTML=tm;
}






function profileBBCodeInMemberTitle(){
var e=document.getElementById("profilename");if(!e)return;var f;
var els=document.getElementsByTagName("td"),l=els.length;
for(var i=0;i<l;i++){
if(!els[i].firstChild||!els[i].firstChild.firstChild||!els[i].firstChild.firstChild.data)continue;
if(els[i].firstChild.firstChild.data!="Member Title")continue;
var f=els[i].parentNode.cells[1].firstChild;break;
}
if(f)allowBBCodeInMemberTitle(f)
}






function threadBBCodeInMemberTitles(){
var anchors=document.getElementsByTagName("a"),l=anchors.length;
for(var i=0;i<l;i++){
if(!(/^entry\d+$/.test(anchors[i].getAttribute("name"))))continue;
if(!anchors[i].nextSibling)continue;
var t=anchors[i].nextSibling.tagName?anchors[i].nextSibling:anchors[i].nextSibling.nextSibling;
if(!t)continue;
if(new String(t.tagName).toLowerCase()!="table")continue;
if(t.rows.length<2)continue;
if(!t.rows[1].cells.length)continue;
var td=t.rows[1].cells[0];
var span=td.getElementsByTagName("span");
if(span.length==0)continue;
span=span[0];
var BRs=span.getElementsByTagName("br");
if(BRs.length<2)continue;
var d=BRs[1].nextSibling;
if(!d||!d.data)continue;
var sp=document.createElement("span");
d.parentNode.insertBefore(sp,d);
sp.appendChild(d)
allowBBCodeInMemberTitle(sp.firstChild)
}
}







if(/^[^\x23]*[\x3F\x26]showuser=\d+/.test(location.search))
profileBBCodeInMemberTitle()
else if(/^[^\x23]*[\x3F\x26]showtopic=\d+/.test(location.search))
threadBBCodeInMemberTitles()
//--><!]]></script>

Copyright:
Code:
 

Programmer:
Ultimater at gmail.com on February 22nd 2007
http://webdeveloper.com/forum/member.php?u=30185
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Codes & Modifications · Next Topic »
Add Reply