Jump to content
sakura

Chrome/TamperMonkey for Design

Recommended Posts

For those of you, using TamperMonkey in Chrome, I have created a small script, which, for now, will compact the design just a bit. Feel free to enhance/comment.

 

// ==UserScript==
// @name         [DPE] CSS Overrides
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://en.delphipraxis.net/*
// @exclude      *?do=edit
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // fluid list
    const $ = jQuery;

    $('HEADER .logo').attr('style', 'height: auto;');
    $('HEADER .logo IMG').attr('style', 'margin-bottom: -30px;');
    $('LI.ipsDataItem').attr('style', 'padding: 2px 0');
    $('DIV.ipsDataItem_icon').attr('style', 'padding: 0 10px;');
    $('DIV.ipsDataItem_main').attr('style', 'padding: 0;');
    $('UL.ipsDataItem_stats').attr('style', 'padding: 0 10px 0 0;');

    $('LI.ipsDataItem_unread DIV.ipsDataItem_main A[href*=topic]').each(function() {
        const href = $(this).attr('href');
        if (href.indexOf('?') < 0) $(this).attr('href', href + '?do=getNewComment');
    });

    // thread view
    const ipsPageHeader = $('DIV.ipsPageHeader');
    ipsPageHeader.attr('style', 'padding: 5px;');
    const topicControls = ipsPageHeader.next();
    const topicControlsLinks = topicControls.find('A');
    for (var idx = 0, link; link = topicControlsLinks[idx]; idx++) {
        const div = $('<div class="ipsPos_right ipsResponsive_noFloat ipsResponsive_hidePhone" style="margin-left: 5px;"></div>');
        link.style = 'padding: 5px; line-height: 1.5em;';
        div.append(link);
        ipsPageHeader.prepend(div);
    }
    topicControls.remove();

    $('UL.cAuthorPane_info').attr('style', 'transform: scale(0.6); padding: 0; margin: -40px;');
    $('DIV[data-role="commentContent"]').attr('style', 'padding: 0; font-size: small;');

})();

... 🐈 ...

Edited by sakura
  • Like 2

Share this post


Link to post

I added a little bit to make the code blocks a little bit smaller and the spacing between survey items (See the "Oh my god, I can post code" thread for an example for a survey)

I'm not a javascript/css expert so there might still be room for improvement

// Code
$('PRE.ipsCode').attr('style', 'padding: 5px !important; font-size: small;');

// survey
$(':root').attr('style', '--grid-gap: 0px;');
$('span.ipsFaded').attr('style', 'margin-left: 5px;');

Share this post


Link to post

Added a small tidbit too: 

    // scroll to start of content
    if (window.location.href.indexOf('?do') < 0) $('html,body').animate({scrollTop: $('#elContent').offset().top},'slow');

 

Share this post


Link to post

A 1-liner to slightly highlight the subforum in the fluid list

 

image.png.4634995dbd695ce2b3d2341ef879cb61.png

 

// Highlight subforum in post listing (fluid list)
$('.ipsDataItem_meta > a[href*="?forumId="]').css({ color: '#4D7395' });

 

Edited by Neutral General

Share this post


Link to post
// ==UserScript==
// @name         [DPE] CSS Overrides
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://en.delphipraxis.net/*
// @exclude      *?do=edit
// @exclude      */discover/
// @grant        none
// ==/UserScript==

(function() {
    try{
        'use strict';

        const $ = jQuery;
        const stylesheet = document.styleSheets[document.styleSheets.length - 1];

        // fluid list
        $('HEADER .logo').attr('style', 'height: auto;');
        $('HEADER .logo IMG').attr('style', 'margin-bottom: -30px;');
        $('LI.ipsDataItem').attr('style', 'padding: 2px 0');
        $('DIV.ipsDataItem_icon').attr('style', 'padding: 0 10px;');
        $('DIV.ipsDataItem_main').attr('style', 'padding: 0;');
        $('UL.ipsDataItem_stats').attr('style', 'padding: 0 10px 0 0;');

        $('LI.ipsDataItem_unread DIV.ipsDataItem_main A[href*=topic]').each(function() {
            const href = $(this).attr('href');
            if (href.indexOf('?') < 0) $(this).attr('href', href + '?do=getNewComment');
        });

        // thread view
        const ipsPageHeader = $('DIV.ipsPageHeader');
        ipsPageHeader.attr('style', 'padding: 5px;');
        const topicControls = ipsPageHeader.next();
        const topicControlsLinks = topicControls.find('A');
        for (var idx = 0, link; link = topicControlsLinks[idx]; idx++) {
            const div = $('<div class="ipsPos_right ipsResponsive_noFloat ipsResponsive_hidePhone" style="margin-left: 5px;"></div>');
            link.style = 'padding: 5px; line-height: 1.5em;';
            div.append(link);
            ipsPageHeader.prepend(div);
        }
        topicControls.remove();

        $('UL.cAuthorPane_info').attr('style', 'transform: scale(0.6); padding: 0; margin: -40px;');
        $('DIV[data-role="commentContent"]').attr('style', 'padding: 0; font-size: small;');

        // Code
        $('PRE.ipsCode').attr('style', 'padding: 5px !important; font-size: small;');

        // Survey
        $(':root').attr('style', '--grid-gap: 0px;');
        $('span.ipsFaded').attr('style', 'margin-left: 5px;');

        stylesheet.insertRule('.ipsDataList.ipsDataList_zebra > .ipsDataItem { height: 45px; }');

        // scroll to start of content
        if (window.location.href.indexOf('?do') < 0) $('html,body').animate({scrollTop: $('#elContent').offset().top},'slow');

    }
    catch(e) {
    }
})();

