From 19cb309d58e3311c839ff2e69d212c135e9d0136 Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Sat, 13 Jun 2020 17:02:20 +1000 Subject: [PATCH] Added lukes button and made good --- manifest.json | 2 +- test.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index a5bc695..c34fdd9 100644 --- a/manifest.json +++ b/manifest.json @@ -13,7 +13,7 @@ }, "content_scripts": [ { - "matches": ["*://*.youtube.com/*"], + "matches": ["*://*.youtube.com/*", "*://*.youtu.be/*"], "js": ["test.js"] } ], diff --git a/test.js b/test.js index 43d40f0..39007f6 100644 --- a/test.js +++ b/test.js @@ -2,6 +2,8 @@ function getTime() { // Youtube can get fucked, this is the worst way I can get this to work -_- // console.log("Why does this not fucking work"); let url = window.location.href; + url = url.split("&t")[0]; + url = url.split("&start")[0]; let d = document.querySelector(".video-stream"); return url + "&t=" + Math.ceil(d.currentTime); } @@ -30,7 +32,7 @@ function postURL(url) { .catch((err) => console.log(err)); } -ele = document.createElement("p"); +ele = document.createElement("button"); text = document.createTextNode("Save Timestamp"); ele.addEventListener("click", () => postURL(getTime())); ele.appendChild(text);