Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: N3RVE on July 10, 2008, 08:56:04 AM

Title: Select All & Copy Code to Clipboard
Post by: N3RVE on July 10, 2008, 08:56:04 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=1285)



Select All & Copy 'Code' to Clipboard BETA
By [n3rve] (http://www.simplemachines.org/community/index.php?action=profile;u=139801)



Introduction
When the "[ code ] [ /code ]" tag is used on your forum, The Code is seperated in a box like a quote as illustrated below;


This is an Example; [n3rve] thinks Metallica is SMF himself

This plugin will alter output of the 'code' tag to include js to "select all" and  "Copy to clipboard".
'Flash' needs to be enabled on the clients browser (as the copying is done by a flash file called _clipboard.swf)
It's enabled by default in most browsers.


This plugin has been tested on the following Browsers:
o Internet Explorer 6 / 7
o Internet Explorer 8 BETA
o Mozilla Firefox 3.0 BETA 2
o Opera               
Please, Test and let me know which browsers are supported and which are not, I'll reference you (http://www.simplemachines.org/community/index.php?action=profile;u=0) in this readme.

Compatability
o 1.1.4
o 1.1.5
o 2.0 Beta 3 Public
o 2.0 Beta 3.1 Public

Features
o Adds "Select Code" Link to each coded section
o Adds "Copy To Clipboard" Link to each coded section

Currently, There are no administration settings with this mod. (maybe in an updated version :) ). To disable/remove it, you must uninstall the modification.
Should you experience problems installing/ uninstalling a mod?
Use the SMF Package Parser (http://modparser.oxynerve.net)

Installation
Installation affects source files and a javascript file which is called from the default theme for virtually all themes, therefore theme modificatoions aren't required.

Languages
o English/English-utf8
o English_British/English_British-utf8
o Turkish/Turkish-utf8 (Translated by 'Kapadokyali' & 'BadBoy')
o Spanish/Spanish-utf8 (Translated by 'EgAr')
o Spanish_es/Spanish_es-utf8 (Trasnlated by 'EgAr')
o Greek/Greek-utf8 (Translated by 'MinasC')

I welcome translations for other languages SMF Supports.
Please translate the following and post them in the comment topic linked above.
$txt['codeselectall'] = 'Select All';
$txt['codecopytoclipboard'] = 'Copy To Clipboard';
$txt['codedivider'] = '|';

Bug Reports
They shouldn't be any major bugs, but just in case, Please use the modification's thread for bug reports pertaining this modification.

Thanks for Testing this BETA Release, The Non-BETA will be released a few days after I have used this on my production site and no bugs have been reported here.

-[n3rve]
©2007 - 2008
Title: Re: Select All & Copy Code to Clipboard
Post by: Flocke on July 15, 2008, 01:59:05 PM
German:

$txt['codeselectall'] = 'Markieren';
$txt['codecopytoclipboard'] = 'In die Zwischenablage kopieren';
$txt['codedivider'] = '|';


Can you put Select All|Copy to Clipboard on the right side?
Title: Re: Select All & Copy Code to Clipboard
Post by: 3axapbl4 on July 25, 2008, 03:34:33 AM
Russian


$txt['codeselectall'] = 'Выделить всё';
$txt['codecopytoclipboard'] = 'Копировать в буфер обмена';
$txt['codedivider'] = '|';

Title: Re: Select All & Copy Code to Clipboard
Post by: ElectricSquid on July 25, 2008, 09:44:44 PM
This is a great feature. Glad to see it offered as I will be using this

But... I'd like to extent it's use to something else besides the code field.
I have an area in Ultimate Profiles called My URL. Basically it's a box in the users profile that shows the user his or her personal Pretty URL.

I would like to extend the functionallity of this mod to also work on that < td>
Is it as easy as making that < td> use the same CSS as the code box?
Title: Re: Select All & Copy Code to Clipboard
Post by: ElectricSquid on July 25, 2008, 11:19:50 PM
OK, I installed it.
It shows "Select All | Copy To Clipboard" like it should.
It does copy to Clipboard as it should.

...but heres where it gets weird. If I try to paste to the adress bar in IE7, it pastes nothing.
It will paste to a reply text field, or to Notepad, but not to the address bar ???

Also, Is there a way to mix the select and copy to clipboard features into one button?



is this the same mod that is being used here on this site (as seen below)

        /|\
         |
         |
        /|\
        /|\
This Button
Title: Re: Select All & Copy Code to Clipboard
Post by: N3RVE on July 26, 2008, 09:29:51 AM
Thanks for the translations 3axapbl4 and Flocke.


∑£ℓ¢†®¡¢ §ợų¡đ,
Sorry I can't help you with that. You should post at the SMF Coding Discussion Board as it's not related to the mod.


Quote
...but heres where it gets weird. If I try to paste to the adress bar in IE7, it pastes nothing.
It will paste to a reply text field, or to Notepad, but not to the address bar.
This could be a client browser issue, it works fine on firefox.

-[n3rve]
Title: Re: Select All & Copy Code to Clipboard
Post by: ElectricSquid on July 26, 2008, 02:10:22 PM
I was figuring it was browser related. The auto copy thing seems to not be cross browser friendly at all. Not this mod, im talking in general with any code that does this.
Title: Re: Select All & Copy Code to Clipboard
Post by: NicKCramleT on July 26, 2008, 02:42:09 PM
Spanish:

$txt['codeselectall'] = 'Seleccionar';
$txt['codecopytoclipboard'] = 'Copiar al Portapapeles';
$txt['codedivider'] = '|';
Title: Re: Select All & Copy Code to Clipboard
Post by: N3RVE on July 26, 2008, 02:44:08 PM
Quote from: NicKCramleT on July 26, 2008, 02:42:09 PM
Spanish:

$txt['codeselectall'] = 'Seleccionar';
$txt['codecopytoclipboard'] = 'Copiar al Portapapeles';
$txt['codedivider'] = '|';

Thanks NicKCramleT :)

