Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove test points #20

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions contentScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@
}`

const videosLoaded = async () => {
console.log("thisisworking");
const oldestBtnExists = document.getElementById("oldest-btn");

if (!oldestBtnExists) {
setTimeout(function () {
console.log("creating button");
oldestBtn = document.createElement("yt-chip-cloud-chip-renderer");

oldestBtn.className = "style-scope " + "yt-chip-cloud-chip-renderer " + "oldest-btn";
Expand All @@ -51,7 +49,7 @@
text.innerHTML = "Sort by: Oldest";

if (!text) {
console.log("text missing!");
errorHandler("test", "videosLoaded()")
}

if (selected === true) {
Expand All @@ -66,13 +64,13 @@
//watches for "Latest" or "Popular" buttons to be pressed to reinstate the oldest button

if (addbutton) {
console.log("[1][1]in use")
//console.log("[1][1]in use")
latestHandler = document.querySelectorAll("#chips")[1].getElementsByClassName("style-scope ytd-feed-filter-chip-bar-renderer")[0];
latestHandler.addEventListener("click", waitHandler);
popularHandler = document.querySelectorAll("#chips")[1].getElementsByClassName("style-scope ytd-feed-filter-chip-bar-renderer")[1];
popularHandler.addEventListener("click", waitHandler);
} else {
console.log("[0][0]in use")
//console.log("[0][0]in use")
latestHandler = document.querySelectorAll("#chips")[0].getElementsByClassName("style-scope ytd-feed-filter-chip-bar-renderer")[0];
latestHandler.addEventListener("click", waitHandler);
popularHandler = document.querySelectorAll("#chips")[0].getElementsByClassName("style-scope ytd-feed-filter-chip-bar-renderer")[1];
Expand All @@ -81,28 +79,26 @@
};

const waitHandler = async () => {
console.log("timeout set")
setTimeout(function () {
videosLoaded();
}, 500)
}

const scriptStop = async () => {
console.log("script stop");
var styleSheet = document.createElement("style")
styleSheet.innerText = stylesrestore
document.head.appendChild(styleSheet)
};

const returnState = async (stateRequest) => {
if (stateRequest === "latest"){
console.log("state => latest")
//console.log("state => latest")
location.reload();
} else {
location.reload();
setTimeout(function () {
popularHandler.click();
console.log("state => popular")
//console.log("state => popular")
}, 500)
}
};
Expand Down Expand Up @@ -141,7 +137,7 @@
urlString = document.URL;
if ((urlString.includes("videos") || urlString.includes("shorts") || urlString.includes("streams")) == true) {
urlRefresh(urlString);
console.log("string includes videos or shorts")
//console.log("string includes videos or shorts")
if (urlString.includes("videos")) {
location = "videos";
} else if (urlString.includes("shorts")) {
Expand Down Expand Up @@ -194,7 +190,7 @@
ac.innerHTML = numdiv + "/" + videoNum;

if (checkNum == numdiv) {
console.log(videoNum, numdiv);
//console.log(videoNum, numdiv);
videosDiv.style.zIndex = "0";
ac.style.display = "none";
clearInterval(refreshInterval);
Expand Down