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
fc10c308
Commit
fc10c308
authored
Nov 07, 2010
by
Vadim Makeev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
script refactoring
parent
53f357cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
51 deletions
+50
-51
script.js
scripts/script.js
+50
-51
No files found.
scripts/script.js
View file @
fc10c308
var
url
=
document
.
location
,
var
url
=
document
.
location
,
domSlides
=
document
.
querySelectorAll
(
'section.slide'
),
slides
=
[],
backhash
=
{},
linkScreen
=
document
.
querySelector
(
'link[title=screen]'
),
linkScreen
=
document
.
querySelector
(
'link[title=screen]'
),
linkProjection
=
document
.
querySelector
(
'link[title=projection]'
),
linkProjection
=
document
.
querySelector
(
'link[title=projection]'
),
shower
=
document
.
querySelector
(
'div.shower'
),
slides
=
document
.
querySelectorAll
(
'section.slide'
),
slideList
=
[],
hashList
=
{},
fullscreen
=
false
;
fullscreen
=
false
;
for
(
var
i
=
0
,
iLength
=
domSlides
.
length
;
i
<
i
Length
;
i
++
)
{
for
(
var
i
=
0
,
slidesLength
=
slides
.
length
;
i
<
slides
Length
;
i
++
)
{
var
id
=
domS
lides
[
i
].
id
;
var
id
=
s
lides
[
i
].
id
;
slide
s
[
i
]
=
'#'
+
id
;
slide
List
[
i
]
=
'#'
+
id
;
backhash
[
'#'
+
id
]
=
i
;
hashList
[
'#'
+
id
]
=
i
;
}
}
function
enterFull
()
{
function
toggleFull
(
force
)
{
fullscreen
=
true
;
fullscreen
=
(
typeof
force
==
'boolean'
)
?
force
:
(
updateView
();
window
.
fullScreen
||
// Firefox
}
function
exitFull
()
{
fullscreen
=
false
;
updateView
();
}
function
toggleFull
()
{
if
(
window
.
fullScreen
||
// Firefox
document
.
webkitFullScreen
||
// Webkit
document
.
webkitFullScreen
||
// Webkit
screen
.
width
==
window
.
outerWidth
&&
screen
.
height
==
window
.
outerHeight
)
{
screen
.
width
==
window
.
outerWidth
&&
screen
.
height
==
window
.
outerHeight
enterFull
();
);
}
else
{
updateView
();
exitFull
();
}
}
}
function
turnSlide
(
e
)
{
function
turnSlide
(
e
)
{
if
(
!
fullscreen
)
return
;
if
(
!
fullscreen
)
return
;
var
current
=
backhash
[
url
.
hash
],
var
current
=
hashList
[
url
.
hash
],
target
,
target
;
command
;
if
(
e
.
type
==
'keyup'
)
{
// Key-Based
switch
(
e
.
which
)
{
switch
(
e
.
which
)
{
case
33
:
// PgUp
case
33
:
// PgUp
case
38
:
// Up
case
38
:
// Up
case
37
:
// Left
case
37
:
// Left
current
--
;
current
--
;
break
;
break
;
case
34
:
// PgDown
case
34
:
// PgDown
case
40
:
// Down
case
40
:
// Down
case
39
:
// Right
case
39
:
// Right
current
++
;
current
++
;
break
;
break
;
case
32
:
// Space
case
32
:
// Space
current
+=
e
.
shiftKey
?
-
1
:
1
;
current
+=
e
.
shiftKey
?
-
1
:
1
;
break
;
break
;
default
:
default
:
return
;
return
;
}
target
=
slideList
[
current
];
e
.
preventDefault
();
}
if
(
typeof
e
==
'number'
)
{
// Specific
target
=
slideList
[
e
];
}
if
(
typeof
e
==
'undefined'
)
{
// Next
target
=
slideList
[
current
++
];
}
}
target
=
slides
[
current
];
e
.
preventDefault
();
if
(
target
)
url
.
hash
=
target
;
if
(
target
)
url
.
hash
=
target
;
}
}
function
updateView
()
{
function
updateView
()
{
linkScreen
.
disabled
=
fullscreen
;
linkScreen
.
disabled
=
fullscreen
;
linkProjection
.
disabled
=
!
fullscreen
;
linkProjection
.
disabled
=
!
fullscreen
;
if
(
fullscreen
&&
!
backhash
[
url
.
hash
])
url
.
hash
=
slides
[
0
]
;
if
(
!
hashList
[
url
.
hash
])
turnSlide
(
0
)
;
}
}
domSlides
[
0
].
addEventListener
(
'click'
,
enterFull
,
false
);
slides
[
0
].
addEventListener
(
'click'
,
function
(){
toggleFull
(
true
);
window
.
addEventListener
(
'DOMContentLoaded'
,
toggleFull
,
false
);
},
false
);
window
.
addEventListener
(
'resize'
,
toggleFull
,
false
);
document
.
addEventListener
(
'keyup'
,
turnSlide
,
false
);
document
.
addEventListener
(
'keyup'
,
turnSlide
,
false
);
document
.
addEventListener
(
'keyup'
,
function
(
e
)
{
document
.
addEventListener
(
'keyup'
,
function
(
e
)
{
if
(
e
.
which
==
27
)
exitFull
();
if
(
e
.
which
==
27
)
toggleFull
(
false
);
},
false
);
},
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