From a29015551c202a6fda018757f128a0ccaec1bc2f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki & Nathan Sobo Date: Thu, 16 May 2013 15:04:30 -0700 Subject: [PATCH] Extract link click callback to method --- src/app/window-event-handler.coffee | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/app/window-event-handler.coffee b/src/app/window-event-handler.coffee index 61d3db3bc..a9cb3dfd7 100644 --- a/src/app/window-event-handler.coffee +++ b/src/app/window-event-handler.coffee @@ -25,14 +25,16 @@ class WindowEventHandler e.preventDefault() e.stopPropagation() - @subscribe $(document), 'click', 'a', (e) -> - location = $(e.target).attr('href') - return unless location - return if location[0] is '#' + @subscribe $(document), 'click', 'a', @openLink - if location.indexOf('https://') is 0 or location.indexOf('http://') is 0 - require('child_process').spawn('open', [location]) - false + openLink: (event) => + location = $(event.target).attr('href') + return unless location + return if location[0] is '#' + + if location.indexOf('https://') is 0 or location.indexOf('http://') is 0 + require('child_process').spawn('open', [location]) + false eachTabIndexedElement: (callback) -> for element in $('[tabindex]')