[ home / rules / faq ] [ overboard / sfw / alt ] [ leftypol / edu / labor / siberia / lgbt / latam / hobby / tech / games / anime / music / draw / AKM ] [ meta ] [ wiki / shop / tv / tiktok / twitter / patreon ] [ GET / ref / marx / booru ]

/meta/ - Ruthless criticism of all that exists (in leftypol.org)

Discussions, querries, feedback and complaints about the site and its administration.
Name
Options
Subject
Comment
Flag
File
Embed
Password(For file deletion.)

Not reporting is bourgeois


 

Anyone have a user style to fix picrel. where preformatted text is wrapped prematurely?
It does this because the image is floated and floated items are removed from normal flow.
This is preventing it from being used in the width calculation of the surrounding div.
Tried to fix it for a good chunk of the morning to no avail, but would really like it corrected.
Setting display: flow-root on the image container does something…

https://css-tricks.com/snippets/css/clear-fix/
https://css-tricks.com/display-flow-root/

The closest have gotten so far is wrapping head and body in a div and setting display: -moz-box (whatever that is) together with width: min-content on file. But this breaks posts without preformed text. Very unsatisfying!

// ==UserScript==
// @name         Wrap Post Reply Head and Body
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Wraps the head and body elements of "post-reply" class in a div
// @author       You
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Find all elements with class "post-reply"
    const postReplies = document.querySelectorAll('.reply');

    postReplies.forEach(postReply => {
        // Get the head and body elements inside the post-reply
        const head = postReply.querySelector(':scope > head, :scope > .head');
        const body = postReply.querySelector(':scope > body, :scope > .body');

        if (head || body) {
            // Create a wrapper div
            const wrapper = document.createElement('div');
            wrapper.className = 'post-reply-wrapper';

            // Wrap the head and body elements
            if (head) {
                wrapper.appendChild(head.cloneNode(true));
                head.remove();
            }
            if (body) {
                wrapper.appendChild(body.cloneNode(true));
                body.remove();
            }

            // Insert the wrapper into the post-reply
            postReply.appendChild(wrapper);
        }
    });

    console.log('Post reply head and body elements wrapped successfully!');
})();

>>41420
display: flex works even a little better, but it seems like am not going to be able to complete this.

>>41422
Here's the state of this userstyle. It's not great, but most of what's necessary are small margin adjustments and moving the mentions outside of the head. The one thing can't figure out it seems it how to make multifile take up the full width of the flexbox.
.post-reply-wrapper { 
  display: flex;
}

.file {
  width: fit-content;
}

.fileinfo {
  width: min-content;
}

.multifile {
 flex: 1;
}

>>41458
You'll notice even still it's wrapping too early, so…


Unique IPs: 2

[Return][Go to top] [Catalog] | [Home][Post a Reply]
Delete Post [ ]
[ home / rules / faq ] [ overboard / sfw / alt ] [ leftypol / edu / labor / siberia / lgbt / latam / hobby / tech / games / anime / music / draw / AKM ] [ meta ] [ wiki / shop / tv / tiktok / twitter / patreon ] [ GET / ref / marx / booru ]