Added multilanguage support.
Used German as example language.
This commit is contained in:
parent
62fe1ee818
commit
5e14cab3e4
9 changed files with 398 additions and 310 deletions
|
|
@ -1,7 +1,8 @@
|
|||
languageCode = "en-us"
|
||||
title = "Dimension"
|
||||
baseurl = "http://example.org/"
|
||||
title = "Dimension"
|
||||
theme = "dimension"
|
||||
languageCode = "en-us"
|
||||
defaultContentLanguage = "en"
|
||||
|
||||
[params]
|
||||
title = "Dimension"
|
||||
|
|
@ -29,3 +30,14 @@ theme = "dimension"
|
|||
medium = "github"
|
||||
icon = "github"
|
||||
link = "#"
|
||||
|
||||
[languages]
|
||||
[languages.en]
|
||||
languageName = "English"
|
||||
weight = 1
|
||||
title = "Dimension"
|
||||
|
||||
[languages.de]
|
||||
languageName = "Deutsch"
|
||||
weight = 2
|
||||
title = "Dimension"
|
||||
|
|
|
|||
10
exampleSite/content/about.de.md
Normal file
10
exampleSite/content/about.de.md
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
+++
|
||||
draft = false
|
||||
date = "2017-03-02T11:59:21-05:00"
|
||||
title = "Über"
|
||||
weight = 30
|
||||
|
||||
+++
|
||||
|
||||
{{< figure class="image main" src="/img/pic03.jpg" >}}
|
||||
Lorem ipsum dolor sit amet, consectetur et adipiscing elit. Praesent eleifend dignissim arcu, at eleifend sapien imperdiet ac. Aliquam erat volutpat. Praesent urna nisi, fringila lorem et vehicula lacinia quam. Integer sollicitudin mauris nec lorem luctus ultrices. Aliquam libero et malesuada fames ac ante ipsum primis in faucibus. Cras viverra ligula sit amet ex mollis mattis lorem ipsum dolor sit amet.
|
||||
28
exampleSite/content/contact.de.md
Normal file
28
exampleSite/content/contact.de.md
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
+++
|
||||
date = "2017-03-02T11:59:27-05:00"
|
||||
title = "Kontakt"
|
||||
weight = 40
|
||||
draft = false
|
||||
|
||||
+++
|
||||
|
||||
<form method="post" action="#">
|
||||
<div class="field half first">
|
||||
<label for="name">Name</label>
|
||||
<input type="text" name="name" id="name" />
|
||||
</div>
|
||||
<div class="field half">
|
||||
<label for="email">Email</label>
|
||||
<input type="text" name="email" id="email" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="message">Nachricht</label>
|
||||
<textarea name="message" id="message" rows="4"></textarea>
|
||||
</div>
|
||||
<ul class="actions">
|
||||
<li><input type="submit" value="Absenden" class="special" /></li>
|
||||
<li><input type="reset" value="Zurücksetzen" /></li>
|
||||
</ul>
|
||||
</form>
|
||||
|
||||
{{< socialLinks >}}
|
||||
13
exampleSite/content/intro.de.md
Normal file
13
exampleSite/content/intro.de.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
+++
|
||||
weight = 10
|
||||
date = "2017-03-02T10:54:38-05:00"
|
||||
title = "Einführung"
|
||||
draft = false
|
||||
menuname = "Einf."
|
||||
|
||||
+++
|
||||
|
||||
{{< figure class="image main" src="/img/pic01.jpg" >}}
|
||||
Aenean ornare velit lacus, ac varius enim ullamcorper eu. Proin aliquam facilisis ante interdum congue. Integer mollis, nisl amet convallis, porttitor magna ullamcorper, amet egestas mauris. Ut magna finibus nisi nec lacinia. Nam maximus erat id euismod egestas. By the way, check out my [awesome work](#work).
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dapibus rutrum facilisis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam tristique libero eu nibh porttitor fermentum. Nullam venenatis erat id vehicula viverra. Nunc ultrices eros ut ultricies condimentum. Mauris risus lacus, blandit sit amet venenatis non, bibendum vitae dolor. Nunc lorem mauris, fringilla in aliquam at, euismod in lectus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In non lorem sit amet elit placerat maximus. Pellentesque aliquam maximus risus, vel sed vehicula.
|
||||
12
exampleSite/content/work.de.md
Normal file
12
exampleSite/content/work.de.md
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
+++
|
||||
weight = 20
|
||||
draft = false
|
||||
date = "2017-03-02T11:59:05-05:00"
|
||||
title = "Arbeit"
|
||||
|
||||
+++
|
||||
|
||||
{{< figure class="image main" src="/img/pic02.jpg" >}}
|
||||
Adipiscing magna sed dolor elit. Praesent eleifend dignissim arcu, at eleifend sapien imperdiet ac. Aliquam erat volutpat. Praesent urna nisi, fringila lorem et vehicula lacinia quam. Integer sollicitudin mauris nec lorem luctus ultrices.
|
||||
|
||||
Nullam et orci eu lorem consequat tincidunt vivamus et sagittis libero. Mauris aliquet magna magna sed nunc rhoncus pharetra. Pellentesque condimentum sem. In efficitur ligula tate urna. Maecenas laoreet massa vel lacinia pellentesque lorem ipsum dolor. Nullam et orci eu lorem consequat tincidunt. Vivamus et sagittis libero. Mauris aliquet magna magna sed nunc rhoncus amet feugiat tempus.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<article id="{{ .File.BaseFileName }}">
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ .Content }}
|
||||
<article id="{{ .File.TranslationBaseName }}">
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ .Content }}
|
||||
</article>
|
||||
|
|
|
|||
|
|
@ -1,33 +1,41 @@
|
|||
{{ partial "header.html" . }}
|
||||
|
||||
<!-- Wrapper -->
|
||||
<div id="wrapper">
|
||||
<!-- Wrapper -->
|
||||
<div id="wrapper">
|
||||
|
||||
<!-- Header -->
|
||||
<header id="header">
|
||||
<div class="logo">
|
||||
<span class="icon {{ .Site.Params.logo }}"></span>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="inner">
|
||||
<h1>{{ .Site.Params.title | safeHTML }}</h1>
|
||||
<p>{{ .Site.Params.description | safeHTML }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<nav>
|
||||
<ul>
|
||||
{{ range .Data.Pages.ByWeight }}
|
||||
<li><a href="#{{ .File.BaseFileName }}">{{ if .GetParam "menuname" }}{{ .GetParam "menuname" }}{{ else }}{{ .Title }}{{ end }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
<!-- Header -->
|
||||
<header id="header">
|
||||
<div class="logo">
|
||||
<span class="icon {{ .Site.Params.logo }}"></span>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="inner">
|
||||
<h1>{{ .Site.Params.title | safeHTML }}</h1>
|
||||
<p>{{ .Site.Params.description | safeHTML }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<nav>
|
||||
<ul>
|
||||
{{ range .Data.Pages.ByWeight }}
|
||||
<li><a href="#{{ .File.TranslationBaseName }}">{{ if .GetParam "menuname" }}{{ .GetParam "menuname" }}{{ else }}{{ .Title }}{{ end }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<!-- Main -->
|
||||
<div id="main">
|
||||
{{ range .Data.Pages }}
|
||||
{{ .Render "onepagestyle" }}
|
||||
{{ end }}
|
||||
</div>
|
||||
<!-- Main -->
|
||||
<div id="main">
|
||||
{{ range .Data.Pages }}
|
||||
{{ .Render "onepagestyle" }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<!-- Multilanguage -->
|
||||
<div id="languages">
|
||||
{{ if .IsTranslated }}
|
||||
{{ range $i, $e := .Translations }}
|
||||
{{ if $i }}, {{ end }}<a href="{{ .Permalink }}">{{ $e.Language.LanguageName }}</a>
|
||||
{{ end}}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ partial "footer.html" . }}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
{{ $baseURL := .Site.BaseURL }}
|
||||
{{ range sort .Data.Pages }}
|
||||
<url>
|
||||
<loc>{{ $baseURL }}#{{ .File.BaseFileName }}</loc>
|
||||
<loc>{{ $baseURL }}#{{ .File.TranslationBaseName }}</loc>
|
||||
</url>
|
||||
{{ end }}
|
||||
</urlset>
|
||||
|
|
|
|||
|
|
@ -1,409 +1,414 @@
|
|||
/*
|
||||
Dimension by HTML5 UP
|
||||
html5up.net | @ajlkn
|
||||
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
|
||||
Dimension by HTML5 UP
|
||||
html5up.net | @ajlkn
|
||||
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
skel.breakpoints({
|
||||
xlarge: '(max-width: 1680px)',
|
||||
large: '(max-width: 1280px)',
|
||||
medium: '(max-width: 980px)',
|
||||
small: '(max-width: 736px)',
|
||||
xsmall: '(max-width: 480px)',
|
||||
xxsmall: '(max-width: 360px)'
|
||||
});
|
||||
skel.breakpoints({
|
||||
xlarge: '(max-width: 1680px)',
|
||||
large: '(max-width: 1280px)',
|
||||
medium: '(max-width: 980px)',
|
||||
small: '(max-width: 736px)',
|
||||
xsmall: '(max-width: 480px)',
|
||||
xxsmall: '(max-width: 360px)'
|
||||
});
|
||||
|
||||
$(function() {
|
||||
$(function() {
|
||||
|
||||
var $window = $(window),
|
||||
$body = $('body'),
|
||||
$wrapper = $('#wrapper'),
|
||||
$header = $('#header'),
|
||||
$footer = $('#footer'),
|
||||
$main = $('#main'),
|
||||
$main_articles = $main.children('article');
|
||||
var $window = $(window),
|
||||
$body = $('body'),
|
||||
$wrapper = $('#wrapper'),
|
||||
$header = $('#header'),
|
||||
$footer = $('#footer'),
|
||||
$languages = $('#languages'),
|
||||
$main = $('#main'),
|
||||
$main_articles = $main.children('article');
|
||||
|
||||
// Disable animations/transitions until the page has loaded.
|
||||
$body.addClass('is-loading');
|
||||
// Disable animations/transitions until the page has loaded.
|
||||
$body.addClass('is-loading');
|
||||
|
||||
$window.on('load', function() {
|
||||
window.setTimeout(function() {
|
||||
$body.removeClass('is-loading');
|
||||
}, 100);
|
||||
});
|
||||
$window.on('load', function() {
|
||||
window.setTimeout(function() {
|
||||
$body.removeClass('is-loading');
|
||||
}, 100);
|
||||
});
|
||||
|
||||
// Fix: Placeholder polyfill.
|
||||
$('form').placeholder();
|
||||
// Fix: Placeholder polyfill.
|
||||
$('form').placeholder();
|
||||
|
||||
// Fix: Flexbox min-height bug on IE.
|
||||
if (skel.vars.IEVersion < 12) {
|
||||
// Fix: Flexbox min-height bug on IE.
|
||||
if (skel.vars.IEVersion < 12) {
|
||||
|
||||
var flexboxFixTimeoutId;
|
||||
var flexboxFixTimeoutId;
|
||||
|
||||
$window.on('resize.flexbox-fix', function() {
|
||||
$window.on('resize.flexbox-fix', function() {
|
||||
|
||||
clearTimeout(flexboxFixTimeoutId);
|
||||
clearTimeout(flexboxFixTimeoutId);
|
||||
|
||||
flexboxFixTimeoutId = setTimeout(function() {
|
||||
flexboxFixTimeoutId = setTimeout(function() {
|
||||
|
||||
if ($wrapper.prop('scrollHeight') > $window.height())
|
||||
$wrapper.css('height', 'auto');
|
||||
else
|
||||
$wrapper.css('height', '100vh');
|
||||
if ($wrapper.prop('scrollHeight') > $window.height())
|
||||
$wrapper.css('height', 'auto');
|
||||
else
|
||||
$wrapper.css('height', '100vh');
|
||||
|
||||
}, 250);
|
||||
}, 250);
|
||||
|
||||
}).triggerHandler('resize.flexbox-fix');
|
||||
}).triggerHandler('resize.flexbox-fix');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Nav.
|
||||
var $nav = $header.children('nav'),
|
||||
$nav_li = $nav.find('li');
|
||||
// Nav.
|
||||
var $nav = $header.children('nav'),
|
||||
$nav_li = $nav.find('li');
|
||||
|
||||
// Add "middle" alignment classes if we're dealing with an even number of items.
|
||||
if ($nav_li.length % 2 == 0) {
|
||||
// Add "middle" alignment classes if we're dealing with an even number of items.
|
||||
if ($nav_li.length % 2 == 0) {
|
||||
|
||||
$nav.addClass('use-middle');
|
||||
$nav_li.eq( ($nav_li.length / 2) ).addClass('is-middle');
|
||||
$nav.addClass('use-middle');
|
||||
$nav_li.eq( ($nav_li.length / 2) ).addClass('is-middle');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Main.
|
||||
var delay = 325,
|
||||
locked = false;
|
||||
// Main.
|
||||
var delay = 325,
|
||||
locked = false;
|
||||
|
||||
// Methods.
|
||||
$main._show = function(id, initial) {
|
||||
// Methods.
|
||||
$main._show = function(id, initial) {
|
||||
|
||||
var $article = $main_articles.filter('#' + id);
|
||||
var $article = $main_articles.filter('#' + id);
|
||||
|
||||
// No such article? Bail.
|
||||
if ($article.length == 0)
|
||||
return;
|
||||
// No such article? Bail.
|
||||
if ($article.length == 0)
|
||||
return;
|
||||
|
||||
// Handle lock.
|
||||
// Handle lock.
|
||||
|
||||
// Already locked? Speed through "show" steps w/o delays.
|
||||
if (locked || (typeof initial != 'undefined' && initial === true)) {
|
||||
// Already locked? Speed through "show" steps w/o delays.
|
||||
if (locked || (typeof initial != 'undefined' && initial === true)) {
|
||||
|
||||
// Mark as switching.
|
||||
$body.addClass('is-switching');
|
||||
// Mark as switching.
|
||||
$body.addClass('is-switching');
|
||||
|
||||
// Mark as visible.
|
||||
$body.addClass('is-article-visible');
|
||||
// Mark as visible.
|
||||
$body.addClass('is-article-visible');
|
||||
|
||||
// Deactivate all articles (just in case one's already active).
|
||||
$main_articles.removeClass('active');
|
||||
// Deactivate all articles (just in case one's already active).
|
||||
$main_articles.removeClass('active');
|
||||
|
||||
// Hide header, footer.
|
||||
$header.hide();
|
||||
$footer.hide();
|
||||
// Hide header, footer, languages.
|
||||
$header.hide();
|
||||
$footer.hide();
|
||||
$languages.hide();
|
||||
|
||||
// Show main, article.
|
||||
$main.show();
|
||||
$article.show();
|
||||
// Show main, article.
|
||||
$main.show();
|
||||
$article.show();
|
||||
|
||||
// Activate article.
|
||||
$article.addClass('active');
|
||||
// Activate article.
|
||||
$article.addClass('active');
|
||||
|
||||
// Unlock.
|
||||
locked = false;
|
||||
// Unlock.
|
||||
locked = false;
|
||||
|
||||
// Unmark as switching.
|
||||
setTimeout(function() {
|
||||
$body.removeClass('is-switching');
|
||||
}, (initial ? 1000 : 0));
|
||||
// Unmark as switching.
|
||||
setTimeout(function() {
|
||||
$body.removeClass('is-switching');
|
||||
}, (initial ? 1000 : 0));
|
||||
|
||||
return;
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Lock.
|
||||
locked = true;
|
||||
// Lock.
|
||||
locked = true;
|
||||
|
||||
// Article already visible? Just swap articles.
|
||||
if ($body.hasClass('is-article-visible')) {
|
||||
// Article already visible? Just swap articles.
|
||||
if ($body.hasClass('is-article-visible')) {
|
||||
|
||||
// Deactivate current article.
|
||||
var $currentArticle = $main_articles.filter('.active');
|
||||
// Deactivate current article.
|
||||
var $currentArticle = $main_articles.filter('.active');
|
||||
|
||||
$currentArticle.removeClass('active');
|
||||
$currentArticle.removeClass('active');
|
||||
|
||||
// Show article.
|
||||
setTimeout(function() {
|
||||
// Show article.
|
||||
setTimeout(function() {
|
||||
|
||||
// Hide current article.
|
||||
$currentArticle.hide();
|
||||
// Hide current article.
|
||||
$currentArticle.hide();
|
||||
|
||||
// Show article.
|
||||
$article.show();
|
||||
// Show article.
|
||||
$article.show();
|
||||
|
||||
// Activate article.
|
||||
setTimeout(function() {
|
||||
// Activate article.
|
||||
setTimeout(function() {
|
||||
|
||||
$article.addClass('active');
|
||||
$article.addClass('active');
|
||||
|
||||
// Window stuff.
|
||||
$window
|
||||
.scrollTop(0)
|
||||
.triggerHandler('resize.flexbox-fix');
|
||||
// Window stuff.
|
||||
$window
|
||||
.scrollTop(0)
|
||||
.triggerHandler('resize.flexbox-fix');
|
||||
|
||||
// Unlock.
|
||||
setTimeout(function() {
|
||||
locked = false;
|
||||
}, delay);
|
||||
// Unlock.
|
||||
setTimeout(function() {
|
||||
locked = false;
|
||||
}, delay);
|
||||
|
||||
}, 25);
|
||||
}, 25);
|
||||
|
||||
}, delay);
|
||||
}, delay);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, handle as normal.
|
||||
else {
|
||||
// Otherwise, handle as normal.
|
||||
else {
|
||||
|
||||
// Mark as visible.
|
||||
$body
|
||||
.addClass('is-article-visible');
|
||||
// Mark as visible.
|
||||
$body
|
||||
.addClass('is-article-visible');
|
||||
|
||||
// Show article.
|
||||
setTimeout(function() {
|
||||
// Show article.
|
||||
setTimeout(function() {
|
||||
|
||||
// Hide header, footer.
|
||||
$header.hide();
|
||||
$footer.hide();
|
||||
// Hide header, footer, languages.
|
||||
$header.hide();
|
||||
$footer.hide();
|
||||
$languages.hide();
|
||||
|
||||
// Show main, article.
|
||||
$main.show();
|
||||
$article.show();
|
||||
// Show main, article.
|
||||
$main.show();
|
||||
$article.show();
|
||||
|
||||
// Activate article.
|
||||
setTimeout(function() {
|
||||
// Activate article.
|
||||
setTimeout(function() {
|
||||
|
||||
$article.addClass('active');
|
||||
$article.addClass('active');
|
||||
|
||||
// Window stuff.
|
||||
$window
|
||||
.scrollTop(0)
|
||||
.triggerHandler('resize.flexbox-fix');
|
||||
// Window stuff.
|
||||
$window
|
||||
.scrollTop(0)
|
||||
.triggerHandler('resize.flexbox-fix');
|
||||
|
||||
// Unlock.
|
||||
setTimeout(function() {
|
||||
locked = false;
|
||||
}, delay);
|
||||
// Unlock.
|
||||
setTimeout(function() {
|
||||
locked = false;
|
||||
}, delay);
|
||||
|
||||
}, 25);
|
||||
}, 25);
|
||||
|
||||
}, delay);
|
||||
}, delay);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
$main._hide = function(addState) {
|
||||
$main._hide = function(addState) {
|
||||
|
||||
var $article = $main_articles.filter('.active');
|
||||
var $article = $main_articles.filter('.active');
|
||||
|
||||
// Article not visible? Bail.
|
||||
if (!$body.hasClass('is-article-visible'))
|
||||
return;
|
||||
// Article not visible? Bail.
|
||||
if (!$body.hasClass('is-article-visible'))
|
||||
return;
|
||||
|
||||
// Add state?
|
||||
if (typeof addState != 'undefined'
|
||||
&& addState === true)
|
||||
history.pushState(null, null, '#');
|
||||
// Add state?
|
||||
if (typeof addState != 'undefined'
|
||||
&& addState === true)
|
||||
history.pushState(null, null, '#');
|
||||
|
||||
// Handle lock.
|
||||
// Handle lock.
|
||||
|
||||
// Already locked? Speed through "hide" steps w/o delays.
|
||||
if (locked) {
|
||||
// Already locked? Speed through "hide" steps w/o delays.
|
||||
if (locked) {
|
||||
|
||||
// Mark as switching.
|
||||
$body.addClass('is-switching');
|
||||
// Mark as switching.
|
||||
$body.addClass('is-switching');
|
||||
|
||||
// Deactivate article.
|
||||
$article.removeClass('active');
|
||||
// Deactivate article.
|
||||
$article.removeClass('active');
|
||||
|
||||
// Hide article, main.
|
||||
$article.hide();
|
||||
$main.hide();
|
||||
// Hide article, main.
|
||||
$article.hide();
|
||||
$main.hide();
|
||||
|
||||
// Show footer, header.
|
||||
$footer.show();
|
||||
$header.show();
|
||||
// Show footer, header.
|
||||
$footer.show();
|
||||
$header.show();
|
||||
$languages.show();
|
||||
|
||||
// Unmark as visible.
|
||||
$body.removeClass('is-article-visible');
|
||||
// Unmark as visible.
|
||||
$body.removeClass('is-article-visible');
|
||||
|
||||
// Unlock.
|
||||
locked = false;
|
||||
// Unlock.
|
||||
locked = false;
|
||||
|
||||
// Unmark as switching.
|
||||
$body.removeClass('is-switching');
|
||||
// Unmark as switching.
|
||||
$body.removeClass('is-switching');
|
||||
|
||||
// Window stuff.
|
||||
$window
|
||||
.scrollTop(0)
|
||||
.triggerHandler('resize.flexbox-fix');
|
||||
// Window stuff.
|
||||
$window
|
||||
.scrollTop(0)
|
||||
.triggerHandler('resize.flexbox-fix');
|
||||
|
||||
return;
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Lock.
|
||||
locked = true;
|
||||
// Lock.
|
||||
locked = true;
|
||||
|
||||
// Deactivate article.
|
||||
$article.removeClass('active');
|
||||
// Deactivate article.
|
||||
$article.removeClass('active');
|
||||
|
||||
// Hide article.
|
||||
setTimeout(function() {
|
||||
// Hide article.
|
||||
setTimeout(function() {
|
||||
|
||||
// Hide article, main.
|
||||
$article.hide();
|
||||
$main.hide();
|
||||
// Hide article, main.
|
||||
$article.hide();
|
||||
$main.hide();
|
||||
|
||||
// Show footer, header.
|
||||
$footer.show();
|
||||
$header.show();
|
||||
// Show footer, header.
|
||||
$footer.show();
|
||||
$header.show();
|
||||
$languages.show();
|
||||
|
||||
// Unmark as visible.
|
||||
setTimeout(function() {
|
||||
// Unmark as visible.
|
||||
setTimeout(function() {
|
||||
|
||||
$body.removeClass('is-article-visible');
|
||||
$body.removeClass('is-article-visible');
|
||||
|
||||
// Window stuff.
|
||||
$window
|
||||
.scrollTop(0)
|
||||
.triggerHandler('resize.flexbox-fix');
|
||||
// Window stuff.
|
||||
$window
|
||||
.scrollTop(0)
|
||||
.triggerHandler('resize.flexbox-fix');
|
||||
|
||||
// Unlock.
|
||||
setTimeout(function() {
|
||||
locked = false;
|
||||
}, delay);
|
||||
// Unlock.
|
||||
setTimeout(function() {
|
||||
locked = false;
|
||||
}, delay);
|
||||
|
||||
}, 25);
|
||||
}, 25);
|
||||
|
||||
}, delay);
|
||||
}, delay);
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
// Articles.
|
||||
$main_articles.each(function() {
|
||||
// Articles.
|
||||
$main_articles.each(function() {
|
||||
|
||||
var $this = $(this);
|
||||
var $this = $(this);
|
||||
|
||||
// Close.
|
||||
$('<div class="close">Close</div>')
|
||||
.appendTo($this)
|
||||
.on('click', function() {
|
||||
location.hash = '';
|
||||
});
|
||||
// Close.
|
||||
$('<div class="close">Close</div>')
|
||||
.appendTo($this)
|
||||
.on('click', function() {
|
||||
location.hash = '';
|
||||
});
|
||||
|
||||
// Prevent clicks from inside article from bubbling.
|
||||
$this.on('click', function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
// Prevent clicks from inside article from bubbling.
|
||||
$this.on('click', function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// Events.
|
||||
$body.on('click', function(event) {
|
||||
// Events.
|
||||
$body.on('click', function(event) {
|
||||
|
||||
// Article visible? Hide.
|
||||
if ($body.hasClass('is-article-visible'))
|
||||
$main._hide(true);
|
||||
// Article visible? Hide.
|
||||
if ($body.hasClass('is-article-visible'))
|
||||
$main._hide(true);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$window.on('keyup', function(event) {
|
||||
$window.on('keyup', function(event) {
|
||||
|
||||
switch (event.keyCode) {
|
||||
switch (event.keyCode) {
|
||||
|
||||
case 27:
|
||||
case 27:
|
||||
|
||||
// Article visible? Hide.
|
||||
if ($body.hasClass('is-article-visible'))
|
||||
$main._hide(true);
|
||||
// Article visible? Hide.
|
||||
if ($body.hasClass('is-article-visible'))
|
||||
$main._hide(true);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$window.on('hashchange', function(event) {
|
||||
$window.on('hashchange', function(event) {
|
||||
|
||||
// Empty hash?
|
||||
if (location.hash == ''
|
||||
|| location.hash == '#') {
|
||||
// Empty hash?
|
||||
if (location.hash == ''
|
||||
|| location.hash == '#') {
|
||||
|
||||
// Prevent default.
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
// Prevent default.
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
// Hide.
|
||||
$main._hide();
|
||||
// Hide.
|
||||
$main._hide();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, check for a matching article.
|
||||
else if ($main_articles.filter(location.hash).length > 0) {
|
||||
// Otherwise, check for a matching article.
|
||||
else if ($main_articles.filter(location.hash).length > 0) {
|
||||
|
||||
// Prevent default.
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
// Prevent default.
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
// Show article.
|
||||
$main._show(location.hash.substr(1));
|
||||
// Show article.
|
||||
$main._show(location.hash.substr(1));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// Scroll restoration.
|
||||
// This prevents the page from scrolling back to the top on a hashchange.
|
||||
if ('scrollRestoration' in history)
|
||||
history.scrollRestoration = 'manual';
|
||||
else {
|
||||
// Scroll restoration.
|
||||
// This prevents the page from scrolling back to the top on a hashchange.
|
||||
if ('scrollRestoration' in history)
|
||||
history.scrollRestoration = 'manual';
|
||||
else {
|
||||
|
||||
var oldScrollPos = 0,
|
||||
scrollPos = 0,
|
||||
$htmlbody = $('html,body');
|
||||
var oldScrollPos = 0,
|
||||
scrollPos = 0,
|
||||
$htmlbody = $('html,body');
|
||||
|
||||
$window
|
||||
.on('scroll', function() {
|
||||
$window
|
||||
.on('scroll', function() {
|
||||
|
||||
oldScrollPos = scrollPos;
|
||||
scrollPos = $htmlbody.scrollTop();
|
||||
oldScrollPos = scrollPos;
|
||||
scrollPos = $htmlbody.scrollTop();
|
||||
|
||||
})
|
||||
.on('hashchange', function() {
|
||||
$window.scrollTop(oldScrollPos);
|
||||
});
|
||||
})
|
||||
.on('hashchange', function() {
|
||||
$window.scrollTop(oldScrollPos);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize.
|
||||
// Initialize.
|
||||
|
||||
// Hide main, articles.
|
||||
$main.hide();
|
||||
$main_articles.hide();
|
||||
// Hide main, articles.
|
||||
$main.hide();
|
||||
$main_articles.hide();
|
||||
|
||||
// Initial article.
|
||||
if (location.hash != ''
|
||||
&& location.hash != '#')
|
||||
$window.on('load', function() {
|
||||
$main._show(location.hash.substr(1), true);
|
||||
});
|
||||
// Initial article.
|
||||
if (location.hash != ''
|
||||
&& location.hash != '#')
|
||||
$window.on('load', function() {
|
||||
$main._show(location.hash.substr(1), true);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
})(jQuery);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue