Created
May 23, 2013 04:48
-
-
Save ana-balica/5632803 to your computer and use it in GitHub Desktop.
Pictalicious - a Chrome Extension for determining the best colors to use with an image via Pictaculous (http://www.pictaculous.com/).
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
{ | |
"manifest_version": 2, | |
"name": "Pictalicious", | |
"description": "Get the perfect pallete right from this webpage picture. Pictaculous knows what colors to use with an image.", | |
"version": "1.0", | |
"permissions": [ | |
"<all_urls>" | |
], | |
"browser_action": { | |
"default_icon": "icon.png", | |
"default_popup": "popup.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
<!doctype html> | |
<html> | |
<head> | |
<title>Picture Pictaculous</title> | |
<style type="text/css"> | |
body{min-width:400px; min-height:300px; overflow-x:hidden;} | |
</style> | |
<script src="jquery-1.9.1.min.js"></script> | |
<script src="script.js"></script> | |
</head> | |
<body> | |
<button type="button">Click here!</button> | |
</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
$(document).ready(function() { | |
$("button").click(function(e) { | |
c('button clicked'); | |
file = "http://www.vectorstock.com/i/composite/56,72/sleeping-kitten-vector-95672.jpg"; | |
file_reader = new FileReader(); | |
var data = file_reader.readAsArrayBuffer(file); | |
c(data); | |
// $.ajax({ | |
// type: "POST", | |
// url: "http://pictaculous.com/api/1.0/", | |
// data: {"image": "http://www.vectorstock.com/i/composite/56,72/sleeping-kitten-vector-95672.jpg"}, | |
// contentType: "image/jpeg", | |
// processData: false | |
// }).success(function(data) { | |
// c(data); | |
// }); | |
}); | |
}); | |
function download_image(url) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', url, true); | |
xhr.responseType = 'blob'; | |
xhr.onload = function(e) { | |
if (this.status == 200) { | |
var blob = new Blob([this.response], {type: 'image/png'}); | |
} | |
}; | |
xhr.send(); | |
} | |
function c(val) { | |
console.log(val); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment