-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.html
98 lines (77 loc) · 2.21 KB
/
popup.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<style>
body {
background-color: #222222;
color: #E1E1E1;
font-family: verdana;
font-size: 11px;
}
#screenshot {
border: 2px solid black;
max-width: 640px;
max-height: 480px;
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="jquery.Jcrop.min.js"></script>
<script>
var app_location = "http://localhost/visualmarks/";
var img_data;
var crop_data = "";
var url;
function takeScreenshot()
{
chrome.tabs.captureVisibleTab(null, {"format": "png"}, onScreenCapture );
chrome.tabs.getSelected(null, function(tab){
var tag = document.getElementById("url");
tag.innerHTML = tab.url;
url = tab.url;
});
}
function onScreenCapture(screenshotUrl)
{
img_data = screenshotUrl;
var img = document.getElementById("screenshot");
img.setAttribute("src", img_data);
$('#screenshot').Jcrop({
onSelect: updateCropData,
onChange: updateCropData
});
}
function onSubmit()
{
var post_url = app_location + "submit/chrome";
var data = new Object();
data.img_data = img_data;
data.crop_data = crop_data;
data.url = url;
$.post(post_url, data, onSubmitComplete);
}
function onSubmitComplete(result)
{
// open tab with app.
//var result_location = app_location;
//chrome.tabs.create({ "url": result_location},onResultShowed);
window.close();
}
function onResultShowed(tab)
{
}
function updateCropData(coord)
{
crop_data = coord.x + "," + coord.y + "," + coord.x2 + "," + coord.y2;
}
takeScreenshot();
</script>
<body>
<div>
<img id="screenshot" src="white.png">
</div>
<br />
<div>
<form>
<div>url: <span id="url"></span></div>
<br />
<div>tags: <input type="text" style="width: 500px; padding: 4px;"/> <input type="button" onclick="onSubmit();" value="verzenden" /></div>
</form>
</div>
</body>