-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ec892d8
Showing
4 changed files
with
117 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
build/ |
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,63 @@ | ||
var gui = require('nw.gui'); | ||
var win = gui.Window.get(); | ||
|
||
var nativeMenuBar = new gui.Menu({ type: "menubar" }); | ||
nativeMenuBar.createMacBuiltin("Hot Gif"); | ||
win.menu = nativeMenuBar; | ||
|
||
var clipboard = gui.Clipboard.get(); | ||
|
||
//win.showDevTools(); | ||
|
||
|
||
var api_key="dc6zaTOxFJmzC"; | ||
var translate_endpoint="http://api.giphy.com"; | ||
var api_version="v1"; | ||
|
||
//Hotkey Stuff | ||
var option = { | ||
key : "Ctrl+Alt+G", | ||
active : function() { | ||
win.show(); | ||
win.focus(); | ||
$("#s").focus(); | ||
}, | ||
failed : function(msg) { | ||
console.log(msg); | ||
} | ||
}; | ||
|
||
var shortcut = new gui.Shortcut(option); | ||
|
||
|
||
gui.App.registerGlobalHotKey(shortcut); | ||
|
||
|
||
$(document).on("ready", function() | ||
{ | ||
$("#search").on("click", function() | ||
{ | ||
search(); | ||
}); | ||
$("#s").keyup(function (e) | ||
{ | ||
if (e.keyCode == 13) | ||
{ | ||
search(); | ||
} | ||
}); | ||
}); | ||
|
||
function search() | ||
{ | ||
keyword=$("#s").val(); | ||
$("#s").val(""); | ||
win.hide(); | ||
url=translate_endpoint+"/"+api_version+"/gifs/translate?s=" + keyword + "&api_key=" + api_key; | ||
|
||
$.ajax({type: "GET",url: url }).done(function(res) | ||
{ | ||
clipboard.set(res.data.images.original.url, 'text'); | ||
}); | ||
|
||
} |
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,39 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Hot Gif</title> | ||
|
||
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> | ||
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script> | ||
|
||
<script src="app.js"></script> | ||
|
||
<style type="text/css"> | ||
body | ||
{ | ||
font-size:48px; | ||
background-color: #FF69B4; | ||
color: #FFF; | ||
margin: 0px; | ||
padding: 0px; | ||
overflow:hidden; | ||
|
||
} | ||
input | ||
{ | ||
border: 0; | ||
color: #FFF; | ||
background-color: #FF69B4; | ||
font-size:48px; | ||
width: 500px; | ||
text-align:center; | ||
outline: none; | ||
} | ||
|
||
</style> | ||
|
||
</head> | ||
<body> | ||
<input type="text" id="s"> | ||
</body> | ||
</html> |
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,13 @@ | ||
{ | ||
"name": "Hot Gif", | ||
"main": "index.html", | ||
"version": "0.0.1", | ||
"name": "Hot Gif", | ||
"window": { | ||
"title": "Hot Gif", | ||
"toolbar": false, | ||
"frame": false, | ||
"width": 500, | ||
"height": 60 | ||
} | ||
} |