Extensions :  K-Meleon Web Browser Forum
All about K-Meleon extensions. 
Tiny macro javascript warner: just reminder popup
Posted by: siria
Date: August 28, 2019 03:49AM

A tiny macro for extra paranoid users who usually keep javascript blocked, and allow it only shortly, if needed.
If JS is ACTIVE, this macro will show a POPUP after every page load, just as REMINDER.
The macro simply checks if the global pref "javascript.enabled=true", nothing else.
The popup offers buttons to either continue, or to block JS again, or to DISABLE those warnings.
When you cancel or hit the ESC key, it will close and ask again next time.
When disabling the WARNINGS (stop asking), you can choose when it shall become active again:
when switching tabs (KM76+) or open new tabs / switching windows / at next session / or never
IMPORTANT: The reminder settings can not be stored in single tabs/pages



Menu: in Tools > Privacy, or right-click on a PrivBar button
(But menu not really needed, just allow JS and open a new page => Popup appears)

UPDATE version 2:
- avoid multiple popups lining up in background while a previous popup is still open
- added URL-exceptions to avoid popups for "chrome:" pages or your own URL choices (customize inside kmm)
- option for a "mini" popup with OK+CANCEL buttons, instead of default YES+NO+CANCEL
(customize on about:config, filter for "warner", toggle pref true)

INSTALLATION: put the kmm-file in the macros folder and restart
UN-install: remove the kmm-file


.




Edited 5 time(s). Last edit at 08/28/2019 05:21PM by siria.

Attachments: javascriptwarner.kmm (7.7 KB)   javascriptwarner_pic1.png (11.3 KB)  
Options: ReplyQuote
Re: Tiny macro javascript warner: just reminder popup
Posted by: siria
Date: August 28, 2019 04:07AM

I find those boxes probably too obnoxious yet, but not sure how to do it otherwise. At the first attempt for such a warner macro, a few years ago, I wanted just a little MENU (with options) to appear instead of a confirmation box. Menus can be closed much easier, just clicking anywhere outside. But at the time was running against the usual wall of BUGs, menus just wouldn't appear after $OnLoad events, no matter what and how I tried, and finally had to gave up.
That's now the second attempt, will try it awhile to see if getting used to it, or if finding this method too annoying.

Hmm... perhaps could compare the time between 2 popups, to prevent those boxes showing up too fast in a row when quickly clicking some links? Would need some more code and injectJS-return function.



Edited 1 time(s). Last edit at 08/28/2019 04:15AM by siria.

Attachments: javascriptwarner_pic2.png (11.7 KB)   javascriptwarner_URL-exceptions.png (15.7 KB)  
Options: ReplyQuote
Re: Tiny macro javascript warner: just reminder popup
Posted by: cpm1a_new
Date: August 28, 2019 06:50AM

thanks, the idea is very good


can you tweak the macro just for me?

leave only 2 buttons:
1) CANCEL with mouse focus on it
2) YES = BLOCK JAVASCRIPT

i don't need STOP ASKING at all. ALWAYS is the only mode for me. can change it thru the privbar context menu if ever needed

i would like to also try the variant as described above, but with mouse focus on YES



Edited 2 time(s). Last edit at 08/28/2019 07:09AM by cpm1a_new.

Options: ReplyQuote
Re: Tiny macro javascript warner: just reminder popup
Posted by: siria
Date: August 28, 2019 07:34AM

to get an "OK / CANCEL" popup change this:
$_x=confirm("NO   =  BLOCK JAVASCRIPT\nYES  =  STOP ASKING\n\n(cancel or ESC key = warn again)","Javascript is ACTIVE",YESNOCANCEL,STOP);
if ($_x=="NO") {
to
$_x=confirm("BLOCK javascript again","Javascript is ACTIVE",OKCANCEL,STOP);
if ($_x=="OK") {

But cannot control the mouse focus, only your general System settings can.

The usual system shortcuts for OKCANCEL:
OK = 1) click 2) hit Spacebar 3) hit Enter-key
CANCEL = 1) click 2) hit ESC-key



Edited 1 time(s). Last edit at 08/28/2019 07:41AM by siria.

Options: ReplyQuote
Re: Tiny macro javascript warner: just reminder popup
Posted by: cpm1a_new
Date: August 28, 2019 09:31AM

> to get an "OK / CANCEL" popup change this:
i did. perfect

only in goggle search SOMETIMES i have to press the button twice. can you confirm this?



Edited 2 time(s). Last edit at 08/28/2019 10:02AM by cpm1a_new.

Options: ReplyQuote
Re: Tiny macro javascript warner: just reminder popup
Posted by: siria
Date: August 28, 2019 11:59AM

Quote
cpm1a_new
only in goggle search SOMETIMES i have to press the button twice. can you confirm this?

