Zgodnie z tym co opracował Fenrir dodałem poprawkę na wygląd kolumny z awatarem i postami (jest na prawo). Przetestujcie czy wam to działa to rozwiazanie, bo u mnie wszystko śmiga, a podobno u Fenrira coś szwankuje.
Display MoreCode
- // ==UserScript==
- // @name OGame Forum (Fixed STABLE)
- // @namespace https://forum.pl.ogame.gameforge.com/
- // @version 2.7
- // @author Fenrir and Crysis
- // @match https://forum.pl.ogame.gameforge.com/forum/*
- // @match https://forum.pl.ogame.gameforge.com/forum
- // @match https://board.en.ogame.gameforge.com/*
- // @match https://board.en.ogame.gameforge.com/
- // @grant GM_addStyle
- // @grant GM_xmlhttpRequest
- // @connect forum.pl.ogame.gameforge.com
- // @connect board.en.ogame.gameforge.com
- // @run-at document-end
- // ==/UserScript==
- (function () {
- 'use strict';
- const host = location.hostname;
- const path = location.pathname;
- const isMainPage =
- (host === 'forum.pl.ogame.gameforge.com' && (path === '/forum/' || path === '/forum')) ||
- (host === 'board.en.ogame.gameforge.com' && (path === '/' || path === ''));
- const isSubPage =
- (host === 'forum.pl.ogame.gameforge.com' && path.startsWith('/forum/') && path !== '/forum/') ||
- (host === 'board.en.ogame.gameforge.com' && path.startsWith('/index.php'));
- const homeUrl =
- host === 'board.en.ogame.gameforge.com'
- ? 'https://board.en.ogame.gameforge.com/'
- : 'https://forum.pl.ogame.gameforge.com/forum/';
- /* =========================
- UTIL: SAFE DOM READY
- ========================= */
- function onReady(fn) {
- if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', fn);
- } else {
- fn();
- }
- }
- /* =========================
- MAIN PAGE FIX
- ========================= */
- if (isMainPage) {
- function removeRightSidebar() {
- const sidebar = document.querySelector('.boxesSidebarRight');
- if (sidebar) sidebar.remove();
- }
- function moveSidebar() {
- const sidebar = document.querySelector('#boxesSidebarLeft, .boxesSidebarLeft');
- if (!sidebar) return;
- const parent = sidebar.parentElement;
- if (!parent) return;
- parent.appendChild(sidebar);
- sidebar.style.float = 'right';
- sidebar.style.marginLeft = '10px';
- }
- onReady(() => {
- removeRightSidebar();
- moveSidebar();
- });
- // retry (dla wolnych urządzeń / lazy load)
- setTimeout(removeRightSidebar, 1000);
- setTimeout(moveSidebar, 1200);
- }
- /* =========================
- SUB PAGE FIX (STABLE)
- ========================= */
- if (isSubPage) {
- GM_addStyle(`
- .injected-home-sidebar .box {
- margin: 0 0 10px 0 !important;
- }
- .injected-home-sidebar .box[data-box-identifier="com.woltlab.wcf.SignedInAs"] {
- margin-top: 0 !important;
- padding-top: 0 !important;
- }
- .injected-home-sidebar .box:first-child {
- margin-top: 0 !important;
- }
- .boxesSidebarRight .boxContainer {
- display: flex;
- flex-direction: column;
- align-items: stretch;
- }
- /* HARD BLOCK reklamy */
- .injected-home-sidebar [data-box-identifier="com.woltlab.wcf.genericBox23"],
- .boxesSidebarRight [data-box-identifier="com.woltlab.wcf.genericBox23"] {
- display: none !important;
- }
- `);
- function inject() {
- const rightSidebar = document.querySelector('.boxesSidebarRight');
- if (!rightSidebar) return false;
- const target = rightSidebar.querySelector('.boxContainer');
- if (!target) return false;
- if (target.dataset.injected === "1") return true;
- GM_xmlhttpRequest({
- method: 'GET',
- url: homeUrl,
- onload: function (resp) {
- try {
- const doc = new DOMParser().parseFromString(resp.responseText, 'text/html');
- const srcSidebar = doc.querySelector('.boxesSidebarLeft');
- if (!srcSidebar) return;
- const boxContainer = srcSidebar.querySelector('.boxContainer');
- if (!boxContainer) return;
- const boxes = Array.from(boxContainer.querySelectorAll(':scope > .box'));
- boxes.forEach(box => {
- target.appendChild(box.cloneNode(true));
- });
- target.dataset.injected = "1";
- } catch (e) {
- console.error('Injection error:', e);
- }
- },
- onerror: function () {
- console.error('GM_xmlhttpRequest failed');
- }
- });
- return true;
- }
- function waitAndInject(retries = 10) {
- if (inject()) return;
- if (retries > 0) {
- setTimeout(() => waitAndInject(retries - 1), 300);
- }
- }
- onReady(() => {
- waitAndInject();
- });
- }
- })();
Może ostatecznie podepne najlepsze i stabilne rozwiazanie do posta 1
Wszystko na pierwszy rzut oka działa jak powinno.






