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
PhonoDrop
Commits
e9db04ee
Commit
e9db04ee
authored
Apr 30, 2020
by
Sylvain Coulange
Browse files
correction bug enregistrements new id dans repCases après duplication carte
parent
9911f9d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
public/scripts/script.js
View file @
e9db04ee
...
@@ -97,7 +97,7 @@ function loadPage() {
...
@@ -97,7 +97,7 @@ function loadPage() {
var
phon
=
bouches
[
bouchePath
].
replace
(
'
bouche_
'
,
'
phon_
'
).
replace
(
'
.jpg
'
,
''
);
var
phon
=
bouches
[
bouchePath
].
replace
(
'
bouche_
'
,
'
phon_
'
).
replace
(
'
.jpg
'
,
''
);
// Formatage de la carte
// Formatage de la carte
newDiv
.
id
=
phon
+
'
-
'
+
Math
.
random
().
toString
(
36
).
substring
(
7
);
newDiv
.
id
=
phon
+
'
-
'
+
Math
.
random
().
toString
(
36
).
substring
(
2
,
9
);
newDiv
.
className
=
"
carte
"
;
newDiv
.
className
=
"
carte
"
;
newDiv
.
draggable
=
true
;
newDiv
.
draggable
=
true
;
newDiv
.
style
.
backgroundImage
=
'
url("bouches/
'
+
bouches
[
bouchePath
]
+
'
"
'
;
newDiv
.
style
.
backgroundImage
=
'
url("bouches/
'
+
bouches
[
bouchePath
]
+
'
"
'
;
...
@@ -113,7 +113,7 @@ function loadPage() {
...
@@ -113,7 +113,7 @@ function loadPage() {
var
punct
=
puncts
[
i
].
replace
(
'
.jpg
'
,
''
);
var
punct
=
puncts
[
i
].
replace
(
'
.jpg
'
,
''
);
// Formatage de la carte
// Formatage de la carte
newDiv
.
id
=
punct
+
'
-
'
+
Math
.
random
().
toString
(
36
).
substring
(
7
);
newDiv
.
id
=
punct
+
'
-
'
+
Math
.
random
().
toString
(
36
).
substring
(
2
,
9
);
newDiv
.
className
=
"
carte
"
;
newDiv
.
className
=
"
carte
"
;
newDiv
.
draggable
=
true
;
newDiv
.
draggable
=
true
;
newDiv
.
style
.
backgroundImage
=
'
url("punct/
'
+
puncts
[
i
]
+
'
"
'
;
newDiv
.
style
.
backgroundImage
=
'
url("punct/
'
+
puncts
[
i
]
+
'
"
'
;
...
@@ -129,7 +129,7 @@ function loadPage() {
...
@@ -129,7 +129,7 @@ function loadPage() {
var
tp
=
tps
[
i
].
replace
(
'
.jpg
'
,
''
);
var
tp
=
tps
[
i
].
replace
(
'
.jpg
'
,
''
);
// Formatage de la carte
// Formatage de la carte
newDiv
.
id
=
tp
+
'
-
'
+
Math
.
random
().
toString
(
36
).
substring
(
7
);
newDiv
.
id
=
tp
+
'
-
'
+
Math
.
random
().
toString
(
36
).
substring
(
2
,
9
);
newDiv
.
className
=
"
carte
"
;
newDiv
.
className
=
"
carte
"
;
newDiv
.
draggable
=
true
;
newDiv
.
draggable
=
true
;
newDiv
.
style
.
backgroundImage
=
'
url("trait-point/
'
+
tps
[
i
]
+
'
"
'
;
newDiv
.
style
.
backgroundImage
=
'
url("trait-point/
'
+
tps
[
i
]
+
'
"
'
;
...
@@ -202,6 +202,7 @@ function loadPage() {
...
@@ -202,6 +202,7 @@ function loadPage() {
//////////////////////////////////////////
//////////////////////////////////////////
// https://www.youtube.com/watch?v=C22hQKE_32c
// https://www.youtube.com/watch?v=C22hQKE_32c
// multiple elements : https://www.sitepoint.com/accessible-drag-drop/
// multiple elements : https://www.sitepoint.com/accessible-drag-drop/
// simple draggable http://jsfiddle.net/maniator/zVZFq/
// Drag Functions
// Drag Functions
...
@@ -273,16 +274,17 @@ function loadPage() {
...
@@ -273,16 +274,17 @@ function loadPage() {
}
else
if
(
this
.
classList
.
contains
(
'
case
'
))
{
}
else
if
(
this
.
classList
.
contains
(
'
case
'
))
{
repCases
[
item
.
parentNode
.
id
]
=
null
;
repCases
[
item
.
parentNode
.
id
]
=
null
;
repCases
[
this
.
id
]
=
item
.
id
;
logg
(
"
DROP! in
"
+
this
.
id
);
logg
(
"
DROP! in
"
+
this
.
id
);
var
nodeCopy
=
item
.
cloneNode
(
true
);
var
nodeCopy
=
item
.
cloneNode
(
true
);
nodeCopy
.
classList
.
remove
(
'
hold
'
);
nodeCopy
.
classList
.
remove
(
'
hold
'
);
nodeCopy
.
addEventListener
(
'
dragstart
'
,
dragStart
);
nodeCopy
.
addEventListener
(
'
dragstart
'
,
dragStart
);
nodeCopy
.
addEventListener
(
'
dragend
'
,
dragEnd
);
nodeCopy
.
addEventListener
(
'
dragend
'
,
dragEnd
);
var
thisPhon
=
nodeCopy
.
id
.
match
(
/phon_
\w
+/
);
var
thisPhon
=
nodeCopy
.
id
.
match
(
/
(\w
+
)
-
\w
+/
);
thisPhon
=
thisPhon
[
1
];
logg
(
"
Match id:
"
+
thisPhon
);
logg
(
"
Match id:
"
+
thisPhon
);
thisPhon
=
thisPhon
+
'
-
'
+
Math
.
random
().
toString
(
36
).
substring
(
7
);
thisPhon
=
thisPhon
+
'
-
'
+
Math
.
random
().
toString
(
36
).
substring
(
2
,
9
);
nodeCopy
.
id
=
thisPhon
;
nodeCopy
.
id
=
thisPhon
;
repCases
[
this
.
id
]
=
nodeCopy
.
id
;
logg
(
"
Created new item id:
"
+
nodeCopy
.
id
);
logg
(
"
Created new item id:
"
+
nodeCopy
.
id
);
e
.
currentTarget
.
innerHTML
=
''
;
// on vide la case si elle déjà pleine.
e
.
currentTarget
.
innerHTML
=
''
;
// on vide la case si elle déjà pleine.
e
.
currentTarget
.
appendChild
(
nodeCopy
);
e
.
currentTarget
.
appendChild
(
nodeCopy
);
...
@@ -400,7 +402,7 @@ async function save2url(){
...
@@ -400,7 +402,7 @@ async function save2url(){
var
dateTime
=
date
+
'
'
+
time
;
var
dateTime
=
date
+
'
'
+
time
;
// Id
// Id
if
(
pageId
==
'
0
'
)
pageId
=
'
id-
'
+
Math
.
random
().
toString
(
36
).
substring
(
7
);
if
(
pageId
==
'
0
'
)
pageId
=
'
id-
'
+
Math
.
random
().
toString
(
36
).
substring
(
2
,
9
);
// ON EMBALLE TOUT ÇA
// ON EMBALLE TOUT ÇA
var
colis
=
{
var
colis
=
{
...
...
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