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.