-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #396 from Ne4istb/master
Added plugin for quick search in AngularJS documentation
- Loading branch information
Showing
4 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
angular ~query(directive) | ||
ng ~query(compile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "angulardocs", | ||
"displayName": "AngularJS Docs", | ||
"description": "Quick search in AngularJS Documentation", | ||
"examples": ["angular directives", "ng compile"], | ||
"categories": ["Developer"], | ||
"creator_name": "Ne4istb" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import urllib | ||
import json | ||
import i18n | ||
|
||
|
||
def results(parsed, original_query): | ||
|
||
angular_specs = [ | ||
["~query", "http://docs-angular.herokuapp.com/#/<query>"] | ||
] | ||
for key, url in angular_specs: | ||
if key in parsed: | ||
search_query = parsed[key].encode('UTF-8') | ||
title = i18n.localstr("Search in Angular Docs for '{0}'").format(search_query) | ||
search_url = url.replace("<query>", urllib.quote(search_query)) | ||
return { | ||
"title": title, | ||
"run_args": [search_url], | ||
"html": """ | ||
<script> | ||
setTimeout(function() { | ||
window.location = %s | ||
}, 500); | ||
</script> | ||
""" % (json.dumps(search_url)), | ||
"webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53", | ||
"webview_links_open_in_browser": True | ||
} | ||
|
||
def run(url): | ||
import os | ||
os.system('open "{0}"'.format(url)) |