Previous Thread
Next Thread
Print Thread
Rate Thread
Sally #291843 03/27/2002 1:15 PM
Joined: Mar 2002
Posts: 1
Lurker
Lurker
Offline
Joined: Mar 2002
Posts: 1
You need to hack some more files than the template to implement the hack. Each file that prints a <textarea> needs to be modified. for expample:

<textarea cols="80" rows="15" class="formboxes"
wrap="soft" name="Body" [:red] onChange=getActiveText(this) onclick=getActiveText(this)
onFocus=getActiveText(this) ></textarea>


Here comes the script we are using.

<script language="javascript"><!--

function getActiveText(selectedtext) {
text = (document.all) ? document.selection.createRange().text : document.getSelection();

if (selectedtext.createTextRange) {
selectedtext.caretPos = document.selection.createRange().duplicate();
}

return true;
}

function returnTag(tag) {
if (document.forms(0).Body.createTextRange && document.forms(0).Body.caretPos) {
var caretPos = document.forms(0).Body.caretPos;
caretPos.text = tag;
} else {
document.forms(0).Body.value+=tag;
}
document.forms(0).Body.focus();
}

function doppeltag(tag1,tag2,alt) {
if (document.forms(0).Body.createTextRange && document.forms(0).Body.caretPos) {
var caretPos = document.forms(0).Body.caretPos;
caretPos.text = tag1 + ((caretPos.text.length>0) ? caretPos.text : alt) + tag2;
} else {
document.forms(0).Body.value+=tag1+alt+tag2;
}
document.forms(0).Body.focus();
}

//--></script>



returnTag is the simple function for smileys. There is just one string to add at cursor position.
doppelTag (rename it to doubleTag if you want []/forum/images/icons/wink.gif[/] ) checks if there is a selection.
If yes, then it encloses the selection by tag1 and tag2.
If not, it prints the string specified by 'alt' enclosed by tag1 and tag2 at the cursor position.

Some examples how to call the functions:


<A HREF="javascript:returnTag('[ grin]')">...</A>
<A HREF="javascript:doppeltag('[ url]','[ /url]','link')">...</A>
<A HREF="javascript:doppeltag('[ url=',']description[ /url]','link')">...</A>
<A HREF="javascript:returnTag('[ Image]url[ /Image]')">...</A>
<A HREF="javascript:doppeltag('[ b]','[ /b]','text')">...</A>


This only works with IE. Using an other browser it will only add the smiley at the end of the textarea. (or it will do nothing at all []/forum/images/icons/wink.gif[/] )

PS: NeooeN and me are from the same board

Sponsored Links
Entire Thread
Subject Posted By Posted
Beta2 running here Rick 03/27/2002 5:39 PM
Re: Beta2 running here Charles Capps 03/27/2002 6:31 PM
Re: Beta2 running here WrÅith 03/27/2002 6:58 PM
Re: Beta2 running here NeooeN 03/27/2002 7:16 PM
Re: Beta2 running here Rick 03/27/2002 7:29 PM
Re: Beta2 running here Rick 03/27/2002 7:31 PM
Re: Beta2 running here Sirius 03/27/2002 8:15 PM
Re: Beta2 running here JoshPet 03/28/2002 3:26 AM
Re: Beta2 running here navaho 03/28/2002 3:47 AM
Re: Beta2 running here omegatron 03/28/2002 3:21 PM
Re: Beta2 running here ivf 04/04/2002 3:09 AM
Re: Beta2 running here JoshPet 04/04/2002 3:25 AM
Re: Beta2 running here Rick 04/04/2002 4:18 PM
Re: Beta2 running here omegatron 04/04/2002 8:26 PM
Re: Beta2 running here Rick 04/05/2002 5:38 PM
Re: Beta2 running here JoshPet 04/05/2002 9:32 PM
Re: Beta2 running here omegatron 04/05/2002 9:58 PM
Re: Beta2 running here AllenAyres 04/19/2002 8:17 AM
Public Beta Ian_W 04/19/2002 5:37 PM
Re: Public Beta AllenAyres 04/19/2002 5:45 PM
Re: Public Beta omegatron 04/19/2002 10:25 PM
Re: Public Beta AllenAyres 04/19/2002 11:09 PM
Re: Public Beta omegatron 04/20/2002 1:23 AM
Re: Public Beta navaho 04/20/2002 4:26 AM
Re: Public Beta omegatron 04/21/2002 2:43 AM
Re: Public Beta JustDave 04/21/2002 2:49 AM
Re: Public Beta omegatron 04/21/2002 3:07 AM
Re: Public Beta JustDave 04/21/2002 3:28 AM
Re: Public Beta omegatron 04/21/2002 4:13 AM
Re: Beta2 running here caymuc 05/01/2002 8:50 PM
Re: Beta2 running here AllenAyres 05/01/2002 11:30 PM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,575
Posts293,931
Members13,823
Most Online6,139
Sep 21st, 2024
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
Gizmo 1
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2025 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.1
(Snapshot build 20240918)