mirror of
https://github.com/atom/atom.git
synced 2026-02-17 10:01:25 -05:00
Extract link click callback to method
This commit is contained in:
@@ -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]')
|
||||
|
||||
Reference in New Issue
Block a user