General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Pages: Previous12
Current Page: 2 of 2
Re: Spacebar hot key problem / open page with Opera
Posted by: siria
Date: August 19, 2019 05:36AM

@cpm1a
add linebreaks after the "{" and before "}" and you'll start seeing that it's really the same structure as in the template. Just different names. And then insert the setmenu line right above the setaccel line again.

Or use the template completely again, rename it, and just exchange the 2 action lines (toggle images/ reload) with the Opera path and exec.

Options: ReplyQuote
Re: Spacebar hot key problem / open page with Opera
Posted by: cpm1a_new
Date: August 19, 2019 08:47AM

tried hard, but didn't make it... can you help? the template:
-----------
TogImgReloadWeb{
macroinfo=_("Toggle image loading")." + "._("&Reload");
macros("pref_ToggleImages");
id(ID_NAV_RELOAD);
}

_TogImgReloadWeb_BuildMenu{
# in VIEW menu, and right-click in page
setmenu("Nav",macro,"Toggle Images","TogImgReloadWeb","id(ID_NAV_RELOAD)");
setaccel("CTRL VK_Space","macros(TogImgReloadWeb)");
setcmdicon("macros(TogImgReloadWeb)", "picture_selected.png");
}

$OnInit=$OnInit."_TogImgReloadWeb_BuildMenu;";
$macroModules=$macroModules."TogImgReloadWeb;";
------------

the path to Opera is in the hermes macro:

$_OPERA_WAY_="\""."d:\\Programs\\operausb1218en\\opera.exe\"";

or

$__data=readreg("HKCR","Applications\\opera.exe\\shell\\open\\command\\")

Options: ReplyQuote
Re: Spacebar hot key problem / open page with Opera
Posted by: siria
Date: August 19, 2019 09:03AM

Quote
cpm1a_new
tried hard, but didn't make it...

Please post the code you tried, your modified macro, to find the prob.

Options: ReplyQuote
Re: Spacebar hot key problem / open page with Opera
Posted by: cpm1a_new
Date: August 19, 2019 09:25AM

my code:
--------------
$_OPERA_WAY_="\""."d:\\Programs\\operausb1218en\\opera.exe\"";

_OPEN_in_OPERA_{exec($_OPERA_WAY_." ".$URL);}
setmenu("Nav",macro,"Open in Opera","_OPEN_in_OPERA_");
_OPEN_in_OPERA_KEY_{setaccel("CTRL S","macros(_OPEN_in_OPERA_)");
}
$OnInit=$OnInit."_OPEN_in_OPERA_KEY_;";



Edited 1 time(s). Last edit at 08/19/2019 09:26AM by cpm1a_new.

Options: ReplyQuote
Re: Spacebar hot key problem / open page with Opera
Posted by: siria
Date: August 19, 2019 09:43AM

Quote
cpm1a_new
my code:
--------------
$_OPERA_WAY_="\""."d:\\Programs\\operausb1218en\\opera.exe\"";

_OPEN_in_OPERA_{exec($_OPERA_WAY_." ".$URL);}
setmenu("Nav",macro,"Open in Opera","_OPEN_in_OPERA_");
_OPEN_in_OPERA_KEY_{setaccel("CTRL S","macros(_OPEN_in_OPERA_)");
}
$OnInit=$OnInit."_OPEN_in_OPERA_KEY_;";

Thanks. OK, so you forgot to add the linebreaks at the { } as I wrote in my previous post.
Merely adding linebreaks makes your code look like that:

$_OPERA_WAY_="\""."d:\\Programs\\operausb1218en\\opera.exe\"";

_OPEN_in_OPERA_{
exec($_OPERA_WAY_." ".$URL);
}

setmenu("Nav",macro,"Open in Opera","_OPEN_in_OPERA_");

_OPEN_in_OPERA_KEY_{
setaccel("CTRL S","macros(_OPEN_in_OPERA_)");
}

$OnInit=$OnInit."_OPEN_in_OPERA_KEY_;";

Do you see now where the prob is?
The setmenu line is lonely in the middle, outside of the macro modules.
Now place setmenu directly above setaccel and it should start working (in theory)



