mirror of
https://framagit.org/fiat-tux/hat-softwares/lutim.git
synced 2026-06-20 01:54:50 +02:00
Fix #78 Add CSP Header
+ update morris and raphael graph libraries + some changes in "myfiles" table
This commit is contained in:
@@ -13,6 +13,7 @@ themes/*
|
||||
themes/default/templates/data.html.ep
|
||||
themes/default/templates/raw.html.ep
|
||||
themes/default/templates/stats.json.ep
|
||||
themes/default/templates/partial/raw.js.ep
|
||||
tmp/*
|
||||
.zanata-cache/*
|
||||
cover_db/*
|
||||
|
||||
@@ -7,6 +7,7 @@ Revision history for Lutim
|
||||
- Use Mojolicious::Plugin::Chi
|
||||
- Gzip static assets with Mojolicious::Plugin::GzipStatic
|
||||
- Fix scroll-to-top when clicking on delete image
|
||||
- Add CSP header
|
||||
|
||||
0.10.4 2018-05-07
|
||||
- Fix bug in cache system that would allow someone to view an image with an incorrect decryption key
|
||||
|
||||
@@ -10,6 +10,7 @@ minify:
|
||||
@cd ./themes/default/public/css/ && cat bootstrap.min.css fontello.css hennypenny.css lutim.css toastify.css | csso > common.min.css
|
||||
@cd ./themes/default/public/css/ && cat animation.css uploader.css markdown.css | csso > not_stats.min.css
|
||||
@cd ./themes/default/public/css/ && cat photoswipe.css default-skin/default-skin.css | csso > gallery.min.css
|
||||
@cd ./themes/default/public/css/ && cat twitter.css | csso > twitter.min.css
|
||||
|
||||
locales:
|
||||
$(XGETTEXT) $(EXTRACTDIR) -o $(POT) 2>/dev/null
|
||||
|
||||
@@ -8,6 +8,7 @@ requires 'Mojolicious::Plugin::I18N';
|
||||
requires 'Mojolicious::Plugin::DebugDumperHelper';
|
||||
requires 'Mojolicious::Plugin::StaticCache';
|
||||
requires 'Mojolicious::Plugin::GzipStatic';
|
||||
requires 'Mojolicious::Plugin::CSPHeader';
|
||||
requires 'Text::Unidecode';
|
||||
requires 'DateTime';
|
||||
requires 'Filesys::DiskUsage';
|
||||
|
||||
@@ -1926,6 +1926,13 @@ DISTRIBUTIONS
|
||||
Test::More 0
|
||||
Test::Output 1
|
||||
perl 5.010001
|
||||
Mojolicious-Plugin-CSPHeader-0.03
|
||||
pathname: L/LD/LDIDRY/Mojolicious-Plugin-CSPHeader-0.03.tar.gz
|
||||
provides:
|
||||
Mojolicious::Plugin::CSPHeader 0.03
|
||||
requirements:
|
||||
ExtUtils::MakeMaker 0
|
||||
Mojolicious 7.75
|
||||
Mojolicious-Plugin-DebugDumperHelper-0.03
|
||||
pathname: L/LD/LDIDRY/Mojolicious-Plugin-DebugDumperHelper-0.03.tar.gz
|
||||
provides:
|
||||
|
||||
+2
-2
@@ -105,8 +105,8 @@ sub startup {
|
||||
# Static assets gzipping
|
||||
$self->plugin('GzipStatic');
|
||||
|
||||
# Cache static files
|
||||
$self->plugin('StaticCache' => { even_in_dev => 1 });
|
||||
# Headers
|
||||
$self->plugin('Lutim::Plugin::Headers');
|
||||
|
||||
# Helpers
|
||||
$self->plugin('Lutim::Plugin::Helpers');
|
||||
|
||||
@@ -151,7 +151,10 @@ sub run {
|
||||
% l('1 year'),
|
||||
% l('Total')
|
||||
% );
|
||||
<script>
|
||||
$dom2
|
||||
EOF
|
||||
|
||||
my $js = <<EOF;
|
||||
var enabled_donut = {
|
||||
element: 'raw-enabled-holder',
|
||||
data: [
|
||||
@@ -186,13 +189,12 @@ var disabled_donut = {
|
||||
'#455ac3',
|
||||
]
|
||||
};
|
||||
</script>
|
||||
$dom2
|
||||
EOF
|
||||
|
||||
Mojo::File->new('themes/'.$config->{theme}.'/templates/stats.json.ep')->spurt(encode_json($stats));
|
||||
Mojo::File->new('themes/'.$config->{theme}.'/templates/data.html.ep')->spurt($dom);
|
||||
Mojo::File->new('themes/'.$config->{theme}.'/templates/raw.html.ep')->spurt(encode('UTF-8', $dom2));
|
||||
Mojo::File->new('themes/'.$config->{theme}.'/templates/partial/raw.js.ep')->spurt(encode('UTF-8', $js));
|
||||
}
|
||||
|
||||
=encoding utf8
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package Lutim::Plugin::Headers;
|
||||
use Mojo::Base 'Mojolicious::Plugin';
|
||||
|
||||
sub register {
|
||||
my ($self, $app) = @_;
|
||||
|
||||
# Assets Cache headers
|
||||
$app->plugin('StaticCache' => { even_in_dev => 1 });
|
||||
|
||||
# Add CSP Header
|
||||
if (!defined($app->config('csp')) || (defined($app->config('csp')) && $app->config('csp') ne '')) {
|
||||
my $directives = {
|
||||
'default-src' => "'none'",
|
||||
'script-src' => "'self' 'unsafe-eval'",
|
||||
'style-src' => "'self' 'unsafe-inline'",
|
||||
'connect-src' => "'self'",
|
||||
'img-src' => "'self' data:",
|
||||
'font-src' => "'self'",
|
||||
'form-action' => "'self'",
|
||||
'base-uri' => "'self'",
|
||||
};
|
||||
|
||||
my $frame_ancestors = '';
|
||||
#$frame_ancestors = "'none'" if $app->config('x_frame_options') eq 'DENY';
|
||||
#$frame_ancestors = "'self'" if $app->config('x_frame_options') eq 'SAMEORIGIN';
|
||||
#if ($app->config('x_frame_options') =~ m#^ALLOW-FROM#) {
|
||||
# $frame_ancestors = $app->config('x_frame_options');
|
||||
# $frame_ancestors =~ s#ALLOW-FROM +##;
|
||||
#}
|
||||
$directives->{'frame-ancestors'} = $frame_ancestors if $frame_ancestors;
|
||||
|
||||
$app->plugin('CSPHeader',
|
||||
csp => $app->config('csp'),
|
||||
directives => $directives
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
+2
-2
@@ -69,8 +69,8 @@ sub startup {
|
||||
# Static assets gzipping
|
||||
$self->plugin('GzipStatic');
|
||||
|
||||
# Cache static files
|
||||
$self->plugin('StaticCache' => { even_in_dev => 1 });
|
||||
# Headers
|
||||
$self->plugin('Lutim::Plugin::Headers');
|
||||
|
||||
# Helpers
|
||||
$self->plugin('Lutim::Plugin::Helpers');
|
||||
|
||||
@@ -205,6 +205,16 @@
|
||||
# optional, default is 0
|
||||
#quiet_logs => 0,
|
||||
|
||||
# Content-Security-Policy header that will be sent by Lstu
|
||||
# Set to '' to disable CSP header
|
||||
# https://content-security-policy.com/ provides a good documentation about CSP.
|
||||
# https://report-uri.com/home/generate provides a tool to generate a CSP header.
|
||||
# optional, default is "base-uri 'self'; connect-src 'self'; default-src 'none'; font-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'"
|
||||
# NB: unsafe-inline for script-src and style-src are here only because morris,
|
||||
# the graph library used in the stats page requires it
|
||||
# the default value is good for `default` theme
|
||||
#csp => "base-uri 'self'; connect-src 'self'; default-src 'none'; font-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'",
|
||||
|
||||
##########################
|
||||
# Lutim cron jobs settings
|
||||
##########################
|
||||
|
||||
@@ -63,7 +63,8 @@ BEGIN {
|
||||
my $t = Test::Mojo->new('Lutim');
|
||||
$t->get_ok('/')
|
||||
->status_is(200)
|
||||
->content_like(qr/Let's Upload That IMage/i);
|
||||
->content_like(qr/Let's Upload That IMage/i)
|
||||
->header_is('Content-Security-Policy' => "base-uri 'self'; connect-src 'self'; default-src 'none'; font-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'");
|
||||
|
||||
# Gzip static assets
|
||||
$t->get_ok('/css/lutim.css')
|
||||
|
||||
@@ -19,7 +19,7 @@ msgstr ""
|
||||
#. (30)
|
||||
#. ($delay)
|
||||
#. (config('max_delay')
|
||||
#: lib/Lutim/Command/cron/stats.pm:149 lib/Lutim/Command/cron/stats.pm:150 lib/Lutim/Command/cron/stats.pm:160 lib/Lutim/Command/cron/stats.pm:161 lib/Lutim/Command/cron/stats.pm:177 lib/Lutim/Command/cron/stats.pm:178 themes/default/templates/partial/for_my_delay.html.ep:13 themes/default/templates/partial/for_my_delay.html.ep:14 themes/default/templates/partial/for_my_delay.html.ep:4 themes/default/templates/partial/lutim.js.ep:142 themes/default/templates/partial/lutim.js.ep:151 themes/default/templates/partial/lutim.js.ep:152 themes/default/templates/raw.html.ep:19 themes/default/templates/raw.html.ep:20 themes/default/templates/raw.html.ep:36 themes/default/templates/raw.html.ep:37 themes/default/templates/raw.html.ep:8 themes/default/templates/raw.html.ep:9
|
||||
#: lib/Lutim/Command/cron/stats.pm:149 lib/Lutim/Command/cron/stats.pm:150 lib/Lutim/Command/cron/stats.pm:163 lib/Lutim/Command/cron/stats.pm:164 lib/Lutim/Command/cron/stats.pm:180 lib/Lutim/Command/cron/stats.pm:181 themes/default/templates/partial/for_my_delay.html.ep:13 themes/default/templates/partial/for_my_delay.html.ep:14 themes/default/templates/partial/for_my_delay.html.ep:4 themes/default/templates/partial/lutim.js.ep:140 themes/default/templates/partial/lutim.js.ep:149 themes/default/templates/partial/lutim.js.ep:150 themes/default/templates/partial/raw.js.ep:23 themes/default/templates/partial/raw.js.ep:24 themes/default/templates/partial/raw.js.ep:6 themes/default/templates/partial/raw.js.ep:7 themes/default/templates/raw.html.ep:8 themes/default/templates/raw.html.ep:9
|
||||
msgid "%1 days"
|
||||
msgstr ""
|
||||
|
||||
@@ -32,15 +32,15 @@ msgstr ""
|
||||
msgid "-or-"
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lutim.pm:217 lib/Lutim/Command/cron/stats.pm:151 lib/Lutim/Command/cron/stats.pm:162 lib/Lutim/Command/cron/stats.pm:179 themes/default/templates/index.html.ep:5 themes/default/templates/raw.html.ep:10 themes/default/templates/raw.html.ep:21 themes/default/templates/raw.html.ep:38
|
||||
#: lib/Lutim.pm:217 lib/Lutim/Command/cron/stats.pm:151 lib/Lutim/Command/cron/stats.pm:165 lib/Lutim/Command/cron/stats.pm:182 themes/default/templates/index.html.ep:5 themes/default/templates/partial/raw.js.ep:25 themes/default/templates/partial/raw.js.ep:8 themes/default/templates/raw.html.ep:10
|
||||
msgid "1 year"
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lutim.pm:216 lib/Lutim/Command/cron/stats.pm:148 lib/Lutim/Command/cron/stats.pm:159 lib/Lutim/Command/cron/stats.pm:176 themes/default/templates/index.html.ep:4 themes/default/templates/partial/for_my_delay.html.ep:13 themes/default/templates/partial/lutim.js.ep:151 themes/default/templates/raw.html.ep:18 themes/default/templates/raw.html.ep:35 themes/default/templates/raw.html.ep:7
|
||||
#: lib/Lutim.pm:216 lib/Lutim/Command/cron/stats.pm:148 lib/Lutim/Command/cron/stats.pm:162 lib/Lutim/Command/cron/stats.pm:179 themes/default/templates/index.html.ep:4 themes/default/templates/partial/for_my_delay.html.ep:13 themes/default/templates/partial/lutim.js.ep:149 themes/default/templates/partial/raw.js.ep:22 themes/default/templates/partial/raw.js.ep:5 themes/default/templates/raw.html.ep:7
|
||||
msgid "24 hours"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/partial/myfiles.js.ep:57
|
||||
#: themes/default/templates/partial/myfiles.js.ep:62
|
||||
msgid ": Error while trying to get the counter."
|
||||
msgstr ""
|
||||
|
||||
@@ -76,15 +76,15 @@ msgstr ""
|
||||
msgid "Contributors"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/partial/common.js.ep:96
|
||||
#: themes/default/templates/partial/common.js.ep:75 themes/default/templates/partial/common.js.ep:95
|
||||
msgid "Copied to clipboard"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/partial/lutim.js.ep:218 themes/default/templates/partial/lutim.js.ep:273 themes/default/templates/partial/lutim.js.ep:351
|
||||
#: themes/default/templates/partial/lutim.js.ep:215 themes/default/templates/partial/lutim.js.ep:276 themes/default/templates/partial/lutim.js.ep:361
|
||||
msgid "Copy all view links to clipboard"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/index.html.ep:18 themes/default/templates/index.html.ep:36 themes/default/templates/index.html.ep:69 themes/default/templates/index.html.ep:77 themes/default/templates/index.html.ep:85 themes/default/templates/index.html.ep:93 themes/default/templates/myfiles.html.ep:20 themes/default/templates/myfiles.html.ep:38 themes/default/templates/partial/common.js.ep:177 themes/default/templates/partial/lutim.js.ep:108 themes/default/templates/partial/lutim.js.ep:123 themes/default/templates/partial/lutim.js.ep:82 themes/default/templates/partial/lutim.js.ep:94
|
||||
#: themes/default/templates/index.html.ep:18 themes/default/templates/index.html.ep:36 themes/default/templates/index.html.ep:69 themes/default/templates/index.html.ep:77 themes/default/templates/index.html.ep:85 themes/default/templates/index.html.ep:93 themes/default/templates/myfiles.html.ep:20 themes/default/templates/myfiles.html.ep:38 themes/default/templates/partial/common.js.ep:168 themes/default/templates/partial/lutim.js.ep:106 themes/default/templates/partial/lutim.js.ep:121 themes/default/templates/partial/lutim.js.ep:80 themes/default/templates/partial/lutim.js.ep:92 themes/default/templates/partial/myfiles.js.ep:30
|
||||
msgid "Copy to clipboard"
|
||||
msgstr ""
|
||||
|
||||
@@ -100,7 +100,7 @@ msgstr ""
|
||||
msgid "Delay repartition chart for enabled images"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/index.html.ep:115 themes/default/templates/index.html.ep:147 themes/default/templates/index.html.ep:178 themes/default/templates/myfiles.html.ep:53 themes/default/templates/partial/lutim.js.ep:163
|
||||
#: themes/default/templates/index.html.ep:115 themes/default/templates/index.html.ep:147 themes/default/templates/index.html.ep:178 themes/default/templates/myfiles.html.ep:53 themes/default/templates/partial/lutim.js.ep:161
|
||||
msgid "Delete at first view?"
|
||||
msgstr ""
|
||||
|
||||
@@ -112,7 +112,7 @@ msgstr ""
|
||||
msgid "Deleted images in 30 days"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/index.html.ep:98 themes/default/templates/myfiles.html.ep:56 themes/default/templates/partial/common.js.ep:169 themes/default/templates/partial/common.js.ep:172
|
||||
#: themes/default/templates/index.html.ep:98 themes/default/templates/myfiles.html.ep:56 themes/default/templates/partial/common.js.ep:160 themes/default/templates/partial/common.js.ep:163
|
||||
msgid "Deletion link"
|
||||
msgstr ""
|
||||
|
||||
@@ -120,7 +120,7 @@ msgstr ""
|
||||
msgid "Download all images"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/index.html.ep:81 themes/default/templates/index.html.ep:83 themes/default/templates/partial/lutim.js.ep:100 themes/default/templates/partial/lutim.js.ep:104
|
||||
#: themes/default/templates/index.html.ep:81 themes/default/templates/index.html.ep:83 themes/default/templates/partial/lutim.js.ep:102 themes/default/templates/partial/lutim.js.ep:98
|
||||
msgid "Download link"
|
||||
msgstr ""
|
||||
|
||||
@@ -140,7 +140,7 @@ msgstr ""
|
||||
msgid "Encrypt the image (Lutim does not keep the key)."
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/partial/lutim.js.ep:47
|
||||
#: themes/default/templates/partial/lutim.js.ep:45
|
||||
msgid "Error while trying to modify the image."
|
||||
msgstr ""
|
||||
|
||||
@@ -168,11 +168,11 @@ msgstr ""
|
||||
msgid "Gallery link"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/partial/common.js.ep:105 themes/default/templates/partial/common.js.ep:122
|
||||
#: themes/default/templates/partial/common.js.ep:116 themes/default/templates/partial/common.js.ep:98
|
||||
msgid "Hit Ctrl+C, then Enter to copy the short link"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/layouts/default.html.ep:48
|
||||
#: themes/default/templates/layouts/default.html.ep:47
|
||||
msgid "Homepage"
|
||||
msgstr ""
|
||||
|
||||
@@ -200,7 +200,7 @@ msgstr ""
|
||||
msgid "Image delay"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/partial/common.js.ep:142
|
||||
#: themes/default/templates/partial/common.js.ep:139
|
||||
msgid "Image deleted"
|
||||
msgstr ""
|
||||
|
||||
@@ -240,7 +240,7 @@ msgstr ""
|
||||
msgid "Language"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/index.html.ep:118 themes/default/templates/index.html.ep:166 themes/default/templates/index.html.ep:206 themes/default/templates/partial/lutim.js.ep:167
|
||||
#: themes/default/templates/index.html.ep:118 themes/default/templates/index.html.ep:166 themes/default/templates/index.html.ep:206 themes/default/templates/partial/lutim.js.ep:165
|
||||
msgid "Let's go!"
|
||||
msgstr ""
|
||||
|
||||
@@ -248,7 +248,7 @@ msgstr ""
|
||||
msgid "License:"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/index.html.ep:89 themes/default/templates/index.html.ep:91 themes/default/templates/partial/lutim.js.ep:114 themes/default/templates/partial/lutim.js.ep:118
|
||||
#: themes/default/templates/index.html.ep:89 themes/default/templates/index.html.ep:91 themes/default/templates/partial/lutim.js.ep:112 themes/default/templates/partial/lutim.js.ep:116
|
||||
msgid "Link for share on social networks"
|
||||
msgstr ""
|
||||
|
||||
@@ -264,7 +264,7 @@ msgstr ""
|
||||
msgid "Main developers"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/index.html.ep:73 themes/default/templates/index.html.ep:75 themes/default/templates/partial/lutim.js.ep:88 themes/default/templates/partial/lutim.js.ep:91
|
||||
#: themes/default/templates/index.html.ep:73 themes/default/templates/index.html.ep:75 themes/default/templates/partial/lutim.js.ep:86 themes/default/templates/partial/lutim.js.ep:89
|
||||
msgid "Markdown syntax"
|
||||
msgstr ""
|
||||
|
||||
@@ -276,7 +276,7 @@ msgstr ""
|
||||
msgid "Next (arrow right)"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/partial/myfiles.js.ep:19
|
||||
#: themes/default/templates/partial/myfiles.js.ep:20
|
||||
msgid "No limit"
|
||||
msgstr ""
|
||||
|
||||
@@ -313,11 +313,7 @@ msgstr ""
|
||||
msgid "Send an image"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/partial/lutim.js.ep:23
|
||||
msgid "Share it!"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/index.html.ep:133 themes/default/templates/partial/gallery.js.ep:211 themes/default/templates/partial/lutim.js.ep:178
|
||||
#: themes/default/templates/index.html.ep:133 themes/default/templates/partial/gallery.js.ep:211 themes/default/templates/partial/lutim.js.ep:176
|
||||
msgid "Something bad happened"
|
||||
msgstr ""
|
||||
|
||||
@@ -370,7 +366,7 @@ msgstr ""
|
||||
#. ($tx->res->max_message_size)
|
||||
#. ($c->req->max_message_size)
|
||||
#. (config('max_file_size')
|
||||
#: lib/Lutim/Controller.pm:309 lib/Lutim/Controller.pm:378 themes/default/templates/partial/lutim.js.ep:245
|
||||
#: lib/Lutim/Controller.pm:309 lib/Lutim/Controller.pm:378 themes/default/templates/partial/lutim.js.ep:247
|
||||
msgid "The file exceed the size limit (%1)"
|
||||
msgstr ""
|
||||
|
||||
@@ -421,7 +417,7 @@ msgstr ""
|
||||
msgid "Tweet it!"
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/partial/common.js.ep:85
|
||||
#: themes/default/templates/partial/common.js.ep:72 themes/default/templates/partial/common.js.ep:92
|
||||
msgid "Unable to copy to clipboard"
|
||||
msgstr ""
|
||||
|
||||
@@ -459,7 +455,7 @@ msgstr ""
|
||||
msgid "Uploading is currently disabled, please try later or contact the administrator (%1)."
|
||||
msgstr ""
|
||||
|
||||
#: themes/default/templates/index.html.ep:65 themes/default/templates/index.html.ep:67 themes/default/templates/myfiles.html.ep:51 themes/default/templates/partial/lutim.js.ep:74 themes/default/templates/partial/lutim.js.ep:78
|
||||
#: themes/default/templates/index.html.ep:65 themes/default/templates/index.html.ep:67 themes/default/templates/myfiles.html.ep:51 themes/default/templates/partial/lutim.js.ep:72 themes/default/templates/partial/lutim.js.ep:76
|
||||
msgid "View link"
|
||||
msgstr ""
|
||||
|
||||
@@ -507,7 +503,7 @@ msgstr ""
|
||||
msgid "core developer"
|
||||
msgstr ""
|
||||
|
||||
#: lib/Lutim.pm:215 lib/Lutim/Command/cron/stats.pm:147 lib/Lutim/Command/cron/stats.pm:158 lib/Lutim/Command/cron/stats.pm:175 themes/default/templates/index.html.ep:3 themes/default/templates/raw.html.ep:17 themes/default/templates/raw.html.ep:34 themes/default/templates/raw.html.ep:6
|
||||
#: lib/Lutim.pm:215 lib/Lutim/Command/cron/stats.pm:147 lib/Lutim/Command/cron/stats.pm:161 lib/Lutim/Command/cron/stats.pm:178 themes/default/templates/index.html.ep:3 themes/default/templates/partial/raw.js.ep:21 themes/default/templates/partial/raw.js.ep:4 themes/default/templates/raw.html.ep:6
|
||||
msgid "no time limit"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
# Lutim language file
|
||||
# Copyright (C) 2014 Luc Didry
|
||||
# This file is distributed under the same license as the Lutim package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
# Luc Didry <luc@framasoft.org>, 2018. #zanata
|
||||
# Quentí <quentinantonin@free.fr>, 2018. #zanata
|
||||
# Quentí, 2018. #zanata
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
@@ -12,7 +11,7 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"PO-Revision-Date: 2018-03-20 04:53+0000\n"
|
||||
"Last-Translator: Quentí <quentinantonin@free.fr>\n"
|
||||
"Last-Translator: Quentí\n"
|
||||
"Language-Team: Occitan (http://www.transifex.com/fiat-tux/lutim/language/oc/"
|
||||
")\n"
|
||||
"Language: oc\n"
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -104,3 +104,28 @@ label.always-encrypt {
|
||||
@media (max-width: 675px) {
|
||||
.gallery { column-count: 1 }
|
||||
}
|
||||
.border-zero {
|
||||
border: 0;
|
||||
}
|
||||
.copy-node {
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
position: 'fixed';
|
||||
top: 5px;
|
||||
}
|
||||
.width-zero {
|
||||
width: 0%;
|
||||
}
|
||||
.pdg-left-10 {
|
||||
padding-left: 10px;
|
||||
}
|
||||
.spin {
|
||||
font-size: 200%;
|
||||
display: none;
|
||||
}
|
||||
#myfiles td.ellips {
|
||||
max-width: 300px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
.morris-hover{position:absolute;z-index:1000;}.morris-hover.morris-default-style{border-radius:10px;padding:6px;color:#666;background:rgba(255, 255, 255, 0.8);border:solid 2px rgba(230, 230, 230, 0.8);font-family:sans-serif;font-size:12px;text-align:center;}.morris-hover.morris-default-style .morris-hover-row-label{font-weight:bold;margin:0.25em 0;}
|
||||
.morris-hover.morris-default-style .morris-hover-point{white-space:nowrap;margin:0.1em 0;}
|
||||
@@ -0,0 +1,2 @@
|
||||
.morris-hover{position:absolute;z-index:1000}.morris-hover.morris-default-style{border-radius:10px;padding:6px;color:#666;background:rgba(255,255,255,0.8);border:solid 2px rgba(230,230,230,0.8);font-family:sans-serif;font-size:12px;text-align:center}.morris-hover.morris-default-style .morris-hover-row-label{font-weight:bold;margin:0.25em 0}
|
||||
.morris-hover.morris-default-style .morris-hover-point{white-space:nowrap;margin:0.1em 0}
|
||||
@@ -0,0 +1,11 @@
|
||||
/* vim:set sw=4 ts=4 sts=4 ft=css expandtab: */
|
||||
html {
|
||||
max-height:100%;
|
||||
}
|
||||
.height-97 {
|
||||
height: 97%;
|
||||
}
|
||||
.freezeframe {
|
||||
max-width: 100%;
|
||||
max-height:100%;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
html{max-height:100%}.height-97{height:97%}.freezeframe{max-width:100%;max-height:100%}
|
||||
@@ -40,16 +40,6 @@ function updateItem(short, limit, del_at_view) {
|
||||
});
|
||||
localStorage.setItem('images', JSON.stringify(files));
|
||||
}
|
||||
function share(url) {
|
||||
new MozActivity({
|
||||
name: 'share',
|
||||
data: {
|
||||
type: 'url',
|
||||
number: 1,
|
||||
url: url
|
||||
}
|
||||
});
|
||||
}
|
||||
function evaluateCopyAll(e) {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
@@ -116,4 +106,6 @@ $('document').ready(function() {
|
||||
} else if ($('#myfiles').length !== 0) {
|
||||
populateFilesTable();
|
||||
}
|
||||
$('.copy-to-clipboard-link').on('click', clickOnCopyLink);
|
||||
$('.copy-all-to-clipboard-link').on('click', copyAllToClipboard);
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
|
||||
freezeframe_options = {
|
||||
trigger_event: "click",
|
||||
animation_play_duration: 60000
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<input class="form-control" name="gallery-url-input" type="text" id="gallery-url-input" readonly></input>
|
||||
<a href="#" onClick="event.preventDefault();copyToClipboard($(this));" class="input-group-addon jsonly" title="<%= l('Copy to clipboard') %>">
|
||||
<a href="#" class="input-group-addon jsonly copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>">
|
||||
<span class="icon icon-clipboard"></span>
|
||||
</a>
|
||||
</div>
|
||||
@@ -33,7 +33,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<input class="form-control" name="zip-url-input" type="text" id="zip-url-input" readonly></input>
|
||||
<a href="#" onClick="event.preventDefault();copyToClipboard($(this));" class="input-group-addon jsonly" title="<%= l('Copy to clipboard') %>">
|
||||
<a href="#" class="input-group-addon jsonly copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>">
|
||||
<span class="icon icon-clipboard"></span>
|
||||
</a>
|
||||
</div>
|
||||
@@ -66,7 +66,7 @@
|
||||
<div class="input-group col-sm-6">
|
||||
<div class="input-group-addon"><a href="<%= $url.'.'.stash('ext') %>" target="_blank"><span class="icon icon-eye" title =" <%= l('View link') %>"></span></a></div>
|
||||
<input type="text" class="form-control" id="view" value="<%= $url.'.'.stash('ext') %>" readonly>
|
||||
<a href="#" onClick="copyToClipboard($(this));" class="input-group-addon jsonly" title="<%= l('Copy to clipboard') %>"><span class="icon icon-clipboard"></span></a>
|
||||
<a href="#" class="input-group-addon jsonly copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>"><span class="icon icon-clipboard"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -74,7 +74,7 @@
|
||||
<div class="input-group col-sm-6">
|
||||
<div class="input-group-addon"><span class="markdown-mark-solid" title ="<%= l('Markdown syntax') %>"></span></div>
|
||||
<input type="text" class="form-control" id="markdown" value="" readonly>
|
||||
<a href="#" onClick="copyToClipboard($(this));" class="input-group-addon jsonly" title="<%= l('Copy to clipboard') %>"><span class="icon icon-clipboard"></span></a>
|
||||
<a href="#" class="input-group-addon jsonly copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>"><span class="icon icon-clipboard"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -82,7 +82,7 @@
|
||||
<div class="input-group col-sm-6">
|
||||
<div class="input-group-addon"><a href="<%= $url %>?dl"><span class="icon icon-download" title ="<%= l('Download link') %>"></span></a></div>
|
||||
<input type="text" class="form-control" id="download" value="<%= $url %>?dl" readonly>
|
||||
<a href="#" onClick="copyToClipboard($(this));" class="input-group-addon jsonly" title="<%= l('Copy to clipboard') %>"><span class="icon icon-clipboard"></span></a>
|
||||
<a href="#" class="input-group-addon jsonly copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>"><span class="icon icon-clipboard"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -90,7 +90,7 @@
|
||||
<div class="input-group col-sm-6">
|
||||
<div class="input-group-addon"><a href="<%= $url %>?t" target="_blank"><span class="icon icon-share" title ="<%= l('Link for share on social networks') %>"></span></a></div>
|
||||
<input type="text" class="form-control" id="share" value="<%= $url %>?t" readonly>
|
||||
<a href="#" onClick="copyToClipboard($(this));" class="input-group-addon jsonly" title="<%= l('Copy to clipboard') %>"><span class="icon icon-clipboard"></span></a>
|
||||
<a href="#" class="input-group-addon jsonly copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>"><span class="icon icon-clipboard"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -198,7 +198,7 @@
|
||||
<p class="help-block"><%= l('Only images are allowed') %></p>
|
||||
<form class="form-horizontal" method="POST" action="<%== url_for('add') %>">
|
||||
<div class="form-group">
|
||||
<span class="col-sm-3 col-xs-12"><span class="hidden-spin" style="font-size:200%; display:none;" > <span class="icon-spinner animate-spin pull-right"></span></span><label for="lutim-file-url" class="control-label pull-right"><%= l('Upload an image with its URL') %></label></span>
|
||||
<span class="col-sm-3 col-xs-12"><span class="hidden-spin spin"> <span class="icon-spinner animate-spin pull-right"></span></span><label for="lutim-file-url" class="control-label pull-right"><%= l('Upload an image with its URL') %></label></span>
|
||||
<div class="col-sm-9 col-xs-12">
|
||||
<input type="url" name="lutim-file-url" class="form-control" id="lutim-file-url" placeholder="<%= l('Image URL') %>">
|
||||
</div>
|
||||
|
||||
@@ -23,14 +23,13 @@
|
||||
<link rel="apple-touch-icon-precomposed" sizes="128x128" href="<%= url_for('/img/lutim128.png') %>">
|
||||
%= stylesheet '/css/common.min.css'
|
||||
% if (current_route 'stats') {
|
||||
%= stylesheet '/css/morris-0.4.3.min.css'
|
||||
%= stylesheet '/css/morris-0.5.1.min.css'
|
||||
% } else {
|
||||
%= stylesheet '/css/not_stats.min.css'
|
||||
% }
|
||||
% if (current_route 'gallery') {
|
||||
%= stylesheet '/css/gallery.min.css'
|
||||
% }
|
||||
%= javascript '/js/jquery-3.2.1.min.js'
|
||||
</head>
|
||||
<body>
|
||||
%= include 'partial/navbar', twitter_url => $twitter_url
|
||||
@@ -60,25 +59,25 @@
|
||||
% }
|
||||
<%= content %>
|
||||
</div>
|
||||
%= javascript begin
|
||||
var manifestUrl = '<%== url_for('manifest.webapp')->to_abs() %>';
|
||||
% end
|
||||
% if (defined(config('piwik_img'))) {
|
||||
<img src="<%== config('piwik_img') %>" style="border:0" alt="">
|
||||
<img src="<%== config('piwik_img') %>" class="border-zero" alt="">
|
||||
% }
|
||||
%= javascript '/js/jquery-3.2.1.min.js'
|
||||
%= javascript '/partial/manifest.js'
|
||||
%= javascript '/js/toastify.js'
|
||||
%= javascript '/js/bootstrap.min.js'
|
||||
%= javascript '/partial/common.js'
|
||||
% if (current_route 'stats') {
|
||||
%= javascript '/js/lutim.js'
|
||||
%= javascript '/js/raphael-min.js'
|
||||
%= javascript '/js/morris-0.4.3.min.js'
|
||||
%= javascript '/js/morris-0.5.1.min.js'
|
||||
%= javascript '/js/stats.js'
|
||||
%= javascript '/partial/raw.js'
|
||||
% } elsif (!(current_route 'about')) {
|
||||
%= javascript '/js/lutim.js'
|
||||
%= javascript '/js/dmuploader.min.js'
|
||||
% }
|
||||
% if (current_route 'index') {
|
||||
%= javascript '/partial/common.js'
|
||||
%= javascript '/partial/lutim.js'
|
||||
% }
|
||||
% if (current_route 'gallery') {
|
||||
@@ -90,7 +89,6 @@
|
||||
%= javascript '/partial/lutim.js'
|
||||
% }
|
||||
% if (current_route 'myfiles') {
|
||||
%= javascript '/partial/common.js'
|
||||
%= javascript '/js/moment-with-locales.min.js'
|
||||
%= javascript '/partial/myfiles.js'
|
||||
% }
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<input class="form-control" name="gallery-url-input" type="text" id="gallery-url-input" readonly></input>
|
||||
<a href="#" onClick="event.preventDefault();copyToClipboard($(this));" class="input-group-addon jsonly" title="<%= l('Copy to clipboard') %>">
|
||||
<a href="#" class="input-group-addon jsonly copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>">
|
||||
<span class="icon icon-clipboard"></span>
|
||||
</a>
|
||||
</div>
|
||||
@@ -35,7 +35,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<input class="form-control" name="zip-url-input" type="text" id="zip-url-input" readonly></input>
|
||||
<a href="#" onClick="event.preventDefault();copyToClipboard($(this));" class="input-group-addon jsonly" title="<%= l('Copy to clipboard') %>">
|
||||
<a href="#" class="input-group-addon jsonly copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>">
|
||||
<span class="icon icon-clipboard"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,6 @@ window.short_hash = {};
|
||||
window.zip_hash = {};
|
||||
function addToShortHash(short) {
|
||||
window.short_hash[short] = 1;
|
||||
console.debug(window.short_hash);
|
||||
if (Object.keys(window.short_hash).length > 0) {
|
||||
$('#gallery-url').removeClass('hidden');
|
||||
$('#gallery-url-input').val(window.gallery_url+Object.keys(window.short_hash).join(','));
|
||||
@@ -39,10 +38,7 @@ function rmFromZipHash(short) {
|
||||
/* Stolen from https://github.com/mozilla-services/push-dev-dashboard/blob/3ad4de737380d0842f40c82301d1f748c1b20f2b/push/static/js/validation.js */
|
||||
function createNode(text) {
|
||||
var node = document.createElement('pre');
|
||||
node.style.width = '1px';
|
||||
node.style.height = '1px';
|
||||
node.style.position = 'fixed';
|
||||
node.style.top = '5px';
|
||||
node.classList.add('copy-node');
|
||||
node.textContent = text;
|
||||
return node;
|
||||
}
|
||||
@@ -67,6 +63,18 @@ function copyText(text) {
|
||||
document.body.removeChild(node);
|
||||
return success;
|
||||
}
|
||||
function copyLink(e) {
|
||||
e.preventDefault();
|
||||
var successful = copyText($(this).prop('href'));
|
||||
var msg = successful ? 'successful' : 'unsuccessful';
|
||||
console.debug('Copying text command was ' + msg);
|
||||
if (!successful) {
|
||||
badToast('<%= l('Unable to copy to clipboard') %>');
|
||||
throw new Error('Copying text command was ' + msg);
|
||||
} else {
|
||||
goodToast('<%= l('Copied to clipboard') %>');
|
||||
}
|
||||
}
|
||||
|
||||
function copyInput(node) {
|
||||
node.select();
|
||||
@@ -81,31 +89,17 @@ function copyToClipboard(el) {
|
||||
var msg = successful ? 'successful' : 'unsuccessful';
|
||||
console.debug('Copying text command was ' + msg);
|
||||
if (!successful) {
|
||||
Toastify({
|
||||
text: '<%= l('Unable to copy to clipboard') %>',
|
||||
duration: 3000,
|
||||
newWindow: true,
|
||||
close: true,
|
||||
gravity: 'bottom',
|
||||
positionLeft: false,
|
||||
backgroundColor: '#f2dede'
|
||||
}).showToast();
|
||||
badToast('<%= l('Unable to copy to clipboard') %>');
|
||||
throw new Error('Copying text command was ' + msg);
|
||||
} else {
|
||||
Toastify({
|
||||
text: '<%= l('Copied to clipboard') %>',
|
||||
duration: 3000,
|
||||
newWindow: true,
|
||||
close: true,
|
||||
gravity: 'bottom',
|
||||
positionLeft: false
|
||||
}).showToast();
|
||||
goodToast('<%= l('Copied to clipboard') %>');
|
||||
}
|
||||
} catch (err) {
|
||||
prompt('<%= l('Hit Ctrl+C, then Enter to copy the short link') %>', el.val());
|
||||
}
|
||||
}
|
||||
function copyAllToClipboard() {
|
||||
function copyAllToClipboard(e) {
|
||||
e.preventDefault;
|
||||
var text = new Array();
|
||||
$('.view-link-input').each(function(index) {
|
||||
text.push($(this).val());
|
||||
@@ -123,6 +117,10 @@ function copyAllToClipboard() {
|
||||
}
|
||||
|
||||
}
|
||||
function clickOnCopyLink(e) {
|
||||
e.preventDefault();
|
||||
copyToClipboard($(this));
|
||||
}
|
||||
function delImage(e) {
|
||||
e.preventDefault();
|
||||
var short = $(this).attr('data-short');
|
||||
@@ -138,16 +136,9 @@ function delImage(e) {
|
||||
$('#alert-'+short).remove();
|
||||
evaluateCopyAll();
|
||||
delItem(short);
|
||||
Toastify({
|
||||
text: '<%= l('Image deleted') %>',
|
||||
duration: 3000,
|
||||
newWindow: true,
|
||||
close: true,
|
||||
gravity: 'bottom',
|
||||
positionLeft: false
|
||||
}).showToast();
|
||||
goodToast('<%= l('Image deleted') %>');
|
||||
} else {
|
||||
alert(data.msg);
|
||||
badToast(data.msg);
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
@@ -174,7 +165,7 @@ function link(url, dl, token, modify, only_url) {
|
||||
'</a>',
|
||||
'</div>',
|
||||
'<input type="text" class="form-control" id="link-del-', url, '" value="', link, '" readonly>',
|
||||
'<a href="#" onClick="event.preventDefault();copyToClipboard($(this));" class="input-group-addon" title="<%= l('Copy to clipboard') %>">',
|
||||
'<a href="#" class="input-group-addon copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>">',
|
||||
'<span class="icon icon-clipboard"></span>',
|
||||
'</a>',
|
||||
'</div>'
|
||||
@@ -184,3 +175,26 @@ function link(url, dl, token, modify, only_url) {
|
||||
}
|
||||
return '<%== url_for('/')->to_abs() %>'+url;
|
||||
}
|
||||
|
||||
function badToast(msg) {
|
||||
Toastify({
|
||||
text: msg,
|
||||
duration: 6000,
|
||||
newWindow: true,
|
||||
close: true,
|
||||
gravity: 'bottom',
|
||||
positionLeft: false,
|
||||
backgroundColor: '#f26163'
|
||||
}).showToast();
|
||||
}
|
||||
|
||||
function goodToast(msg) {
|
||||
Toastify({
|
||||
text: msg,
|
||||
duration: 3000,
|
||||
newWindow: true,
|
||||
close: true,
|
||||
gravity: 'bottom',
|
||||
positionLeft: false
|
||||
}).showToast();
|
||||
}
|
||||
|
||||
@@ -13,19 +13,17 @@ function cleanName(name, empty) {
|
||||
}
|
||||
}
|
||||
function tw_url(url) {
|
||||
var btn = [
|
||||
return btn = [
|
||||
'<a title="<%= l('Tweet it!') %>" target="_blank" href="https://twitter.com/share?url=<%== url_for('/')->to_abs() %>', url, '?t" class="btn btn-default">',
|
||||
'<span class="icon icon-twitter"></span>',
|
||||
'</a>'
|
||||
].join('');
|
||||
if (navigator.mozSetMessageHandler !== undefined) {
|
||||
btn = btn+[
|
||||
'<a title="<%= l('Share it!') %>" target="_blank" href="" onclick="share(\'<%== url_for('/')->to_abs() %>', url, '?t\');return false;">',
|
||||
'<span class="icon icon-share"></span>',
|
||||
'</a>'
|
||||
].join('');
|
||||
}
|
||||
return btn
|
||||
}
|
||||
function modifyImage(e) {
|
||||
e.preventDefault();
|
||||
var url = $(this).data('modlink');
|
||||
var short = $(this).data('modshort');
|
||||
modify(url, short);
|
||||
}
|
||||
function modify(url, short) {
|
||||
var limit = $('#day-'+short).val();
|
||||
@@ -41,10 +39,10 @@ function modify(url, short) {
|
||||
},
|
||||
success: function(data) {
|
||||
updateItem(short, limit, del_at_view);
|
||||
alert(data.msg);
|
||||
goodToast(data.msg);
|
||||
},
|
||||
error: function() {
|
||||
alert('<%= l('Error while trying to modify the image.') %>');
|
||||
badToast('<%= l('Error while trying to modify the image.') %>');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -61,7 +59,7 @@ function buildMessage(success, msg) {
|
||||
].join('') : ''
|
||||
return [
|
||||
'<div class="alert alert-success" id="alert-', msg.real_short, '">',
|
||||
'<button type="button" class="close" data-dismiss="alert" aria-hidden="true" onclick="rmFromShortHash(\'', msg.short, '.', msg.ext, '\');rmFromZipHash(\'', msg.short, '\');">×</button>',
|
||||
'<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>',
|
||||
'<div class="row">', thumb,
|
||||
'<div class="col-sm-11">',
|
||||
'<h4>',
|
||||
@@ -79,7 +77,7 @@ function buildMessage(success, msg) {
|
||||
'</a>',
|
||||
'</div>',
|
||||
'<input type="text" class="form-control view-link-input" id="view', msg.real_short, '" value="', s_url, '" readonly>',
|
||||
'<a href="#" onClick="event.preventDefault();copyToClipboard($(this));" class="input-group-addon" title="<%= l('Copy to clipboard') %>">',
|
||||
'<a href="#" class="input-group-addon copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>">',
|
||||
'<span class="icon icon-clipboard"></span>',
|
||||
'</a>',
|
||||
'</div>',
|
||||
@@ -91,7 +89,7 @@ function buildMessage(success, msg) {
|
||||
'<span class="markdown-mark-solid" title="<%= l('Markdown syntax') %>"></span>',
|
||||
'</div>',
|
||||
'<input type="text" class="form-control" id="markdown', msg.real_short, '" value=", ')" readonly>',
|
||||
'<a href="#" onClick="event.preventDefault();copyToClipboard($(this));" class="input-group-addon" title="<%= l('Copy to clipboard') %>">',
|
||||
'<a href="#" class="input-group-addon copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>">',
|
||||
'<span class="icon icon-clipboard"></span>',
|
||||
'</a>',
|
||||
'</div>',
|
||||
@@ -105,7 +103,7 @@ function buildMessage(success, msg) {
|
||||
'</a>',
|
||||
'</div>',
|
||||
'<input type="text" class="form-control" id="download', msg.real_short, '" value="', link(msg.short, 'dl'), '" readonly>',
|
||||
'<a href="#" onClick="event.preventDefault();copyToClipboard($(this));" class="input-group-addon" title="<%= l('Copy to clipboard') %>">',
|
||||
'<a href="#" class="input-group-addon copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>">',
|
||||
'<span class="icon icon-clipboard"></span>',
|
||||
'</a>',
|
||||
'</div>',
|
||||
@@ -120,7 +118,7 @@ function buildMessage(success, msg) {
|
||||
tw_url(msg.short),
|
||||
'</div>',
|
||||
'<input type="text" class="form-control" id="share', msg.real_short, '" value="', link(msg.short, 't'), '" readonly>',
|
||||
'<a href="#" onClick="event.preventDefault();copyToClipboard($(this));" class="input-group-addon" title="<%= l('Copy to clipboard') %>">',
|
||||
'<a href="#" class="input-group-addon copy-to-clipboard-link" title="<%= l('Copy to clipboard') %>">',
|
||||
'<span class="icon icon-clipboard"></span>',
|
||||
'</a>',
|
||||
'</div>',
|
||||
@@ -163,7 +161,7 @@ function buildMessage(success, msg) {
|
||||
'<input id="first-view-', msg.real_short, '" type="checkbox" name="first-view"> <%= l('Delete at first view?') %>',
|
||||
'</label>',
|
||||
'</div> ',
|
||||
'<a href="#" onclick="modify(\'', link(msg.real_short, '', msg.token, true), '\', \'', msg.real_short, '\');return false;" class="btn btn-sm btn-default btn-primary">',
|
||||
'<a href="#" class="btn btn-sm btn-default btn-primary modify-image" data-modlink="', link(msg.real_short, '', msg.token, true),'" data-modshort="', msg.real_short,'">',
|
||||
'<%= l('Let\'s go!') %>',
|
||||
'</a>',
|
||||
'</div>',
|
||||
@@ -194,8 +192,8 @@ function bindddz(firstview, deleteday) {
|
||||
'<div id="', id, '-div">',
|
||||
cleanName(file.name), '<br>',
|
||||
'<div class="progress">',
|
||||
'<div id="', id, '"class="progress-bar progress-striped active" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">',
|
||||
'<span id="', id, '-text" class="pull-left" style="padding-left: 10px;"> 0%</span>',
|
||||
'<div id="', id, '"class="progress-bar progress-striped active width-zero" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">',
|
||||
'<span id="', id, '-text" class="pull-left pdg-left-10"> 0%</span>',
|
||||
'</div>',
|
||||
'</div>',
|
||||
'</div>'
|
||||
@@ -204,22 +202,20 @@ function bindddz(firstview, deleteday) {
|
||||
onUploadProgress: function(id, percent){
|
||||
var percentStr = ' '+percent+'%';
|
||||
$('#'+id).prop('aria-valuenow', percent);
|
||||
$('#'+id).prop('style', 'width: '+percent+'%;');
|
||||
$('#'+id).css('width', percent+'%');
|
||||
$('#'+id+'-text').html(percentStr);
|
||||
},
|
||||
onUploadSuccess: function(id, data){
|
||||
data.msg.filename = cleanName(data.msg.filename);
|
||||
$('#'+id+'-div').remove();
|
||||
if ($('#copy-all').length === 0 && data.success) {
|
||||
$('.messages').prepend(
|
||||
[
|
||||
'<div class="col-xs-12 col-sm-11 col-sm-offset-1">',
|
||||
'<a id="copy-all" href="#" class="btn btn-info" onClick="event.preventDefault();copyAllToClipboard();">',
|
||||
'<%= l('Copy all view links to clipboard') %>',
|
||||
'</a>',
|
||||
'</div>'
|
||||
].join('')
|
||||
);
|
||||
$('.messages').prepend([
|
||||
'<div class="col-xs-12 col-sm-11 col-sm-offset-1">',
|
||||
'<a id="copy-all" href="#" class="btn btn-info copy-all-to-clipboard-link">',
|
||||
'<%= l('Copy all view links to clipboard') %>',
|
||||
'</a>',
|
||||
'</div>'
|
||||
].join(''));
|
||||
}
|
||||
$('.messages').append(buildMessage(data.success, data.msg));
|
||||
$('#del-'+data.msg.real_short).on('click', function(e) {
|
||||
@@ -235,6 +231,12 @@ function bindddz(firstview, deleteday) {
|
||||
$('.close').on('click', evaluateCopyAll);
|
||||
$('input[type=\'text\']').unbind("click", selectInput);
|
||||
$('input[type=\'text\']').on("click", selectInput);
|
||||
$('.copy-all-to-clipboard-link').unbind('click', copyAllToClipboard);
|
||||
$('.copy-all-to-clipboard-link').on('click', copyAllToClipboard);
|
||||
$('.modify-image').unbind('click', modifyImage);
|
||||
$('.modify-image').on('click', modifyImage);
|
||||
$('.copy-to-clipboard-link').unbind('click', clickOnCopyLink);
|
||||
$('.copy-to-clipboard-link').on('click', clickOnCopyLink);
|
||||
addItem(data.msg);
|
||||
}
|
||||
},
|
||||
@@ -247,7 +249,8 @@ function bindddz(firstview, deleteday) {
|
||||
});
|
||||
}
|
||||
|
||||
function upload_url() {
|
||||
function upload_url(e) {
|
||||
e.preventDefault();
|
||||
var val = $('#lutim-file-url').val();
|
||||
if (val !== undefined && val !== '') {
|
||||
$('#lutim-file-url').prop('disabled', 'disabled');
|
||||
@@ -269,7 +272,7 @@ function upload_url() {
|
||||
if ($('#copy-all').length === 0) {
|
||||
$('.messages').prepend([
|
||||
'<div class="col-xs-12 col-sm-11 col-sm-offset-1">',
|
||||
'<a id="copy-all" href="#" class="btn btn-info" onClick="event.preventDefault();copyAllToClipboard();">',
|
||||
'<a id="copy-all" href="#" class="btn btn-info copy-all-to-clipboard-link">',
|
||||
'<%= l('Copy all view links to clipboard') %>',
|
||||
'</a>',
|
||||
'</div>'
|
||||
@@ -278,6 +281,7 @@ function upload_url() {
|
||||
$('#lutim-file-url').val('');
|
||||
addToShortHash(data.msg.short+'.'+data.msg.ext);
|
||||
addToZipHash(data.msg.short);
|
||||
$('#del-'+data.msg.real_short).on('click', delImage);
|
||||
$('.close').unbind('click', evaluateCopyAll);
|
||||
$('.close').on('click', evaluateCopyAll);
|
||||
addItem(data.msg);
|
||||
@@ -289,6 +293,12 @@ function upload_url() {
|
||||
complete: function() {
|
||||
$('#lutim-file-url').prop('disabled', '');
|
||||
$('.hidden-spin').css('display', 'none');
|
||||
$('.copy-all-to-clipboard-link').unbind('click', copyAllToClipboard);
|
||||
$('.copy-all-to-clipboard-link').on('click', copyAllToClipboard);
|
||||
$('.modify-image').unbind('click', modifyImage);
|
||||
$('.modify-image').on('click', modifyImage);
|
||||
$('.copy-to-clipboard-link').unbind('click', clickOnCopyLink);
|
||||
$('.copy-to-clipboard-link').on('click', clickOnCopyLink);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -306,8 +316,8 @@ function fileUpload(file) {
|
||||
$('.messages').append([
|
||||
'<div id="1-div">', cleanName(file.name), '<br>',
|
||||
'<div class="progress">',
|
||||
'<div id="1"class="progress-bar progress-striped active" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">',
|
||||
'<span id="1-text" class="pull-left" style="padding-left: 10px;"> 0%</span>',
|
||||
'<div id="1" class="progress-bar progress-striped active width-zero" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">',
|
||||
'<span id="1-text" class="pull-left pdg-left-10"> 0%</span>',
|
||||
'</div>',
|
||||
'</div>',
|
||||
'</div>'
|
||||
@@ -335,7 +345,7 @@ function fileUpload(file) {
|
||||
|
||||
var percentStr = ' '+percent+'%';
|
||||
$('#1').prop('aria-valuenow', percent);
|
||||
$('#1').prop('style', 'width: '+percent+'%;');
|
||||
$('#1').css('width', percent+'%');
|
||||
$('#1-text').html(percentStr);
|
||||
}, false);
|
||||
}
|
||||
@@ -347,7 +357,7 @@ function fileUpload(file) {
|
||||
if ($('#copy-all').length === 0 && data.success) {
|
||||
$('.messages').prepend([
|
||||
'<div class="col-xs-12 col-sm-11 col-sm-offset-1">',
|
||||
'<a id="copy-all" href="#" class="btn btn-info" onClick="event.preventDefault();copyAllToClipboard();">',
|
||||
'<a id="copy-all" href="#" class="btn btn-info copy-all-to-clipboard-link">',
|
||||
'<%= l('Copy all view links to clipboard') %>',
|
||||
'</a>',
|
||||
'</div>'
|
||||
@@ -364,6 +374,14 @@ function fileUpload(file) {
|
||||
error: function (xhr, status, errMsg){
|
||||
$('.messages').append(buildMessage(false, ''));
|
||||
},
|
||||
complete: function () {
|
||||
$('.copy-all-to-clipboard-link').unbind('click', copyAllToClipboard);
|
||||
$('.copy-all-to-clipboard-link').on('click', copyAllToClipboard);
|
||||
$('.modify-image').unbind('click', modifyImage);
|
||||
$('.modify-image').on('click', modifyImage);
|
||||
$('.copy-to-clipboard-link').unbind('click', clickOnCopyLink);
|
||||
$('.copy-to-clipboard-link').on('click', clickOnCopyLink);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
% # vim:set sw=4 ts=4 sts=4 ft=javascript expandtab:
|
||||
var manifestUrl = '<%== url_for('manifest.webapp')->to_abs() %>';
|
||||
@@ -1,6 +1,7 @@
|
||||
% # vim:set sw=4 ts=4 sts=4 ft=javascript expandtab:
|
||||
function onCheck(e, short, ext) {
|
||||
if (e.is(':checked')) {
|
||||
e.preventDefault();
|
||||
if ($(this).is(':checked')) {
|
||||
addToShortHash(short+'.'+ext);
|
||||
addToZipHash(short);
|
||||
} else {
|
||||
@@ -19,16 +20,20 @@ function populateFilesTable() {
|
||||
var limit = (element.limit === 0) ? '<%= l('No limit') %>' : moment.unix(element.limit * 86400 + element.created_at).locale(window.navigator.language).format('LLLL');
|
||||
var created_at = moment.unix(element.created_at).locale(window.navigator.language).format('LLLL');
|
||||
|
||||
var name = element.filename.replace(/</g, '<').replace(/>/g, '>');
|
||||
var tr = [
|
||||
'<tr id="alert-',real_short,'">',
|
||||
'<td><span class="checkbox"><label><input type="checkbox" onChange="onCheck($(this), \'', element.short, '\', \'', element.ext, '\');"><label></span></td>',
|
||||
'<td>', element.filename.replace(/</g, '<').replace(/>/g, '>'), '</td>',
|
||||
'<td><a href="',vlink,'">',vlink,'</a></td>',
|
||||
'<td><span class="checkbox"><label><input type="checkbox"><label></span></td>',
|
||||
'<td class="ellips"><span title="', name,'">', name, '</span></td>',
|
||||
'<td class="text-center">',
|
||||
'<a href="',vlink,'" target="_blank"><i class="icon icon-eye"></i></a>',
|
||||
' <a href="',vlink,'" class="copy-to-clipboard" title="<%= l('Copy to clipboard') %>"><i class="icon icon-clipboard"></i></a>',
|
||||
'</td>',
|
||||
'<td id="count-',real_short,'" class="text-center"></td>',
|
||||
'<td class="text-center">', del_view, '</td>',
|
||||
'<td>', created_at, '</td>',
|
||||
'<td>', limit, '</td>',
|
||||
'<td><a id="del-',real_short,'" data-short="',real_short,'" data-token="',element.token,'" href="#">',dlink,'</a></td>',
|
||||
'<td class="text-center"><a id="del-',real_short,'" data-short="',real_short,'" data-token="',element.token,'" href="#" class="remove-link"><i class="icon icon-trash"></i></a></td>',
|
||||
'</tr>'
|
||||
].join('');
|
||||
$('#myfiles').append(tr);
|
||||
@@ -50,12 +55,14 @@ function populateFilesTable() {
|
||||
$('#alert-'+real_short).remove();
|
||||
}
|
||||
} else {
|
||||
alert(data.msg);
|
||||
badToast(element.filename+' '+data.msg);
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
alert(element.filename+'<%= l(': Error while trying to get the counter.') %>');
|
||||
badToast(element.filename+'<%= l(': Error while trying to get the counter.') %>');
|
||||
}
|
||||
});
|
||||
});
|
||||
$('input[type="checkbox"]').on('change', onCheck);
|
||||
$('.copy-to-clipboard').on('click', copyLink);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
% my $g = ($mimetype eq 'image/gif') ? 1 : 0;
|
||||
% my $abs = url_for('/'.$short)->to_abs();
|
||||
<!DOCTYPE html>
|
||||
<html style="max-height:100%;">
|
||||
<html>
|
||||
<head>
|
||||
<title>Lutim</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" type="image/png" href="<%= url_for('/img/favicon.png')->to_abs() %>">
|
||||
%= stylesheet '/css/twitter.min.css'
|
||||
<meta property="og:title" content="Lutim" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="<%= $abs %>?t" />
|
||||
@@ -25,18 +26,13 @@
|
||||
<meta name="twitter:player:height" content="<%= $height %>">
|
||||
%= javascript '/js/jquery-3.2.1.min.js'
|
||||
%= javascript '/js/freezeframe.min.js'
|
||||
%= javascript begin
|
||||
freezeframe_options = {
|
||||
trigger_event: "click",
|
||||
animation_play_duration: 60000
|
||||
}
|
||||
% end
|
||||
%= javascript '/js/twitter.js'
|
||||
% } else {
|
||||
<meta name="twitter:card" content="photo">
|
||||
% }
|
||||
</head>
|
||||
<body<%== ($g) ? '' : ' style="height: 97%;"' %>>
|
||||
<img<%= ' class="freezeframe"' if ($g) %> style="<%= 'max-' unless ($g) %>width:100%; max-height:100%;" src="<%= $abs %><%= '.gif' if ($g) %>" alt="<%= $filename %>">
|
||||
<body<%== ($g) ? '' : ' class="height-97"' %>>
|
||||
<img class="freezeframe" src="<%= $abs %><%= '.gif' if ($g) %>" alt="<%= $filename %>">
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user