Add some convenience properties.

This commit is contained in:
ccd0 2019-07-12 22:27:52 -07:00
parent a650efe9ab
commit 64d1e5b21d
4 changed files with 7 additions and 1 deletions

View File

@ -2,6 +2,8 @@ class Board
toString: -> @ID
constructor: (@ID) ->
@boardID = @ID
@siteID = g.SITE.ID
@threads = new SimpleDict()
@posts = new SimpleDict()
@config = BoardConfig.boards?[@ID] or {}

View File

@ -8,6 +8,7 @@ class Post
$.extend @, flags
@ID = +root.id.match(/\d*$/)[0]
@postID = @ID
@threadID = @thread.ID
@boardID = @board.ID
@siteID = g.SITE.ID

View File

@ -2,6 +2,9 @@ class Thread
toString: -> @ID
constructor: (@ID, @board) ->
@threadID = @ID
@boardID = @board.ID
@siteID = g.SITE.ID
@fullID = "#{@board}.#{@ID}"
@posts = new SimpleDict()
@isDead = false

View File

@ -37,5 +37,5 @@ Site =
software = properties.software
continue unless software and SW[software]
g.sites[ID] = site = Object.create SW[software]
$.extend site, {ID, properties, software}
$.extend site, {ID, siteID: ID, properties, software}
g.SITE = g.sites[hostname]