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
9974f8f0
Commit
9974f8f0
authored
Jul 16, 2011
by
Vadim Makeev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
progress bar reverted; preventDefault usage optimized
parent
5094e983
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
script.js
scripts/script.js
+17
-6
No files found.
scripts/script.js
View file @
9974f8f0
...
@@ -30,34 +30,36 @@
...
@@ -30,34 +30,36 @@
var
current
=
slideList
.
indexOf
(
url
.
hash
.
substr
(
1
));
var
current
=
slideList
.
indexOf
(
url
.
hash
.
substr
(
1
));
if
(
e
)
{
if
(
e
)
{
if
(
e
.
type
==
'keydown'
)
{
if
(
e
.
type
==
'keydown'
)
{
var
prevent
=
true
;
switch
(
e
.
which
)
{
switch
(
e
.
which
)
{
case
33
:
// PgUp
case
33
:
// PgUp
case
38
:
// Up
case
38
:
// Up
case
37
:
// Left
case
37
:
// Left
case
75
:
// k
case
75
:
// k
current
--
;
current
--
;
e
.
preventDefault
();
break
;
break
;
case
34
:
// PgDown
case
34
:
// PgDown
case
40
:
// Down
case
40
:
// Down
case
39
:
// Right
case
39
:
// Right
case
74
:
// j
case
74
:
// j
current
++
;
current
++
;
e
.
preventDefault
();
break
;
break
;
case
36
:
// Home
case
36
:
// Home
current
=
0
;
current
=
0
;
e
.
preventDefault
();
break
;
break
;
case
35
:
// End
case
35
:
// End
current
=
slideList
.
length
-
1
;
current
=
slideList
.
length
-
1
;
e
.
preventDefault
();
break
;
break
;
case
32
:
// Space
case
32
:
// Space
current
+=
e
.
shiftKey
?
-
1
:
1
;
current
+=
e
.
shiftKey
?
-
1
:
1
;
e
.
preventDefault
();
break
;
break
;
case
13
:
// Enter
if
(
!
current
+
1
)
enterFull
();
break
;
default
:
prevent
=
false
;
}
}
if
(
prevent
)
e
.
preventDefault
();
}
}
if
(
e
.
type
==
'click'
)
{
if
(
e
.
type
==
'click'
)
{
current
=
slideList
.
indexOf
(
e
.
target
.
parentNode
.
id
);
current
=
slideList
.
indexOf
(
e
.
target
.
parentNode
.
id
);
...
@@ -67,12 +69,14 @@
...
@@ -67,12 +69,14 @@
}
}
target
=
slideList
[
current
];
target
=
slideList
[
current
];
if
(
target
)
url
.
hash
=
target
;
if
(
target
)
url
.
hash
=
target
;
updateProgress
();
}
}
function
enterFull
(
e
)
{
function
enterFull
(
e
)
{
body
.
className
=
'full'
;
body
.
className
=
'full'
;
resizeFull
(
true
);
resizeFull
(
true
);
turnSlide
(
e
);
turnSlide
(
e
);
updateProgress
();
if
(
!
isFull
())
history
.
pushState
(
null
,
null
,
url
.
pathname
+
'?full'
+
url
.
hash
);
if
(
!
isFull
())
history
.
pushState
(
null
,
null
,
url
.
pathname
+
'?full'
+
url
.
hash
);
window
.
addEventListener
(
'resize'
,
resizeFull
,
false
);
window
.
addEventListener
(
'resize'
,
resizeFull
,
false
);
document
.
addEventListener
(
'keyup'
,
exitFullEsc
,
false
);
document
.
addEventListener
(
'keyup'
,
exitFullEsc
,
false
);
...
@@ -81,7 +85,9 @@
...
@@ -81,7 +85,9 @@
function
exitFull
()
{
function
exitFull
()
{
body
.
className
=
'list'
;
body
.
className
=
'list'
;
resizeFull
(
false
);
resizeFull
(
false
);
history
.
pushState
(
null
,
null
,
url
.
href
.
replace
(
'?full'
,
''
));
var
hash
=
url
.
hash
;
history
.
pushState
(
null
,
null
,
url
.
pathname
.
replace
(
'?full'
,
''
));
url
.
hash
=
hash
;
window
.
removeEventListener
(
'resize'
,
resizeFull
,
false
);
window
.
removeEventListener
(
'resize'
,
resizeFull
,
false
);
document
.
removeEventListener
(
'keyup'
,
exitFullEsc
,
false
);
document
.
removeEventListener
(
'keyup'
,
exitFullEsc
,
false
);
}
}
...
@@ -95,6 +101,11 @@
...
@@ -95,6 +101,11 @@
return
url
.
search
.
substr
(
1
)
==
'full'
;
return
url
.
search
.
substr
(
1
)
==
'full'
;
}
}
function
updateProgress
()
{
if
(
!
progress
)
return
;
progress
.
style
.
width
=
(
100
/
(
slideList
.
length
-
1
)
*
slideList
.
indexOf
(
url
.
hash
.
substr
(
1
))).
toFixed
(
2
)
+
'%'
;
}
window
.
addEventListener
(
'DOMContentLoaded'
,
function
()
{
window
.
addEventListener
(
'DOMContentLoaded'
,
function
()
{
if
(
isFull
())
enterFull
();
if
(
isFull
())
enterFull
();
},
false
);
},
false
);
...
...
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