Fixed view.php #384
This commit is contained in:
parent
26f8dda2cc
commit
21a6fc111b
BIN
dist/main.js
vendored
BIN
dist/main.js
vendored
Binary file not shown.
BIN
dist/view.js
vendored
Executable file → Normal file
BIN
dist/view.js
vendored
Executable file → Normal file
Binary file not shown.
@ -3,15 +3,25 @@
|
|||||||
* @copyright 2015 by Tobias Reich
|
* @copyright 2015 by Tobias Reich
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let lychee = { content: $('#content') },
|
let lychee = {
|
||||||
loadingBar = { show() {}, hide() {} }
|
content: $('#content'),
|
||||||
|
getEventName() {
|
||||||
|
|
||||||
|
let touchendSupport = (/Android|iPhone|iPad|iPod/i).test(navigator.userAgent || navigator.vendor || window.opera) && ('ontouchend' in document.documentElement),
|
||||||
|
eventName = (touchendSupport===true ? 'touchend' : 'click')
|
||||||
|
|
||||||
|
return eventName
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let loadingBar = { show() {}, hide() {} },
|
||||||
imageview = $('#imageview')
|
imageview = $('#imageview')
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
// Event Name
|
// Event Name
|
||||||
let touchendSupport = (/Android|iPhone|iPad|iPod/i).test(navigator.userAgent || navigator.vendor || window.opera) && ('ontouchend' in document.documentElement),
|
let eventName = lychee.getEventName()
|
||||||
eventName = (touchendSupport===true ? 'touchend' : 'click')
|
|
||||||
|
|
||||||
// Set API error handler
|
// Set API error handler
|
||||||
api.onError = error
|
api.onError = error
|
||||||
@ -41,13 +51,13 @@ const getPhotoSize = function(photo) {
|
|||||||
hasMedium = photo.medium!=='',
|
hasMedium = photo.medium!=='',
|
||||||
pixelRatio = window.devicePixelRatio,
|
pixelRatio = window.devicePixelRatio,
|
||||||
view = {
|
view = {
|
||||||
width: $(window).width() - 60,
|
width : $(window).width() - 60,
|
||||||
height: $(window).height() - 100
|
height : $(window).height() - 100
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect if the photo will be shown scaled,
|
// Detect if the photo will be shown scaled,
|
||||||
// because the screen size is smaller than the photo
|
// because the screen size is smaller than the photo
|
||||||
if (photo.json.width>view.width || photo.json.height>view.height) scaled = true
|
if (photo.width>view.width || photo.height>view.height) scaled = true
|
||||||
|
|
||||||
// Calculate pixel ratio of screen
|
// Calculate pixel ratio of screen
|
||||||
if (pixelRatio!=null && pixelRatio>1) {
|
if (pixelRatio!=null && pixelRatio>1) {
|
||||||
@ -61,7 +71,7 @@ const getPhotoSize = function(photo) {
|
|||||||
|
|
||||||
// Photo not scaled
|
// Photo not scaled
|
||||||
// Photo smaller then screen
|
// Photo smaller then screen
|
||||||
if (scaled===false && (photo.json.width<view.width&& photo.json.width<view.height)) size = 'small'
|
if (scaled===false && (photo.width<view.width&& photo.width<view.height)) size = 'small'
|
||||||
|
|
||||||
return size
|
return size
|
||||||
|
|
||||||
@ -71,8 +81,8 @@ const loadPhotoInfo = function(photoID) {
|
|||||||
|
|
||||||
let params = {
|
let params = {
|
||||||
photoID,
|
photoID,
|
||||||
albumID: 0,
|
albumID : 0,
|
||||||
password: ''
|
password : ''
|
||||||
}
|
}
|
||||||
|
|
||||||
api.post('Photo::get', params, function(data) {
|
api.post('Photo::get', params, function(data) {
|
||||||
|
Loading…
Reference in New Issue
Block a user