23 lines
582 B
JavaScript
23 lines
582 B
JavaScript
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
|
|
})();
|