View Full Version : HIGHTLIGHT and COPY
Kihon Kata
11-05-2004, 02:32 AM
I am interested in being able to allow my users of our baords to press one button to HIGHTLIGHT and COPY the text in the WYSIWYG Editor when starting new threads or replying.
Take a look at this javascript here (http://javascript.internet.com/forms/select-and-auto-copy.html). This does exactly what needs to happen, but I am having trouble with using it on vB3. I know where to add it inside the newthread template....:devious:
Anyone have an ideas?
Johnny
11-05-2004, 01:01 PM
i figured it out, give me a few min so i can write out how i did it.
Kihon Kata
11-05-2004, 01:12 PM
Oh awesome! Thanks!:D
i figured it out, give me a few min so i can write out how i did it.
Johnny
11-05-2004, 01:35 PM
Files to edit:
Vbulletin_editor.js
Template Modifications:
editor_toolbar_standard
Open clientscript/Vbulletin_editor.js
at the bottom of the file look for:
// ################################################## ###########################
function open_smilie_window(x_width, y_width, wysiwyg, forumid)
{
if (typeof(forumid) == "undefined")
{
forumid = 0;
}
window.open("misc.php?" + SESSIONURL + "do=getsmilies&wysiwyg=" + wysiwyg + "&forumid=" + forumid, "smilies", "statusbar=no,menubar=no,toolbar=no,scrollbars=yes, resizable=yes,width=" + x_width + ",height=" + y_width);
}
under add:
// ################################################## ###########################
function copyit(theField)
{
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
therange=tempval.createTextRange()
therange.execCommand("Copy")
}
then save.
<---------------------------------------------------------------------------------------->
Template Modifications:
open template editor_toolbar_standard
look for:
<textarea name="message" rows="20" cols="60" wrap="virtual" style="width:$stylevar[messagewidth]; height:250px" tabindex="1">$newpost[message]</textarea>
Under add:
You can put the copy button in two ways with a normal text link or a regular button
for a text copy link:
<A onclick="copyit('vbform.message')" href="#">Copy Text</a>
or
for a regular button:
<input onclick="copyit('vbform.message')" type="button" value="Copy Text" name="cpy">
Your done. :)
it worked on my board perfect.
only way i got it to work is to have it be displayed on newthread and newreply as well.
plus i only added the copylink to the standerd editor
Kihon Kata
11-05-2004, 01:53 PM
Ok I have done your mod, BUT, how do I add this button UNDER the WYSIWYG editor?
Do I just edit the templage "editor_toolbar_wysiwyg"?
Thanks again!
Files to edit:
Vbulletin_editor.js
Template Modifications:
editor_toolbar_standard
Open clientscript/Vbulletin_editor.js
at the bottom of the file look for:
// ################################################## ###########################
function open_smilie_window(x_width, y_width, wysiwyg, forumid)
{
if (typeof(forumid) == "undefined")
{
forumid = 0;
}
window.open("misc.php?" + SESSIONURL + "do=getsmilies&wysiwyg=" + wysiwyg + "&forumid=" + forumid, "smilies", "statusbar=no,menubar=no,toolbar=no,scrollbars=yes, resizable=yes,width=" + x_width + ",height=" + y_width);
}
under add:
// ################################################## ###########################
function copyit(theField)
{
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
therange=tempval.createTextRange()
therange.execCommand("Copy")
}
then save.
<---------------------------------------------------------------------------------------->
Template Modifications:
open template editor_toolbar_standard
look for:
<textarea name="message" rows="20" cols="60" wrap="virtual" style="width:$stylevar[messagewidth]; height:250px" tabindex="1">$newpost[message]</textarea>
Under add:
You can put the copy button in two ways with a normal text link or a regular button
for a text copy link:
<A onclick="copyit('vbform.message')" href="#">Copy Text</a>
or
for a regular button:
<input onclick="copyit('vbform.message')" type="button" value="Copy Text" name="cpy">
Your done. :)
it worked on my board perfect.
only way i got it to work is to have it be displayed on newthread and newreply as well.
plus i only added the copylink to the standerd editor
Johnny
11-05-2004, 01:58 PM
its stated in the post i made on where to put it the way i put it is i added the code right under the textarea where everyone can see it. as stated in the post.
Kihon Kata
11-05-2004, 02:03 PM
The wysiwyg template (editor_toolbar_wysiwyg) is a bit different. I have tried to stick this in a few places in the template. The button shows up, but it didn't hightlight or copy the text.
Let me know what you think
its stated in the post i made on where to put it the way i put it is i added the code right under the textarea where everyone can see it. as stated in the post.
Kihon Kata
11-05-2004, 02:05 PM
Ahh, do I add the change in the vbulletin_wysiwyg.js?
Johnny
11-05-2004, 02:20 PM
the directions i gave you on the post i belieave is written clearly to understand on where to put everything,
or do you want the button to be displayed someplace instead of under the text area?
Kihon Kata
11-05-2004, 02:25 PM
Nope,
I followed your directions step by step. I DOES work with the standard editor, but not with the WYSYWYG editor that most of my users like more.
So....what I did, was add:
// ################################################## ###########################
function copyit(theField)
{
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
therange=tempval.createTextRange()
therange.execCommand("Copy")
}
TO: BOTH vbulletin_wysiwyg.js AND vbulletin_editor.js(then uploaded)
Then added the button (and I also tried the TEXT version also) to the template of editor_toolbar_wysiwyg.
The BUTTON show up fine just under the text area of the WYSIWYG editor(just like in your standard editor) but it just does not copy/highlight.
Any other ideas on why it isnt?
the directions i gave you on the post i belieave is written clearly to understand on where to put everything,
or do you want the button to be displayed someplace instead of under the text area?
Johnny
11-05-2004, 02:50 PM
i tested on my board with both standard controls and with WYSIWYG controls enabled
and both of them work how it suppose to and im using the same steps i gave you, i just dont see why its not working for you...
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.