72 lines
No EOL
2 KiB
JavaScript
72 lines
No EOL
2 KiB
JavaScript
// ==UserScript==
|
|
// @name Xilly - Embed Banner
|
|
// @namespace http://experimenting.website/
|
|
// @description Replaces X banner with any url
|
|
// @version 0.1
|
|
// @author EXPERIMENTING
|
|
// @match https://x.com/main_experiment
|
|
// @grant GM_addElement
|
|
// ==/UserScript==
|
|
|
|
(function() {
|
|
'use strict';
|
|
|
|
function replaceBanner() {
|
|
const bannerLink = document.querySelector('a[href$="/header_photo"]');
|
|
|
|
if (bannerLink) {
|
|
if (bannerLink.dataset.embedBannerReplaced) return;
|
|
|
|
console.log('Twitter Embed Banner: Banner found, replacing...');
|
|
|
|
const container = bannerLink.parentElement;
|
|
|
|
if (container) {
|
|
container.style.paddingBottom = '0';
|
|
container.style.height = 'auto';
|
|
}
|
|
|
|
bannerLink.innerHTML = '';
|
|
bannerLink.dataset.embedBannerReplaced = 'true';
|
|
|
|
bannerLink.removeAttribute('href');
|
|
bannerLink.style.cursor = 'default';
|
|
bannerLink.style.display = 'block';
|
|
bannerLink.style.height = 'auto';
|
|
bannerLink.onclick = (e) => {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
};
|
|
|
|
GM_addElement(bannerLink, 'iframe', {
|
|
src: 'https://webosu.online/', /*CHANGE WHATEVER YOU WANT :3*/
|
|
scrolling: 'yes',
|
|
style: `
|
|
width: 200%;
|
|
height: 200%;
|
|
transform: scale(0.5);
|
|
transform-origin: top left;
|
|
border: none;
|
|
display: flex;
|
|
aspect-ratio: 1500 / 300;
|
|
overflow-x: auto;
|
|
overflow-y: auto;
|
|
`
|
|
});
|
|
|
|
bannerLink.style.overflow = 'hidden';
|
|
}
|
|
}
|
|
|
|
const observer = new MutationObserver((mutations) => {
|
|
replaceBanner();
|
|
});
|
|
|
|
observer.observe(document.body, {
|
|
childList: true,
|
|
subtree: true
|
|
});
|
|
|
|
replaceBanner();
|
|
|
|
})(); |