General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Can javascript button on privacy bar be made to auto reload page?
Posted by: Mello
Date: October 07, 2018 12:11AM

Rather than toggle on or off and then have to refresh page.

Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: siria
Date: October 07, 2018 09:31AM

Sigh, now am tempted to make a non-JS autoreload macro, using metarefresh tag and $OnLoad with url check, but that would only pile up yet more on my growing heap of functioning-but-never-finished macros :-/ Perhaps JohnHell...?

<meta http-equiv="refresh" content="120">

Hmm... .and of course it would also need a stop-option (remove from page +from $OnLoad).... hmm.... and of course that would also make a great general redirect-killer function... to be found on the Reload+Stop buttons.... hmm.... but perhaps such a macro exists already somewhere, forum or kmext??.... hmm.... and what about that autorefresh pref in geckos/KM?? It would also prevent the macro function if blocked generally.... hmm.... then again, in my old KM1.6 that pref never seemed to work anyway!.... hmm.... ah a dim memory, aren't there even 2-3 prefs involved for automatic redirects, and I still never got my old KM to respect them??.... hmm.... perhaps newer KM-versions work better, but if that depends on the various versions again and the macro should consider this then the code get really complicated again.... hmm.... and what about frames? That tag should of course be injected into all of them.... hmm... or perhaps in some cases it would be better to not reload always the whole (huge) page incl all bloated frames and scripted ads, but just one of them, perhaps a little ticker or wheather framelet, by right-clicking in that frame and "auto-reload this frame"??... hmm...

Just as always, my usual probs with seemingly tiny+easy little macros at first, then growing and growing and after far too much work still never finished to be published :cool:



Edited 2 time(s). Last edit at 10/07/2018 12:31PM by siria.

Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: JohnHell
Date: October 07, 2018 04:55PM

I'm not happy with modify main macros, but if you want to make it easy, modify main.kmm by changing this. No need to complicate things. Obviously this is tidy work and is not ideal. Ideally should be made a new macro, with a new button, because you don't want to ALWAYS, reload the page when enabling JavaScript. But, anyway, is what you requested.

NOTE: haven't been tested but there is no reason not to work.

pref_ToggleJavaScript{
macroinfo=_("Toggle JavaScript execution");
menuchecked=!getpref(BOOL,$pref_JavaScript);
id(navToggleJS); &_pref_SyncButtons;
statusbar(sub("%s",!getpref(BOOL,$pref_JavaScript)?$off:$on,_("JavaScript execution %s")));
}

to this

pref_ToggleJavaScript{
macroinfo=_("Toggle JavaScript execution");
menuchecked=!getpref(BOOL,$pref_JavaScript);
if(getpref(BOOL,$pref_JavaScript) == "false"){
id(navToggleJS);
id(ID_NAV_RELOAD);
}else{
id(navToggleJS);
}
&_pref_SyncButtons;
statusbar(sub("%s",!getpref(BOOL,$pref_JavaScript)?$off:$on,_("JavaScript execution %s")));
}



Edited 1 time(s). Last edit at 10/07/2018 04:58PM by JohnHell.

Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: Mello
Date: October 07, 2018 05:29PM

That's a good point about not always
wanting to auto reload.

Thanks for the macro change.
Js still toggles, but no auto reload.

I'm using Goanna 76



Edited 1 time(s). Last edit at 10/07/2018 05:30PM by Mello.

Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: JohnHell
Date: October 07, 2018 06:14PM

Quote
Mello
That's a good point about not always
wanting to auto reload.

Thanks for the macro change.
Js still toggles, but no auto reload.

I'm using Goanna 76



These macro things have nothing to do with Goanna or not.

But it doesn't work on main version, so, I have no clue.

I use an ultra-mega-super-customized profile and it works, so I don't know where is the problem in main version. Should work, but it doesn't

I tested a little and I can't get where the problem comes. The only original in my profile is the menu, and it doesn't work either, so something, somewhere is not working, but I don't know...

The best chance is to take that code, put into a new kmm file in your macros profile folder and add a new button (for the ALWAYS reload on toggle function to have two separate macros (with different names, of course)).



Edited 3 time(s). Last edit at 10/07/2018 06:23PM by JohnHell.

Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: siria
Date: October 07, 2018 06:28PM

The quotes around false look unhealthy, but haven't tested either ;-)

Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: JohnHell
Date: October 07, 2018 06:30PM

Quote
siria
The quotes around false look unhealthy

No, never have been.

Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: JohnHell
Date: October 07, 2018 06:41PM

Anyway, all this is not complicated at all, F7 > F5. They are at a finger step. Is not that hard and easier than click a button.

Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: siria
Date: October 07, 2018 06:49PM

Quote
JohnHell
Quote
siria
The quotes around false look unhealthy

No, never have been.

Still worth trying, just in case. Obviously it doesn't work as is in all builds and systems.

The other possibility of which I can think of, would be a general prob:
if possible the old ID-command may be broken?? Sure hope not. Test:
id("navReload") instead of id(ID_NAV_GO)

PS: regardless which macro name is used, the same or a new one, the macroinfo-line should be changed too to reduce future misunderstandings.

Quote
JohnHell
Anyway, all this is not complicated at all, F7 > F5. They are at a finger step. Is not that hard and easier than click a button.

