Commit bdd11af0 authored by Vadim Makeev's avatar Vadim Makeev

jquery is dropped

parent 39b959e2
This diff is collapsed.
$(function() {
var domSlides = document.querySelectorAll('section.slide'),
url = document.location,
slides = [],
backhash = {},
linkScreen = document.querySelector('link[title=screen]'),
linkProjection = document.querySelector('link[title=projection]');
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;
}
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 &&
window.screenY == 0 &&
screen.width == window.outerWidth &&
screen.height == window.outerHeight;
}
function fullScreen() {
return window.screenX == 0 &&
window.screenY == 0 &&
screen.width == window.outerWidth &&
screen.height == window.outerHeight;
function turnSlide(e) {
if(!fullScreen()) return;
var current = backhash[url.hash],
target,
command;
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 = backhash[location.hash],
target,
command;
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 = slides[current];
e.preventDefault();
if( target ) location.hash = target;
}
function updateView() {
var fullscreen = fullScreen();
linkScreen.attr( 'disabled', fullscreen );
linkProjection.attr( 'disabled', !fullscreen );
if( fullscreen && !backhash[location.hash]) location.hash = slides[0];
}
$( document ).
keyup( turnSlide );
target = slides[current];
e.preventDefault();
if(target) url.hash = target;
}
$( window ).
ready( updateView ).
resize( updateView );
function updateView() {
var fullscreen = fullScreen();
linkScreen.disabled = fullscreen;
linkProjection.disabled = !fullscreen;
if(fullscreen && !backhash[url.hash]) url.hash = slides[0];
}
});
window.addEventListener('DOMContentLoaded', updateView, false);
window.addEventListener('resize', updateView, false);
document.addEventListener('keyup', turnSlide, false);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment