greenshot/GreenshotNetworkImportPlugin/Browser-Plugins/Chrome/background.js
RKrom 8d458998a1 Moving back to trunk!
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1602 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
2012-01-24 19:24:36 +00:00

29 lines
752 B
JavaScript

function sendCaptureToGreenshot(dataURL) {
window.console.info('Sending data...');
$.ajax({
cache: false,
type: "POST",
contentType: "image/png;base64",
dataType: "text",
processData: false,
data: dataURL,
url: 'http://localhost:11234',
success : function (text) {
window.console.info('Got: ' + text);
},
error : function () {
alert("Couldn't send capture, please check if Greenshot is running!");
}
});
}
function capture() {
window.console.info('Starting capture');
try {
chrome.tabs.captureVisibleTab(null, {format:'png'}, captureTaken);
} catch(exception) {
alert( exception.toString());
}
}
chrome.browserAction.onClicked.addListener(function(tab) {capture();});