40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
// ==UserScript==
|
|
// @name CDA - wbijam.pl
|
|
// @namespace Return to Luna Scripts
|
|
// @match https://*.wbijam.pl/*
|
|
// @grant none
|
|
// @version 1.0
|
|
// @author mlunax
|
|
// @description 5/5/2021, 6:58:17 PM
|
|
// @include https://*.wbijam.pl/*
|
|
// @run-at document-body
|
|
// ==/UserScript==
|
|
|
|
const style = document.createElement("style");
|
|
style.innerText = `
|
|
.odtwarzacz_link + button {
|
|
display:none;
|
|
}
|
|
|
|
.odtwarzacz_link:hover + button, .odtwarzacz_link + button:hover {
|
|
display:block;
|
|
}
|
|
`;
|
|
document.head.appendChild(style);
|
|
for (const el of document.querySelectorAll("span.odtwarzacz_link")) {
|
|
const but = document.createElement("button");
|
|
but.innerText = "Gimme CDA link";
|
|
but.onclick = () => {
|
|
const url = el.getAttribute("rel");
|
|
fetch(`https://${document.location.host}/odtwarzacz-${url}.html`).then(e => {
|
|
e.text().then(t => {
|
|
const dom = new DOMParser().parseFromString(t, "text/html");
|
|
const h = dom.querySelector('iframe[src*="cda.pl"]');
|
|
if (h){
|
|
alert(h.src);
|
|
}
|
|
})
|
|
})
|
|
};
|
|
el.parentElement.appendChild(but);
|
|
}
|