Merge branch 'v3'
Conflicts: LICENSE builds/appchan-x.user.js builds/crx/script.js
This commit is contained in:
commit
7aafc89cb8
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* appchan x - Version 2.9.7 - 2014-03-20
|
* appchan x - Version 2.9.7 - 2014-03-21
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* appchan x - Version 2.9.7 - 2014-03-20
|
* appchan x - Version 2.9.7 - 2014-03-21
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
||||||
@ -5497,37 +5497,32 @@
|
|||||||
return Post.callbacks.execute(posts);
|
return Post.callbacks.execute(posts);
|
||||||
},
|
},
|
||||||
buildCatalogViews: function() {
|
buildCatalogViews: function() {
|
||||||
var catalogThreads, i, nodes, thread, _i, _len, _ref;
|
var catalogThreads, i, nodes, root, size, thread;
|
||||||
catalogThreads = [];
|
catalogThreads = [];
|
||||||
_ref = Index.sortedThreads;
|
nodes = [];
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
i = 0;
|
||||||
thread = _ref[_i];
|
size = Conf['Index Size'] === 'small' ? 150 : 250;
|
||||||
|
while (thread = Index.sortedThreads[i++]) {
|
||||||
if (!thread.catalogView) {
|
if (!thread.catalogView) {
|
||||||
catalogThreads.push(new CatalogThread(Build.catalogThread(thread), thread));
|
catalogThreads.push(new CatalogThread(Build.catalogThread(thread), thread));
|
||||||
}
|
}
|
||||||
|
root = thread.catalogView.nodes.root;
|
||||||
|
Index.sizeSingleCatalogNode(root, size);
|
||||||
|
nodes.push(root);
|
||||||
}
|
}
|
||||||
CatalogThread.callbacks.execute(catalogThreads);
|
CatalogThread.callbacks.execute(catalogThreads);
|
||||||
nodes = [];
|
|
||||||
i = 0;
|
|
||||||
while (thread = Index.sortedThreads[i++]) {
|
|
||||||
nodes.push(thread.catalogView.nodes.root);
|
|
||||||
}
|
|
||||||
return nodes;
|
return nodes;
|
||||||
},
|
},
|
||||||
sizeCatalogViews: function(nodes) {
|
sizeSingleCatalogNode: function(node, size) {
|
||||||
var height, node, ratio, size, thumb, width, _i, _len, _ref;
|
var height, ratio, thumb, width, _ref;
|
||||||
size = Conf['Index Size'] === 'small' ? 150 : 250;
|
thumb = node.firstElementChild;
|
||||||
for (_i = 0, _len = nodes.length; _i < _len; _i++) {
|
_ref = thumb.dataset, width = _ref.width, height = _ref.height;
|
||||||
node = nodes[_i];
|
if (!width) {
|
||||||
thumb = node.firstElementChild;
|
return;
|
||||||
_ref = thumb.dataset, width = _ref.width, height = _ref.height;
|
|
||||||
if (!width) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ratio = size / Math.max(width, height);
|
|
||||||
thumb.style.width = width * ratio + 'px';
|
|
||||||
thumb.style.height = height * ratio + 'px';
|
|
||||||
}
|
}
|
||||||
|
ratio = size / Math.max(width, height);
|
||||||
|
thumb.style.width = width * ratio + 'px';
|
||||||
|
return thumb.style.height = height * ratio + 'px';
|
||||||
},
|
},
|
||||||
sort: function() {
|
sort: function() {
|
||||||
var i, liveData, sortedThreadIDs, sortedThreads, thread, threadID;
|
var i, liveData, sortedThreadIDs, sortedThreads, thread, threadID;
|
||||||
@ -5646,7 +5641,6 @@
|
|||||||
break;
|
break;
|
||||||
case 'catalog':
|
case 'catalog':
|
||||||
nodes = Index.buildCatalogViews();
|
nodes = Index.buildCatalogViews();
|
||||||
Index.sizeCatalogViews(nodes);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
nodes = [];
|
nodes = [];
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// Generated by CoffeeScript
|
// Generated by CoffeeScript
|
||||||
/*
|
/*
|
||||||
* appchan x - Version 2.9.7 - 2014-03-20
|
* appchan x - Version 2.9.7 - 2014-03-21
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
||||||
@ -5555,37 +5555,32 @@
|
|||||||
return Post.callbacks.execute(posts);
|
return Post.callbacks.execute(posts);
|
||||||
},
|
},
|
||||||
buildCatalogViews: function() {
|
buildCatalogViews: function() {
|
||||||
var catalogThreads, i, nodes, thread, _i, _len, _ref;
|
var catalogThreads, i, nodes, root, size, thread;
|
||||||
catalogThreads = [];
|
catalogThreads = [];
|
||||||
_ref = Index.sortedThreads;
|
nodes = [];
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
i = 0;
|
||||||
thread = _ref[_i];
|
size = Conf['Index Size'] === 'small' ? 150 : 250;
|
||||||
|
while (thread = Index.sortedThreads[i++]) {
|
||||||
if (!thread.catalogView) {
|
if (!thread.catalogView) {
|
||||||
catalogThreads.push(new CatalogThread(Build.catalogThread(thread), thread));
|
catalogThreads.push(new CatalogThread(Build.catalogThread(thread), thread));
|
||||||
}
|
}
|
||||||
|
root = thread.catalogView.nodes.root;
|
||||||
|
Index.sizeSingleCatalogNode(root, size);
|
||||||
|
nodes.push(root);
|
||||||
}
|
}
|
||||||
CatalogThread.callbacks.execute(catalogThreads);
|
CatalogThread.callbacks.execute(catalogThreads);
|
||||||
nodes = [];
|
|
||||||
i = 0;
|
|
||||||
while (thread = Index.sortedThreads[i++]) {
|
|
||||||
nodes.push(thread.catalogView.nodes.root);
|
|
||||||
}
|
|
||||||
return nodes;
|
return nodes;
|
||||||
},
|
},
|
||||||
sizeCatalogViews: function(nodes) {
|
sizeSingleCatalogNode: function(node, size) {
|
||||||
var height, node, ratio, size, thumb, width, _i, _len, _ref;
|
var height, ratio, thumb, width, _ref;
|
||||||
size = Conf['Index Size'] === 'small' ? 150 : 250;
|
thumb = node.firstElementChild;
|
||||||
for (_i = 0, _len = nodes.length; _i < _len; _i++) {
|
_ref = thumb.dataset, width = _ref.width, height = _ref.height;
|
||||||
node = nodes[_i];
|
if (!width) {
|
||||||
thumb = node.firstElementChild;
|
return;
|
||||||
_ref = thumb.dataset, width = _ref.width, height = _ref.height;
|
|
||||||
if (!width) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ratio = size / Math.max(width, height);
|
|
||||||
thumb.style.width = width * ratio + 'px';
|
|
||||||
thumb.style.height = height * ratio + 'px';
|
|
||||||
}
|
}
|
||||||
|
ratio = size / Math.max(width, height);
|
||||||
|
thumb.style.width = width * ratio + 'px';
|
||||||
|
return thumb.style.height = height * ratio + 'px';
|
||||||
},
|
},
|
||||||
sort: function() {
|
sort: function() {
|
||||||
var i, liveData, sortedThreadIDs, sortedThreads, thread, threadID;
|
var i, liveData, sortedThreadIDs, sortedThreads, thread, threadID;
|
||||||
@ -5704,7 +5699,6 @@
|
|||||||
break;
|
break;
|
||||||
case 'catalog':
|
case 'catalog':
|
||||||
nodes = Index.buildCatalogViews();
|
nodes = Index.buildCatalogViews();
|
||||||
Index.sizeCatalogViews(nodes);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
nodes = [];
|
nodes = [];
|
||||||
|
|||||||
@ -128,7 +128,7 @@ Index =
|
|||||||
id: 'catalogIcon'
|
id: 'catalogIcon'
|
||||||
className: 'a-icon'
|
className: 'a-icon'
|
||||||
href: "//boards.4chan.org/#{g.BOARD.ID}/"
|
href: "//boards.4chan.org/#{g.BOARD.ID}/"
|
||||||
|
|
||||||
@catalogLink.dataset.indexMode = 'catalog'
|
@catalogLink.dataset.indexMode = 'catalog'
|
||||||
|
|
||||||
$.on returnLink, 'click', (e) ->
|
$.on returnLink, 'click', (e) ->
|
||||||
@ -139,7 +139,7 @@ Index =
|
|||||||
Navigate.navigate.call @, e
|
Navigate.navigate.call @, e
|
||||||
|
|
||||||
$.on @catalogLink, 'click', Navigate.navigate
|
$.on @catalogLink, 'click', Navigate.navigate
|
||||||
|
|
||||||
Header.addShortcut @catalogLink, true
|
Header.addShortcut @catalogLink, true
|
||||||
Header.addShortcut returnLink, true
|
Header.addShortcut returnLink, true
|
||||||
|
|
||||||
@ -518,7 +518,7 @@ Index =
|
|||||||
delete Index.pageNum
|
delete Index.pageNum
|
||||||
Index.req?.abort()
|
Index.req?.abort()
|
||||||
Index.notice?.close()
|
Index.notice?.close()
|
||||||
|
|
||||||
{sortedThreads} = Index
|
{sortedThreads} = Index
|
||||||
if sortedThreads
|
if sortedThreads
|
||||||
board = sortedThreads[0].board.ID
|
board = sortedThreads[0].board.ID
|
||||||
@ -673,26 +673,25 @@ Index =
|
|||||||
|
|
||||||
buildCatalogViews: ->
|
buildCatalogViews: ->
|
||||||
catalogThreads = []
|
catalogThreads = []
|
||||||
for thread in Index.sortedThreads when !thread.catalogView
|
|
||||||
catalogThreads.push new CatalogThread Build.catalogThread(thread), thread
|
|
||||||
CatalogThread.callbacks.execute catalogThreads
|
|
||||||
nodes = []
|
nodes = []
|
||||||
i = 0
|
i = 0
|
||||||
|
size = if Conf['Index Size'] is 'small' then 150 else 250
|
||||||
while thread = Index.sortedThreads[i++]
|
while thread = Index.sortedThreads[i++]
|
||||||
nodes.push thread.catalogView.nodes.root
|
if !thread.catalogView
|
||||||
|
catalogThreads.push new CatalogThread Build.catalogThread(thread), thread
|
||||||
|
{root} = thread.catalogView.nodes
|
||||||
|
Index.sizeSingleCatalogNode root, size
|
||||||
|
nodes.push root
|
||||||
|
CatalogThread.callbacks.execute catalogThreads
|
||||||
return nodes
|
return nodes
|
||||||
|
|
||||||
sizeCatalogViews: (nodes) ->
|
sizeSingleCatalogNode: (node, size) ->
|
||||||
# XXX When browsers support CSS3 attr(), use it instead.
|
thumb = node.firstElementChild
|
||||||
size = if Conf['Index Size'] is 'small' then 150 else 250
|
{width, height} = thumb.dataset
|
||||||
for node in nodes
|
return unless width
|
||||||
thumb = node.firstElementChild
|
ratio = size / Math.max width, height
|
||||||
{width, height} = thumb.dataset
|
thumb.style.width = width * ratio + 'px'
|
||||||
continue unless width
|
thumb.style.height = height * ratio + 'px'
|
||||||
ratio = size / Math.max width, height
|
|
||||||
thumb.style.width = width * ratio + 'px'
|
|
||||||
thumb.style.height = height * ratio + 'px'
|
|
||||||
return
|
|
||||||
|
|
||||||
sort: ->
|
sort: ->
|
||||||
sortedThreads = []
|
sortedThreads = []
|
||||||
@ -778,7 +777,6 @@ Index =
|
|||||||
|
|
||||||
when 'catalog'
|
when 'catalog'
|
||||||
nodes = Index.buildCatalogViews()
|
nodes = Index.buildCatalogViews()
|
||||||
Index.sizeCatalogViews nodes
|
|
||||||
|
|
||||||
else
|
else
|
||||||
nodes = []
|
nodes = []
|
||||||
@ -835,7 +833,7 @@ Index =
|
|||||||
while thread = sortedThreads[i++]
|
while thread = sortedThreads[i++]
|
||||||
filtered.push thread if Index.searchMatch thread, keywords
|
filtered.push thread if Index.searchMatch thread, keywords
|
||||||
Index.sortedThreads = filtered
|
Index.sortedThreads = filtered
|
||||||
|
|
||||||
|
|
||||||
searchMatch: (thread, keywords) ->
|
searchMatch: (thread, keywords) ->
|
||||||
{info, file} = thread.OP
|
{info, file} = thread.OP
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user