General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
How to open a right-click-selected-url in a new tab?
Posted by: Voltaire
Date: April 21, 2016 12:09PM

When selecting a text that has the syntax of a valid url and right-clicking it, you get the option to open it as URL. So far so clear. But how to open it in a new tab or window (and not in the same tab or window)?



Edited 1 time(s). Last edit at 04/21/2016 12:13PM by Voltaire.

Options: ReplyQuote
Re: How to open a right-click-selected-url in a new tab?
Posted by: rodocop
Date: April 21, 2016 03:50PM

clickable image:



Options: ReplyQuote
Re: How to open a right-click-selected-url in a new tab?
Posted by: Voltaire
Date: April 22, 2016 08:28AM

Thanks ... there must have been something wrong that it did not behave as it was meant to ... anyway ...

Suggestion: I would like to have all five options to select directly in that menu, to decide case by case; i.e.:
a) open in the same tab,
c) open in a new tab but keep staying on the former tab
b) open in a new tab and go to that new tab,
e) open in a new window but keep staying on the former tab
d) open in a new window and go to that new tab,

Options: ReplyQuote
Re: How to open a right-click-selected-url in a new tab?
Posted by: rodocop
Date: April 22, 2016 10:21AM

They all are there already.

Checking 'In background' boxes will keep you at current tab/window while opening selected in new.

Sorry for misunderstanding. siria have given better answer ;-)



Edited 2 time(s). Last edit at 04/22/2016 10:33PM by rodocop.

Options: ReplyQuote
Re: How to open a right-click-selected-url in a new tab? (OLD)
Posted by: siria
Date: April 22, 2016 09:15PM

Quote
Voltaire
When selecting a text that has the syntax of a valid url and right-clicking it, you get the option to open it as URL. So far so clear.

Suggestion: I would like to have all five options to select directly in that menu, to decide case by case; i.e.:
a) open in the same tab,
c) open in a new tab but keep staying on the former tab
b) open in a new tab and go to that new tab,
e) open in a new window but keep staying on the former tab
d) open in a new window and go to that new tab,

Here's a tiny macro. It cannot tell if a selected text is "a valid URL", only checks if no dot is contained or if it has linebreaks, then it warns and stops. If that's good enough for your purpose:
Copy the blue text into a new notepad file and save it as "OpenAsURLx5.kmm" into the macros folder (make sure it gets no *.txt ending, by saving as "all types" or such...)

OLD VERSION, see next post for update to version 2!

# UTF-8  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage2)
#
# ------------------ OpenAsURLx5.kmm  ------------------------------
# Creates more "Open as URL" options in the Selection menu (right-click on selection or page)
#
# Version:  1.0  /  2016-04-22
# Forum:   kmeleonbrowser.org/forum/read.php?1,138321
# KM-Version:   1.5 or newer
# ----------------------------------------------------------------------------

OpenAsURLx5{
macroinfo="Open selected text as link (macro \"OpenAsURLx5\")";
$_url=$SelectedText;
index($_url,".")<0 ? $_warn="no . in link" : $_warn="";
index($_url,"\n")>-1 ? $_warn="linebreak in link" : 0;
if ($_warn=="") {
	$ARG=="open" ? open($_url) :0;
	$ARG=="opentab" ? opentab($_url) :0;
	$ARG=="openbgtab" ? openbgtab($_url) :0;
	$ARG=="opennew" ? opennew($_url) :0;
	$ARG=="openbg" ? openbg($_url) :0;
}
else alert("",$_warn,EXCLAIM);
$_url=""; $_warn="";
}

