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
e1443282
Commit
e1443282
authored
Mar 06, 2013
by
Wichert Akkerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add init API method to help with shower/shower#124
parent
e1b49a76
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
14 deletions
+33
-14
shower.js
shower.js
+33
-14
No files found.
shower.js
View file @
e1443282
...
...
@@ -7,8 +7,8 @@ window.shower = window.shower || (function(window, document, undefined) {
var
shower
=
{},
url
=
window
.
location
,
body
=
document
.
body
,
slides
=
document
.
querySelectorAll
(
'.slide'
)
,
progress
=
document
.
querySelector
(
'div.progress div'
)
,
slides
=
[]
,
progress
=
[]
,
slideList
=
[],
timer
,
isHistoryApiSupported
=
!!
(
window
.
history
&&
history
.
pushState
),
...
...
@@ -25,19 +25,36 @@ window.shower = window.shower || (function(window, document, undefined) {
return
element
.
dataset
?
element
.
dataset
[
name
]
:
element
.
getAttribute
(
'data-'
+
name
);
};
for
(
i
=
0
;
i
<
l
;
i
++
)
{
// 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
;
/**
* Init
* @param {String} slideSelector
* @param {String} progressBarSelector
* @returns {Object} shower
*/
shower
.
init
=
function
(
slideSelector
,
progressSelector
)
{
slideSelector
=
slideSelector
||
'.slide'
;
progressSelector
=
progressSelector
||
'div.progress div'
;
slides
=
document
.
querySelectorAll
(
slideSelector
);
progress
=
document
.
querySelector
(
progressSelector
);
slideList
=
[],
for
(
i
=
0
;
i
<
l
;
i
++
)
{
// 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
;
}
slideList
.
push
({
id
:
slides
[
i
].
id
,
hasInnerNavigation
:
null
!==
slides
[
i
].
querySelector
(
'.next'
),
hasTiming
:
(
shower
.
_getData
(
slides
[
i
],
'timing'
)
&&
shower
.
_getData
(
slides
[
i
],
'timing'
).
indexOf
(
':'
)
!==
-
1
)
});
}
slideList
.
push
({
id
:
slides
[
i
].
id
,
hasInnerNavigation
:
null
!==
slides
[
i
].
querySelector
(
'.next'
),
hasTiming
:
(
shower
.
_getData
(
slides
[
i
],
'timing'
)
&&
shower
.
_getData
(
slides
[
i
],
'timing'
).
indexOf
(
':'
)
!==
-
1
)
});
}
};
/**
* Get slide scale value.
...
...
@@ -723,6 +740,8 @@ window.shower = window.shower || (function(window, document, undefined) {
}
},
false
);
shower
.
init
();
return
shower
;
})(
this
,
this
.
document
);
\ No newline at end of file
})(
this
,
this
.
document
);
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