diff options
| author | Jez Ng | 2012-09-04 15:23:29 -0400 |
|---|---|---|
| committer | Jez Ng | 2012-09-04 15:23:29 -0400 |
| commit | eb0955875ba6ba77a90b1e411c42be0df6de950d (patch) | |
| tree | 45aac8cd0e19e209cf37c199a7c89b3972f63df9 /background_scripts | |
| parent | 525276bde9b99d05b133f96f21e1ac187c068bb6 (diff) | |
| download | vimium-eb0955875ba6ba77a90b1e411c42be0df6de950d.tar.bz2 | |
Style fixes.
Errors were detected using coffeelint.
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/commands.coffee | 6 | ||||
| -rw-r--r-- | background_scripts/completion.coffee | 4 | ||||
| -rw-r--r-- | background_scripts/main.coffee | 26 |
3 files changed, 18 insertions, 18 deletions
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index e3001f4f..69c37ac4 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -43,9 +43,9 @@ Commands = # On the other hand, <c-a> and <c-A> are different named keys - for one of # them you have to press "shift" as well. normalizeKey: (key) -> - key.replace(/<[acm]-/ig, (match) -> match.toLowerCase()) - .replace(/<([acm]-)?([a-zA-Z0-9]{2,5})>/g, (match, optionalPrefix, keyName) -> - "<" + (if optionalPrefix then optionalPrefix else "") + keyName.toLowerCase() + ">") + key.replace(/<[acm]-/ig, (match) -> match.toLowerCase()) + .replace(/<([acm]-)?([a-zA-Z0-9]{2,5})>/g, (match, optionalPrefix, keyName) -> + "<" + (if optionalPrefix then optionalPrefix else "") + keyName.toLowerCase() + ">") parseCustomKeyMappings: (customKeyMappings) -> lines = customKeyMappings.split("\n") diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index 5920db0b..5539f7c7 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -26,7 +26,7 @@ class Suggestion generateHtml: -> return @html if @html - relevancyHtml = if @showRelevancy then "<span class='relevancy'>#{@computeRelevancy() + ''}</span>" else "" + relevancyHtml = if @showRelevancy then "<span class='relevancy'>#{@computeRelevancy()}</span>" else "" # NOTE(philc): We're using these vimium-specific class names so we don't collide with the page's CSS. @html = "<div class='vimiumReset vomnibarTopHalf'> @@ -90,7 +90,7 @@ class BookmarkCompleter performSearch: -> results = @bookmarks.filter (bookmark) => - RankingUtils.matches(@currentSearch.queryTerms, bookmark.url, bookmark.title) + RankingUtils.matches(@currentSearch.queryTerms, bookmark.url, bookmark.title) suggestions = results.map (bookmark) => new Suggestion(@currentSearch.queryTerms, "bookmark", bookmark.url, bookmark.title, @computeRelevancy) onComplete = @currentSearch.onComplete diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 707febc9..5ae80235 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -265,17 +265,17 @@ selectTab = (callback, direction) -> chrome.tabs.getAllInWindow(null, (tabs) -> return unless tabs.length > 1 chrome.tabs.getSelected(null, (currentTab) -> - switch direction - when "next" - toSelect = tabs[(currentTab.index + 1 + tabs.length) % tabs.length] - when "previous" - toSelect = tabs[(currentTab.index - 1 + tabs.length) % tabs.length] - when "first" - toSelect = tabs[0] - when "last" - toSelect = tabs[tabs.length - 1] - selectionChangedHandlers.push(callback) - chrome.tabs.update(toSelect.id, { selected: true }))) + switch direction + when "next" + toSelect = tabs[(currentTab.index + 1 + tabs.length) % tabs.length] + when "previous" + toSelect = tabs[(currentTab.index - 1 + tabs.length) % tabs.length] + when "first" + toSelect = tabs[0] + when "last" + toSelect = tabs[tabs.length - 1] + selectionChangedHandlers.push(callback) + chrome.tabs.update(toSelect.id, { selected: true }))) updateOpenTabs = (tab) -> openTabs[tab.id] = { url: tab.url, positionIndex: tab.index, windowId: tab.windowId } @@ -367,7 +367,7 @@ updatePositionsAndWindowsForAllTabsInWindow = (windowId) -> splitKeyIntoFirstAndSecond = (key) -> if (key.search(namedKeyRegex) == 0) - { first: RegExp.$1, second: RegExp.$2 } + { first: RegExp.$1, second: RegExp.$2 } else { first: key[0], second: key.slice(1) } @@ -409,7 +409,7 @@ generateCompletionKeys = (keysToCheck) -> for key of Commands.keyToCommandRegistry splitKey = splitKeyIntoFirstAndSecond(key) if (splitKey.first == command) - completionKeys.push(splitKey.second) + completionKeys.push(splitKey.second) completionKeys |
