-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.js
More file actions
23 lines (20 loc) · 750 Bytes
/
Copy pathpopup.js
File metadata and controls
23 lines (20 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// USER'S MODE
// Get the user's system preference
let prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
// Set the initial mode according to the preference
if (prefersDark) {
document.body.classList.add("dark-mode");
} else {
document.body.classList.add("light-mode");
}
// THE ACTUAL THINGY
document.addEventListener("DOMContentLoaded", () => {
document.getElementById("add-url").addEventListener("click", function () {
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
var currentUrl = tabs[0].url;
var newUrl = "https://readmedium.com/";
var modifiedUrl = newUrl + currentUrl;
chrome.tabs.update(tabs[0].id, { url: modifiedUrl });
});
});
});