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
247d715f
Commit
247d715f
authored
Nov 08, 2010
by
Dmitry Baranovskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Duck-typing fix. Less `typeof`, more casting.
parent
fc10c308
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
65 deletions
+65
-65
script.js
scripts/script.js
+65
-65
No files found.
scripts/script.js
View file @
247d715f
var
url
=
document
.
location
,
linkScreen
=
document
.
querySelector
(
'link[title=screen]'
),
linkProjection
=
document
.
querySelector
(
'link[title=projection]'
),
shower
=
document
.
querySelector
(
'div.shower'
),
slides
=
document
.
querySelectorAll
(
'section.slide'
),
slideList
=
[],
hashList
=
{},
fullscreen
=
false
;
(
function
()
{
var
url
=
document
.
location
,
linkScreen
=
document
.
querySelector
(
'link[title=screen]'
),
linkProjection
=
document
.
querySelector
(
'link[title=projection]'
),
shower
=
document
.
querySelector
(
'div.shower'
),
slides
=
document
.
querySelectorAll
(
'section.slide'
),
slideList
=
[],
hashList
=
{},
fullscreen
=
false
;
for
(
var
i
=
0
,
slidesLength
=
slides
.
length
;
i
<
slidesLength
;
i
++
)
{
var
id
=
slides
[
i
].
id
;
slideList
[
i
]
=
'#'
+
id
;
hashList
[
'#'
+
id
]
=
i
;
}
for
(
var
i
=
0
,
slidesLength
=
slides
.
length
;
i
<
slidesLength
;
i
++
)
{
var
id
=
slides
[
i
].
id
;
slideList
[
i
]
=
'#'
+
id
;
hashList
[
'#'
+
id
]
=
i
;
}
function
toggleFull
(
force
)
{
fullscreen
=
(
typeof
force
==
'boolean'
)
?
force
:
(
window
.
fullScreen
||
// Firefox
document
.
webkitFullScreen
||
// Webkit
screen
.
width
==
window
.
outerWidth
&&
screen
.
height
==
window
.
outerHeight
);
updateView
();
}
function
toggleFull
(
force
)
{
fullscreen
=
(
force
!=
null
)
?
!!
force
:
(
window
.
fullScreen
||
// Firefox
document
.
webkitFullScreen
||
// Webkit
screen
.
width
==
window
.
outerWidth
&&
screen
.
height
==
window
.
outerHeight
);
updateView
();
}
function
turnSlide
(
e
)
{
if
(
!
fullscreen
)
return
;
var
current
=
hashList
[
url
.
hash
],
target
;
if
(
e
.
type
==
'keyup'
)
{
// Key-Based
switch
(
e
.
which
)
{
case
33
:
// PgUp
case
38
:
// Up
case
37
:
// Left
current
--
;
break
;
case
34
:
// PgDown
case
40
:
// Down
case
39
:
// Right
current
++
;
break
;
case
32
:
// Space
current
+=
e
.
shiftKey
?
-
1
:
1
;
break
;
default
:
return
;
function
turnSlide
(
e
)
{
if
(
!
fullscreen
)
return
;
var
current
=
hashList
[
url
.
hash
],
target
;
if
(
e
==
null
)
{
target
=
slideList
[
current
++
];
}
else
if
(
e
.
type
==
'keyup'
)
{
// Key-Based
switch
(
e
.
which
)
{
case
33
:
// PgUp
case
38
:
// Up
case
37
:
// Left
current
--
;
break
;
case
34
:
// PgDown
case
40
:
// Down
case
39
:
// Right
current
++
;
break
;
case
32
:
// Space
current
+=
e
.
shiftKey
?
-
1
:
1
;
break
;
default
:
return
;
}
target
=
slideList
[
current
];
e
.
preventDefault
();
}
else
{
// Specific
target
=
slideList
[
+
e
||
0
];
}
target
=
slideList
[
current
];
e
.
preventDefault
();
}
if
(
typeof
e
==
'number'
)
{
// Specific
target
=
slideList
[
e
];
if
(
target
)
url
.
hash
=
target
;
}
if
(
typeof
e
==
'undefined'
)
{
// Next
target
=
slideList
[
current
++
];
}
if
(
target
)
url
.
hash
=
target
;
}
function
updateView
()
{
linkScreen
.
disabled
=
fullscreen
;
linkProjection
.
disabled
=
!
fullscreen
;
if
(
!
hashList
[
url
.
hash
])
turnSlide
(
0
);
}
function
updateView
()
{
linkScreen
.
disabled
=
fullscreen
;
linkProjection
.
disabled
=
!
fullscreen
;
if
(
!
hashList
[
url
.
hash
])
turnSlide
(
0
);
}
slides
[
0
].
addEventListener
(
'click'
,
function
(){
toggleFull
(
true
);
},
false
);
slides
[
0
].
addEventListener
(
'click'
,
function
(){
toggleFull
(
true
);
},
false
);
document
.
addEventListener
(
'keyup'
,
turnSlide
,
false
);
document
.
addEventListener
(
'keyup'
,
function
(
e
)
{
if
(
e
.
which
==
27
)
toggleFull
(
false
);
},
false
);
document
.
addEventListener
(
'keyup'
,
turnSlide
,
false
);
document
.
addEventListener
(
'keyup'
,
function
(
e
)
{
if
(
e
.
which
==
27
)
toggleFull
(
false
);
},
false
);
window
.
addEventListener
(
'resize'
,
toggleFull
,
false
);
window
.
addEventListener
(
'DOMContentLoaded'
,
toggleFull
,
false
);
\ No newline at end of file
window
.
addEventListener
(
'resize'
,
toggleFull
,
false
);
window
.
addEventListener
(
'DOMContentLoaded'
,
toggleFull
,
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