|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
// ==UserScript==
// @name SpongeForum Video Fix
// @namespace SpongeForum
// @version 1.0
// @description Fix for the broken video embeds on SpongeForum.de
// @author Reschif der fette
// @grant none
// ==/UserScript==
(function() {
'use strict';
if (window.location.hostname === 'spongeforum.de') {
document.querySelectorAll('iframe.videoBBCodeObject.youtube-player').forEach((iframe) => {
const youtubeId = iframe.src.match(/youtube\.com\/embed\/([a-zA-Z0-9_-]+)/)[1];
const newEmbed = document.createElement('iframe');
newEmbed.src = `https://www.youtube.com/embed/${youtubeId}`;
newEmbed.width = "400";
newEmbed.height = "315";
newEmbed.classList.add('videoBBCodeObject', 'youtube-player');
iframe.parentNode.replaceChild(newEmbed, iframe);
});
}
})();
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
{
"manifest_version": 3,
"name": "SpongeForum Video Fix",
"version": "1.0",
"permissions": ["activeTab", "tabs"],
"host_permissions": ["*://*/*"],
"background": {
"service_worker": "background.js"
},
"content_scripts": [
{
"matches": ["*://spongeforum.de/*"],
"js": ["content.js"]
}
]
}
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 |
chrome.runtime.onInstalled.addListener(function() {
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if (tab.url && tab.url.includes('spongeforum.de')) {
chrome.action.enable(tabId);
} else {
chrome.action.disable(tabId);
}
});
});
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
window.onload = function() {
var videoPlayers = Array.from(document.getElementsByClassName('videoBBCodeObject youtube-player'));
for (var i = 0; i < videoPlayers.length; i++) {
var videoURL = videoPlayers[i].src;
var youtubeIndex = videoURL.indexOf('youtube.com/embed/');
if (youtubeIndex !== -1) {
var videoId = videoURL.slice(youtubeIndex + 18, youtubeIndex + 29);
var newVideoEmbed = document.createElement('iframe');
newVideoEmbed.setAttribute('src', 'https://www.youtube.com/embed/' + videoId);
newVideoEmbed.setAttribute('frameborder', '0');
newVideoEmbed.setAttribute('allow', 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture');
newVideoEmbed.setAttribute('allowfullscreen', '');
// Set the size of the player
newVideoEmbed.style.width = '400px';
newVideoEmbed.style.height = '315px';
// Replace the old iframe with the new one
var parent = videoPlayers[i].parentNode;
parent.replaceChild(newVideoEmbed, videoPlayers[i]);
}
}
};
|
Benutzerinformationen überspringen
Dabei seit: 27. Juli 2013
Beruf: Prof. Dr. Schläck, studierte in Oxford Sozialwissenschaften
Kauf dir lieber ’n Strick und erschieß dich! Benutzerinformationen überspringen
Dabei seit: 27. Juli 2013
Beruf: Prof. Dr. Schläck, studierte in Oxford Sozialwissenschaften
Kauf dir lieber ’n Strick und erschieß dich! hab einfach mal chatgpt gebeten das image-script so zu erweitern dass große bilder automatisch auf eine bestimmte breite verkleinert werden. Ist bestimmt nicht optimal gecoded, aber whatever, ich kenn mich mit der materie nicht aus und es funktioniert zumindestens http://bikinibottom.de/s/i8qrW.gif
Spoiler
![]()
Quellcode
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62// ==UserScript== // @name Spongeforum-Image-Inliner // @namespace spongeforum // @description Display linked images inline and resize them to a width of 850 pixels if their width is larger // @include http://spongeforum.de* // ==/UserScript== var processedImages = false; function addListener(obj, eventName, listener) { if (obj.addEventListener) { obj.addEventListener(eventName, listener, false); } else { obj.attachEvent("on" + eventName, listener); } } function resizeImageIfNeeded(img) { var maxWidth = 850; var currentWidth = img.width; if (currentWidth > maxWidth) { img.style.maxWidth = maxWidth + "px"; img.style.width = "100%"; } } function LocalMain() { if (processedImages) { return; } processedImages = true; var imageLinks = document.evaluate( "//a[@class='image']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null ); var imageCount = imageLinks.snapshotLength; for (var i = 0; i < imageCount; i++) { var item = imageLinks.snapshotItem(i); var url = item.getAttribute('href'); var img = document.createElement('img'); img.setAttribute('src', url); img.setAttribute('class', 'resizeImage'); // Resize the image if its width is larger than 850 pixels img.onload = function() { resizeImageIfNeeded(this); }; item.parentNode.replaceChild(img, item); } } addListener(document, "DOMContentLoaded", LocalMain); addListener(window, "load", LocalMain);
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
// ==UserScript==
// @name Spongeforum-Image-Inliner
// @namespace spongeforum
// @description Display linked images inline and resize them to a width of 850 pixels if their width is larger
// @include http://spongeforum.de*
// ==/UserScript==
var processedImages = false;
function addListener(obj, eventName, listener) {
if (obj.addEventListener) {
obj.addEventListener(eventName, listener, false);
} else {
obj.attachEvent("on" + eventName, listener);
}
}
function resizeImageIfNeeded(img) {
var maxWidth;
if (img.parentNode.classList.contains('quoteBody')) {
maxWidth = 200;
}else{
maxWidth = 850;
}
var currentWidth = img.width;
if (currentWidth > maxWidth) {
img.style.maxWidth = maxWidth + "px";
img.style.width = "100%";
}
}
function LocalMain() {
if (processedImages) {
return;
}
processedImages = true;
var imageLinks = document.evaluate(
"//a[@class='image']",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null
);
var imageCount = imageLinks.snapshotLength;
for (var i = 0; i < imageCount; i++) {
var item = imageLinks.snapshotItem(i);
var url = item.getAttribute('href');
var img = document.createElement('img');
img.setAttribute('src', url);
img.setAttribute('class', 'resizeImage');
// Resize the image if its width is larger than 850 pixels
img.onload = function() {
resizeImageIfNeeded(this);
};
item.parentNode.replaceChild(img, item);
}
}
addListener(document, "DOMContentLoaded", LocalMain);
addListener(window, "load", LocalMain);
|
Keine Ahnung, woran es liegt. Vielleicht kollidiert ein anderes Add-on damit. |
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
{
"manifest_version": 3,
"name": "SpongeForum - Online-Liste deaktivieren komplett",
"version": "2.0",
"description": "Deaktiviert den Link auf der Startseite und blendet die UsersOnline-Seite sofort aus.",
"content_scripts": [
{
"matches": ["*://spongeforum.de/*"],
"js": ["remove-online.js"],
"css": ["remove-online.css"],
"run_at": "document_start"
}
]
}
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
function removeOnlineElements() {
// UsersOnline-Seite: komplette Tabelle + Container entfernen
if (window.location.href.includes("index.php?page=UsersOnline")) {
document.querySelectorAll(".border.borderMarginRemove, table.tableList").forEach(el => el.remove());
}
}
// MutationObserver nur starten, wenn body existiert
function startObserver() {
if (!document.body) {
// Wenn body noch nicht existiert, erneut in 50ms prüfen
setTimeout(startObserver, 50);
return;
}
const observer = new MutationObserver(removeOnlineElements);
observer.observe(document.body, { childList: true, subtree: true });
}
// sofort ausführen
removeOnlineElements();
startObserver();
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 |
/* UsersOnline-Container sofort ausblenden */
.userOnline {
display: none !important;
}
/* Link auf Startseite deaktivieren, Unterstreichung weg */
a[href*="index.php?page=UsersOnline"] {
pointer-events: none !important;
text-decoration: none !important;
color: inherit !important;
}
|

|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
{
"manifest_version": 3,
"name": "SpongeForum Nickname Changer - CSS Blocker",
"version": "3.0",
"description": "Ersetzt den Namen 'Scheißhaufen' durch 'Krosso'. Nutzt CSS für sofortiges Anti-Flackern.",
"content_scripts": [
{
"matches": ["*://spongeforum.de/*", "*://www.spongeforum.de/*"],
"css": ["styles.css"],
"run_at": "document_start"
},
{
"matches": ["*://spongeforum.de/*", "*://www.spongeforum.de/*"],
"js": ["content.js"],
"run_at": "document_idle"
}
]
}
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
// Konfiguration
const alterName = "Scheißhaufen";
const neuerName = "Krosso";
// Selektor für den Haupt-Content-Bereich zur Begrenzung der initialen Suche
const mainContentSelector = '#main';
// NEU: Selektoren für Elemente, die von der Textersetzung AUSGESCHLOSSEN werden müssen,
// um das Ruckeln beim Like-Zähler zu stoppen (basierend auf deinem HTML).
const EXCLUDE_SELECTORS = [
// 1. Schließt den Like-Stats-Container komplett aus
'.thankStats',
// 2. Schließt den Like-Link selbst aus
'a[id^="thankStatsLink-"]'
];
/**
* Prüft, ob ein Element oder einer seiner Vorfahren von der Ersetzung ausgeschlossen werden muss.
*/
function shouldExcludeNode(node) {
if (node.nodeType !== 1) return false; // Nur Element-Knoten prüfen
for (const selector of EXCLUDE_SELECTORS) {
// Überprüft, ob der aktuelle Knoten dem Ausschluss-Selektor entspricht ODER ob ein Vorfahre ihm entspricht.
if (node.matches(selector) || node.closest(selector)) {
return true;
}
}
return false;
}
/**
* Funktion, die einen DOM-Knoten und seine Kinder rekursiv nach Text durchsucht.
*/
function durchsucheUndErsetzeText(node) {
if (node.nodeType === 3) { // 3 = TEXT_NODE
if (node.nodeValue.includes(alterName)) {
node.nodeValue = node.nodeValue.replace(alterName, neuerName);
}
} else if (node.nodeType === 1) { // 1 = ELEMENT_NODE
// **!!! DER FILTER !!!** Wenn der Knoten ausgeschlossen werden soll, beende die Suche hier.
if (shouldExcludeNode(node)) {
return;
}
const tag = node.tagName.toLowerCase();
// Kritische Elemente (Skripte, Styles, Formulare) überspringen
if (tag === 'script' || tag === 'style' || tag === 'textarea' || tag === 'input') {
return;
}
node.childNodes.forEach(durchsucheUndErsetzeText);
}
}
// ----------------------------------------------------------------------
// NEUE FUNKTIONEN: Gezielte Ersetzung in Attributen und spezifischen WBB-Strukturen
// ----------------------------------------------------------------------
/**
* Ersetzt den Namen in spezifischen HTML-Attributen und Profilüberschriften.
*/
function attributeErsetzen(parentNode) {
const elementsToUpdate = parentNode.querySelectorAll(
// Korrigiert Tooltips, Avatare und Profil-Header
'[title*="' + alterName + '"], ' +
'img[alt*="' + alterName + '"], ' +
'.profileContent > h3, ' +
'.profileContent > h2'
);
elementsToUpdate.forEach(element => {
// Ändert den Title-Text (Tooltip)
if (element.hasAttribute('title')) {
element.title = element.title.replaceAll(alterName, neuerName);
}
if (element.hasAttribute('alt')) {
element.alt = element.alt.replaceAll(alterName, neuerName);
}
// Textuelle Ersetzung für H2 und H3
if (element.tagName.toLowerCase() === 'h3' || element.tagName.toLowerCase() === 'h2') {
element.textContent = element.textContent.replaceAll(alterName, neuerName);
}
});
}
/**
* KORRIGIERT: Korrigiert den Namen in Like-Listen, PN-Benachrichtigungen UND der PN-Übersicht.
*/
function linkTextUndAttributeErsetzen(parentNode) {
// 1. Like-Liste
const likeSelectors = 'div[id^="thankUser-"] > p.smallFont a';
// 2. PN-Benachrichtigungsbox
const pnNotificationSelector = 'div#pmOutstandingNotifications a';
// 3. PN-Übersicht (NEUER SELEKTOR für die Spalte columnAuthor)
const pnListAuthorSelector = '.columnAuthor a';
// Kombinierter Selektor
parentNode.querySelectorAll(`${likeSelectors}, ${pnNotificationSelector}, ${pnListAuthorSelector}`).forEach(userLink => {
// 1. Textinhalt korrigieren (Der sichtbare Name)
if (userLink.textContent.includes(alterName)) {
userLink.textContent = userLink.textContent.replaceAll(alterName, neuerName);
}
// 2. href-Attribut korrigieren (Der Link zur Profilseite)
if (userLink.href && userLink.href.includes(alterName)) {
userLink.href = userLink.href.replaceAll(alterName, neuerName);
}
});
}
// ----------------------------------------------------------------------
// HAUPTAUSFÜHRUNG
// ----------------------------------------------------------------------
// 1. ERSÄTZEN: Aggressive Textersetzung (Original-Logik)
const mainContent = document.querySelector(mainContentSelector);
if (mainContent) {
durchsucheUndErsetzeText(mainContent);
}
// 2. KORRIGIEREN: Gezielte Ersetzung in Attributen und Links (jetzt inkl. PN-Übersicht)
attributeErsetzen(document);
linkTextUndAttributeErsetzen(document); // Funktion umbenannt und erweitert
// Korrektur des globalen Browser-Tab-Titels
if (document.title.includes(alterName)) {
document.title = document.title.replaceAll(alterName, neuerName);
}
// 3. FREIGEBEN: Entfernt die CSS-Blockade aus der styles.css und macht die Seite sichtbar.
document.body.style.setProperty('visibility', 'visible', 'important');
document.body.style.setProperty('opacity', '1', 'important');
// 4. DYNAMISCHE INHALTE: MutationObserver
new MutationObserver(mutations => {
mutations.forEach(mutation => {
if (mutation.type === 'childList') {
mutation.addedNodes.forEach(node => {
// Beschränke die Suche auch bei neuen Knoten.
if (node.nodeType === 1) {
// Führe alle drei Ersetzungstypen auf dem neuen Knoten aus!
durchsucheUndErsetzeText(node);
attributeErsetzen(node);
// Spezieller Aufruf für dynamisch geladene Bereiche (Likes/PNs)
if (node.matches('.thankStats') || node.closest('.thankStats') || node.matches('#pmOutstandingNotifications') || node.closest('#pmOutstandingNotifications') || node.matches('.columnAuthor') || node.closest('.columnAuthor')) {
linkTextUndAttributeErsetzen(node.closest('.thankStats') || node.closest('#pmOutstandingNotifications') || node.closest('.columnAuthor') || node);
} else {
linkTextUndAttributeErsetzen(node);
}
}
});
}
});
}).observe(document.body, {
childList: true,
subtree: true
});
|
|
|
Quellcode |
1 2 3 4 5 |
/* Diese CSS-Regel blockiert das gesamte Seiten-Rendering, bis das JS sie entfernt. */
body {
visibility: hidden !important;
opacity: 0 !important;
}
|
1 Besucher