vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   AutoCopy Code and PHP to clipboard (https://vborg.vbsupport.ru/showthread.php?t=37117)

TECK 04-06-2002 10:00 PM

AutoCopy Code and PHP to clipboard
 
This hack will allow you to copy the text quoted in Code and PHP, to your clipboard, with a simple double-click.
This is extremly useful if your users utilise frequently the code environment.

Once installed the hack, if an user double-click in the quoted area, an alert will popup let him(her) know that the code was copied to the clipboard.

ESTIMATED INSTALL TIME: 1 minute
TESTED IN VERSION: 2.2.5

[HIGH]NOTE:[/HIGH] As a thank you for using my hack, please click on the INSTALL button. You will receive updates in your email, whenever I add new features to it and it will let me evaluate better the quality of my hacks.
[HIGH]Also post a reply with your comments. Your oppinion is important to me.[/HIGH]

To use this hack with FireFly's Quote, Code and PHP hack, read the instructions mentioned here.

To download the latest version of this hack, click below:

TECK 04-07-2002 09:42 AM

Below, you see a screenshot... ;)

Lesane 04-07-2002 10:03 AM

Pretty usefull, thanks.

TECK 04-07-2002 10:03 AM

i hope firefly will install this here.. ;)

Admin 04-07-2002 11:14 AM

Yeah, looks useful indeed. I'll look into this shortly. :)

TECK 04-07-2002 11:18 AM

thanks firefly. :)
it's extremly easy to install it in your hack. i have no idea how come i didnt think of this before...

Admin 04-07-2002 11:27 AM

Code:

Alright, installed. :) Will make my life easier, good job.

Recluse 04-07-2002 11:31 AM

nice one ;)

Admin 04-07-2002 11:32 AM

Yeah, you must click inside the text and not just anywhere in the table (because the <pre> ends before the table).
Maybe with some more Javscript you can make the whole table double-clickable? :)

TECK 04-07-2002 11:33 AM

i'm glad you like it firefly. it will make everyone's life easier here at vB.org... :D

TECK 04-07-2002 11:39 AM

Quote:

Originally posted by FireFly
Yeah, you must click inside the text and not just anywhere in the table (because the <pre> ends before the table).
Maybe with some more Javscript you can make the whole table double-clickable? :)

you cant.. unfortunatelly. the code is looking only for a segment of code related to whatever variable you select (in our case [high]<pre[/high]), to paste it. if you select ather area, it will paste everything, including the html code. i would make more clear the message:
[high](double-click the code segment to copy to clipboard)[/high] or something like that...

if you dont click on the actual code, it will not work. talking abot this, how can we remove the space? if you click on the first line (even is it's outside the text), in your example, it works. in the empty space below, it doesnt. VB adds some extra space there... only in CODE and PHP. maybe you can tell us here firefly how to remove this pesky space in both CODE and PHP.. it is not very estethic..

Admin 04-07-2002 11:46 AM

I was thinking of maybe giving every <pre> a unique ID (per page of course), and then instead of "this" in the JS use that ID.

Admin 04-07-2002 11:50 AM

[high]* FireFly beats the system. ;)
[/high]

Ok, I got it to work with my hack (PHP and stuff in boxes) that you can click the table and not just the text.

Instead of replacing <pre I replace this:
Code:

<td colspan="2" style="BORDER: #000000 1px solid; FONT-SIZE:
With the same code only with added JavaScript.

TECK 04-07-2002 11:51 AM

good job firefly, as usual.. ;)
so if i understand corectly.. you fall in love with me?? hehe

nsr81 04-07-2002 05:02 PM

Thanks for this hack nakkid.

Neo 04-07-2002 06:37 PM

Cool nakkid :D

Sindatel 04-10-2002 12:06 PM

I can't seem to get it to work on my 2.2.5
every time i click it copies the entire post!
and gives me 3 CopyBoxes !!!
HELP :)

TECK 04-11-2002 04:24 AM

you have firefly's hack installed?
check his post here, related to this issue. he tells you how to edit properly the html code.

squawell 04-11-2002 06:12 AM

very useful hack~~

thankz ur great work~~