... 🐈 ...

  • Thanks 1

Share this post


Link to post

Since I am using Firefox and not Chrome: Could you please post a screenshot (before / after ?) so I can see what it does?

Share this post


Link to post
4 minutes ago, dummzeuch said:

Since I am using Firefox and not Chrome: Could you please post a screenshot (before / after ?) so I can see what it does?

TamperMonkey is avaliable for FF, too.

Share this post


Link to post

The 2nd screenshot from "Der schöne Günther" isn't really how it looks for me with the script.

I've attached 2 pictures myself. The small search bar on top isn't officially in the script (yet). That's something I'm working on myself.

 

The script also makes the code blocks a little bit more compact and automatically jumps to the newest post even if you don't click on the little icon etc.

 

before.png

after.png

Edited by Neutral General
  • Like 1

Share this post


Link to post

Sorry for my double post. I just wanted to share my own custom version of sakuras script:

At the beginning of the script are a couple constants you can set either to true or false to control which features of the script you want to use.

// ==UserScript==
// @name         [DPE] CSS Overrides
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://en.delphipraxis.net/*
// @exclude      *?do=edit
// @grant        none
// ==/UserScript==

(function() {
    try{
        'use strict';

        // Header
        const enable_compact_banner = true;
        const enable_compact_searchbar = true;

        // thread overview
        const enable_modified_topic_banner = true;
        const enable_compact_fluidlist = true;
        const enable_additional_highlight = true;

        // Threads/Posts
        const enable_small_userinfo = true;
        const enable_compact_comment = true;
        const enable_compact_code = true;
        const enable_compact_survey = true;

        // Other
        const enable_goto_latest_post = true;
        const enable_scroll_to_content = true;

        const $ = jQuery;
        const stylesheet = document.styleSheets[document.styleSheets.length - 1];

        if (enable_compact_banner)
        {
            $('HEADER .logo').attr('style', 'height: auto;');
            $('HEADER .logo IMG').attr('style', 'margin-bottom: -30px;');
        }

        // fluid list
        if (enable_compact_fluidlist)
        {
            $('LI.ipsDataItem').attr('style', 'padding: 2px 0');
            $('DIV.ipsDataItem_icon').attr('style', 'padding: 0 10px;');
            $('DIV.ipsDataItem_main').attr('style', 'padding: 0;');
            $('UL.ipsDataItem_stats').attr('style', 'padding: 0 10px 0 0;');
        }

        if (enable_goto_latest_post)
        {
            $('LI.ipsDataItem_unread DIV.ipsDataItem_main A[href*=topic]').each(function() {
                const href = $(this).attr('href');
                if (href.indexOf('?') < 0) $(this).attr('href', href + '?do=getNewComment');
            });
        }

        if (enable_modified_topic_banner)
        {
            const ipsPageHeader = $('DIV.ipsPageHeader');
            ipsPageHeader.attr('style', 'padding: 5px;');
            const topicControls = ipsPageHeader.next();
            const topicControlsLinks = topicControls.find('A');
            for (var idx = 0, link; link = topicControlsLinks[idx]; idx++) {
                const div = $('<div class="ipsPos_right ipsResponsive_noFloat ipsResponsive_hidePhone" style="margin-left: 5px;"></div>');
                link.style = 'padding: 5px; line-height: 1.5em;';
                div.append(link);
                ipsPageHeader.prepend(div);
            }
            topicControls.remove();
        }

        if (enable_small_userinfo)
        {
            $('UL.cAuthorPane_info').attr('style', 'transform: scale(0.6); padding: 0; margin: -40px;');
        }

        if (enable_compact_comment)
        {
            $('DIV[data-role="commentContent"]').attr('style', 'padding: 0; font-size: small;');
        }

        // Code
        if (enable_compact_code)
        {
            $('PRE.ipsCode').attr('style', 'padding: 5px !important; font-size: small;');
        }

        // Survey
        if (enable_compact_survey)
        {
            $(':root').attr('style', '--grid-gap: 0px;');
            $('span.ipsFaded').attr('style', 'margin-left: 5px;');
        }

        if (enable_additional_highlight)
        {
            // Highlight subforum in post listing (fluid list)
            $('.ipsDataItem_meta > a[href*="?forumId="]').css({ color: '#4D7395' });
            // Highlight user in post listing (fluid list)
            $('.ipsDataItem_meta > span > a[href*="/profile/"]').css({ color: '#4D7395' });
        }

        // Compact search bar
        if (enable_compact_searchbar)
        {
            $('.nav-bar').attr('style', 'height: 30px;');
            $('.secondary-header-align').attr('style', 'height: 30px;');
            $('.ipsNavBar_primary > ul > li > a').attr('style', 'line-height: 30px;');
            $('.ipsfocus-search').attr('style', 'height: 30px; line-height: 30px;');
        }

        stylesheet.insertRule('.ipsDataList.ipsDataList_zebra > .ipsDataItem { height: 45px; }');

        // scroll to start of content
        if (enable_scroll_to_content)
        {
          if (window.location.href.indexOf('?do') < 0)
          {
              $('html,body').animate({scrollTop: $('#elContent').offset().top},'slow');
          }
        }
    }
    catch(e)
    {
        // I don't wanna hear about it
    }
})();

 

