Select All & Copy Code To Clipboard

Started by karlbenson, October 14, 2007, 04:51:27 PM

Previous topic - Next topic

karlbenson



SELECT ALL AND COPY CODE TO CLIPBOARD v1.2
By Karl Benson



Introduction
This mod alters the output of the 'code' tag to include links to select all the code and to copy it to clipboard.

Requires 'Flash' to enabled by the browser (as the copying is done by a flash file called _clipboard.swf)

Tested in browsers
IE 6/7
Firefox 1/2
Opera (Select All does not work, but Copy To Clipboard works.)

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

There are no admin settings with this mod. To disable/remove it, you must uninstall it.

Installation
Installation affects source files and a javascript file which is called from the default theme for ALL themes, therefore NO theme edits will be required.
(unless there is a conflict with modifications OR if your not using a supported language)

There are TWO versions of this mod.
One for SMF 1.1.x versions and
one for SMF 2.0 Beta 1 (which is currently available to Charter Members).

If your using a language different than the ones supported this mod (listed below), then you will need to add the following to the Modifications.{language}.php for each theme (The language folder can be found eg Themes/{themename}/languages/)

FIND
?>
ADD BEFORE (and translate as necessary the language strings)
$txt['codeselectall'] = 'Select All';
$txt['codecopytoclipboard'] = 'Copy To Clipboard';
$txt['codedivider'] = '|';


Languages
o Currently Supports
- English/English-utf8
- English_British/English_British-utf8
- Turkish/Turkish-utf8 (Thanks to Kapadokyali & BadBoy)
- Spanish/Spanish-utf8 (Thanks to EgAr)
- Spanish_es/Spanish_es-utf8 (Thanks to EgAr)
- Greek/Greek-utf8 (Thanks to MinasC)
I welcome translations for any other languages which SMF Supports.
Please translate the following and post them in the modification topic.
$txt['codeselectall'] = 'Select All';
$txt['codecopytoclipboard'] = 'Copy To Clipboard';
$txt['codedivider'] = '|';


Support
Please use the modification thread for support with this modification.
(Please don't ask me to do the edits for you)

Changelog
1.0 - 10th October 2007
o Initial release
1.1 - 20th October 2007
o Added languages
- Turkish/Turkish-utf8 (Thanks to Kapadokyali & BadBoy)
- English_British/English_British-utf8
- Spanish/Spanish-utf8 (Thanks to EgAr)
- Spanish_es/Spanish_es-utf8 (Thanks to EgAr)
1.2 - 22nd November 2007
o Added Greek/Greek-utf8 (Thanks to MinasC)

MinasC

wow man , productivity day today , right ?
thnx a lot !

karlbenson

They have all been approved today.
I created these in the past few days to 1-3 weeks.

and theres still 2 more to be fix then to be approved.

MinasC


karlbenson


MinasC

hey , i just tried to install and got an error : subs.php not found ! i think you have to change install.xml and put "Subs.php" instead of "subs.php" !

karlbenson

I was in the process of fixing it when you posted it.

Updated versions of 1.0 are not available via mod section.

MinasC

well ,

i installed it fine in one of my forums (i am still testing that one) but i got that text

$txt['codeselectall'] = 'Select All'; $txt['codecopytoclipboard'] ='Copy To Clipboard'; $txt['codedivider'] = '|';

at the top of my pages , and the mod doesn't show ! what's wrong ?
thnx !

karlbenson

This one is not my mods fault, but a bug in SMF on some server setups. :P

Open
Modifications.english.php (the location of this file is Themes/default/languages)

Making sure no text strings like those you posted are;
above <?php (which needs to be the first thing in the file)
below ?> (which needs to be the last thing in the file [on a line of its own]

if your using utf8, you will need to do the same for
Modifications.english-utf8.php


edi67

i was searching this by AGEssss thxxxxx   work ok for now
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

MinasC

Quote from: karlbenson on October 14, 2007, 06:59:54 PM
This one is not my mods fault, but a bug in SMF on some server setups. :P

Open
Modifications.english.php (the location of this file is Themes/default/languages)

Making sure no text strings like those you posted are;
above <?php (which needs to be the first thing in the file)
below ?> (which needs to be the last thing in the file [on a line of its own]

if your using utf8, you will need to do the same for
Modifications.english-utf8.php



done , all ok ! thnx !

(by the way , i installed 4 of the mods you posted yesterday and they are all great ! my congrats man !!!)

Badboy

Nice mod.

Here are the Turkish and Turkish-utf8 translations


Code (Turkish) Select
$txt['codeselectall'] = 'Hepsini Seç';
$txt['codecopytoclipboard'] = 'Panoya Kopyala';
$txt['codedivider'] = '|';


Code (Turkish-utf8) Select
$txt['codeselectall'] = 'Hepsini Seç';
$txt['codecopytoclipboard'] = 'Panoya Kopyala';
$txt['codedivider'] = '|';
Nothing is true, everything is permitted.

EgAr

Hi, for

spanish  ,  spanish_es , spanish-utf8 , spanish_es-utf8


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




Saludos   :D

karlbenson

gracias.

I've now uploaded v1.1. to add all the languages I've had submitted.

1.1 - 20th October 2007
o Added languages
- Turkish/Turkish-utf8 (Thanks to Kapadokyali & BadBoy)
- English_British/English_British-utf8
- Spanish/Spanish-utf8 (Thanks to EgAr)
- Spanish_es/Spanish_es-utf8 (Thanks to EgAr)

MinasC

here is the greek translation :

$txt['codeselectall'] = 'Επιλογή Όλων';
$txt['codecopytoclipboard'] = 'Αντιγραφή στον Πίνακα';
$txt['codedivider'] = '|';

karlbenson

Thanks MinasC

I've uploaded v1.2 with theGreek Language strings inside

1.2 - 22nd November 2007
o Added Greek/Greek-utf8 (Thanks to MinasC)

MinasC


falguni1


karlbenson

It adds two links to the 'code' box.

One to 'select all' the contents of the code box.
Second to Copy it to Clipboard (so you can paste it elsewhere)

falguni1


Advertisement: