added link to blogpost to blog headline, also some cleaning, we cant have more than 4 navigation points

This commit is contained in:
Timm Szigat 2015-10-17 21:24:11 +02:00
parent 090df14b9a
commit cef7b0df10
4 changed files with 110 additions and 58 deletions

View File

@ -23,10 +23,6 @@
<li><a href="#contact">Kontakt</a></li> <li><a href="#contact">Kontakt</a></li>
<li class="divider-vertical"></li> <li class="divider-vertical"></li>
<li><a href="https://wiki.chaospott.de">Wiki</a></li> <li><a href="https://wiki.chaospott.de">Wiki</a></li>
<li class="divider-vertical"></li>
<li><a href="https://wiki.chaospott.de/Anfahrt">Anfahrt</a></li>
<li class="divider-vertical"></li>
<li><a href="/status.html">Raumstatus</a></li>
</ul> </ul>
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<script> <script>
@ -42,12 +38,12 @@
</script> </script>
<li id="status_open"> <li id="status_open">
<a href="/status.html" style="color:#5CB85C !important;"> <a href="/status.html" style="color:#5CB85C !important;">
<i class="fa fa-unlock"></i> Raum offen <i class="fa fa-unlock"></i> Raumstatus
</a> </a>
</li> </li>
<li id="status_closed"> <li id="status_closed">
<a href="/status.html"> <a href="/status.html">
<i class="fa fa-lock"></i> Raum geschlossen <i class="fa fa-lock"></i> Raumstatus
</a> </a>
</li> </li>
</ul> </ul>

View File

@ -11,18 +11,27 @@ layout: default
<div class="col-md-12 post"> <div class="col-md-12 post">
<header class="post-header"> <header class="post-header">
<h1 class="post-title">{{ post.title }}</h1> <h2 class="post-title">
<p class="post-meta">{{ post.date | date: "%b %-d, %Y" }}{% if post.author %} • {{ post.author }}{% endif %}{% if post.meta %} • {{ post.meta }}{% endif %}</p> <a href="{{ post.url | prepend: site.baseurl }}">
{{ post.title }}
</a>
</h2>
<p class="post-meta">
{{ post.date | date: "%b %-d, %Y" }}{% if post.author %} • {{ post.author }}{% endif %}{% if post.meta %} • {{ post.meta }}{% endif %}
</p>
</header> </header>
<article class="post-content"> <article class="post-content">
{{post.content}} {{post.content}}
{% assign wordcount = post.content | number_of_words %} {% assign wordcount = post.content | number_of_words %}
{% if wordcount > 200 %} {% if wordcount > 200 %}
<p><a class="btn btn-default" href="{{ post.url | prepend: site.baseurl }}" role="button">&gt; Weiterlesen</a></p> <p>
<a class="btn btn-default" href="{{ post.url | prepend: site.baseurl }}" role="button">
&gt; Weiterlesen
</a>
</p>
{% endif %} {% endif %}
</article> </article>
</div> </div>
</div> </div>
</div> </div>

View File

@ -6,13 +6,21 @@ layout: default
<div class="row"> <div class="row">
{% for post in site.posts limit:4 %} {% for post in site.posts limit:4 %}
<div class="col-md-3"> <div class="col-md-3">
<h2>{{ post.title }}</h2> <h2>
<a href="{{ post.url | prepend: site.baseurl }}">
{{ post.title }}
</a>
</h2>
<p> <p>
{{ post.content | truncatewords:20 }} {{ post.content | truncatewords:20 }}
</p> </p>
{% assign wordcount = post.content | number_of_words %} {% assign wordcount = post.content | number_of_words %}
{% if wordcount > 20 %} {% if wordcount > 20 %}
<p><a class="btn btn-default" href="{{ post.url | prepend: site.baseurl }}" role="button">&gt; Weiterlesen</a></p> <p>
<a class="btn btn-default" href="{{ post.url | prepend: site.baseurl }}" role="button">
&gt; Weiterlesen
</a>
</p>
{% endif %} {% endif %}
</div> </div>
{% endfor %} {% endfor %}

View File

