Initial real commit
|
|
@ -0,0 +1,79 @@
|
|||
var express = require('express');
|
||||
var path = require('path');
|
||||
var favicon = require('serve-favicon');
|
||||
var logger = require('morgan');
|
||||
var cookieParser = require('cookie-parser');
|
||||
var bodyParser = require('body-parser');
|
||||
|
||||
var parseurl = require('parseurl')
|
||||
|
||||
var index = require('./routes/index');
|
||||
|
||||
const session = require('express-session')
|
||||
const os = require('os');
|
||||
|
||||
var app = express();
|
||||
|
||||
// view engine setup
|
||||
app.set('views', path.join(__dirname, 'views'));
|
||||
app.set('view engine', 'pug');
|
||||
|
||||
// uncomment after placing your favicon in /public
|
||||
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
|
||||
|
||||
app.use(session({
|
||||
secret: 'keyboard cat',
|
||||
resave: false,
|
||||
saveUninitialized: false,
|
||||
}));
|
||||
|
||||
app.use(function restrict(req, res, next)
|
||||
{
|
||||
// get the url pathname
|
||||
var pathname = parseurl(req).pathname;
|
||||
|
||||
if (req.session.no_robot || pathname === '/login' || pathname === '/captcha' || pathname.startsWith('/stylesheets/') || pathname.startsWith('/javascripts/') || pathname.startsWith('/fonts/') || pathname === "/favicon.ico")
|
||||
{
|
||||
next();
|
||||
}
|
||||
else
|
||||
{
|
||||
req.session.startdest = pathname;
|
||||
var hostname = os.hostname();
|
||||
if(hostname === 'pc-familie.halieus.de' || hostname === 'pc.peter.halieus.de') {
|
||||
req.session.as_presentation = true;
|
||||
next();
|
||||
}
|
||||
else
|
||||
res.redirect('/login');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
app.use(logger('dev'));
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({ extended: false }));
|
||||
app.use(cookieParser());
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
app.use('/', index);
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function(req, res, next) {
|
||||
var err = new Error('Not Found');
|
||||
err.status = 404;
|
||||
next(err);
|
||||
});
|
||||
|
||||
// error handler
|
||||
app.use(function(err, req, res, next) {
|
||||
// set locals, only providing error in development
|
||||
res.locals.message = err.message;
|
||||
res.locals.error = req.app.get('env') === 'development' ? err : {};
|
||||
|
||||
// render the error page
|
||||
res.status(err.status || 500);
|
||||
res.render('error');
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var app = require('../app');
|
||||
var debug = require('debug')('mkev:server');
|
||||
var http = require('http');
|
||||
|
||||
/**
|
||||
* Get port from environment and store in Express.
|
||||
*/
|
||||
|
||||
var port = normalizePort(process.env.PORT || '3001');
|
||||
app.set('port', port);
|
||||
|
||||
/**
|
||||
* Create HTTP server.
|
||||
*/
|
||||
|
||||
var server = http.createServer(app);
|
||||
|
||||
/**
|
||||
* Listen on provided port, on all network interfaces.
|
||||
*/
|
||||
|
||||
server.listen(port);
|
||||
server.on('error', onError);
|
||||
server.on('listening', onListening);
|
||||
|
||||
/**
|
||||
* Normalize a port into a number, string, or false.
|
||||
*/
|
||||
|
||||
function normalizePort(val) {
|
||||
var port = parseInt(val, 10);
|
||||
|
||||
if (isNaN(port)) {
|
||||
// named pipe
|
||||
return val;
|
||||
}
|
||||
|
||||
if (port >= 0) {
|
||||
// port number
|
||||
return port;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "error" event.
|
||||
*/
|
||||
|
||||
function onError(error) {
|
||||
if (error.syscall !== 'listen') {
|
||||
throw error;
|
||||
}
|
||||
|
||||
var bind = typeof port === 'string'
|
||||
? 'Pipe ' + port
|
||||
: 'Port ' + port;
|
||||
|
||||
// handle specific listen errors with friendly messages
|
||||
switch (error.code) {
|
||||
case 'EACCES':
|
||||
console.error(bind + ' requires elevated privileges');
|
||||
process.exit(1);
|
||||
break;
|
||||
case 'EADDRINUSE':
|
||||
console.error(bind + ' is already in use');
|
||||
process.exit(1);
|
||||
break;
|
||||
default:
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "listening" event.
|
||||
*/
|
||||
|
||||
function onListening() {
|
||||
var addr = server.address();
|
||||
var bind = typeof addr === 'string'
|
||||
? 'pipe ' + addr
|
||||
: 'port ' + addr.port;
|
||||
debug('Listening on ' + bind);
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "bibelwissen",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node ./bin/www"
|
||||
},
|
||||
"dependencies": {
|
||||
"body-parser": "~1.18.3",
|
||||
"bootstrap": "~4.1.3",
|
||||
"cookie-parser": "~1.4.3",
|
||||
"debug": "~3.1.0",
|
||||
"express": "~4.16.3",
|
||||
"express-session": "^1.15.6",
|
||||
"jquery": "^3.3.1",
|
||||
"morgan": "~1.9.0",
|
||||
"open-iconic": "^1.1.1",
|
||||
"popper.js": "^1.14.4",
|
||||
"pug": "~2.0.3",
|
||||
"serve-favicon": "~2.5.0",
|
||||
"svg-captcha": "^1.3.11",
|
||||
"typeface-alegreya": "0.0.54",
|
||||
"typeface-alegreya-sans": "0.0.54"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/open-iconic/font/fonts/open-iconic.eot
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/open-iconic/font/fonts/open-iconic.otf
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/open-iconic/font/fonts/open-iconic.svg
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/open-iconic/font/fonts/open-iconic.ttf
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/open-iconic/font/fonts/open-iconic.woff
|
||||
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 134 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 1.7 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 966 KiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 3.0 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 2.1 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 942 KiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 2.1 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.9 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/bootstrap/dist/js/bootstrap.min.js
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){'use strict';var game=require('i-am-not-a-robot').ticTacToe;var rootElement=document.createElement('div');document.body.appendChild(rootElement);game(rootElement,function(){return window.alert('You are not a robot');});},{"i-am-not-a-robot":2}],2:[function(require,module,exports){'use strict';exports.ticTacToe=require('./src/ticTacToe');},{"./src/ticTacToe":7}],3:[function(require,module,exports){'use strict';var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}
|
||||
function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}
|
||||
function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+ typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}
|
||||
var Component=require('./Component');var Cell=function(_Component){_inherits(Cell,_Component);function Cell(element,dispatch,index){_classCallCheck(this,Cell);var _this=_possibleConstructorReturn(this,(Cell.__proto__||Object.getPrototypeOf(Cell)).call(this,element,dispatch));_this.index=index;element.style.float='left';element.style.width='40px';element.style.height='40px';element.style.margin='1px';element.style.borderRadius='3px';element.onclick=function(){dispatch({type:'PLAYER_CHOOSES_CELL',index:index});};return _this;}
|
||||
_createClass(Cell,[{key:'render',value:function render(state){var element=this.element;var index=this.index;var cellIsNotSelected=state.cells.indexOf(index)===-1;var cellWasChoosedByPlayer=state.cells.indexOf(index)%2===0;var dot='<svg xmlns="http://www.w3.org/2000/svg" width="35" height="35"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g fill="#e74522"><path d="M17.5,35 C27.1649831,35 35,27.1649831 35,17.5 C35,7.83501688 27.1649831,0 17.5,0 C7.83501688,0 0,7.83501688 0,17.5 C0,27.1649831 7.83501688,35 17.5,35 Z M17.5,27.6171875 C23.0875684,27.6171875 27.6171875,23.0875684 27.6171875,17.5 C27.6171875,11.9124316 23.0875684,7.3828125 17.5,7.3828125 C11.9124316,7.3828125 7.3828125,11.9124316 7.3828125,17.5 C7.3828125,23.0875684 11.9124316,27.6171875 17.5,27.6171875 Z"></path></g></g></svg>';var cross='<svg xmlns="http://www.w3.org/2000/svg" width="35" height="35"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g fill="#0194F7"><path d="M22.5335744,17.5 L33.9584004,6.07517407 C35.3398039,4.69377056 35.3458996,2.43406676 33.9559164,1.04408356 C32.5687616,-0.343071308 30.3134373,-0.347011737 28.9248259,1.04159963 L17.5,12.4664256 L6.07517407,1.04159963 C4.69377056,-0.339803881 2.43406676,-0.345899645 1.04408356,1.04408356 C-0.343071308,2.43123842 -0.347011737,4.6865627 1.04159963,6.07517407 L12.4664256,17.5 L1.04159963,28.9248259 C-0.339803881,30.3062294 -0.345899645,32.5659332 1.04408356,33.9559164 C2.43123842,35.3430713 4.6865627,35.3470117 6.07517407,33.9584004 L17.5,22.5335744 L28.9248259,33.9584004 C30.3062294,35.3398039 32.5659332,35.3458996 33.9559164,33.9559164 C35.3430713,32.5687616 35.3470117,30.3134373 33.9584004,28.9248259 L22.5335744,17.5 Z" stroke="none" fill="#0194F7" fill-rule="evenodd"></path></g></g></svg>';if(cellIsNotSelected){element.style.backgroundColor='#fff';}else{if(cellWasChoosedByPlayer){element.style.background="url('data:image/svg+xml;utf8,"+ cross+"') #fff no-repeat center";}else{element.style.background="url('data:image/svg+xml;utf8,"+ dot+"') #fff no-repeat center";}}}}]);return Cell;}(Component);module.exports=Cell;},{"./Component":4}],4:[function(require,module,exports){'use strict';var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}
|
||||
var Component=function(){function Component(element,dispatch){_classCallCheck(this,Component);this.element=element;this.dispatch=dispatch;this.component={};}
|
||||
_createClass(Component,[{key:'createDiv',value:function createDiv(){var div=document.createElement('div');this.element.appendChild(div);return div;}},{key:'render',value:function render(state,dispatch){var component=this.component;Object.keys(component).forEach(function(key){component[key].render(state,dispatch);});}}]);return Component;}();module.exports=Component;},{}],5:[function(require,module,exports){'use strict';function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}
|
||||
function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}
|
||||
function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+ typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}
|
||||
var Component=require('./Component');var Row=require('./Row');var Root=function(_Component){_inherits(Root,_Component);function Root(element,dispatch){_classCallCheck(this,Root);var _this=_possibleConstructorReturn(this,(Root.__proto__||Object.getPrototypeOf(Root)).call(this,element,dispatch));var createDiv=_this.createDiv.bind(_this);_this.component.row1=new Row(createDiv(),dispatch,0);_this.component.row2=new Row(createDiv(),dispatch,3);_this.component.row3=new Row(createDiv(),dispatch,6);return _this;}
|
||||
return Root;}(Component);module.exports=Root;},{"./Component":4,"./Row":6}],6:[function(require,module,exports){'use strict';function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}
|
||||
function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}
|
||||
function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+ typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}
|
||||
var Component=require('./Component');var Cell=require('./Cell');var Row=function(_Component){_inherits(Row,_Component);function Row(element,dispatch,index){_classCallCheck(this,Row);var _this=_possibleConstructorReturn(this,(Row.__proto__||Object.getPrototypeOf(Row)).call(this,element,dispatch));element.style['clear']='both';var createDiv=_this.createDiv.bind(_this);_this.component.cell1=new Cell(createDiv(),dispatch,index+ 0);_this.component.cell2=new Cell(createDiv(),dispatch,index+ 1);_this.component.cell3=new Cell(createDiv(),dispatch,index+ 2);return _this;}
|
||||
return Row;}(Component);module.exports=Row;},{"./Cell":3,"./Component":4}],7:[function(require,module,exports){'use strict';var Root=require('./components/Root');var reducer=require('./reducer');function ticTacToe(element,callback){var currentState={isMyTurn:true,win:false,cells:[]};var render=Function.prototype;function dispatch(action){currentState=reducer(currentState,action,dispatch,callback);render(currentState,dispatch);}
|
||||
var root=new Root(element,dispatch);render=root.render.bind(root);dispatch({type:'INIT'});}
|
||||
module.exports=ticTacToe;},{"./components/Root":5,"./reducer":8}],8:[function(require,module,exports){'use strict';var winningCombinations=['0-1-2','3-4-5','6-7-8','0-3-6','1-4-7','2-5-8','0-4-8','2-4-6'];function isTris(cells){var choosenCells=[];for(var i=cells.length- 1;i>=0;i=i- 2){choosenCells.push(cells[i]);}
|
||||
for(var a=0;a<choosenCells.length- 2;a++){for(var b=a+ 1;b<choosenCells.length- 1;b++){for(var c=b+ 1;c<choosenCells.length;c++){var combination=[choosenCells[a],choosenCells[b],choosenCells[c]].sort().join('-');if(winningCombinations.indexOf(combination)>-1)return true;}}}
|
||||
return false;}
|
||||
function randomCell(cells){if(cells.indexOf(4)===-1)return 4;if(cells.length===3){for(var i=0;i<9;i++){if(cells.indexOf(i)>-1)continue;var combination=[cells[0],cells[2],i].join('-');if(winningCombinations.indexOf(combination)>-1){return i;}}}
|
||||
var randomIndex=Math.floor(Math.random()*8);if(cells.indexOf(randomIndex)===-1){return randomIndex;}else{return randomCell(cells);}}
|
||||
function reducer(currenState,action,dispatch,callback){var state=Object.assign({},currenState);switch(action.type){case'PLAYER_CHOOSES_CELL':var cellIsFree=state.cells.indexOf(action.index)===-1;if(cellIsFree&&state.isMyTurn){state.cells.push(action.index);state.isMyTurn=false;setTimeout(function(){dispatch({type:'IS_COMPUTER_TURN'});},1000);}
|
||||
break;case'IS_COMPUTER_TURN':var gameOver=state.cells.length===9;if(gameOver||isTris(state.cells)){callback();}else{state.cells.push(randomCell(state.cells));state.isMyTurn=true;if(isTris(state.cells))callback();}
|
||||
break;}
|
||||
return state;}
|
||||
module.exports=reducer;},{}]},{},[1]);
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
const game = require('i-am-not-a-robot').ticTacToe
|
||||
|
||||
// const rootElement = document.createElement('div')
|
||||
// document.body.appendChild(rootElement)
|
||||
|
||||
// game(rootElement, () => window.alert('You are not a robot'))
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/jquery/dist/jquery.min.js
|
||||
|
|
@ -0,0 +1,250 @@
|
|||
|
||||
|
||||
|
||||
var __slide_data = {
|
||||
slides : [],
|
||||
index : -1,
|
||||
jump_to_slide : true,
|
||||
fade_in_time: 500
|
||||
}
|
||||
|
||||
function push_slide_stack(ident) {
|
||||
|
||||
console.log("push_slide_slides: ", ident);
|
||||
|
||||
$(ident).each(function() {
|
||||
__slide_data.slides.push($(this));
|
||||
$(this).hide();
|
||||
|
||||
var subslides = $(this).data('subslides');
|
||||
if(typeof subslides !== 'undefined' && subslides !== '') {
|
||||
push_slide_stack(subslides);
|
||||
}
|
||||
});
|
||||
|
||||
console.log("push_slide_slides: ", ident, "; completet: count: ", __slide_data.slides.length)
|
||||
}
|
||||
|
||||
// https://slidesoverflow.com/questions/5685589/scroll-to-element-only-if-not-in-view-jquery
|
||||
/*function scrollIntoViewIfNeeded($target) {
|
||||
if ($target.offset()) {
|
||||
if ($target.offset().top < jQuery(window).scrollTop()){
|
||||
//scroll up
|
||||
$('html,body').scrollTop($target.offset().top-20);
|
||||
//$('html,body').animate({scrollTop: $target.position().top-20});
|
||||
}
|
||||
else if ($target.offset().top + $target.height() >
|
||||
$(window).scrollTop() + (
|
||||
window.innerHeight || document.documentElement.clientHeight
|
||||
)) {
|
||||
//scroll down
|
||||
$('html,body').scrollTop($target.offset().top -
|
||||
(window.innerHeight || document.documentElement.clientHeight)
|
||||
+ $target.height() + 20);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
function scrollIntoViewIfNeeded(target) {
|
||||
if(__slide_data.jump_to_slide === false)
|
||||
return;
|
||||
var rect = target.getBoundingClientRect();
|
||||
console.log(rect);
|
||||
console.log(window.innerHeight);
|
||||
if (rect.bottom > window.innerHeight-10) {
|
||||
target.scrollIntoView(false);
|
||||
if(rect.height < window.innerHeight-20) {
|
||||
console.log("additional scroll");
|
||||
window.scrollTo(0, window.pageYOffset+20);
|
||||
}
|
||||
else
|
||||
{
|
||||
var position = window.pageYOffset - (rect.height - window.innerHeight);
|
||||
console.log("position ", position);
|
||||
window.scrollTo(0, position);
|
||||
}
|
||||
}
|
||||
if (rect.top < 0) {
|
||||
target.scrollIntoView();
|
||||
//window.scrollTo(0, target.bottom+20);
|
||||
window.scrollTo(0, window.pageYOffset-25);
|
||||
}
|
||||
}
|
||||
|
||||
function slide_key_up() {
|
||||
var slides = __slide_data.slides;
|
||||
console.log('up');
|
||||
|
||||
if(__slide_data.index>=0) {
|
||||
var slideslave = $(slides[__slide_data.index]).data('slideslave');
|
||||
if(typeof slideslave !== 'undefined' && slideslave !== '') {
|
||||
$(slideslave).fadeOut(0);
|
||||
}
|
||||
$(slides[__slide_data.index]).fadeOut(__slide_data.fade_in_time, function() {
|
||||
$(this).trigger('fadeOutCompleted')
|
||||
var slidefunc = $(this).data('slidefunc');
|
||||
if(typeof slidefunc !== 'undefined' && slidefunc !== '') {
|
||||
window[slidefunc](false);
|
||||
}
|
||||
});
|
||||
__slide_data.index--;
|
||||
}
|
||||
/*else { // we look if we can go up
|
||||
if(__slide_data.slideslidesidx > 0) {
|
||||
__slide_data.slideslidesidx--;
|
||||
__slide_data.slideslidess.pop();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
function slide_key_down() {
|
||||
console.log('down; index: ', __slide_data.index);
|
||||
var slides = __slide_data.slides;
|
||||
if(__slide_data.index<(slides.length-1)) {
|
||||
console.log('bin drin');
|
||||
__slide_data.index++;
|
||||
if($(slides[__slide_data.index]).hasClass('nodisplay')) {
|
||||
$(slides[__slide_data.index]).removeClass('nodisplay');
|
||||
$(slides[__slide_data.index]).addClass('HASnodisplay');
|
||||
}
|
||||
if($(slides[__slide_data.index]).parent().hasClass('nodisplay')) {
|
||||
$(slides[__slide_data.index]).parent().removeClass('nodisplay');
|
||||
$(slides[__slide_data.index]).parent().addClass('HASnodisplay');
|
||||
}
|
||||
|
||||
//scrollIntoViewIfNeeded($(slides.slides[slides.index]));
|
||||
$(slides[__slide_data.index]).css('visibility','visible').hide().fadeIn(__slide_data.fade_in_time, function() {
|
||||
scrollIntoViewIfNeeded(this);
|
||||
var slideslave = $(this).data('slideslave');
|
||||
if(typeof slideslave !== 'undefined' && slideslave !== '') {
|
||||
console.log('sslave', $(slideslave));
|
||||
if($(slideslave).parent().hasClass("nodisplay")) {
|
||||
$(slideslave).parent().removeClass('nodisplay');
|
||||
$(slideslave).parent().addClass('HASnodisplay');
|
||||
}
|
||||
$(slideslave).css('visibility','visible').hide().fadeIn(__slide_data.fade_in_time);
|
||||
}
|
||||
$(this).trigger('fadeInCompleted');
|
||||
var slidefunc = $(this).data('slidefunc');
|
||||
if(typeof slidefunc !== 'undefined' && slidefunc !== '') {
|
||||
window[slidefunc](true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function register_presentationkeys () {
|
||||
console.log("registering keys ...")
|
||||
$(document).keydown(function(e) {
|
||||
console.log('Keydown: ', e.which)
|
||||
switch(e.which) {
|
||||
case 37:
|
||||
slide_key_up();
|
||||
break;
|
||||
case 39:
|
||||
slide_key_down();
|
||||
break;
|
||||
case 33:
|
||||
console.log('Nächster Punkt ...');
|
||||
var i = $(".nav-pills:not(.pill-sub-1) > .nav-item > .nav-link.active").parent();
|
||||
console.log(i);
|
||||
var n = i.next();
|
||||
if(n.length >= 1) {
|
||||
console.log(n);
|
||||
var a = n.find('a.nav-link');
|
||||
console.log(a);
|
||||
if(a.length >= 1)
|
||||
a[0].click();
|
||||
else
|
||||
console.log("Kein nächster Punkt [FEHLER!]");
|
||||
}
|
||||
else {
|
||||
console.log('Kein nächster Punkt!');
|
||||
}
|
||||
break;
|
||||
case 36:
|
||||
console.log('Vorheriger Punkt ...');
|
||||
var i = $(".nav-pills:not(.pill-sub-1) > .nav-item > .nav-link.active").parent();
|
||||
console.log(i);
|
||||
var n = i.prev();
|
||||
console.log(n);
|
||||
if(n.length >= 1) {
|
||||
console.log(n);
|
||||
var a = n.find('a.nav-link');
|
||||
console.log(a);
|
||||
if(a.length >= 1)
|
||||
a[0].click();
|
||||
else
|
||||
console.log("Kein vorheriger Punkt [FEHLER!]");
|
||||
}
|
||||
else {
|
||||
console.log('Kein vorheriger Punkt!');
|
||||
}
|
||||
break;
|
||||
case 34:
|
||||
console.log('Nächster Unter-Punkt ...');
|
||||
var i = $(".nav-pills.pill-sub-1 > .nav-item > .nav-link.active").parent();
|
||||
console.log(i);
|
||||
var n = i.next();
|
||||
if(n.length >= 1) {
|
||||
console.log(n);
|
||||
var a = n.find('a.nav-link');
|
||||
console.log(a);
|
||||
if(a.length >= 1)
|
||||
a[0].click();
|
||||
else
|
||||
console.log("Kein nächster Punkt [FEHLER!]");
|
||||
}
|
||||
else {
|
||||
console.log('Kein nächster Punkt!');
|
||||
}
|
||||
break;
|
||||
case 35:
|
||||
console.log('Vorheriger Unter-Punkt ...');
|
||||
var i = $(".nav-pills.pill-sub-1 > .nav-item > .nav-link.active").parent();
|
||||
console.log(i);
|
||||
var n = i.prev();
|
||||
console.log(n);
|
||||
if(n.length >= 1) {
|
||||
console.log(n);
|
||||
var a = n.find('a.nav-link');
|
||||
console.log(a);
|
||||
if(a.length >= 1)
|
||||
a[0].click();
|
||||
else
|
||||
console.log("Kein vorheriger Punkt [FEHLER!]");
|
||||
}
|
||||
else {
|
||||
console.log('Kein vorheriger Punkt!');
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function jump_to_slide_true() {
|
||||
__slide_data.jump_to_slide = true;
|
||||
console.log("SET TO TRUE");
|
||||
}
|
||||
|
||||
function show_next_slide() {
|
||||
if(__slide_data.index != __slide_data.slides.length-1) {
|
||||
slide_key_down();
|
||||
setTimeout(show_next_slide, 0);
|
||||
}
|
||||
else
|
||||
setTimeout(jump_to_slide_true, 2000);
|
||||
}
|
||||
|
||||
function show_all_slides() {
|
||||
__slide_data.jump_to_slide = false;
|
||||
__slide_data.fade_in_time = 0;
|
||||
show_next_slide();
|
||||
/* while(__slide_data.slideslidess[0].index != __slide_data.slideslidess[0].slides.length-1)
|
||||
{
|
||||
console.log(__slide_data.slideslidess[0].index);
|
||||
console.log(__slide_data.slideslidess[0].slides.length-1);
|
||||
slide_key_down();
|
||||
}*/
|
||||
}
|
||||
|
|
@ -0,0 +1,198 @@
|
|||
|
||||
|
||||
|
||||
var __slide_data = {
|
||||
slidestacks : [],
|
||||
slidestackidx : -1,
|
||||
jump_to_slide : true
|
||||
}
|
||||
|
||||
function push_slide_stack(ident) {
|
||||
var slidedata = {
|
||||
ident : ident,
|
||||
slides : $(ident),
|
||||
index : -1
|
||||
}
|
||||
slidedata.count = slidedata.slides.length;
|
||||
|
||||
console.log(slidedata);
|
||||
|
||||
__slide_data.slidestacks.push(slidedata);
|
||||
__slide_data.slidestackidx++;
|
||||
}
|
||||
|
||||
function current_slidestack() {
|
||||
return __slide_data.slidestacks[__slide_data.slidestackidx];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*slides.each(function() {
|
||||
$(this).hide();
|
||||
$(this).fadeIn(0, function(){$(this).trigger('fadeInCompleted')});
|
||||
})*/
|
||||
|
||||
// https://stackoverflow.com/questions/5685589/scroll-to-element-only-if-not-in-view-jquery
|
||||
/*function scrollIntoViewIfNeeded($target) {
|
||||
if ($target.offset()) {
|
||||
if ($target.offset().top < jQuery(window).scrollTop()){
|
||||
//scroll up
|
||||
$('html,body').scrollTop($target.offset().top-20);
|
||||
//$('html,body').animate({scrollTop: $target.position().top-20});
|
||||
}
|
||||
else if ($target.offset().top + $target.height() >
|
||||
$(window).scrollTop() + (
|
||||
window.innerHeight || document.documentElement.clientHeight
|
||||
)) {
|
||||
//scroll down
|
||||
$('html,body').scrollTop($target.offset().top -
|
||||
(window.innerHeight || document.documentElement.clientHeight)
|
||||
+ $target.height() + 20);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
function scrollIntoViewIfNeeded(target) {
|
||||
if(__slide_data.jump_to_slide === false)
|
||||
return;
|
||||
var rect = target.getBoundingClientRect();
|
||||
if (rect.bottom > window.innerHeight-10) {
|
||||
target.scrollIntoView(false);
|
||||
window.scrollTo(0, window.pageYOffset+20);
|
||||
}
|
||||
if (rect.top < 0) {
|
||||
target.scrollIntoView();
|
||||
//window.scrollTo(0, target.bottom+20);
|
||||
window.scrollTo(0, window.pageYOffset-25);
|
||||
}
|
||||
}
|
||||
|
||||
function slide_key_up() {
|
||||
var stack = current_slidestack();
|
||||
console.log(stack);
|
||||
console.log('up');
|
||||
while(stack.index < 0 && __slide_data.slidestackidx > 0) {
|
||||
console.log('return to lower in stack UP')
|
||||
__slide_data.slidestackidx--;
|
||||
__slide_data.slidestacks.pop();
|
||||
stack=current_slidestack();
|
||||
console.log(stack);
|
||||
}
|
||||
if(stack.index>=0) {
|
||||
var slideslave = $(stack.slides[stack.index]).data('slideslave');
|
||||
if(typeof slideslave !== 'undefined' && slideslave !== '') {
|
||||
$(slideslave).fadeOut(0);
|
||||
}
|
||||
$(stack.slides[stack.index]).fadeOut(500, function() {
|
||||
$(this).trigger('fadeOutCompleted')
|
||||
var slidefunc = $(this).data('slidefunc');
|
||||
if(typeof slidefunc !== 'undefined' && slidefunc !== '') {
|
||||
window[slidefunc](false);
|
||||
}
|
||||
});
|
||||
var subslides = $(stack.slides[stack.index]).data('prev-subslides');
|
||||
stack.index--;
|
||||
if(typeof subslides !== 'undefined' && subslides !== '') {
|
||||
console.log('prev-subslides: ', subslides)
|
||||
push_slide_stack(subslides);
|
||||
stack = current_slidestack();
|
||||
stack.index = stack.slides.length-1;
|
||||
}
|
||||
}
|
||||
/*else { // we look if we can go up
|
||||
if(__slide_data.slidestackidx > 0) {
|
||||
__slide_data.slidestackidx--;
|
||||
__slide_data.slidestacks.pop();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
function slide_key_down() {
|
||||
var stack = current_slidestack();
|
||||
console.log(stack);
|
||||
console.log('down');
|
||||
while(stack.index+1>=stack.count && __slide_data.slidestackidx > 0) {
|
||||
console.log('return to lower in stack')
|
||||
__slide_data.slidestackidx--;
|
||||
__slide_data.slidestacks.pop();
|
||||
stack=current_slidestack();
|
||||
}
|
||||
|
||||
if(stack.index<(stack.count-1)) {
|
||||
stack.index++;
|
||||
if($(stack.slides[stack.index]).hasClass('nodisplay')) {
|
||||
$(stack.slides[stack.index]).removeClass('nodisplay');
|
||||
$(stack.slides[stack.index]).addClass('HASnodisplay');
|
||||
}
|
||||
if($(stack.slides[stack.index]).parent().hasClass('nodisplay')) {
|
||||
$(stack.slides[stack.index]).parent().removeClass('nodisplay');
|
||||
$(stack.slides[stack.index]).parent().addClass('HASnodisplay');
|
||||
}
|
||||
|
||||
var subslides = $(stack.slides[stack.index]).data('subslides');
|
||||
console.log('subslides: ', subslides);
|
||||
if(typeof subslides !== 'undefined' && subslides !== '') {
|
||||
console.log('have one');
|
||||
if(stack.index < (stack.slides.length)) {
|
||||
$(stack.slides[stack.index+1]).data('prev-subslides',subslides)
|
||||
console.log('ABC',$(stack.slides[stack.index+1]).data('prev-subslides'));
|
||||
}
|
||||
push_slide_stack(subslides);
|
||||
}
|
||||
//scrollIntoViewIfNeeded($(stack.slides[stack.index]));
|
||||
$(stack.slides[stack.index]).css('visibility','visible').hide().fadeIn(500, function() {
|
||||
scrollIntoViewIfNeeded(this);
|
||||
var slideslave = $(this).data('slideslave');
|
||||
if(typeof slideslave !== 'undefined' && slideslave !== '') {
|
||||
console.log('sslave', $(slideslave));
|
||||
if($(slideslave).parent().hasClass("nodisplay")) {
|
||||
$(slideslave).parent().removeClass('nodisplay');
|
||||
$(slideslave).parent().addClass('HASnodisplay');
|
||||
}
|
||||
$(slideslave).css('visibility','visible').hide().fadeIn(500);
|
||||
}
|
||||
$(this).trigger('fadeInCompleted');
|
||||
var slidefunc = $(this).data('slidefunc');
|
||||
if(typeof slidefunc !== 'undefined' && slidefunc !== '') {
|
||||
window[slidefunc](true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(document).keydown(function(e) {
|
||||
switch(e.which) {
|
||||
case 37:
|
||||
slide_key_up();
|
||||
break;
|
||||
case 39:
|
||||
slide_key_down();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
function jump_to_slide_true() {
|
||||
__slide_data.jump_to_slide = true;
|
||||
console.log("SET TO TRUE");
|
||||
}
|
||||
|
||||
function show_next_slide() {
|
||||
if(__slide_data.slidestacks[0].index != __slide_data.slidestacks[0].slides.length-1) {
|
||||
slide_key_down();
|
||||
setTimeout(show_next_slide, 0);
|
||||
}
|
||||
else
|
||||
setTimeout(jump_to_slide_true, 2000);
|
||||
}
|
||||
|
||||
function show_all_slides() {
|
||||
__slide_data.jump_to_slide = false;
|
||||
show_next_slide();
|
||||
/* while(__slide_data.slidestacks[0].index != __slide_data.slidestacks[0].slides.length-1)
|
||||
{
|
||||
console.log(__slide_data.slidestacks[0].index);
|
||||
console.log(__slide_data.slidestacks[0].slides.length-1);
|
||||
slide_key_down();
|
||||
}*/
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/typeface-alegreya-sans/index.css
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/typeface-alegreya/index.css
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/bootstrap/dist/css/bootstrap.min.css
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../node_modules/bootstrap/dist/css/bootstrap.min.css.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-400.woff
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-400.woff2
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-400italic.woff
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-400italic.woff2
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-500.woff
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-500.woff2
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-500italic.woff
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-500italic.woff2
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-700.woff
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-700.woff2
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-700italic.woff
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-700italic.woff2
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-800.woff
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-800.woff2
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-800italic.woff
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-800italic.woff2
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-900.woff
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-900.woff2
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-900italic.woff
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya/files/alegreya-latin-900italic.woff2
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya-sans/files/alegreya-sans-latin-100.woff
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya-sans/files/alegreya-sans-latin-100.woff2
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya-sans/files/alegreya-sans-latin-100italic.woff
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya-sans/files/alegreya-sans-latin-100italic.woff2
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya-sans/files/alegreya-sans-latin-300.woff
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya-sans/files/alegreya-sans-latin-300.woff2
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya-sans/files/alegreya-sans-latin-300italic.woff
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya-sans/files/alegreya-sans-latin-300italic.woff2
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya-sans/files/alegreya-sans-latin-400.woff
|
||||
|
|
@ -0,0 +1 @@
|
|||
../../../node_modules/typeface-alegreya-sans/files/alegreya-sans-latin-400.woff2
|
||||