Dual Articles

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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);
})();