erosman / support

Support Location for all my extensions
Mozilla Public License 2.0
170 stars 12 forks source link

[not an issue] FireMonkey: Two Simple Questions #90

Closed EstherMoellman closed 4 years ago

EstherMoellman commented 5 years ago

Hi @erosman !

Firstly, your add-on is fantastic! Thank you and congrats. The possibility to have all my CSS and JS scripts in one place, with a lightweight add-on... makes your add-on unbeatable. I discovered FireMonkey today, and I am still learning and testing, but I already love it.

I am not an expert, so please, I have two questions:

1) All my CSS and JS scripts have a delay. At AMO, you answered a similar question by saying: "You need to change the "run-at". By default it injects when everything is fully loaded.". So, I went to "FireMonkey - Help", read about "run-at", and sorry, but I didn't understand how to implement it. It seems I must use "run-at: document_start"... but where, how to use it? In brief, please: How can I make my CSS/JS' scripts to load instantaneously - without any delay? Why the FireMonkey default' mode doesn't do that automatically? For example, I use Dark Theme, and it is very bad to have first original webpage colors (whiteflash) and only then changing to my CSS' dark themes (at Stylus my CSS' scripts apply instantaneously). Same issue with JS' scripts, at FireMonkey they only work 1 or 2 seconds after the webpage loaded... bad. Please, how can I fix it?

2) I can't select/check the "Auto-Update" option. It seems an inactive/dead option. Am I doing something wrong?

Thank you in advance!

EstherMoellman commented 5 years ago

... many of your answers to my thousand questions over the past days, are so important, that in my opinion should be briefed at FireMonkey' AMO page, or at FireMonkey' help page. Sadly my English is bad, and I can't help you here. But lot of infos you shared with me here, I'm sure they will be tremendously useful for future users. It is important to find a place to stress the difference between FireMonkey and similar add-ons (added-values, competitive-differentials etc). Otherwise, many users might wrongly believe that FireMonkey is equal to similar add-ons, and definitely is not!

And I realize you may be very busy with lot of stuff, but in the future also will be nice, if you can have a specific GitHub' repo for FireMonkey.

Well, I'm not sure how I can help you, but count on me! : )

EstherMoellman commented 5 years ago

Hi @erosman !

Finally I'm already 100% on FireMonkey, no other similar add-ons in my Nightly (everything was uninstalled). So, now FireMonkey is for real to me. I've completed my migration, I still have to fix details here and there, but 90% is done, and I solved by myself most of the small issues that appeared. So indeed I can confirm, it was relative easy to migrate to FireMonkey.

Please, if possible, I would like to know if you have some JS' script recommendations for: 1) Global ad-blockers 2) Global anti-trackers 3) Youtube ads 4) Text zoom customization for webpages (text + content) 5) Global Dark Themes

Again, I'm not asking about add-ons, nor CSS' scripts. Please, I would like your help finding JS' scripts.

Thanks in advance! : )

erosman commented 5 years ago

Good job :+1:

I dont use script for what you have mentioned. I use uBlock Origin & uMatrix (the only 2 addons I use that are not written by myself).

EstherMoellman commented 5 years ago

... thanks for answering me. Not urgent, but if by chance you can take a look over these JS' scripts, I'll appreciate your opinion. I couldn't make work none of them at FireMonkey:

1) https://greasyfork.org/en/scripts/27199-remove-youtube-ads-works

2) https://greasyfork.org/en/scripts/40178-youtube-ad-skip

3) https://greasyfork.org/en/scripts/9165-auto-close-youtube-ads

4) https://greasyfork.org/en/scripts/386925-youtube-ad-cleaner-include-non-skippable-ads-works

5) https://greasyfork.org/en/scripts/376772-ad-blocker-for-youtube

6) https://greasyfork.org/en/scripts/376772-ad-blocker-for-youtube/code

7) https://greasyfork.org/en/scripts/375264-youtube-to-invidious

8) https://greasyfork.org/en/scripts/17665-openload

9) This one works in FireMonkey. Please, I would like your opinion. Also, it will be nice to find one redirecting all youtube, including embedded ones: https://greasyfork.org/en/scripts/370461-invidious-redirect

erosman commented 5 years ago

Note: Script ad-remover work after ad is loaded. In other words, the ads have been loaded and user privacy already infringed. It only hides ads from the view. Only extensions can prevent the ads from loading in the first place.

I have a very quick glance at those codes ....

27199-remove-youtube-ads-works
Script uses @require which I have not included its support as it enables remote script injection which is a security risk. This script will not work in FireMonkey. AFA performance, including 700+ function of JQeury for few lines of code that can easily (& better) be written with pure JS, is not efficient. Furthermore, JQuery 1.-2. are not safe and should not be used at all.

40178-youtube-ad-skip No problem in FireMonkey although not very efficient (it reruns every 2.5 seconds)

9165-auto-close-youtube-ads @require wont work in FireMoneky

386925-youtube-ad-cleaner-include-non-skippable-ads-works Should work in FireMoneky

376772-ad-blocker-for-youtube broken

375264-youtube-to-invidious Should work in FireMoneky, needs to change the RegEX

17665-openload Should work in FireMoneky, needs to change the RegEX

EstherMoellman commented 5 years ago

@erosman, I can't describe you how much I learn from you, how useful are your answers... THANK YOU! Thank you for your time and patience with me... believe me, most appreciated!

With regards to your first comment, I used in the past both UMatrix + UBlock until I discovered better options. I never will be back to UMatrix/UBlock (time ago they were my heroes, but today for me they are dinosaurs). We must evolve! A good example of my spirit is FireMonkey! I don't care if FireMonkey demands works, is still under development, is not perfect bla-bla-bla... FireMonkey for me means evolution! Well, same logic applies to ads-tracking-blockers.

Today I use DNSCrypt, which encrypts DNS while blocking tons of garbage at OS level, but without hurting performance. The blocking function is a kind of Pi-Hole (it accepts wildcards) inside the user computer/device (and is portable). So, everything is loaded into RAM (average of 25MB), with very low use of CPU, because garbage is just redirected to a Pi-Hole. It's basically a redirector, super fast and lightweight, not hiding garbage but blocking requests before loading, and redirecting them to a Pi-Hole.

