Skip to content
This repository was archived by the owner on Dec 25, 2023. It is now read-only.

Commit aa5bb70

Browse files
authored
Misc fixes (#311)
* Fix photo.toggleStar to update the parent album * Hide the rotation buttons for non-editable albums
1 parent 142b71b commit aa5bb70

File tree

3 files changed

+31
-27
lines changed

3 files changed

+31
-27
lines changed

scripts/main/header.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,11 @@ header.setMode = function (mode) {
482482
}
483483

484484
if (album.isUploadable()) {
485-
const e = $("#button_trash, #button_move, #button_visibility, #button_star");
485+
const e = $("#button_trash, #button_move, #button_visibility, #button_star, #button_rotate_cwise, #button_rotate_ccwise");
486486
e.show();
487487
tabindex.makeFocusable(e);
488488
} else {
489-
const e = $("#button_trash, #button_move, #button_visibility, #button_star");
489+
const e = $("#button_trash, #button_move, #button_visibility, #button_star, #button_rotate_cwise, #button_rotate_ccwise");
490490
e.hide();
491491
tabindex.makeUnfocusable(e);
492492
}

scripts/main/photo.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ photo.load = function (photoID, albumID, autoplay) {
4242
// TODO: Why do we overwrite the true album ID of a photo, by the externally provided one? I guess we need it, because the album which the user came from might also be a smart album or a tag album. However, in this case I would prefer to leave the `album_id untouched (don't rename it to `original_album_id`) and call this one `effective_album_id` instead.
4343
photo.json.album_id = albumID;
4444

45-
if (!visible.photo()) view.photo.show();
45+
view.photo.show();
4646
view.photo.init(autoplay);
4747
lychee.imageview.show();
4848

@@ -521,6 +521,10 @@ photo.setAlbum = function (photoIDs, albumID) {
521521
photo.toggleStar = function () {
522522
photo.json.is_starred = !photo.json.is_starred;
523523
view.photo.star();
524+
525+
album.getByID(photo.json.id).is_starred = photo.json.is_starred;
526+
view.album.content.star(photo.json.id);
527+
524528
albums.refresh();
525529

526530
api.post("Photo::setStar", {

scripts/main/view.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -707,31 +707,33 @@ view.photo = {
707707
lychee.content.addClass("view");
708708
header.setMode("photo");
709709

710-
// Make body not scrollable
711-
// use bodyScrollLock package to enable locking on iOS
712-
// Simple overflow: hidden not working on iOS Safari
713-
// Only the info pane needs scrolling
714-
// Touch event for swiping of photo still work
715-
716-
scrollLock.disablePageScroll($(".sidebar__wrapper").get());
717-
718-
// Fullscreen
719-
let timeout = null;
720-
$(document).bind("mousemove", function () {
721-
clearTimeout(timeout);
722-
// For live Photos: header animation only if LivePhoto is not playing
723-
if (!photo.isLivePhotoPlaying() && lychee.header_auto_hide) {
724-
header.show();
725-
timeout = setTimeout(header.hideIfLivePhotoNotPlaying, 2500);
710+
if (!visible.photo()) {
711+
// Make body not scrollable
712+
// use bodyScrollLock package to enable locking on iOS
713+
// Simple overflow: hidden not working on iOS Safari
714+
// Only the info pane needs scrolling
715+
// Touch event for swiping of photo still work
716+
717+
scrollLock.disablePageScroll($(".sidebar__wrapper").get());
718+
719+
// Fullscreen
720+
let timeout = null;
721+
$(document).bind("mousemove", function () {
722+
clearTimeout(timeout);
723+
// For live Photos: header animation only if LivePhoto is not playing
724+
if (!photo.isLivePhotoPlaying() && lychee.header_auto_hide) {
725+
header.show();
726+
timeout = setTimeout(header.hideIfLivePhotoNotPlaying, 2500);
727+
}
728+
});
729+
730+
// we also put this timeout to enable it by default when you directly click on a picture.
731+
if (lychee.header_auto_hide) {
732+
setTimeout(header.hideIfLivePhotoNotPlaying, 2500);
726733
}
727-
});
728734

729-
// we also put this timeout to enable it by default when you directly click on a picture.
730-
if (lychee.header_auto_hide) {
731-
setTimeout(header.hideIfLivePhotoNotPlaying, 2500);
735+
lychee.animate(lychee.imageview, "fadeIn");
732736
}
733-
734-
lychee.animate(lychee.imageview, "fadeIn");
735737
},
736738

737739
/**
@@ -970,8 +972,6 @@ view.photo = {
970972
(photo.json.live_photo_url !== "" && photo.json.live_photo_url !== null)
971973
) {
972974
$("#button_rotate_cwise, #button_rotate_ccwise").hide();
973-
} else {
974-
$("#button_rotate_cwise, #button_rotate_ccwise").show();
975975
}
976976
},
977977

0 commit comments

Comments
 (0)