Skip to content

Commit

Permalink
create Gyazo Ivy Search Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
pastak committed Jul 28, 2015
1 parent dfb8990 commit 5ccaf9c
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 0 deletions.
12 changes: 12 additions & 0 deletions PluginDirectories/1/gyazo-search.bundle/README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Gyazo Search in Spotlight plugin by Flashlight

![Screenshot](https://i.gyazo.com/9a8ffcd84835c1630088579565fb5150.png)

## keyword

- `gyazo <searchword>`
- `gy <searchword>`

### :warning: Note about login

if it shows login page in webview, please login to Gyazo.com with your Safari.
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/gyazo-search.bundle/examples.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gyazo ~keyword(kyoto)
gy ~keyword(lgtm)
Binary file added PluginDirectories/1/gyazo-search.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.
12 changes: 12 additions & 0 deletions PluginDirectories/1/gyazo-search.bundle/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"categories" : [
"Utilities"
],
"displayName" : "Gyazo Search",
"name" : "gyazo-search",
"description" : "",
"examples" : [
"gyazo kyoto",
"gy lgtm"
]
}
Binary file added PluginDirectories/1/gyazo-search.bundle/ninja.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions PluginDirectories/1/gyazo-search.bundle/plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
def results(fields, original_query):
keyword = fields['~keyword']
html = (
open("show.html").read().decode('utf-8')
.replace("<!--KEYWORD-->", keyword)
)
return {
"title": "Gyazo Seach '{0}'".format(keyword.encode('utf-8')),
"run_args": [keyword.encode('utf-8')],
"html": html,
"webview_links_open_in_browser": True
}

def run(message):
import os, pipes
os.system('open "https://gyazo.com/search/{0}"'.format(message.encode('utf8')))
14 changes: 14 additions & 0 deletions PluginDirectories/1/gyazo-search.bundle/show.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<html>
<head>
</head>
<body data-keyword='<!--KEYWORD-->'>
<script>
setTimeout(function () {
var keyword = document.querySelector('body').getAttribute('data-keyword')
window.location = 'https://gyazo.com/search/' + keyword
}, 300)
</script>
<h1 style="font-family: sans-serif;margin-bottom: 5px;"> Searching <!--KEYWORD--> </h1>
<img style="width: 80%; margin: auto;margin-top: 0px;" src="./ninja.png" />
</body>
</html>

0 comments on commit 5ccaf9c

Please sign in to comment.