I have been collaborating for months here at GitHub, with other Devs, developing the less ads-tracking-blocker way, with the less negative performance impact. And I tested lot of variants. DNSCrypt is the winner for me.

The problem is that no ads-tracking-blocker is perfect. And always is needed "something else" to complement. My "something else" is an add-on (https://addons.mozilla.org/en-US/firefox/addon/rule-adblocker/), which is extremely lightweight but powerful at the same time. Probably alone this add-on is not enough, but in complement with DNSCrypt... this combo is unbeatable. Sadly this add-on seems to be abandoned. So by myself I copied its REGEXPs' rules, I combined with other REGEXPs' rules, and I tried to build my first JS' script. Of course this was a very kamikaze approach form my side (LOL), considering that I know nothing about REGEXPs and nothing about JS. That's the reason I was exploring new ads-tracking-blocker JS' scripts. And that's the real reason I wanted to know your opinion/recommendations. My real interest was not exactly the JS' scripts I sent you yesterday, but to explore the possibility to build a JS' script for FireMonkey, capable to block ads (trackers not included at first stage), not just hiding but blocking before loading, and efficient + lightweight + powerful at the same time.

If by chance you are interested, here is the bit of JS' script I tested and seem to work fine: https://pastebin.com/9dTqdym0

And here are the other bits I stole, but I don't know if they are useful, efficient etc: https://pastebin.com/rSVAky5X I also don't know if there something useful at the scripts I sent you yesterday.

Yeah, I am aware this is totally out-of-topic from FireMonkey! But you said you like to build your own add-ons. And I love so much your approach to efficiency! So I wonder if you will be interested on building an ads-tracking-blocker JS' script for FireMonkey, using or not these scripts I am sharing here with you.

If you don't have time or you are not interested etc, please, forget this my message. But if by chance you want/can build this ad-tracking-blocker JS' script... it will be amaaaaaaaaaaaaazing! : )

Thanks in advance!

erosman commented 5 years ago

Off-Topic

One of the old ways (still valid) of blocking ads was using the host file on Windows (or similar) to redirect the unwanted traffic to localhost (which wont answer). Although not specifically designed for that purpose, my FoxyPAC extension can be used that way too. It is a proxifying extension that can use rules that are based on RegEx. It can also use full RegEx. However the rules are extremely simple to make (so simple that there is rarely a need for full RegEx)

To use it to BLOCK, you can set a proxy as 127.0.0.1:*** (something that is not used) e.g.

// Default localhost for denied connections
PROXY 127.0.0.1:65535
EstherMoellman commented 5 years ago

... Windows' hosts file, as you better know than me, is very limited in functions. Not just it doesn't work with wildcards (working only for specific written addresses), but also hosts is not kept in RAM all the time, Windows needs to read and reread it many times, making everything slow, hurting performance etc. Worse, hosts doesn't work 100% at OS level, Microsoft and other programs can skip hosts file. In fact, hosts is so rudimentary, that malwares easily can delete or rewrite it. Two simple blocking-list, let's say EasyList and EasyPrivacy, are enough to make hosts unusable in terms of performance. Instead, DNSCrypt is a kind of hosts on steroids, it can perfectly handle large blocking-lists, it can't be bypassed, and performance is fantastic. In brief, personally, I'm not back to hosts, nor UMatrix/UBlock etc. I'm not saying DNSCrypt is perfect. I'm saying I tested lot of alternatives along more than one entire year, and DNSCrypt is the winner for me. I just need now a small complement, a JS' script covering ads with REGEXPs.

With regards to FoxyPAC (thank you), I saw it days ago when I visited your other add-ons. I understand your explanation, and I know FoxyPAC might be used as a blocker. However, as you perfectly said, "FoxyPAC is not specifically designed for ads-blocking". And I'm really kind of obsessed looking for the best possible Firefox' performance. And honestly, I prefer here FireMonkey + an ads-blocker JS' script. I recognize that I may be wrong, but I want to test FireMonkey with the new API, working with the ads-blocker JS' script I need now as a complement to DNSCrypt. But thank you anyway for your answer and suggestion. By the way, FoxyPAC' ads-blocker capability remained me a bit this little old gem (http://www.schooner.com/~loverso/no-ads/). It has been updated on past fev 2019, and I'm in contact with the Dev. I use "no-ads.pac" for testing the REGEXPs I sent you in my previous message.

@erosman , my invitation to you remains opened. If by chance you can, want, and have interest, please, let's build this ads-blocker JS' script for FireMonkey. It doesn't need to be today, nor tomorrow, this week etc. Do it whenever you want! Also, if you want, you can use the first link I sent you in my previous message, containing the script I'm using today. And if the second link (with more scripts) is useful, great, you may use too. Feel totally free, do whatever you want, when and only if you want. Zero compromise here. It's just for having fun! : )

And if you are not interested, don't worry at all, it is fine, I always will love you! LOL

Thanks! : )

EDIT: Please, simple question just to be sure... you wrote:

Only extensions can prevent the ads from loading in the first place.

Does this means... no ads-blocker JS' script at FireMonkey will ever avoid ads to be loaded? Always a JS' scritp will be just a cosmetic function of hiding ads? If your answer is "yes", then my plan of complementing DNSCrypt with a JS' script at FireMonkey... sadly will be useless. I really hope that an ads-blocker JS' script is possible to be done, not for hiding ads, but for blocking ads requests, avoiding ads to be loaded.

erosman commented 5 years ago

Does this means... no ads-blocker JS' script at FireMonkey will ever avoid ads to be loaded? Always a JS' script will be just a cosmetic function of hiding ads?

That depends....

It is possible to use Document.onbeforescriptexecute to handle remote script but not inline ones. Even then it gets loaded first (part of the tracking is done which is sending refer, IP etc to the ad server script) and its execution is halted.

The rest of the available scripts (e.g. 99% of them) only hide the ads. Some can help preventing the creation of new ads (in case of dynamically loaded ads).

An extension can intercept the HTTP request to the ads server before a request is made. This is a browser action. Scripts are content script which are from the page loaded in a tab. They never have access to above high-level functions (otherwise scripts on the page could cause havoc).

