Tweak.
This commit is contained in:
parent
c9f6bd50dc
commit
606875c292
@ -909,7 +909,7 @@
|
|||||||
},
|
},
|
||||||
initHeaderReady: function() {
|
initHeaderReady: function() {
|
||||||
var header, nav, settings, _ref, _ref1, _ref2;
|
var header, nav, settings, _ref, _ref1, _ref2;
|
||||||
if (!$.id('navtopr')) {
|
if (!$.id('navtopright')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
header = Main.header;
|
header = Main.header;
|
||||||
@ -981,7 +981,7 @@
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!$.id('navtopr')) {
|
if (!$.id('navtopright')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
threads = [];
|
threads = [];
|
||||||
@ -1371,7 +1371,11 @@
|
|||||||
return root;
|
return root;
|
||||||
},
|
},
|
||||||
fetchedPost: function(req, board, threadID, postID, root) {
|
fetchedPost: function(req, board, threadID, postID, root) {
|
||||||
var clone, doc, href, inBoard, inThread, link, pc, post, quote, status, url, _i, _len, _ref;
|
var doc, href, inBoard, inThread, link, pc, post, quote, status, url, _i, _len, _ref;
|
||||||
|
if (post = g.posts["" + board + "." + postID]) {
|
||||||
|
Get.insert(post, root);
|
||||||
|
return;
|
||||||
|
}
|
||||||
status = req.status;
|
status = req.status;
|
||||||
if (status !== 200) {
|
if (status !== 200) {
|
||||||
if (url = Redirect.post(board, postID)) {
|
if (url = Redirect.post(board, postID)) {
|
||||||
@ -1412,19 +1416,16 @@
|
|||||||
link.nextSibling.href = "/" + board + "/res/" + threadID + "#q" + postID;
|
link.nextSibling.href = "/" + board + "/res/" + threadID + "#q" + postID;
|
||||||
inBoard = g.boards[board] || new Board(board);
|
inBoard = g.boards[board] || new Board(board);
|
||||||
inThread = g.threads["" + board + "." + threadID] || new Thread(threadID, inBoard);
|
inThread = g.threads["" + board + "." + threadID] || new Thread(threadID, inBoard);
|
||||||
if (!(post = g.posts["" + board + "." + postID])) {
|
post = new Post(postContainer, thread, board);
|
||||||
post = new Post(postContainer, thread, board);
|
Main.callbackNodes(Post, [post]);
|
||||||
Main.callbackNodes(Post, [post]);
|
return Get.insert(post, root);
|
||||||
}
|
|
||||||
if (!root.parentNode) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
clone = post.addClone();
|
|
||||||
Main.callbackNodes(Post, [clone]);
|
|
||||||
return $.replace(root.firstChild, Get.cleanRoot(clone));
|
|
||||||
},
|
},
|
||||||
archivedPost: function(req, board, postID, root) {
|
archivedPost: function(req, board, postID, root) {
|
||||||
var bq, clone, comment, data, post, postContainer, thread, threadID;
|
var bq, comment, data, post, postContainer, thread, threadID;
|
||||||
|
if (post = g.posts["" + board + "." + postID]) {
|
||||||
|
Get.insert(post, root);
|
||||||
|
return;
|
||||||
|
}
|
||||||
data = JSON.parse(req.response);
|
data = JSON.parse(req.response);
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
$.addClass(root, 'warning');
|
$.addClass(root, 'warning');
|
||||||
@ -1492,12 +1493,14 @@
|
|||||||
});
|
});
|
||||||
board = g.boards[board] || new Board(board);
|
board = g.boards[board] || new Board(board);
|
||||||
thread = g.threads["" + board + "." + threadID] || new Thread(threadID, board);
|
thread = g.threads["" + board + "." + threadID] || new Thread(threadID, board);
|
||||||
if (!(post = g.posts["" + board + "." + postID])) {
|
post = new Post(postContainer, thread, board, {
|
||||||
post = new Post(postContainer, thread, board, {
|
isArchived: true
|
||||||
isArchived: true
|
});
|
||||||
});
|
Main.callbackNodes(Post, [post]);
|
||||||
Main.callbackNodes(Post, [post]);
|
return Get.insert(post, root);
|
||||||
}
|
},
|
||||||
|
insert: function(post, root) {
|
||||||
|
var clone;
|
||||||
if (!root.parentNode) {
|
if (!root.parentNode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -714,7 +714,7 @@ Main =
|
|||||||
localStorage.setItem '4chan_settings', false
|
localStorage.setItem '4chan_settings', false
|
||||||
$.ready Main.initHeaderReady
|
$.ready Main.initHeaderReady
|
||||||
initHeaderReady: ->
|
initHeaderReady: ->
|
||||||
return unless $.id 'navtopr'
|
return unless $.id 'navtopright'
|
||||||
header = Main.header
|
header = Main.header
|
||||||
$.prepend d.body, header
|
$.prepend d.body, header
|
||||||
|
|
||||||
@ -780,7 +780,7 @@ Main =
|
|||||||
location.href = Redirect.thread g.BOARD, g.THREAD, location.hash
|
location.href = Redirect.thread g.BOARD, g.THREAD, location.hash
|
||||||
return
|
return
|
||||||
|
|
||||||
return unless $.id 'navtopr'
|
return unless $.id 'navtopright'
|
||||||
|
|
||||||
threads = []
|
threads = []
|
||||||
posts = []
|
posts = []
|
||||||
@ -1160,6 +1160,11 @@ Get =
|
|||||||
$.rm child unless child is post
|
$.rm child unless child is post
|
||||||
root
|
root
|
||||||
fetchedPost: (req, board, threadID, postID, root) ->
|
fetchedPost: (req, board, threadID, postID, root) ->
|
||||||
|
# In case of multiple callbacks for the same request,
|
||||||
|
# don't parse the same original post more than once.
|
||||||
|
if post = g.posts["#{board}.#{postID}"]
|
||||||
|
Get.insert post, root
|
||||||
|
return
|
||||||
{status} = req
|
{status} = req
|
||||||
if status isnt 200
|
if status isnt 200
|
||||||
# The thread can die by the time we check a quote.
|
# The thread can die by the time we check a quote.
|
||||||
@ -1201,18 +1206,15 @@ Get =
|
|||||||
new Board board
|
new Board board
|
||||||
inThread = g.threads["#{board}.#{threadID}"] or
|
inThread = g.threads["#{board}.#{threadID}"] or
|
||||||
new Thread threadID, inBoard
|
new Thread threadID, inBoard
|
||||||
|
post = new Post postContainer, thread, board
|
||||||
|
Main.callbackNodes Post, [post]
|
||||||
|
Get.insert post, root
|
||||||
|
archivedPost: (req, board, postID, root) ->
|
||||||
# In case of multiple callbacks for the same request,
|
# In case of multiple callbacks for the same request,
|
||||||
# don't parse the same original post more than once.
|
# don't parse the same original post more than once.
|
||||||
unless post = g.posts["#{board}.#{postID}"]
|
if post = g.posts["#{board}.#{postID}"]
|
||||||
post = new Post postContainer, thread, board
|
Get.insert post, root
|
||||||
Main.callbackNodes Post, [post]
|
return
|
||||||
|
|
||||||
# Stop here if the container has been removed while loading.
|
|
||||||
return unless root.parentNode
|
|
||||||
clone = post.addClone()
|
|
||||||
Main.callbackNodes Post, [clone]
|
|
||||||
$.replace root.firstChild, Get.cleanRoot clone
|
|
||||||
archivedPost: (req, board, postID, root) ->
|
|
||||||
data = JSON.parse req.response
|
data = JSON.parse req.response
|
||||||
if data.error
|
if data.error
|
||||||
$.addClass root, 'warning'
|
$.addClass root, 'warning'
|
||||||
@ -1293,13 +1295,11 @@ Get =
|
|||||||
new Board board
|
new Board board
|
||||||
thread = g.threads["#{board}.#{threadID}"] or
|
thread = g.threads["#{board}.#{threadID}"] or
|
||||||
new Thread threadID, board
|
new Thread threadID, board
|
||||||
# In case of multiple callbacks for the same request,
|
post = new Post postContainer, thread, board,
|
||||||
# don't parse the same original post more than once.
|
isArchived: true
|
||||||
unless post = g.posts["#{board}.#{postID}"]
|
Main.callbackNodes Post, [post]
|
||||||
post = new Post postContainer, thread, board,
|
Get.insert post, root
|
||||||
isArchived: true
|
insert: (post, root) ->
|
||||||
Main.callbackNodes Post, [post]
|
|
||||||
|
|
||||||
# Stop here if the container has been removed while loading.
|
# Stop here if the container has been removed while loading.
|
||||||
return unless root.parentNode
|
return unless root.parentNode
|
||||||
clone = post.addClone()
|
clone = post.addClone()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user