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
D
decker
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
decker
decker
Commits
4e84d75e
Commit
4e84d75e
authored
Nov 01, 2020
by
Mario Botsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show questions in menu
parent
57895ec8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
1 deletion
+55
-1
resource/support/css/engine.css
resource/support/css/engine.css
+21
-0
resource/support/js/engine.js
resource/support/js/engine.js
+34
-1
No files found.
resource/support/css/engine.css
View file @
4e84d75e
...
...
@@ -426,3 +426,24 @@ section#questions-overview table tr td:first-child {
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
li
.slide-menu-item
[
data-questions
]
::after
{
content
:
attr
(
data-questions
);
margin-left
:
1em
;
font-size
:
0.9em
;
/* from class counter */
background-color
:
red
;
color
:
white
;
/* from class badge */
font-family
:
sans-serif
;
font-weight
:
bold
;
line-height
:
1
;
text-align
:
center
;
vertical-align
:
baseline
;
white-space
:
nowrap
;
border-radius
:
0.4em
;
padding
:
0.2em
0.4em
;
}
resource/support/js/engine.js
View file @
4e84d75e
...
...
@@ -33,6 +33,9 @@ async function prepareEngine(api) {
buildOverview
(
api
,
serverToken
);
});
}
Reveal
.
addEventListener
(
"
menu-ready
"
,
_
=>
{
buildMenu
(
api
,
serverToken
);
});
})
.
catch
(
e
=>
{
// Nothing goes without a token
...
...
@@ -99,7 +102,7 @@ function buildInterface(api, initialToken) {
let
lock
=
document
.
createElement
(
"
i
"
);
lock
.
classList
.
add
(
"
fas
"
,
"
fa-lock
"
,
"
lock
"
);
lock
.
setAttribute
(
"
title
"
,
"
Lock user
token
"
);
lock
.
setAttribute
(
"
title
"
,
"
Lock user
"
);
let
unlock
=
document
.
createElement
(
"
i
"
);
unlock
.
classList
.
add
(
"
fas
"
,
"
fa-unlock
"
,
"
unlock
"
);
...
...
@@ -509,3 +512,33 @@ function buildOverview(api, initialToken) {
}
function
buildMenu
(
api
,
initialToken
)
{
var
serverToken
=
initialToken
;
let
updateMenu
=
list
=>
{
for
(
let
comment
of
list
)
{
// get slide info
const
slideID
=
comment
.
slide
;
const
slide
=
document
.
getElementById
(
slideID
);
const
indices
=
Reveal
.
getIndices
(
slide
);
// build query string, get menu item
let
query
=
'
ul.slide-menu-items > li.slide-menu-item
'
;
if
(
indices
.
h
)
query
+=
'
[data-slide-h=
\
"
'
+
indices
.
h
+
'
\
"]
'
;
if
(
indices
.
v
)
query
+=
'
[data-slide-v=
\
"
'
+
indices
.
v
+
'
\
"]
'
;
let
li
=
document
.
querySelector
(
query
);
// update question counter
if
(
li
)
{
li
.
setAttribute
(
'
data-questions
'
,
li
.
hasAttribute
(
'
data-questions
'
)
?
parseInt
(
li
.
getAttribute
(
'
data-questions
'
))
+
1
:
1
);
}
}
};
api
.
getComments
(
deckId
())
.
then
(
updateMenu
)
.
catch
(
console
.
log
);
}
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