EstherMoellman commented 5 years ago

@erosman thank you!

... so, your answer seems to be an official bye-bye to my ads-blocker JS' script, right? If it can't block ads, and it is a mere cosmetic effect of hiding ads... then I don't want it! What really confuses here is the fake-marketing some add-ons/JS' scripts do. For example, I read some JS' script descriptions where they were confirming the capability of blocking ads (avoiding to be loaded) instead of hiding. And that's the reason I asked for your help, I wrongly believed that this could be done with JS' scripts. But after your answer, now I know that my ads-blocker JS' script never will really block stuff (which according to your explanations/teachings is a browser function, out of the scope of any JS' script).

So per your answer, if I want a complement for DSNCrypt, I necessarily will need an add-on, right? What about the add-on I mentioned you? (https://addons.mozilla.org/en-US/firefox/addon/rule-adblocker/). Any possibility from your side to make an improvement of this add-on? Or what about if you make a fork of FoxyPAC? (converting it to specifically be an ads-blocker-add-on, using rules or RegExps). Yeah, I repeat, I don't expect you to do nothing today, tomorrow, next week, month etc. I'm just showing you that most of the add-on-blockers are performance killers. I tested most of them. The only add-on I can recommend, is the one I mentioned to you (RuleAdBlocker). However, it is abandoned. And due to my ignorance, after your teachings, I even really don't know if RuleAdBlocker blocks or just hides ads. So @erosman, what I'm trying to say is that in my opinion the niche-opportunity is there for a new ads-blocker-add-on, but like FireMonkey, focused on efficiency, lightweight etc. If by chance you are interested, as I said in previous messages, this will be fantastic, because 99% of the ads-blocker-add-ons are the same: Browser performance killers.... and also because efficiency/lightweight are an @erosman signature!

Changing subject and back to FireMonkey:

1) At FireMonkey, there are 3 buttons for "export". "Export-preferences" (at settings), and "Export" at script page (top corner on the right), both seem to work fine. But Export at bottom corner on the left... I can't make it work (when I mouse-click on it nothing happens, it seems dead).

2) Question: Is it possible that FireMonkey is better in performance that userContent.css file? Please let me explain:

I have been doing some Nightly' performance tests, comparing FireMonkey VS userContent.css file (so just to be clear, here I'm talking only about testing my CSS' scripts related to webcontent, around 100 CSS' scripts for webpages).

The empirical test (using my personal subjective impression + chronometring loading/rendering times) showed almost no difference. However, technical tests using online tools showed a difference in favor of FireMonkey.

Is it possible? An add-on can be faster than userContent.css? I took care of repeating the test on different days, hours, computers etc, and always appears the same positive difference in favor of FireMonkey, around +5% better.

When I do the same test with Stylus (add-on), is exactly the opposite, the result is +5% in favor of userContent.css.

Please, what are your thoughts?

I ask you because depending on your answer, I will move all the CSS' scripts I was keeping at userContent.css. The reason these CSS' scripts were at userContent (and not at Stylus/FireMonkey) is because they behave better at userContent... I don't know why. But is a fact, same CSS' script at userContent may have different behavior than working at Stylus/FireMonkey etc. PS: By "behavior" I mean CSS' mods cover more stuff.

In one hand, if I move from userContent to FireMonkey, I will lose some CSS' mods, and I will need to make some readjustments in same CSS' script in order to work at FireMonkey. Translation: It is time consuming, it will take me time.

In the other hand, I may gain +5% in browser performance.

Of course browser performance always is and forever will be my priority! But I prefer first to ask you, because I don't want to waste my time by doing something that could be wrong or could be a mere placebo effect.

Thank you, have a nice Saturday, and big hug! : )

erosman commented 5 years ago

