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
0930bb94
Commit
0930bb94
authored
Oct 10, 2013
by
Roman Komarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the getCurrentSlideNumber to return 0 when it fails to find a slide, fixes #152
parent
31d74111
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
shower.js
shower.js
+4
-9
No files found.
shower.js
View file @
0930bb94
...
...
@@ -599,7 +599,7 @@ window.shower = window.shower || (function(window, document, undefined) {
/**
* Get current slide number. Starts from zero. Warning: when you have
* slide number 1 in URL this method will return 0.
* If something is wrong return
-1
.
* If something is wrong return
0 to get the first slide
.
* @returns {Number}
*/
shower
.
getCurrentSlideNumber
=
function
()
{
...
...
@@ -614,7 +614,7 @@ window.shower = window.shower || (function(window, document, undefined) {
}
}
return
-
1
;
return
0
;
};
/**
...
...
@@ -634,11 +634,6 @@ window.shower = window.shower || (function(window, document, undefined) {
throw
new
Error
(
'You can
\'
t scroll to because you in slide mode. Please, switch to list mode.'
);
}
// @TODO: WTF?
if
(
-
1
===
slideNumber
)
{
return
ret
;
}
if
(
shower
.
slideList
[
slideNumber
])
{
currentSlide
=
document
.
getElementById
(
shower
.
slideList
[
slideNumber
].
id
);
window
.
scrollTo
(
0
,
currentSlide
.
offsetTop
);
...
...
@@ -799,7 +794,7 @@ window.shower = window.shower || (function(window, document, undefined) {
document
.
addEventListener
(
'keydown'
,
function
(
e
)
{
var
currentSlideNumber
=
shower
.
getCurrentSlideNumber
(),
slide
=
shower
.
slideList
[
currentSlideNumber
!==
-
1
?
currentSlideNumber
:
0
],
slide
=
shower
.
slideList
[
currentSlideNumber
],
slideNumber
;
switch
(
e
.
which
)
{
...
...
@@ -833,7 +828,7 @@ window.shower = window.shower || (function(window, document, undefined) {
break
;
case
13
:
// Enter
if
(
shower
.
isListMode
()
&&
-
1
!==
currentSlideNumber
)
{
if
(
shower
.
isListMode
())
{
e
.
preventDefault
();
shower
.
enterSlideMode
();
...
...
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