-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/nate-parrott/Flashlight
- Loading branch information
Showing
7 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
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
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 @@ | ||
qiita ~qiitaquery(query here) |
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,7 @@ | ||
{ | ||
"name": "Qiita", | ||
"displayName": "Search Qiita", | ||
"examples": ["qiita flashlight"], | ||
"categories": ["Developer"], | ||
"creator_name": "Takuya Mannami" | ||
} |
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,27 @@ | ||
import urllib, json, i18n | ||
|
||
def results(parsed, original_query): | ||
search_specs = [ | ||
["Qiita", "~qiitaquery", "http://qiita.com/search?&q="] | ||
] | ||
for name, key, url in search_specs: | ||
if key in parsed: | ||
search_query = parsed[key].encode('UTF-8') | ||
search_url = url + urllib.quote_plus(search_query) | ||
return { | ||
"title": i18n.localstr("Search {0} for '{1}'".format(name, search_query)), | ||
"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)) |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.