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
67f7f776
Commit
67f7f776
authored
May 10, 2013
by
Vadim Makeev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #132 parsing issue for data-timing
parent
b364f028
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
12 deletions
+22
-12
shower.js
shower.js
+21
-11
shower.min.js
shower.min.js
+1
-1
No files found.
shower.js
View file @
67f7f776
...
...
@@ -179,7 +179,6 @@ window.shower = window.shower || (function(window, document, undefined) {
return
element
.
dataset
?
element
.
dataset
[
name
]
:
element
.
getAttribute
(
'data-'
+
name
);
};
shower
.
slideList
=
[];
/**
...
...
@@ -189,7 +188,9 @@ window.shower = window.shower || (function(window, document, undefined) {
* @returns {Object} shower
*/
shower
.
init
=
function
(
slideSelector
,
progressSelector
)
{
var
timing
;
var
timing
,
minutes
,
seconds
;
slideSelector
=
slideSelector
||
'.slide'
;
progressSelector
=
progressSelector
||
'div.progress div'
;
...
...
@@ -198,29 +199,38 @@ window.shower = window.shower || (function(window, document, undefined) {
progress
=
document
.
querySelector
(
progressSelector
);
for
(
var
i
=
0
;
i
<
slides
.
length
;
i
++
)
{
// Slide IDs are optional.
In case of missing ID we set it to the
// slide number
// Slide IDs are optional.
//
In case of missing ID we set it to the
slide number
if
(
!
slides
[
i
].
id
)
{
slides
[
i
].
id
=
i
+
1
;
}
timing
=
shower
.
_getData
(
slides
[
i
],
'timing'
);
if
(
timing
&&
timing
.
indexOf
(
':'
)
!==
-
1
)
{
timing
=
timing
.
split
(
':'
);
// Compute number of milliseconds from format "mm:ss"
timing
=
(
parseInt
(
timing
[
0
],
10
)
*
60
+
parseInt
(
timing
[
1
],
10
))
*
1000
;
timing
=
shower
.
_getData
(
slides
[
i
],
'timing'
)
||
undefined
;
// Parsing timing in [S] or [M:S] format
// and returning it in milliseconds
if
(
timing
&&
timing
.
split
(
':'
).
length
<=
2
)
{
if
(
timing
.
indexOf
(
':'
)
!==
-
1
)
{
timing
=
timing
.
split
(
':'
);
minutes
=
parseInt
(
timing
[
0
],
10
),
seconds
=
parseInt
(
timing
[
1
],
10
);
timing
=
(
minutes
*
60
+
seconds
)
*
1000
;
}
else
{
seconds
=
parseInt
(
timing
,
10
);
timing
=
seconds
*
1000
;
}
if
(
slides
[
i
].
querySelector
(
'.next'
))
{
timing
=
timing
/
(
slides
[
i
].
querySelectorAll
(
'.next'
).
length
+
1
);
}
}
else
{
timing
=
undefined
;
}
shower
.
slideList
.
push
(
new
Slide
({
id
:
slides
[
i
].
id
,
number
:
i
,
hasInnerNavigation
:
null
!==
slides
[
i
].
querySelector
(
'.next'
),
timing
:
parseInt
(
timing
,
10
)
||
undefined
,
timing
:
timing
,
innerLength
:
slides
[
i
].
querySelectorAll
(
'.next'
).
length
,
innerComplete
:
0
}));
...
...
shower.min.js
View file @
67f7f776
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