mirror of
https://github.com/tubearchivist/browser-extension.git
synced 2024-11-22 19:50:12 +00:00
move currentLocation into event listener
This commit is contained in:
parent
b34d8a822c
commit
030fb2d223
@ -122,16 +122,17 @@ function buildButtonDiv() {
|
|||||||
|
|
||||||
function buildSubLink(channelContainer) {
|
function buildSubLink(channelContainer) {
|
||||||
var subLink = document.createElement("span");
|
var subLink = document.createElement("span");
|
||||||
var currentLocation = window.location.href;
|
|
||||||
subLink.innerText = "Subscribe";
|
subLink.innerText = "Subscribe";
|
||||||
subLink.addEventListener('click', e => {
|
subLink.addEventListener('click', e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
var currentLocation = window.location.href;
|
||||||
console.log("subscribe to: " + currentLocation);
|
console.log("subscribe to: " + currentLocation);
|
||||||
sendUrl(currentLocation, "subscribe", subLink);
|
sendUrl(currentLocation, "subscribe", subLink);
|
||||||
});
|
});
|
||||||
subLink.addEventListener("mouseover", e => {
|
subLink.addEventListener("mouseover", e => {
|
||||||
let subText
|
let subText
|
||||||
if (window.location.pathname == "/watch") {
|
if (window.location.pathname == "/watch") {
|
||||||
|
var currentLocation = window.location.href;
|
||||||
subText = currentLocation;
|
subText = currentLocation;
|
||||||
} else {
|
} else {
|
||||||
subText = channelContainer.querySelector("#text").textContent;
|
subText = channelContainer.querySelector("#text").textContent;
|
||||||
@ -156,17 +157,18 @@ function buildSpacer() {
|
|||||||
|
|
||||||
function buildDlLink(channelContainer) {
|
function buildDlLink(channelContainer) {
|
||||||
var dlLink = document.createElement("span");
|
var dlLink = document.createElement("span");
|
||||||
var currentLocation = window.location.href;
|
|
||||||
dlLink.innerHTML = downloadIcon;
|
dlLink.innerHTML = downloadIcon;
|
||||||
|
|
||||||
dlLink.addEventListener('click', e => {
|
dlLink.addEventListener('click', e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
var currentLocation = window.location.href;
|
||||||
console.log("download: " + currentLocation)
|
console.log("download: " + currentLocation)
|
||||||
sendUrl(currentLocation, "download", dlLink);
|
sendUrl(currentLocation, "download", dlLink);
|
||||||
});
|
});
|
||||||
dlLink.addEventListener("mouseover", e => {
|
dlLink.addEventListener("mouseover", e => {
|
||||||
let subText
|
let subText
|
||||||
if (window.location.pathname == "/watch") {
|
if (window.location.pathname == "/watch") {
|
||||||
|
var currentLocation = window.location.href;
|
||||||
subText = currentLocation;
|
subText = currentLocation;
|
||||||
} else {
|
} else {
|
||||||
subText = channelContainer.querySelector("#text").textContent;
|
subText = channelContainer.querySelector("#text").textContent;
|
||||||
@ -366,7 +368,6 @@ const throttle = (callback, time) => {
|
|||||||
if (throttleBlock) return;
|
if (throttleBlock) return;
|
||||||
throttleBlock = true;
|
throttleBlock = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
console.log("observer hit");
|
|
||||||
callback();
|
callback();
|
||||||
throttleBlock = false;
|
throttleBlock = false;
|
||||||
}, time);
|
}, time);
|
||||||
|
Loading…
Reference in New Issue
Block a user