-
Notifications
You must be signed in to change notification settings - Fork 2
/
popup.js
74 lines (56 loc) · 1.75 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
$(document).ready(function(){
console.log('enter ready'+$(document).find("title").text());
//console.log('Link '+window.location.href);
chrome.tabs.query({
active: true,
lastFocusedWindow: true
}, function(tabs) {
// and use that tab to fill in out title and url
var tab = tabs[0];
//console.log(tab.url);
var title = tab.title;
//console.log('title:'+title);
document.getElementById("LinkTextarea").value = title+' : '+tab.url;
});
});
document.addEventListener('DOMContentLoaded', () => {
var Copybutton = document.getElementById('Copybutton');
Copybutton.addEventListener('click', function() {
CopyFunction();
});
});
function CopyFunction(){
console.log('copy enter ****');
var copyFrom = $('<textarea/>');
copyFrom.text(document.getElementById("LinkTextarea").value);
$('body').append(copyFrom);
copyFrom.select();
document.execCommand('copy');
copyFrom.remove();
document.getElementById("TooltipId").style.display = "";
setTimeout(function () {
document.getElementById("TooltipId").style.display = "none";
}, 1000);
/*
var copyText = document.getElementById("LinkTextarea").value;
console.log('copyText:'+ copyText );
copyText.select();
document.execCommand("Copy");
console.log('copy!');
*/
}
/*
function CopyFunction() {
chrome.tabs.executeScript({
console.log('copy enter ');
var copyText = document.getElementById("LinkTextarea").value;
console.log('copyText:'+ copyText );
copyText.select();
document.execCommand("Copy");
console.log('copy!');
});
}
*/
/*
document.getElementById('Copybutton').onclick = CopyFunction;*/
//document.getElementById('Copybutton').addEventListener('click', CopyFunction);