Edited by Neutral General
  • Thanks 1

Share this post


Link to post

Don't do that 😛

It's not a perfect solution. The script is open source so if you know how to fix this you're welcome to change stuff 😉 

  • Haha 1

Share this post


Link to post

@Neutral General  Is it really supposed to look like this? t is a bit too condensed for my taste.

script_screenshot.JPG

Edited by toms
  • Haha 1

Share this post


Link to post

@toms What overview is this screenshot from? The script is supposed to be used with the "Fluid" overview.

Can you also give me the url to this view? Maybe I can fix something.

Although as I said: If this is anything other than the fluid view, this script isn't supposed to handle this.

Share this post


Link to post
On 10/26/2018 at 4:47 PM, Neutral General said:

At the beginning of the script are a couple constants you can set either to true or false to control which features of the script you want to use.

I love that compact view!!! Great Job @sakura and @Neutral General

 

BTW: script successful tested with Opera Browser and Tampermonkey.

Edited by KodeZwerg

Share this post


Link to post

I have changed the header, so it only works on the portal page and topic view, but as those are the most important, I think it is for the better, as it does not mess up other pages.

 

// ==UserScript==
// @name         [DPE] CSS Overrides
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://en.delphipraxis.net/
// @match        https://en.delphipraxis.net/topic/*
// @grant        none
// ==/UserScript==

(function() {
    try{
        'use strict';

        // Header
        const enable_compact_banner = true;
        const enable_compact_searchbar = true;

        // thread overview
        const enable_modified_topic_banner = true;
        const enable_compact_fluidlist = true;
        const enable_additional_highlight = true;

        // Threads/Posts
        const enable_small_userinfo = true;
        const enable_compact_comment = true;
        const enable_compact_code = true;
        const enable_compact_survey = true;

        // Other
        const enable_goto_latest_post = true;
        const enable_scroll_to_content = true;

        const $ = jQuery;
        const stylesheet = document.styleSheets[document.styleSheets.length - 1];

        if (enable_compact_banner)
        {
            $('HEADER .logo').attr('style', 'height: auto;');
            $('HEADER .logo IMG').attr('style', 'margin-bottom: -30px;');
        }

        // fluid list
        if (enable_compact_fluidlist)
        {
            $('LI.ipsDataItem').attr('style', 'padding: 2px 0');
            $('DIV.ipsDataItem_icon').attr('style', 'padding: 0 10px;');
            $('DIV.ipsDataItem_main').attr('style', 'padding: 0;');
            $('UL.ipsDataItem_stats').attr('style', 'padding: 0 10px 0 0;');
        }

        if (enable_goto_latest_post)
        {
            $('LI.ipsDataItem_unread DIV.ipsDataItem_main A[href*=topic]').each(function() {
                const href = $(this).attr('href');
                if (href.indexOf('?') < 0) $(this).attr('href', href + '?do=getNewComment');
            });
        }

        if (enable_modified_topic_banner)
        {
            const ipsPageHeader = $('DIV.ipsPageHeader');
            ipsPageHeader.attr('style', 'padding: 5px;');
            const topicControls = ipsPageHeader.next();
            const topicControlsLinks = topicControls.find('A');
            for (var idx = 0, link; link = topicControlsLinks[idx]; idx++) {
                const div = $('<div class="ipsPos_right ipsResponsive_noFloat ipsResponsive_hidePhone" style="margin-left: 5px;"></div>');
                link.style = 'padding: 5px; line-height: 1.5em;';
                div.append(link);
                ipsPageHeader.prepend(div);
            }
            topicControls.remove();
        }

        if (enable_small_userinfo)
        {
            $('UL.cAuthorPane_info').attr('style', 'transform: scale(0.6); padding: 0; margin: -40px;');
        }

        if (enable_compact_comment)
        {
            $('DIV[data-role="commentContent"]').attr('style', 'padding: 0; font-size: small;');
        }

        // Code
        if (enable_compact_code)
        {
            $('PRE.ipsCode').attr('style', 'padding: 5px !important; font-size: small;');
        }

        // Survey
        if (enable_compact_survey)
        {
            $(':root').attr('style', '--grid-gap: 0px;');
            $('span.ipsFaded').attr('style', 'margin-left: 5px;');
        }

        if (enable_additional_highlight)
        {
            // Highlight subforum in post listing (fluid list)
            $('.ipsDataItem_meta > a[href*="?forumId="]').css({ color: '#4D7395' });
            // Highlight user in post listing (fluid list)
            $('.ipsDataItem_meta > span > a[href*="/profile/"]').css({ color: '#4D7395' });
        }

        // Compact search bar
        if (enable_compact_searchbar)
        {
            $('.nav-bar').attr('style', 'height: 30px;');
            $('.secondary-header-align').attr('style', 'height: 30px;');
            $('.ipsNavBar_primary > ul > li > a').attr('style', 'line-height: 30px;');
            $('.ipsfocus-search').attr('style', 'height: 30px; line-height: 30px;');
        }

        stylesheet.insertRule('.ipsDataList.ipsDataList_zebra > .ipsDataItem { height: 45px; }');

        // scroll to start of content
        if (enable_scroll_to_content)
        {
          if (window.location.href.indexOf('?do') < 0)
          {
              $('html,body').animate({scrollTop: $('#elContent').offset().top},'slow');
          }
        }
    }
    catch(e)
    {
        // I don't wanna hear about it
    }
})();

 

