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
Phonographe
Commits
70ebc1cb
Commit
70ebc1cb
authored
Apr 07, 2021
by
Sylvain Coulange
Browse files
correction bug export texte Phonographe + espace dans player
parent
d97d4814
Changes
6
Hide whitespace changes
Inline
Side-by-side
static/js/clavier.js
View file @
70ebc1cb
...
...
@@ -492,55 +492,56 @@ var span = document.getElementsByClassName("close")[0]
// Fonction pour ouvrir le PopUp
function
getPopUp
()
{
if
(
bgWhite
)
bg2white
()
var
outputContent
=
document
.
getElementById
(
'
textZone
'
).
innerHTML
if
(
bgWhite
)
bg2white
()
;
var
outputContent
=
document
.
getElementById
(
'
textZone
'
).
innerHTML
;
var
finalOutput
=
""
;
// contiendra la chaîne de caractères à copier coller
// On récupère la liste des <span>
const
regexSpan
=
/<span id="
\w
+" class="
(
.*
?)
".*
?
>
(
.*
?)
<
\/
span>|<br>/gm
let
m
const
regexSpan
=
/<span id=".*
?
" class="
(
.*
?)
".*
?
>
(
.*
?)
<
\/
span>|<br>/gm
;
console
.
log
(
regexSpan
.
exec
(
outputContent
));
let
m
;
while
((
m
=
regexSpan
.
exec
(
outputContent
))
!==
null
)
{
// This is necessary to avoid infinite loops with zero-width matches
if
(
m
.
index
===
regexSpan
.
lastIndex
)
{
regexSpan
.
lastIndex
++
regexSpan
.
lastIndex
++
;
}
console
.
log
(
m
[
1
],
m
[
2
])
console
.
log
(
m
[
1
],
m
[
2
])
;
if
(
m
[
0
]
==
"
<br>
"
)
{
finalOutput
+=
"
<br>
"
finalOutput
+=
"
<br>
"
;
}
else
if
(
m
[
2
]
!=
"
"
)
{
classs
=
m
[
1
].
split
(
'
'
)
var
expFonte
=
"
font-family: Palatino, Times, Calibri;
"
var
expCoulBase
=
"
color:#cccccc;
"
var
classs
=
m
[
1
].
split
(
'
'
)
;
var
expFonte
=
"
font-family: Palatino, Times, Calibri;
"
;
var
expCoulBase
=
"
color:#cccccc;
"
;
var
expSizeBase
=
"
font-size:30pt;
"
var
expSizeStress1
=
"
font-size:45pt;
"
var
expSizeStress2
=
"
font-size:36pt;
"
var
expSizeSchwa
=
"
font-size:20pt;
"
var
expSizeBase
=
"
font-size:30pt;
"
;
var
expSizeStress1
=
"
font-size:45pt;
"
;
var
expSizeStress2
=
"
font-size:36pt;
"
;
var
expSizeSchwa
=
"
font-size:20pt;
"
;
var
expBold
=
"
font-weight: bold;
"
var
expNoBold
=
"
font-weight: normal;
"
var
expLong
=
"
text-decoration: underline;
"
var
expBold
=
"
font-weight: bold;
"
;
var
expNoBold
=
"
font-weight: normal;
"
;
var
expLong
=
"
text-decoration: underline;
"
;
newOutputSpan
=
"
<span style='
"
+
expFonte
+
expBold
+
expSizeBase
// PAR DEFAUT
newOutputSpan
=
"
<span style='
"
+
expFonte
+
expBold
+
expSizeBase
;
// PAR DEFAUT
if
(
classs
.
includes
(
"
punct
"
))
newOutputSpan
=
"
<span style='
"
+
expFonte
+
expSizeBase
if
(
classs
.
includes
(
"
unstressed
"
))
newOutputSpan
=
"
<span style='
"
+
expFonte
+
expNoBold
+
expSizeBase
if
(
classs
.
includes
(
"
schwa
"
))
newOutputSpan
=
"
<span style='
"
+
expFonte
+
expNoBold
+
expSizeSchwa
if
(
classs
.
includes
(
"
stress1
"
))
newOutputSpan
=
"
<span style='
"
+
expFonte
+
expSizeStress1
if
(
classs
.
includes
(
"
stress2
"
))
newOutputSpan
=
"
<span style='
"
+
expFonte
+
expSizeStress2
if
(
classs
.
includes
(
"
punct
"
))
newOutputSpan
=
"
<span style='
"
+
expFonte
+
expSizeBase
;
if
(
classs
.
includes
(
"
unstressed
"
))
newOutputSpan
=
"
<span style='
"
+
expFonte
+
expNoBold
+
expSizeBase
;
if
(
classs
.
includes
(
"
schwa
"
))
newOutputSpan
=
"
<span style='
"
+
expFonte
+
expNoBold
+
expSizeSchwa
;
if
(
classs
.
includes
(
"
stress1
"
))
newOutputSpan
=
"
<span style='
"
+
expFonte
+
expSizeStress1
;
if
(
classs
.
includes
(
"
stress2
"
))
newOutputSpan
=
"
<span style='
"
+
expFonte
+
expSizeStress2
;
if
(
classs
.
includes
(
"
punct
"
))
newOutputSpan
+=
expCoulBase
if
(
classs
.
includes
(
"
punct
"
))
newOutputSpan
+=
expCoulBase
;
// COULEURS
phonClass
=
""
phonClass
=
""
;
for
(
i
=
0
;
i
<
classs
.
length
;
i
++
)
{
if
(
classs
[
i
].
match
(
/phon_.*/
))
phonClass
=
classs
[
i
]
if
(
classs
[
i
].
match
(
/phon_.*/
))
phonClass
=
classs
[
i
]
;
}
if
(
phonClass
.
match
(
/.*_long/
))
newOutputSpan
+=
expLong
if
(
phonClass
!=
""
)
newOutputSpan
+=
phon2color
(
phonClass
)
if
(
phonClass
.
match
(
/.*_long/
))
newOutputSpan
+=
expLong
;
if
(
phonClass
!=
""
)
newOutputSpan
+=
phon2color
(
phonClass
)
;
newOutputSpan
+=
"
'>
"
+
m
[
2
]
+
"
</span>
"
newOutputSpan
+=
"
'>
"
+
m
[
2
]
+
"
</span>
"
;
finalOutput
+=
newOutputSpan
finalOutput
+=
newOutputSpan
;
}
}
...
...
static/js/dragdrop.js
View file @
70ebc1cb
...
...
@@ -5,22 +5,31 @@
// https://www.youtube.com/watch?v=jfYWwQrtzzY&t=102s
// ajouter DragDropTouch.js pour compatibilité tactile
if
(
thisAppli
==
"
phonographe
"
)
rep
=
document
.
getElementById
(
'
textZone
'
)
if
(
thisAppli
==
"
phonographe
"
)
{
targ
=
document
.
getElementById
(
'
textZone
'
)
}
else
{
targ
=
document
.
getElementById
(
ligneCible
)
}
targ
.
addEventListener
(
'
dragover
'
,
e
=>
{
// mise à jour de la ligne cible
if
(
thisAppli
==
"
phonoplayer
"
)
{
targ
=
document
.
getElementById
(
ligneCible
)
}
rep
.
addEventListener
(
'
dragover
'
,
e
=>
{
e
.
preventDefault
()
const
afterElement
=
getDragAfterElement
(
e
.
clientX
)
const
carte
=
document
.
querySelector
(
'
.dragging
'
)
if
(
afterElement
==
null
)
{
rep
.
append
(
carte
)
targ
.
append
(
carte
)
}
else
{
rep
.
insertBefore
(
carte
,
afterElement
)
targ
.
insertBefore
(
carte
,
afterElement
)
}
})
function
getDragAfterElement
(
x
)
{
const
draggableElements
=
[...
rep
.
querySelectorAll
(
'
.carte:not(.dragging)
'
)]
const
draggableElements
=
[...
targ
.
querySelectorAll
(
'
.carte:not(.dragging)
'
)]
return
draggableElements
.
reduce
((
closest
,
child
)
=>
{
const
box
=
child
.
getBoundingClientRect
()
const
offset
=
x
-
box
.
left
-
box
.
width
/
2
...
...
static/js/phon2api.js
View file @
70ebc1cb
...
...
@@ -304,6 +304,5 @@ var phon2api = {
"
phon_j3_rho
"
:
"
jɝ
"
,
"
phon_schwar
"
:
"
əɹ
"
,
"
phon_schwiz
"
:
"
ɪz
"
,
"
phon_schwju
"
:
"
jʊ
"
,
"
ju
"
:
"
phon_schwju
"
"
phon_schwju
"
:
"
jʊ
"
}
\ No newline at end of file
static/js/playerPhono.js
View file @
70ebc1cb
...
...
@@ -106,7 +106,7 @@ function recupPhon(identifiant) {
var
newCarte
=
document
.
createElement
(
'
div
'
)
newCarte
.
classList
=
"
carte
"
+
rectId
;
// on garde rectId, pour connaître le phonème mais sans appeler les styles de phonochromie-alem.css
newCarte
.
draggable
=
true
newCarte
.
style
.
backgroundImage
=
"
url('/static/cartes/
"
+
famille
+
"
/
"
+
phonId
+
"
.jpg')
"
if
(
!
identifiant
.
match
(
/espace/
))
{
newCarte
.
style
.
backgroundImage
=
"
url('/static/cartes/
"
+
famille
+
"
/
"
+
phonId
+
"
.jpg')
"
}
newCarte
.
addEventListener
(
"
click
"
,
function
(
e
)
{
var
tgt
=
e
.
target
playEffect
(
"
delete
"
)
...
...
@@ -121,7 +121,7 @@ function recupPhon(identifiant) {
newCarte
.
addEventListener
(
'
dragend
'
,
()
=>
{
newCarte
.
classList
.
remove
(
'
dragging
'
)
let
listCartes
=
[]
for
(
i
=
0
;
i
<
rep
.
children
.
length
;
i
++
)
listCartes
.
push
(
Array
.
from
(
rep
.
children
[
i
].
classList
).
join
(
"
.
"
))
for
(
i
=
0
;
i
<
rep
Div
.
children
.
length
;
i
++
)
listCartes
.
push
(
Array
.
from
(
rep
Div
.
children
[
i
].
classList
).
join
(
"
.
"
))
saveTrace
(
`drag to
${
listCartes
.
join
(
'
'
)}
`
)
})
...
...
@@ -324,6 +324,7 @@ window.onclick = function(event) {
function
initGraph
()
{
// Rien. Pour éviter une erreur quand on clique dans le fond du tableau
recupPhon
(
"
espace
"
)
}
// RECUPERATION DU SVG (CLICK FR)
...
...
static/js/syntheseVocale.js
View file @
70ebc1cb
...
...
@@ -38,7 +38,7 @@ async function playIpa(line="") {
ipa
=
""
for
(
i
=
0
;
i
<
rep
.
children
.
length
;
i
++
)
{
var
repphon
=
rep
.
children
[
i
].
classList
[
1
].
replace
(
"
rect
"
,
"
phon
"
)
ipa
+=
phon2api
[
repphon
]
if
(
repphon
!=
"
espace
"
)
{
ipa
+=
phon2api
[
repphon
]
}
}
if
(
ipa
.
length
>
0
&&
ipa
!=
currentIpa
)
{
synth
=
true
}
}
...
...
templates/clavier.html
View file @
70ebc1cb
...
...
@@ -36,7 +36,7 @@
</svg>
</div>
<div
onclick=
"bg2white()"
class=
"langtitle"
id=
"ti_changeBgColor"
><svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"30"
height=
"30"
fill=
"currentColor"
class=
"bi bi-circle-half nobg"
viewBox=
"0 0 16 16"
><path
d=
"M8 15A7 7 0 1 0 8 1v14zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16z"
/></svg></div>
<div
id=
"div2png"
class=
"langtitle"
><svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"30"
height=
"30"
fill=
"currentColor"
class=
"bi bi-image nobg"
viewBox=
"0 0 16 16"
><path
d=
"M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"
/><path
d=
"M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1h12z"
/></svg></div>
<!--
<div id="div2png" class="langtitle"><svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="currentColor" class="bi bi-image nobg" viewBox="0 0 16 16"><path d="M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"/><path d="M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1h12z"/></svg></div>
-->
<div
onclick=
"toggleContentEditable()"
id=
"btnContentEditable"
class=
"langtitle"
><svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"30"
height=
"30"
fill=
"currentColor"
class=
"bi bi-pencil-square nobg"
viewBox=
"0 0 16 16"
><path
d=
"M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456l-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z"
/><path
fill-rule=
"evenodd"
d=
"M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z"
/></svg></div>
</div>
</div>
...
...
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