Avoid conflicting thread/post IDs between different boards in g.threads/posts.

This commit is contained in:
Nicolas Stepien 2012-08-27 04:31:14 +02:00
parent e4eb6b2d7c
commit 4a3da8bafb
2 changed files with 5 additions and 5 deletions

View File

@ -621,7 +621,7 @@
this.ID = +root.id.slice(1); this.ID = +root.id.slice(1);
this.hr = root.nextElementSibling; this.hr = root.nextElementSibling;
this.posts = {}; this.posts = {};
g.threads[this.ID] = board.threads[this.ID] = this; g.threads["" + board.ID + "." + this.ID] = board.threads[this.ID] = this;
} }
return Thread; return Thread;
@ -636,7 +636,7 @@
this.board = board; this.board = board;
this.ID = +root.id.slice(2); this.ID = +root.id.slice(2);
this.el = $('.post', root); this.el = $('.post', root);
g.posts[this.ID] = thread.posts[this.ID] = board.posts[this.ID] = this; g.posts["" + board.ID + "." + this.ID] = thread.posts[this.ID] = board.posts[this.ID] = this;
} }
return Post; return Post;

View File

@ -485,14 +485,14 @@ class Thread
@hr = root.nextElementSibling @hr = root.nextElementSibling
@posts = {} @posts = {}
g.threads[@ID] = board.threads[@ID] = @ g.threads["#{board.ID}.#{@ID}"] = board.threads[@ID] = @
class Post class Post
constructor: (@root, @thread, @board) -> constructor: (@root, @thread, @board) ->
@ID = +root.id[2..] @ID = +root.id[2..]
@el = $ '.post', root @el = $ '.post', root
g.posts[@ID] = thread.posts[@ID] = board.posts[@ID] = @ g.posts["#{board.ID}.#{@ID}"] = thread.posts[@ID] = board.posts[@ID] = @
Main = Main =
init: -> init: ->
@ -528,13 +528,13 @@ Main =
if $.hasClass child, 'postContainer' if $.hasClass child, 'postContainer'
new Post child, thread, g.BOARD new Post child, thread, g.BOARD
$.log g $.log g
addStyle: -> addStyle: ->
$.off d, 'DOMNodeInserted', Main.addStyle $.off d, 'DOMNodeInserted', Main.addStyle
if d.head if d.head
$.addStyle Main.css $.addStyle Main.css
else else
$.on d, 'DOMNodeInserted', Main.addStyle $.on d, 'DOMNodeInserted', Main.addStyle
css: ' css: '
.move { .move {
cursor: move; cursor: move;