Bug 453524 - UserStyle manager
Summary: UserStyle manager
Status: REPORTED
Alias: None
Product: Falkon
Classification: Applications
Component: extensions (other bugs)
Version First Reported In: unspecified
Platform: unspecified Unspecified
: NOR minor
Target Milestone: ---
Assignee: David Rosca
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-08 04:54 UTC by genghiskhan
Modified: 2022-11-20 22:51 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description genghiskhan 2022-05-08 04:54:20 UTC
Please add to Greasemonkey extension ability to manage UserStyles https://userbase.kde.org/Falkon#User_Style

Extension that is both Userscript and userstyle manager https://addons.mozilla.org/en-US/firefox/addon/firemonkey/

Objective
The code requires to manipulate CSS with a UserStyle is shorter, cleaner and easier to read.

Here are a couple of (complex) ways to handle CSS with UserScript

First:

function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
}

We send to this function a one-line stylesheet (not readable) or a multiple lined stylesheet which has the sign \ at end of each line (hardens on cut and paste).

Second:

function hide(property) {
  const div = document.querySelector(property);
        div.style.display = "none"
}

switch (window.location.hostname)

{

    case 'unix.stackexchange.com':
    case 'stackoverflow.com':
      hide('div.js-consent-banner');
    break;

}

The second way, even when has more code, should work on any render engine which makes it even more powerful than a UserStyle.

Still, I find a UserStyle manager a useful extension nonetheless.
As written above, the code requires to manipulate CSS with a UserStyle is shorter, cleaner and easier to read.
Comment 1 Rigoberto Leyva Salmeron 2022-11-20 22:51:52 UTC
This would be a great addition to Falkon