commit
c0c924fc13
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
dist/**/* binary
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Tobias Reich (http://electerious.com/)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
21
README.md
21
README.md
@ -64,29 +64,12 @@ Here's a list of all available Plugins and Extensions:
|
||||
| lychee-watermark | Adds a second watermarked photo when uploading images | [More »](https://github.com/electerious/lychee-watermark) |
|
||||
| lychee-rss | Creates a RSS-Feed out of your photos | [More »](https://github.com/cternes/Lychee-RSS) |
|
||||
| lychee-FlashAir | Import from a Toshiba FlashAir WiFi SD card | [More »](https://github.com/mhp/Lychee-FlashAir) |
|
||||
| lychee-webroot | Controls photos accessibility and keeps Lychee files hidden | [More »](https://github.com/Bramas/lychee-webroot) |
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
Take a look at the [FAQ](docs/FAQ.md) if you have problems. Discovered a bug? Please create an issue here on GitHub!
|
||||
|
||||
## Developer
|
||||
| Version | Name |
|
||||
|:-----------|:------------|
|
||||
| 1.2, 1.3, 2.x, 3.x | [Tobias Reich](http://electerious.com)|
|
||||
| 1.0, 1.1 | [Tobias Reich](http://electerious.com)<br>[Philipp Maurer](http://phinal.net) |
|
||||
|
||||
## Donate
|
||||
|
||||
I am working hard on continuously developing and maintaining Lychee. Please consider making a donation via [Flattr](https://flattr.com/submit/auto?user_id=electerious&url=http%3A%2F%2Flychee.electerious.com&title=Lychee&category=software) or PayPal (from [our site](http://lychee.electerious.com/)) to keep the project going strong and me motivated.
|
||||
|
||||
## License
|
||||
|
||||
(MIT License)
|
||||
|
||||
Copyright (C) 2015 [Tobias Reich](http://electerious.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
I am working hard on continuously developing and maintaining Lychee. Please consider making a donation via [Flattr](https://flattr.com/submit/auto?user_id=electerious&url=http%3A%2F%2Flychee.electerious.com&title=Lychee&category=software) or PayPal (from [our site](http://lychee.electerious.com/)) to keep the project going strong and me motivated.
|
BIN
dist/main.css
vendored
BIN
dist/main.css
vendored
Binary file not shown.
BIN
dist/main.js
vendored
BIN
dist/main.js
vendored
Binary file not shown.
BIN
dist/view.js
vendored
BIN
dist/view.js
vendored
Binary file not shown.
@ -1,3 +1,13 @@
|
||||
## v3.0.9
|
||||
|
||||
Released January 10, 2016
|
||||
|
||||
- `Improved` Disabled dragging for thumbnails
|
||||
- `Improved` Avoided unnecessary devicePixelRatio checks by using srcset for all thumbnails
|
||||
- `Improved` Avoided devicePixelRatio check by using srcset for the imageview image
|
||||
- `Improved` Don't show log and system information when logged out (Thanks @Bramas, #421)
|
||||
- `Fixed` Swipe-gestures on mobile devices
|
||||
|
||||
## v3.0.8
|
||||
|
||||
Released December 20, 2015
|
||||
|
@ -25,7 +25,7 @@ You can also use the [direct download](https://github.com/electerious/Lychee/arc
|
||||
|
||||
### 3. Permissions
|
||||
|
||||
Change the permissions of `uploads/`, `data/` and all their subfolders. Sufficient read/write privileges are reqiured.
|
||||
Change the permissions of `uploads/`, `data/` and all their subfolders. Sufficient read/write privileges are required.
|
||||
|
||||
chmod -R 777 uploads/ data/
|
||||
|
||||
|
@ -69,14 +69,20 @@ class Album extends Module {
|
||||
$album['title'] = $data['title'];
|
||||
$album['public'] = $data['public'];
|
||||
|
||||
# Additional attributes
|
||||
# Only part of $album when available
|
||||
if (isset($data['description'])) $album['description'] = $data['description'];
|
||||
if (isset($data['visible'])) $album['visible'] = $data['visible'];
|
||||
if (isset($data['downloadable'])) $album['downloadable'] = $data['downloadable'];
|
||||
|
||||
# Parse date
|
||||
$album['sysdate'] = date('F Y', $data['sysstamp']);
|
||||
|
||||
# Parse password
|
||||
$album['password'] = ($data['password']=='' ? '0' : '1');
|
||||
|
||||
# Set placeholder for thumbs
|
||||
$album['thumbs'] = array();
|
||||
# Parse thumbs or set default value
|
||||
$album['thumbs'] = (isset($data['thumbs']) ? explode(',', $data['thumbs']) : array());
|
||||
|
||||
return $album;
|
||||
|
||||
@ -112,8 +118,7 @@ class Album extends Module {
|
||||
default: $query = Database::prepare($this->database, "SELECT * FROM ? WHERE id = '?' LIMIT 1", array(LYCHEE_TABLE_ALBUMS, $this->albumIDs));
|
||||
$albums = $this->database->query($query);
|
||||
$return = $albums->fetch_assoc();
|
||||
$return['sysdate'] = date('d M. Y', $return['sysstamp']);
|
||||
$return['password'] = ($return['password']=='' ? '0' : '1');
|
||||
$return = Album::prepareData($return);
|
||||
$query = Database::prepare($this->database, "SELECT id, title, tags, public, star, album, thumbUrl, takestamp, url FROM ? WHERE album = '?' " . $this->settings['sortingPhotos'], array(LYCHEE_TABLE_PHOTOS, $this->albumIDs));
|
||||
break;
|
||||
|
||||
|
@ -103,27 +103,41 @@ else echo $error;
|
||||
echo(PHP_EOL . PHP_EOL . 'System Information' . PHP_EOL);
|
||||
echo('------------------' . PHP_EOL);
|
||||
|
||||
# Load json
|
||||
$json = file_get_contents(LYCHEE_SRC . 'package.json');
|
||||
$json = json_decode($json, true);
|
||||
# Ensure that user is logged in
|
||||
session_start();
|
||||
|
||||
# About imagick
|
||||
$imagick = extension_loaded('imagick');
|
||||
if ($imagick===true) $imagickVersion = @Imagick::getVersion();
|
||||
else $imagick = '-';
|
||||
if (!isset($imagickVersion, $imagickVersion['versionNumber'])||$imagickVersion==='') $imagickVersion = '-';
|
||||
else $imagickVersion = $imagickVersion['versionNumber'];
|
||||
if ((isset($_SESSION['login'])&&$_SESSION['login']===true)&&
|
||||
(isset($_SESSION['identifier'])&&$_SESSION['identifier']===$settings['identifier'])) {
|
||||
|
||||
# Output system information
|
||||
echo('Lychee Version: ' . $json['version'] . PHP_EOL);
|
||||
echo('DB Version: ' . $settings['version'] . PHP_EOL);
|
||||
echo('System: ' . PHP_OS . PHP_EOL);
|
||||
echo('PHP Version: ' . floatval(phpversion()) . PHP_EOL);
|
||||
echo('MySQL Version: ' . $database->server_version . PHP_EOL);
|
||||
echo('Imagick: ' . $imagick . PHP_EOL);
|
||||
echo('Imagick Active: ' . $settings['imagick'] . PHP_EOL);
|
||||
echo('Imagick Version: ' . $imagickVersion . PHP_EOL);
|
||||
echo('GD Version: ' . $gdVersion['GD Version'] . PHP_EOL);
|
||||
echo('Plugins: ' . $settings['plugins'] . PHP_EOL);
|
||||
# Load json
|
||||
$json = file_get_contents(LYCHEE_SRC . 'package.json');
|
||||
$json = json_decode($json, true);
|
||||
|
||||
# About imagick
|
||||
$imagick = extension_loaded('imagick');
|
||||
if ($imagick===true) $imagickVersion = @Imagick::getVersion();
|
||||
else $imagick = '-';
|
||||
if (!isset($imagickVersion, $imagickVersion['versionNumber'])||$imagickVersion==='') $imagickVersion = '-';
|
||||
else $imagickVersion = $imagickVersion['versionNumber'];
|
||||
|
||||
# Output system information
|
||||
echo('Lychee Version: ' . $json['version'] . PHP_EOL);
|
||||
echo('DB Version: ' . $settings['version'] . PHP_EOL);
|
||||
echo('System: ' . PHP_OS . PHP_EOL);
|
||||
echo('PHP Version: ' . floatval(phpversion()) . PHP_EOL);
|
||||
echo('MySQL Version: ' . $database->server_version . PHP_EOL);
|
||||
echo('Imagick: ' . $imagick . PHP_EOL);
|
||||
echo('Imagick Active: ' . $settings['imagick'] . PHP_EOL);
|
||||
echo('Imagick Version: ' . $imagickVersion . PHP_EOL);
|
||||
echo('GD Version: ' . $gdVersion['GD Version'] . PHP_EOL);
|
||||
echo('Plugins: ' . $settings['plugins'] . PHP_EOL);
|
||||
|
||||
} else {
|
||||
|
||||
# Don't go further if the user is not logged in
|
||||
echo('You have to be logged in to see more information.');
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -37,26 +37,44 @@ if (mysqli_connect_errno()!=0) {
|
||||
exit();
|
||||
}
|
||||
|
||||
# Result
|
||||
$query = Database::prepare($database, "SELECT FROM_UNIXTIME(time), type, function, line, text FROM ?", array(LYCHEE_TABLE_LOG));
|
||||
$result = $database->query($query);
|
||||
# Load settings
|
||||
$settings = new Settings($database);
|
||||
$settings = $settings->get();
|
||||
|
||||
# Output
|
||||
if ($result->num_rows===0) {
|
||||
# Ensure that user is logged in
|
||||
session_start();
|
||||
|
||||
echo('Everything looks fine, Lychee has not reported any problems!' . PHP_EOL . PHP_EOL);
|
||||
if ((isset($_SESSION['login'])&&$_SESSION['login']===true)&&
|
||||
(isset($_SESSION['identifier'])&&$_SESSION['identifier']===$settings['identifier'])) {
|
||||
|
||||
# Result
|
||||
$query = Database::prepare($database, "SELECT FROM_UNIXTIME(time), type, function, line, text FROM ?", array(LYCHEE_TABLE_LOG));
|
||||
$result = $database->query($query);
|
||||
|
||||
# Output
|
||||
if ($result->num_rows===0) {
|
||||
|
||||
echo('Everything looks fine, Lychee has not reported any problems!');
|
||||
|
||||
} else {
|
||||
|
||||
while($row = $result->fetch_row()) {
|
||||
|
||||
# Encode result before printing
|
||||
$row = array_map('htmlentities', $row);
|
||||
|
||||
# Format: time TZ - type - function(line) - text
|
||||
printf ("%s - %s - %s (%s) \t- %s\n", $row[0], $row[1], $row[2], $row[3], $row[4]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
while($row = $result->fetch_row()) {
|
||||
|
||||
# Encode result before printing
|
||||
$row = array_map("htmlentities", $row);
|
||||
|
||||
# Format: time TZ - type - function(line) - text
|
||||
printf ("%s %s - %s - %s (%s) \t- %s\n", $row[0], date_default_timezone_get(), $row[1], $row[2], $row[3], $row[4]);
|
||||
|
||||
}
|
||||
# Don't go further if the user is not logged in
|
||||
echo('You have to be logged in to see the log.');
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Lychee",
|
||||
"version": "3.0.8",
|
||||
"version": "3.0.9",
|
||||
"description": "Self-hosted photo-management done right.",
|
||||
"authors": "Tobias Reich <tobias@electerious.com>",
|
||||
"license": "MIT",
|
||||
@ -11,15 +11,15 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-preset-es2015": "^6.3.13",
|
||||
"basiccontext": "^3.5.0",
|
||||
"basicmodal": "^3.3.0",
|
||||
"basiccontext": "^3.5.1",
|
||||
"basicmodal": "^3.3.2",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-autoprefixer": "3.1.0",
|
||||
"gulp-babel": "^6.1.1",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-inject": "^3.0.0",
|
||||
"gulp-load-plugins": "^1.1.0",
|
||||
"gulp-minify-css": "^1.2.2",
|
||||
"gulp-load-plugins": "^1.2.0",
|
||||
"gulp-minify-css": "^1.2.3",
|
||||
"gulp-rimraf": "^0.2.0",
|
||||
"gulp-sass": "^2.1.1",
|
||||
"gulp-uglify": "^1.5.1",
|
||||
|
@ -45,13 +45,13 @@ build.album = function(data) {
|
||||
|
||||
let html = ''
|
||||
|
||||
let { path: thumbPath, hasRetina: thumbRetina } = lychee.retinize(data.thumbs[0])
|
||||
let { path: retinaThumbUrl, isPhoto } = lychee.retinize(data.thumbs[0])
|
||||
|
||||
html += lychee.html`
|
||||
<div class='album' data-id='$${ data.id }'>
|
||||
<img src='$${ data.thumbs[2] }' width='200' height='200' alt='thumb' data-overlay='false'>
|
||||
<img src='$${ data.thumbs[1] }' width='200' height='200' alt='thumb' data-overlay='false'>
|
||||
<img src='$${ thumbPath }' width='200' height='200' alt='thumb' data-overlay='$${ thumbRetina }'>
|
||||
<img src='$${ data.thumbs[2] }' width='200' height='200' alt='Photo thumbnail' data-overlay='false' draggable='false'>
|
||||
<img src='$${ data.thumbs[1] }' width='200' height='200' alt='Photo thumbnail' data-overlay='false' draggable='false'>
|
||||
<img src='$${ data.thumbs[0] }' srcset='$${ retinaThumbUrl } 1.5x' width='200' height='200' alt='Photo thumbnail' data-overlay='$${ isPhoto }' draggable='false'>
|
||||
<div class='overlay'>
|
||||
<h1 title='$${ data.title }'>$${ data.title }</h1>
|
||||
<a>$${ data.sysdate }</a>
|
||||
@ -82,11 +82,11 @@ build.photo = function(data) {
|
||||
|
||||
let html = ''
|
||||
|
||||
let { path: thumbPath, hasRetina: thumbRetina } = lychee.retinize(data.thumbUrl)
|
||||
let { path: retinaThumbUrl } = lychee.retinize(data.thumbUrl)
|
||||
|
||||
html += lychee.html`
|
||||
<div class='photo' data-album-id='$${ data.album }' data-id='$${ data.id }'>
|
||||
<img src='$${ thumbPath }' width='200' height='200' alt='thumb'>
|
||||
<img src='$${ data.thumbUrl }' srcset='$${ retinaThumbUrl } 1.5x' width='200' height='200' alt='Photo thumbnail' draggable='false'>
|
||||
<div class='overlay'>
|
||||
<h1 title='$${ data.title }'>$${ data.title }</h1>
|
||||
`
|
||||
@ -113,24 +113,18 @@ build.photo = function(data) {
|
||||
|
||||
}
|
||||
|
||||
build.imageview = function(data, size, visibleControls) {
|
||||
build.imageview = function(data, visibleControls) {
|
||||
|
||||
let html = ''
|
||||
let html = '',
|
||||
hasMedium = data.medium!==''
|
||||
|
||||
if (size==='big') {
|
||||
if (hasMedium===false) {
|
||||
|
||||
if (visibleControls===true) html += lychee.html`<div id='image' style='background-image: url($${ data.url })'></div>`
|
||||
else html += lychee.html`<div id='image' style='background-image: url($${ data.url });' class='full'></div>`
|
||||
html += lychee.html`<div id='image' class='$${ visibleControls===true ? '' : 'full' }'><div><img src='$${ data.url }' draggable='false'></div></div>`
|
||||
|
||||
} else if (size==='medium') {
|
||||
} else {
|
||||
|
||||
if (visibleControls===true) html += lychee.html`<div id='image' style='background-image: url($${ data.medium })'></div>`
|
||||
else html += lychee.html`<div id='image' style='background-image: url($${ data.medium });' class='full'></div>`
|
||||
|
||||
} else if (size==='small') {
|
||||
|
||||
if (visibleControls===true) html += lychee.html`<div id='image' class='small' style='background-image: url($${ data.url }); width: $${ data.width }px; height: $${ data.height }px; margin-top: -$${ parseInt(data.height/2-20) }px; margin-left: -$${ data.width/2 }px;'></div>`
|
||||
else html += lychee.html`<div id='image' class='small' style='background-image: url($${ data.url }); width: $${ data.width }px; height: $${ data.height }px; margin-top: -$${ parseInt(data.height/2) }px; margin-left: -$${ data.width/2 }px;'></div>`
|
||||
html += lychee.html`<div id='image' class='$${ visibleControls===true ? '' : 'full' }'><div><img src='$${ data.url }' srcset='$${ data.medium } 1920w, $${ data.url } $${ data.width }w' draggable='false'></div></div>`
|
||||
|
||||
}
|
||||
|
||||
|
@ -67,17 +67,11 @@ header.bind = function() {
|
||||
|
||||
header.show = function() {
|
||||
|
||||
let newMargin = (-1 * ($('#imageview #image').height()/2) + 20)
|
||||
|
||||
clearTimeout($(window).data('timeout'))
|
||||
|
||||
lychee.imageview.removeClass('full')
|
||||
header.dom().removeClass('header--hidden')
|
||||
|
||||
// Adjust position or size of photo
|
||||
if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin)
|
||||
else $('#imageview #image').removeClass('full')
|
||||
|
||||
return true
|
||||
|
||||
}
|
||||
@ -90,15 +84,9 @@ header.hide = function(e, delay = 500) {
|
||||
|
||||
$(window).data('timeout', setTimeout(function() {
|
||||
|
||||
let newMargin = (-1 * ($('#imageview #image').height()/2))
|
||||
|
||||
lychee.imageview.addClass('full')
|
||||
header.dom().addClass('header--hidden')
|
||||
|
||||
// Adjust position or size of photo
|
||||
if ($('#imageview #image.small').length>0) $('#imageview #image').css('margin-top', newMargin)
|
||||
else $('#imageview #image').addClass('full')
|
||||
|
||||
}, delay))
|
||||
|
||||
return true
|
||||
|
@ -78,7 +78,7 @@ $(document).ready(function() {
|
||||
$(document)
|
||||
|
||||
// Fullscreen on mobile
|
||||
.on('touchend', '#image', function(e) {
|
||||
.on('touchend', '#imageview #image', function(e) {
|
||||
if (swipe.obj==null || (swipe.offset>=-5&&swipe.offset<=5)) {
|
||||
if (visible.header()) header.hide(e, 0)
|
||||
else header.show()
|
||||
@ -86,7 +86,7 @@ $(document).ready(function() {
|
||||
})
|
||||
|
||||
// Swipe on mobile
|
||||
.swipe().on('swipeStart', function() { if (visible.photo()) swipe.start($('#image')) })
|
||||
.swipe().on('swipeStart', function() { if (visible.photo()) swipe.start($('#imageview #image')) })
|
||||
.swipe().on('swipeMove', function(e) { if (visible.photo()) swipe.move(e.swipe) })
|
||||
.swipe().on('swipeEnd', function(e) { if (visible.photo()) swipe.stop(e.swipe, photo.previous, photo.next) })
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
lychee = {
|
||||
|
||||
title : document.title,
|
||||
version : '3.0.8',
|
||||
version_code : '030008',
|
||||
version : '3.0.9',
|
||||
version_code : '030009',
|
||||
|
||||
update_path : '//update.electerious.com/index.json',
|
||||
updateURL : 'https://github.com/electerious/Lychee',
|
||||
@ -310,11 +310,10 @@ lychee.animate = function(obj, animation) {
|
||||
|
||||
lychee.retinize = function(path = '') {
|
||||
|
||||
let pixelRatio = window.devicePixelRatio,
|
||||
extention = path.split('.').pop(),
|
||||
hasRetina = extention!=='svg'
|
||||
let extention = path.split('.').pop(),
|
||||
isPhoto = extention!=='svg'
|
||||
|
||||
if ((pixelRatio!=null && pixelRatio>1) && hasRetina===true) {
|
||||
if (isPhoto===true) {
|
||||
|
||||
path = path.replace(/\.[^/.]+$/, '')
|
||||
path = path + '@2x' + '.' + extention
|
||||
@ -323,7 +322,7 @@ lychee.retinize = function(path = '') {
|
||||
|
||||
return {
|
||||
path,
|
||||
hasRetina
|
||||
isPhoto
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ photo.previous = function(animate) {
|
||||
|
||||
delay = 200
|
||||
|
||||
$('#image').css({
|
||||
$('#imageview #image').css({
|
||||
WebkitTransform : 'translateX(100%)',
|
||||
MozTransform : 'translateX(100%)',
|
||||
transform : 'translateX(100%)',
|
||||
@ -131,7 +131,7 @@ photo.next = function(animate) {
|
||||
|
||||
delay = 200
|
||||
|
||||
$('#image').css({
|
||||
$('#imageview #image').css({
|
||||
WebkitTransform : 'translateX(-100%)',
|
||||
MozTransform : 'translateX(-100%)',
|
||||
transform : 'translateX(-100%)',
|
||||
@ -625,42 +625,6 @@ photo.share = function(photoID, service) {
|
||||
|
||||
}
|
||||
|
||||
photo.getSize = function() {
|
||||
|
||||
// Size can be 'big', 'medium' or 'small'
|
||||
// Default is big
|
||||
// Small is centered in the middle of the screen
|
||||
let size = 'big',
|
||||
scaled = false,
|
||||
hasMedium = photo.json.medium!=='',
|
||||
pixelRatio = window.devicePixelRatio,
|
||||
view = {
|
||||
width : $(window).width() - 60,
|
||||
height : $(window).height() - 100
|
||||
}
|
||||
|
||||
// Detect if the photo will be shown scaled,
|
||||
// because the screen size is smaller than the photo
|
||||
if (photo.json.width>view.width || photo.json.height>view.height) scaled = true
|
||||
|
||||
// Calculate pixel ratio of screen
|
||||
if (pixelRatio!=null && pixelRatio>1) {
|
||||
view.width = view.width * pixelRatio
|
||||
view.height = view.height * pixelRatio
|
||||
}
|
||||
|
||||
// Medium available and
|
||||
// Medium still bigger than screen
|
||||
if (hasMedium===true && (1920>view.width && 1080>view.height)) size = 'medium'
|
||||
|
||||
// Photo not scaled
|
||||
// Photo smaller then screen
|
||||
if (scaled===false && (photo.json.width<view.width&& photo.json.width<view.height)) size = 'small'
|
||||
|
||||
return size
|
||||
|
||||
}
|
||||
|
||||
photo.getArchive = function(photoID) {
|
||||
|
||||
let link,
|
||||
|
@ -36,14 +36,25 @@ swipe.move = function(e) {
|
||||
|
||||
swipe.stop = function(e, left, right) {
|
||||
|
||||
if (e.x<=-swipe.tolerance) left(true)
|
||||
else if (e.x>=swipe.tolerance) right(true)
|
||||
else if (swipe.obj!==null) {
|
||||
// Only execute once
|
||||
if (swipe.obj==null) return false
|
||||
|
||||
if (e.x<=-swipe.tolerance) {
|
||||
|
||||
left(true)
|
||||
|
||||
} else if (e.x>=swipe.tolerance) {
|
||||
|
||||
right(true)
|
||||
|
||||
} else {
|
||||
|
||||
swipe.obj.css({
|
||||
WebkitTransform : 'translateX(0px)',
|
||||
MozTransform : 'translateX(0px)',
|
||||
transform : 'translateX(0px)'
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
swipe.obj = null
|
||||
|
@ -406,27 +406,28 @@ view.photo = {
|
||||
|
||||
photo: function() {
|
||||
|
||||
lychee.imageview.html(build.imageview(photo.json, photo.getSize(), visible.header()))
|
||||
lychee.imageview.html(build.imageview(photo.json, visible.header()))
|
||||
|
||||
let $nextArrow = lychee.imageview.find('a#next'),
|
||||
$previousArrow = lychee.imageview.find('a#previous'),
|
||||
hasNext = album.json && album.json.content && album.json.content[photo.getID()] && album.json.content[photo.getID()].nextPhoto==='',
|
||||
hasPrevious = album.json && album.json.content && album.json.content[photo.getID()] && album.json.content[photo.getID()].previousPhoto===''
|
||||
photoID = photo.getID(),
|
||||
hasNext = album.json && album.json.content && album.json.content[photoID] && album.json.content[photoID].nextPhoto!=='',
|
||||
hasPrevious = album.json && album.json.content && album.json.content[photoID] && album.json.content[photoID].previousPhoto!==''
|
||||
|
||||
if (hasNext || lychee.viewMode) { $nextArrow.hide() }
|
||||
if (hasNext===false || lychee.viewMode===true) { $nextArrow.hide() }
|
||||
else {
|
||||
|
||||
let nextPhotoID = album.json.content[photo.getID()].nextPhoto,
|
||||
let nextPhotoID = album.json.content[photoID].nextPhoto,
|
||||
nextPhoto = album.json.content[nextPhotoID]
|
||||
|
||||
$nextArrow.css('background-image', lychee.html`linear-gradient(to bottom, rgba(0, 0, 0, .4), rgba(0, 0, 0, .4)), url("$${ nextPhoto.thumbUrl }")`)
|
||||
|
||||
}
|
||||
|
||||
if (hasPrevious || lychee.viewMode) { $previousArrow.hide() }
|
||||
if (hasPrevious===false || lychee.viewMode===true) { $previousArrow.hide() }
|
||||
else {
|
||||
|
||||
let previousPhotoID = album.json.content[photo.getID()].previousPhoto,
|
||||
let previousPhotoID = album.json.content[photoID].previousPhoto,
|
||||
previousPhoto = album.json.content[previousPhotoID]
|
||||
|
||||
$previousArrow.css('background-image', lychee.html`linear-gradient(to bottom, rgba(0, 0, 0, .4), rgba(0, 0, 0, .4)), url("$${ previousPhoto.thumbUrl }")`)
|
||||
|
@ -97,42 +97,6 @@ $(document).ready(function() {
|
||||
|
||||
})
|
||||
|
||||
const getPhotoSize = function(photo) {
|
||||
|
||||
// Size can be 'big', 'medium' or 'small'
|
||||
// Default is big
|
||||
// Small is centered in the middle of the screen
|
||||
let size = 'big',
|
||||
scaled = false,
|
||||
hasMedium = photo.medium!=='',
|
||||
pixelRatio = window.devicePixelRatio,
|
||||
view = {
|
||||
width : $(window).width() - 60,
|
||||
height : $(window).height() - 100
|
||||
}
|
||||
|
||||
// Detect if the photo will be shown scaled,
|
||||
// because the screen size is smaller than the photo
|
||||
if (photo.width>view.width || photo.height>view.height) scaled = true
|
||||
|
||||
// Calculate pixel ratio of screen
|
||||
if (pixelRatio!=null && pixelRatio>1) {
|
||||
view.width = view.width * pixelRatio
|
||||
view.height = view.height * pixelRatio
|
||||
}
|
||||
|
||||
// Medium available and
|
||||
// Medium still bigger than screen
|
||||
if (hasMedium===true && (1920>view.width && 1080>view.height)) size = 'medium'
|
||||
|
||||
// Photo not scaled
|
||||
// Photo smaller then screen
|
||||
if (scaled===false && (photo.width<view.width&& photo.width<view.height)) size = 'small'
|
||||
|
||||
return size
|
||||
|
||||
}
|
||||
|
||||
const loadPhotoInfo = function(photoID) {
|
||||
|
||||
let params = {
|
||||
@ -157,10 +121,8 @@ const loadPhotoInfo = function(photoID) {
|
||||
document.title = 'Lychee - ' + data.title
|
||||
header.dom('.header__title').html(lychee.escapeHTML(data.title))
|
||||
|
||||
let size = getPhotoSize(data)
|
||||
|
||||
// Render HTML
|
||||
imageview.html(build.imageview(data, size, true))
|
||||
imageview.html(build.imageview(data, true))
|
||||
imageview.find('.arrow_wrapper').remove()
|
||||
imageview.addClass('fadeIn').show()
|
||||
|
||||
|
@ -21,30 +21,43 @@
|
||||
right: 30px;
|
||||
bottom: 30px;
|
||||
left: 30px;
|
||||
transition: top .3s, right .3s, bottom .3s, left .3s, margin-top .3s, opacity .2s, transform .3s $timingBounce;
|
||||
transition: top .3s, right .3s, bottom .3s, left .3s, opacity .2s, transform .2s;
|
||||
will-change: transform;
|
||||
|
||||
background-repeat: no-repeat;
|
||||
background-position: 50% 50%;
|
||||
background-size: contain;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
animation-name: zoomIn;
|
||||
animation-duration: .3s;
|
||||
animation-timing-function: $timingBounce;
|
||||
|
||||
&.small {
|
||||
top: 50%;
|
||||
right: auto;
|
||||
bottom: auto;
|
||||
left: 50%;
|
||||
@media (max-width: 640px) {
|
||||
right: 20px;
|
||||
bottom: 20px;
|
||||
left: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
&.full {
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
&.full #image {
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
#image > div {
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
#image img {
|
||||
position: absolute;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: auto;
|
||||
height: auto;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
// Previous/Next Buttons -------------------------------------------------------------- //
|
||||
@ -58,6 +71,10 @@
|
||||
|
||||
&--next { right: 0; }
|
||||
|
||||
@media (max-width: 640px) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
a {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
|
@ -1,7 +0,0 @@
|
||||
@media only screen and (max-width: 640px) {
|
||||
|
||||
#imageview .arrow_wrapper {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
}
|
@ -77,5 +77,4 @@ input {
|
||||
@import 'sidebar';
|
||||
@import 'loading';
|
||||
@import 'message';
|
||||
@import 'multiselect';
|
||||
@import 'mediaquery';
|
||||
@import 'multiselect';
|
Loading…
Reference in New Issue
Block a user