Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Gallery option to display image dimensions #3391

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions src/Images/Gallery.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ Gallery =
$.extend dialog, `<%= readHTML('Gallery.html') %>`

nodes[key] = $ value, dialog for key, value of {
buttons: '.gal-buttons'
frame: '.gal-image'
name: '.gal-name'
count: '.count'
total: '.total'
sauce: '.gal-sauce'
thumbs: '.gal-thumbnails'
next: '.gal-image a'
current: '.gal-image img'
buttons: '.gal-buttons'
frame: '.gal-image'
name: '.gal-name'
dimensions: '.gal-dimensions'
count: '.count'
total: '.total'
sauce: '.gal-sauce'
thumbs: '.gal-thumbnails'
next: '.gal-image a'
current: '.gal-image img'
}

menuButton = $ '.menu-button', dialog
Expand Down Expand Up @@ -179,6 +180,10 @@ Gallery =
nodes.frame.scrollTop = 0
nodes.next.focus()

if Conf['Image Resolution'] and (post = g.posts.get(file.dataset.post)) and post.file.dimensions
[w, h] = post.file.dimensions.split('x')
nodes.dimensions.innerText = "#{w} x #{h} px"

# Set sauce links
$.rmAll nodes.sauce
if Conf['Sauce'] and Sauce.links and (post = g.posts.get(file.dataset.post))
Expand Down
1 change: 1 addition & 0 deletions src/Images/Gallery/Gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<span class="count"></span> / <span class="total"></span>
</span>
<a class="gal-name" target="_blank"></a>
<span class="gal-dimensions"></span>
<span class="gal-sauce"></span>
</div>
<div class="gal-prev"></div>
Expand Down
5 changes: 5 additions & 0 deletions src/config/Config.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ Config =
'Show PDF files in gallery.'
1
]
'Image Resolution': [
false
'Shows the dimensions of the image you\'re viewing in the gallery.'
1
]
'Sauce': [
true
'Add sauce links to images.'
Expand Down
4 changes: 4 additions & 0 deletions src/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2418,6 +2418,7 @@ a:only-of-type > .remove {
display: none;
}
.gal-name,
.gal-dimensions,
.gal-count,
.gal-sauce {
background: rgba(0,0,0,0.6) !important;
Expand All @@ -2435,6 +2436,9 @@ a:only-of-type > .remove {
.gal-sauce a:hover {
color: rgb(95, 95, 101) !important;
}
.gal-dimensions:empty {
display: none;
}
:root.gal-pdf .gal-buttons a:hover {
color: rgb(204, 204, 204) !important;
}
Expand Down