Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
shower-presentation
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
Шардт Максим Александрович
shower-presentation
Commits
7e3b56ac
Commit
7e3b56ac
authored
Feb 17, 2014
by
Tony Ganch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Non-existent slide id leads to the first slide
parent
71aa70ec
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
+24
-5
shower.js
shower.js
+23
-4
shower.min.js
shower.min.js
+1
-1
No files found.
shower.js
View file @
7e3b56ac
...
@@ -599,13 +599,18 @@ window.shower = window.shower || (function(window, document, undefined) {
...
@@ -599,13 +599,18 @@ window.shower = window.shower || (function(window, document, undefined) {
/**
/**
* Get current slide number. Starts from zero. Warning: when you have
* Get current slide number. Starts from zero. Warning: when you have
* slide number 1 in URL this method will return 0.
* slide number 1 in URL this method will return 0.
* If something is wrong return -1.
* If there is no slide number in url, return -1.
* If there is a slide number in url, but the slide does not exist, return 0.
* @returns {Number}
* @returns {Number}
*/
*/
shower
.
getCurrentSlideNumber
=
function
()
{
shower
.
getCurrentSlideNumber
=
function
()
{
var
i
=
shower
.
slideList
.
length
-
1
,
var
i
=
shower
.
slideList
.
length
-
1
,
currentSlideId
=
url
.
hash
.
substr
(
1
);
currentSlideId
=
url
.
hash
.
substr
(
1
);
if
(
currentSlideId
===
''
)
{
return
-
1
;
}
// As fast as you can ;-)
// As fast as you can ;-)
// http://jsperf.com/for-vs-foreach/46
// http://jsperf.com/for-vs-foreach/46
for
(;
i
>=
0
;
--
i
)
{
for
(;
i
>=
0
;
--
i
)
{
...
@@ -614,7 +619,7 @@ window.shower = window.shower || (function(window, document, undefined) {
...
@@ -614,7 +619,7 @@ window.shower = window.shower || (function(window, document, undefined) {
}
}
}
}
return
-
1
;
return
0
;
};
};
/**
/**
...
@@ -809,13 +814,27 @@ window.shower = window.shower || (function(window, document, undefined) {
...
@@ -809,13 +814,27 @@ window.shower = window.shower || (function(window, document, undefined) {
// Event handlers
// Event handlers
window
.
addEventListener
(
'DOMContentLoaded'
,
function
()
{
window
.
addEventListener
(
'DOMContentLoaded'
,
function
()
{
if
(
body
.
classList
.
contains
(
'full'
)
||
shower
.
isSlideMode
())
{
var
currentSlideNumber
=
shower
.
getCurrentSlideNumber
(),
shower
.
go
(
shower
.
getCurrentSlideNumber
());
isSlideMode
=
body
.
classList
.
contains
(
'full'
)
||
shower
.
isSlideMode
();
if
(
currentSlideNumber
===
-
1
&&
isSlideMode
)
{
shower
.
go
(
0
);
}
else
if
(
currentSlideNumber
===
0
||
isSlideMode
)
{
shower
.
go
(
currentSlideNumber
);
}
if
(
isSlideMode
)
{
shower
.
enterSlideMode
();
shower
.
enterSlideMode
();
}
}
},
false
);
},
false
);
window
.
addEventListener
(
'popstate'
,
function
()
{
window
.
addEventListener
(
'popstate'
,
function
()
{
var
currentSlideNumber
=
shower
.
getCurrentSlideNumber
();
if
(
currentSlideNumber
!==
-
1
)
{
shower
.
go
(
currentSlideNumber
);
}
if
(
shower
.
isListMode
())
{
if
(
shower
.
isListMode
())
{
shower
.
enterListMode
();
shower
.
enterListMode
();
}
else
{
}
else
{
...
...
shower.min.js
View file @
7e3b56ac
This diff is collapsed.
Click to expand it.
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