Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added plugin for quick search in AngularJS documentation #396

Merged
merged 1 commit into from
Apr 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))