Share this post


Link to post

One more, code is folded, however, a toggle is at the top right corner...

 

// ==UserScript==
// @name         [DPE] CSS Overrides
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://en.delphipraxis.net/
// @match        https://en.delphipraxis.net/topic/*
// @grant        none
// ==/UserScript==

(function() {
    try{
        'use strict';

        // Header
        const enable_compact_banner = true;
        const enable_compact_searchbar = true;

        // thread overview
        const enable_modified_topic_banner = true;
        const enable_compact_fluidlist = true;
        const enable_additional_highlight = true;

        // Threads/Posts
        const enable_small_userinfo = true;
        const enable_compact_comment = true;
        const enable_compact_pre = true;
        const enable_compact_code = true;
        const enable_compact_survey = true;

        // Other
        const enable_goto_latest_post = true;
        const enable_scroll_to_content = true;

        const $ = jQuery;
        const stylesheet = document.styleSheets[document.styleSheets.length - 1];

        if (enable_compact_banner)
        {
            $('HEADER .logo').attr('style', 'height: auto;');
            $('HEADER .logo IMG').attr('style', 'margin-bottom: -30px;');
        }

        // fluid list
        if (enable_compact_fluidlist)
        {
            $('LI.ipsDataItem').attr('style', 'padding: 2px 0');
            $('DIV.ipsDataItem_icon').attr('style', 'padding: 0 10px;');
            $('DIV.ipsDataItem_main').attr('style', 'padding: 0;');
            $('UL.ipsDataItem_stats').attr('style', 'padding: 0 10px 0 0;');
        }

        if (enable_goto_latest_post)
        {
            $('LI.ipsDataItem_unread DIV.ipsDataItem_main A[href*=topic]').each(function() {
                const href = $(this).attr('href');
                if (href.indexOf('?') < 0) $(this).attr('href', href + '?do=getNewComment');
            });
        }

        if (enable_modified_topic_banner)
        {
            const ipsPageHeader = $('DIV.ipsPageHeader');
            ipsPageHeader.attr('style', 'padding: 5px;');
            const topicControls = ipsPageHeader.next();
            const topicControlsLinks = topicControls.find('A');
            for (var idx = 0, link; link = topicControlsLinks[idx]; idx++) {
                const div = $('<div class="ipsPos_right ipsResponsive_noFloat ipsResponsive_hidePhone" style="margin-left: 5px;"></div>');
                link.style = 'padding: 5px; line-height: 1.5em;';
                div.append(link);
                ipsPageHeader.prepend(div);
            }
            topicControls.remove();
        }

        if (enable_small_userinfo)
        {
            $('UL.cAuthorPane_info').attr('style', 'transform: scale(0.6); padding: 0; margin: -40px;');
        }

        if (enable_compact_comment)
        {
            $('DIV[data-role="commentContent"]').attr('style', 'padding: 0; font-size: small;');
        }

        // Code
        if (enable_compact_code)
        {
            $('PRE.ipsCode').attr('style', 'padding: 5px !important; font-size: small;');
        }

        if (enable_compact_pre) {
            stylesheet.insertRule('PRE.ipsCode { max-height: 15em; }');
            stylesheet.insertRule('PRE.ipsCode.viewAll { max-height: inherit; }');
            stylesheet.insertRule('.codefold { right: 0; position: absolute !important; margin-right: 3em; }');
            const a = $('<a href="javascript:void(0);" class="codefold" onclick="$(this).parent().toggleClass(\'viewAll\');">open/close</a>');
            $('PRE.ipsCode').prepend(a);
        }

        // Survey
        if (enable_compact_survey)
        {
            $(':root').attr('style', '--grid-gap: 0px;');
            $('span.ipsFaded').attr('style', 'margin-left: 5px;');
        }

        if (enable_additional_highlight)
        {
            // Highlight subforum in post listing (fluid list)
            $('.ipsDataItem_meta > a[href*="?forumId="]').css({ color: '#4D7395' });
            // Highlight user in post listing (fluid list)
            $('.ipsDataItem_meta > span > a[href*="/profile/"]').css({ color: '#4D7395' });
        }

        // Compact search bar
        if (enable_compact_searchbar)
        {
            $('.nav-bar').attr('style', 'height: 30px;');
            $('.secondary-header-align').attr('style', 'height: 30px;');
            $('.ipsNavBar_primary > ul > li > a').attr('style', 'line-height: 30px;');
            $('.ipsfocus-search').attr('style', 'height: 30px; line-height: 30px;');
        }

        stylesheet.insertRule('.ipsDataList.ipsDataList_zebra > .ipsDataItem { height: 45px; }');

        // scroll to start of content
        if (enable_scroll_to_content)
        {
          if (window.location.href.indexOf('?do') < 0)
          {
              $('html,body').animate({scrollTop: $('#elContent').offset().top},'slow');
          }
        }
    }
    catch(e)
    {
        // I don't wanna hear about it
    }
})();

 