... so, your answer seems to be an official bye-bye to my ads-blocker JS' script, right? If it can't block ads, and it is a mere cosmetic effect of hiding ads... then I don't want it! What really confuses here is the fake-marketing some add-ons/JS' scripts do. For example, I read some JS' script descriptions where they were confirming the capability of blocking ads (avoiding to be loaded) instead of hiding. And that's the reason I asked for your help, I wrongly believed that this could be done with JS' scripts. But after your answer, now I know that my ads-blocker JS' script never will really block stuff (which according to your explanations/teachings is a browser function, out of the scope of any JS' script).

Content script ad blocker at best maybe 20-30% as effective as a good extension ad-blocker.

So per your answer, if I want a complement for DSNCrypt, I necessarily will need an add-on, right?

Different process. You dont have control over DSNCrypt. Browsers behave differently when proxies are used. They dont use system DNS. Service workers work differently. There are far too many things to mention. A good extension to handle these would be a complex one.

Simple rule-blocker type extensions cant handle everything.

FoxyPAC can do what rule-adblocker does but that covers part of the ads.

At FireMonkey, there are 3 buttons for "export". "Export-preferences" (at settings), and "Export" at script page (top corner on the right), both seem to work fine. But Export at bottom corner on the left... I can't make it work (when I mouse-click on it nothing happens, it seems dead).

Export at bottom right exports all scripts & CSS as individual files to FireMonkey folder in your default Firefox download folder. I noticed that if there is a filename issue with operating system (disallowed characters in the name), it causes an error. I will fix that.

Question: Is it possible that FireMonkey is better in performance that userContent.css file?

Different thing altogether. userContent.css will probably be removed. It is a leftover from legacy Firefox. Firefox 69: userChrome.css and userContent.css disabled by default

Those are borrower setting while user-styles are page content settings.

EstherMoellman commented 5 years ago

... as I mentioned in previous messages, I never look after the "perfect-ads-blocker". As you know, for me the priority is browser performance, so here I am totally willing to accept an alternative that not covers 100% of ads. DNSCrypt covers me a huge part of trackers and ads (I can measure it with Ctrl+Shift+I => Network and at "blocked-log" in DNSCrypt). In addition, RuleAdBlocker add-on covers me ads DNSCrypt doesn't covers. This combo is enough for me! (despite not being the perfect combo, the ultimate solution). And this combo also doesn't hurt browser performance. But RuleAdBlocker is abandoned, it has bugs, I can't add/change rules etc. So, please sorry to repeat and sorry for being insistent: Is there a chance that in the future you will improve this RuleAdBlocker or another specific ads-blocker add-on?

With regards to usercontent, yeah, I already read about the possibility to become deprecated. But back to my question, please, do you think that an add-on (FireMonkey) can performance better than userContent? Or is it a placebo effect from my side, some mistake I did on my tests?

erosman commented 5 years ago

do you think that an add-on (FireMonkey) can performance better than userContent? Or is it a placebo effect from my side, some mistake I did on my tests?

There are different things.

userContent.css loads at starts up.. therefore is faster but it affects browser, therefore constantly uses memory.

Contnet-Css is only injected when needed.. it affects the page.

They are different things completely. Their performance is similar since they still have to be injected unto pages. One uses more memory, one uses more resources and all that depends on how large it is and how often it is injected and what type of rules is used.

A poorly written userContent.css or user-CSS can put a considerable load.

So to answer your question, it all depends. There is no definite answer.

EstherMoellman commented 5 years ago

... sorry if I wasn't enough clear, but I was talking about testing exactly the same CSS' scripts (around 100). Regardless these CSS' scripts having been well or poorly written, short or long size etc, if they are the same, then from my ignorance I thought that userContent.css file always should be faster than any other CSS' tool (add-on). Also, considering your answer that userContent loads at startup, and is kept into RAM, this confirm that it should be faster than any add-on (which according to your explanation, add-ons only inject CSS when a webpage is loaded).

So to be clear, having exactly same CSS' scripts, I tested at: a) FireMonkey b) Stylus and c) userContent file. And FireMonkey was the winner. I thought maybe there would be an explanation for such weird result. But I don't know, maybe it was a mistake of my test, or a placebo effect from my side.

I just shared with you the result of my test and the question about the result, because I thought it might be interesting for you and the future of FireMonkey. Again, possibly I'm making some mistakes, and this explains the result of my test. But if by chance I did nothing wrong, then this positive test result is good news for FireMonkey.

At Mozilla I have a friendly contact, he is an employee (Engineer), he always helps me with questions and ideas. I sent him the data of my test and FireMonkey. He just answered me minutes ago, and he seems very interested. Let's wait and see if he has an answer. Firefox is full of bugs. And around one year ago, doing tests with Stylus, I found a similar weird case, were Stylus was faster than userContent. This guy, the Firefox' Engineer was involved, and he discovered that was a FF' bug making userContet slower for a specific CSS' mod.

erosman commented 5 years ago

Sounds good :+1:

BTW, DNScrypt has many limitations and can not catch a lot of things but that takes too long to get into.

1- DNS are not called for numerical IP addresses, only domain names. So if ad uses IP address, it gets through. 2- Just note that DNS calls are cached. So When a page loads and the same domain has ads, the subsequent calls to those ad-servers on the same domain (or a domain that is already cached) are not passed thought DNS calls and browser send them through directly.

DNS filtering is one the most basic types of filtering and thus provides basic restriction.

EstherMoellman commented 5 years ago

I really don't have the required technical level to make you any explanation about DNSCrypt. But the DNSCrypt' Dev and other advanced users, they are extremely friendly, very responsive, and at least for me they always answered and help me a lot (on the same day). I'm sure if you share your findings, they will replay you at DNSCrypt' GitHub.

Having said that, and from my ignorance, I dare to confirm you that DNSCrypt blocks IP's. I'm alleging that, firstly because for the past year I had (and I still have) an IP-blocking-list inside DNSCrypt, it works perfectly, and this IP-list has a separated log showing the blocks. It doesn't work with SimpleDNSCrypt, which is a different software (interface). But IPs-blocking-list perfectly works with DNSCrypt. Again, it just needs a separated file and log. Sounds complex, but is tremendously easy. Secondly, I'm alleging that also because I'm collaborating with an Australian Dev, which is using DNSCrypt, with only IPs-blocking-lists against ads and trackers etc. The general idea is to build a global IPs-blocking-list, because as you know, one IP may block hundreds or thousands of domains. It should be the most efficient way to block garbage.

With regards to DNSCrypt DNS caching, is customizable. Users can increase or decrease cache, they even can totally turn off cache... zero caching. First-Party-Isolation (FIP), Containers and other FF' pref, also may help to deal with cached DNS. I don't zero my DNS' cache. And I use DNSCrypt with the default DNS' cache. This is because I'm not paranoid about privacy. What really drives me crazy about ads and trackers, is not privacy, is performance! Nothing against those who fight in favor of privacy. It is just not my case. I want to block trackers and ads, because they significantly impact browser performance.

... and by the way, that's the reason I remain waiting for an @erosman ' miracle (LOL), building an efficient ads-blocker-add-on to complement my DNSCrypt.

: )

erosman commented 5 years ago

You misunderstood .... browser caches the DNS (OS also caches the DNS), so DNSCrypt settings has no bearing.

I dont want to get into argument with other applications... I mentioned those FYI... that is all.

EstherMoellman commented 5 years ago

@erosman good morning! Yeah, I know your intention is not to build arguments against App "X"/Script "Y" etc. Your intention is to help me by sharing your general impressions, as you did with my JS' scripts. And I THANK YOU for that. Please, always keep doing that whenever you want, it is very helpful for me, most appreciated from my side.

With regards to DNSCrypt, I by myself recognized that it is not perfect. And I requested you an ads-blocker-add-on as a complement... precisely because DNSCrypt is not perfect. DNSCrypt has its own autonomous customizable DNS (it can be increased, decreased or turned off). If OS DNS cache is turned off (Windows Services), Firefox' DNS cache also is turned off (FF' preferences), and DNSCrypt' DNS cache is turned off... I just tried to say that then you are not going to see DNS' cache/cached/caching. I apologize in advance if due to my low-level-user I'm misunderstanding you.

Please, changing subject, simple question: At usercontent.css file in Firefox, is it possible to use Match Patterns? In other words: How can I replace RegExps at Firefox' usercontent.css file? For example, without RegExps, how can I specify for a CSS' script to work at any domain except domain "X", "Y" and "Z"?

