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

Commit

Permalink
🎨 remove space-pen dependency
Browse files Browse the repository at this point in the history
- output using string interpolation
  • Loading branch information
liuderchi committed Nov 27, 2016
1 parent 64e8a5c commit 9cd6ca7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/project/util.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
_ = require 'underscore-plus'
{$} = require 'atom-space-pen-views'

module.exports =
escapeHtml: (str) ->
Expand Down Expand Up @@ -29,17 +28,18 @@ module.exports =

parseSearchResult: ->
searchResult = []
summary = $('span.preview-count', 'div.preview-pane').text()
summary = document.querySelector('span.preview-count').textContent
searchResult.push summary, ''

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

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

0 comments on commit 9cd6ca7

Please sign in to comment.