Edited 5 time(s). Last edit at 08/19/2019 10:00AM by siria.

Options: ReplyQuote
Re: Spacebar hot key problem / open page with Opera
Posted by: cpm1a_new
Date: August 19, 2019 10:04AM

> it should start working (in theory)
it works, thanks!

Options: ReplyQuote
Re: Spacebar hot key problem / open page with Opera
Posted by: siria
Date: August 19, 2019 10:42AM

Quote
cpm1a_new
> it should start working (in theory)
it works, thanks!

Great! grinning smiley
PS: if you or anyone would like tools to help for debugging, have posted some crucial beginner tips here:
http://kmeleonbrowser.org/forum/read.php?1,149318,149384#msg-149384

Options: ReplyQuote
Re: Spacebar hot key problem / open page with Opera
Posted by: cpm1a_new
Date: August 19, 2019 11:00AM

and this one crashes KM :-(

where am i wrong?
------------
KM_ToggleAdblock{
macroinfo=_("Toggle Adblock");
macros("KM_ToggleAdblock");
}

_KM_ToggleAdblock_BuildMenu{
setmenu("Nav",macro,"Author/User","KM_ToggleAdblock");
setaccel("CTRL SHIFT VK_SPACE","macros(KM_ToggleAdblock)");
}

$OnInit=$OnInit."_KM_ToggleAdblock_BuildMenu;";
$macroModules=$macroModules."KM_ToggleAdblock;";

Options: ReplyQuote
Re: Spacebar hot key problem / open page with Opera
Posted by: siria
Date: August 19, 2019 11:51AM

(_HowTo_ modify menus in menus.cfg or using macros)

Quote
cpm1a_new
and this one crashes KM :-(

where am i wrong?
------------
KM_ToggleAdblock{
macroinfo=_("Toggle Adblock");
macros("KM_ToggleAdblock");
}

_KM_ToggleAdblock_BuildMenu{
setmenu("Nav",macro,"Author/User","KM_ToggleAdblock");
setaccel("CTRL SHIFT VK_SPACE","macros(KM_ToggleAdblock)");
}

$OnInit=$OnInit."_KM_ToggleAdblock_BuildMenu;";
$macroModules=$macroModules."KM_ToggleAdblock;";

Ouch.... main prob here:
KM_ToggleAdblock{
macroinfo=_("Toggle Adblock");
macros("KM_ToggleAdblock");
}


You are DELETING a native macro that is defined in main.kmm, and replace it with your own version. And your own version really does nothing except calling itself over and over - an endless loop!

If all you want is to add a shortcut and setmenu line, do only this:
KM_ToggleAdblock{
macroinfo=_("Toggle Adblock");
macros("KM_ToggleAdblock");
}

_KM_ToggleAdblock_BuildMenu{
setmenu("Nav",macro,"Author/User","KM_ToggleAdblock");
setaccel("CTRL SHIFT VK_SPACE","macros(KM_ToggleAdblock)");
}

$OnInit=$OnInit."_KM_ToggleAdblock_BuildMenu;";
$macroModules=$macroModules."KM_ToggleAdblock_menu;";

But your menuline "Author/User" is completely uncomprehensible without previous knowledge that you actually toggle your userContent.css with the adblock toggle, and want to mimick Opera-styles. Of course, for your OWN macro it's fine whatever you want, just noting this hint for other readers.

If you plan to add more menu+shortcuts this way, for already existing macro actions, you can combine them all into 1 macro, for example:
_myMacro_MenusAccels{
setmenu("Nav",macro,"Author/User","KM_ToggleAdblock");
setmenu("menuname",macro,"menu text2","macroname2");
setmenu("menuname",macro,"menu text3","macroname3");
setaccel("CTRL SHIFT VK_SPACE","macros(KM_ToggleAdblock)");
setaccel("shortcut2","macros(macroname2)");
setaccel("shortcut3","macros(macroname3)");
}



The usual way for SUCH cases, to only add menulines and shortcuts for already existing native menus, would be to do what Hermes suggested: tweak menus.cfg. And add the shortcut in accel.cfg

HowTo: For example add at the bottom of menus.cfg:
!Nav{
Author User Styles=macros(KM_ToggleAdblock)
}

The "!" before the menu name means: modify it.
If you want to define a line position, it's possible to add a number 0-99 at end:
Author User Style=macros(KM_ToggleAdblock)|0

Such modifications should work in menus.cfg in the profile.
But due to an old bug with the rebarmenu plugin it may not, then add those changes *additionally* at the bottom of the global menus.cfg in .../k-meleon/browser/defaults/settings/menus.cfg
The prob is, changes in those default files can accidentally get lost when installing a new KM-version, which overwrites those files again. As backup I'd keep a copy in the same folder, renamed to menus_myChanges.cfg. Same trick for accel.cfg Just to make it easier to find and restore the own settings again later, after updating KM, by doing a file search for all backup files with "mychanges" in their name.



Edited 5 time(s). Last edit at 08/19/2019 03:26PM by siria.

Options: ReplyQuote
Re: Spacebar hot key problem / open page with Opera
Posted by: cpm1a_new
Date: August 19, 2019 12:15PM

thanks, got it working. and great info on tweaking menus.cfg and defining line positions

Options: ReplyQuote
Re: Spacebar hot key problem / imagekiller
Posted by: anonymous
Date: August 23, 2019 03:16PM

@siria
Had a look at the links and the last one did help improve toggling. Found no example for the 'killer prob' in this link yet.

Options: ReplyQuote
Re: Spacebar hot key problem / imagekiller
Posted by: cpm1a_new
Date: August 26, 2019 10:15AM

---------------
$_PP_WAY_="\""."d:\\Programs\\PotPlayer\\PotPlayerMiniXP.exe\"";

_OPEN_in_PP_{
exec($_PP_WAY_." ".$URL);
}

_OPEN_in_PP_KEY_{
setmenu("Nav",macro,"Send to PotPlayer","_OPEN_in_PP_");
setaccel("CTRL P","macros(_OPEN_in_PP_)");
setcmdicon("macros(_OPEN_in_PP_)", "pp.png");
}

$OnInit=$OnInit."_OPEN_in_PP_KEY_;";
----------------
this works, but i tried to make "Send to PotPlayer" also appear in context menu for a youtube link and failed so far. is it possible?



Edited 2 time(s). Last edit at 08/26/2019 06:28PM by cpm1a_new.

Options: ReplyQuote
Re: Spacebar... and other KM tweaks, menus, first macros, beginner tips (howto)
Posted by: siria
Date: August 26, 2019 12:27PM

Quote
cpm1a_new
this works, but i tried to make "Send to PotPlayer" also appear in CONTEXT menu for a youtube link and failed so far. is it possible?

For sending LINKS to the exe use $LinkURL instead of $URL (=page)
As parent menu use for example "LinkOpenExternal" instead of "Nav".
That is a little group inside the link context menu. Major menus consist of several subgroups to get similar actions shown together.
Or insert it into any other menu or submenu, all default menu names are created in menus.cfg

I'd just recommand to use a bit more descriptive macro names (potplayer instead of everywhere only PP) ;-)



Edited 2 time(s). Last edit at 08/26/2019 01:07PM by siria.

Options: ReplyQuote
Re: Spacebar... and other KM tweaks, menus, first macros, beginner tips (howto)
Posted by: cpm1a_new
Date: August 26, 2019 06:25PM

@siria
thanks

Options: ReplyQuote
Re: Spacebar hot key problem / imagekiller
Posted by: anonymous
Date: September 05, 2019 12:46PM

========= other macro: image toggle with JAVASCRIPT ========

@Siria
Still reading parts of your huge posts from last month. The parent window can read and write to its own frame tags containing 3rd party links referring to media or content pages without errors or warnings. Type of frame is in 'contentDocument' and there may be a 'src' attribute. What smelled like macrolanguage+JS bugs and engine RESTRICTIONS and XXS barriers of 3rd party frames is meaningless if injectJS with 'frame' option opens them one by one.

Options: ReplyQuote
Re: Spacebar hot key problem / imagekiller
Posted by: siria
Date: September 05, 2019 10:19PM

Quote
anonymous
The parent window can read and write to its own frame tags containing 3rd party links referring to media or content pages without errors or warnings. Type of frame is in 'contentDocument' and there may be a 'src' attribute.

Yes that's what I had finally figured out too, after searching around in the web.
And since then my iframes-loop can change those attributes, and even fill html text into empty blocked frames.

Quote
anonymous
What smelled like macrolanguage+JS bugs and engine RESTRICTIONS and XXS barriers of 3rd party frames is meaningless if injectJS with 'frame' option opens them one by one.

Hmm... am aware of that frame-option from the wiki, but have never seen an example for it. Always thought it just injects into the current hover frame, when started by its context menu?
It's explained as "frame = Address the current frame only.", and syntax is:
$value = injectJS( JS , nothing/alltabs/frame/hidden);
But how would that help to "toggle all images in current page" at once? Users will certainly not fire that command for every single frame manually.
For a moment wondered now if you suggest that injectJS could adress frames by their number too, instead of just "current frame", but have very strong doubts again...



Edited 1 time(s). Last edit at 09/05/2019 10:36PM by siria.

Options: ReplyQuote
Re: Spacebar... / KG76 lost crucial images feature??
Posted by: siria
Date: September 05, 2019 10:43PM

But have ran into a completely different prob again, a real new killer bug, for images in general, not just macros (or bug-feature?! Or perhaps just settings related?)

KM-Goanna76 doesn't know this essential CSS anymore!
img:-moz-user-disabled {.....}
img:-moz-suppressed {......} 

Only "img:-moz-broken" still works.
Have searched around the web for hours, if Mozilla has perhaps deprecated it, or it got a universal name now, or whatever, but found nothing. Even inside omni.ja, in html.css, those css-rules are still contained as they were since forever. You don't happen to know anything about this...?

One of my biggest struggles with older KM versions has always been that most missing or blocked images just vanish completely, without any hint for the user that an image even existed. Especially if the size is undefined and they have no alt-text, as in most forums. Like this one:



A decade ago have struggled endlessly with prefs and styles until finally adding complicated code to my user-css (adblock.css), which gave all "normal" images at least a min-size and thick border.
That code also included those very handy -moz- properties.

Doing a bit short testing in KM76 now showed that "broken" images are finally getting a working placeholder out-of-box, without needing further tricks. So far so great.
But now am afraid the whole disaster is starting yet AGAIN, not for "broken", but for "blocked" and "supressed" images sad smiley
No placeholders again, nothing - and now not even CSS-styling possible anymore.
And also noticed that images which have their source only in a modern "srcset", but no "src" tag vanish completely too.

Checking the last KM76RC2-GECKO version, it seems that could still handle "-moz-user-disabled" fully.
But "-moz-suppressed" was already broken too. But at least it did not crash scripts, as KMG now does.

No clue what happens, so far have only 2 ideas:
- did Mozilla or PM silently remove those functions?? Was the code getting too complicated, or do they insist now that blocked or suppressed images MUST vanish without any chance for users to see at least an empty placeholder or icon?
- or could it possibly just be related to some privacy settings? (like the "visited links" history issue)
But if so, that would probably be some default setting, since that was checked with a rather fresh unzipped installation, only a few macros added but hardly any tweaks, since that was just a permanently offline computer.

Here's a little extract of my scripts (am testing with macro testinjectcode):
// blocked = by permissions.default.image pref  (and others?)
try {var imgBLOCKED=document.querySelectorAll('img:-moz-user-disabled'); alert( imgBLOCKED.length+' blocked images'); }
catch(e){alert('Error, crashing script:\nimg:-moz-user-disabled');}
	
//  suppressed = in permissions.sqlite   (those are NOT counted as BLOCKED if all pics are blocked!)
try {var imgSUPPR=document.querySelectorAll('img:-moz-suppressed');alert( imgSUPPR.length+' suppressed images'); }
catch(e){alert('Error, crashing script:\nimg:-moz-suppressed');}



Edited 2 time(s). Last edit at 09/05/2019 11:00PM by siria.

Options: ReplyQuote
Re: Spacebar hot key problem / imagekiller
Posted by: anonymous
Date: September 06, 2019 12:51PM

@siria
Can't help with CSS, my source code has moz-suppressed is in nsCSSPseudoClasses.h source file.
Only found iframes with trackers and used virtual servers to test 3rd party iframes with images. Extended docinfo with code from the now obsolete imagekiller macro code and tested from right click menu on an iframe. Macros kplugin looks for a string named "frame".
injectJS("(function(){".$JS_func."})()","frame");


Options: ReplyQuote
Re: Spacebar... / KG76 lost crucial images feature??
Posted by: anonymous
Date: September 07, 2019 08:00PM

@siria
Looked closer at -moz-user-disabled and -moz-suppressed. Not important, but it was nsCSSPseudoClassList.h and not the file name I pasted last time. I guess they are 'chrome only' now. Never needed them and some sites detected ad blocking like you did. It was an improvement.

I can see that broken image frame in your message. Added a user style at that time too.

Your online browsers should handle 'srcset' and countless variations with toggle image if you add script code for it. Opens fast without page scripts and a click shows images. There are some vicious sites though, but that's the fun part.

Options: ReplyQuote
Re: Spacebar... / how to get hover enabled??
Posted by: siria
Date: September 09, 2019 12:37AM

For another macro, am running against yet another wall again:
How in the world get ":hover" working in quirksmode pages for ALL elements, not just links?
Have searched the whole web endlessly again, yet didn't even find the trace of an answer sad smiley Must be either impossible - OR too baby easy to mention it...
Exchanging the doctype dynamically changes nothing.
a test page: http://www.verticalbrowser.com/firefoxtest.htm
a test code: var ele1=document.querySelector(':hover'); alert('ele1: '+ele1);

Options: ReplyQuote
Re: Spacebar... / how to get hover enabled??
Posted by: cpm1a_new
Date: September 10, 2019 05:58AM

Quote

!Nav{
Author User Styles=macros(KM_ToggleAdblock)
}

The "!" before the menu name means: modify it.
If you want to define a line position, it's possible to add a number 0-99 at end:
Author User Style=macros(KM_ToggleAdblock)|0

thanks, it works!

Options: ReplyQuote
Re: Spacebar... / how to get hover enabled??
Posted by: anonymous
Date: September 10, 2019 06:47PM

@siria
Hover should work for known tag names in quirks mode.

Options: ReplyQuote
Re: Spacebar... / how to get hover enabled??
Posted by: siria
Date: September 10, 2019 08:49PM

Quote
anonymous
Hover should work for known tag names in quirks mode.

YES!! Finally light at the end of the tunnel! grinning smiley
This was the missing clue since weeks: "for known tag names"
Always so much precious time wasted, sigh, and this time just because everywhere on the web it was only claimed "quirksmode :hover works only for LINKS, period." Now am glad that one of my favorite new macros can work on 95-100% of websites, not just 80% smiling smiley
So far have just done a quick little test in KM1.6 and KMG76.2, using a long list like this:
html:hover, body:hover, div:hover, p:hover, span:hover, table:hover, th:hover, tbody:hover, tr:hover, td:hover, img:hover, a:hover, form:hover, ul:hover, li:hover, h1:hover, h2:hover, h3:hover, h4:hover, video:hover, nav:hover, section:hover, canvas:hover, iframe:hover, object:hover, embed:hover, script:hover, noscript:hover, *[src]:hover, *[id]:hover, *[name]:hover, *[href]:hover, *[style]:hover, *[class]:hover

If that can be shorter with some universal trick it would be better, but otherwise no prob either.

Options: ReplyQuote
Re: Spacebar... / how to get hover enabled??
Posted by: anonymous
Date: September 10, 2019 10:15PM

@siria
Number one in forum search for 'cuantos' knew everything about tag names.

Options: ReplyQuote
Pages: Previous12
Current Page: 2 of 2


K-Meleon forum is powered by Phorum.