-[n3rve]
Title: Re: Select All & Copy Code to Clipboard
Post by: Adish - (F.L.A.M.E.R) on August 22, 2008, 11:17:03 AM
the text appears up over the coded text but it doesnt work... it neither selects neither copies them...any solutions ?
Title: Re: Select All & Copy Code to Clipboard
Post by: N3RVE on August 23, 2008, 09:33:21 AM
Quote from: F.L.A.M.E.R on August 22, 2008, 11:17:03 AM
the text appears up over the coded text but it doesnt work... it neither selects neither copies them...any solutions ?

which browser do u use?
Title: Re: Select All & Copy Code to Clipboard
Post by: Adish - (F.L.A.M.E.R) on August 23, 2008, 10:55:14 AM
firefox..
Title: Re: Select All & Copy Code to Clipboard
Post by: N3RVE on August 25, 2008, 02:20:43 PM
version?
Title: Re: Select All & Copy Code to Clipboard
Post by: Adish - (F.L.A.M.E.R) on August 25, 2008, 04:30:22 PM
3.0.1
Title: Re: Select All & Copy Code to Clipboard
Post by: B.SkiLLs on August 28, 2008, 05:29:03 AM
Quote from: F.L.A.M.E.R on August 22, 2008, 11:17:03 AM
the text appears up over the coded text but it doesnt work... it neither selects neither copies them...any solutions ?

Same here. It shows the "select all" and  "Copy to clipboard" above the code section box But it doesnt highlight or copy to clip at all.

Any solutions yet ??

I tried IE7 and FF 2.5 or the latest version what ever it is. Not FF3 though. I am also using 1.1.5 fresh

great mod and i could really use it. Any help would be appreciated alot. Thanks.

Title: Re: Select All & Copy Code to Clipboard
Post by: jepot5 on October 09, 2008, 01:03:34 AM
What if you have modified this line already to hide the code tag from guests
from this thread - http://www.simplemachines.org/community/index.php?topic=251621
'content' => '<div class="codeheader">' . $txt['smf238'] . ':</div><div class="code">' . ($context['browser']['is_gecko'] ? '<pre style="margin-top: 0; display: inline;">$1</pre>' : '$1') . '</div>',
to this
'content' => '<div class="codeheader">' . $txt['smf238'] . ':</div>' . ($user_info['is_guest'] ? 'Codes are only visible to the guests. <a href="' . $scripturl . '?action=register">Register</a>&nbsp;or&nbsp;<a href="' . $scripturl . '?action=login">Login</a><div style="visibility:hidden">' : '<div class="code">') . ($context['browser']['is_gecko'] ? '<pre style="margin-top: 0; display: inline;">$1</pre>' : '$1') . '</div>',

