Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
my-cucumbers-ru-github-io
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Лотуга Данила Сергеевич
my-cucumbers-ru-github-io
Commits
f43c65f3
Commit
f43c65f3
authored
Aug 10, 2011
by
Vadim Makeev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new logic for inner navigation; minor cleanup
parent
766cd63e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
31 deletions
+3
-31
script.js
scripts/script.js
+3
-31
No files found.
scripts/script.js
View file @
f43c65f3
...
...
@@ -122,8 +122,7 @@
}
}
// Increases inner navigation by adding 'active' class to next inactive
// inner navigation item.
// Increases inner navigation by adding 'active' class to next inactive inner navigation item
function
increaseInnerNavigation
(
slideNumber
)
{
// Shortcut for slides without inner navigation
if
(
true
!==
slideList
[
slideNumber
].
hasInnerNavigation
)
{
return
-
1
;
}
...
...
@@ -134,39 +133,17 @@
if
(
null
!==
node
)
{
node
.
classList
.
add
(
'active'
);
// NOTE: 'auto-added' class is used in resetInnerNavigation - to
// overcome problems with manually added 'active' class.
node
.
classList
.
add
(
'auto-added'
);
return
activeNodes
.
length
+
1
;
}
else
{
return
-
1
;
}
}
// Resets inner navigation by removing 'active' class from all previously
// activated elements.
function
resetInnerNavigation
(
slideNumber
)
{
// Shortcut for slides without inner navigation
if
(
true
!==
slideList
[
slideNumber
].
hasInnerNavigation
)
{
return
;
}
var
activeNodes
=
document
.
querySelectorAll
(
getSlideHash
(
slideNumber
)
+
' .active.auto-added'
),
i
=
0
,
l
;
for
(
l
=
activeNodes
.
length
;
i
<
l
;
i
++
)
{
activeNodes
[
i
].
classList
.
remove
(
'active'
);
activeNodes
[
i
].
classList
.
remove
(
'auto-added'
);
}
}
// Event handlers
window
.
addEventListener
(
'DOMContentLoaded'
,
function
()
{
if
(
!
isListMode
())
{
// "?full" is present without slide hash, so we should display first
// slide
// "?full" is present without slide hash, so we should display first slide
if
(
-
1
===
getCurrentSlideNumber
())
{
history
.
replaceState
(
null
,
null
,
url
.
pathname
+
'?full'
+
getSlideHash
(
0
));
}
...
...
@@ -226,7 +203,6 @@
case
75
:
// k
e
.
preventDefault
();
resetInnerNavigation
(
currentSlideNumber
);
currentSlideNumber
--
;
goToSlide
(
currentSlideNumber
);
break
;
...
...
@@ -244,7 +220,6 @@
!
slideList
[
currentSlideNumber
].
hasInnerNavigation
||
-
1
===
increaseInnerNavigation
(
currentSlideNumber
)
)
{
resetInnerNavigation
(
currentSlideNumber
);
currentSlideNumber
++
;
goToSlide
(
currentSlideNumber
);
}
...
...
@@ -253,7 +228,6 @@
case
36
:
// Home
e
.
preventDefault
();
resetInnerNavigation
(
currentSlideNumber
);
currentSlideNumber
=
0
;
goToSlide
(
currentSlideNumber
);
break
;
...
...
@@ -261,7 +235,6 @@
case
35
:
// End
e
.
preventDefault
();
resetInnerNavigation
(
currentSlideNumber
);
currentSlideNumber
=
slideList
.
length
-
1
;
goToSlide
(
currentSlideNumber
);
break
;
...
...
@@ -270,7 +243,6 @@
case
32
:
// Space = +1; Shift + Space = -1
e
.
preventDefault
();
resetInnerNavigation
(
currentSlideNumber
);
currentSlideNumber
+=
e
.
shiftKey
?
-
1
:
1
;
goToSlide
(
currentSlideNumber
);
break
;
...
...
@@ -303,4 +275,4 @@
}
},
false
);
}());
}());
\ No newline at end of file
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