Extensions :  K-Meleon Web Browser Forum
All about K-Meleon extensions. 
Divert left button click to open in new tab
Posted by: JamesD
Date: February 14, 2016 02:56PM

Moving the thread from Improvement requests to Extension so we can attach files to the posts.

From: http://kmeleonbrowser.org/forum/read.php?4,137550

Options: ReplyQuote
Re: Divert left button click to open in new tab
Posted by: siria
Date: February 14, 2016 08:51PM

attached beta version 0.7, explanation in other thread above

Attachments: KMLClick_v07.kmm (5 KB)  
Options: ReplyQuote
Re: Divert left button click to open in new tab
Posted by: JamesD
Date: February 14, 2016 09:59PM

@ siria

You are right. The diversion can only be switched twice, then it is stuck. My guess would be there is only a small amount of memory set aside for this and we go beyond the limit. That is just a guess.

I tried both your code and my code. Always gets stuck about the same place. No idea where to go from here.

Attachments: KMLclick.7z (1.7 KB)  
Options: ReplyQuote
Re: Divert left button click to open in new tab
Posted by: siria
Date: February 18, 2016 06:49AM

Me neither :-(
Theory: it seems like once the shortcut for one combination was disabled by "" it can never be filled again in a session, not even used for other commands anymore.

Options: ReplyQuote
Re: Divert left button click to open in new tab
Posted by: JohnHell
Date: February 18, 2016 03:49PM



I'm pending on test the latest version of JamesD macro, but, my last posted version, worked toggling the accel infinite number of times.

My initial guess is that you are cascading the menu/button toggling and that makes the code to get stuck.

They could be separated and then call the accel change.

Options: ReplyQuote
Re: Divert left button click to open in new tab
Posted by: JohnHell
Date: February 18, 2016 04:45PM

Ok, tested. I was wrong. Mine didn't work either

Actually, it goes beyond, @Siria and it isn't the double quotes "", but anything it isn't a macro. A command also disables it. So, lets use a macro, the only thing accepted, to tell it to just open($LinkURL);

Note that I removed the cascading, just in case, and I placed the macros in order of parsing, but the code hasn't changed much, only the setaccel change.

The most changed is the following. It is not pretty, but:

KMLClick_Click {
   if(($LinkURL != "" ) and (index($LinkURL,"javascript") == -1) and (index($LinkURL,"#") != length($LinkURL)-1)){
        $_KMLClick_status_frontback == 0 ? opentab($LinkURL) : openbgtab($LinkURL);
   }else{
        &KMLClick_go;
   }
}

KMLClick_go{
	open($LinkURL);
}

_KMLClick_behavior{ 
        if($_KMLClick_status == "true"){
                setaccel("LButton", "macros(KMLClick_Click)");
                $__wd = "ON";
        }else{
                setaccel("LButton", "macros(KMLClick_go)");
                $__wd = "OFF";
        }
statusbar("Left Click diverion is ".$__wd);
}


Also I want to warn here that the command open($LinkURL) opens an href attribute. What does that mean? That it opens whatever is set in an href in a link, but won't open javascript attributes as onclick or event listeners.

We could go beyond and try to read onclick by injecting JS, but... eventlisteners can change very quick so, I don't know, that is too much.



Edited 2 time(s). Last edit at 02/18/2016 04:57PM by JohnHell.

Attachments: KMLclick065.zip (2.4 KB)  
Options: ReplyQuote
Re: Divert left button click to open in new tab
Posted by: JamesD
Date: February 18, 2016 05:57PM

I tried your code in last post and works two more times but then quits also.

I am beginning to think that there is a reason we have usually seen set accel's in the OnInit event only.

I think the only reasonable solution for this is if Dorian would create a command ID which is everything the left click does. We could then have one set accel and just change what it does, like I tried at first.

Note: I do not mean to imply that enough users are asking for this that it makes sense to spend Dorian's time on it.



Edited 1 time(s). Last edit at 02/18/2016 06:02PM by JamesD.

Options: ReplyQuote
Re: Divert left button click to open in new tab
Posted by: JohnHell
Date: February 18, 2016 07:39PM

For me work always, regardless of the Nth times I toggle on and off :-?

But I think you refer that the full left click functionality stops. As I said, this is because, for example, with the buttons in this edit area, there isn't any href, so nothing can happen.

And the side effect I commented previously, that the enter/intro keys are affected as well.


Anyway, I'm with you, and, to be fair, I can't understand, in the other hand, that obsession to change the default left click functionality. As others noted before, I just CTRL+click and other combinations

Let this extension rest in peace xD

Options: ReplyQuote
Re: Divert left button click to open in new tab
Posted by: siria
Date: February 19, 2016 10:19AM

You have a misunderstanding. The prob isn't whether a link is opened in a new or the same tab, that's easy to handle with an if-condition.
The only prob is to get the original action executed (whatever that is) when there is no link at all, how to disable the diversion shortcut.

One of the fixes in my last posted version (other thread, link above) was actually to avoid at least opening a new *empty* tab when there is no link at all, what your version still does when clicking e.g. on the background. Because then your macro versions still fire open(Link):

Quote
JohnHell
KMLClick_Click {
   if(($LinkURL != "" ) and (index($LinkURL,"javascript") == -1) and (index($LinkURL,"#") != length($LinkURL)-1)){
        $_KMLClick_status_frontback == 0 ? opentab($LinkURL) : openbgtab($LinkURL);
   }else{
        &KMLClick_go;
   }
}

KMLClick_go{
	open($LinkURL);
}

But anyway, although fixed that easy issue , of course still doesn't help to fix the real prob, to completely disable the diverted accel shortcut sad smiley

Personally my best hopes are still on examining the available touchpad options and workarounds, to find the easiest middle-click emulation. E.g. using the left touchpad button for it sounds really promising to me, since the left-action can just as well be fired by tapping on a link.

And there's also that new "superdrag" function in KM76, what some people seem so obsessive about too, but among others probably not widely known yet? That means if mousegestures are enabled, clicking on something (link,image,selection) and dragging a tiny bit to the right has a flexible and customizable context action. Not sure how easy on a touchpad, but worth testing.

Anyway, couldn't quite stop yet wondering how on earth that diversion macro could be of any use at all and at least run submit buttons, and found now this:
Clicking Alt+Ctrl before left-click (on european keyboards AltGrp-button) actually executes the "Preview" button in this forum! Perhaps works elsewhere too?? No idea, but at least a partly fix...

Options: ReplyQuote


K-Meleon forum is powered by Phorum.