Share this post


Link to post

Added Activity Stream:

// ==UserScript==
// @name         [DPE] CSS Overrides
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://en.delphipraxis.net/
// @match        https://en.delphipraxis.net/?*
// @match        https://en.delphipraxis.net/topic/*
// @match        https://en.delphipraxis.net/discover/*
// @grant        none
// ==/UserScript==

(function() {
    try{
        'use strict';

        // Header
        const enable_compact_banner = true;
        const enable_compact_searchbar = true;

        // thread overview
        const enable_modified_topic_banner = true;
        const enable_compact_fluidlist = true;
        const enable_additional_highlight = true;

        // Threads/Posts
        const enable_small_userinfo = true;
        const enable_compact_comment = true;
        const enable_compact_pre = true;
        const enable_compact_code = true;
        const enable_compact_survey = true;

        // Other
        const enable_goto_latest_post = true;
        const enable_scroll_to_content = true;
        const enable_compactDiscover = true;

        const isDiscover = location.href.indexOf('delphipraxis.net/discover') > 0;

        const $ = jQuery;
        const stylesheet = document.styleSheets[document.styleSheets.length - 1];

        if (enable_compact_banner)
        {
            $('HEADER .logo').attr('style', 'height: auto;');
            $('HEADER .logo IMG').attr('style', 'margin-bottom: -30px;');
        }

        // fluid list
        if (enable_compact_fluidlist && !isDiscover)
        {
            $('LI.ipsDataItem').attr('style', 'padding: 2px 0');
            $('DIV.ipsDataItem_icon').attr('style', 'padding: 0 10px;');
            $('DIV.ipsDataItem_main').attr('style', 'padding: 0;');
            $('UL.ipsDataItem_stats').attr('style', 'padding: 0 10px 0 0;');
        }

        if (enable_goto_latest_post)
        {
            $('LI.ipsDataItem_unread DIV.ipsDataItem_main A[href*=topic]').each(function() {
                const href = $(this).attr('href');
                if (href.indexOf('?') < 0) $(this).attr('href', href + '?do=getNewComment');
            });
        }

        if (enable_modified_topic_banner)
        {
            const ipsPageHeader = $('DIV.ipsPageHeader');
            ipsPageHeader.attr('style', 'padding: 5px;');
            if (!isDiscover) {
                const topicControls = ipsPageHeader.next();
                const topicControlsLinks = topicControls.find('A');
                for (var idx = 0, link; link = topicControlsLinks[idx]; idx++) {
                    const div = $('<div class="ipsPos_right ipsResponsive_noFloat ipsResponsive_hidePhone" style="margin-left: 5px;"></div>');
                    link.style = 'padding: 5px; line-height: 1.5em;';
                    div.append(link);
                    ipsPageHeader.prepend(div);
                }
                topicControls.remove();
            }
        }

        if (enable_small_userinfo)
        {
            $('UL.cAuthorPane_info').attr('style', 'transform: scale(0.6); padding: 0; margin: -40px;');
        }

        if (enable_compact_comment && !isDiscover)
        {
            $('DIV[data-role="commentContent"]').attr('style', 'padding: 0; font-size: small;');
        }

        // Code
        if (enable_compact_code && !isDiscover)
        {
            $('PRE.ipsCode').attr('style', 'padding: 5px !important; font-size: small;');
        }

        if (enable_compact_pre) {
            stylesheet.insertRule('PRE.ipsCode { max-height: 15em; }');
            stylesheet.insertRule('PRE.ipsCode.viewAll { max-height: inherit; }');
            stylesheet.insertRule('.codefold { right: 0; position: absolute !important; margin-right: 3em; }');
            const a = $('<a href="javascript:void(0);" class="codefold" onclick="$(this).parent().toggleClass(\'viewAll\');">open/close</a>');
            $('PRE.ipsCode').prepend(a);
        }

        // Survey
        if (enable_compact_survey && !isDiscover)
        {
            $(':root').attr('style', '--grid-gap: 0px;');
            $('span.ipsFaded').attr('style', 'margin-left: 5px;');
        }

        if (enable_additional_highlight)
        {
            // Highlight subforum in post listing (fluid list)
            $('.ipsDataItem_meta > a[href*="?forumId="]').css({ color: '#4D7395' });
            // Highlight user in post listing (fluid list)
            $('.ipsDataItem_meta > span > a[href*="/profile/"]').css({ color: '#4D7395' });
        }

        // Compact search bar
        if (enable_compact_searchbar && !isDiscover)
        {
            $('.nav-bar').attr('style', 'height: 30px;');
            $('.secondary-header-align').attr('style', 'height: 30px;');
            $('.ipsNavBar_primary > ul > li > a').attr('style', 'line-height: 30px;');
            $('.ipsfocus-search').attr('style', 'height: 30px; line-height: 30px;');
        }

        stylesheet.insertRule('.ipsDataList.ipsDataList_zebra > .ipsDataItem { height: 45px; }');

        if (enable_compactDiscover && isDiscover) {
            $('LI.ipsStreamItem').attr('style', 'padding: 2px 10px !important; margin: 0 0 2px 30px !important;');
            $('LI.ipsStreamItem UL.ipsTags').each(function () { $(this).closest('DIV').find('H2').append($(this)); });
        }

        // scroll to start of content
        if (enable_scroll_to_content)
        {
          if (window.location.href.indexOf('?do') < 0)
          {
              $('html,body').animate({scrollTop: $('#elContent').offset().top},'slow');
          }
        }
    }
    catch(e)
    {
        // I don't wanna hear about it
    }
})();

 