Not enough own experience yet. But that's the other point which I expect to need more finetuning: what happens exactly when opening several links very quickly, and the effect of delayed popups at the "loading finished" event. When you very quickly open for example 3 links, which load 3 pages, you'll get 3x the $OnLoad event with 3 popups. If you have a fast connection probably almost at the same time... Not sure yet how to handle that: NOT fire warnings after every page load, and instead add a time check somehow, and fire only max 1 alert in x seconds...? Would be more complicated, but probably possible.

But what do you mean exactly with getting it for a google search? Are you allowing JS for the google search itself?
If you do, that's unnecessary. At the moment (yet) google still let's me search perfectly fine without needing js. Only requires using an old UA (ie7 here) to get the old classic view, and perhaps more search parameters in their url.

Edit: oh... just got another idea.... To avoid at least the worst popups multiplication, make the macro check if multiple other popups are already lined up in the waiting queue, and cancel those. That means it's not firing for EVERY page load anymore, but if you must click 2-3 times at the same moment that makes no sense either. At second thought... not quite as easy as first thought, but will post a new version soon...



Edited 4 time(s). Last edit at 08/28/2019 01:54PM by siria.

Options: ReplyQuote
Re: Tiny macro javascript warner: just reminder popup
Posted by: cpm1a_new
Date: August 28, 2019 12:58PM

>At the moment (yet) google still let's me search perfectly fine without needing js
+1, but it was TESTING

same prob as with google
>https://note-pad.net/

except these it's perfect

Options: ReplyQuote
Re: Tiny macro javascript warner: just reminder popup
Posted by: siria
Date: August 28, 2019 01:48PM

Thanks for testing smiling smiley

UPDATE version 2:
- avoid multiple popups lining up in background while a previous popup is still open
- added URL-exceptions to avoid popups for "chrome:" pages or your own URL choices (customize inside kmm)
- option for a "mini" popup with OK+CANCEL buttons, instead of default YES+NO+CANCEL
(customize on about:config, filter for "warner", toggle pref true)

Options: ReplyQuote
Re: Tiny macro javascript warner: just reminder popup
Posted by: cpm1a_new
Date: August 28, 2019 02:47PM

this is it, thanks

Options: ReplyQuote
Re: Tiny macro javascript warner: just reminder popup
Posted by: siria
Date: August 28, 2019 05:30PM

Okay. Let's try for some time how it works in daily use, if it gets annoying or not, or may need more tweaks

PS: in 1st post have added more screenshots, for settings etc.

Options: ReplyQuote
Re: Tiny macro javascript warner: just reminder popup
Posted by: cpm1a_new
Date: August 29, 2019 05:40AM

>if it gets annoying or not
its not the macro, its just how often you toggle. and i HAVE to pretty often. a good part of my every-day-vists do require JS. great pity for long-time JS hater, but nothing doing :-(

btw put this in user.js

user_pref("javascript.enabled", false);

to start sessions with JS off just the way i used to in O12

anyway i don't see a chance of Mozilla engine JS limitations removed by the developer. sigh
-----
offtopic: do you save pages to single-file (*.mht etc)? how?

Options: ReplyQuote
Re: Tiny macro javascript warner: just reminder popup
Posted by: siria
Date: August 30, 2019 08:49PM

Quote
cpm1a_new
>if it gets annoying or not
its not the macro, its just how often you toggle. and i HAVE to pretty often. a good part of my every-day-vists do require JS. great pity for long-time JS hater, but nothing doing :-(

Looks like we're in the same boat. But amazingly often it helps to just toggle the stylesheets off (macro stylekiller), to get more stuff accessible. And javascript isn't all or nothing, it consists of several levels. We may be forced to open the main door for it, but inside the house we can often keep some inner doors locked. Using prefs like permissions.default.subdocument, and permissions.default.script, and permissions.default.xmlhttprequest (ajax like). For those sub-permissions the whitelisting works by the way. To toggle the global settings for those prefs I'm using macro priv3buttons, and for managing black-white-listed domains the addon ExExceptions/ExExPermissions (KM-version). But have written about that stuff several times in other topics long since.

Quote
cpm1a_new
offtopic: do you save pages to single-file (*.mht etc)? how?
No I don't use that. But why don't you just take a look at google? KM is indexed there too :cool: Just 3 seconds, the very first hit for "mht" and "k-meleon" is Hermes topic for mht-addons. I thought having read somewhere it was broken in newest KM-versions, but may be mistaken.

Options: ReplyQuote
Re: Tiny macro javascript warner: just reminder popup
Posted by: siria
Date: August 31, 2019 09:31AM

mht-addon discussion please in own topic:
http://kmeleonbrowser.org/forum/read.php?19,146714

Options: ReplyQuote


K-Meleon forum is powered by Phorum.