Add Image Size.
Conflicts: CHANGELOG.md src/General/Build.coffee src/General/Config.coffee src/General/Index.coffee src/General/css/style.css
This commit is contained in:
parent
5ca2cbc46f
commit
73a5bcfdee
@ -316,9 +316,6 @@ Build =
|
|||||||
imgClass = 'deleted-file'
|
imgClass = 'deleted-file'
|
||||||
else if thread.OP.file
|
else if thread.OP.file
|
||||||
src = thread.OP.file.thumbURL
|
src = thread.OP.file.thumbURL
|
||||||
max = Math.max data.tn_w, data.tn_h
|
|
||||||
imgWidth = data.tn_w * 150 / max
|
|
||||||
imgHeight = data.tn_h * 150 / max
|
|
||||||
else
|
else
|
||||||
src = "#{staticPath}nofile.png"
|
src = "#{staticPath}nofile.png"
|
||||||
imgClass = 'no-file'
|
imgClass = 'no-file'
|
||||||
@ -326,7 +323,7 @@ Build =
|
|||||||
thumb = if imgClass
|
thumb = if imgClass
|
||||||
<%= html('<img src="${src}" class="catalog-thumb ${imgClass}">') %>
|
<%= html('<img src="${src}" class="catalog-thumb ${imgClass}">') %>
|
||||||
else
|
else
|
||||||
<%= html('<img src="${src}" class="catalog-thumb" width="${imgWidth}" height="${imgHeight}">') %>
|
<%= html('<img src="${src}" class="catalog-thumb" data-width="${data.tn_w}" data-height="${data.tn_h}">') %>
|
||||||
|
|
||||||
postCount = data.replies + 1
|
postCount = data.replies + 1
|
||||||
fileCount = data.images + !!data.ext
|
fileCount = data.images + !!data.ext
|
||||||
|
|||||||
@ -571,6 +571,7 @@ http://iqdb.org/?url=%TURL
|
|||||||
'Index Mode': 'paged'
|
'Index Mode': 'paged'
|
||||||
'Previous Index Mode': 'paged'
|
'Previous Index Mode': 'paged'
|
||||||
'Index Sort': 'bump'
|
'Index Sort': 'bump'
|
||||||
|
'Index Size': 'small'
|
||||||
'Show Replies': true
|
'Show Replies': true
|
||||||
'Anchor Hidden Threads': true
|
'Anchor Hidden Threads': true
|
||||||
'Refreshed Navigation': false
|
'Refreshed Navigation': false
|
||||||
|
|||||||
@ -63,6 +63,7 @@ Index =
|
|||||||
|
|
||||||
$.addClass doc, 'index-loading', "#{Conf['Index Mode'].replace /\ /g, '-'}-mode"
|
$.addClass doc, 'index-loading', "#{Conf['Index Mode'].replace /\ /g, '-'}-mode"
|
||||||
@root = $.el 'div', className: 'board'
|
@root = $.el 'div', className: 'board'
|
||||||
|
@cb.size()
|
||||||
@pagelist = $.el 'div', className: 'pagelist'
|
@pagelist = $.el 'div', className: 'pagelist'
|
||||||
$.extend @pagelist, <%= importHTML('Features/Index-pagelist') %>
|
$.extend @pagelist, <%= importHTML('Features/Index-pagelist') %>
|
||||||
$('.cataloglink a', @pagelist).href = CatalogLinks.catalog()
|
$('.cataloglink a', @pagelist).href = CatalogLinks.catalog()
|
||||||
@ -73,6 +74,7 @@ Index =
|
|||||||
@searchInput = $ '#index-search', @navLinks
|
@searchInput = $ '#index-search', @navLinks
|
||||||
@hideLabel = $ '#hidden-label', @navLinks
|
@hideLabel = $ '#hidden-label', @navLinks
|
||||||
@selectSort = $ '#index-sort', @navLinks
|
@selectSort = $ '#index-sort', @navLinks
|
||||||
|
@selectSize = $ '#index-size', @navLinks
|
||||||
@currentPage = @getCurrentPage()
|
@currentPage = @getCurrentPage()
|
||||||
$.on window, 'popstate', @cb.popstate
|
$.on window, 'popstate', @cb.popstate
|
||||||
|
|
||||||
@ -82,9 +84,11 @@ Index =
|
|||||||
$.on $('#index-search-clear', @navLinks), 'click', @clearSearch
|
$.on $('#index-search-clear', @navLinks), 'click', @clearSearch
|
||||||
$.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads
|
$.on $('#hidden-toggle a', @navLinks), 'click', @cb.toggleHiddenThreads
|
||||||
$.on $('.returnlink a', @navLinks), 'click', @cb.frontPage unless Conf['Use 4chan X Catalog']
|
$.on $('.returnlink a', @navLinks), 'click', @cb.frontPage unless Conf['Use 4chan X Catalog']
|
||||||
@selectSort.value = Conf[@selectSort.name]
|
for select in [@selectSort, @selectSize]
|
||||||
$.on @selectSort, 'change', $.cb.value
|
select.value = Conf[select.name]
|
||||||
|
$.on select, 'change', $.cb.value
|
||||||
$.on @selectSort, 'change', @cb.sort
|
$.on @selectSort, 'change', @cb.sort
|
||||||
|
$.on @selectSize, 'change', @cb.size
|
||||||
|
|
||||||
@update()
|
@update()
|
||||||
$.asap (-> $('.board > .thread > .postContainer', doc) or d.readyState isnt 'loading'), ->
|
$.asap (-> $('.board > .thread > .postContainer', doc) or d.readyState isnt 'loading'), ->
|
||||||
@ -200,6 +204,17 @@ Index =
|
|||||||
sort: ->
|
sort: ->
|
||||||
Index.sort()
|
Index.sort()
|
||||||
Index.buildIndex()
|
Index.buildIndex()
|
||||||
|
size: (e) ->
|
||||||
|
if Conf['Index Mode'] isnt 'catalog'
|
||||||
|
$.rmClass Index.root, 'catalog-small'
|
||||||
|
$.rmClass Index.root, 'catalog-large'
|
||||||
|
else if Conf['Index Size'] is 'small'
|
||||||
|
$.addClass Index.root, 'catalog-small'
|
||||||
|
$.rmClass Index.root, 'catalog-large'
|
||||||
|
else
|
||||||
|
$.addClass Index.root, 'catalog-large'
|
||||||
|
$.rmClass Index.root, 'catalog-small'
|
||||||
|
Index.buildIndex() if e
|
||||||
replies: ->
|
replies: ->
|
||||||
Index.buildThreads()
|
Index.buildThreads()
|
||||||
Index.sort()
|
Index.sort()
|
||||||
@ -287,6 +302,7 @@ Index =
|
|||||||
applyMode: ->
|
applyMode: ->
|
||||||
for mode in ['paged', 'infinite', 'all pages', 'catalog']
|
for mode in ['paged', 'infinite', 'all pages', 'catalog']
|
||||||
$[if mode is Conf['Index Mode'] then 'addClass' else 'rmClass'] doc, "#{mode.replace /\ /g, '-'}-mode"
|
$[if mode is Conf['Index Mode'] then 'addClass' else 'rmClass'] doc, "#{mode.replace /\ /g, '-'}-mode"
|
||||||
|
Index.cb.size()
|
||||||
Index.showHiddenThreads = false
|
Index.showHiddenThreads = false
|
||||||
$('#hidden-toggle a', Index.navLinks).textContent = 'Show'
|
$('#hidden-toggle a', Index.navLinks).textContent = 'Show'
|
||||||
|
|
||||||
@ -501,6 +517,18 @@ Index =
|
|||||||
Main.callbackNodes CatalogThread, catalogThreads
|
Main.callbackNodes CatalogThread, catalogThreads
|
||||||
threads.map (thread) -> thread.catalogView.nodes.root
|
threads.map (thread) -> thread.catalogView.nodes.root
|
||||||
|
|
||||||
|
sizeCatalogViews: (nodes) ->
|
||||||
|
# XXX When browsers support CSS3 attr(), use it instead.
|
||||||
|
size = if Conf['Index Size'] is 'small' then 150 else 250
|
||||||
|
for node in nodes
|
||||||
|
thumb = $ '.catalog-thumb', node
|
||||||
|
{width, height} = thumb.dataset
|
||||||
|
continue unless width
|
||||||
|
ratio = size / Math.max width, height
|
||||||
|
thumb.style.width = width * ratio + 'px'
|
||||||
|
thumb.style.height = height * ratio + 'px'
|
||||||
|
return
|
||||||
|
|
||||||
sort: ->
|
sort: ->
|
||||||
{liveThreadIDs, liveThreadData} = Index
|
{liveThreadIDs, liveThreadData} = Index
|
||||||
sortedThreadIDs = {
|
sortedThreadIDs = {
|
||||||
@ -541,6 +569,7 @@ Index =
|
|||||||
nodes = Index.sortedNodes
|
nodes = Index.sortedNodes
|
||||||
when 'catalog'
|
when 'catalog'
|
||||||
nodes = Index.buildCatalogViews()
|
nodes = Index.buildCatalogViews()
|
||||||
|
Index.sizeCatalogViews nodes
|
||||||
else
|
else
|
||||||
nodes = Index.buildSinglePage Index.getCurrentPage()
|
nodes = Index.buildSinglePage Index.getCurrentPage()
|
||||||
$.rmAll Index.root
|
$.rmAll Index.root
|
||||||
|
|||||||
@ -516,7 +516,7 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) {
|
|||||||
#index-search:not([data-searching]) + #index-search-clear {
|
#index-search:not([data-searching]) + #index-search-clear {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#index-sort {
|
#index-sort, #index-size {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
.summary {
|
.summary {
|
||||||
@ -535,9 +535,7 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
-webkit-align-items: center;
|
-webkit-align-items: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 165px;
|
|
||||||
margin: 0 2px 5px;
|
margin: 0 2px 5px;
|
||||||
max-height: 320px;
|
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
@ -546,16 +544,18 @@ hr + div.center:not(.ad-cnt):not(.topad):not(.middlead):not(.bottomad) {
|
|||||||
-webkit-flex-shrink: 0;
|
-webkit-flex-shrink: 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
.catalog-small .catalog-thread {
|
||||||
|
width: 165px;
|
||||||
|
max-height: 320px;
|
||||||
|
}
|
||||||
|
.catalog-large .catalog-thread {
|
||||||
|
width: 270px;
|
||||||
|
max-height: 410px;
|
||||||
|
}
|
||||||
.catalog-thumb {
|
.catalog-thumb {
|
||||||
max-width: 150px;
|
|
||||||
max-height: 150px;
|
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
box-shadow: 0 0 5px rgba(0, 0, 0, .25);
|
box-shadow: 0 0 5px rgba(0, 0, 0, .25);
|
||||||
}
|
}
|
||||||
.catalog-thumb:not(.deleted-file):not(.no-file) {
|
|
||||||
min-width: 30px;
|
|
||||||
min-height: 30px;
|
|
||||||
}
|
|
||||||
.catalog-thumb.spoiler-file {
|
.catalog-thumb.spoiler-file {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
|
|||||||
@ -13,3 +13,8 @@
|
|||||||
<option value="replycount">Reply count</option>
|
<option value="replycount">Reply count</option>
|
||||||
<option value="filecount">File count</option>
|
<option value="filecount">File count</option>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="index-size" name="Index Size">
|
||||||
|
<option disabled>Image Size</option>
|
||||||
|
<option value="small">Small</option>
|
||||||
|
<option value="large">Large</option>
|
||||||
|
</select>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user