By the way, you already perfectly answered all my questions, solved bugs, and helped me light-years far away beyond your obligation. So, please, the fact I keep abusing from you, for example by asking endless questions, it doesn't mean you have to answer me. I love your help and hope to always count with your replies, but if you feel that "enough is enough", please feel totally free to stop answering me whenever you want. Also, feel free to close this issue whenever you want.

Big hug and have a nice Sunday! : )

erosman commented 5 years ago

I dont use usercontent.css so give me an example to check.

EstherMoellman commented 5 years ago

... days ago, when you kindly converted my RegExps into Match Patterns for FireMonkey, you took for example my RegExp:

@-moz-document regexp("http[s]?://(?!(imdb.com|facebook.com|github.com)).*")

... and you converted into:

// match :/// // exclude ://imdb.com/ // exclude ://facebook.com/ // exclude ://github.com/*

From my ignorance, I tried to use this same conversion inside userContent.css file, but I couldn't make it work. So please, my question is: Do Match Patters work inside userContent.css file? And please, at Firefox' userContent.css file, how can I use exactly the same example above, with or without Match Patterns, in order to make a CSS' script to work for all webpages except (excluding) domain "X", domain "Y" and domain "Z"?

I need this because I want same conditions for my tests comparing FireMonkey VS Firefox' userContent.css file. At FireMonkey I use the conversions you kindly made for me, so everything there is clean of RegExps, working all with Match Patterns. But at userContent file, I have RegExps. And if I want to make comparison tests with FireMonkey, at my userContent file I need to convert RegExps into something else equal to Match Patterns, or at least I need something else without RegExps. In general, I know how to specify urls at userContent file, this is not a problem for me. I just don't know how to specify an exception at userContent file, without using RegExp. I don't know how to use "@exclude" at userContent file, without using RegExp. So, I want to find the analog of "@exclude" to be used at userContent file, without RegExps.

Please, it will be enough if you can give me just one example of a CSS' script header command, allowing this CSS' script to work for all webpages but excluding domain "X"... at Firefox' userContent.css file... and without RegExps.

Thanks in advance!

erosman commented 5 years ago

I have never used the userContent.css but I assume it is using the same set up as Stylus/Stylish with @-moz-document.

I need to see it as there are multiple formats in @-moz-document

EstherMoellman commented 5 years ago

... yeah, at FF' userContent no problems from my side with "@-moz-document" and its variants ("@-moz-document url", "url-prefix", "domain" etc). To specify an url or several urls, this is not a problem for me. I can even know how to use "@-moz-document" for all websites.

My difficulty is only with "exceptions/exclusions at userContent file. At FF' userContent I know to exclude a domain only if I use RegExps (I don't know how to exclude domains without RegExps). I don't care if it is Match Patterns or any other alternative, I just need to know how to exclude any domain (without using RegExps) at FF' userContent.

If by chance you know the answer, it will be great, because I will able to compare FireMonkey VS userContent, using not just same CSS' script, but also not using RegExps in both cases. This is something my FF' Engineer friend ask me to test. Personally, I don't think this will change nothing... but I need to deliver my FF' friend request. And that's why I'm asking your help.

Yesterday I did more tests, with and without RegExps at userContent. And the results always are in favor of FireMonkey. My guess is that the explanation of such good FireMonkey' test result has nothing to do with RegExps. But again, I need to deliver what my FF' friend asked: Same test for both, FireMonkey and userContent, both without RegExps. Please, it will be enough just one example, at userContent, not using RegExps, and excluding one or more domains. That's all.

Thanks again! : )

erosman commented 5 years ago

You can exclude domains using @excludeMatches or @excludeGlobs

The included Help explains the use

Include http://*.one.com        @match              http://*.one.com/*
Include https://*.one.com       @match              https://*.one.com/*
Include https?://*.one.com      @match              *://*.one.com/*

exclude http://*.two.com        @excludeMatches     http://*.one.com/*
exclude https://*.two.com       @excludeMatches     https://*.one.com/*
exclude https?://*.two.com      @excludeMatches     *://*.one.com/*
EstherMoellman commented 5 years ago

... just to be clear: We are not talking about FireMonkey. The FireMonkey' "Included Help" doesn't apply to my question, because we are not talking about FireMonkey.

We are talking just about Firefox' userContent.css file. So, we are talking just about how to exclude a domain at userContent, without using RegExp.

I apologize in advance if I made some confusion, or if I wasn't enough clear. I also apologize in advance, because I tested all the possible variants you posted above, and I couldn't make them work at userContent.