Parker Clack 04-13-2002 04:19 PM

nakkid:

Is there anyway to incorporate this in with the quotereply template so when someone clicks on the quote icon the text that is in the post is copied to the clipboard?

So instead of putting the
Code:


       
Quote:

       
       
               
       
       

                       

                       
                                Originally posted by $originalposter $pagetext
                       
                       

               


that this template puts into a new post it would just copy $pagetext to the clipboard? That way it when they go to reply and the page won't load they haven't lost what they just typed. Or better yet it would be cool if it was a feature that when they typed a message it would just copy the contents to the clipboard and then you could just cut and paste. The information copied to the clipboard would change each time you posted a new message.

Just a thought.

Parker

212rikanmofo 04-22-2002 12:54 AM

in the instructions in the txt file says:

| File: admin/functions.php (1 change) |
+-----------------------------------------------+
| 1. Find this code:
+--------------------------------------------------------------------------+
Code:

return "</normalfont><blockquote><pre><smallfont>PHP:</smallfont><hr>$buffer<hr></pre></blockquote><normalfont>";
}

// ###################### Start stripbrsfromcode #######################
function stripbrsfromcode($foundcode) {
  $foundcode = str_replace("\\\"","\"",$foundcode);
  return "</normalfont><blockquote><pre><smallfont>code:</smallfont><hr>" . str_replace("<br>", "", str_replace("<br />", "", $foundcode) ) . "<hr></pre></blockquote><normalfont>";
}

but in my admin/functions.php it says:

Code:

  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>PHP:</b></smallfont></td></tr><tr><td style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: {codefontcolor}; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: {codebackground};\"><pre>" . $buffer . "</pre></td></tr></table><normalfont>";
}

// ###################### Start stripbrsfromcode #######################
function stripbrsfromcode($foundcode) {
  $foundcode = str_replace("\\\"","\"",$foundcode);
  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>code:</b></smallfont></td></tr><tr><td style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: {codefontcolor}; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: {codebackground};\"><pre>" . $foundcode . "</pre></td></tr></table><normalfont>";
}

im running vb 2.2.5... btw... so how am i spose to modify this?

TECK 04-22-2002 01:31 AM

you have firefly's hack installed? he posted how to mod the code few posts above.

Entourage 04-22-2002 09:27 AM

very nice hack mate! tnx

212rikanmofo 04-22-2002 09:41 AM

Quote:

Originally posted by FireFly
[high]* 212rikanmofo beats the system. ;)
[/high]

Ok, I got it to work with my hack (PHP and stuff in boxes) that you can click the table and not just the text.

Instead of replacing <pre I replace this:
Code:

<td colspan="2" style="BORDER: #000000 1px solid; FONT-SIZE:
With the same code only with added JavaScript.

k, firefly im really confused here, i have installed your code,php quote box hack, and i want to install this hack to work with your hack, can you please be more specific on what to do. when i install this hack, the php and code boxes return to vbulletin's default, which is them lines.... :(

Felix 05-04-2002 08:16 PM

Just replace

Code:

  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>PHP:</b></smallfont></td></tr><tr><td style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #EEEEFF; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: #1D6AA0;\"><pre>" . $buffer . "</pre></td></tr></table><normalfont>";
}

// ###################### Start stripbrsfromcode #######################
function stripbrsfromcode($foundcode) {
  $foundcode = str_replace("\\\"","\"",$foundcode);
  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>code:</b></smallfont></td></tr><tr><td style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #EEEEFF; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: #1D6AA0;\"><pre>" . $foundcode . "</pre></td></tr></table><normalfont>";
}

with this:

Code:

  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>PHP:</b></smallfont></td><td align=\"right\"><smallfont>(double-click to copy to clipboard)</smallfont></td></tr><tr><td colspan=\"2\" ondblclick='javascript:window.clipboardData.setData(\"Text\", this.innerText); alert(\"Code copied to the clipboard. You can paste it now.\");' style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: {codefontcolor}; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: {codebackground};\"><pre>" . $buffer . "</pre></td></tr></table><normalfont>";
}

