mirror of
https://github.com/greenshot/greenshot
synced 2025-07-15 01:23:47 -07:00
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1602 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
29 lines
752 B
JavaScript
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();});
|