first commit

This commit is contained in:
Kian
2026-01-19 21:10:52 -05:00
parent df5072201b
commit d4978a7122
6 changed files with 196 additions and 81 deletions
-24
View File
@@ -1,24 +0,0 @@
function popup(){
alert('hello there this is a test popup');
console.log("hellooooo");
}
function replace_text(){
var x= document.getElementById("ub-tabbed-content-f5da2756-8434-41cd-aa83-ec95a71a9c26-panel-0");
x.innerHTML=js_variable;
}
document.addEventListener("DOMContentLoaded", function () {
popup();
replace_text();
});
+22
View File
@@ -0,0 +1,22 @@
var counter=0;
(function waitForISBN() {
const interval = setInterval(() => {
const isbnEl = document.querySelector(".sp__the-isbn13");
if (!isbnEl){
return;
} // keep waiting
const isbn = isbnEl.textContent.trim();
const link = document.querySelector(".wp-block-image.size-full a");
if (link) {
link.href = `https://cdcshoppingcart.uchicago.edu/Cart2/ChicagoBook?ISBN=${isbn}&PRESS=wvp`;
console.log("Cart link updated:", isbn);
}
clearInterval(interval); // stop checking once done
}, 100); // check every 100ms
})();
+23
View File
@@ -0,0 +1,23 @@
(function waitForBookWrappers(imageUrl) {
const interval = setInterval(() => {
const bookWrappers = document.querySelectorAll(".book-wrapper");
if (bookWrappers.length === 0) return;
bookWrappers.forEach(wrapper => {
const coverLink = wrapper.querySelector(".sp__the-cover a");
if (!coverLink || wrapper.querySelector(".shop_link")) return;
const hrefParts = coverLink.getAttribute("href").split("/");
const isbn = hrefParts[1];
const shopLink = document.createElement("p");
shopLink.innerHTML = `<a class="shop_link" href="https://cdcshoppingcart.uchicago.edu/Cart2/ChicagoBook?ISBN=${isbn}&PRESS=wvp" target="_blank">
<img src="${imageUrl}" alt="Shop Link">
</a>`;
wrapper.appendChild(shopLink);
});
clearInterval(interval);
}, 100);
})(window.searchShopLinkImageUrl); // Pass URL dynamically