Dual Articles

1/27/2025, 5:42:58 PM

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

Advertisement:

// ==UserScript==
// @name        Dual Articles
// @namespace   Violentmonkey Scripts
// @match       https://omni.se/*
// @grant       none
// @version     1.0
// @author      divergent001911
// @description 1/27/2025, 5:42:58 PM
// @license     MIT 
// ==/UserScript==

(function() {
    'use strict';

    function applyStyles(feed) {
        feed.style.maxWidth = '1200px';
        feed.style.display = 'flex';
        feed.style.flexWrap = 'wrap';
        feed.style.gap = '12px';
        feed.style.padding = '10px 0';
        feed.style.flexDirection = 'row';
        feed.style.justifyContent = 'center';

        const children = feed.querySelectorAll(':scope > div');
        children.forEach(child => {
            child.style.minWidth = '320px';
            child.style.maxWidth = '600px';
            child.style.flex = '1 1 480px';
            child.style.boxSizing = 'border-box';
            child.style.width = 'min(600px, calc(100vw - 40px))';
        });
    }

    function observeFeeds() {
        const feeds = document.querySelectorAll('[class^="Feed_feed__"]');
        feeds.forEach(feed => {
            applyStyles(feed);
            const observer = new MutationObserver(() => applyStyles(feed));
            observer.observe(feed, { childList: true, subtree: false });
        });
    }

    window.addEventListener('load', observeFeeds);
})();