Skip to content

Commit

Permalink
Add possibility to disable gesture navigation in config le4ker#170
Browse files Browse the repository at this point in the history
  • Loading branch information
eiselems committed Jun 2, 2016
1 parent 4e0912e commit 1b872f5
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 83 deletions.
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ icon-192p: "/img/web-app/icon-192p.png"
# Blog #
########

enable-gesture-navigation: True

post-preview-words: 96

paginate: 5
Expand Down
173 changes: 90 additions & 83 deletions _includes/js.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,106 +166,113 @@
}
</script>

{% if page.section-type == "post" %}

<!-- Post Gesture Navigation Start -->

<script type="text/javascript" src="{{site.baseurl}}/js/hammer.min.js"></script>
<!-- Gesture Navigation / Swipe Instruction Start -->
{% if site.enable-gesture-navigation %}

This comment has been minimized.

Copy link
@eiselems

eiselems Jun 2, 2016

Author Owner

Basically i just added this line with closing {} at the end of the file.
Doesn't look pretty in the diff 😢


<script>
var post = document.getElementById('post');

new Hammer(post).on('swipeleft', function(event) {
addTohistory();
{% if site.baseurl == "" and page.previous == nil %}
document.location.replace("/");
{% else %}
document.location.replace("{{site.baseurl}}{{page.previous.url}}");
{% endif %}
});

new Hammer(post).on('swiperight', function(event) {
addTohistory();
{% if site.baseurl == "" and page.next == nil %}
document.location.replace("/");
{% else %}
document.location.replace("{{site.baseurl}}{{page.next.url}}");
{% endif %}
});
</script>
{% if page.section-type == "post" %}

<!-- Post Gesture Navigation Start -->
<!-- Post Gesture Navigation Start -->

<script type="text/javascript" src="{{site.baseurl}}/js/hammer.min.js"></script>

<script>
var post = document.getElementById('post');

new Hammer(post).on('swipeleft', function(event) {
addTohistory();
{% if site.baseurl == "" and page.previous == nil %}
document.location.replace("/");
{% else %}
document.location.replace("{{site.baseurl}}{{page.previous.url}}");
{% endif %}
});

new Hammer(post).on('swiperight', function(event) {
addTohistory();
{% if site.baseurl == "" and page.next == nil %}
document.location.replace("/");
{% else %}
document.location.replace("{{site.baseurl}}{{page.next.url}}");
{% endif %}
});
</script>

{% endif %}
<!-- Post Gesture Navigation Start -->

{% if page.section-type == "blog" %}
{% endif %}

<!-- Blog Gesture Navigation Start -->
{% if page.section-type == "blog" %}

<!-- Blog Gesture Navigation Start -->

<script type="text/javascript" src="{{site.baseurl}}/js/hammer.min.js"></script>

<script>
var page = document.getElementById('page');

new Hammer(page).on('swipeleft', function(event) {
addTohistory();
{% if site.baseurl == "" and paginator.next_page_path == nil %}
document.location.replace("/");
{% else %}
document.location.replace("{{site.baseurl}}{{paginator.next_page_path}}");
{% endif %}
});
new Hammer(page).on('swiperight', function(event) {
addTohistory();
{% if site.baseurl == "" and paginator.previous_page_path == nil %}
document.location.replace("/");
{% else %}
document.location.replace("{{site.baseurl}}{{paginator.previous_page_path}}");
{% endif %}
});
</script>

<script type="text/javascript" src="{{site.baseurl}}/js/hammer.min.js"></script>
<!-- Blog Gesture Navigation Start -->

<script>
var page = document.getElementById('page');

new Hammer(page).on('swipeleft', function(event) {
addTohistory();
{% if site.baseurl == "" and paginator.next_page_path == nil %}
document.location.replace("/");
{% else %}
document.location.replace("{{site.baseurl}}{{paginator.next_page_path}}");
{% endif %}
});
new Hammer(page).on('swiperight', function(event) {
addTohistory();
{% if site.baseurl == "" and paginator.previous_page_path == nil %}
document.location.replace("/");
{% else %}
document.location.replace("{{site.baseurl}}{{paginator.previous_page_path}}");
{% endif %}
});
</script>

<!-- Blog Gesture Navigation Start -->
{% endif %}

{% endif %}
{% if page.section-type == "blog" %}

{% if page.section-type == "blog" %}
<!-- Swipe Instructions for Blog Start -->

<!-- Swipe Instructions for Blog Start -->
<script>
$(document).ready(function(){
if(!localStorage.getItem('blog-swipeshowed')){
$("#swipe-instruction").fadeIn();
$("#swipe-instruction .close-swipe-instruction").click(function(){
$("#swipe-instruction").fadeOut();
});
localStorage.setItem('blog-swipeshowed', true);
}
});
</script>

<script>
$(document).ready(function(){
if(!localStorage.getItem('blog-swipeshowed')){
$("#swipe-instruction").fadeIn();
$("#swipe-instruction .close-swipe-instruction").click(function(){
$("#swipe-instruction").fadeOut();
});
localStorage.setItem('blog-swipeshowed', true);
}
});
</script>
<!-- Swipe Instructions for Blog End -->

<!-- Swipe Instructions for Blog End -->
{% endif %}

{% endif %}
{% if page.section-type == "post" %}

{% if page.section-type == "post" %}
<!-- Swipe Instructions for Post Start -->

<script>
$(document).ready(function(){
if(!localStorage.getItem('post-swipeshowed')){
$("#swipe-instruction").fadeIn();
$("#swipe-instruction .close-swipe-instruction").click(function(){
$("#swipe-instruction").fadeOut();
});
localStorage.setItem('post-swipeshowed', true);
}
});
</script>

<!-- Swipe Instructions for Post Start -->
<!-- Swipe Instructions for Post End -->

<script>
$(document).ready(function(){
if(!localStorage.getItem('post-swipeshowed')){
$("#swipe-instruction").fadeIn();
$("#swipe-instruction .close-swipe-instruction").click(function(){
$("#swipe-instruction").fadeOut();
});
localStorage.setItem('post-swipeshowed', true);
}
});
</script>
{% endif %}

<!-- Swipe Instructions for Post End -->
<!-- Gesture Navigation / Swipe Instruction End -->

{% endif %}

Expand Down

0 comments on commit 1b872f5

Please sign in to comment.