Title: Re: Select All & Copy Code to Clipboard
Post by: jepot5 on October 18, 2008, 11:13:10 PM
Pls Help.
Title: Re: Select All & Copy Code to Clipboard
Post by: L'AltroWeb on October 27, 2008, 05:20:08 PM
Hi!
I've installed this mod but it don't work with pretty urls!
To fix open /forum/Themes/default/script.js
Search: document.getElementById('clipboard').innerHTML = '<embed src="_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(output)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
Replace: document.getElementById('clipboard').innerHTML = '<embed src="http://www.yoursiteurl.xx/forum/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(output)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
PS: for noscript browser is best to edit like this:
$data = \'<div class="codeheader">\' . $txt[\'smf238\'] . \': \'
.\'<script type="text/javascript">/*//<![CDATA[ */document.write("<a href=\"javascript:void(0)\" title=\"\'.$txt[\'codeselectall\'].\'\" onclick=\"javascript:selectall(\\\'code_a\'.$codecounter.\'\\\');return false;\">\'.$txt[\'codeselectall\'].\'</a>\'
.\' \'.$txt[\'codedivider\'].\' <a href=\"javascript:void(0)\" title=\"\'.$txt[\'codecopytoclipboard\'].\'\" onclick=\"javascript:copy(\\\'code_a\'.$codecounter.\'\\\');return false;\">\'.$txt[\'codecopytoclipboard\'].\'</a>"); /*//]]>*/</script>\'
.\'<noscript><u>\'.$txt[\'codeselectall\'].\'</u> \'.$txt[\'codedivider\'].\' <u>\'.$txt[\'codecopytoclipboard\'].\'</u> \'.$txt[\'codejavarequired\'].\'</noscript>\'
.\'</div><div class="code" id="code_a\'.$codecounter.\'">\' . ($context[\'browser\'][\'is_gecko\'] ? \'<pre style="margin-top: 0; display: inline;">\'.$data.\'</pre>\' : $data) . \'</div>\';
// end of select all and copy to clipboard mod

Now insert in ModSettings.english.php this line:
$txt['codejavarequired'] = '- (Enable Javascript to use these functions)';
U can test result here: http://darkwolf.altervista.org/forum/modemrouter/g604t-e-reboot/msg1549/#msg1549
;)
Title: Re: Select All & Copy Code to Clipboard
Post by: italo_anonimo on November 12, 2008, 05:03:28 PM
not work in opera 9.62 (smf 1.1.7) =(
Title: Re: Select All & Copy Code to Clipboard
Post by: DarthKayla on January 04, 2009, 01:26:57 PM
Portuguese (BR)


$txt['codeselectall'] = 'Selecionar Tudo';
$txt['codecopytoclipboard'] = 'Copiar para a Área de Transferência';
$txt['codedivider'] = '|';
Title: Re: Select All & Copy Code to Clipboard
Post by: Impsat-1 on April 18, 2009, 11:23:59 AM
Uhhh... God MOD but not work in SMF 1.1.8, any suggestions? can updated? to SMF 1.1.8 please?, Thanks...

Regards 8).-
Title: Re: Select All & Copy Code to Clipboard
Post by: The_Wii_Nes_Boy on April 21, 2009, 02:15:26 AM
Any idea if thiis will reach an official release? Would be so usefull to have on my site.

Please someone, code, code, code :P
Title: Re: Select All & Copy Code to Clipboard
Post by: B.SkiLLs on May 07, 2009, 03:36:58 AM
Try this:

set for install on 1.1.8

BE SURE TO MAKE BACK UPS FIRST !!!!

i edited a couple thing for install. Should work but havent tried it yet. I will also try it tomorrow and let you know if anybody hasnt already. But should be ok and install fine.

might have a little bit more editing to do.

See attached

Not sure why the mod creator hasnt fixed this one yet. It is a much needed mod.

Title: Re: Select All & Copy Code to Clipboard
Post by: B.SkiLLs on May 07, 2009, 04:23:50 AM
scratch that above. Got it to install and select all. But not copy to clip board. Got a little bit of some more editing to do.

will work for at least that part for now. You can also edit it and take out the text for the 'copy to clipboard" part and just use to select all (highlight)

