Configuring a Keyboard Shortcut
Posted by: Zero3K
Date: January 13, 2014 11:06AM

I need help configuring one that will open a clicked link in a background tab by pressing Shift and Ctrl.

Re: Configuring a Keyboard Shortcut
Posted by: JamesD
Date: January 15, 2014 03:16AM

Does the method need to be using keyboard? Do you use mouse for clicking link? If you have a middle button on your mouse it is very easy to set up to have middle button open link in background tab.

Go to EDIT - CONFIGURATION - ACCELERATORS and make the following change.

BEFORE:::
# Middle-click links to the background:
#%ifplugin tabs
#MButton = ID_OPEN_LINK_IN_BACKGROUNDTAB
#%else
#MButton = ID_OPEN_LINK_IN_BACKGROUND
#%endif

AFTER:::
# Middle-click links to the background:
%ifplugin tabs
MButton = ID_OPEN_LINK_IN_BACKGROUNDTAB
%else
MButton = ID_OPEN_LINK_IN_BACKGROUND
%endif

Save the file and restart KM.

Re: Configuring a Keyboard Shortcut
Posted by: Zero3K
Date: January 15, 2014 04:23AM

1. Yes.

2. I don't have a middle mouse button.

Re: Configuring a Keyboard Shortcut
Posted by: siria
Date: January 15, 2014 06:49AM
Re: Configuring a Keyboard Shortcut
Posted by: Zero3K
Date: January 15, 2014 08:27AM

I don't want to use the mouse.

EDIT: Oh, I read that page and discovered how to do it like I wanted. Thanks for letting me know.



Edited 1 time(s). Last edit at 01/15/2014 08:30AM by Zero3K.

Re: Configuring a Keyboard Shortcut
Posted by: Zero3K
Date: January 16, 2014 10:02AM

Now I want to know how to get "Continuous Reload" to be assigned to a keyboard shortcut. I hope someone can help me.

Re: Configuring a Keyboard Shortcut
Posted by: siria
Date: January 16, 2014 01:46PM

No prob (if you know how). It's even a native command.
Which shortcut do you want for it exactly?

howto:
http://kmeleon.sourceforge.net/wiki/FAQ#accels
(okay, this part could use a little wiki update, as most parts ;-))
How to figure out the command for "continuous reload":
Edit > Configuration > Commands List, search page for e.g. continuous

Re: Configuring a Keyboard Shortcut
Posted by: JamesD
Date: January 17, 2014 07:57AM

Look in reload.kmm for command for Continuous Reload.

The keys string is within quotes as is the command.

   setaccel( keys [,command]);                                                 Since version 1.1

This method can be used to set keyboard accelerators instead of editing accel.cfg.

Parameter 	Required 	Type 	Value 	Meaning
keys 	YES 	STRING 	A key combination(1) 	The addressed key combination.
command 	YES 	STRING 	A command(2) 	The command to be associated with the key combination.

(1) A space-separated list of predefined key names.
(2) Command can be "ID_..." or "pluginName(pluginCommand)".
If command is an empty string, this is a deletion.

In accel.cfg the format is space separated keys list = command.

Re: Configuring a Keyboard Shortcut
Posted by: Zero3K
Date: January 17, 2014 10:24AM

I got it added as a keyboard shortcut now. Thanks for helping. I just added the following to its default accel.cfg:

ALT R = macros(Reload_Continuously)



Edited 1 time(s). Last edit at 01/17/2014 10:25AM by Zero3K.

Re: Configuring a Keyboard Shortcut
Posted by: Zero3K
Date: January 21, 2014 10:53AM

One more question. How do I get CTRL + ALT + LButton to not open the image's URL when trying to save it?

Re: Configuring a Keyboard Shortcut
Posted by: JamesD
Date: January 22, 2014 12:00AM

I think that an accel definition to blank is a delete. You might try the following.

CTRL ALT LButton = ""


