-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
84 lines (55 loc) · 1.81 KB
/
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
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
var text="untaged";
$(function() {
var list = $('.js-dropdown-list');
var link = $('.js-link');
link.click(function(e) {
e.preventDefault();
list.slideToggle(200);
});
list.find('li').click(function() {
text = $(this).html();
var icon = '<i class="fa fa-chevron-down"></i>';
link.html(text+icon);
list.slideToggle(200);
});
});
$(document).ready(function(){
chrome.tabs.query({currentWindow: true,active: true},function(tabs){
$("#title").val(tabs[0].title);
$("#url").val(tabs[0].url);
});
});
$(document).ready(function(){
$("#sub").click(function(){
/* var table = document.getElementById("bookmarks");
var row = table.insertRow(0);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
var cell3 = row.insertCell(2);
// Add some text to the new cells:
cell1.innerHTML = $('#title').val();
cell2.innerHTML = 1;
cell3.innerHTML = Date();*/
var url = $('#url').val();
var title = $('#title').val();
var tag = text;
if( !url.includes("http://") && !url.includes("https://") )
{ url = "http://" + String(url); }
tag = tag.toUpperCase();
title = String(tag) + " :: " + String(title);
$.ajax({
type:'GET',
url:'https://bookmarks.pythonanywhere.com/add_get',
data:{
'title':title,
'tag':tag,
'ur':url
},
dataType: 'json',
sucess:function(data){
alert(" gf");
},
});
setTimeout(function(){ window.close(); }, 400);
});
});