Based on your comment above, please, at userContent, which will be the complete correct grammar?: @-moz-document @excludeMatches("https://www.google.com") { or @-moz-document exclude("https://www.google.com") { or plain @excludeMatches https://www.google.com { or etc?

... I tested all of them at userContent, and I failed. ... sorry for abusing from you and for taking your time.

Once again, the goal is to replace the "exclude" RegExp at userContent, in order to have exactly same CSS' script to test against FireMonkey.

erosman commented 4 years ago

We are talking just about Firefox' userContent.css file.

Sorry ... I misunderstood. I thought you were referring to FireMonkey.

There is no exclude option in @-moz-document url(), @-moz-document domain() or @-moz-document url-prefix() The technology was experimental and never developed further.

If the rules are very few and simple, it is possible to write a rule to undo changes made by above for he excluded locations but that is just a hack and not practical, especially for anything but the most basic changes.

So the only option to exclude is the @-moz-document regexp()

EstherMoellman commented 4 years ago

... @erosman, is me who apologizes to you! Obviously I wasn't clear. All the time, since the beginning of my question today, I was talking about "usercontent" (not FireMonkey). Perhaps unnecessarily I extended myself, and I ended confusing you. My bad, again, I apologize to you.

Thank you for answer. Sadly I was afraid of your confirmation. I will redo my tests comparing FireMonkey VS userContent, but only using the same CSS' scripts (without RegExps). I still believe FireMonkey will be the winner here!

Now, and changing subject once again, off-topic once again, please I will ask your help with another different issue, but I promise, for a while this will be my last ask/question/request to you... I cant keep abusing form your patience (LOL). After this my last next question/request, I will give you a break! (LOL). Here is my request:

Please, take a look at these two CSS’ scripts (https://pastebin.com/p3h0QAu2) and (https://pastebin.com/fkVVXW7T). But before that, please allow me a short explanation:

The first attached link is a CSS’ script for Global Dark Theme. The second one is for globally reducing brightness on images. I made both scripts, so yeah, both scripts are extremely poorly written, incomplete, and perhaps with lot of mistakes. I made both of them, because most of the CSS’ scripts I found with similar functions, they were hurting browsing performance.

These my two CSS’ scripts work relative fine at Firefox’ userContent.css file. And they don't hurt browser performance as the other scripts do. I use these two scripts for global browsing (while for lot of specific webpages (youtube, facebook, google etc) I have specific CSS’ scripts). In other words, these my two CSS’ scripts don’t need to work for the most famous webpages, is enough if my two CSS’ scripts work for the most not famous webpages (without hurting browsing performance).

However, as you know, per my recent tests, CSS’ scripts for me are performing better at FireMonkey. So, I’m trying to migrate everything I have, including userContent’ scripts, everything to and into FireMonkey. Sadly when I do that, these my two CSS’ scripts behave a little bit different (than they behave at userContent). At FireMonkey, both scripts seem to cover webpages not completely (for example, white background and stuff still appears).

For example, these are webpages where at FireMonkey my two CSS’ scripts seem not to work completely, and white background/stuff appears: https://techxplore.com/news/2019-07-robot-machine-harvest-lettuce.html https://www.w3schools.com/css/css_background.asp https://www.vpnmentor.com/blog/the-best-and-worst-ad-blockers/ https://forum.avast.com/index.php?topic=196456.15 https://medium.com/about https://www.mozilla.org/en-US/about/ https://mozilla.github.io/arewefastyet-speedometer/2.0/

Of course, one by one, I can tweak these specific webpages above in order to turn them completely dark background. But this is not the idea, because these my two CSS' scripts are "global", so both they are expected to work for most of the webpages, having and using the most global CSS' selectors. And even if I try to tweak these webpages above, using just global CSS' selector, I end breaking more stuff than fixing webpages.

So please, my (last) request to you is to take a look at these my two CSS’ scripts. And it will be great if you can do something to improve them, using just global CSS' selectors, and trying to hurt browser performance the less possible.

This is an important (last) request from me to you. So please, if you can help me, take all the time you need, and give your best shot. Of course and as usual, please do only whatever you want/can do, and whenever you want/can do. And if you don’t want to do nothing or can’t, don’t worry, it will be perfectly fine.

Again, I promise after this my last request... I will give you a break (LOL).

Thousand of thank you in advance! : )

erosman commented 4 years ago

There are too many rules. Often they are not needed. There are also specific rules which only apply to specific sites (e.g. #header, .header etc). They should be avoided.

There are also off-topic rules such as border-radius which doesn't relate to dark theme.

It is not important but what is #000001 ? Eyes can not see the difference between #000001 & #000000

I also usually use the shorthand #000

A very general (and simple) rules can make most of the work.

body, body * { 
  background-color: #000 !important; 
  color: #fff !important;
}

Similar to JavaScript, written good CSS is also an art. I recently changed a CSS with 5000 lines to a CSS with 600 lines which did the same job (and IMHO better).

My suggestion is to start simple and then add whatever is needed. Please note that CSS engine are a lot more sensitive to errors than JS. You have extra } at the end which is not a problem but if it was in the middle, half the CSS could be ignored due to error.

EstherMoellman commented 4 years ago

... well, I alerted you (LOL), I made both scripts, and I never learnt CSS (LOL), so both scripts should be poorly written, having mistakes etc. No surprises here.

But both scripts, despite my terrible CSS, both work pretty well at my Firefox' userContent.css file. Also, both scripts have better browser performance than other scripts. I tested them extensively.

Please, I just need your help to improve both scripts, to work better at FireMonkey (where my CSS' scripts perform even better than in userContent).

Please @erosman , feel free to help as you want. Do you prefer to make your own corrections/additions of my two scripts? Or do you prefer to build two new scripts from the scratch? Or do you you prefer to quit? ... feel totally free @erosman ! Do whatever you want. And if you can't do anything, don't worry at all, it's perfectly fine, I totally understand, you already helped me a lot.

Thanks in advance : )

erosman commented 4 years ago

I am afraid that is quite time-consuming and I already occupied with other endeavours.

EstherMoellman commented 4 years ago

Hi @erosman ! Please, simple question out of topic:

Do you remember this my post? (https://github.com/erosman/support/issues/90#issuecomment-533075794). Just briefing the case, this add-on (https://addons.mozilla.org/en-US/firefox/addon/rule-adblocker/) is great by blocking ads with RegExps, with a low negative browser performance impact. The problem is that it seems abandoned. And some functions are not working.

I tried to do something by myself, not the fixing, nor the update/upgrade, but at least I tried by myself to edit the add-on, and to insert some new RegExps inside its JS' code. But in order to do that, first I need to convert this add-on into an "unsigned add-on". And I tried to that in a lot of different ways, and sadly I failed, my Nightly always rejects my unsigned-conversions. Literally, I've been breaking my head trying to edit this add-on, and I failed. Even if I don't touch the add-on, I can't convert it into an unsigned add-on, Nightly rejects it. I did my homework, read lot of stuff about how to build an add-on, and zero, I can't make Nightly to accept this add-on as an unsigned one.

I know you are busy, and this is totally out of topic. I also know you are not interested in fixing, updating and upgrading this add-on. But it will be great if by chance you can help me, at least by converting this add-on into an unsigned one. If you can't help me or you don't want to do it, please don't worry at all, it's perfectly fine.

Thanks in advance, and big hug! : )

erosman commented 4 years ago

Just briefing the case, this add-on

After a closer look at its code, it does more tracking than blocking and its blocking is superficial. It is not a real ad-blocker and that is the reason it is so light.

unsigned add-on

On Nightly or developer, install addon using about:debugging#/runtime/this-firefox then Load Temporary addon...

However, that has to be done every time Firefox starts.

EstherMoellman commented 4 years ago

... yeah, I already tried the "debugging" way... I believe I tried most of the ways... and I failed. Of course, I can perfectly install the original add-on. This is not the problem! I'm failing to install the add-on, when I edit and I change some part of the add-on. In this case, if I edit the add-on, then there is no way I can install it again, and it doesn't matter the way I try.

Sometimes the "error report" says that the manifest.json is wrong, sometimes says the file is corrupted, etc etc etc. In brief, if I change something inside the add-on, I can't install it. And here is where I asked your help. Perhaps is easy to you to know how to change the manifest.json etc, in order to convert the add-on into an unsigned one. Please, if you can, help me to convert this add-on, in a way I can edit it by myself, and after editing, I can be able to install it again.

Only if first I convert the add-on into an unsigned one, that then I can edit its JS' script, adding more RegExps, and improving its blocking capabilities. This my plan.

PS: If you remember our conversation about ad-blockers, I tested most of them. And when I say "tested", I'm talking about one year of tests, 50 users participating in the tests, more than 20 ad-blockers tested, I used all kind of tools for the tests, including online tools etc. And my conclusion (if you remember) is that DNSCrypt is the winner. However, it needs a complement. When I met FireMonkey, my dream was to find a JS' code as a complement of DNSCrypt. But you taught me that those JS' code are hiding, not blocking ads. You also taught me that only an add-on can block ads. The RuleAdBlocker add-on, at first sight, is perfect as a DNSCrypt' complement. Yeah, you have much more knowledge than me, and I can't say nothing about its code. I do recognize that this add-on might not be the best one in the world. And I do hope some Dev in the future, may fix, upgrade and update it. But today this add-on is fine for me, just as a complement of DNSCrypt. I stole few powerful RegExps from other scripts (please see our comment https://github.com/erosman/support/issues/90#issuecomment-533075794), and I plan to insert these RegExps inside RuleAdBlocker add-on, in order to improve its blocking capabilities. I have no knowledge how to fix this add-on, how to update and upgrade it, but I believe I'm capable of improving its blocking capabilities by inserting new RegExps. However, as I explained above, first of all, before editing, I need to convert this add-on into an unsigned one, or into an add-on that I can edit and reinstalling many times. Again, this is the first step where I'm failing now, and is in this first step I need your help.

: )

erosman commented 4 years ago

I'm failing to install the add-on, when I edit and I change some part of the add-on. In this case, if I edit the add-on, then there is no way I can install it again, and it doesn't matter the way I try.

Sometimes the "error report" says that the manifest.json is wrong, sometimes says the file is corrupted, etc etc etc. In brief, if I change something inside the add-on, I can't install it.

It is because of error.. you need to fix the error

Please, if you can, help me to convert this add-on,

Where is the code?

EstherMoellman commented 4 years ago

Here is the add-on, and inside the add-on you will find all the folders and scripts with the codes: https://addons.mozilla.org/en-US/firefox/addon/rule-adblocker/

However, please, let me be clear: My problem now is not with the code.

I downloaded the add-on. If I don't touch the add-on, then I have not problems in reinstalling the add-on (as a file, temporary etc).

The problem is when I edit the XPI folder add-on contents. The minimum change I do inside the XPI folder, after that, I can't reinstall the add-on again, nor as a file, nor as temporary (debugging) etc.

You are asking me for the code, but before the code, the first problem I have, is with the edited XPI folder add-on. Again, my problem now is not with the code. It is before that, is when I edit the XPI folder add-on, and Nightly rejects my new XPI folder add-on.

In the past I worked with unsigned add-ons, without a problem. I also spend days reading how to build an webextension. I follow step by step how to edit the XPI folder of RuleAdBlocker add-on... and I don't know why Nightly is not accepting my edited RuleAdBlocker add-on.

I will need to worry about the code, the RegExps etc. But, as I said, this is not the problem now. As I said, now I'm experiencing a previous problem before the code. I believe the problem has to do with the "manifest.json" file or the "META-INF" folder. It seems like after editing something inside the XPI folder add-on, Nightly can't install the add-on. If it is not the "manifest.json" or "META-INF" etc, then I believe is something with the rest of the structure (folders, files etc). It seems like when the XPI folder is untouched, everything works perfect. But if a tiny change is done inside any folder or any file, Nightly can't load the edited XPI folder. And again, it is not a problem with the code. For example, I can delete a simple png file inside the XPI folder, and that is enough for Nightly rejecting all the new XPI folder. Another example, write a simple word inside manifest.json (change the description add-on), and again, Nightly will reject all the entire new edited XPI folder.

erosman commented 4 years ago

The problem is when I edit the XPI folder add-on contents.

I meant where is your edited extension code?

EstherMoellman commented 4 years ago

If you download the add-on, and you make a tiny change inside the XPI folder, let's say you change the "description add-on" at "manifest.json" file, this small change you do inside the XPI folder... Nightly will reject this new edited XPI folder. Or let's say you delete a simple png file... Nightly won't install the new edited XPI folder. That's precisely the reason I haven't finished my edited extension code. Every time I do any simple change inside the XPI folder, even if it is not at the code, I can't test it, Nightly always rejects the new edited XPI folder. So sorry, I have not an edited extension code.

These (https://pastebin.com/D6Gxu3ic) are some of the RegExps I want to insert at "{222a6fb4-cb77-4b29-9a67-ebd65198373c}\lib\config.js" (if you download the add-on, the XPI folder is "{222a6fb4-cb77-4b29-9a67-ebd65198373c}", and inside you will find the "config,js" file at "lib" folder).

At "config.js" script, line 21, you will see that is very easy to insert any new RegExps.

erosman commented 4 years ago

I need to see the actual complete extension code that you are trying to instal to see what mistakes there are.

Is it on Github?

EstherMoellman commented 4 years ago

Here is my edited extension: https://ufile.io/2pyblimt

Here is the virustotal check: https://www.virustotal.com/gui/file/d7ad61b1415821267f0d22d8a9da83669dfe55647eb356088c039263504a7457/detection

Explanation: I downloaded the xpi folder RuleAdBlocker add-on (https://addons.mozilla.org/en-US/firefox/addon/rule-adblocker/). I extracted to folder "RulesAdBlockerMyVersion". Inside the "lib" folder, I edited the "config.js" file, adding some RegExps at the beginning of line 21. I compressed everything again. I renamed the "rar" extension to "xpi". I tried to install in all the possible ways (as a file, as temporary etc), and Nightly always rejects, the new edited add-on never is installed.

Of course, I apologize in advance if due to my ignorance I'm doing something wrong. I always try to have a proactive attitude, and I'm aware that many times this drives me to make lot of mistakes. Also, I want to take the opportunity to thank you once again for your help, time, and infinite patience with me.

: )

erosman commented 4 years ago

I compressed everything again. I renamed the "rar" extension to "xpi".

XPI is ZIP, not RAR

You must compress as zip. I tested it after compressing as zip and it is fine. Delete META-INF as it is for the original You can install without even zipping.

Load Temporary addonn ... -> navigate and select the manifest.json

EstherMoellman commented 4 years ago

THANK YOU!... and again, my apologies for my ignorance, no tutorial explained me the ZIP vs RAR, the Devil always lives in the details (LOL).

So, I was able to install the add-on as temporary. But I need this add-on full-time installed. And when I tried to install it "as a file", the same message appears "The File Is Corrupted". I tried with and without META-INF, with ZIP, with XPI etc... and Nightly rejects.

Please @erosman , any idea how to install this add-on permanently?

erosman commented 4 years ago

ZIP vs RAR

XPI

I need this add-on full-time installed

It is complicated to install it full-time as Firefox prevents unsigned addon installation. You can get it signed. Info: Signing and distributing your add-on

I tried with and without META-INF

META-INF is specific to each XPI. Any change will invalidate it and a new META-INF has to be created via AMO.

EstherMoellman commented 4 years ago

... thanks for the XPI' link you sent me... but by "tutorials" I meant the Mozilla' tutorial and video explaining "how to build an add-on". Really, I read several tutorials, official and unofficial ones, and no one explained that compression can't be RAR. Anyway, I assume the mistake as my fault! I do recognize that I'm trying to do things without having enough knowledge. Again, thanks a lot for your help! You @erosman rescued me once again! LOL

Now, with regards to installing the RuleAdBlocker add-on "as a file" (permanently), I have lot of unsigned add-ons where I can install them "as a file" (permanently) without a problem. I never had a problem. At Nightly, I just turn the FF' pref "xpinstall.signatures.required" to "false", and voilà, any unsigned add-on can be installed without problems, and without signing at AMO etc.

The RuleAdBlocker add-on perfectly can be installed permanently from AMO. So, if now I can't install permanently my new edited unsigned RuleAdBlocker add-on (without META-INF), then my guess is that again the problem should be my ignorance, my lack of know-how, a mistake I'm making (as I did with RAR vs ZIP) etc... I must be missing something!

If by chance you discover how to permanently make work this add-on, if you discover what I'm missing or which one now is my mistake etc, please @erosman , send me a message.

Zillions of thanks in advance!

erosman commented 4 years ago

You can try asking at https://discourse.mozilla.org/

EstherMoellman commented 4 years ago

@erosman , another friend of mine solved the issue. Just in case you are interested, in order to make permanent (installed as a file) any unsigned add-on, at the manifest.json needs to be written:

"applications": { "gecko": { "id": "example@example.com" } }

That's all! : )

erosman commented 4 years ago

Great... good that it is sorted

EstherMoellman commented 4 years ago

... please, last question for you, always out of the topic: What is your opinion about this JS' script? (https://greasyfork.org/en/scripts/390857-redirect-away/code)

I'm trying to use FireMonkey as much as possible, replacing as much as I can other other add-ons I have. So for example, now I'm trying to replace:

https://addons.mozilla.org/en-US/firefox/addon/skip-redirect/

and

https://addons.mozilla.org/en-US/firefox/addon/neat-url/

Please, I would like your opinion about the JS' script I'm attaching above, or even better if you have another better JS' script to replace these my two add-ons.

Again, millions thanks if you can help! : )

PS: I already replaced 5 add-ons by using FireMonkey... A-M-A-Z-I-N-G! My browser performance is much better! FireMonkey is splendid! Congrats!

erosman commented 4 years ago

What is your opinion about this JS' script? (https://greasyfork.org/en/scripts/390857-redirect-away/code)

It is OK. Change @include http* to @include *://*/*

addons vs script:

1- addon can change the URL ...BEFORE browser gets it.... so browser never gets the original 2- Script can only change the URL.... AFTER browser gets it.... so browser gets is but as soon as it gets it, it can be stopped and new URL loaded

EstherMoellman commented 4 years ago

Hi there @erosman !

I am proud to present to you my first "edited" add-on. Here is the unsigned add-on: And here is the virustotal report: The add-on can be installed permanently (as a file), or temporary (about:debugging).

You are the first person I share my work, and this is because you helped me a lot. I know this subject is not of your interest, you are busy with your own great stuff, you don't have time etc. But if by chance you are curious, it will be great if you can take a look at the JS' code, perhaps you can improve there something etc. Also, if by miracle you are motivated by my edition, and if you liked the challenge, and you decided to rebuild this add-on, THIS WILL BE FANTASTIC!... and please, in this case I want you to know that the add-on will be yours.

As it is now in my edited version, the add-on works pretty well. I have done lot of tests, and haven't seen bugs or issues. It is a very lightweight add-on, when compared to other ad-blockers. And it is very powerful with the RegExps I added (blocks around 80% of ads, including very nasty ads). Of course, the add-on still is very imperfect, and it has enormous space for improvements (and future features). I have no knowledge, but IMO, a good Dev with little work can make an outstanding ad-blocker from this add-on.

This tiny add-on is not meant to be the ultimate solution for blocking ads. I worked on it having in focus browser performance as the maximum priority. I tested this add-on with lot of online and offline tools, and it is much friendly at CPU, RAM, browser speed etc than other blockers. In the other hand, this add-on also is not meant to cover 100% of the ads (80% is more than reasonable!).

I hope you will enjoy my work... and again, zillions of thanks for your great help! : )

erosman commented 4 years ago

Good job and good luck :+1:

EstherMoellman commented 4 years ago

Hello @erosman ! Please, if possible, a simple question out of topic: Do you know any JS' script for controlling web-page zoom? Yeah, I know there are few add-ons doing that. But I would like to test alternatives without add-ons. Thanks in advance, and have a nice Saturday! : )