... 🐈 ...

 

Fixed for start page after login.

Edited by sakura

Share this post


Link to post
14 minutes ago, sakura said:

... 🐈 ...

515247773_chrome-extension___mfdhdgbonjidekjkjmjaneanmdmpmidf_options_htmlnav16fa232a-4bf3-4e73-a210-37da67e1fb28editorOpera-28_10.jpg.aa303215a575cde87a01733596ae58a8.jpg

Is it normal that it display that line as error?

I mean it works just fine, but show on some lines a red crossed badge and I am to unexperienced to decide if this is right or wrong.

Share this post


Link to post
9 hours ago, KodeZwerg said:

Is it normal that it display that line as error?

 I mean it works just fine, but show on some lines a red crossed badge and I am to unexperienced to decide if this is right or wrong.

The CodeMonkey code editor is not perfect. I can live with that 😉

 

... 🐈 ...

Share this post


Link to post

Dear @sakura, does the "enable_goto_latest_post" feature work on your browser?

My Opera will not jump there, always load page and reside at post #1.

Share this post


Link to post
14 minutes ago, KodeZwerg said:

Dear @sakura, does the "enable_goto_latest_post" feature work on your browser?

My Opera will not jump there, always load page and reside at post #1.

Now it does: 

// ==UserScript==
// @name         [DPE] CSS Overrides
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://en.delphipraxis.net/
// @match        https://en.delphipraxis.net/?*
// @match        https://en.delphipraxis.net/topic/*
// @match        https://en.delphipraxis.net/discover/*
// @grant        none
// ==/UserScript==