Re: Configuring a Keyboard Shortcut
Posted by: Zero3K
Date: January 22, 2014 02:17AM

I think you misinterpreted my question. I want to have CTRL ALT LButton open the Save Image dialog box without having the page detect the clicking of the mouse button.

EDIT: The reason why its happening is because K-Meleon is sending a "click event" when using the mentioned shortcut like how Opera used to do. Here's some JS code that will help figure out how to fix it in K-Meleon:

window.addEventListener('click', function (e) {
	if (e.target.tagName === 'IMG' && e.altKey && e.ctrlKey)
		e.stopPropagation();
}, true);



Edited 2 time(s). Last edit at 01/22/2014 03:15AM by Zero3K.

Re: Configuring a Keyboard Shortcut
Posted by: JamesD
Date: January 22, 2014 04:16AM

Try this in your accels.cfg file.

ALT SHIFT LButton = ID_SAVE_IMAGE_AS

If this works then we can try to move it to your selection of keys.

Re: Configuring a Keyboard Shortcut
Posted by: Zero3K
Date: January 22, 2014 04:27AM

That doesn't work. CTRL ALT LButton does work except its sending a "click event". I would like for it to stop doing that.

Re: Configuring a Keyboard Shortcut
Posted by: JamesD
Date: January 22, 2014 05:02AM

I have just saved 15 images without sending a "click". I used this:

ALT SHIFT N = ID_SAVE_IMAGE_AS

There was no highlight on the image. There was no return key or button click used.

I am just not sure if you are trying to do the same thing that I needed to do.

Re: Configuring a Keyboard Shortcut
Posted by: Zero3K
Date: January 22, 2014 06:47AM

Is there no way to get CTRL ALT LButton to not send a click event?

Re: Configuring a Keyboard Shortcut
Posted by: siria
Date: January 22, 2014 08:27AM

Sorry but I'm really confused too. In the first line why anything happens when you do that, because nothing happens for me when I click for example on those images here, except that they are highlighted. But both our profiles are customized, and I didn't really investigate deeply ;-)
Next confusing, one time you say you want nothing to happen, and then you say, you want the image-save-command? Then nothing again?

Does it not work if you use one of those in accels.cfg in the current profile folder?
CTRL ALT LButton = 0
CTRL ALT LButton = ID_SAVE_IMAGE_AS

If not, then it might be that the setting in tools/mouse accelerators has some sort of priority. No idea. In that case I'd switch back and only add what I really want as single shortcuts in accels.cfg

PS: too bad, *finally* someone savvy in JS and currently nothing needed for some new macro grinning smiley



Edited 1 time(s). Last edit at 01/22/2014 08:29AM by siria.

Re: Configuring a Keyboard Shortcut
Posted by: Zero3K
Date: January 22, 2014 10:13AM

1. Take a look at http://my.opera.com/community/forums/topic.dml?id=1265992 for more info about what I'm wanting to be done.

2. I'm not proficient in JS code. I just took that code from the Opera Extension that fixed it which is available at https://addons.opera.com/en/extensions/details/fix-altctrlclick/?display=en.

Re: Configuring a Keyboard Shortcut
Posted by: JohnHell
Date: January 22, 2014 10:24AM

Quote
Zero3K
window.addEventListener('click', function (e) {
	if (e.target.tagName === 'IMG' && e.altKey && e.ctrlKey)
		e.stopPropagation();
}, true);


Don't expect anything else if the code is in the page and you don't disable Javascript (you can disable after page load). You can't fight an event listener with magic.

As simple as that.

The alternative that you won't like, because it requires more steps, is to go to the view menu and choose images or page images (note: I don't know if in the latest version (74) there is such option and with what text definition).

K-meleon will open a new window with the page images. Then you can save from that page absolutely anonymously except if K-meleon haven't cached them, because it must request again to the server when downloading, but wouldn't be an even capture.

I improved the default macro (I think I posted so should be somewhere in the forum) to retrieve the CSS images too.

