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,
var domSlides = $( 'section.slide' ),
location = document.location,
slides = [], slides = [],
backhash = {}, backhash = {},
linkScreen = $( 'link[title=screen]' ), linkScreen = document.querySelector('link[title=screen]'),
linkProjection = $( 'link[title=projection]' ); linkProjection = document.querySelector('link[title=projection]');
for (var i = 0, len = domSlides.length; i < len; i++) { for(var i = 0, len = domSlides.length; i < len; i++) {
var id = domSlides[i].id; var id = domSlides[i].id;
slides[i] = '#' + id; slides[i] = '#' + id;
backhash['#' + id] = i; backhash['#' + id] = i;
} }
function fullScreen() { function fullScreen() {
return window.screenX == 0 && return window.screenX == 0 &&
window.screenY == 0 && window.screenY == 0 &&
screen.width == window.outerWidth && screen.width == window.outerWidth &&
screen.height == window.outerHeight; screen.height == window.outerHeight;
} }
function turnSlide( e ) { function turnSlide(e) {
if( !fullScreen() ) return; if(!fullScreen()) return;
var current = backhash[location.hash], var current = backhash[url.hash],
target, target,
command; command;
switch ( e.which ) { switch(e.which) {
case 33 : // PgUp case 33 : // PgUp
case 38 : // Up case 38 : // Up
case 37 : // Left case 37 : // Left
...@@ -44,21 +42,16 @@ $(function() { ...@@ -44,21 +42,16 @@ $(function() {
} }
target = slides[current]; target = slides[current];
e.preventDefault(); e.preventDefault();
if( target ) location.hash = target; if(target) url.hash = target;
} }
function updateView() { function updateView() {
var fullscreen = fullScreen(); var fullscreen = fullScreen();
linkScreen.attr( 'disabled', fullscreen ); linkScreen.disabled = fullscreen;
linkProjection.attr( 'disabled', !fullscreen ); linkProjection.disabled = !fullscreen;
if( fullscreen && !backhash[location.hash]) location.hash = slides[0]; if(fullscreen && !backhash[url.hash]) url.hash = slides[0];
} }
$( document ). window.addEventListener('DOMContentLoaded', updateView, false);
keyup( turnSlide ); window.addEventListener('resize', updateView, false);
document.addEventListener('keyup', turnSlide, false);
$( window ). \ No newline at end of file
ready( updateView ).
resize( updateView );
});
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