_OpenAsURLx5_BuildMenu{
$_menu="Open As URL (x5)";
setmenu("Selection",inline,$_menu,0);
### or as popup menu:  setmenu("Selection",popup,$_menu,0);
#
setmenu($_menu,macro,"&Open as URL","OpenAsURLx5(open)");
setmenu($_menu,macro,"Open In Ne&w Tab","OpenAsURLx5(opentab)");
setmenu($_menu,macro,"Open In &New Window","OpenAsURLx5(opennew)");
setmenu($_menu,macro,"Open In Bac&kground Tab","OpenAsURLx5(openbgtab)");
setmenu($_menu,macro,"Open In Backgro&und Window","OpenAsURLx5(openbg)");
#
setmenu("Selection",separator,1);
setmenu("Selection",macro,"&Open As URL","");
$_menu="";
}

$OnInit=$OnInit."_OpenAsURLx5_BuildMenu;";
$macroModules=$macroModules."OpenAsURLx5;";



Edited 1 time(s). Last edit at 12/18/2016 08:09PM by siria.

Options: ReplyQuote
Re: How to open a right-click-selected-url in a new tab?
Posted by: Voltaire
Date: April 26, 2016 10:48AM

Quote
rodocop
They all are there already.

Checking 'In background' boxes will keep you at current tab/window while opening selected in new.

Sorry for misunderstanding. siria have given better answer ;-)

btw: they could be there; in theory and not without each time going to settings and change them; and that was not the idea ...

yep, siria has done great work (thanks for it, it's working fine!) ... grinning smiley

Options: ReplyQuote
Re: How to open a right-click-selected-url in a new tab?
Posted by: siria
Date: December 18, 2016 07:56PM

Update, see request in
http://kmeleonbrowser.org/forum/read.php?1,140470

If a selection contains linebreaks, it does not show an error anymore but instead removes it automatically

PS: if this thread could be moved to Extensions forum I could attach it as file smiling smiley

(Howto install: see post above)

# UTF-8 K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage2)
#
# ------------------ OpenAsURLx5.kmm ------------------------------
# Creates more "Open as URL" options in the Selection menu (right-click on selection or page)
# v2: If a selection contains linebreaks, it does not show an error anymore but instead removes it automatically
#
# Version: 2.0 / 2016-12-18
# Forum v1: kmeleonbrowser.org/forum/read.php?1,138321
# Forum v1+2: kmeleonbrowser.org/forum/read.php?1,140470
# KM-Version: 1.5 or newer
# ----------------------------------------------------------------------------

OpenAsURLx5{
macroinfo="Open selected text as link (macro \"OpenAsURLx5\")";
$_url=$SelectedText;
index($_url,".")<0 ? $_warn="no . in link" : $_warn="";
# index($_url,"\n")>-1 ? $_warn="linebreak in link" : 0;
$_url=gsub("\n","",$_url);
if ($_warn=="") {
$ARG=="open" ? open($_url) :0;
$ARG=="opentab" ? opentab($_url) :0;
$ARG=="openbgtab" ? openbgtab($_url) :0;
$ARG=="opennew" ? opennew($_url) :0;
$ARG=="openbg" ? openbg($_url) :0;
}
else alert("",$_warn,EXCLAIM);
$_url=""; $_warn="";
}

_OpenAsURLx5_BuildMenu{
$_menu="Open As URL (x5)";
setmenu("Selection",inline,$_menu,0);
### or as popup menu: setmenu("Selection",popup,$_menu,0);
#
setmenu($_menu,macro,"&Open as URL","OpenAsURLx5(open)");
setmenu($_menu,macro,"Open In Ne&w Tab","OpenAsURLx5(opentab)");
setmenu($_menu,macro,"Open In &New Window","OpenAsURLx5(opennew)");
setmenu($_menu,macro,"Open In Bac&kground Tab","OpenAsURLx5(openbgtab)");
setmenu($_menu,macro,"Open In Backgro&und Window","OpenAsURLx5(openbg)");
#
setmenu("Selection",separator,1);
setmenu("Selection",macro,"&Open As URL","");
$_menu="";
}

$OnInit=$OnInit."_OpenAsURLx5_BuildMenu;";
$macroModules=$macroModules."OpenAsURLx5;";


Options: ReplyQuote


K-Meleon forum is powered by Phorum.