-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths.js
48 lines (36 loc) · 1.65 KB
/
s.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
// this save url for all parts
let urlForShor;
// PART - 1 GENERATING QR CODE 🧨
let url
chrome.tabs.query({ currentWindow: true, active: true }, function (tabs) {
url = `https://api.qrserver.com/v1/create-qr-code/?data=${tabs[0].url}&size=100x100`;
urlForShor = tabs[0].url
document.getElementById("qr").src = url;
})
// PART - 2 LINK SHORTNING🧨
var link = document.getElementById('linkshort');
link.addEventListener('click', async function () {
link.innerText = "loding.."
const data = await (await fetch(` https://tinyurl.com/api-create.php?url=${urlForShor}`)).text();
await navigator.clipboard.writeText(data);
link.innerText = await "Copied To ClipBoard";
});
// PART - 3 FULL SCREEN SCREENSHOT🧨
var screenButton = document.getElementById('ScreenShot');
screenButton.addEventListener('click', async function () {
// console.log("clicked");
screenButton.innerText = "loding.."
await chrome.downloads.download({ url: `https://screenshot.abstractapi.com/v1/?api_key=95533e4b0c394bb0b3b2ee7032e3f03c&url=${urlForShor}`, filename: "fullScreenshot.png", saveAs: true });
screenButton.innerText = await "Saving";
console.log("hi data");
});
//part 4 saving qr code
let qrsave = document.getElementById('QRbutton1');
qrsave.addEventListener('click', async function () {
// console.log("clicked");
// qrsave.innerText = "saving.."
// await chrome.downloads.download({ url: `https://api.qrserver.com/v1/create-qr-code/?data=${tabs[0].url}&size=100x100`, filename: "QRCode.png", saveAs: true });
// qrsave.innerText = await "Saving";
window.open(url, '_blank');
console.log("hi data");
});