vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   HIGHTLIGHT and COPY (https://vborg.vbsupport.ru/showthread.php?t=71370)

Kihon Kata 11-05-2004 02:32 AM

HIGHTLIGHT and COPY
 
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. 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



Quote:

Originally Posted by Johnny
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:

PHP Code:

// #############################################################################
function open_smilie_window(x_widthy_widthwysiwygforumid)
{
    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:

PHP Code:

// #############################################################################
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:

PHP Code:

    <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:

PHP Code:

<A onclick="copyit('vbform.message')" href="#">Copy Text</a

or

for a regular button:


PHP Code:

<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!


Quote:

Originally Posted by Johnny
Files to edit:
Vbulletin_editor.js


Template Modifications:
editor_toolbar_standard



Open clientscript/Vbulletin_editor.js

at the bottom of the file look for:

PHP Code:

// #############################################################################
function open_smilie_window(x_widthy_widthwysiwygforumid)
{
    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:

PHP Code:

// #############################################################################
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:

PHP Code:

    <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:

PHP Code:

<A onclick="copyit('vbform.message')" href="#">Copy Text</a

or

for a regular button:


PHP Code:

<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


Quote:

Originally Posted by Johnny
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:

Code:


// #############################################################################
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?


Quote:

Originally Posted by Johnny
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?



All times are GMT. The time now is 08:01 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01127 seconds
  • Memory Usage 1,774KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (10)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete