Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mathieu
potage
Commits
8939c7f2
Commit
8939c7f2
authored
Jun 30, 2018
by
Mat
Browse files
plus besoin
parent
261c9892
Changes
1
Hide whitespace changes
Inline
Side-by-side
web/js/script.js
deleted
100755 → 0
View file @
261c9892
// 1
// Modale de confirmation avant effacement
let
modal_boutons
=
document
.
querySelectorAll
(
"
table.table a.btn-modal:not(.disabled)
"
);
for
(
let
bouton
of
modal_boutons
)
{
let
gid
=
bouton
.
getAttribute
(
'
id
'
);
if
(
gid
!==
null
)
{
bouton
.
addEventListener
(
"
click
"
,
function
()
{
id
=
gid
.
replace
(
"
dup-
"
,
""
);
$
(
'
#dupmodal-
'
+
id
).
modal
({
focus
:
true
});
id
=
gid
.
replace
(
"
del-
"
,
""
);
$
(
'
#delmodal-
'
+
id
).
modal
({
focus
:
true
});
});
}
}
// 2
// Tri par colonnes
function
ASC
(
a
,
b
)
{
a
=
a
[
1
];
b
=
b
[
1
];
if
(
a
>
b
)
{
return
1
;
}
else
if
(
a
<
b
)
{
return
-
1
;
}
else
{
return
0
;
}
}
function
DESC
(
a
,
b
)
{
a
=
a
[
1
];
b
=
b
[
1
];
if
(
a
>
b
)
{
return
-
1
;
}
else
if
(
a
<
b
)
{
return
1
;
}
else
{
return
0
;
}
}
function
sortTable
(
table
,
col
,
tri
)
{
let
tbody
=
document
.
getElementById
(
table
).
getElementsByTagName
(
'
tbody
'
)[
0
];
let
rows
=
tbody
.
getElementsByTagName
(
'
tr
'
);
let
resort
=
new
Array
();
for
(
let
row
of
rows
)
{
let
sortcol
=
row
.
getElementsByTagName
(
'
td
'
)[
col
].
innerHTML
;
resort
.
push
([
row
,
sortcol
]);
}
if
(
tri
===
'
ASC
'
)
{
resort
.
sort
(
ASC
);
}
if
(
tri
===
'
DESC
'
)
{
resort
.
sort
(
DESC
);
}
for
(
var
i
=
0
;
i
<
resort
.
length
;
i
++
)
{
tbody
.
appendChild
(
resort
[
i
][
0
]);
}
}
let
buttons
=
document
.
querySelectorAll
(
'
a.btn-tri
'
);
for
(
let
btn
of
buttons
)
{
btn
.
addEventListener
(
"
click
"
,
function
()
{
let
col
=
btn
.
getAttribute
(
'
id
'
).
replace
(
"
btncol
"
,
""
).
split
(
"
_
"
)[
0
];
let
tri
=
btn
.
getAttribute
(
'
id
'
).
replace
(
"
btncol
"
,
""
).
split
(
"
_
"
)[
1
].
toUpperCase
();
sortTable
(
'
maintab
'
,
col
,
tri
);
});
}
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