Added swiping on mobile, fixed index.html, small changes to css
This commit is contained in:
parent
4961c398a5
commit
d9a96b827f
@ -35,7 +35,7 @@ def scan_photos():
|
|||||||
|
|
||||||
@app.route("/auth")
|
@app.route("/auth")
|
||||||
def login():
|
def login():
|
||||||
if request.args.get('logout'):
|
if 'logout' in request.args:
|
||||||
logout_user()
|
logout_user()
|
||||||
|
|
||||||
if current_user.is_authenticated:
|
if current_user.is_authenticated:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python2
|
#!./venv/bin/python
|
||||||
|
|
||||||
from TreeWalker import TreeWalker
|
from TreeWalker import TreeWalker
|
||||||
from CachePath import message
|
from CachePath import message
|
||||||
|
@ -40,7 +40,7 @@ a:hover {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
.current-thumb {
|
.current-thumb {
|
||||||
border-top: 1px solid #FFAD27 !important;
|
border-top: 4px solid #FFAD27 !important;
|
||||||
}
|
}
|
||||||
#subalbums {
|
#subalbums {
|
||||||
padding-top: 1.5em;
|
padding-top: 1.5em;
|
||||||
@ -63,7 +63,7 @@ a:hover {
|
|||||||
#next, #back {
|
#next, #back {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: auto;
|
width: auto;
|
||||||
font-size: 4.5em;
|
font-size: 12em;
|
||||||
line-height: 0;
|
line-height: 0;
|
||||||
top: 40%;
|
top: 40%;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@ -86,7 +86,6 @@ a:hover {
|
|||||||
bottom: 150px;
|
bottom: 150px;
|
||||||
top: 2.5em;
|
top: 2.5em;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-bottom: 0.5em;
|
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -102,9 +101,9 @@ a:hover {
|
|||||||
#photo-links {
|
#photo-links {
|
||||||
background-color: #000000;
|
background-color: #000000;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
height: 10px;
|
height: 12px;
|
||||||
font-size: 10px;
|
font-size: 12px;
|
||||||
line-height: 7px;
|
line-height: 10px;
|
||||||
padding-top: 3px;
|
padding-top: 3px;
|
||||||
padding-bottom: 3px;
|
padding-bottom: 3px;
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
@ -167,6 +166,7 @@ a:hover {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
background-color: #999999;
|
||||||
}
|
}
|
||||||
|
|
||||||
#powered-by {
|
#powered-by {
|
||||||
|
@ -1,44 +1,50 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<meta name="medium" content="image" />
|
<meta name="medium" content="image" />
|
||||||
<title>Photos</title>
|
<title>Photos</title>
|
||||||
<link href="css/styles.min.css" rel="stylesheet" type="text/css" />
|
<link href="css/styles.min.css" rel="stylesheet" type="text/css" />
|
||||||
<script type="text/javascript" src="js/scripts.min.js"></script>
|
<script src="js/scripts.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="title">Photos</div>
|
<div id="title">Photos</div>
|
||||||
<div id="photo-view">
|
<div id="photo-view">
|
||||||
<div id="photo-box">
|
<div id="photo-box">
|
||||||
<a id="next-photo"><img id="photo" /></a>
|
<a id="next-photo">
|
||||||
<div id="photo-bar">
|
<img id="photo" alt="Dynamic image, no alt available" src="./img/image-placeholder.png" />
|
||||||
<div id="photo-links">
|
</a>
|
||||||
<a id="metadata-link" href="javascript:void(0)">show metadata</a> | <a id="original-link" target="_blank">download original</a><span id="fullscreen-divider"> | </span><a id="fullscreen" href="javascript:void(0)">fullscreen</a>
|
<div id="photo-bar">
|
||||||
</div>
|
<div id="photo-links">
|
||||||
<div id="metadata"></div>
|
<a id="metadata-link" href="javascript:void(0)">show metadata</a> | <a id="original-link" target="_blank">download original</a><span id="fullscreen-divider"> | </span><a id="fullscreen" href="javascript:void(0)">fullscreen</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div id="metadata"></div>
|
||||||
<div id="video-box">
|
</div>
|
||||||
<div id="video-box-inner">
|
</div>
|
||||||
</div>
|
<div id="video-box">
|
||||||
</div>
|
<div id="video-box-inner">
|
||||||
|
</div>
|
||||||
<a id="back">‹</a>
|
</div>
|
||||||
<a id="next">›</a>
|
<a id="back">‹</a>
|
||||||
</div>
|
<a id="next">›</a>
|
||||||
<div id="album-view">
|
</div>
|
||||||
<div id="thumbs">
|
|
||||||
<div id="loading">Loading...</div>
|
|
||||||
</div>
|
|
||||||
<div id="subalbums"></div>
|
|
||||||
<div id="powered-by">Powered by <a href="http://www.zx2c4.com/projects/photofloat/" target="_blank">PhotoFloat</a></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="error-overlay"></div>
|
<div id="album-view">
|
||||||
<div id="error-text">Forgot my camera.</div>
|
<div id="thumbs">
|
||||||
<div id="auth-text"><form id="auth-form"><input id="password" type="password" /><input type="submit" value="Login" /></form</div>
|
<div id="loading">Loading...</div>
|
||||||
|
</div>
|
||||||
|
<div id="subalbums"></div>
|
||||||
|
<div id="powered-by">Powered by <a href="http://www.zx2c4.com/projects/photofloat/" target="_blank">PhotoFloat</a></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="error-overlay"></div>
|
||||||
|
<div id="error-text">Forgot my camera.</div>
|
||||||
|
<div id="auth-text">
|
||||||
|
<form id="auth-form">
|
||||||
|
<input id="password" type="password" />
|
||||||
|
<input type="submit" value="Login" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
129
web/js/011-xwiper.js
Normal file
129
web/js/011-xwiper.js
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
'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 Xwiper = function () {
|
||||||
|
function Xwiper(element) {
|
||||||
|
_classCallCheck(this, Xwiper);
|
||||||
|
|
||||||
|
this.element = null;
|
||||||
|
this.touchStartX = 0;
|
||||||
|
this.touchStartY = 0;
|
||||||
|
this.touchEndX = 0;
|
||||||
|
this.touchEndY = 0;
|
||||||
|
this.sensitive = 50;
|
||||||
|
this.onSwipeLeftAgent = null;
|
||||||
|
this.onSwipeRightAgent = null;
|
||||||
|
this.onSwipeUpAgent = null;
|
||||||
|
this.onSwipeDownAgent = null;
|
||||||
|
this.onTapAgent = null;
|
||||||
|
|
||||||
|
this.onTouchStart = this.onTouchStart.bind(this);
|
||||||
|
this.onTouchEnd = this.onTouchEnd.bind(this);
|
||||||
|
this.onSwipeLeft = this.onSwipeLeft.bind(this);
|
||||||
|
this.onSwipeRight = this.onSwipeRight.bind(this);
|
||||||
|
this.onSwipeUp = this.onSwipeUp.bind(this);
|
||||||
|
this.onSwipeDown = this.onSwipeDown.bind(this);
|
||||||
|
this.onTap = this.onTap.bind(this);
|
||||||
|
this.destroy = this.destroy.bind(this);
|
||||||
|
this.handleGesture = this.handleGesture.bind(this);
|
||||||
|
|
||||||
|
this.element = document.querySelector(element);
|
||||||
|
this.element.addEventListener('touchstart', this.onTouchStart, false);
|
||||||
|
|
||||||
|
this.element.addEventListener('touchend', this.onTouchEnd, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
_createClass(Xwiper, [{
|
||||||
|
key: 'onTouchStart',
|
||||||
|
value: function onTouchStart(event) {
|
||||||
|
this.touchStartX = event.changedTouches[0].screenX;
|
||||||
|
this.touchStartY = event.changedTouches[0].screenY;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'onTouchEnd',
|
||||||
|
value: function onTouchEnd(event) {
|
||||||
|
this.touchEndX = event.changedTouches[0].screenX;
|
||||||
|
this.touchEndY = event.changedTouches[0].screenY;
|
||||||
|
this.handleGesture();
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'onSwipeLeft',
|
||||||
|
value: function onSwipeLeft(func) {
|
||||||
|
this.onSwipeLeftAgent = func;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'onSwipeRight',
|
||||||
|
value: function onSwipeRight(func) {
|
||||||
|
this.onSwipeRightAgent = func;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'onSwipeUp',
|
||||||
|
value: function onSwipeUp(func) {
|
||||||
|
this.onSwipeUpAgent = func;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'onSwipeDown',
|
||||||
|
value: function onSwipeDown(func) {
|
||||||
|
this.onSwipeDownAgent = func;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'onTap',
|
||||||
|
value: function onTap(func) {
|
||||||
|
this.onTapAgent = func;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'destroy',
|
||||||
|
value: function destroy() {
|
||||||
|
this.element.removeEventListener('touchstart', this.onTouchStart);
|
||||||
|
this.element.removeEventListener('touchend', this.onTouchEnd);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'handleGesture',
|
||||||
|
value: function handleGesture() {
|
||||||
|
/**
|
||||||
|
* swiped left
|
||||||
|
*/
|
||||||
|
if (this.touchEndX + this.sensitive <= this.touchStartX) {
|
||||||
|
this.onSwipeLeftAgent && this.onSwipeLeftAgent();
|
||||||
|
return 'swiped left';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* swiped right
|
||||||
|
*/
|
||||||
|
if (this.touchEndX - this.sensitive >= this.touchStartX) {
|
||||||
|
this.onSwipeRightAgent && this.onSwipeRightAgent();
|
||||||
|
return 'swiped right';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* swiped up
|
||||||
|
*/
|
||||||
|
if (this.touchEndY + this.sensitive <= this.touchStartY) {
|
||||||
|
this.onSwipeUpAgent && this.onSwipeUpAgent();
|
||||||
|
return 'swiped up';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* swiped down
|
||||||
|
*/
|
||||||
|
if (this.touchEndY - this.sensitive >= this.touchStartY) {
|
||||||
|
this.onSwipeDownAgent && this.onSwipeDownAgent();
|
||||||
|
return 'swiped down';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tap
|
||||||
|
*/
|
||||||
|
if (this.touchEndY === this.touchStartY) {
|
||||||
|
this.onTapAgent && this.onTapAgent();
|
||||||
|
return 'tap';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]);
|
||||||
|
|
||||||
|
return Xwiper;
|
||||||
|
}();
|
@ -164,9 +164,9 @@ $(document).ready(function() {
|
|||||||
$(window).bind("resize", scaleImage);
|
$(window).bind("resize", scaleImage);
|
||||||
container = $("#photo-view");
|
container = $("#photo-view");
|
||||||
if (image.css("width") !== "100%" && container.height() * image.attr("ratio") > container.width())
|
if (image.css("width") !== "100%" && container.height() * image.attr("ratio") > container.width())
|
||||||
image.css("width", "100%").css("height", "auto").css("position", "absolute").css("bottom", 0);
|
image.css("width", "100%").css("height", "auto");
|
||||||
else if (image.css("height") !== "100%")
|
else if (image.css("height") !== "100%")
|
||||||
image.css("height", "100%").css("width", "auto").css("position", "").css("bottom", "");
|
image.css("height", "100%").css("width", "auto");
|
||||||
}
|
}
|
||||||
function scaleVideo() {
|
function scaleVideo() {
|
||||||
var video, container;
|
var video, container;
|
||||||
@ -318,6 +318,7 @@ $(document).ready(function() {
|
|||||||
photoFloat.parseHash(location.hash, hashParsed, die);
|
photoFloat.parseHash(location.hash, hashParsed, die);
|
||||||
});
|
});
|
||||||
$(window).hashchange();
|
$(window).hashchange();
|
||||||
|
/* Keyboard: Left / Right */
|
||||||
$(document).keydown(function(e){
|
$(document).keydown(function(e){
|
||||||
if (currentPhoto === null)
|
if (currentPhoto === null)
|
||||||
return true;
|
return true;
|
||||||
@ -330,6 +331,7 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
/* Mousewheel */
|
||||||
$(document).mousewheel(function(event, delta) {
|
$(document).mousewheel(function(event, delta) {
|
||||||
if (currentPhoto === null)
|
if (currentPhoto === null)
|
||||||
return true;
|
return true;
|
||||||
@ -342,6 +344,16 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* Swipe */
|
||||||
|
xwiper = new Xwiper('#photo-view');
|
||||||
|
xwiper.onSwipeLeft(function(event){
|
||||||
|
window.location.href = $("#next").attr("href");
|
||||||
|
});
|
||||||
|
xwiper.onSwipeRight(function(event){
|
||||||
|
window.location.href = $("#back").attr("href");
|
||||||
|
});
|
||||||
|
|
||||||
$("#photo-box").mouseenter(function() {
|
$("#photo-box").mouseenter(function() {
|
||||||
$("#photo-links").stop().fadeTo("slow", 0.50).css("display", "inline");
|
$("#photo-links").stop().fadeTo("slow", 0.50).css("display", "inline");
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user