And even easier are mouse gestures! Wish I'd 'discovered' those years ago smiling smiley
Would be lost without them for reloading and closing tabs, needed countless times per session.
Just for trying it's enough to start with 1-2 gestures, and all others off.
Later, if wished, add a bit more. Try it, you don't know what you're missing grinning smiley
Just a tiny flicker of a few millimeters with the right mouse button pressed!



Edited 1 time(s). Last edit at 10/07/2018 06:55PM by siria.

Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: JohnHell
Date: October 07, 2018 07:10PM

Quote
siria

Still worth trying, just in case. Obviously it doesn't work as is in all builds and systems.

It has been, believe me. Quotes or not, is not a difference for the check functionality.

Quote
siria
The other possibility of which I can think of, would be a general prob:
if possible the old ID-command may be broken?? Sure hope not. Test:
id("navReload") instead of id(ID_NAV_GO)

Then shouldn't work in profile macros.

Quote
siria
PS: regardless which macro name is used, the same or a new one, the macroinfo-line should be changed too to reduce future misunderstandings.

Yep. (I don't add macro descriptions tongue sticking out smiley I live in the edge)

Anyway, I don't have time to further checks. Maybe is the menuchecked or something, that I don't have in my own macros.

No time and too much to tests.



Edited 2 time(s). Last edit at 10/07/2018 07:11PM by JohnHell.

Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: siria
Date: October 07, 2018 07:31PM

Quote
JohnHell
Then shouldn't work in profile macros.

Ah it works, but only from profile? Had misunderstood that.
But that brings up a 3rd possibility:
perhaps another macro has hijacked it, using the same name too?
Profile macros probably have a higher priority as global ones.

Mello, to verify if that macro is even called or not, you can insert a test alert below the menuchecked line:
alert("with reload","My JS-toggle");

Then again, not highly likely that both of you have a custom macro interfering.
Perhaps a misunderstanding? Mello, are you aware that the reload should only happen when toggling javascript ON, but not after toggling OFF?



Edited 1 time(s). Last edit at 10/07/2018 08:03PM by siria.

Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: JohnHell
Date: October 07, 2018 08:44PM

Quote
siria
Quote
JohnHell
Then shouldn't work in profile macros.

Ah it works, but only from profile? Had misunderstood that.
But that brings up a 3rd possibility:
perhaps another macro has hijacked it, using the same name too?
Profile macros probably have a higher priority as global ones.

Mello, to verify if that macro is even called or not, you can insert a test alert below the menuchecked line:
alert("with reload","My JS-toggle");

Then again, not highly likely that both of you have a custom macro interfering.
Perhaps a misunderstanding? Mello, are you aware that the reload should only happen when toggling javascript ON, but not after toggling OFF?

I ended testing and I was a total dumb

I forgot to rename the backup.

So, in the end, all works and as I said above, there is no reason to not work.

Note: that I'm not testing/using K-meleon 76 in any of its flavours, anyway. 75.0 here.

Mello, did you make a backup of main.kmm file and left in the macros folder? If so, rename to main.kmm.old and restart it.


I forgot sometimes, as I did now in a hurry. I have no time for this things, really.

Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: Mello
Date: October 07, 2018 10:20PM

It Worked as soon as I renamed the main kmm copy I'd left in macros and restarted smiling smiley

I appreciate your assistance JH, especially as you are pressed for time.

Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: JohnHell
Date: October 08, 2018 03:02PM

To avoid reload. I didn't think about it. It will be annoying to click yes or not after enable javascript, but you'll avoid the reload.


pref_ToggleJavaScript{
macroinfo=_("Toggle JavaScript execution");
menuchecked=!getpref(BOOL,$pref_JavaScript);
id(navToggleJS); &_pref_SyncButtons;
statusbar(sub("%s",!getpref(BOOL,$pref_JavaScript)?$off:$on,_("JavaScript execution %s")));
}

to this

pref_ToggleJavaScript{
macroinfo=_("Toggle JavaScript execution");
menuchecked=!getpref(BOOL,$pref_JavaScript);
if(getpref(BOOL,$pref_JavaScript) == "false"){
id(navToggleJS);
if(confirm("Do I reload?", "Reload on JavaScript enabled", YESNO, QUESTION) == "YES"){
id(ID_NAV_RELOAD);
}
}else{
id(navToggleJS);
}
&_pref_SyncButtons;
statusbar(sub("%s",!getpref(BOOL,$pref_JavaScript)?$off:$on,_("JavaScript execution %s")));
}


Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: Mello
Date: October 08, 2018 07:36PM

It is good to have alternatives, I'll see which I prefer.

So I can use this for a separate macro and create a button?
I think i can do that by pirating some of another now unused macro for the button



Edited 1 time(s). Last edit at 10/08/2018 07:36PM by Mello.

Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: JohnHell
Date: October 08, 2018 08:02PM

Quote
Mello
It is good to have alternatives, I'll see which I prefer.

So I can use this for a separate macro and create a button?
I think i can do that by pirating some of another now unused macro for the button

As long as you change the name of the macro and the "macroinfo", you could do it.

Options: ReplyQuote
Re: Can javascript button on privacy bar be made to auto reload page?
Posted by: Mello
Date: October 09, 2018 12:37AM

Thanks, I'll have a go at weekend.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.