@ -9,7 +9,7 @@
* Elevator.js * Elevator.js
*********************************************/ *********************************************/
var Elevator = (function() { var Elevator = function(options) {
'use strict'; 'use strict';
@ -22,33 +22,44 @@ var Elevator = (function() {
var customDuration = false; var customDuration = false;
var startTime = null; var startTime = null;
var startPosition = null; var startPosition = null;
var endPosition = 0;
var elevating = false;
var mainAudio; var mainAudio;
var endAudio; var endAudio;
var elevating = false; var that = this;
/** /**
* Utils * Utils
*/ */
// Soft object augmentation
function extend( target, source ) {
for ( var key in source ) {
if ( !( key in target ) ) {
target[ key ] = source[ key ];
}
}
return target;
};
// Thanks Mr Penner - http://robertpenner.com/easing/ // Thanks Mr Penner - http://robertpenner.com/easing/
function easeInOutQuad( t, b, c, d ) { function easeInOutQuad( t, b, c, d ) {
t /= d/2; t /= d / 2;
if (t < 1) return c/2*t*t + b; if ( t < 1 ) return c / 2 * t * t + b;
t--; t--;
return -c/2 * (t*(t-2) - 1) + b; return -c / 2 * ( t * ( t -2 ) - 1 ) + b;
}; }
function extendParameters(options, defaults){
for( var option in defaults ){
var t = options[option] === undefined && typeof option !== "function";
if(t){
options[option] = defaults[option];
}
}
return options;
}
function getVerticalOffset(element) {
var verticalOffset = 0;
while( element ){
verticalOffset += element.offsetTop || 0;
element = element.offsetParent;
}
return verticalOffset;
}
/** /**
* Main * Main
@ -56,12 +67,12 @@ var Elevator = (function() {
// Time is passed through requestAnimationFrame, what a world! // Time is passed through requestAnimationFrame, what a world!
function animateLoop( time ) { function animateLoop( time ) {
if (!startTime) { if ( !startTime ) {
startTime = time; startTime = time;
} }
var timeSoFar = time - startTime; var timeSoFar = time - startTime;
var easedPosition = easeInOutQuad(timeSoFar, startPosition, -startPosition, duration); var easedPosition = easeInOutQuad(timeSoFar, startPosition, endPosition - startPosition, duration);
window.scrollTo(0, easedPosition); window.scrollTo(0, easedPosition);
@ -70,7 +81,7 @@ var Elevator = (function() {
} else { } else {
animationFinished(); animationFinished();
} }
}; }
// ELEVATE! // ELEVATE!
// / // /
@ -85,7 +96,7 @@ var Elevator = (function() {
// C O O O D // C O O O D
// C__O__O__O__D // C__O__O__O__D
// [_____________] // [_____________]
function elevate() { this.elevate = function() {
if( elevating ) { if( elevating ) {
return; return;
@ -105,6 +116,10 @@ var Elevator = (function() {
if( mainAudio ) { if( mainAudio ) {
mainAudio.play(); mainAudio.play();
} }
};
function browserMeetsRequirements() {
return window.requestAnimationFrame && window.Audio && window.addEventListener;
} }
function resetPositions() { function resetPositions() {
@ -141,44 +156,68 @@ var Elevator = (function() {
mainAudio.currentTime = 0; mainAudio.currentTime = 0;
} }
window.scrollTo(0, 0); window.scrollTo(0, endPosition);
} }
} }
//@TODO: Does this need tap bindings too?
function bindElevateToElement( element ) { function bindElevateToElement( element ) {
element.addEventListener('click', elevate, false); if( element.addEventListener ) {
element.addEventListener('click', that.elevate, false);
} else {
// Older browsers
element.attachEvent('onclick', function() {
document.documentElement.scrollTop = endPosition;
document.body.scrollTop = endPosition;
window.scroll(0, endPosition);
});
}
} }
function main( options ) { function init( _options ) {
// Bind to element click event, if need be. // Bind to element click event, if need be.
body = document.body; body = document.body;
if( options.element ) { var defaults = {
bindElevateToElement( options.element ); duration: undefined,
mainAudio: false,
endAudio: false,
preloadAudio: true,
loopAudio: true,
};
_options = extendParameters(_options, defaults);
if( _options.element ) {
bindElevateToElement( _options.element );
} }
if( options.duration ) { // Take the stairs instead
if( !browserMeetsRequirements() ) {
return;
}
if( _options.duration ) {
customDuration = true; customDuration = true;
duration = options.duration; duration = _options.duration;
} }
if( options.mainAudio ) { if( _options.targetElement ) {
mainAudio = new Audio( options.mainAudio ); endPosition = getVerticalOffset(_options.targetElement);
mainAudio.setAttribute( 'preload', 'true' ); //@TODO: Option to not preload audio.
mainAudio.setAttribute( 'loop', 'true' );
}
if( options.endAudio ) {
endAudio = new Audio( options.endAudio );
endAudio.setAttribute( 'preload', 'true' );
} }
window.addEventListener('blur', onWindowBlur, false); window.addEventListener('blur', onWindowBlur, false);
if( _options.mainAudio ) {
mainAudio = new Audio( _options.mainAudio );
mainAudio.setAttribute( 'preload', _options.preloadAudio );
mainAudio.setAttribute( 'loop', _options.loopAudio );
}
if( _options.endAudio ) {
endAudio = new Audio( _options.endAudio );
endAudio.setAttribute( 'preload', 'true' );
}
} }
return extend(main, { init(options);
elevate: elevate };
});
})();