News:

Wondering if this will always be free?  See why free is better.

Main Menu

Select All & Copy Code to Clipboard

Started by N3RVE, July 10, 2008, 08:56:04 AM

Previous topic - Next topic

N3RVE

Link to Mod



Select All & Copy 'Code' to Clipboard BETA
By [n3rve]



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

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
Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

Flocke

German:

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


Can you put Select All|Copy to Clipboard on the right side?

3axapbl4

Russian


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


ElectricSquid

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?

ElectricSquid

#4
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

N3RVE

#5
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]
Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

ElectricSquid

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.

NicKCramleT

Spanish:

$txt['codeselectall'] = 'Seleccionar';
$txt['codecopytoclipboard'] = 'Copiar al Portapapeles';
$txt['codedivider'] = '|';
Comunidad Down-ALL ONLINE!!!
www.downallnow.com

Aportes:

Favicon sin Mod
Traducir MODs

N3RVE

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]
Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

Adish - (F.L.A.M.E.R)

the text appears up over the coded text but it doesnt work... it neither selects neither copies them...any solutions ?

N3RVE

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?
Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

Adish - (F.L.A.M.E.R)


N3RVE

Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

Adish - (F.L.A.M.E.R)


B.SkiLLs

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.

VICKTORY THE UNDERDOG Documentary – Pitbulls the untold true story

This is a must read & watch. Then Buy your DVD today. You will not regret it. Totally AWESOME. Best i ever seen. --
 
____________________
Message approved by
: [B. SkiLLs]
 


jepot5

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>',



L'AltroWeb

#17
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
;)

italo_anonimo


DarthKayla

Portuguese (BR)


$txt['codeselectall'] = 'Selecionar Tudo';
$txt['codecopytoclipboard'] = 'Copiar para a Área de Transferência';
$txt['codedivider'] = '|';

Advertisement: