Skip to content

Commit

Permalink
Merge pull request #396 from Ne4istb/master
Browse files Browse the repository at this point in the history
Added plugin for quick search in AngularJS documentation
  • Loading branch information
nate-parrott committed Apr 5, 2015
2 parents 86680a2 + d63b750 commit a996df3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
Binary file added PluginDirectories/1/angulardocs.bundle/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions PluginDirectories/1/angulardocs.bundle/examples.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
angular ~query(directive)
ng ~query(compile)
8 changes: 8 additions & 0 deletions PluginDirectories/1/angulardocs.bundle/info.json
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"
}
32 changes: 32 additions & 0 deletions PluginDirectories/1/angulardocs.bundle/plugin.py
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))

0 comments on commit a996df3

Please sign in to comment.