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
e3b69b89
Commit
e3b69b89
authored
Nov 01, 2010
by
Dmitry Baranovskiy
Committed by
Vadim Makeev
Nov 01, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Touching DOM as less as possible
parent
8550d1aa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
19 deletions
+27
-19
script.js
scripts/script.js
+27
-19
No files found.
scripts/script.js
View file @
e3b69b89
$
(
function
()
{
var
slides
=
$
(
'section.slide'
);
var
domSlides
=
$
(
'section.slide'
),
location
=
document
.
location
,
slides
=
[],
backhash
=
{},
linkScreen
=
$
(
'link[title=screen]'
),
linkProjection
=
$
(
'link[title=projection]'
);
for
(
var
i
=
0
,
len
=
domSlides
.
length
;
i
<
len
;
i
++
)
{
var
id
=
domSlides
[
i
].
id
;
slides
[
i
]
=
'#'
+
id
;
backhash
[
'#'
+
id
]
=
i
;
}
function
fullScreen
()
{
return
(
window
.
screenX
==
0
&&
return
window
.
screenX
==
0
&&
window
.
screenY
==
0
&&
screen
.
width
==
window
.
outerWidth
&&
screen
.
height
==
window
.
outerHeight
)
?
true
:
false
;
screen
.
height
==
window
.
outerHeight
;
}
function
turnSlide
(
e
)
{
if
(
!
fullScreen
()
)
return
;
var
current
=
$
(
document
.
location
.
hash
);
var
current
=
backhash
[
location
.
hash
],
target
,
command
;
switch
(
e
.
which
)
{
case
33
:
// PgUp
case
38
:
// Up
case
37
:
// Left
var
target
=
current
.
prev
(
slides
)
;
current
--
;
break
;
case
34
:
// PgDown
case
40
:
// Down
case
39
:
// Right
var
target
=
current
.
next
(
slides
)
;
current
++
;
break
;
case
32
:
// Space
var
target
=
current
[
e
.
shiftKey
?
'prev'
:
'next'
](
slides
)
;
current
+=
e
.
shiftKey
?
-
1
:
1
;
break
;
default
:
return
;
}
target
=
slides
[
current
];
e
.
preventDefault
();
if
(
!
target
.
length
)
return
;
else
document
.
location
.
hash
=
'#'
+
target
.
attr
(
'id'
);
if
(
target
)
location
.
hash
=
target
;
}
function
updateView
()
{
var
screen
=
$
(
'link[title=screen]'
),
projection
=
$
(
'link[title=projection]'
),
fullscreen
=
fullScreen
();
screen
.
attr
(
'disabled'
,
fullscreen
);
projection
.
attr
(
'disabled'
,
!
fullscreen
);
if
(
!
fullscreen
||
$
(
document
.
location
.
hash
).
length
)
return
;
else
document
.
location
.
hash
=
'#'
+
slides
.
first
().
attr
(
'id'
);
var
fullscreen
=
fullScreen
();
linkScreen
.
attr
(
'disabled'
,
fullscreen
);
linkProjection
.
attr
(
'disabled'
,
!
fullscreen
);
if
(
fullscreen
&&
!
backhash
[
location
.
hash
])
location
.
hash
=
slides
[
0
];
}
$
(
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