// ###################### Start stripbrsfromcode #######################
function stripbrsfromcode($foundcode) {
  $foundcode = str_replace("\\\"","\"",$foundcode);
  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>code:</b></smallfont></td><td align=\"right\"><smallfont>(double-click to copy to clipboard)</smallfont></td></tr><tr><td colspan=\"2\" ondblclick='javascript:window.clipboardData.setData(\"Text\", this.innerText); alert(\"Code copied to the clipboard. You can paste it now.\");' style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: {codefontcolor}; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: {codebackground};\"><pre>" . $foundcode . "</pre></td></tr></table><normalfont>";
}

Worked for me :)

Bald Bouncer 05-07-2002 03:56 PM

Quote:

Originally posted by FireFly
* FireFly beats the system. ;)

Ok, I got it to work with my hack (PHP and stuff in boxes) that you can click the table and not just the text.

Instead of replacing <pre I replace this:
Code:

<td colspan="2" style="BORDER: #000000 1px solid; FONT-SIZE:
With the same code only with added JavaScript.

what added javascript ... I just cant get this too work with your boxes :(

mersey 05-13-2002 08:42 AM

cheers very handy hack :)

Boofo 05-13-2002 09:26 AM

I already installed Firefly's code and php hack and I also installed this great hack (the part I needed with Firefly's hack), but how do I add the "double-click to copy to clipboard" text at the top of the box if I only need to use the final step 1 in this file? Also, I'm not 100 % clear on the instructions Firefly said about the <pre replacement. Can anyone help explain what it is exactly that I am supposed to do here?

Allstar DC 05-14-2002 02:17 PM

ok,i figured it out. do the following after you installed firefly's hack:


replace:
Code:

return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>PHP:</b></smallfont></td></tr><tr><td style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: #D7D7D7;\"><pre>" . $buffer . "</pre></td></tr></table><normalfont>";
}

// ###################### Start stripbrsfromcode #######################
function stripbrsfromcode($foundcode) {
  $foundcode = str_replace("\\\"","\"",$foundcode);
  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>code:</b></smallfont></td></tr><tr><td style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: #D7D7D7;\"><pre>" . $foundcode . "</pre></td></tr></table><normalfont>";

with:
Code:

return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\"

cellspacing=\"1\"><tr><td><smallfont><b>PHP:</b></smallfont></td><td align=\"right\"><smallfont>(double click the code to

copy it)</smallfont></td></tr><tr><td colspan=\"2\" style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR:

#000000; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: #D7D7D7;\"><pre>" . $buffer .

"</pre></td></tr></table><normalfont>";
}

// ###################### Start stripbrsfromcode #######################
function stripbrsfromcode($foundcode) {
  $foundcode = str_replace("\\\"","\"",$foundcode);
  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\"

cellspacing=\"1\"><tr><td><smallfont><b>code:</b></smallfont></td><td align=\"right\"><smallfont>(double click the code to

copy it)</smallfont></td></tr><tr><td colspan=\"2\" style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR:

#000000; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: #D7D7D7;\"><pre>" . $foundcode .

"</pre></td></tr></table><normalfont>";

forget about the lines in nakkids hack, just do this:
Code:

Create a new replacement variable. Go to your admin control panel:
|
|      Replacements > Add
|
| and enter the following information:
|
|      Code to find:  <td colspan="2"
|      Code to insert: <td colspan="2" ondblclick='javascript:window.clipboardData.setData("Text", this.innerText); alert("Code copied to the clipboard. You can paste it now.");'

that will fix the "php:" and "code:" part.

to make the box clickable with quote do the following:

+-------------------------------------------------------------------------------------------------+
| In the Admin CP, goto Modify under Custom vB Codes and click [edit] next to the [quote] code |
| |
+-------------------------------------------------------------------------------------------------+
replace this:
Code:

<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"><tr><td><smallfont><b>quote:</b></smallfont></td></tr><tr><td style="BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana,Arial; BACKGROUND-COLOR: #D7D7D7;">{param}</td></tr></table>
with this:
Code:

<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"><tr><td><smallfont><b>quote:</b></smallfont></td><td align="right"><smallfont>(double click the code to copy it)</td></tr><tr><td colspan="2" ondblclick='javascript:window.clipboardData.setData("Text", this.innerText); alert("Code copied to the clipboard. You can paste it now.");' style="BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana,Arial; BACKGROUND-COLOR: #D7D7D7;">{param}</td></tr></table>