(function() {
    try{
        'use strict';

        // Header
        const enable_compact_banner = true;
        const enable_compact_searchbar = true;

        // thread overview
        const enable_modified_topic_banner = true;
        const enable_compact_fluidlist = true;
        const enable_additional_highlight = true;

        // Threads/Posts
        const enable_small_userinfo = true;
        const enable_compact_comment = true;
        const enable_compact_pre = true;
        const enable_compact_code = true;
        const enable_compact_survey = true;

        // Other
        const enable_goto_latest_post = true;
        const enable_scroll_to_content = true;
        const enable_compactDiscover = true;

        const isDiscover = location.href.indexOf('delphipraxis.net/discover') > 0;

        const $ = jQuery;
        const stylesheet = document.styleSheets[document.styleSheets.length - 1];

        if (enable_compact_banner)
        {
            $('HEADER .logo').attr('style', 'height: auto;');
            $('HEADER .logo IMG').attr('style', 'margin-bottom: -30px;');
        }

        // fluid list
        if (enable_compact_fluidlist && !isDiscover)
        {
            $('LI.ipsDataItem').attr('style', 'padding: 2px 0');
            $('DIV.ipsDataItem_icon').attr('style', 'padding: 0 10px;');
            $('DIV.ipsDataItem_main').attr('style', 'padding: 0;');
            $('UL.ipsDataItem_stats').attr('style', 'padding: 0 10px 0 0;');
        }

        if (enable_goto_latest_post)
        {
            $('LI.ipsDataItem_unread DIV.ipsDataItem_main A[href*=topic]').each(function() {
                const href = $(this).attr('href');
                if (href.indexOf('?') < 0) $(this).attr('href', href + '?do=getNewComment');
            });
        }

        if (enable_modified_topic_banner)
        {
            const ipsPageHeader = $('DIV.ipsPageHeader');
            ipsPageHeader.attr('style', 'padding: 5px;');
            if (!isDiscover) {
                const topicControls = ipsPageHeader.next();
                const topicControlsLinks = topicControls.find('A');
                for (var idx = 0, link; link = topicControlsLinks[idx]; idx++) {
                    const div = $('<div class="ipsPos_right ipsResponsive_noFloat ipsResponsive_hidePhone" style="margin-left: 5px;"></div>');
                    link.style = 'padding: 5px; line-height: 1.5em;';
                    div.append(link);
                    ipsPageHeader.prepend(div);
                }
                topicControls.remove();
            }
        }

        if (enable_small_userinfo)
        {
            $('UL.cAuthorPane_info').attr('style', 'transform: scale(0.6); padding: 0; margin: -40px;');
        }

        if (enable_compact_comment && !isDiscover)
        {
            $('DIV[data-role="commentContent"]').attr('style', 'padding: 0; font-size: small;');
        }

        // Code
        if (enable_compact_code && !isDiscover)
        {
            $('PRE.ipsCode').attr('style', 'padding: 5px !important; font-size: small;');
        }

        if (enable_compact_pre) {
            stylesheet.insertRule('PRE.ipsCode { max-height: 15em; }');
            stylesheet.insertRule('PRE.ipsCode.viewAll { max-height: inherit; }');
            stylesheet.insertRule('.codefold { right: 0; position: absolute !important; margin-right: 3em; }');
            const a = $('<a href="javascript:void(0);" class="codefold" onclick="$(this).parent().toggleClass(\'viewAll\');">open/close</a>');
            $('PRE.ipsCode').prepend(a);
        }

        // Survey
        if (enable_compact_survey && !isDiscover)
        {
            $(':root').attr('style', '--grid-gap: 0px;');
            $('span.ipsFaded').attr('style', 'margin-left: 5px;');
        }

        if (enable_additional_highlight)
        {
            // Highlight subforum in post listing (fluid list)
            $('.ipsDataItem_meta > a[href*="?forumId="]').css({ color: '#4D7395' });
            // Highlight user in post listing (fluid list)
            $('.ipsDataItem_meta > span > a[href*="/profile/"]').css({ color: '#4D7395' });
        }

        // Compact search bar
        if (enable_compact_searchbar && !isDiscover)
        {
            $('.nav-bar').attr('style', 'height: 30px;');
            $('.secondary-header-align').attr('style', 'height: 30px;');
            $('.ipsNavBar_primary > ul > li > a').attr('style', 'line-height: 30px;');
            $('.ipsfocus-search').attr('style', 'height: 30px; line-height: 30px;');
        }

        stylesheet.insertRule('.ipsDataList.ipsDataList_zebra > .ipsDataItem { height: 45px; }');

        if (enable_compactDiscover && isDiscover) {
            $('LI.ipsStreamItem').attr('style', 'padding: 2px 10px !important; margin: 0 0 2px 30px !important;');
            $('LI.ipsStreamItem UL.ipsTags').each(function () { $(this).closest('DIV').find('H2').append($(this)); });
        }

        // scroll to start of content
        if (enable_scroll_to_content)
        {
          if ((window.location.href.indexOf('?do') < 0) && window.location.href.indexOf('#') < 0)
          {
              $('html,body').animate({scrollTop: $('#elContent').offset().top},'slow');
          }
        }
    }
    catch(e)
    {
        // I don't wanna hear about it
    }
})();

 

  • Like 1

Share this post


Link to post

Still not working, i just tried with this thread, maby my browser aint capable. Thankyou anyway for try helping me.

Share this post


Link to post

Strange, works fine for me now. Anyways, posting a new topic was broke, so here is another fix. 😄

 

// ==UserScript==
// @name         [DPE] CSS Overrides
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://en.delphipraxis.net/
// @match        https://en.delphipraxis.net/?*
// @match        https://en.delphipraxis.net/topic/*
// @match        https://en.delphipraxis.net/discover/*
// @grant        none
// ==/UserScript==