BUT, yes, there is a BUT, if the images are displayed by Javascript calls (aren't defined in the HTML body or by CSS), they won't be gathered by K-meleon in any way (I don't remember now if preloaded images could be gathered). In this case, the only way is to enable javascript and do your best to keep your anonymity.

EDIT: I was writting this while you posted the previous message.
EDIT2: after read what you posted, I can't help with it as every browser I have used behave the same way, maybe Opera not, as was the first browser with mouse gestures.

-----------------------------
If I'm required and I don't reply in a long time




Edited 2 time(s). Last edit at 01/22/2014 10:30AM by JohnHell.

Re: Configuring a Keyboard Shortcut
Posted by: JamesD
Date: January 22, 2014 08:23PM

Quote
Zero3K
One more question. How do I get CTRL + ALT + LButton to not open the image's URL when trying to save it?

I went to that image that you noted.
http://img543.imageshack.us/img543/6521/1276789335240.jpg
You are right. In that situation the code that I gave you does not work. Does a right click and choose "Save image as" not get you what you wish? Do you wish the full size image or just the size your screen is displaying? Does "Save image as" open the URL of the image again?

Re: Configuring a Keyboard Shortcut
Posted by: JohnHell
Date: January 23, 2014 01:45AM

Wait, but, are we talking about the example about an image at imageshack?

A standalone image?

Truth, the image is not served directly, probably is being sent by a PHP server or ASP. You can test it by showing the source code and discovering that the source code is the image itself. If you show the source again, now you have the binary data, the real source. I've done this in the past by myself to prevent hotlinking in one of my sites.

But what I'm trying to say is that the image server, this way, hasn't any script that can track you by mouse events. Could be done, of course, but in this kind of scenarios it's not usual to see a crafted page with an event listener script to show just one image as if it's standalone.

What it really happens and you must concern, if the concerns are privacy, is that the PHP/ASP server is logging the access to the image because can measure with the server side script behind the whole process. And, depending on the access displays one image or another, or an error, or whatever. And to avoid this..., there is no way. But I ensure you that the mouse it's not tracked (unless what I said above).

-----------------------------
If I'm required and I don't reply in a long time


Re: Configuring a Keyboard Shortcut
Posted by: JamesD
Date: January 23, 2014 06:15AM

In the case of the image at imageshack, all that is required is to press CTRL + S. The URL ends in the image name/number dot jpg. I think nothing is sent to the server. There is no code except the compressed (jpeg) image. Looking at the page source only displays the image again.

I tested by first clearing my cache and then going to the imageshack site. I checked work offline and then pressed CTRL + S. I was able to save the full size image. I had my KM window sized below my normal size so that I was shown the smaller image when first loaded. Nothing I did changed the size of the image displayed.

Re: Configuring a Keyboard Shortcut
Posted by: Zero3K
Date: January 23, 2014 06:50AM

Here's a link to an image on the site that is causing the problem:

http://www.pixiv.net/member_illust.php?mode=medium&illust_id=41126478

Re: Configuring a Keyboard Shortcut
Posted by: JohnHell
Date: January 23, 2014 08:40AM

This is one of those weird pages where, even disabling javascript, something still works (Seamonkey 2.9.1 does the same) and the javascript still executes.

I think there is no way to avoid mouse tracking here. Maybe is something related to how Gecko works or a glitch or whatever.

It happens to me with some other pages too and it's quite annoying.

The only way to fix it and avoid tracking and capture mouse events is to load the page without javascript enabled.

-----------------------------
If I'm required and I don't reply in a long time


Re: Configuring a Keyboard Shortcut
Posted by: siria
Date: January 23, 2014 03:30PM

Uah what a horrible page, and in KM1.6 I don't even manage to get the picture shown at all. Or perhaps it's one of my adblock settings or whatever, never mind. Anyway, JS in general, sometimes it seems to behave like flash: once an object is already loaded and active, it can only be "killed". Flash has an extra button for killing.

But with JS, what if you click the stop button first? Or use the Escape-key as keyboard shortcut for it, or menu View>Stop.
Often (or always??) works well for me as killer for active scripts. Even without toggling JS first.
Provided the page is fully loaded already, otherwise that stupid 1.6/1.7 bug kicks in that loading can't be interrupted without killing the systems internet connection. No idea about the current versions - is that bug fixed now in KM74/1.8??

And there's another 'harder' pref to toggle JS, that might help too. It's used in the policies manager and disables even own macros containing JS snippets.

Hmm, that downright screams to replace the normal JS-toggle button with a little macro, which in case of toggling "off" fires the stop command first...



Edited 3 time(s). Last edit at 01/23/2014 03:39PM by siria.

Re: Configuring a Keyboard Shortcut
Posted by: JamesD
Date: January 23, 2014 10:56PM

If you have JavaScript off when you load the page, you still get the main image. If you then go offline you should be able to do anything you wish with the image. There is no script loaded and you no longer are connected to the internet. Nothing can be reported back to the website.

Re: Configuring a Keyboard Shortcut
Posted by: JohnHell
Date: January 23, 2014 11:07PM

This is for Siria smiling smiley Not you JamesD (I was writting this while you posted now smiling smiley)

What javascript pref do you mean?

Stop has nothing to do with scripts but page loading and scripts loading. Of course, if you stop to load some script, that script doesn't work as functions are broken (usually). And this happens most to pages that the scripts aren't written/called from html>head. But, anyway, that only works before the page fully loads. Once loaded, stop only stops animated gifs.

And I noticed now that, at least 1.6b2.6, doesn't stop animated PNG hehe.

-----------------------------
If I'm required and I don't reply in a long time


Re: Configuring a Keyboard Shortcut
Posted by: siria
Date: January 24, 2014 02:56AM

I understand of course that the stop button stops loading stuff smiling smiley But sometimes there are scripts that start running after they are loaded, and keep on running, don't stop by themselves. That's when a stop command helps. Although for lack of a current test page I'm not sure enough to put my hand into fire for it ;-)

But forgot something, my stop button is not the normal one. Long time ago I was experimenting with various stopping actions, perhaps a desperate attempt to fix that stupid 1.6/1.7 bug, but no chance.
My stop button is since then set to inject "window.stop()"
Can't remember if that was any better, but if anyone wants to try on a problematic page, type into urlbar and enter:
javascript:window.stop()

Still don't manage to see that pic on that weird side, no idea why, so can't try myself.

(Hm, or it's actually possible that I needed that stop for stopping animated images, many years ago? Memory quite dim there...)



Edited 1 time(s). Last edit at 01/24/2014 02:58AM by siria.

Re: Configuring a Keyboard Shortcut
Posted by: Zero3K
Date: January 24, 2014 03:30AM

The code that's causing the closing when trying to use CTRL ALT LButton to save the original sized version of a picture on Pixiv.net is the following:

onclick="(window.open('', '_self')).close()

Re: Configuring a Keyboard Shortcut
Posted by: JohnHell
Date: January 24, 2014 05:30AM

I have that stop() function too because I tested too, but that doesn't work. Indeed, in the Mozilla knowledge base states that actually, doesn't stop scripts. Or at least is what I understand and the tests I did in the past:
https://developer.mozilla.org/en-US/docs/Web/API/Window.stop

@Zero3k
I didn't register and I didn't test such full size page, Zero3k, but that should be solved disabling javascript if it doesn't happen as with the small size image size link you posted. Onclick are not problematic functions as what I told.

I recommend you to bind some key to toggle javascript on/off macro and, if so, calling to the save function to do all in one.

-----------------------------
If I'm required and I don't reply in a long time




Edited 1 time(s). Last edit at 01/24/2014 05:32AM by JohnHell.

K-Meleon forum is powered by Phorum.