-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
32 lines (28 loc) · 774 Bytes
/
popup.js
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
function getCurrentTabUrl(callback) {
var queryInfo = {
active: true,
currentWindow: true
};
chrome.tabs.query(queryInfo, function(tabs) {
var tab = tabs[0];
var url = tab.url;
callback(url);
});
}
function submitForm (url) {
var email = $("#inputEmail").val();
var description = $("#inputDescription").val();
var tags = $('#inputTags').val();
var data = {
'url' : url,
'user_email' : email,
'description' : description,
'tags' : tags
};
$.post( "http://localhost:3000/api/websites", data, function(data) {window.close();});
return true;
}
$().ready(function() {
//$("#buttonSubmit").on("click", function () {window.close();});
$("#buttonSubmit").on("click", function () {getCurrentTabUrl(submitForm)});
});