Title: Re: Select All & Copy Code to Clipboard
Post by: candidosa2 on May 24, 2009, 05:30:42 AM
when update please dont forget portugues linguage

<file name="$languagedir/Modifications.portuguese_pt.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['codeselectall'] = 'Selecionar Tudo';
$txt['codecopytoclipboard'] = 'Copiar para a &Aacute;rea de Transfer&ecirc;ncia';
$txt['codedivider'] = '|';
]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.portuguese_pt-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['codeselectall'] = 'Selecionar Tudo';
$txt['codecopytoclipboard'] = 'Copiar para a &Aacute;rea de Transfer&ecirc;ncia';
$txt['codedivider'] = '|';
]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.portuguese_brazilian.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['codeselectall'] = 'Selecionar Tudo';
$txt['codecopytoclipboard'] = 'Copiar para a &Aacute;rea de Transfer&ecirc;ncia';
$txt['codedivider'] = '|';
]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.portuguese_brazilian-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['codeselectall'] = 'Selecionar Tudo';
$txt['codecopytoclipboard'] = 'Copiar para a &Aacute;rea de Transfer&ecirc;ncia';
$txt['codedivider'] = '|';
]]></add>
</operation>
</file


Title: Re: Select All & Copy Code to Clipboard
Post by: Impsat-1 on May 24, 2009, 04:56:50 PM
Mmm... hey [n3rve] update the MOD complete, is the better for all users... is so good MOD but may be need UpDate to last version's of SMF, thanks...

Regards  8).-
Title: Re: Select All & Copy Code to Clipboard
Post by: N3RVE on May 24, 2009, 05:36:09 PM
Updated :)

-[n3rve]
Title: Re: Select All & Copy Code to Clipboard
Post by: Impsat-1 on May 24, 2009, 10:56:27 PM
Wowww... THANKS!!! :D [n3rve] I repeat... Excelent MOD, Congratulations ;) Thanks... fully working now

Regards [n3rve] 8).-
Title: Re: Select All & Copy Code to Clipboard
Post by: candidosa2 on May 24, 2009, 11:45:19 PM
that link
http://modparser.oxynerve.net/
she not work
Title: Re: Select All & Copy Code to Clipboard
Post by: N3RVE on May 25, 2009, 04:31:37 AM
Yeah, my domain name expired and I haven't renewed it so I currently access that site using the IP address.
We now have a Package Parser on the page of every mod, select your SMF version and click "Parse".

-[n3rve]
Title: Re: Select All & Copy Code to Clipboard
Post by: baijianpeng on July 08, 2009, 12:54:42 PM
Thanks for this great Mod. I tested on my SMF 1.1.9 with FireFox 3.0.10, it can't work. My SMF is using a custom theme instead of the default theme.

Below is Chinese language translation made by me:


<file name="$languagedir/Modifications.chinese-simplified-utf8.php">
<operation>
<search position="end" />
<add><![CDATA[
$txt['codeselectall'] = '全选';
$txt['codecopytoclipboard'] = '复制到剪切板';
$txt['codedivider'] = '|';
]]></add>
</operation>
</file>

<file name="$languagedir/Modifications.chinese-traditional-utf8.php">
<operation>
<search position="end" />
<add><![CDATA[
$txt['codeselectall'] = '全選';
$txt['codecopytoclipboard'] = '復制到剪切板';
$txt['codedivider'] = '|';
]]></add>
</operation>
</file>
Title: Re: Select All & Copy Code to Clipboard
Post by: SCM-NZ on October 12, 2009, 09:34:08 PM
An awesome mod, many thanks [n3rve]. after some issues installing on SMF 1.1.10, is is now installed and works ok with IE. IE however is rubbish and most of my users are using Fx 3.5.3. The shame of it all is this mod is not selecting the code or copying to clipboard when used in Fx 3.5.3. is there any fix for this.
Thanks in advance
SCM
Title: Re: Select All & Copy Code to Clipboard
Post by: B.SkiLLs on May 14, 2010, 09:56:53 AM
Any update for 1.1.11 +  as the package is saying it is corrupted  and will not apply. ??
Title: Re: Select All & Copy Code to Clipboard
Post by: forumfjott on June 30, 2013, 08:54:24 AM
How about getting this to work with 2.0.4? I've tried making install in compability mode, but get errors regarding subs.