Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pédagogies Multimodales
wikicolor
Commits
feacc5e3
Commit
feacc5e3
authored
Jul 23, 2020
by
Sylvain Coulange
Browse files
modif url en/fr + selectLangFromUrl()
parent
dafdeb2a
Changes
3
Hide whitespace changes
Inline
Side-by-side
coloriseur/urls.py
View file @
feacc5e3
...
...
@@ -22,6 +22,8 @@ urlpatterns = [
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
'app/'
,
redirApp
),
path
(
''
,
main
),
path
(
'en/'
,
main
),
path
(
'fr/'
,
main
),
path
(
'colorize/'
,
csrf_exempt
(
colorize
)),
path
(
'app/dico/'
,
dicoView
),
path
(
'dicoSearch/'
,
dicoReq
),
...
...
static/languages/languages.js
View file @
feacc5e3
...
...
@@ -21,7 +21,7 @@ var langJson = {
},
"
sp_bicolor
"
:
{
"
fr
"
:
'
<span style="color: #ff0000; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">B</span><span style="color: #40b9ff; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">i</span><span style="color: #ff0000; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">c</span><span style="color: #40b9ff; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">o</span><span style="color: #ff0000; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">l</span><span style="color: #40b9ff; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">o</span><span style="color: #ff0000; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">re</span>
'
,
"
en
"
:
'
<span class="phon_b" style="color: #ff0000; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">B</span><span class="
phon_ai_maj
stress1" style="color: #40b9ff; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">i</span><span class="phon_k" style="color: #ff0000; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">c</span><span class="phon_arobase schwa" style="color: #40b9ff; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">o</span><span class="phon_l" style="color: #ff0000; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">l</span><span class="phon_arobase schwa" style="color: #40b9ff; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">o</span><span class="phon_r_slash" style="color: #ff0000; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">r</span>
'
"
en
"
:
'
<span class="phon_b" style="color: #ff0000; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">B</span><span class=" stress1" style="color: #40b9ff; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">i</span><span class="phon_k" style="color: #ff0000; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">c</span><span class="phon_arobase schwa" style="color: #40b9ff; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">o</span><span class="phon_l" style="color: #ff0000; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">l</span><span class="phon_arobase schwa" style="color: #40b9ff; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">o</span><span class="phon_r_slash" style="color: #ff0000; -webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;">r</span>
'
},
"
sp_silentWay
"
:
{
"
fr
"
:
'
<span style="-webkit-text-stroke-width: 0.5px; -webkit-text-stroke-color: #000000;"><span class="text phon_s">S</span><span style="background:-webkit-linear-gradient(white 60%, #e7236d 75%);-webkit-background-clip: text;background-clip: text;-webkit-text-fill-color: transparent;">i</span><span class="text phon_l">l</span><span class="text phon_e_maj ">e</span><span class="text phon_n">n</span><span class="text phon_t">t</span><span class="text punct "> </span><span class="text phon_w">W</span><span class="text phon_ei_maj">ay</span></span>
'
,
...
...
static/scripts/main.js
View file @
feacc5e3
...
...
@@ -4,9 +4,30 @@ $(document).ready(function(){
txtarea
.
focus
();
});
const
thisURL
=
window
.
location
.
href
;
console
.
log
(
"
url:
"
,
thisURL
);
var
thisPageLang
=
""
;
// set page target language
setLangFromUrl
()
function
setLangFromUrl
()
{
var
pageLang
=
thisURL
.
match
(
/.*
\/(
fr|en
)
/
);
if
(
pageLang
)
{
console
.
log
(
"
Langue indiquée par l'url:
"
,
pageLang
[
1
]);
thisPageLang
=
pageLang
[
1
];
if
(
pageLang
[
1
]
==
"
fr
"
)
selectLang
(
"
fr
"
);
if
(
pageLang
[
1
]
==
"
en
"
)
selectLang
(
"
en
"
);
}
else
{
console
.
log
(
"
Chargement langue par défaut (fr)
"
);
thisPageLang
=
"
fr
"
selectLang
(
"
fr
"
);
}
}
function
selectLang
(
lang
){
if
(
lang
==
"
en
"
){
interface
(
"
en
"
);
document
.
getElementById
(
'
choixLang
'
).
value
=
'
en
'
;
document
.
getElementById
(
'
output
'
).
classList
.
remove
(
'
outputBold
'
);
document
.
getElementById
(
'
monochromeLabel
'
).
style
.
display
=
""
;
...
...
@@ -15,8 +36,11 @@ function selectLang(lang){
document
.
getElementById
(
'
bicolorLabel
'
).
style
.
margin
=
"
-10px 0px
"
;
document
.
getElementById
(
'
subtitle
'
).
style
.
marginTop
=
"
-20px
"
;
window
.
history
.
pushState
(
""
,
""
,
"
/en
"
);
}
else
if
(
lang
==
"
fr
"
){
interface
(
"
fr
"
);
document
.
getElementById
(
'
choixLang
'
).
value
=
'
fr
'
;
document
.
getElementById
(
'
output
'
).
classList
.
add
(
'
outputBold
'
);
document
.
getElementById
(
'
monochromeLabel
'
).
style
.
display
=
"
none
"
;
...
...
@@ -24,6 +48,8 @@ function selectLang(lang){
document
.
getElementById
(
'
silentWayLabel
'
).
style
.
margin
=
"
0px 0px
"
;
document
.
getElementById
(
'
bicolorLabel
'
).
style
.
margin
=
"
0px 0px
"
;
document
.
getElementById
(
'
subtitle
'
).
style
.
marginTop
=
"
0px
"
;
window
.
history
.
pushState
(
""
,
""
,
"
/fr
"
);
}
}
...
...
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