(function() {
    try{
        'use strict';

        // Header
        const enable_compact_banner = true;
        const enable_compact_searchbar = true;

        // thread overview
        const enable_modified_topic_banner = true;
        const enable_compact_fluidlist = true;
        const enable_additional_highlight = true;

        // Threads/Posts
        const enable_small_userinfo = true;
        const enable_compact_comment = true;
        const enable_compact_pre = true;
        const enable_compact_code = true;
        const enable_compact_survey = true;

        // Other
        const enable_goto_latest_post = true;
        const enable_scroll_to_content = true;
        const enable_compactDiscover = true;

        const isDiscover = location.href.indexOf('delphipraxis.net/discover') > 0;

        const $ = jQuery;
        const stylesheet = document.styleSheets[document.styleSheets.length - 1];

        if (enable_compact_banner)
        {
            $('HEADER .logo').attr('style', 'height: auto;');
            $('HEADER .logo IMG').attr('style', 'margin-bottom: -30px;');
        }

        // fluid list
        if (enable_compact_fluidlist && !isDiscover)
        {
            $('LI.ipsDataItem').attr('style', 'padding: 2px 0');
            $('DIV.ipsDataItem_icon').attr('style', 'padding: 0 10px;');
            $('DIV.ipsDataItem_main').attr('style', 'padding: 0;');
            $('UL.ipsDataItem_stats').attr('style', 'padding: 0 10px 0 0;');
        }

        if (enable_goto_latest_post)
        {
            $('LI.ipsDataItem_unread DIV.ipsDataItem_main A[href*=topic]').each(function() {
                const href = $(this).attr('href');
                if (href.indexOf('?') < 0) $(this).attr('href', href + '?do=getNewComment');
            });
        }

        if (enable_modified_topic_banner)
        {
            const ipsPageHeader = $('DIV.ipsPageHeader');
            ipsPageHeader.attr('style', 'padding: 5px;');
            if (!isDiscover) {
                const topicControls = ipsPageHeader.next();
                const topicControlsLinks = topicControls.find('A');

                for (var idx = 0, link; link = topicControlsLinks[idx]; idx++) {
                    if ($(link).closest('FORM').length > 0) continue;

                    const div = $('<div class="ipsPos_right ipsResponsive_noFloat ipsResponsive_hidePhone" style="margin-left: 5px;"></div>');
                    link.style = 'padding: 5px; line-height: 1.5em;';
                    div.append(link);
                    ipsPageHeader.prepend(div);
                }
            }
        }

        if (enable_small_userinfo)
        {
            $('UL.cAuthorPane_info').attr('style', 'transform: scale(0.6); padding: 0; margin: -40px;');
        }

        if (enable_compact_comment && !isDiscover)
        {
            $('DIV[data-role="commentContent"]').attr('style', 'padding: 0; font-size: small;');
        }

        // Code
        if (enable_compact_code && !isDiscover)
        {
            $('PRE.ipsCode').attr('style', 'padding: 5px !important; font-size: small;');
        }

        if (enable_compact_pre) {
            stylesheet.insertRule('PRE.ipsCode { max-height: 15em; }');
            stylesheet.insertRule('PRE.ipsCode.viewAll { max-height: inherit; }');
            stylesheet.insertRule('.codefold { right: 0; position: absolute !important; margin-right: 3em; }');
            const a = $('<a href="javascript:void(0);" class="codefold" onclick="$(this).parent().toggleClass(\'viewAll\');">open/close</a>');
            $('PRE.ipsCode').prepend(a);
        }

        // Survey
        if (enable_compact_survey && !isDiscover)
        {
            $(':root').attr('style', '--grid-gap: 0px;');
            $('span.ipsFaded').attr('style', 'margin-left: 5px;');
        }

        if (enable_additional_highlight)
        {
            // Highlight subforum in post listing (fluid list)
            $('.ipsDataItem_meta > a[href*="?forumId="]').css({ color: '#4D7395' });
            // Highlight user in post listing (fluid list)
            $('.ipsDataItem_meta > span > a[href*="/profile/"]').css({ color: '#4D7395' });
        }

        // Compact search bar
        if (enable_compact_searchbar && !isDiscover)
        {
            $('.nav-bar').attr('style', 'height: 30px;');
            $('.secondary-header-align').attr('style', 'height: 30px;');
            $('.ipsNavBar_primary > ul > li > a').attr('style', 'line-height: 30px;');
            $('.ipsfocus-search').attr('style', 'height: 30px; line-height: 30px;');
        }

        stylesheet.insertRule('.ipsDataList.ipsDataList_zebra > .ipsDataItem { height: 45px; }');

        if (enable_compactDiscover && isDiscover) {
            $('LI.ipsStreamItem').attr('style', 'padding: 2px 10px !important; margin: 0 0 2px 30px !important;');
            $('LI.ipsStreamItem UL.ipsTags').each(function () { $(this).closest('DIV').find('H2').append($(this)); });
        }

        // scroll to start of content
        if (enable_scroll_to_content)
        {
          if ((window.location.href.indexOf('?do') < 0) && window.location.href.indexOf('#') < 0)
          {
              $('html,body').animate({scrollTop: $('#elContent').offset().top},'slow');
          }
        }
    }
    catch(e)
    {
        // I don't wanna hear about it
    }
})();

 

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×