Dual Articles

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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