From b01c372c1a1462976e99c9d5418c77961393db75 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 6 Feb 2015 20:59:54 -0800 Subject: [PATCH] Merge from Appchan X: src/General/lib deferred: changes to Callbacks.execute --- src/General/lib/$.coffee | 2 +- src/General/lib/board.class | 6 +++--- src/General/lib/catalogthread.class | 2 +- src/General/lib/connection.class | 6 +++--- src/General/lib/post.class | 7 +++---- src/General/lib/thread.class | 2 +- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/General/lib/$.coffee b/src/General/lib/$.coffee index a243439dd..8d7700ee2 100755 --- a/src/General/lib/$.coffee +++ b/src/General/lib/$.coffee @@ -215,7 +215,7 @@ $.one = (el, events, handler) -> $.event = (event, detail, root=d) -> <% if (type === 'userscript') { %> if detail? and typeof cloneInto is 'function' - detail = cloneInto detail, document.defaultView + detail = cloneInto detail, d.defaultView <% } %> root.dispatchEvent new CustomEvent event, {bubbles: true, detail} diff --git a/src/General/lib/board.class b/src/General/lib/board.class index 4b4fdd720..7f811d463 100755 --- a/src/General/lib/board.class +++ b/src/General/lib/board.class @@ -2,7 +2,7 @@ class Board toString: -> @ID constructor: (@ID) -> - @threads = new SimpleDict - @posts = new SimpleDict + @threads = new SimpleDict() + @posts = new SimpleDict() - g.boards[@] = @ \ No newline at end of file + g.boards[@] = @ diff --git a/src/General/lib/catalogthread.class b/src/General/lib/catalogthread.class index 564f62bfb..40f6fcd94 100644 --- a/src/General/lib/catalogthread.class +++ b/src/General/lib/catalogthread.class @@ -1,5 +1,5 @@ class CatalogThread - @callbacks = new Callbacks 'CatalogThread' + @callbacks = new Callbacks 'Catalog Thread' toString: -> @ID constructor: (root, @thread) -> diff --git a/src/General/lib/connection.class b/src/General/lib/connection.class index 455948563..52e614136 100644 --- a/src/General/lib/connection.class +++ b/src/General/lib/connection.class @@ -1,11 +1,11 @@ class Connection constructor: (@target, @origin, @cb) -> - $.on window, 'message', @onMessage.bind @ + $.on window, 'message', @onMessage - send: (data) -> + send: (data) => @target.postMessage "#{g.NAMESPACE}#{JSON.stringify data}", @origin - onMessage: (e) -> + onMessage: (e) => return unless e.source is @target and e.origin is @origin and typeof e.data is 'string' and diff --git a/src/General/lib/post.class b/src/General/lib/post.class index 125bee370..063cb9090 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -234,10 +234,9 @@ class Post for clone in @clones clone.resurrect() - for quotelink in Get.allQuotelinksLinkingTo @ - if $.hasClass quotelink, 'deadlink' - quotelink.textContent = quotelink.textContent.replace '\u00A0(Dead)', '' - $.rmClass quotelink, 'deadlink' + for quotelink in Get.allQuotelinksLinkingTo @ when $.hasClass quotelink, 'deadlink' + quotelink.textContent = quotelink.textContent.replace '\u00A0(Dead)', '' + $.rmClass quotelink, 'deadlink' return collect: -> diff --git a/src/General/lib/thread.class b/src/General/lib/thread.class index d68c1c75a..f9741c7b0 100755 --- a/src/General/lib/thread.class +++ b/src/General/lib/thread.class @@ -4,7 +4,7 @@ class Thread constructor: (@ID, @board) -> @fullID = "#{@board}.#{@ID}" - @posts = new SimpleDict + @posts = new SimpleDict() @isDead = false @isHidden = false @isOnTop = false