Put catalog stuff into post rather than moving post stuff into catalog thread.
This commit is contained in:
parent
a736f139dc
commit
9cee88ce3a
@ -165,6 +165,7 @@ Build =
|
|||||||
thread: (thread, data) ->
|
thread: (thread, data) ->
|
||||||
if (root = thread.nodes.root)
|
if (root = thread.nodes.root)
|
||||||
$.rmAll root
|
$.rmAll root
|
||||||
|
delete thread.nodes.placeholder
|
||||||
else
|
else
|
||||||
thread.nodes.root = root = $.el 'div',
|
thread.nodes.root = root = $.el 'div',
|
||||||
className: 'thread'
|
className: 'thread'
|
||||||
@ -203,12 +204,11 @@ Build =
|
|||||||
postCount = data.replies + 1
|
postCount = data.replies + 1
|
||||||
fileCount = data.images + !!data.ext
|
fileCount = data.images + !!data.ext
|
||||||
|
|
||||||
|
container = $.el 'div', <%= readHTML('CatalogThread.html') %>
|
||||||
|
$.before thread.OP.nodes.info, [container.childNodes...]
|
||||||
|
|
||||||
root = $.el 'div',
|
root = $.el 'div',
|
||||||
className: 'catalog-thread post' # post added to make 4chan postInfo CSS work
|
className: 'thread catalog-thread'
|
||||||
|
|
||||||
$.extend root, <%= readHTML('CatalogThread.html') %>
|
|
||||||
|
|
||||||
root.dataset.fullID = thread.fullID
|
|
||||||
$.addClass root, thread.OP.highlights... if thread.OP.highlights
|
$.addClass root, thread.OP.highlights... if thread.OP.highlights
|
||||||
$.addClass root, 'noFile' unless thread.OP.file
|
$.addClass root, 'noFile' unless thread.OP.file
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ Get =
|
|||||||
index = root.dataset.clone
|
index = root.dataset.clone
|
||||||
if index then post.clones[index] else post
|
if index then post.clones[index] else post
|
||||||
postFromNode: (root) ->
|
postFromNode: (root) ->
|
||||||
Get.postFromRoot $.x '(ancestor::div[contains(@class,"postContainer") or contains(@class,"catalog-thread")][1]|following::div[contains(@class,"postContainer")][1])', root
|
Get.postFromRoot $.x '(ancestor::div[contains(@class,"postContainer")][1]|following::div[contains(@class,"postContainer")][1])', root
|
||||||
postDataFromLink: (link) ->
|
postDataFromLink: (link) ->
|
||||||
if link.hostname is 'boards.4chan.org'
|
if link.hostname is 'boards.4chan.org'
|
||||||
path = link.pathname.split /\/+/
|
path = link.pathname.split /\/+/
|
||||||
|
|||||||
@ -713,7 +713,9 @@ Index =
|
|||||||
Index.buildReplies threads if Conf['Show Replies']
|
Index.buildReplies threads if Conf['Show Replies']
|
||||||
nodes = []
|
nodes = []
|
||||||
for thread in threads
|
for thread in threads
|
||||||
thread.OP.setCatalogOP false
|
if thread.nodes.placeholder
|
||||||
|
$.replace thread.nodes.placeholder, thread.OP.nodes.root
|
||||||
|
delete thread.nodes.placeholder
|
||||||
if (file = thread.OP.file) and (thumb = thread.OP.file.thumb) and thumb.dataset.src
|
if (file = thread.OP.file) and (thumb = thread.OP.file.thumb) and thumb.dataset.src
|
||||||
thumb.src = thumb.dataset.src
|
thumb.src = thumb.dataset.src
|
||||||
# XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1021289
|
# XXX https://bugzilla.mozilla.org/show_bug.cgi?id=1021289
|
||||||
@ -729,7 +731,10 @@ Index =
|
|||||||
Index.sizeCatalogViews threads
|
Index.sizeCatalogViews threads
|
||||||
nodes = []
|
nodes = []
|
||||||
for thread in threads
|
for thread in threads
|
||||||
thread.OP.setCatalogOP true
|
unless thread.nodes.placeholder
|
||||||
|
thread.nodes.placeholder = $.el 'div'
|
||||||
|
$.replace thread.OP.nodes.root, thread.nodes.placeholder
|
||||||
|
$.add thread.catalogView.nodes.root, thread.OP.nodes.root
|
||||||
nodes.push thread.catalogView.nodes.root
|
nodes.push thread.catalogView.nodes.root
|
||||||
$.add Index.root, nodes
|
$.add Index.root, nodes
|
||||||
if doc.contains Index.root
|
if doc.contains Index.root
|
||||||
|
|||||||
@ -39,6 +39,7 @@ Nav =
|
|||||||
Nav.scroll +1
|
Nav.scroll +1
|
||||||
|
|
||||||
getThread: ->
|
getThread: ->
|
||||||
|
return $ '.board' if $.hasClass doc, 'catalog-mode'
|
||||||
for threadRoot in $$ '.thread'
|
for threadRoot in $$ '.thread'
|
||||||
thread = Get.threadFromRoot threadRoot
|
thread = Get.threadFromRoot threadRoot
|
||||||
continue if thread.isHidden and !thread.stub
|
continue if thread.isHidden and !thread.stub
|
||||||
|
|||||||
@ -4,11 +4,12 @@ class CatalogThread
|
|||||||
constructor: (root, @thread) ->
|
constructor: (root, @thread) ->
|
||||||
@ID = @thread.ID
|
@ID = @thread.ID
|
||||||
@board = @thread.board
|
@board = @thread.board
|
||||||
|
{post} = @thread.OP.nodes
|
||||||
@nodes =
|
@nodes =
|
||||||
root: root
|
root: root
|
||||||
thumb: $ '.catalog-thumb', root
|
thumb: $ '.catalog-thumb', post
|
||||||
icons: $ '.catalog-icons', root
|
icons: $ '.catalog-icons', post
|
||||||
postCount: $ '.post-count', root
|
postCount: $ '.post-count', post
|
||||||
fileCount: $ '.file-count', root
|
fileCount: $ '.file-count', post
|
||||||
pageCount: $ '.page-count', root
|
pageCount: $ '.page-count', post
|
||||||
@thread.catalogView = @
|
@thread.catalogView = @
|
||||||
|
|||||||
@ -7,14 +7,10 @@ Post.Clone = class extends Post
|
|||||||
@[key] = @origin[key]
|
@[key] = @origin[key]
|
||||||
|
|
||||||
{nodes} = @origin
|
{nodes} = @origin
|
||||||
cloneNode = if contractThumb
|
root = if contractThumb
|
||||||
@cloneWithoutVideo
|
@cloneWithoutVideo nodes.root
|
||||||
else
|
else
|
||||||
(node) -> node.cloneNode true
|
nodes.root.cloneNode true
|
||||||
root = cloneNode nodes.root
|
|
||||||
if @origin.isCatalogOP
|
|
||||||
$.prepend $('.post', root), cloneNode(nodes.fileRoot) if nodes.fileRoot
|
|
||||||
$.add $('.post', root), [cloneNode(nodes.info), cloneNode(nodes.comment)]
|
|
||||||
Post.Clone.prefix or= 0
|
Post.Clone.prefix or= 0
|
||||||
for node in [root, $$('[id]', root)...]
|
for node in [root, $$('[id]', root)...]
|
||||||
node.id = Post.Clone.prefix + node.id
|
node.id = Post.Clone.prefix + node.id
|
||||||
@ -32,6 +28,10 @@ Post.Clone = class extends Post
|
|||||||
$.rmClass root, 'forwarded' # quote inlining
|
$.rmClass root, 'forwarded' # quote inlining
|
||||||
$.rmClass @nodes.post, 'highlight' # keybind navigation, ID highlighting
|
$.rmClass @nodes.post, 'highlight' # keybind navigation, ID highlighting
|
||||||
|
|
||||||
|
# Remove catalog stuff.
|
||||||
|
$.rm $('.catalog-link', @nodes.post)
|
||||||
|
$.rm $('.catalog-stats', @nodes.post)
|
||||||
|
|
||||||
@parseQuotes()
|
@parseQuotes()
|
||||||
@quotes = [@origin.quotes...]
|
@quotes = [@origin.quotes...]
|
||||||
|
|
||||||
|
|||||||
@ -36,9 +36,8 @@ class Post
|
|||||||
@parseQuotes()
|
@parseQuotes()
|
||||||
@parseFile()
|
@parseFile()
|
||||||
|
|
||||||
@isDead = false
|
@isDead = false
|
||||||
@isHidden = false
|
@isHidden = false
|
||||||
@isCatalogOP = false
|
|
||||||
|
|
||||||
@clones = []
|
@clones = []
|
||||||
<% if (readJSON('/.tests_enabled')) { %>
|
<% if (readJSON('/.tests_enabled')) { %>
|
||||||
@ -259,11 +258,3 @@ class Post
|
|||||||
for clone in @clones[index..]
|
for clone in @clones[index..]
|
||||||
clone.nodes.root.dataset.clone = index++
|
clone.nodes.root.dataset.clone = index++
|
||||||
return
|
return
|
||||||
|
|
||||||
setCatalogOP: (isCatalogOP) ->
|
|
||||||
return if @isCatalogOP is isCatalogOP
|
|
||||||
@isCatalogOP = isCatalogOP
|
|
||||||
node = if isCatalogOP then @thread.catalogView.nodes.root else @nodes.post
|
|
||||||
{fileRoot, info, comment} = @nodes
|
|
||||||
$.prepend node, fileRoot if fileRoot
|
|
||||||
$.add node, [info, comment]
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ class Thread
|
|||||||
|
|
||||||
@nodes =
|
@nodes =
|
||||||
root: null
|
root: null
|
||||||
|
placeholder: null
|
||||||
|
|
||||||
@board.threads.push @ID, @
|
@board.threads.push @ID, @
|
||||||
g.threads.push @fullID, @
|
g.threads.push @fullID, @
|
||||||
|
|||||||
@ -31,10 +31,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Catalog */
|
/* Catalog */
|
||||||
:root.burichan .catalog-thread:hover > * {
|
:root.burichan .catalog-thread:hover .post {
|
||||||
background-color: #D6DAF0;
|
background-color: #D6DAF0;
|
||||||
}
|
}
|
||||||
:root.burichan.werkTyme .catalog-thread:not(:hover), :root.burichan .catalog-thread:hover > * {
|
:root.burichan.werkTyme .catalog-thread:not(:hover), :root.burichan .catalog-thread:hover .post {
|
||||||
border-color: #B7C5D9;
|
border-color: #B7C5D9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,10 +31,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Catalog */
|
/* Catalog */
|
||||||
:root.futaba .catalog-thread:hover > * {
|
:root.futaba .catalog-thread:hover .post {
|
||||||
background-color: #F0E0D6;
|
background-color: #F0E0D6;
|
||||||
}
|
}
|
||||||
:root.futaba.werkTyme .catalog-thread:not(:hover), :root.futaba .catalog-thread:hover > * {
|
:root.futaba.werkTyme .catalog-thread:not(:hover), :root.futaba .catalog-thread:hover .post {
|
||||||
border-color: #D9BFB7;
|
border-color: #D9BFB7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,10 +31,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Catalog */
|
/* Catalog */
|
||||||
:root.photon .catalog-thread:hover > * {
|
:root.photon .catalog-thread:hover .post {
|
||||||
background-color: #DDD;
|
background-color: #DDD;
|
||||||
}
|
}
|
||||||
:root.photon.werkTyme .catalog-thread:not(:hover), :root.photon .catalog-thread:hover > * {
|
:root.photon.werkTyme .catalog-thread:not(:hover), :root.photon .catalog-thread:hover .post {
|
||||||
border-color: #CCC;
|
border-color: #CCC;
|
||||||
}
|
}
|
||||||
:root.photon .catalog-code {
|
:root.photon .catalog-code {
|
||||||
|
|||||||
@ -718,39 +718,31 @@ div[data-checked="false"] > .suboption-list {
|
|||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
div.catalog-thread {
|
div.catalog-thread {
|
||||||
margin: 4px;
|
margin: 4px;
|
||||||
}
|
}
|
||||||
.catalog-thread > * {
|
.catalog-thread > .postContainer {
|
||||||
margin: 0 -1px;
|
overflow: hidden;
|
||||||
border-left: 1px solid transparent;
|
|
||||||
border-right: 1px solid transparent;
|
|
||||||
}
|
}
|
||||||
.catalog-thread > :first-child {
|
.catalog-small .catalog-thread,
|
||||||
margin-top: -21px;
|
.catalog-small .catalog-thread > .postContainer {
|
||||||
border-top: 1px solid transparent;
|
width: 165px;
|
||||||
|
height: 320px;
|
||||||
}
|
}
|
||||||
.catalog-thread.noFile > :first-child {
|
.catalog-large .catalog-thread,
|
||||||
padding-top: 20px;
|
.catalog-large .catalog-thread > .postContainer {
|
||||||
|
width: 270px;
|
||||||
|
height: 410px;
|
||||||
}
|
}
|
||||||
.catalog-thread > :last-child {
|
.catalog-thread .post {
|
||||||
margin-bottom: -1px;
|
margin: -1px;
|
||||||
border-bottom: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
}
|
}
|
||||||
.catalog-link {
|
.catalog-link {
|
||||||
display: block;
|
display: block;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.catalog-small .catalog-thread {
|
|
||||||
width: 165px;
|
|
||||||
height: 320px;
|
|
||||||
}
|
|
||||||
.catalog-large .catalog-thread {
|
|
||||||
width: 270px;
|
|
||||||
height: 410px;
|
|
||||||
}
|
|
||||||
.catalog-thumb {
|
.catalog-thumb {
|
||||||
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);
|
||||||
@ -791,12 +783,18 @@ div.catalog-thread {
|
|||||||
.catalog-stats > [title] {
|
.catalog-stats > [title] {
|
||||||
cursor: help;
|
cursor: help;
|
||||||
}
|
}
|
||||||
#delform .catalog-thread:not(:hover) > .file,
|
.catalog-thread blockquote {
|
||||||
#delform .catalog-thread:not(:hover) > .postInfo,
|
margin: 0;
|
||||||
#delform .catalog-thread > .file > :not(.fileText),
|
}
|
||||||
#delform .catalog-thread > .file > .fileText > :not(:first-child),
|
#delform .catalog-thread:not(:hover) .file,
|
||||||
#delform .catalog-thread > .postInfo > :not(.nameBlock):not(.dateTime),
|
#delform .catalog-thread:not(:hover) .postInfo,
|
||||||
#delform .catalog-thread .posteruid {
|
#delform .catalog-thread > .postContainer > :not(.post),
|
||||||
|
#delform .catalog-thread .file > :not(.fileText),
|
||||||
|
#delform .catalog-thread .file > .fileText > :not(:first-child),
|
||||||
|
#delform .catalog-thread .postInfo > :not(.nameBlock):not(.dateTime),
|
||||||
|
#delform .catalog-thread .posteruid,
|
||||||
|
.thread:not(.catalog-thread) .catalog-link,
|
||||||
|
.thread:not(.catalog-thread) .catalog-stats {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.catalog-thread .fileText {
|
.catalog-thread .fileText {
|
||||||
@ -805,7 +803,7 @@ div.catalog-thread {
|
|||||||
line-height: 1;
|
line-height: 1;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
}
|
}
|
||||||
#delform .catalog-thread > .postInfo {
|
#delform .catalog-thread .postInfo {
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
.catalog-thread .subject {
|
.catalog-thread .subject {
|
||||||
@ -816,12 +814,16 @@ div.catalog-thread {
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
.catalog-thread:hover {
|
.catalog-thread:hover {
|
||||||
overflow: visible;
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
.catalog-thread:hover > * {
|
.catalog-thread:hover > .postContainer {
|
||||||
margin-left: -61px;
|
overflow: visible;
|
||||||
margin-right: -61px;
|
}
|
||||||
|
.catalog-thread:hover .post {
|
||||||
|
margin: -21px -61px -1px;
|
||||||
|
}
|
||||||
|
.catalog-thread.noFile:hover .post {
|
||||||
|
margin-top: -1px;
|
||||||
}
|
}
|
||||||
.catalog-thread .prettyprinted {
|
.catalog-thread .prettyprinted {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
|||||||
@ -30,10 +30,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Catalog */
|
/* Catalog */
|
||||||
:root.tomorrow .catalog-thread:hover > * {
|
:root.tomorrow .catalog-thread:hover .post {
|
||||||
background-color: #282A2E;
|
background-color: #282A2E;
|
||||||
}
|
}
|
||||||
:root.tomorrow.werkTyme .catalog-thread:not(:hover), :root.tomorrow .catalog-thread:hover > * {
|
:root.tomorrow.werkTyme .catalog-thread:not(:hover), :root.tomorrow .catalog-thread:hover .post {
|
||||||
border-color: #111;
|
border-color: #111;
|
||||||
}
|
}
|
||||||
:root.tomorrow .catalog-code {
|
:root.tomorrow .catalog-code {
|
||||||
|
|||||||
@ -31,10 +31,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Catalog */
|
/* Catalog */
|
||||||
:root.yotsuba-b .catalog-thread:hover > * {
|
:root.yotsuba-b .catalog-thread:hover .post {
|
||||||
background-color: #D6DAF0;
|
background-color: #D6DAF0;
|
||||||
}
|
}
|
||||||
:root.yotsuba-b.werkTyme .catalog-thread:not(:hover), :root.yotsuba-b .catalog-thread:hover > * {
|
:root.yotsuba-b.werkTyme .catalog-thread:not(:hover), :root.yotsuba-b .catalog-thread:hover .post {
|
||||||
border-color: #B7C5D9;
|
border-color: #B7C5D9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,10 +31,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Catalog */
|
/* Catalog */
|
||||||
:root.yotsuba .catalog-thread:hover > * {
|
:root.yotsuba .catalog-thread:hover .post {
|
||||||
background-color: #F0E0D6;
|
background-color: #F0E0D6;
|
||||||
}
|
}
|
||||||
:root.yotsuba.werkTyme .catalog-thread:not(:hover), :root.yotsuba .catalog-thread:hover > * {
|
:root.yotsuba.werkTyme .catalog-thread:not(:hover), :root.yotsuba .catalog-thread:hover .post {
|
||||||
border-color: #D9BFB7;
|
border-color: #D9BFB7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user