that will fix it for you!

Boofo 05-14-2002 05:35 PM

It works here now, I just don't have the "double-click to copy to clipboard" showing up like it does here. That's the only part I need to make it look right.

Allstar DC 05-14-2002 07:08 PM

thats easy, just add
Code:

<smallfont>(double click the code to copy it)</smallfont>
in functions.php right after the following :
PHP Code:

<smallfont><b>PHP:</b></smallfont

& after:
PHP Code:

<smallfont><b>CODE:</b></smallfont


last one: In the Admin CP, goto Modify under Custom vB Codes and click [edit] next to the [quote] code Place this code in the "vB Code replacement" Box
PHP Code:

<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"><tr><td><smallfont><b>quote:</b></smallfont></td><td align="right"><smallfont>(double click the code to copy it)</td></tr><tr><td colspan="2" ondblclick='javascript:window.clipboardData.setData("Text", this.innerText); alert("Code copied to the clipboard. You can paste it now.");' style="BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: {codefontcolor}; FONT-FAMILY: Verdana,Arial; BACKGROUND-COLOR: {codebackground};">{param}</td></tr></table


Bald Bouncer 05-15-2002 12:20 AM

never mind sorted it ... good job mate! :)

Bald Bouncer 05-15-2002 12:30 AM

PHP Code:

<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"><tr><td><smallfont><b>quote:</b></smallfont></td><td align="right"><smallfont>(double click the code to copy it)</td></tr><tr><td colspan="2" style="BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana,Arial; BACKGROUND-COLOR: #D7D7D7;">{param}</td></tr></table

that needs to be your quote text to work

Boofo 05-15-2002 12:46 AM

Thanks! It works great! :)

Allstar DC 05-15-2002 04:06 AM

Quote:

Originally posted by Bald Bouncer
PHP Code:

<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"><tretcetc

that needs to be your quote text to work


your right, thanx i pasted the wrong code in my message

aspire007 05-15-2002 07:02 PM

is there a way i can fix this? --

[QUOTE]Originally posted by blue devil

did it work? [/QUOTE

test

thats how it shows up when someone quotes another person accept the last quote has this at the end ] but i couldnt put it here due to it tries to quote me :)

Allstar DC 05-15-2002 07:28 PM

In the Admin CP, goto Modify under Custom vB Codes and click [edit] next to the [quote] code Place this code in the "vB Code replacement" Box:

Code:

<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"><tr><td><smallfont><b>quote:</b></smallfont></td><td align="right"><smallfont>(double click the code to copy it)</td></tr><tr><td colspan="2" ondblclick='java script:window.clipboardData.setData("Text", this.innerText); alert("Code copied to the clipboard. You can paste it now.");' style="BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #EEEEFF; FONT-FAMILY: Verdana,Arial; BACKGROUND-COLOR: #1D6AA0;">{param}</td></tr></table>

Boofo 05-15-2002 07:32 PM

Isn't it supposed to be this?
Code:

<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"><tr><td><smallfont><b>quote:</b></smallfont></td><td align="right"><smallfont>(double click the code to copy it)</td></tr><tr><td colspan="2" style="BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana,Arial; BACKGROUND-COLOR: #D7D7D7;">{param}</td></tr></table>
Did you mean to put the above? :)

Allstar DC 05-15-2002 07:38 PM

boofo, your code doesn't have the "copy to clipboard"function, mine does

aspire007 05-15-2002 09:09 PM

sorry guys heres what i did -- *didnt notice untill now*

when i click on modify Custom vB Codes there is no quote Definitions there.. i see the rest of the things there like [b]bold[b] but quote is gone
i think i deleted the whole thing on accident so could you guys tell me what all i need to put it back in?

thanx in advance to you all :)


All times are GMT. The time now is 02:41 AM.

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.01508 seconds
  • Memory Usage 1,868KB
  • 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
  • (17)bbcode_code_printable
  • (5)bbcode_php_printable
  • (5)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
  • (40)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