Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 24d2f35

Browse files
committed
🎨 remove space-pen dependency
- output using string interpolation
1 parent 64e8a5c commit 24d2f35

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/project/util.coffee

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
_ = require 'underscore-plus'
2-
{$} = require 'atom-space-pen-views'
32

43
module.exports =
54
escapeHtml: (str) ->
@@ -29,17 +28,18 @@ module.exports =
2928

3029
parseSearchResult: ->
3130
searchResult = []
32-
summary = $('span.preview-count', 'div.preview-pane').text()
31+
summary = document.querySelector('span.preview-count').textContent
3332
searchResult.push summary, ''
3433

35-
$('ol.results-view.list-tree>li.path').each ->
36-
path = $('span.path-name', this).text()
37-
matches = $('span.path-match-number', this).text()
38-
searchResult.push path + ' ' + matches
34+
document.querySelectorAll('ol.results-view.list-tree>li.path').forEach (el) ->
35+
path = el.querySelector('span.path-name').textContent
36+
matches = el.querySelector('span.path-match-number').textContent
37+
searchResult.push "#{path} #{matches}"
3938

40-
$('li.search-result', this).filter(':visible').each ->
41-
lineNumber = $('span.line-number', this).text()
42-
preview = $('span.preview', this).text()
43-
searchResult.push '\t' + lineNumber + '\t' + preview
39+
el.querySelectorAll('li.search-result').forEach (e) ->
40+
return if e.offsetParent == null # skip invisible elements
41+
lineNumber = e.querySelector('span.line-number').textContent
42+
preview = e.querySelector('span.preview').textContent
43+
searchResult.push "\t#{lineNumber}\t#{preview}"
4444
searchResult.push ''
4545
searchResult.join('\n')

0 commit comments

Comments
 (0)