Post by Peter on Oct 29, 2004 10:35:07 GMT
Code created by fla5hba5h[/color]
And, yeah I know this is a planned feature for PBv4.
You know how when you highlight things, then press the bold button, it deletes whatever was selected and replaces it with "[b]TEXT[/b]". This code makes it keep the selected text, and wrap [b][/b] around it.
Board footers
oh, and to the best of my knowledge, this code works in Gecko browsers. ;D ;D
Thanks for helping me name it, Uchiha Sasuke!
And, yeah I know this is a planned feature for PBv4.
You know how when you highlight things, then press the bold button, it deletes whatever was selected and replaces it with "[b]TEXT[/b]". This code makes it keep the selected text, and wrap [b][/b] around it.
<script>
/*
* UBBC Tag Wrap
* Board Footers
* by Fla5hba5H
* http://www.fla5hba5h.tk
* Please don't post this code without my permission.
*/
function add(text){
if(text.match(/\[/i)&&(document.selection.createRange().text||window.getSelection())){
var begin=text.split(/\]/i)[0]+"]"
var end=begin.replace(/\[/i,"[/")
var selection=(document.selection)?document.selection.createRange().text:window.getSelection()
postmsg=document.postmodify.message
if(begin=="[url]"){postmsg.value=postmsg.value.replace(selection,"\[url="+selection+"\]LINK TEXT[/url]")}
else{postmsg.value=postmsg.value.replace(selection,begin+selection+end)}
}
else{ // this part is the Proboards code, not mine
if (document.postmodify.message.createTextRange && document.postmodify.message.caretPos) {
var caretPos = document.postmodify.message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
text + ' ' : text;
}
else {
document.postmodify.message.value += text;
}
document.postmodify.message.focus(caretPos)
}
}
</script>
Board footers
oh, and to the best of my knowledge, this code works in Gecko browsers. ;D ;D
Thanks for helping me name it, Uchiha Sasuke!