Commit 21bf08df authored by Luc Didry's avatar Luc Didry

Add Copy-to-clipboard button

parent 9823a5a8
# Lstu
# Copyright (C) 2013 - 2015 Luc Didry
# This file is distributed under the same license as the Lstu package.
# Luc Didry <luc@didry.org>, 2015.
#
#
# Translators:
# Luc Didry <luc@didry.org>, 2015
msgid ""
msgstr ""
"Project-Id-Version: Lstu - 0.04\n"
"Project-Id-Version: Lstu\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2015-06-10 07:44+0100\n"
"PO-Revision-Date: 2015-07-31 07:58+0000\n"
"Last-Translator: Luc Didry <luc@didry.org>\n"
"Language-Team: English (http://www.transifex.com/projects/p/lstu/language/en/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Last-Translator: Luc Didry <luc@didry.org>\n"
"Language-Team: Luc Didry <admin@lstu.fr>\n"
"Language: en\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.6.10\n"
"X-Poedit-SourceCharset: UTF-8\n"
#. ($url)
#: lib/Lstu.pm:172
#: lib/Lstu.pm:175
msgid "%1 is not a valid URL."
msgstr ""
msgstr "%1 is not a valid URL."
#: templates/layouts/default.html.ep:27
#: templates/layouts/default.html.ep:28
msgid "About"
msgstr ""
msgstr "About"
#: templates/stats.html.ep:12 templates/stats.html.ep:13
msgid "Admin password"
msgstr ""
msgstr "Admin password"
#: lib/Lstu.pm:288
#: lib/Lstu.pm:290
msgid "Bad password"
msgstr "Bad password"
#: templates/index.html.ep:20
msgid "Copy to clipboard"
msgstr ""
#: templates/stats.html.ep:29
msgid "Counter"
msgstr ""
msgstr "Counter"
#: templates/stats.html.ep:30
msgid "Created"
msgstr ""
msgstr "Created"
#: templates/api.html.ep:15 templates/index.html.ep:10
#: templates/index.html.ep:9
#: templates/api.html.ep:15 templates/index.html.ep:10 templates/index.html.ep:9
msgid "Custom shortened text"
msgstr ""
msgstr "Custom shortened text"
#: templates/api.html.ep:21 templates/api.html.ep:39
msgid "Failure reason"
msgstr ""
msgstr "Failure reason"
#: templates/index.html.ep:12 templates/stats.html.ep:16
msgid "Go!"
msgstr ""
msgstr "Go!"
#: templates/index.html.ep:52
msgid "Hit Enter, then Ctrl+C to copy the short link"
msgstr "Hit Enter, then Ctrl+C to copy the short link"
#: templates/api.html.ep:16
msgid ""
"If equal to \"json\", response will be in JSON format, HTML format otherwise"
msgstr ""
msgid "If equal to \"json\", response will be in JSON format, HTML format otherwise"
msgstr "If equal to \"json\", response will be in JSON format, HTML format otherwise"
#: templates/api.html.ep:21 templates/api.html.ep:39
msgid "JSON: failure"
msgstr ""
msgstr "JSON: failure"
#: templates/api.html.ep:20 templates/api.html.ep:38
msgid "JSON: success"
msgstr ""
msgstr "JSON: success"
#: templates/layouts/default.html.ep:26
#: templates/layouts/default.html.ep:27
msgid "License:"
msgstr ""
msgstr "License:"
#: templates/stats.html.ep:9
msgid "Logout from admin stats"
msgstr ""
msgstr "Logout from admin stats"
#: templates/stats.html.ep:53
msgid "Next"
msgstr ""
msgstr "Next"
#. ($c->config('contact')
#: lib/Lstu.pm:165
msgid ""
"No shortened URL available. Please retry or contact the administrator at %1. "
"Your URL to shorten: %2"
msgstr ""
#: lib/Lstu.pm:168
msgid "No shortened URL available. Please retry or contact the administrator at %1. Your URL to shorten: %2"
msgstr "No shortened URL available. Please retry or contact the administrator at %1. Your URL to shorten: %2"
#: templates/api.html.ep:12
msgid "Parameters:"
msgstr ""
msgstr "Parameters:"
#: templates/stats.html.ep:51
msgid "Previous"
msgstr ""
msgstr "Previous"
#: templates/api.html.ep:22
msgid "Response for HTML format"
msgstr ""
msgstr "Response for HTML format"
#: templates/api.html.ep:18 templates/api.html.ep:27 templates/api.html.ep:36
msgid "Response:"
msgstr ""
msgstr "Response:"
#: templates/stats.html.ep:28
msgid "Shortened URL"
msgstr ""
msgstr "Shortened URL"
#: templates/layouts/default.html.ep:29 templates/stats.html.ep:4
#: templates/layouts/default.html.ep:30 templates/stats.html.ep:4
msgid "Statistics"
msgstr ""
msgstr "Statistics"
#. ($c->url_for('/')
#: lib/Lstu.pm:314
#: lib/Lstu.pm:316
msgid "The shortened URL %1 doesn't exist."
msgstr ""
msgstr "The shortened URL %1 doesn't exist."
#. ($custom_url)
#: lib/Lstu.pm:135
#: lib/Lstu.pm:138
msgid "The shortened text (%1) is already used. Please choose another one."
msgstr ""
msgstr "The shortened text (%1) is already used. Please choose another one."
#. ($url)
#: lib/Lstu.pm:133
msgid ""
"The shortened text can contain only numbers, letters and the - and _ "
"character, can't be \"a\", \"api\" or \"stats\" or end with \".json\". Your "
"URL to shorten: %1"
msgstr ""
#: lib/Lstu.pm:136
msgid "The shortened text can contain only numbers, letters and the - and _ character, can't be \"a\", \"api\" or \"stats\" or end with \".json\". Your URL to shorten: %1"
msgstr "The shortened text can contain only numbers, letters and the - and _ character, can't be \"a\", \"api\" or \"stats\" or end with \".json\". Your URL to shorten: %1"
#: templates/stats.html.ep:27
msgid "URL"
msgstr ""
msgstr "URL"
#: templates/api.html.ep:14 templates/index.html.ep:5
#: templates/index.html.ep:6
#: templates/api.html.ep:14 templates/index.html.ep:5 templates/index.html.ep:6
msgid "URL to shorten"
msgstr ""
msgstr "URL to shorten"
#: templates/api.html.ep:22
msgid ""
"You will be redirected to the Lstu interface with a message giving the "
"shortened URL"
msgstr ""
msgid "You will be redirected to the Lstu interface with a message giving the shortened URL"
msgstr "You will be redirected to the Lstu interface with a message giving the shortened URL"
#: templates/api.html.ep:30
msgid ""
"You will be redirected to the targeted URL or to the Lstu interface with a "
"message giving the failure reason"
msgstr ""
msgid "You will be redirected to the targeted URL or to the Lstu interface with a message giving the failure reason"
msgstr "You will be redirected to the targeted URL or to the Lstu interface with a message giving the failure reason"
#: templates/api.html.ep:14
msgid "mandatory"
msgstr ""
msgstr "mandatory"
#: templates/api.html.ep:15 templates/api.html.ep:16
msgid "optional"
msgstr ""
msgstr "optional"
#: templates/api.html.ep:25 templates/api.html.ep:34
msgid "shortened_url"
msgstr ""
msgstr "shortened_url"
# Lstu
# Copyright (C) 2013 - 2015 Luc Didry
# This file is distributed under the same license as the Lstu package.
#
#
# Translators:
# Translators:
# Luc Didry <luc@didry.org>, 2015
# Luc Didry <luc@didry.org>, 2015
msgid ""
msgstr ""
"Project-Id-Version: Lstu\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2015-06-10 07:43+0100\n"
"PO-Revision-Date: 2015-07-31 08:06+0000\n"
"Last-Translator: Luc Didry <luc@didry.org>\n"
"Language-Team: French (http://www.transifex.com/projects/p/lstu/language/"
"fr/)\n"
"Language-Team: French (http://www.transifex.com/projects/p/lstu/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
......@@ -21,11 +22,11 @@ msgstr ""
"X-Poedit-SourceCharset: UTF-8\n"
#. ($url)
#: lib/Lstu.pm:172
#: lib/Lstu.pm:175
msgid "%1 is not a valid URL."
msgstr "%1 n’est pas une URL valide."
#: templates/layouts/default.html.ep:27
#: templates/layouts/default.html.ep:28
msgid "About"
msgstr "À propos"
......@@ -33,10 +34,14 @@ msgstr "À propos"
msgid "Admin password"
msgstr "Mot de passe administrateur"
#: lib/Lstu.pm:288
#: lib/Lstu.pm:290
msgid "Bad password"
msgstr "Mot de passe incorrect"
#: templates/index.html.ep:20
msgid "Copy to clipboard"
msgstr "Copier dans le presse-papier"
#: templates/stats.html.ep:29
msgid "Counter"
msgstr "Compteur"
......@@ -58,12 +63,14 @@ msgstr "Raison de l’échec"
msgid "Go!"
msgstr "Allons-y !"
#: templates/index.html.ep:52
msgid "Hit Enter, then Ctrl+C to copy the short link"
msgstr "Appuyez sur Entrée puis faites Ctrl+C pour copier le lien"
#: templates/api.html.ep:16
msgid ""
"If equal to \"json\", response will be in JSON format, HTML format otherwise"
msgstr ""
"Si égal à \"json\", la réponse sera au format JSON, sinon ce sera une "
"réponse en HTML"
msgstr "Si égal à \"json\", la réponse sera au format JSON, sinon ce sera une réponse en HTML"
#: templates/api.html.ep:21 templates/api.html.ep:39
msgid "JSON: failure"
......@@ -73,7 +80,7 @@ msgstr "JSON : échec"
msgid "JSON: success"
msgstr "JSON : succès"
#: templates/layouts/default.html.ep:26
#: templates/layouts/default.html.ep:27
msgid "License:"
msgstr "Licence :"
......@@ -86,13 +93,11 @@ msgid "Next"
msgstr "Suivant"
#. ($c->config('contact')
#: lib/Lstu.pm:165
#: lib/Lstu.pm:168
msgid ""
"No shortened URL available. Please retry or contact the administrator at %1. "
"Your URL to shorten: %2"
msgstr ""
"Il n’y a plus d’URL raccourcie disponible. Veuillez réessayer ou contactez "
"l’administrateur sur %1. Rappel de l’URL à raccourcir : %2"
"No shortened URL available. Please retry or contact the administrator at %1."
" Your URL to shorten: %2"
msgstr "Il n’y a plus d’URL raccourcie disponible. Veuillez réessayer ou contactez l’administrateur sur %1. Rappel de l’URL à raccourcir : %2"
#: templates/api.html.ep:12
msgid "Parameters:"
......@@ -114,31 +119,27 @@ msgstr "Réponse :"
msgid "Shortened URL"
msgstr "URL raccourcie"
#: templates/layouts/default.html.ep:29 templates/stats.html.ep:4
#: templates/layouts/default.html.ep:30 templates/stats.html.ep:4
msgid "Statistics"
msgstr "Statistiques"
#. ($c->url_for('/')
#: lib/Lstu.pm:314
#: lib/Lstu.pm:316
msgid "The shortened URL %1 doesn't exist."
msgstr "L’URL raccourcie %1 n’existe pas"
#. ($custom_url)
#: lib/Lstu.pm:135
#: lib/Lstu.pm:138
msgid "The shortened text (%1) is already used. Please choose another one."
msgstr ""
"Le texte du raccourci (%1) est déjà utilisé. Veuillez en choisir un autre"
msgstr "Le texte du raccourci (%1) est déjà utilisé. Veuillez en choisir un autre"
#. ($url)
#: lib/Lstu.pm:133
#: lib/Lstu.pm:136
msgid ""
"The shortened text can contain only numbers, letters and the - and _ "
"character, can't be \"a\", \"api\" or \"stats\" or end with \".json\". Your "
"URL to shorten: %1"
msgstr ""
"Le texte du raccourci ne doit contenir que des chiffres, des lettres et les "
"caractères - et _, ne peut être \"a\", \"api\" ou \"stats\" ou se terminer "
"par \".json\". Rappel de l’URL à raccourcir : %1"
msgstr "Le texte du raccourci ne doit contenir que des chiffres, des lettres et les caractères - et _, ne peut être \"a\", \"api\" ou \"stats\" ou se terminer par \".json\". Rappel de l’URL à raccourcir : %1"
#: templates/stats.html.ep:27
msgid "URL"
......@@ -153,17 +154,13 @@ msgstr "URL à raccourcir"
msgid ""
"You will be redirected to the Lstu interface with a message giving the "
"shortened URL"
msgstr ""
"Vous aurez l’interface normale de Lstu avec un message indiquant l’URL "
"raccourcie"
msgstr "Vous aurez l’interface normale de Lstu avec un message indiquant l’URL raccourcie"
#: templates/api.html.ep:30
msgid ""
"You will be redirected to the targeted URL or to the Lstu interface with a "
"message giving the failure reason"
msgstr ""
"Vous serez redirigé vers l’URL cible ou vers la page d’accueil de Lstu avec "
"un message indiquant la raison de l’échec"
msgstr "Vous serez redirigé vers l’URL cible ou vers la page d’accueil de Lstu avec un message indiquant la raison de l’échec"
#: templates/api.html.ep:14
msgid "mandatory"
......
/*
Animation example, for spinners
*/
.animate-spin {
-moz-animation: spin 2s infinite linear;
-o-animation: spin 2s infinite linear;
-webkit-animation: spin 2s infinite linear;
animation: spin 2s infinite linear;
display: inline-block;
}
@-moz-keyframes spin {
0% {
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-moz-transform: rotate(359deg);
-o-transform: rotate(359deg);
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
@-webkit-keyframes spin {
0% {
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-moz-transform: rotate(359deg);
-o-transform: rotate(359deg);
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
@-o-keyframes spin {
0% {
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-moz-transform: rotate(359deg);
-o-transform: rotate(359deg);
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
@-ms-keyframes spin {
0% {
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-moz-transform: rotate(359deg);
-o-transform: rotate(359deg);
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
@keyframes spin {
0% {
-moz-transform: rotate(0deg);
-o-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-moz-transform: rotate(359deg);
-o-transform: rotate(359deg);
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
.icon-clipboard:before { content: '\e800'; } /* '' */
\ No newline at end of file
This diff is collapsed.
.icon-clipboard { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe800;&nbsp;'); }
\ No newline at end of file
[class^="icon-"], [class*=" icon-"] {
font-family: 'fontelico';
font-style: normal;
font-weight: normal;
/* fix buttons height */
line-height: 1em;
/* you can be more comfortable with increased icons size */
/* font-size: 120%; */
}
.icon-clipboard { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xe800;&nbsp;'); }
\ No newline at end of file
@font-face {
font-family: 'fontelico';
src: url('../font/fontelico.eot?90041976');
src: url('../font/fontelico.eot?90041976#iefix') format('embedded-opentype'),
url('../font/fontelico.woff?90041976') format('woff'),
url('../font/fontelico.ttf?90041976') format('truetype'),
url('../font/fontelico.svg?90041976#fontelico') format('svg');
font-weight: normal;
font-style: normal;
}
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
/*
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'fontelico';
src: url('../font/fontelico.svg?90041976#fontelico') format('svg');
}
}
*/
[class^="icon-"]:before, [class*=" icon-"]:before {
font-family: "fontelico";
font-style: normal;
font-weight: normal;
speak: none;
display: inline-block;
text-decoration: inherit;
width: 1em;
margin-right: .2em;
text-align: center;
/* opacity: .8; */
/* For safety - reset parent styles, that can break glyph codes*/
font-variant: normal;
text-transform: none;
/* fix buttons height, for twitter bootstrap */
line-height: 1em;
/* Animation center compensation - margins should be symmetric */
/* remove if not needed */
margin-left: .2em;
/* you can be more comfortable with increased icons size */
/* font-size: 120%; */
/* Font smoothing. That was taken from TWBS */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* Uncomment for 3D effect */
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
}
.icon-clipboard:before { content: '\e800'; } /* '' */
\ No newline at end of file
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Copyright (C) 2015 by original authors @ fontello.com</metadata>
<defs>
<font id="fontelico" horiz-adv-x="1000" >
<font-face font-family="fontelico" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
<missing-glyph horiz-adv-x="1000" />
<glyph glyph-name="clipboard" unicode="&#xe800;" d="m0-150l0 904 225 0 0-64-161 0 0-774 579 0 0 774-161 0 0 64 225 0 0-904-707 0z m129 129l0 31 31 0 0-31-31 0z m0 121l0 31 31 0 0-31-31 0z m0 121l0 31 31 0 0-31-31 0z m0 121l0 32 31 0 0-32-31 0z m0 121l0 32 31 0 0-32-31 0z m0 96l0 94 129 0 0 97q0 41 27 71t69 29 69-30 28-70q0-56-2-97l129 0 0-94-449 0z m96-582l0 33 353 0 0-33-353 0z m0 121l0 33 353 0 0-33-353 0z m0 121l0 33 353 0 0-33-353 0z m0 121l0 34 353 0 0-34-353 0z m0 121l0 34 353 0 0-34-353 0z m97 260q0-14 9-22t23-9 22 9 9 22-9 24-22 9-23-9-9-24z" horiz-adv-x="707" />
</font>
</defs>
</svg>
\ No newline at end of file
{
"name": "fontelico",
"css_prefix_text": "icon-",
"css_use_suffix": false,
"hinting": true,
"units_per_em": 1000,
"ascent": 850,
"glyphs": [
{
"uid": "c9bef3dc67fea47e94c4a5030ea64dad",
"css": "clipboard",
"code": 59392,
"src": "elusive"
}
]
}
\ No newline at end of file
......@@ -13,10 +13,54 @@
</form>
% if (defined(flash('short')) && defined(flash('url'))) {
<h3 class="alert alert-success">
<%= link_to flash('url') => begin %><%= flash('url') %><%= end %></a> =&gt;
<%= link_to flash('short') => begin %><%= flash('short') %><%= end %>
<h3 class="alert alert-success form-inline">
<div class="form-group">
<label><%= link_to flash('url') => begin %><%= flash('url') %><%= end %></a></label>
<br> =&gt; <input id="input-short" value="<%== flash('short') %>" class="form-control">
<span id="js" class="hidden"><a href="#" id="clipboard" class="btn btn-default" title="<%= l('Copy to clipboard') %>"><span class="icon icon-clipboard"></span></a><span>
</div>
</h3>
%= javascript begin
var j = document.getElementById('js');
j.classList.remove('hidden');
// Code from http://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript
function copyTextToClipboard(text) {
var textArea = document.createElement("textarea");
textArea.style.position = 'fixed';
textArea.style.top = 0;
textArea.style.left = 0;
textArea.style.width = '2em';
textArea.style.height = '2em';
textArea.style.padding = 0;
textArea.style.border = 'none';
textArea.style.outline = 'none';
textArea.style.boxShadow = 'none';
textArea.style.background = 'transparent';
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
console.log('Copying text command was ' + msg);
} catch (err) {
var myInput = document.getElementById('input-short');
myInput.focus();
myInput.setSelectionRange(0, 9999);
alert('<%= l('Hit Enter, then Ctrl+C to copy the short link') %>');
}
document.body.removeChild(textArea);
}
var copyBtn = document.getElementById('clipboard');
copyBtn.addEventListener('click', function(event) {
copyTextToClipboard('<%= flash('short') %>');
});
% end
% }
% if (defined(flash('msg'))) {
<h3 class="alert alert-danger"><%= flash('msg') %><h3>
......
......@@ -5,6 +5,7 @@
<title><%= title %></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
%= stylesheet 'css/bootstrap.min.css', media => 'screen'
%= stylesheet 'css/fontelico.css'
%= stylesheet begin
body {
padding-top: 40px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment