-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
29 lines (28 loc) · 1000 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
$(document).ready(function() {
var div = $('#copies_');
chrome.storage.sync.get(['copyTracker','limit'], function(result) {
//To update The limit int the pop up
if(result.limit!=undefined){
$('#limit_show').append(result.limit.toString());
}else{
$('#limit_show').append(10);
}
if(result.copyTracker!=undefined) {
let cps = result.copyTracker;
cps = cps.reverse();
//to show elements according to limit
cps.forEach((copy)=>{
let show = `<h4 class="copy_item">${copy}</h4>`
div.append(show);
})
}
});
//Copy to the Clipboard
$('#copies_').on('click', 'h4', function () {
var $temp = $("<input>");
$("body").append($temp);
$temp.val($(this).text()).select();
document.execCommand("copy");
$temp.remove();
});
});