add gesture support for mobile page
This commit is contained in:
7
app/assets/javascripts/mobile.js
Normal file
7
app/assets/javascripts/mobile.js
Normal file
@@ -0,0 +1,7 @@
|
||||
//= require jquery-1.10.1.min.js
|
||||
//= require hammer.min.js
|
||||
//= require jquery.hammer.min.js
|
||||
|
||||
$(function() {
|
||||
$(document).hammer();
|
||||
});
|
||||
@@ -9,4 +9,27 @@
|
||||
|
||||
<%= content_for(:html_header) do %>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$(document).on("swipeleft", function() {
|
||||
var href = $(".paginator a[rel=next]").attr("href");
|
||||
if (href) {
|
||||
window.location = href;
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("swiperight", function() {
|
||||
var href = $(".paginator a[rel=prev]").attr("href");
|
||||
if (href) {
|
||||
window.location = href;
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
<% if @post_set.tag_string.present? %>
|
||||
<%= @post_set.humanized_tag_string %> - <%= Danbooru.config.app_name %>
|
||||
<% else %>
|
||||
<%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
|
||||
@@ -11,4 +11,22 @@
|
||||
|
||||
<%= content_for(:html_header) do %>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=<%= @post.device_scale %>">
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$(document).on("swipeleft", function() {
|
||||
var href = $(".paginator a[rel=next]").attr("href");
|
||||
if (href) {
|
||||
window.location = href;
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("swiperight", function() {
|
||||
window.history.back();
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
<%= @post.presenter.humanized_essential_tag_string %> - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
|
||||
9
vendor/assets/javascripts/hammer.min.js
vendored
Normal file
9
vendor/assets/javascripts/hammer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
8
vendor/assets/javascripts/jquery.hammer.min.js
vendored
Normal file
8
vendor/assets/javascripts/jquery.hammer.min.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*! jQuery plugin for Hammer.JS - v1.1.0dev - 2014-04-11
|
||||
* http://eightmedia.github.com/hammer.js
|
||||
*
|
||||
* Copyright (c) 2014 Jorik Tangelder <j.tangelder@gmail.com>;
|
||||
* Licensed under the MIT license */
|
||||
|
||||
!function(a){"use strict";function b(a,b){Date.now||(Date.now=function(){return(new Date).getTime()}),a.utils.each(["on","off"],function(c){a.utils[c]=function(a,d,e){b(a)[c](d,function(a){var c=b.extend({},a.originalEvent,a);e.call(this,c)})}}),a.Instance.prototype.trigger=function(a,c){var d=b(this.element);return d.has(c.target).length&&(d=b(c.target)),d.trigger({type:a,gesture:c})},b.fn.hammer=function(c){return this.each(function(){var d=b(this),e=d.data("hammer");e?e&&c&&a.utils.extend(e.options,c):d.data("hammer",new a(this,c||{}))})}}"function"==typeof define&&define.amd?define(["hammerjs","jquery"],b):b(a.Hammer,a.jQuery||a.Zepto)}(window);
|
||||
//# sourceMappingURL=jquery.hammer.min.map
|
||||
Reference in New Issue
Block a user