Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
generateur-slogans
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LQDN Adminsys
generateur-slogans
Commits
ea1da51a
Verified
Commit
ea1da51a
authored
Nov 20, 2017
by
Thibaut Broggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add button "share on Diaspora*"
Sharing URL management has been rewritten has a class
parent
322cdc91
Pipeline
#1675
passed with stage
in 42 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
19 deletions
+48
-19
srv.js
srv.js
+45
-19
views/index.pug
views/index.pug
+3
-0
No files found.
srv.js
View file @
ea1da51a
...
...
@@ -83,34 +83,60 @@ for (let i in fonts) {
}
Canvas
.
registerFont
(
'
./static/fonts/FiraSans-Bold.otf
'
,
{
family
:
'
FiraSans
'
,
weight
:
'
bold
'
});
function
buildUrl
(
req
)
{
return
req
.
protocol
+
'
://
'
+
req
.
headers
.
host
+
'
/
'
+
(
config
.
subdir
||
''
)
+
'
?
'
+
querystring
.
stringify
(
req
.
args
)
+
'
&lang=
'
+
req
.
i18n
.
getLocale
();
}
function
tweetMessage
(
req
)
{
function
ShareMessage
(
req
)
{
let
_req
=
req
;
let
_
=
req
.
i18n
.
_
;
return
(
req
.
args
.
signature
?
_
(
'
Faites comme
'
)
+
encodeURIComponent
(
req
.
args
.
signature
)
+
'
, s
'
:
'
S
'
)
+
_
(
'
outenez
'
)
+
encodeURIComponent
(
'
La Quadrature du Net ! #LQDoN
'
)
+
encodeURIComponent
(
req
.
protocol
+
"
://
"
+
req
.
headers
.
host
)
+
'
'
+
encodeURIComponent
(
buildUrl
(
req
));
this
.
getUrl
=
function
()
{
return
_req
.
protocol
+
'
://
'
+
_req
.
headers
.
host
+
'
/
'
+
(
config
.
subdir
||
''
)
+
'
?
'
+
querystring
.
stringify
(
_req
.
args
)
+
'
&lang=
'
+
_req
.
i18n
.
getLocale
();
}
this
.
getTitle
=
function
()
{
return
(
_req
.
args
.
signature
?
_
(
'
Faites comme
'
)
+
encodeURIComponent
(
_req
.
args
.
signature
)
+
'
, s
'
:
'
S
'
)
+
_
(
'
outenez
'
)
+
'
La Quadrature du Net ! #LQDoN
'
;
}
this
.
getContent
=
function
()
{
return
_req
.
protocol
+
"
://
"
+
_req
.
headers
.
host
;
}
this
.
getTwitterLink
=
function
()
{
return
'
https://twitter.com/intent/tweet?text=
'
+
encodeURIComponent
(
this
.
getTitle
()
+
'
'
+
this
.
getContent
()
+
'
'
+
this
.
getUrl
());
}
this
.
getFacebookLink
=
function
()
{
return
'
https://www.facebook.com/sharer/sharer.php?u=
'
+
encodeURIComponent
(
this
.
getUrl
());
}
this
.
getDiasporaLink
=
function
()
{
return
'
https://share.diasporafoundation.org/?title=
'
+
encodeURIComponent
(
this
.
getTitle
()
+
'
'
+
this
.
getContent
())
+
'
&url=
'
+
encodeURIComponent
(
this
.
getUrl
());
}
}
app
.
get
(
'
/generate.png
'
,
function
(
req
,
res
)
{
let
_
=
req
.
i18n
.
_
;
if
(
req
.
query
.
target
===
'
facebook
'
)
{
return
res
.
redirect
(
'
https://www.facebook.com/sharer/sharer.php?u=
'
+
encodeURIComponent
(
buildUrl
(
req
)));
let
message
=
new
ShareMessage
(
req
);
if
(
req
.
query
.
target
===
'
diaspora
'
)
{
return
res
.
redirect
(
message
.
getDiasporaLink
())
}
else
if
(
req
.
query
.
target
===
'
facebook
'
)
{
return
res
.
redirect
(
message
.
getFacebookLink
());
}
else
if
(
req
.
query
.
target
===
'
twitter
'
)
{
return
res
.
redirect
(
'
https://twitter.com/intent/tweet?text=
'
+
tweetMessage
(
req
));
return
res
.
redirect
(
message
.
getTwitterLink
(
));
}
else
if
(
req
.
query
.
target
===
'
download
'
)
{
res
.
set
(
"
Content-Disposition
"
,
"
attachment;filename=lqdn_slogan.png
"
);
...
...
views/index.pug
View file @
ea1da51a
...
...
@@ -123,6 +123,9 @@ html(lang=locale)
span.fa.fa-refresh
button(type="submit" name="target" value="randomize" formaction="" formtarget="_self").randomize.white-button
span.fa.fa-random
button(type="submit" name="target" value="diaspora").white-button
span.text
=_('Diaspora*') + ' '
button(type="submit" name="target" value="twitter")#tweet-button.blue-button
span.text
=_('Tweet') + ' '
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment