General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Problem to add searchbar and searchmacros
Posted by: Rapido
Date: June 25, 2007 09:32PM

Hi! I have a big problem. When I try to add my searchbar and the searchmacros from my previous K-m 1.0 version to K-m 1.1 I loose the ability to change searchengines both in adv.pref and in toolbar menu: Tools and Websearch it seems that there is not optional to put the macros.cfg files for this in my profile folder because when I do
the change options and the engines just disappear. When I try to follow the directions in the search9.kmm file It doesen't give much of a helping hand because I
don't think the examples is correct. I did however a try with it and all I got was bad lines and bad caracter in macroname and bad language in macro. So I think it needs to be more help to understand how to compile your own searchbar macros and other macros to. But for now I will be more satisfied if there is someone that can help me with the searchbar problem. And here is how it looks in macrofile that is from 1.0x version:


Yours: Rapido

Options: ReplyQuote
Re: Problem to add searchbar and searchmacros
Posted by: Rapido
Date: June 25, 2007 10:54PM

# MACRO DEFINITION FILE (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# Table Of Contents Aprox. Line #
#
# - Basic Functions 40
# - Event Handling 50
# - Menu/Toolbar Synchronization 95
# - Character Encoding 110
# - URL Handling 140
# - JavaScript Document Handling 215
# - Scrolling 235
# - Layers 250
# - Groups 260
# - Startup Group and Last Session 380
# - XUL/chrome and Extensions 460
# - Aggreg8 (RSS Feed Aggregator) 485
# - kmPrefs (Advanced Preferences) 495
# - mtypes (MIME Type Editor) 540
# - Local File Handling 550
# - Tech Demos 570
# - Configuration Files 585
# - Document Handling 640
# - Document Generation 660
# - Zoom 700
# - Links 785
# - Images 795
# - Frames 815
# - Accessibility/Privacy/Security 830
# - User Agent 970
# - Custom Proxies 1010
# - Tools 1065
# - Domain Completion 1070
# - Hotlinks 1090
# - Mail and News 1130
# - Translation 1200
# - Web Search 1265
# - Page Search 1395
# - Miscellaneous 1420
# - Toolbar Buttons 1425
# - External Applications 1450

# ---------- Basic Functions ---------------------------------------------------------------------------------------

# Macro Preferences Branch
$macroPrefBranch="kmeleon.plugins.macros.";
# Macro Resource Location
$macroResLoc=getpref(STRING,"kmeleon.general.profileDir")."chrome\\";

# Global Strings
$ON=_("enabled");
$OFF=_("disabled");

# ----- Event Handling

OnStartup{
# For Startup Group and Last Session:
&SetLast; $layer=="true"? &SetNext:setpref(STRING,$og,$ln); getpref(INT,$sg)<2?0:$OnLoad="GroupStart";
# For kmPrefs:
getpref(BOOL,"kmeleon.plugins.favorites.load")==true?&getFavorites:0;
# General:
&Sync;
}

OnLoad{
$OnLoad==""?0:macros($OnLoad);
# For Startup Group and Last Session:
&GetSetTemp;
# General:
&Sync;
}
$OnLoad="";

OnCloseGroup{
# For Startup Group and Last Session:
&GetSetTemp;
}

OnActivateWindow{
&EncodingSync;
&OpenSync;
}

OnWMAppExit{
# For Startup Group and Last Session:
&GetSetTemp;
}

OnQuit{
# For Startup Group and Last Session:
&SetLast;
# For User Agent:
getpref(BOOL,$uar)==true?delpref($ua):0;
}

# ----- Menu/Toolbar Synchronization

Sync{
&SpeedSync;
&EncodingSync;
&OpenSync;
&GroupsSync;
&ZoomSync;
&PrivacySync;
&UASync;
&ProxySync;
&EnginesSync;
&TAFSync;
}

# ----- Character Encoding

$Pref_charsetdet = "intl.charset.detector";
$charset_current = "iso-8859-1";

EncodingSync{
$detector=getpref(STRING,$Pref_charsetdet);
setcheck("macros(AutoDetect())",$detector==""? true:false);
setcheck("macros(AutoDetect(universal_charset_detector))",
$detector=="universal_charset_detector"? true:false);
setcheck("macros(AutoDetect(zh_parallel_state_machine))",
$detector=="zh_parallel_state_machine"? true:false);
setcheck("macros(AutoDetect(ja_parallel_state_machine))",
$detector=="ja_parallel_state_machine"? true:false);
setcheck("macros(AutoDetect(ko_parallel_state_machine))",
$detector=="ko_parallel_state_machine"? true:false);
setcheck("macros(AutoDetect(cjk_parallel_state_machine))",
$detector=="cjk_parallel_state_machine"? true:false);
setcheck("macros(AutoDetect(ruprob))",$detector=="ruprob"? true:false);
setcheck("macros(AutoDetect(ukprob))",$detector=="ukprob"? true:false);

# getcharset and global vars are dependent of the current active window,
# not on the window which triggered the onload macro. Thank to this bug
# the following work.
$__temp = "macros(ForceCharset(" . $charset_current . "))";
setcheck($__temp, false);
$charset_current = $CHARSET;
$__temp = "macros(ForceCharset(" . $charset_current . "))";
setcheck($__temp, true);
}

AutoDetect{
setpref(STRING,"intl.charset.detector",$ARG); forcecharset();
}

ForceCharset{
forcecharset($ARG);
}

# ----- URL Handling

$openTyped="kmeleon.general.openurl";
$openSelected=$macroPrefBranch."selected.openurl";
$openSync=true;

OpenSync{
# Prevent openurl prefs from being sanitized?
$openSync==true?&OpenChck:0;
}
OpenChck{
# These actions are automatically performed by kmPrefs
# when you toggle between Windows/Layers/Layers Only.
# This macro is a fallback (e.g. for about:config).
$layerOnly=(($layer==true)*(getpref(BOOL,"kmeleon.plugins.layers.catchOpen")==true))?true:false;
$pref=$openTyped; &OpenSani;
$pref=$openSelected; &OpenSani;
$pref="kmeleon.plugins.bookmarks.openurl"; &OpenSani;
$pref="kmeleon.plugins.favorites.openurl"; &OpenSani;
$pref="kmeleon.plugins.hotlist.openurl"; &OpenSani;
}
OpenSani{
$W0="ID_OPEN_LINK_IN_NEW_WINDOW"; $W1="ID_OPEN_LINK_IN_BACKGROUND";
$L0="layers(OpenURL)"; $L1="layers(OpenURLBg)";
$layer==false?(getpref(STRING,$pref)==$L0?setpref(STRING,$pref,$W0):0):0;
$layer==false?(getpref(STRING,$pref)==$L1?setpref(STRING,$pref,$W1):0):0;
$layerOnly==true?(getpref(STRING,$pref)==$W0?setpref(STRING,$pref,$L0):0):0;
$layerOnly==true?(getpref(STRING,$pref)==$W1?setpref(STRING,$pref,$L1):0):0;
}

OpenPopup{
# Prevent openurl prefs from being sanitized!
$openSync=false;
# Force the popup into a layer?
$lay="kmeleon.plugins.layers.catchOpen"; $oldlay=getpref(BOOL,$lay); $layer==true?setpref(BOOL,$lay,$OpenInLayer):0;
# Disable diversion of popups!
$div="browser.link.open_newwindow.restriction"; $olddiv=getpref(INT,$div); setpref(INT,$div,1);
# Execute the macro which wants to opens the popup:
&PBDisable;
# Restore the previous state:
setpref(INT,$div,$olddiv); $layer==true?setpref(BOOL,$lay,$oldlay):0; $openSync=true;
}

OpenTyped{
# Use this method when an URL was generated from a direct user input (by typing into URL Bar or any prompt)
$data==""?0:$URLBAR=$data; $data==""?0:id(ID_NAV_GO); $URLBAR=$URL;
}
OpenSelected{
# Use this method when an URL was generated from selected text
$pref=$openSelected; $data==""?0:&OpenHow;
}
OpenHow{
$how=getpref(STRING,$pref);
$how=="ID_OPEN_LINK"?open($data):0;
$how=="ID_OPEN_LINK_IN_NEW_WINDOW"?opennew($data):0;
$how=="ID_OPEN_LINK_IN_BACKGROUND"?openbg($data):0;
$how=="layers(OpenURL)"?pluginmsg(layers,OpenURL,$data):0;
$how=="layers(OpenURLBg)"?pluginmsg(layers,OpenURLBg,$data):0;
}

OpenURL{
$pre=$URLBAR; $pre==$URL?$pre="":0;
$data=prompt(_("Enter URL:"),_("Open"),$pre); &OpenTyped;
}
OpenText{
$data=$SelectedText; $data==""?0:&OpenSelected;
}

ResetURL{
$URLBAR=$URL;
}

# ----- JavaScript Document Handling

# JavaScript function urlencode() to produce same result as macro function urlencode()
$JSurlencode="function urlencode(s){return encodeURIComponent(s).replace(/%25([A-F0-9]{2})/g,'%$1').replace(/%23/,'#')}";

$JSdoit=""; $JSfunc=""; $JSlast=""; $JSfail="";

hndlDoc{
InjectJS($JSfunc.$JSurlencode."with(document){".$JSdoit."}".$JSlast,"frame");
$JSdoit=""; $JSfunc=""; $JSlast=""; $JSfail="";
}
hndlDocs{
# $JSfunc is the right place for functions and global variables (e.g. when you want to count something over all frames)
# $JSlast is the right place for finishing actions (e.g. when you want to alert what you have counted over all frames)
# $JSfail is the right place to handle errors that may occur when accessing a frame (Gecko prevents cross-site scripting)
InjectJS($JSfunc.$JSurlencode."function hndlFrm(w){try{with(w.document){".$JSdoit."}}catch(e){".$JSfail."}for(var j=0,f=w.frames;j<f.length;j++)hndlFrm(f[j])}hndlFrm(window);".$JSlast);
$JSdoit=""; $JSfunc=""; $JSlast=""; $JSfail="";
}

# ----- Scrolling (for Mouse Gestures)

scrollToTop{
$JSdoit="scroll(0,0x00000)"; &hndlDoc;
}
scrollToBottom{
$JSdoit="scroll(0,0x10000)"; &hndlDoc;
}
scrollToLeftEnd{
$JSdoit="scrollBy(-0x10000,0)"; &hndlDoc;
}
scrollToRightEnd{
$JSdoit="scrollBy( 0x10000,0)"; &hndlDoc;
}

# ---------- Layers ------------------------------------------------------------------------------------------------

$layer=getpref(BOOL,"kmeleon.plugins.layers.load");
$layerOnly=(($layer==true)*(getpref(BOOL,"kmeleon.plugins.layers.catchOpen")==true))?true:false;

ReloadAll{
pluginmsg(layers,"AllLayersInWindow","ID_NAV_RELOAD");
}

# ----- Groups

$kg="kmeleon.group.";
$gn="kmeleon.groupnames";
$rl="ReplaceLayersInWindow";
$al="AddLayersToWindow";
$gl="GetLayersInWindow";
$fn="FindNick";
$lc="";

$bookmk=getpref(BOOL,"kmeleon.plugins.bookmarks.load");
$hotlst=getpref(BOOL,"kmeleon.plugins.hotlist.load");

PluginCheck{
$folder=$bookmk; $folder==false?$folder=$hotlst:0;
$tip=layer==false?_("Enter folder nick:")
sad smiley$folder==false?_("Enter group name:"):_
("Enter group name or folder nick:"));
}

ReadNames{
$names=getpref(STRING,$gn);
}
Checkname{
$checkname="\n".$name."\n"; $exists=index($names,$checkname);
}

SaveAsGroup{
&ReadNames;
$names==""?$names="\n":0; $group=pluginmsgex(layers,$gl,"",STRING); $tit=_("Save As Group");
$name=prompt(_("Enter group name to save these layers as:"),$tit,"");
$name==""?0:&Checkname;
$name==""?0:$exists!=-1?(confirm(sub("%s",$name,_("A group named '%s' already exists."))."\n\n"._("Do you want to overwrite it?"),$tit,YESNO,QUESTION)=="YES"?&SaveGroup:&SaveAsGroup):&SaveGroup;
}
SaveGroup{
$exists==-1?setpref(STRING,$gn,$names.$name."\n"):0; setpref(STRING,$kg.$name,$group);
confirm(sub("%s",$name,_("Type '%s' in the URL Bar and press Shift+Enter to open only this group or press Alt+Enter to open it next to the current layers."))."\n\n"._("Do you want to open this group everytime K-Meleon starts?"),_("Group Saved"),YESNO)=="NO"?0:&SetGroup;
}

SavedGroups{
&ReadNames; $tit=_("Saved Groups"); &PluginCheck;
$names==""?($folder==false?$ask="":$ask=_("Do you want to open a folder now?"))sad smiley$folder==false?$ask=_("Do you want to open a group now?"):$ask=_("Do you want to open a group or a folder now?"));
$names==""?$names="\n"._("(none)")."\n":0; $msg=_("Saved groups:")."\n".$names."\n";
$ask==""?alert($msg._("No folders available."),$tit)sad smileyconfirm($msg.$ask,$tit,YESNO)=="YES"?&OpenGroup:0);
}

DeleteGroup{
&ReadNames; $tit=_("Delete Group");
$names==""?&NoGroups:&ConfirmDelete;
}
ConfirmDelete{
confirm(_("Saved groups:")."\n".$names."\n"._("Do you want to delete one of these groups?"),$tit,YESNO)=="NO"?0:&PromptDelete;
}
PromptDelete{
$name=prompt(_("Enter name of group to delete:"),$tit,"");
$name==""?0:&Checkname;
$name==""?0:$exists!=-1?&DeleteURLs:&NoSuchGroup;
}
DeleteURLs{
$names=sub($checkname,"\n",$names);
length($names)==1?delpref($gn):setpref(STRING,$gn,$names); delpref($kg.$name);
&DeleteGroup;
}

URLToGroup{
$tit=_("Add To Group");
$name=prompt(_("Enter group name to add this layer to:"),$tit,""); $group=getpref(STRING,$kg.$name);
$name==""?0:$group==""?&NoSuchGroup:setpref(STRING,$kg.$name,$group.$URL."\t");
}
LayersToGroup {
$tit=_("Add To Group");
$name=prompt(_("Enter group name to add these layers to:"),$tit,""); $group=getpref(STRING,$kg.$name);
$name==""?0:$group==""?&NoSuchGroup:setpref(STRING,$kg.$name,$group.pluginmsgex(layers,$gl,"",STRING));
}

NoSuchGroup{
alert(sub("%s",$name,_("No group named '%s' found.")),$tit);
}
NoSuchGroupOrFolder{
alert(sub("%s",$name,_("No group or folder named '%s' found.")),$tit);
}

NoGroups{
alert(_("No groups saved."),$tit);
}

SetOnly{
setpref(STRING,$og,"layers(".$rl.")");
}
SetNext{
setpref(STRING,$og,"layers(".$al.")");
}

GroupOnly{
# This macro requires layers
$lc=$rl; &SetOnly; &OpenGroup; $lc=$al; &SetNext;
}
OpenGroup{
# This macro works without layers
$name=$URLBAR; $name==""?$name=$URL:0;
$name==$URL?&PromptGroup:&ChkGroup;
}
PromptGroup{
$tit=_("Open Group");
&PluginCheck; $name=prompt($tip,$tit,"");
$name==""?0:&ChkGroup;
}
ChkGroup{
$group=getpref(STRING,$kg.$name); $group==""?&ChkFolder:&Group;
}
Group{
$lc==""?$lc=$al:0; pluginmsg(layers,$lc,$group);
}
ChkFolder{
$tit=_("Open Group Or Folder");
$chk=pluginmsgex("bookmarks",$fn,$name,STRING).pluginmsgex("hotlist",$fn,$name,STRING);
$chk==""?&NoSuchGroupOrFolder:&Folder;
}
Folder{
$URLBAR=$name; id(ID_NAV_GO); &ResetURL;
}

# ----- Startup Group and Last Session

$sg="kmeleon.general.startGroup";
$sn="kmeleon.general.startGroupName";
$sh="kmeleon.general.startHome";
$og="kmeleon.general.opengroup";
$gt="kmeleon.grouptemp";
$kl="kmeleon.grouplast";
$ln="ID_OPEN_LINK_IN_NEW_WINDOW|ID_OPEN_LINK_IN_BACKGROUND";

GroupsSync{
getpref(BOOL,$sh)==true?setpref(INT,$sg,0):0;
setcheck("macros(StartHome)",getpref(BOOL,$sh));
setcheck("macros(StartBlank)",getpref(INT,$sg)==1?true:false);
setcheck("macros(StartGroup)",getpref(INT,$sg)==2?true:false);
setcheck("macros(StartLast)",getpref(INT,$sg)==3?true:false);
}

SetLast{
$group=getpref(STRING,$gt); setpref(STRING,$kl,$group);
}
SetHome{
setpref(STRING,"kmeleon.general.homePage",$URL);
setpref(INT,$sg,0); setpref(BOOL,$sh,true); &GroupsSync;
}
StartHome{
setpref(INT,$sg,0); setpref(BOOL,$sh,true); &GroupsSync;
}
StartBlank{
setpref(INT,$sg,1); setpref(BOOL,$sh,false); &GroupsSync;
}
StartGroup{
# This macro works without layers
$oldname=getpref(STRING,$sn); &PluginCheck;
$name=prompt($tip,_("Startup Group"),$oldname);
$name==""?0:$group=getpref(STRING,$kg.$name)==""?&FolderCheck:&SetGroup;
}
FolderCheck{
$tit=$layer==true?_("Startup Group Or Folder"):_("Startup Folder");
$chk=pluginmsgex("bookmarks",$fn,$name,STRING).pluginmsgex("hotlist",$fn,$name,STRING);
$chk==""?&NoSuchGroupOrFolder:&SetGroup;
}
SetGroup{
setpref(INT,$sg,2); setpref(BOOL,$sh,false); setpref(STRING,$sn,$name); &GroupsSync;
}
StartLast{
setpref(INT,$sg,3); setpref(BOOL,$sh,false); &GroupsSync;
}

Home{
getpref(INT,$sg)!=2?id(ID_NAV_HOME):&OpenStart;
}
OpenStart{
$name=getpref(STRING,$sn); &ChkGroup;
}
OpenLast{
$group=getpref(STRING,$kl); $group==""?0:&Group;
}

GetSetTemp{
$group=pluginmsgex(layers,$gl,"",STRING); setpref(STRING,$gt,$group);
}

GroupStart{
$name=getpref(STRING,$sn); $URLBAR=="about:blank"?($layer=="true"?&StartLayers:&StartWindows):0; $OnLoad="";
}
StartLayers{
$lc=$rl; &SetOnly; getpref(INT,$sg)==3?&OpenLast:&OpenStart;
$lc=$al; &SetNext;
}
StartWindows{
setpref(STRING,$og,"ID_OPEN_LINK|ID_OPEN_LINK_IN_BACKGROUND");
$name=getpref(STRING,$sn); getpref(INT,$sg)==3?"":&ChkFolder;
setpref(STRING,$og,$ln);
}

OpenClosed{
$lc=$rl; $group=getpref(STRING,$gt); $group==pluginmsgex(layers,$gl,"",STRING)?0:&Group;
}

# ---------- XUL/chrome and Extensions -----------------------------------------------------------------------------

XUL{
$layer==true?pluginmsg(layers,OpenURL,$xul)yawning smileypennew($xul);
}
XULDialog{
opennew($xul);
}

# Core chrome
AllPrefs{
$xul="about:config"; &XUL;
}
JSConsole{
# Default Console:
#$xul="chrome://global/content/console.xul"; &XULDialog;
# Console2:
$xul="chrome://console2/content/console2.xul"; &XULDialog;
}
Master{
$xul="chrome://pippki/content/pref-masterpass.xul"; &XULDialog;
}
Cert{
$xul="chrome://pippki/content/certManager.xul"; &XULDialog;
}

# ----- Aggreg8 (RSS Feed Aggregator)

RSS{
$macro="rss"; &Frm1st;
}
rss{
$xul="chrome://aggreg8/content/aggreg8.xul"; &XUL;
}

# ----- kmPrefs (Advanced Preferences)

$prefURL="chrome://kmprefs/content/pref.xul";

PrefOpen{
$macro="XULDialog"; &Frm1st;
}
PrefPanel{
$xul=$prefURL; &PrefOpen;
}
Bookmarks{
$xul=$prefURL."?bookmarks"; &PrefOpen;
}
Favorites{
$xul=$prefURL."?favorites"; &PrefOpen;
}
Hotlist{
$xul=$prefURL."?hotlist"; &PrefOpen;
}
Browsing{
$xul=$prefURL."?browsing"; &PrefOpen;
}
Filters{
$xul=$prefURL."?filters"; &PrefOpen;
}
Hotlinks{
$xul=$prefURL."?hotlinks"; &PrefOpen;
}
MGestures{
$xul=$prefURL."?gestures"; &PrefOpen;
}
Layers{
$xul=$prefURL."?layers"; &PrefOpen;
}
JavaScript{
$xul=$prefURL."?javascript"; &PrefOpen;
}
ToolBars{
$xul=$prefURL."?toolbars"; &PrefOpen;
}
WebFind{
$xul=$prefURL."?webfind"; &PrefOpen;
}

getFavorites{
$fav="kmeleon.plugins.favorites.directory";
$tmp=readreg("HKCU","Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\Favorites")."\\";
getpref(STRING,$fav)==""?setpref(STRING,$fav,$tmp):"";
}

# ----- mtypes (MIME Type Editor)

mimeEdit{
$xul="chrome://mtypes/content/pref/pref.xul"; &XULDialog;
}

# ---------- Local File Handling -----------------------------------------------------------------------------------

$defaultAction="open";
$defaultEditor=getpref(STRING,$macroPrefBranch."configCommand");

getExtensionHandler{
$defaultEditor==""?$defaultEditor="notepad.exe %1":0;
$doctype=readreg("HKCR",".".$ext."\\");
$doctype==""?$cmdline=$defaultEditor:$cmdline=""; $shell="\\shell\\"; $command="\\command\\";
$cmdline==""?$defactn=readreg("HKCR",$doctype.$shell):0;
$cmdline==""?($defactn==""?$cmdline=readreg("HKCR",$doctype.$shell.$defaultAction.
$command):$cmdline=readreg("HKCR",$doctype.$shell.$defactn.$command)):0;
# DDE is not supported here:
$cmdline==""?$cmdline=$defaultEditorsad smileyindex($cmdline,"%1")?0:$cmdline=$defaultEditor);
$doctype=readreg("HKCR",$doctype."\\"); $doctype==""?$doctype=sub("%s",$ext,_("%s File")):0;
$defaultAction="open";
}
getSecureExtensionHandler{
# use for script files
$defaultAction="edit"; &getExtensionHandler;
}

# ----- Tech Demos

# Choose a Cascading StyleSheet from disk and inject it into the current page
UserCSS{
$ext="css"; &getExtensionHandler;
injectCSS(readfile(promptforfile("",$doctype,"*.css")));
}

# Choose a JavaScript file from disk and inject it into the current page
UserScript{
$ext="js"; &getExtensionHandler;
injectJS(readfile(promptforfile("",$doctype,"*.js")));
}

# ----- Configuration Files

# Settings Directory
$settings=getpref(STRING,"kmeleon.general.settingsDir");

Accel{
$ext="cfg"; &getExtensionHandler; exec(sub("%1",$settings."accel.cfg",$cmdline));
}
Macros{
$ext="cfg"; &getExtensionHandler; exec(sub("%1",$settings."macros.cfg",$cmdline));
}
Menus{
$ext="cfg"; &getExtensionHandler; exec(sub("%1",$settings."menus.cfg",$cmdline));
}
# For kmPrefs:
GestureCmds{
$ext="cfg"; &getExtensionHandler; exec(sub("%1",$settings."gestures.cfg",$cmdline));
}
SearchEngs{
$ext="cfg"; &getExtensionHandler; exec(sub("%1",$settings."search.cfg",$cmdline));
}

# Profile Directory
$path=getpref(STRING,"kmeleon.general.profileDir");

ProfD{
exec("explorer.exe \"".$path."\"");
}
Prefs{
$ext="js"; &getSecureExtensionHandler; exec(sub("%1",$path."prefs.js",$cmdline));
}
User{
$ext="js"; &getSecureExtensionHandler; exec(sub("%1",$path."user.js",$cmdline));
}

# User Chrome Directory
UserContent{
$ext="css"; &getExtensionHandler; exec(sub("%1",$path."chrome\\userContent.css",$cmdline));
}
# For kmPrefs:
CSSFilters{
$ext="css"; &getExtensionHandler; exec(sub("%1",$path."\chrome\\adblock.css",$cmdline));
}

# Skin
$skindir=getpref(STRING,"kmeleon.general.skinsDir");
$skin=getpref(STRING,"kmeleon.general.skinsCurrent");

Commands{
$ext="txt"; &getExtensionHandler; exec(sub("%1",$skindir."commands.txt",$cmdline));
}
Toolbars{
$ext="cfg"; &getExtensionHandler; exec(sub("%1",$skindir.$skin."toolbars.cfg",$cmdline));
}

# ---------- Document Handling -------------------------------------------------------------------------------------

$continuousReload=$macroPrefBranch."continuousReload";

Continuous{
$macro="Reload1st"; &JS1st;
}
Reload1st{
# When frames are toggled from disabled to enabled, the current page must be loaded into a new window/layer
$OnLoad="Reload2nd"; $xul=$URL; $macro=getpref(BOOL,$frames)==false?"XUL":$OnLoad; &Frm1st;
}
Reload2nd{
$OnLoad=""; $sec=getpref(INT,$continuousReload); $sec==0?$sec=120:0;
$seconds=prompt(_("Enter number of seconds between reloads:"),_("Continuous Reload"),$sec);
$seconds==""?0:InjectJS("var t=parseInt('".$seconds."');if(!isNaN(t)&&(t>0))with(document){open();write('<html><head><style type=\"text/css\">#b{position:absolute;left:0;width:100%;height:2em;bottom:0;padding:0 0 0.25em;font:inherit;}#i{position:absolute;left:0;width:100%;
bottom:2em;top:0;border:0;}</style></head><body style=\"font:menu\"><iframe id=\"i\" src=\"'+location.href+'\"></iframe><button id=\"b\" onclick=\"quit()\"></button></body><script type=\"text/javascript\">var tspan='+t+',tleft=tspan+1,buttn=document.getElementsByTagName(\"button\")[0],units=new Array(\""._("hours")."\",\""._("minutes")."\",\""._("seconds")."\"),title=\""._("Reloading: %s")."\",btext=\""._("Reloading in %t %u (Click to abort)")."\";doit();setInterval(\"doit()\",1000);function doit(){if(!--tleft){tleft=tspan;frames[0].location.reload()}var h=Math.floor(tleft/3600),m=Math.floor((tleft%3600)/60),s=tleft%60,ttext=((h)?(h+((m<10)?\":0
\":\":\")+m)sad smiley(m)?m:\"\"))+((h||m)?((s<10)?\":0\":\":\"):\"\")+s,utext=((h)?units[0]sad smiley(m)?
units[1]:units[2]));buttn.innerHTML=btext.replace(/%t/,ttext).replace(/%u/,utext);document.
title=title.replace(/%s/,frames[0].document.title)}function quit(){history.back()}</script></html>');close()}");
setpref(INT,$continuousReload,$seconds); $seconds=getpref(INT,$continuousReload); $seconds>0?0:setpref(INT,$continuousReload,$sec);
}

# ----- Document Generation

$JSframeError="txt+='<fieldset><legend>"._("(unknown)")."</legend><p>"._("A script error occured accessing this frame. Probably this frame belongs to another domain and access was denied for security reasons.")."</p></fieldset>'";

lstLinks{
$JSfunc="with(document)var h='kmHOST',l='kmLINK',w=window.name,n=(w&&!getElementsByTagName('body')[0])?w.replace
(h,''):Math.floor(Math.random()*1000),hstWinName=window.name=h+n,lnkWinName=l+n,cnt=0,nlf='"._("No links found.")."',tit='"._("Links: %s")."'.replace(/%s/,(title)?title:unescape(URL)),txt='';";
$JSdoit="if(getElementsByTagName('body')[0]){txt+='\\n<fieldset><legend>'+
((title)?title:unescape(URL)).link(URL)+'</legend><ol>';cnt+=links.length;if(links.length)for(var j=0;j<links.length;j++)txt+='\\n<li>'+((links[j].text)?links[j].text.link(links[j]):unescape(links[j]).
link(links[j]))+'&nbsp;</li>';else txt+='\\n<p>'+nlf+'</p>';txt+='</ol>\\n</fieldset>'}";
$JSlast="if(cnt){var lnkWin=open('',lnkWinName,'left=0,top=0,width=600,height=300,status=yes');
with(lnkWin.document){open();write('<html><head><title>'+tit+'</title><style type=\"text/css\">\\n".gsub("\n","\\n",readfile($macroResLoc."macros.css"))."\\n</style><base target=\"'+hstWinName+'\"></head>\\n<body class=\"km_lstLinks\">'+txt+'\\n</body></html>');close()}lnkWin.focus()}else alert(nlf)";
$JSfail=$JSframeError;
}
lstLinkedImages{
$JSfunc="with(document)var ext=new Array('bmp','gif','giff','jpg','jpeg','png','ico'),cnt=0,nlf='"._("No linked images found.")."',tit='"._("Linked Images: %s")."'.replace(/%s/,(title)?title:unescape(URL)),txt='';";
$JSdoit="if(getElementsByTagName('body')[0]){var url=new Array();function add(s){for(var j=0;j<url.length;j++)if(s==url[j])return;for(var j=0,x=s.split('.');j<ext.length;j++)if(x[x.length-1].toLowerCase()
==ext[j])url[url.length]=s}for(var j=0,l=links;j<l.length;j++)add(l[j].href);txt+='\\n<fieldset><legend>'
+((title)?title:unescape(URL)).
link(URL)+'</legend><ol>';cnt+=url.length;if(url.length)for(var j=0;j<url.length;j++)txt+='\\n<li><img src=\"'+url[j]+'\"></li>';else txt+='\\n<p>'+nlf+'</p>';txt+='</ol>\\n</fieldset>'}";
$JSlast="if(cnt){var imgWin=open('','kmLINKIMG'+Math.floor(Math.random()*1000),'');with(imgWin.
document){open();write('<html><head><title>'+tit+'</title><style type=\"text/css\">\\n".gsub("\n","\\n",readfile($macroResLoc.
"macros.css"))."\\n</style></head>\\n<body class=\"km_lstLinkedImages\">'+txt+'\\n</body></html>');close()}}else alert(nlf)";
$JSfail=$JSframeError;
}
lstImages{
$JSfunc="with(document)var cnt=0,nif='"._("No images found.")."',tit='"._("Images: %s")."'.replace(/%s/,(title)?title:unescape(URL)),txt='';";
$JSdoit="if(getElementsByTagName('body')[0]){var url=new Array();function add(s){for(var j=0;j<url.length;j++)if(s==url[j])return;url[url.length]=s}for(var j=0,i=images;j<i.length;j++)add(i[j].src);for(var j=0,i=getElementsByTagName('input');j<i.length;j++)if((i[j].getAttribute('type')==
'image')&&(i[j].getAttribute('src')))add(i[j].src);txt+='\\n<fieldset><legend>'
+((title)?title:unescape(URL)).link(URL)+'</legend><ol>';cnt+=url.length;if(url.length)for(var j=0;j<url.length;j++)txt+='\\n<li><img src=\"'+url[j]+'\"></li>';else txt+='\\n<p>'+nif+'</p>';txt+='</ol>\\n</fieldset>'}";
$JSlast="if(cnt){var imgWin=open('','kmIMG'+Math.floor(Math.random()*1000),'');with(imgWin.document){open();
write('<html><head><title>'+tit+'</title><style type=\"text/css\">\\n".gsub("\n","\\n",readfile($macroResLoc."macros.css")).
"\\n</style></head>\\n<body class=\"km_lstImages\">'+txt+'\\n</body></html>');close()}}else alert(nif)";
$JSfail=$JSframeError;
}

ListLinks{
&lstLinks; $macro="hndlDocs"; $OpenInLayer=false; &OpenPopup;
}
ListFrameLinks{
&lstLinks; $macro="hndlDoc"; $OpenInLayer=false; &OpenPopup;
}

ListLinkedImages{
&lstLinkedImages; $macro="hndlDocs"; $OpenInLayer=true; &OpenPopup;
}
ListLinkedFrameImages{
&lstLinkedImages; $macro="hndlDoc"; $OpenInLayer=true; &OpenPopup;
}

ListImages{
&lstImages; $macro="hndlDocs"; $OpenInLayer=true; &OpenPopup;
}
ListFrameImages{
&lstImages; $macro="hndlDoc"; $OpenInLayer=true; &OpenPopup;
}

# ----- Zoom

$zoom=$macroPrefBranch."zoom";

ZoomSync{
$z=getpref(STRING,$zoom);
# Default Action:
$z==""?setpref(STRING,$zoom,"text"):0;
$z==""?$z="text":0;
setcheck("macros(ZoomPage)",$z=="page"?true:false);
setcheck("macros(ZoomText)",$z=="text"?true:false);
setcheck("macros(ZoomImages)",$z=="images"?true:false);
}

ZoomSet{
setpref(STRING,$zoom,$var); &ZoomSync; statusbar($tip);
}
ZoomPage{
$var="page"; $tip=_("Zoom buttons effect text and images."); &ZoomSet;
}
ZoomText{
$var="text"; $tip=_("Zoom buttons effect text only."); &ZoomSet;
}
ZoomImages{
$var="images"; $tip=_("Zoom buttons effect images only."); &ZoomSet;
}

hndlImg{
$JSdoit="var b=getElementsByTagName('body')[0];if(b){var bz=(b.getAttribute('zoom')==null)?1sad smileyb.getAttribute('zoom')/10);for(var j=0,i=images;j<i.length;j++)with(i[j])if(urlencode(src)=='".urlencode($ImageURL)
."'){".$JSdoitImg."}}"; &hndlDoc;
}
hndlImgs{
$JSdoit="var b=getElementsByTagName('body')[0];if(b){if(b.getAttribute('zoom')==null)
b.setAttribute('zoom',10);var bz=".$zoomBy.",o=parseFloat(b.getAttribute('zoom'));if(Math.round(bz+o))
{b.setAttribute('zoom',Math.round(bz+o));bz=b.getAttribute('zoom')/10;for(var j=0,i=images;j<i.length;j++)with(i[j]){".$JSdoitImg."}}}"; $JSfunc=""; &hndlDocs;
}
zoomImg{
$JSdoitImg="if(getAttribute('zoom')==null){setAttribute('initW',width);
setAttribute('initH',height);setAttribute('zoom',1)}var iz=".$zoomBy.";setAttribute('zoom',getAttribute('zoom')*iz);iz=getAttribute
('zoom');width=bz*iz*getAttribute('initW');height=bz*iz*getAttribute('initH')"; &hndlImg;
}
zoomImgs{
$JSdoitImg="var iz=(getAttribute('zoom')==null)?1:getAttribute('zoom');if(getAttribute('initW')==
null){setAttribute('initW',width);setAttribute('initH',height)}width=bz*iz*
getAttribute('initW');height=bz*iz*getAttribute('initH')"; &hndlImgs;
}
zoomTxt{
$JSdoit="var b=getElementsByTagName('body')[0];if(b)zoomNode(b,(10+".$zoomBy.")/10);"; $JSfunc="function zoomNode(n,z){for(var j=0;j<n.childNodes.length;j++)if(n.childNodes[j].nodeType==1)zoomNode(n.
childNodes[j],z);var lh=getComputedStyle(n,'').getPropertyValue('line-height');if(lh!='normal')
n.style.lineHeight=Math.round(parseFloat(lh.replace(/px/,''))*z)
+'px';n.style.fontSize=Math.round(parseFloat(getComputedStyle(n,'').
getPropertyValue('font-size').replace(/px/,''))*z)+'px'}"; &hndlDocs;
}

ZoomIn{
$z=getpref(STRING,$zoom);
$z=="page"?&ZoomInPage:0; $z=="text"?id(ID_FONT_INCREASE):0; $z=="images"?&ZoomInImages:0;
}
ZoomOut{
$z=getpref(STRING,$zoom);
$z=="page"?&ZoomOutPage:0; $z=="text"?id(ID_FONT_DECREASE):0; $z=="images"?&ZoomOutImages:0;
}

ZoomInPage{
$zoomBy="1"; &zoomImgs;
# EITHER:
id(ID_FONT_INCREASE);
# OR:
#&zoomTxt;
}
ZoomOutPage{
$zoomBy="-1"; &zoomImgs;
# EITHER:
id(ID_FONT_DECREASE);
# OR:
#&zoomTxt;
}

ZoomInImages{
$zoomBy="1"; &zoomImgs;
}
ZoomOutImages{
$zoomBy="-1"; &zoomImgs;
}

ZoomInImage{
$zoomBy="2"; &zoomImg;
}
ZoomOutImage{
$zoomBy="1/2"; &zoomImg;
}

# ----- Links

CopyLinkURL{
setclipboard(); id(ID_COPY_LINK_LOCATION); getclipboard()==""?setclipboard($LinkURL):0;
}

hndlA{
$JSdoit="for(var j=0,a=getElementsByTagName('a');j<a.
length;j++)with(a[j])if(urlencode(href)=='".urlencode($LinkURL)."'){".$JSdoitA."}"; &hndlDoc;
}
LinkInfo{
$JSdoitA="var l=getAttribute('hreflang'),p=getAttribute('ping'),t=getAttribute('type'),s='"._("Link Properties:")."\\n\\n"._("URL:\\t%s")."'.replace(/%s/,unescape(href));if(p)s+
='\\n"._("Ping:\\t%s")."'.replace(/%s/,unescape(p));if(l||t){s+='\\n\\n"._("Properties of Linked Resource:")."\\n';if(t)s+='\\n"._("MIME Type:\\t%s")."'.replace(/%s/,t);if(l)s+='\\n"._("Language:\\t%s").
"'.replace(/%s/,l)}s+='\\n\\n"._("Do you want to view the linked resource now?")."';if(confirm(s)){if(top.location==self.location)
open(href);top.location.href=href};j=a.length"; &hndlA;
}

# ----- Images

hndlImage{
$JSdoit="var a=true,b=getElementsByTagName('body')[0];if(b){for(var j=0,i=images;(j<i.length)&&a;j++)with(i[j])if(urlencode(src)==
'".urlencode($ImageURL)."'){a=false;".$JSdoitImg."}for(var j=0,i=document.getElementsByTagName('input');
(j<i.length)&&a;j++)with(i[j])if((getAttribute('type')=='image')&&(urlencode(src)=='".
urlencode($ImageURL)."')){a=false;".$JSdoitInput."}}"; &hndlDoc;
}
ImageInfo{
$JSdoitImg="var l=getAttribute('longdesc'),s='"._("Image Properties:")."\\n\\n"._("URL:\\t%s")."'.replace(/%s/,unescape(src))+'\\n"._("Size:\\t%W x %H Pixels")."'.replace(/%W/,width).replace(/%H/,height);if(alt)s+='\\n"._("Alt. Text:\\t%s")."'.replace(/%s/,alt);if(l){s+='\\n\\n"._("A description is available for this image. Do you want to view it now?")."';if(confirm(s)){if(top.location==self.location)open(l);top.location.href=l}}else alert(s)";
$JSdoitInput="var s='"._("Image Properties:")."\\n\\n"._("URL:\\t%s")."'.replace(/%s/,unescape(src));if(alt)s+='\\n"._("Alt. Text:\\t%s")."'.replace(/%s/,alt);alert(s);a=false"; &hndlImage;
}

ImageCache{
$u=$ImageURL; $i=index($u,"#"); $u=$i==-1?$u:substr($u,0,$i);
index($u,"http://")==0?$client="HTTP&sb=1":$client="";;
index($u,"https://")==0?$client="HTTP-memory-only&sb=1":0;
index($u,"file://")==0?$client="image&sb=0":0;
index($u,"resource://")==0?$client="image&sb=0":0;
index($u,"chrome://")==0?$client="image-chrome&sb=0":0;
$xul="about:cache-entry?client=".$client."&key=".$u;
$client==""?0:&XUL;
}

# ----- Frames

FrameInLayer{
pluginmsg(layers,OpenURL,$FRAMEURL);
}
FrameInBack{
$layer==true?pluginmsg(layers,OpenURLBg,$FRAMEURL):OpenBg($FRAMEURL);
}

ReloadFrame{
$JSdoit="location.reload()"; &hndlDoc;
}

# ---------- Accessibility/Privacy/Security ------------------------------------------------------------------------

$animation="image.animation_mode";
$colors="browser.display.use_document_colors";
$cookies="network.cookie.cookieBehavior";
$frames="browser.frames.enabled";
$images="permissions.default.image";
$java="security.enable_java";
$jscript="javascript.enabled";
$popups="dom.disable_open_during_load";
$referer="network.http.sendRefererHeader";

PrivacySync{
# Privacy Menu:
setcheck("macros(AniToggle)",getpref(STRING,$animation)=="none"?true:false);
setcheck("macros(CToggle)",getpref(BOOL,$colors)?false:true);
setcheck("macros(CKToggle)",getpref(INT,$cookies));
setcheck("macros(FrmToggle)",getpref(BOOL,$frames)?false:true);
setcheck("macros(ImgToggle)",getpref(INT,$images)==1?false:true);
setcheck("macros(JToggle)",getpref(BOOL,$java)?false:true);
setcheck("macros(JSToggle)",getpref(BOOL,$jscript)?false:true);
setcheck("macros(PBToggle)",getpref(BOOL,$popups));
setcheck("macros(RefToggle)",getpref(INT,$referer)==0?true:false);
# Privacy Bar (make sure the toolbar name is correct):
$toolbar="&Privacy Bar";
pluginmsg(toolbars,"CheckButton",$toolbar.",macros(AniToggle),
".(getpref(STRING,$animation)=="none"?1:0));
pluginmsg(toolbars,"CheckButton",$toolbar.",macros(CToggle),
".(getpref(BOOL,$colors)?0:1));
pluginmsg(toolbars,"CheckButton",$toolbar.",macros(CKToggle),
".(getpref(INT,$cookies)==2?1:0));
pluginmsg(toolbars,"CheckButton",$toolbar.",macros(ImgToggle),
".(getpref(INT,$images)==1?0:1));
pluginmsg(toolbars,"CheckButton",$toolbar.",macros(JToggle),
".(getpref(BOOL,$java)?0:1));
pluginmsg(toolbars,"CheckButton",$toolbar.",macros(JSToggle),
".(getpref(BOOL,$jscript)?0:1));
pluginmsg(toolbars,"CheckButton",$toolbar.",macros(PBToggle),
".(getpref(BOOL,$popups)?1:0));
pluginmsg(toolbars,"CheckButton",$toolbar.",macros(RefToggle),
".(getpref(INT,$referer)==0?1:0));
# Main Bar (make sure the toolbar name is correct):
$toolbar="&Main Bar";
pluginmsg(toolbars,"CheckButton",$toolbar.",macros(PBToggle),
".(getpref(BOOL,$popups)?1:0));
}

AniToggle{
togglepref(STRING,$animation,"normal","none"); &PrivacySync;
statusbar(sub("%s",getpref(STRING,$animation)
=="none"?$OFF:$ON,_("Image animation %s")));
}
CToggle{
togglepref(BOOL,$colors); &PrivacySync;
statusbar(sub("%s",getpref(BOOL,$colors)
==false?$OFF:$ON,_("Page color usage %s")));
}
CKToggle{
togglepref(INT,$cookies,2,0); &PrivacySync;
statusbar(sub("%s",getpref(INT,$cookies)
==2?$OFF:$ON,_("Cookie acceptance %s")));
}
FrmToggle{
togglepref(BOOL,$frames); &PrivacySync;
statusbar(sub("%s",getpref(BOOL,$frames)
==false?$OFF:$ON,_("Frame support %s")));
}
ImgToggle {
togglepref(INT,$images,1,2); &PrivacySync;
statusbar(sub("%s",getpref(INT,$images)
==2?$OFF:$ON,_("Image loading %s")));
}
JToggle{
togglepref(BOOL,$java); &PrivacySync;
statusbar(sub("%s",getpref(BOOL,$java)
==false?$OFF:$ON,_("Java support %s")));
}
JSToggle{
togglepref(BOOL,$jscript); &PrivacySync;
statusbar(sub("%s",getpref(BOOL,$jscript)
==false?$OFF:$ON,_("JavaScript execution %s")));
}
PBToggle{
togglepref(BOOL,$popups); &PrivacySync;
statusbar(sub("%s",getpref(BOOL,$popups)
==true?$ON:$OFF,_("Popup blocking %s")));
}
RefToggle {
togglepref(INT,$referer,0,2); &PrivacySync;
statusbar(sub("%s",getpref(INT,$referer)
==0?$OFF:$ON,_("HTTP referer transmission %s")));
}

# Enable frame support persistently (can't only be toggled for macro execution)
Frm1st{
getpref(BOOL,$frames)==false?(confirm(_("Frame support is currently disabled. It must be enabled to use this feature.")."\n\n"._("Enable frame support and continue?"),_("Frame Support Disabled"),YESNO,EXCLAIM)=="YES"?&Frm2nd:0):macros($macro);
}
Frm2nd{
&FrmToggle; macros($macro);
}

# Enable JavaScript execution persistently
JS1st{
getpref(BOOL,$jscript)==false?(confirm(_("JavaScript execution is currently disabled. It must be enabled to use this feature.")."\n\n"._("Enable JavaScript execution and continue?"),_("JavaScript Execution Disabled"),YESNO,EXCLAIM)=="YES"?&JS2nd:0):macros($macro);
}
JS2nd{
&JSToggle; macros($macro);
}

# Disable popup blocker for a single macro and allow this macro's popups to look however they want
PBDisable{
$p1="dom.disable_window_open_feature.resizable";
$p2="dom.disable_window_open_feature.scrollbars";
$p3="dom.disable_window_open_feature.location";
$p4="dom.disable_window_open_feature.menubar";
$p5="dom.disable_window_open_feature.personalbar";
$p6="dom.disable_window_open_feature.status";
$p7="dom.disable_window_open_feature.toolbar";
$v1=getpref(BOOL,$p1); setpref(BOOL,$p1,false);
$v2=getpref(BOOL,$p2); setpref(BOOL,$p2,false);
$v3=getpref(BOOL,$p3); setpref(BOOL,$p3,false);
$v4=getpref(BOOL,$p4); setpref(BOOL,$p4,false);
$v5=getpref(BOOL,$p5); setpref(BOOL,$p5,false);
$v6=getpref(BOOL,$p6); setpref(BOOL,$p6,false);
$v7=getpref(BOOL,$p7); setpref(BOOL,$p7,false);
getpref(BOOL,$popups)==true?&PB:macros($macro);
setpref(BOOL,$p1,$v1);
setpref(BOOL,$p2,$v2);
setpref(BOOL,$p3,$v3);
setpref(BOOL,$p4,$v4);
setpref(BOOL,$p5,$v5);
setpref(BOOL,$p6,$v6);
setpref(BOOL,$p7,$v7);
}
PB{
&PBToggle; macros($macro); &PBToggle;
}

Kill{
$JSfunc="function del(doc,tag){for(var d,e=doc.getElementsByTagName(tag),j=e.length-1;j+1;j--)
{d=doc.createElement('div');d.innerHTML='<del>'+tag+'</
del>';d.style.height=e[j].height;d.style.width=e[j].width;e[j].
parentNode.replaceChild(d,e[j])}}";
&hndlDocs;
}
KillApplets{
$JSdoit="del(w.document,'applet')"; &Kill;
}
KillFlash{
$JSdoit="del(w.document,'object');del(w.document,'embed')"; &Kill;
}

ClearAll{
plugin(privacy,ClearCache);
plugin(privacy,ClearCookies);
plugin(privacy,ClearHistory);
plugin(privacy,ClearMRU);
plugin(privacy,ClearSignon);
}

# ----- User Agent

$ua="general.useragent.override";
$pu="kmeleon.privacy.useragent";
$uar=$macroPrefBranch."useragent.reset_on_exit";

UASync{
$uas=getpref(STRING,$ua);
setcheck("macros(UA0)",$uas==""?true:false);
setcheck("macros(UA1)",$uas==getpref(STRING,$pu."1.string")?true:false);
setcheck("macros(UA2)",$uas==getpref(STRING,$pu."2.string")?true:false);
setcheck("macros(UA3)",$uas==getpref(STRING,$pu."3.string")?true:false);
setcheck("macros(ResetUA)",getpref(BOOL,$uar));
}

UA0{
menu=getpref(STRING,$pu."0.name"); delpref($ua); &UASync;
}
UA1{
menu=getpref(STRING,$pu."1.name"); $uas=getpref(STRING,$pu."1.string"); &SetUA;
}
UA2{
menu=getpref(STRING,$pu."2.name"); $uas=getpref(STRING,$pu."2.string"); &SetUA;
}
UA3{
menu=getpref(STRING,$pu."3.name"); $uas=getpref(STRING,$pu."3.string"); &SetUA;
}

UACust{
$uas=prompt(_("Enter the User Agent string to identify K-Meleon as:"),_("Custom User Agent"),getpref(STRING,$ua));
$uas==""?0:&SetUA;
}

SetUA{
setpref(STRING,$ua,$uas); &UASync;
}
ResetUA{
togglepref(BOOL,$uar); &UASync;
}

# ----- Custom Proxies

$proxy="network.proxy.";
$cprxy=$macroPrefBranch."proxy";

ProxySync{
setcheck("macros(proxy1)",(getpref(STRING,$cprxy."1.http")==getpref(STRING,$proxy.
"http"))*(getpref(INT,$proxy."type")==1)?true:false);
setcheck("macros(proxy2)",(getpref(STRING,$cprxy."2.http")==getpref(STRING,$proxy.
"http"))*(getpref(INT,$proxy."type")==1)?true:false);
setcheck("macros(proxy3)",(getpref(STRING,$cprxy."3.http")==getpref(STRING,$proxy.
"http"))*(getpref(INT,$proxy."type")==1)?true:false);
setcheck("macros(NoProxy)",getpref(INT,$proxy."type")?false:true);
}

proxy1{
$n="1"; menu=getpref(STRING,$cprxy."1.name"); &CPuse;
}
proxy2{
$n="2"; menu=getpref(STRING,$cprxy."2.name"); &CPuse;
}
proxy3{
$n="3"; menu=getpref(STRING,$cprxy."3.name"); &CPuse;
}

CPuse{
$srvr=getpref(STRING,$cprxy.$n.".http");
$port=getpref(INT,$cprxy.$n.".http_port");
# When no server url is set, do not change anything!
$srvr==""?0:setpref(STRING,$proxy."http",$srvr);
$srvr==""?0:setpref(INT,$proxy."http_port",$port);
$srvr==""?0:setpref(INT,$proxy."type",1);
getpref(INT,$proxy."type")==1?statusbar(sub("%url",getpref(STRING,$proxy."http"),
sub("%port",getpref(INT,$proxy."http_port"),_("Connecting over proxy %url:%port")))):&NoProxy;
&ProxySync;
}
CPset{
$name=prompt(_("Server name:"),$tit,$name);
$name==""?0:setpref(STRING,$cprxy.$n.".name",$name);
$name==""?$srvr="":$srvr=prompt(_("Server URL:"),$tit,$srvr);
$srvr==""?0:setpref(STRING,$cprxy.$n.".http",$srvr);
$srvr==""?$port="":$port=prompt(_("Server port:"),$tit,$port);
$port==""?0:setpref(INT,$cprxy.$n.".http_port",$port);
}

NoProxy {
setpref(INT,$proxy."type",0); statusbar(_("Connecting directly")); &ProxySync;
}

ProxyCfg{
$n=1; while($n!=4) &ProxyCfgLoop;
}
ProxyCfgLoop{
$name=getpref(STRING,$cprxy.$n.".name");
$srvr=getpref(STRING,$cprxy.$n.".http");
$port=getpref(INT,$cprxy.$n.".http_port");
$tit=sub("%s",$name==""?$n:$name,_("HTTP Proxy Configuration"));
$msg=sub("%n",$n,_("Current settings for proxy %n:"))."\n\n".sub("%s",$name,_("Server name:\t%s"))."\n".sub("%s",$srvr==""?_("(not set)"):$srvr,_("Server URL:\t%s"))."\n".sub("%s",$port==0?_("(not set)"):$port,_("Server port:\t%s"))."\n\n"._("Do you want to change these settings?");
$r=confirm($msg,$tit,YESNOCANCEL,QUESTION); $r==YES?&CPsetsad smiley$r==NO?$n=$n+1:$n=4);
}

# ---------- Tools -------------------------------------------------------------------------------------------------

# ----- Domain Completion

$dc=$macroPrefBranch."domComplete";

domComplete0{
$n="0"; &DCgo;
}
domComplete1{
$n="1"; &DCgo;
}
domComplete2{
$n="2"; &DCgo;
}
DCgetPref{
$prefix=getpref(STRING,$dc.$n.".prefix");
$suffix=getpref(STRING,$dc.$n.".suffix");
}
DCgo{
&DCgetPref; $data=$prefix.$URLBAR.$suffix; &OpenTyped;
}

# ----- Hotlinks

$hl=$macroPrefBranch."hotlink";

hotlink0{
$n="0"; &HLgo;
}
hotlink1{
$n="1"; &HLgo;
}
hotlink2{
$n="2"; &HLgo;
}
hotlink3{
$n="3"; &HLgo;
}
hotlink4{
$n="4"; &HLgo;
}
hotlink5{
$n="5"; &HLgo;
}
hotlink6{
$n="6"; &HLgo;
}
hotlink7{
$n="7"; &HLgo;
}
hotlink8{
$n="8"; &HLgo;
}
hotlink9{
$n="9"; &HLgo;
}
HLgo{
&HLgetPref; $newwin==true?$xul=$theurl:$xul="";
$xul==""?($theurl==""?0yawning smileypen($theurl))sad smiley$theurl==""?0:&XUL);
}
HLgetPref{
$theurl=getpref(STRING,$hl.$n.".url");
$newwin=getpref(BOOL,$hl.$n.".new");
}

# ----- Mail and News

$mc=$macroPrefBranch."mailClient";
$nc=$macroPrefBranch."newsClient";

defMail{
$base="Software\\Clients\\Mail\\";
$base=$base.readreg("HKLM",$base);
$def=readreg("HKLM",$base."\\shell\\open\\command\\");
$sys=readreg("HKLM",$base."\\protocols\\mailto\\shell\\open\\command\\");
$usr=readreg("HKCR","mailto\\shell\\open\\command\\");
$usr==$sys?$client=$def:$client=$usr;
}
defNews{
$base="Software\\Clients\\News\\";
$base=$base.readreg("HKLM",$base);
$def=readreg("HKLM",$base."\\shell\\open\\command\\");
$sys=readreg("HKLM",$base."\\protocols\\news\\shell\\open\\command\\");
$usr=readreg("HKCR","news\\shell\\open\\command\\");
$usr==$sys?$client=$def:$client=$usr;
}
MNgetPref{
$client=getpref(STRING,$mnPref);
}
MNsetPref{
setpref(STRING,$mnPref,$client);
}
MNcfg{
&MNgetPref; $client==""?macros($macro):0; $client=prompt($txt,$tit,$client); $client==""?0:&MNsetPref;
}
MNopen{
&MNgetPref; $client==""?macros($macro):0; $client==""?0sad smileyindex($client,"://")==-1?exec($client)yawning smileypennew($client));
}

Mail{
$mnPref=$mc; $macro="MailCfg"; &MNopen;
}
News{
$mnPref=$nc; $macro="NewsCfg"; &MNopen;
}

MailCfg{
$mnPref=$mc; $macro="defMail"; $txt=_("Enter your mail client's path or your web mailer's URL:"); $tit=_("Mail Configuration"); &MNcfg;
}
NewsCfg{
$mnPref=$nc; $macro="defNews"; $txt=_("Enter your news client's path or your news provider's URL:"); $tit=_("News Configuration"); &MNcfg;
}

Compose{
open("mailto:");
}

EmailURL{
$JSdoit="with(top.document)location='mailtomoody smileysubject='+encodeURIComponent(title)+
'&body='+encodeURIComponent(URL)"; &hndlDoc;
}
EmailImageURL{
$JSdoitImg="location='mailtomoody smileysubject='+encodeURIComponent((title)?title:
((alt)?alt:document.title))+'&body='+encodeURIComponent(src)"; $JSdoitInput=$JSdoitImg; &hndlImage;
}
EmailFrameURL{
$JSdoit="location='mailtomoody smileysubject='+encodeURIComponent(title)+'&body=
'+encodeURIComponent(URL)"; &hndlDoc;
}
EmailText{
$JSdoit="if(getSelection())location='mailtomoody smileysubject='+
encodeURIComponent(title)+'&body='+encodeURIComponent(getSelection(
))";$SelectedText==""?0:&hndlDoc;
}

# ----- Translation

$Tpref=$macroPrefBranch."translation.to";
$Ttext="http://babelfish.altavista.com/babelfish/tr?lp=<from>_<to>&urltext=";;
$Tpage="http://babelfish.altavista.com/babelfish/trurl_pagecontent?lp=<from>_<to>&url=";;

Dutch{
$from=nl; &Translate;
}
English{
$from=en; &Translate;
}
French{
$from=fr; &Translate;
}
German{
$from=de; &Translate;
}
Greek{
$from=el; &Translate;
}
Italian{
$from=it; &Translate;
}
Japanese{
$from=ja; &Translate;
}
Korean{
$from=ko; &Translate;
}
Portuguese{
$from=pt; &Translate;
}
Russian{
$from=ru; &Translate;
}
Spanish{
$from=es; &Translate;
}
Chinese-Simple{
$from=zh; &Translate;
}
Chinese-Traditional{
$from=zt; &Translate;
}

Translate{
&Tpref; $data=$SelectedText; $data==""?&Tpage:&Ttext;
}
Tpref{
$to=getpref(STRING,$Tpref); $to==""?$to="en":0;
}
Ttext{
$data=sub("<from>",$from,sub("<to>",$to,$Ttext)).urlencode($data); &OpenSelected;
}
Tpage{
$data=sub("<from>",$from,sub("<to>",$to,$Tpage)).urlencode($URL);
index($URL,"http://")==0?&OpenTyped:alert(_("Sorry, local and secure pages cannot be translated!"),_("Babel Fish Translation"),INFO);
}

TranslateCfg{
&Tpref; $tit=_("Babel Fish Translation");
alert(_("Available target languages:").\n\n.sub(%s,en,_("English\t\t = %s")).\n\n.sub(%s,es,_("Spanish\t\t = %s")).\n.sub(%s,pt,_("Portuguese\t = %s")).\n.sub(%s,fr,_("French\t\t = %s")).\n.sub(%s,de,_("German\t\t = %s")).\n.sub(%s,nl,_("Dutch\t\t = %s")).\n.sub(%s,it,_("Italian\t\t = %s")).\n.sub(%s,el,_("Greek\t\t = %s")).\n\n.sub(%s,ru,_("Russian\t\t = %s")).\n.sub(%s,ko,_("Korean\t\t = %s")).\n.sub(%s,ja,_("Japanese\t\t = %s")).\n.sub(%s,zt,_("Chinese (Traditional) = %s")).\n.sub(%s,zh,_("Chinese (Simplified)\t = %s")).\n\n._("Enter the desired language's two-letter code into the following prompt."),$tit,INFO);
$to=prompt(_("Two-letter target language code:"),$tit,$to); $to==""?0:setpref(STRING,$Tpref,$to);
}

# ----- Web Search

$kw="keyword.enabled";
$SearchName="kmeleon.general.searchEngineName";
$SearchEngine="kmeleon.general.searchEngine";
$SearchEngineURL="";
$SearchEngineName="";
$sm=$macroPrefBranch."search.meta";
$se=$macroPrefBranch."search.engine";
$sl=$macroPrefBranch."search.locked";

EnginesSync{
$SearchEngineURL=getpref(STRING,$SearchEngine); $SearchEngineName=getpref(STRING,$SearchName); $n=0; while($n!=10) &EngineLoop;
setcheck("macros(SearchLock)",getpref(BOOL,$sl));
setcheck("macros(Keyword)",getpref(BOOL,$kw));
# Support for K-Meleon 0.9 engine macros:
&EngineSync;
}
EngineLoop{
setcheck("macros(SE".$n.")",getpref(STRING,$se.$n.".url")==$SearchEngineURL ?true:false); $n=$n+1;
}

KMF{
$SearchEngineURL=getpref(STRING,$macroPrefBranch."search.kmforums"); $SearchEngineName=_("K-Meleon Forums Search"); &Search;
}
SE0{
$n=0; menu=getpref(STRING,$se."0.name"); &SEgo;
}
SE1{
$n=1; menu=getpref(STRING,$se."1.name"); &SEgo;
}
SE2{
$n=2; menu=getpref(STRING,$se."2.name"); &SEgo;
}
SE3{
$n=3; menu=getpref(STRING,$se."3.name"); &SEgo;
}
SE4{
$n=4; menu=getpref(STRING,$se."4.name"); &SEgo;
}
SE5{
$n=5; menu=getpref(STRING,$se."5.name"); &SEgo;
}
SE6{
$n=6; menu=getpref(STRING,$se."6.name"); &SEgo;
}
SE7{
$n=7; menu=getpref(STRING,$se."7.name"); &SEgo;
}
SE8{
$n=8; menu=getpref(STRING,$se."8.name"); &SEgo;
}
SE9{
$n=9; menu=getpref(STRING,$se."9.name"); &SEgo;
}
SEgo{
$SearchEngineURL=getpref(STRING,$se.$n.".url"); $SearchEngineName=getpref(STRING,$se.$n.".name"); &SearchInit;
}

SearchInit{
$locked=getpref(BOOL,$sl);
$locked==true?0:setpref(STRING,$SearchEngine,$SearchEngineURL);
$locked==true?0:setpref(STRING,$SearchName,$SearchEngineName);
$locked==true?0:&EnginesSync; &Search;
}
Search{
$SearchEngineURL==""?$SearchEngineURL=getpref(STRING,$SearchEngine):0;
$SearchEngineName==""?$SearchEngineName=getpref(STRING,$SearchName):0;
$data=$SelectedText; $data==""?&SearchTyped:&SearchSelected; $SearchEngineURL=""; $SearchEngineName="";
}
SearchSelected{
$data=$SearchEngineURL.urlencode($data); &OpenSelected;
}
SearchTyped{
$data=$URLBAR; $data==$URL?$data=prompt(_("Enter search query:"),sub("%s",$SearchEngineName,_("Search (%s)"))):0;
$data==""?0:$data=$SearchEngineURL.urlencode($data);
# prevent search queries from being added to the MRU
$prf="kmeleon.MRU.behavior"; $tmp=getpref(INT,$prf); $tmp==2?setpref(INT,$prf,3):0; &OpenTyped; setpref(INT,$prf,$tmp);
}

PasteSearch{
$URLBAR=getclipboard(); &Search;
}

Metasearch{
$data=$SelectedText; $data==""?&MetaTyped:&MetaSelected;
}
MetaSelected{
$pref=$openSelected; &MetaOpen;
}
MetaTyped{
$pref=$openTyped;
$data=$URLBAR; $data==$URL?$data=prompt(_("Enter search query:"),sub("%s",_("Metasearch"),_("Search (%s)"))):0;
$data==""?0:&MetaOpen;
}
MetaOpen{
$how=getpref(STRING,$pref); $data=urlencode($data);
$how=="ID_OPEN_LINK"?$how=0:0;
$how=="ID_OPEN_LINK_IN_NEW_WINDOW"?$how=0:0;
$how=="ID_OPEN_LINK_IN_BACKGROUND"?$how=1:0;
$how=="layers(OpenURL)"?$how=0:0;
$how=="layers(OpenURLBg)"?$how=1:0;
&ResetURL; $n=0; while($n!=10) &MetaLoop;
}
MetaLoop{
$SearchEngineURL=getpref(STRING,$sm.$n.".url");
$SearchEngineURL==""?0:$how==0?($layer==true?pluginmsg(layers,"OpenURL"
,$SearchEngineURL.$data)yawning smileypennew($SearchEngineURL.$data)):0;
$SearchEngineURL==""?0:$how==1?($layer==true?pluginmsg(layers,"OpenURLBg"
,$SearchEngineURL.$data):OpenBg($SearchEngineURL.$data)):0;
$n=$n+1;
}

SearchLock{
togglepref(BOOL,$sl); &EnginesSync;
statusbar(sub("%s",getpref(BOOL,$sl)?getpref(STRING,$SearchName):_("Last used engine"),_("Default search engine: %s")));
}

Keyword{
togglepref(BOOL,$kw); &EnginesSync;
statusbar(sub("%s",getpref(BOOL,$kw)?$ON:$OFF,_("Keyword Autosearch %s")));
}

# Support for K-Meleon 0.9 engine macros:
$sen=$SearchName;
OldSearch{
}
SetSearch{
$SearchEngineURL=$eng; $SearchEngineName=$search; &SearchInit;
}
EngineSync{
setcheck("macros(Google)", getpref(STRING, $sen) == "Google" ? true:false);
setcheck("macros(Icerocket)", getpref(STRING, $sen) == "Icerocket" ? true:false);
setcheck("macros(Kartoo)", getpref(STRING, $sen) == "Kartoo" ? true:false);
setcheck("macros(AltaVista)", getpref(STRING, $sen) == "AltaVista" ? true:false);
setcheck("macros(Hotbot)", getpref(STRING, $sen) == "Hotbot" ? true:false);
setcheck("macros(IMDcool smiley", getpref(STRING, $sen) == "Internet Movie Database" ? true:false);
setcheck("macros(Findtarget)", getpref(STRING, $sen) == "Findtarget" ? true:false);
setcheck("macros(Joyscape)", getpref(STRING, $sen) == "Joyscape" ? true:false);
setcheck("macros(Clusty)", getpref(STRING, $sen) == "Clusty" ? true:false);
setcheck("macros(Astalavista)", getpref(STRING, $sen) == "Astalavista" ? true:false);
setcheck("macros(MSCracks)", getpref(STRING, $sen) == "MSCracks" ? true:false);
setcheck("macros(Mamma)", getpref(STRING, $sen) == "Mamma" ? true:false);
setcheck("macros(IPDcool smiley", getpref(STRING, $sen) == "Internet Pinball Database " ? true:false);
setcheck("macros(ClustyImages)", getpref(STRING, $sen) == "ClustyImages" ? true:false);
setcheck("macros(FindtargetImages)", getpref(STRING, $sen) == "FindtargetImages" ? true:false);
setcheck("macros(IcerocketImages)", getpref(STRING, $sen) == " IcerocketImages " ? true:false);
setcheck("macros(IxquickImages)", getpref(STRING, $sen) == " IxquickImages " ? true:false);
setcheck("macros(JoyScapeImages)", getpref(STRING, $sen) == "JoyScape Images" ? true:false);
setcheck("macros(MondoMolePics)", getpref(STRING, $sen) == "MondoMolePics" ? true:false);
setcheck("macros(GoogleImages)", getpref(STRING, $sen) == "GooglePics" ? true:false);
setcheck("macros(YahooImages)", getpref(STRING, $sen) == "YahooImages" ? true:false);
}

Google{
&OldSearch; $search = "Google";
$eng = "http://www.google.com/search?q=";;
&SetSearch;
}

Icerocket{
&OldSearch; $search = "Icerocket";
$eng = "http://www.icerocket.com/search?tab=web&q=";;
&SetSearch;
}

Kartoo{
&OldSearch; $search = "Kartoo";
$eng = "http://www.kartoo.com/en/servlet/H?q=";;
&SetSearch;
}

AltaVista{
&OldSearch; $search = "AltaVista";
$eng = "http://www.altavista.com/web/results?itag=wrx&q=";;
&SetSearch;
}

Hotbot{
&OldSearch; $search = "Hotbot";
$eng = "http://search.hotbot.co.uk/cgi-bin/pursuit?query=";;
&SetSearch;
}

IMDB{
&OldSearch; $search = "Internet Movie Database";
$eng = "http://www.imdb.com/find?";;
&SetSearch;
}

Findtarget{
&OldSearch; $search = "Findtarget";
$eng = "http://search.findtarget.com/search.php?q=";;
&SetSearch;
}

JoyScape{
&OldSearch; $search = " JoyScape ";
$eng = "http://www.joyscape.com/search/s?q=";;
&SetSearch;
}

Clusty{
&OldSearch; $search = "Clusty";
$eng = "http://clusty.com/search?query=";;
&SetSearch;
}

Astalavista{
&OldSearch; $search = "Astalavista";
$eng = "http://www.astalavista.us/search.php?s=";;
&SetSearch;
}

MSCracks{
&OldSearch; $search = "MSCracks";
$eng = "http://mscracks.com/search.php?q=";;
&SetSearch;
}

Mamma{
&OldSearch; $search = "Mamma";
$eng = "http://www.mamma.com/Mamma?query=";;
&SetSearch;
}

IPDB{
&OldSearch; $search = " Internet Pinball Database ";
$eng = "http://www.ipdb.org/search.pl?any=";;
&SetSearch;
}

ClustyImages{
&OldSearch; $search = "ClustyImages";
$eng = "http://clusty.com/search?v%3aproject=clusty-images&query=";;
&SetSearch;
}

FindtargetImages{
&OldSearch; $search = "FindtargetImages";
$eng = "http://search.findtarget.com/imagesearch.php?q=";;
&SetSearch;
}

IcerocketImages {
&OldSearch; $search = " IcerocketImages ";
$eng = "http://www.icerocket.com/search?tab=image&q=";;
&SetSearch;
}

IxquickImages{
&OldSearch; $search = "IxquickImages";
$eng = "http://eu.ixquick.com/do/metasearch.pl?cat=pics&cmd =process_search&language=english&ff=&query=”;
&SetSearch;
}

JoyScapeImages{
&OldSearch; $search = " JoyScapeImages ";
$eng = "http://www.joyscape.com/search/s?t=images&tmplt=msearch.htm&gbs=no&q=";;
&SetSearch;
}

MondoMolePics{
&OldSearch; $search = "MondoMoleImages";
$eng = "http://www.mondomole.com/search?&NextEntry=0&Search=Search&FF=1&QueryStr=";;
&SetSearch;
}

GoogleImages{
&OldSearch; $search = "Google Images";
$eng = "http://images.google.com/images?btnG=Google+Search&safe=off&filter=0&q=";;
&SetSearch;
}

YahooImages{
&OldSearch; $search = "YahooImages";
$eng = "http://images.search.yahoo.com/search/images?p=";;
&SetSearch;
}

# ----- Page Search

$taf="accessibility.typeaheadfind";

TAFSync{
setcheck("macros(TAF)",getpref(BOOL,$taf));
setcheck("macros(TAFAuto)",getpref(BOOL,$taf.".autostart"));
setcheck("macros(TAFLinks)",getpref(BOOL,$taf.".linksonly"));
}

TAF{
togglepref(BOOL,$taf); &TAFSync;
statusbar(sub("%s",getpref(BOOL,$taf)==true?_("enabled"):_("disabled"),_("Find As You Type %s.")));
}
TAFAuto{
togglepref(BOOL,$taf.".autostart"); &TAFSync;
statusbar(sub("%s",getpref(BOOL,$taf.".autostart")==true?_("enabled"):_("disabled"),_("Find As You Type Autostart %s.")));
}
TAFLinks{
togglepref(BOOL,$taf.".linksonly"); &TAFSync;
statusbar(getpref(BOOL,$taf.".linksonly")==true?_("Search Links Only."):_("Search All Text."));
}

# ---------- Miscellaneous -----------------------------------------------------------------------------------------

KMWiki{
open("http://kmeleon.sourceforge.net/wiki/index.php?id=Welcome"winking smiley;
}

# ----- Toolbar Buttons

# Go
SelectGo{
$data=$SelectedText; $data==""?0:&OpenSelected; $data=$data==""?$URLBAR:"";
$data==""?0sad smiley$data==$URL?id(ID_NAV_RELOAD):&OpenTyped);
}
OpenInNew{
$val=getpref(STRING,$openTyped);
setpref(STRING,$openTyped,$layer==true?"layers(OpenURL)":"ID_OPEN_LINK_IN_NEW_WINDOW");
id(ID_NAV_GO); setpref(STRING,$openTyped,$val);
}
Copy{
id(ID_SELECT_URL); id(ID_EDIT_COPY);
}
PasteGo{
$URLBAR=getclipboard(); id(ID_NAV_GO);
}

# Up
up_directory{
$data=dirname($URL); $data=="."?0yawning smileypen($data."/");
}
top_level{
InjectJS("location.pathname=''");
}

# ----- External Applications

getIE{
$ie=readreg("HKCR","Applications\\iexplore.exe\\shell\\open\\command\\");
$ie==""?$ie=sub("%s",_("Program Files"),"\"C:\\%s\\Internet Explorer\\iexplore.exe\" %1"):0;
}
URLInIE{
&getIE; exec(sub("%1",$URL,$ie));
}
LinkInIE{
&getIE; exec(sub("%1",$LinkURL,$ie));
}
OpenInIE{
$theurl=$URLBAR; $theurl==""?$theurl=$URL:0;
&getIE; exec(sub("%1",$theurl,$ie));
}

# PAGESPEED MACRO

# TOGGLE PAGESPEED

ToggleSpeed{
menu = "Enable Page Load Speed-Up"
getpref(BOOL, "network.http.pipelining") == true ? &DisableSpeed:&EnableSpeed;
&Sync;
getpref(BOOL, "network.http.pipelining") == true ? $warn = "enabled":$warn = "disabled";
Alert("Page Load Speed-Up has been ".$warn."!");
}

# ENABLE PAGESPEED

EnableSpeed{
# TURN ON TIMER BASED REFLOW MANAGEMENT
setpref(BOOL, "content.notify.ontimer", true);

# SETS THE ALLOWED TIME BETWEEN REFLOWS IN MICROSECONDS
setpref(INT, "content.notify.interval", 240000);

# SET THE NUMBER OF REFLOWS TO DO BEFORE WAITING FOR THE REST OF THE PAGE TO ARRIVE
setpref(INT, "content.notify.backoffcount", 10);

# ENABLE IMPROVED PIPELINING
setpref(BOOL, "network.http.pipelining", true);
setpref(INT, "network.http.pipelining.maxrequests", 8);
setpref(BOOL, "network.http.proxy.pipelining", true);

# INCREASE MULTI-THREADED DOWNLOAD PERFORMANCE
setpref(INT, "network.http.max-connections", 24);
setpref(INT, "network.http.max-connections-per-server", 16);
setpref(INT, "network.http.max-persistent-connections-per-proxy", 8);
setpref(INT, "network.http.max-persistent-connections-per-server", 4);
}
DisableSpeed{
setpref(BOOL, "content.notify.ontimer", false);
setpref(INT, "content.notify.interval", 120000);
setpref(INT, "content.notify.backoffcount", -1);
setpref(BOOL,"network.http.pipelining", false);
setpref(INT, "network.http.pipelining.maxrequests", 4);
setpref(BOOL, "network.http.proxy.pipelining", false);
setpref(INT, "network.http.max-connections", 24);
setpref(INT, "network.http.max-connections-per-server", 8);
setpref(INT, "network.http.max-persistent-connections-per-proxy", 4);
setpref(INT, "network.http.max-persistent-connections-per-server", 2);
}
SpeedSync{
setcheck("macros(ToggleSpeed)", getpref(BOOL, "network.http.pipelining") == true ? true:false);
}

ReloadImage {
$tmp=true; getpref(INT,$images)==2 ? &ImgToggle : $tmp=false;
$tmq=true; getpref(BOOL,"dom.disable_image_src_set") ? togglepref(BOOL,"dom.disable_image_src_set") : $tmq=false;
$JSfunc="";
$JSdoit="var t='".$ImageURL."',i=images;for(var j=0;j<i.length;j++)if(i[j].src==t){i[j].src="";i[j].src=t;}";
&hndlDocs;
$tmp ? &ImgToggle : "";
$tmq ? togglepref(BOOL,"dom.disable_image_src_set") : "";
}

Options: ReplyQuote
Re: Problem to add searchbar and searchmacros
Posted by: Rapido
Date: June 25, 2007 10:57PM

And here is Menufile:
# K-Meleon Menus (http://kmeleon.sourceforge.net/wiki/index.php?id=ConfigFiles#menus)

# Syntax:
# <menuname>{
# <label>=<command>
# !<submenunameINLINE>
# :<submenunamePOPUP>
# }
#
# - Lines beginning with '#' are ignored (comments)
# - Menus must be defined BEFORE being used as submenus

# Note: The purpose of this file is to host your personal menu definitions.
# Using the syntax described above, you can completely redefine the
# default menus which are defined in defaults\settings\menus.cfg in
# your K-Meleon installation directory. Using an extended syntax, you
# can even add menus and commands to the default menus and remove
# items from them without missing future updates of the defaults.
# For this extended syntax, please refer to our wiki.

# MENU DEFINITION FILE

# Note: Menus must be defined *before* being used as submenus

# ---------- Plugins -----------------------------------------------------------------------------------------------

# ----- Bookmarks

%ifplugin bookmarks
&Bookmarks{
bookmarks(Add,&Add Page\tCtrl+D)
bookmarks(Edit,&Edit...\tCtrl+cool smiley
macros(Bookmarks,&Options...)
-
bookmarks()
}
%endif

# ----- Hotlist

%ifplugin hotlist
H&otlist{
hotlist(Add,&Add Page)
hotlist(Edit,&Edit...)
macros(Hotlist,&Options...)
-
hotlist()
}
%endif

# ----- Favorites

%ifplugin favorites
F&avorites{
favorites(Add,&Add Page)
favorites(Edit,&Explore...)
macros(Favorites,&Options...)
-
favorites()
}
%endif

# ----- Fullscreen

Fullscreen{
%ifplugin fullscreen
-
fullscreen(,Fu&ll Screen\tF11)
%endif
}

# ----- History

%ifplugin history
Histor&y{
history(View,View &History\tCtrl+H)
privacy(ClearHistory,&Clear History)
history(Config,Se&ttings...)
history()
}
%endif

# ----- Layers

%ifplugin layers

CloseLayer{
layers(Close,Close Laye&r\tCtrl+F4)
layers(CloseAll,Close All La&yers\tCtrl+Shift+F4)
layers(CloseAllOther,Close O&ther Layers\tShift+F4)
-
}

&Layers{
%ifplugin macros
macros(Layers,&Options...)
-
%endif
layers()
}

%endif

# ----- Sessions

%ifplugin sessions
&Sessions{
sessions(load,&Load Session)
sessions(save,&Save Session)
sessions(undo,&Undo Last Closed)
}
%endif

# ---------- Macros ------------------------------------------------------------------------------------------------

%ifplugin macros

# ----- Configuration Files

Config&uration{
macros(AllPrefs,Browser Con&figuration\tabout:config)
#macros(Prefs,&Profile Settings\tprefs.js)
macros(User,&User Settings\tuser.js)
-
macros(UserContent,User-Defined &StyleSheet\tuserContent.css)
macros(CSSFilters,Ad-&Blocking StyleSheet\tadblock.css)
macros(Toolbars,&Toolbars\ttoolbars.cfg)
-
macros(Accel,A&ccelerators\taccel.cfg)
macros(Macros,M&acros\tmacros.cfg)
macros(Menus,M&enus\tmenus.cfg)
macros(GestureCmds,Mouse &Gestures\tgestures.cfg)
macros(SearchEngs,Search &Engines\tsearch.cfg)
macros(Commands,Co&mmands List\tcommands.txt)
-
macros(ProfD,Profile &Directory)
}

# ----- Custom Proxies

Pro&xy{
macros(NoProxy,&Direct Connection)
macros(proxy1)
macros(proxy2)
macros(proxy3)
-
macros(ProxyCfg,Con&figure...)
}

# ----- Encoding

&Auto Detect{
macros(AutoDetect(),(O&ff))
macros(AutoDetect(universal_charset_detector),Uni&versal)
macros(AutoDetect(zh_parallel_state_machine),Ch&inese)
macros(AutoDetect(ja_parallel_state_machine),J&apanese)
macros(AutoDetect(ko_parallel_state_machine),K&orean)
macros(AutoDetect(cjk_parallel_state_machine),&East Asian)
macros(AutoDetect(ruprob),Ru&ssian)
macros(AutoDetect(ukprob),U&krainian)
}

En&coding{
:&Auto Detect
-
macros(ForceCharset(iso-8859-1),&Western (ISO-8859-1))
-
macros(ForceCharset(iso-8859-2),&Central European (ISO-8859-2))
macros(ForceCharset(windows-1250),C&entral European (Windows-1250))
-
macros(ForceCharset(utf-8),&Unicode (UTF-8))
macros(ForceCharset(utf-7),U&nicode (UTF-7))
}

# ----- External Applications/Web Services

Op&en Page With{
macros(URLInIE,&Internet Explorer\tCtrl+Alt+I)
}
Op&en Link Target With{
macros(LinkInIE,&Internet Explorer)
}

# ----- Mail and News

&Mail And News{
macros(Mail,Read &Mail)
macros(Compose,New Me&ssage...)
macros(EmailURL,Sen&d Page As Link...)
-
macros(News,Read &News)
macros(RSS,Read &RSS Feeds)
-
macros(MailCfg,Configure M&ail...)
macros(NewsCfg,Configure N&ews...)
}

# ----- Page Search

Page &Search{
macros(TAF,Find As You &Type)
-
macros(TAFAuto,Start &Automatically)
macros(TAFLinks,Search &Links Only)
}

# ----- Privacy

P&ermissions{
macros(Filters,Content &Filters)
macros(JavaScript,&JavaScript)
-
macros(Master,&Master Password)
macros(Cert,&Certificates)
}

Privacy Settings{
macros(CKToggle,Block Co&okies)
macros(JToggle,Block &Java)
macros(JSToggle,Block Java&Script\tF7)
macros(PBToggle,Block &Popups\tF8)
macros(ImgToggle,Block &Images\tF9)
macros(AniToggle,Block Image Ani&mation)
macros(CToggle,Block Page Co&lors)
macros(FrmToggle,Block &Frames)
macros(RefToggle,Block HTTP &Referer)
}

&User Agent{
macros(UA0)
macros(UA1)
macros(UA2)
macros(UA3)
macros(UACust,&Custom...)
-
macros(ResetUA,&Reset To Default On Exit)
}

# ----- Reloading

Reloa&ding{
&Force Reload\tCtrl+F5=ID_NAV_FORCE_RELOAD
%ifplugin layers
macros(ReloadAll,Reload &All Layers)
%endif
macros(Continuous,&Continuous Reload)
}

# ----- Translation

&Translate From{
macros(English,&English)
-
macros(Spanish,&Spanish)
macros(Portuguese,&Portuguese)
macros(French,&French)
macros(German,&German)
macros(Dutch,&Dutch)
macros(Italian,&Italian)
macros(Greek,Gr&eek)
-
macros(Russian,&Russian)
macros(Korean,&Korean)
macros(Japanese,&Japanese)
macros(Chinese-Traditional,&Chinese (Traditional))
macros(Chinese-Simple,Chi&nese (Simplified))
-
macros(TranslateCfg,&To (Specify Language)...)
}

# ----- Web Search

Engines{
macros(SE0)
macros(SE1)
macros(SE2)
macros(SE3)
macros(SE4)
macros(SE5)
macros(SE6)
macros(SE7)
macros(SE8)
macros(SE9)
-
macros(Google)
macros(Icerocket)
macros(Kartoo)
macros(AltaVista)
macros(Hotbot)
macros(IMDcool smiley
macros(Findtarget)
macros(JoyScape)
macros(Clusty)
macros(Astalavista)
macros(MSCracks)
macros(Mamma)
macros(IPDcool smiley
macros(ClustyImages)
macros(FindtargetImages)
macros(IcerocketImages)
macros(IxquickImages)
macros(JoyScapeImages, JoyScapeImages)
macros(MondoMolePics)
macros(GoogleImages)
macros(YahooImages,YahooImages)
}
-
macros(Metasearch,&Metasearch)
}

&Web Search{
!Engines
-
macros(SearchLock,Use As &Default Engine)
macros(WebFind,Con&figure...)
}

%endif

# ----- Groups

%ifplugin macros & layers
&Groups{
%ifplugin layers
macros(SaveAsGroup,&Save Layers As Group...\tCtrl+Alt+S)
macros(URLToGroup,Add Th&is Layer To Group...)
macros(LayersToGroup,Add Th&ese Layers To Group...)
-
macros(SavedGroups,Saved &Groups...\tCtrl+Alt+G)
macros(GroupOnly,Open Group &Only...\tShift+Enter)
macros(OpenGroup,Open Group &Additionally...\tAlt+Enter)
macros(DeleteGroup,&Delete Group...)
-
layers()
%endif
}
%endif

%ifplugin macros & bookmarks|hotlist|layers
Ho&me{
Open &Home Page\tAlt+Home=ID_NAV_HOME
%ifplugin layers
macros(OpenStart,Open &Startup Group\tCtrl+Alt+Home)
macros(OpenLast,Open &Last Session\tCtrl+Alt+L)
%else
%ifplugin bookmarks|hotlist
macros(OpenStart,Open &Startup Folder\tCtrl+Alt+Home)
%endif
%endif
-
macros(SetHome,M&ake This Page Your Home Page)
-
macros(StartHome,Start With Home &Page)
macros(StartBlank,Start With &Blank Page)
%ifplugin layers
macros(StartGroup,Start With &Group...)
macros(StartLast,Start With Last S&ession)
%else
%ifplugin bookmarks|hotlist
macros(StartGroup,Start With &Folder...)
%endif
%endif
}
%endif

# ----- Privacy

%ifplugin macros|privacy

&Privacy{
%ifplugin macros
tongue sticking out smiley&ermissions
-
!Privacy Settings
%endif
%ifplugin privacy
%ifplugin macros
-
%endif
privacy(Config,Se&ttings...)
-
privacy(ClearCache,Clear C&ache)
privacy(ClearCookies,Clear &Cookies)
privacy(ClearHistory,Clear &History)
privacy(ClearMRU,Clear &URL Bar History)
privacy(ClearSignon,Clear Pass&words)
macros(ClearAll,Clear A&ll)
%endif
%ifplugin macros
-
%endif
macros(KillFlash,Kill Fl&ash Objects)
macros(KillApplets,Kill Ja&va Applets)
}

%endif

# ----- Zoom

%ifplugin macros
ZoomIn{
macros(ZoomInPage,Zoom In &Page\tCtrl+Alt++)
Zoom In &Text\tCtrl++=ID_FONT_INCREASE
macros(ZoomInImages,Zoom In &Images\tAlt++)
}
ZoomOut{
macros(ZoomOutPage,Zoom Out P&age\tCtrl+Alt+-)
Zoom Out T&ext\tCtrl+-=ID_FONT_DECREASE
macros(ZoomOutImages,Zoom Out I&mages\tAlt+-)
}
%endif

%ifplugin macros & toolbars
Zoom &Buttons{
macros(ZoomPage,Zoom Full &Page)
macros(ZoomText,Zoom &Text Only)
macros(ZoomImages,Zoom &Images Only)
}
%endif

# ---------- Toolbar Buttons ---------------------------------------------------------------------------------------

# ----- Main Bar

Print{
&Print...\tCtrl+P=ID_FILE_PRINT
Print Pre&view\tCtrl+Alt+P=ID_FILE_PRINTPREVIEW
Page Set&up=ID_FILE_PRINTSETUP
#bmpmenu()
}

# ----- Zoom Buttons

%ifplugin macros & toolbars
Zoom In{
!ZoomIn
-
:Zoom &Buttons
#bmpmenu()
}
Zoom Out{
!ZoomOut
-
:Zoom &Buttons
#bmpmenu()
}
%endif

# ----- Go Buttons

Go{
macros(OpenInNew,Open In &New Page\tCtrl+Alt+N)
-
macros(Copy,&Copy)
macros(PasteGo,&Paste And Go\tCtrl+Alt+V)
macros(PasteSearch,Paste And &Search\tCtrl+Shift+V)
-
macros(ResetURL,&Reset URL Bar)
privacy(ClearMRU,Clear &URL Bar History)
}

Up{
macros(up_directory,Go &Up One Directory Level)
macros(top_level,Go To &Top Directory Level)
}

# ----- Layer/Window Buttons

Prev{
Pre&vious Window\tCtrl+Shift+F7=ID_WINDOW_PREV
layers(Prev,Previ&ous Layer\tCtrl+PageUp)
layers(Last,Previously Sele&cted Layer\tCtrl+Alt+Tab)
%ifplugin layers
-
layers()
%endif
#bmpmenu()
}

Next{
Ne&xt Window\tCtrl+F7=ID_WINDOW_NEXT
layers(Next,N&ext Layer\tCtrl+PageDown)
%ifplugin layers
-
layers()
%endif
#bmpmenu()
}

New{
layers(Open,New L&ayer\tCtrl+T)
&New Window\tCtrl+N=ID_NEW_BROWSER
#bmpmenu()
}

Close{
%ifplugin layers
!CloseLayer
%endif
&Close Window\tAlt+F4=ID_FILE_CLOSE
Exit &K-Meleon\tCtrl+Alt+F4=ID_APP_EXIT
#bmpmenu()
}

# ---------- Main Menu ---------------------------------------------------------------------------------------------

# ----- File

&File{
!New
-
Ne&xt Window\tCtrl+F7=ID_WINDOW_NEXT
Pre&vious Window\tCtrl+Shift+F7=ID_WINDOW_PREV
-
&Open...\tCtrl+O=ID_FILE_OPEN
%ifplugin layers
macros(OpenLast,Open &Last Session\tCtrl+Alt+L)
%endif
&Save Page As...\tCtrl+S=ID_FILE_SAVE_AS
-
!Print
-
Work O&ffline=ID_OFFLINE
-
!Close
}

# ----- Edit

Edit{
Cu&t\tCtrl+X=ID_EDIT_CUT
&Copy\tCtrl+C=ID_EDIT_COPY
&Paste\tCtrl+V=ID_EDIT_PASTE
Select &All\tCtrl+A=ID_EDIT_SELECT_ALL
}

&Edit{
!Edit
-
&Find In Page\tCtrl+F=ID_EDIT_FIND
Find Ne&xt\tF3=ID_EDIT_FINDNEXT
Find Pre&vious\tShift+F3=ID_EDIT_FINDPREV
-
&Manage Profiles...=ID_MANAGE_PROFILES
Pr&eferences=ID_PREFERENCES
macros(PrefPanel,A&dvanced Preferences)
%ifplugin macros
:Config&uration
%endif
macros(mimeEdit,MIME T&ypes)
}

# ----- View

Tool&bars{
@ToolBars
-
Loc&k Toolbars=ID_TOOLBARS_LOCK
macros(ToolBars,&Options...)
}

Nav{
Bac&k\tAlt+Left=ID_NAV_BACK
For&ward\tAlt+Right=ID_NAV_FORWARD
S&top\tEsc=ID_NAV_STOP
&Reload\tF5=ID_NAV_RELOAD
%ifplugin macros
:Reloa&ding
%else
&Force Reload\tCtrl+F5=ID_NAV_FORCE_RELOAD
%endif
}

%ifplugin macros
&Zoom{
!ZoomIn
-
!ZoomOut
%ifplugin toolbars
-
:Zoom &Buttons
%endif
}
%endif

Page &Properties{
macros(ListLinks,Li&nks)
macros(ListLinkedImages,Link&ed Images)
macros(ListImages,Im&ages)
So&urce Code\tCtrl+U=ID_VIEW_SOURCE
Cache &Information\tCtrl+I=ID_VIEW_PAGE_INFO
}
Page Pro&perties{
macros(ListLinks,Li&nks)
macros(ListLinkedImages,Link&ed Images)
macros(ListImages,Im&ages)
&Background Image=ID_VIEW_IMAGE
So&urce Code\tCtrl+U=ID_VIEW_SOURCE
Cache &Information\tCtrl+I=ID_VIEW_PAGE_INFO
}

Frame &Properties{
macros(ListFrameLinks,Li&nks)
macros(ListLinkedFrameImages,Link&ed Images)
macros(ListFrameImages,Im&ages)
So&urce Code=ID_VIEW_FRAME_SOURCE
Cache &Information=ID_VIEW_FRAME_INFO
}

&View{
:Tool&bars
&Status Bar\tAlt+Shift+S=ID_VIEW_STATUS_BAR
-
!Nav
%ifplugin macros & bookmarks|hotlist|layers
-
:Ho&me
%else
Open &Home Page\tAlt+Home=ID_NAV_HOME
-
%endif
%ifplugin history
:Histor&y
%endif
%ifplugin layers
:&Layers
%endif
%ifplugin history|layers
-
%endif
%ifplugin macros
:&Zoom
:En&coding
%else
Zoom In &Text\tCtrl++=ID_FONT_INCREASE
Zoom Out T&ext\tCtrl+-=ID_FONT_DECREASE
%endif
-
!Page &Properties
!Fullscreen
}

# ----- Tools

&Tools{
%ifplugin macros
:&Mail And News
-
tongue sticking out smileyage &Search
:&Web Search
:&Translate From
%else
&Web Search\tCtrl+G=ID_NAV_SEARCH
%endif
%ifplugin macros|privacy
-
:&Privacy
%endif
%ifplugin macros
tongue sticking out smileyro&xy
:&User Agent
-
macros(ToggleSpeed)
macros(Hotlinks,&Hotlinks...)
macros(MGestures,Mouse &Gestures...)
-
macros(JSConsole,JavaScript &Console)
%endif
}

# ----- Help

&Help{
K-Meleon &Home=ID_LINK_KMELEON_HOME
macros(KMWiki,K-Meleon &Wiki)
-
K-Meleon &Forums=ID_LINK_KMELEON_FORUM
macros(KMF,K-Meleon Forums &Search...)
-
&User's Guide\tF1=ID_LINK_KMELEON_MANUAL
&FAQ=ID_LINK_KMELEON_FAQ
-
About &Plugins=ID_LINK_ABOUT_PLUGINS
About &K-Meleon=ID_APP_ABOUT
}

# ----- Main

Main{
:&File
:&Edit
:&View
%ifplugin bookmarks
:&Bookmarks
%endif
%ifplugin favorites
:F&avorites
%endif
%ifplugin hotlist
:H&otlist
%endif
%ifplugin macros & layers
:&Groups
%endif
%ifplugin sessions
:&Sessions
%endif
:&Tools
:&Help
bmpmenu(top)
}

Compact Menu{
!Main
}

# ---------- Context Menus -----------------------------------------------------------------------------------------

# ----- Layers

%ifplugin layers
LayerButtonPopup{
!New
-
%ifplugin macros
macros(OpenClosed,&Undo Last Closed\tCtrl+Alt+Z)
-
%endif
layers(Next,N&ext Layer\tCtrl+PageDown)
layers(Prev,Previ&ous Layer\tCtrl+PageUp)
layers(Last,Previously Sele&cted Layer\tCtrl+Alt+Tab)
-
!CloseLayer
:&Layers
}
%endif

# ----- Selection

Selected Te&xt{
:&Translate From
-
macros(OpenText,&Open As URL)
macros(EmailText,Sen&d By Mail...)
-
!Engines
}

DocumentSelection{
&Copy Text\tCtrl+C=ID_EDIT_COPY
Select &All\tCtrl+A=ID_EDIT_SELECT_ALL
%ifplugin macros
confused smileyelected Te&xt
%endif
}

LinkSelection{
Copy Link &URL=ID_COPY_LINK_LOCATION
!DocumentSelection
}

# ----- Document Elements

Link{
%ifplugin layers
layers(OpenLink,Open In Ne&w Layer)
layers(OpenLinkBg,Open In Bac&kground Layer)
-
%endif
Open In &New Window=ID_OPEN_LINK_IN_NEW_WINDOW
Open In Back&ground Window=ID_OPEN_LINK_IN_BACKGROUND
-
bookmarks(AddLink,Add Link To &Bookmarks)
favorites(AddLink,Add Link To Fa&vorites)
hotlist(AddLink,Add Link To H&otlist)
&Save Link Target As...=ID_SAVE_LINK_AS
%ifplugin macros
:Op&en Link Target With
%endif
-
!LinkSelection
-
macros(LinkInfo,Link &Properties)
}

&Frame{
macros(ReloadFrame,&Reload)
Show &Only This Frame=ID_OPEN_FRAME
-
%ifplugin layers
macros(FrameInLayer,Open In Ne&w Layer)
%endif
Open In &New Window=ID_OPEN_FRAME_IN_NEW_WINDOW
macros(FrameInBack,Open In &Background)
-
&Save Frame As...=ID_FILE_SAVE_FRAME_AS
macros(EmailFrameURL,Sen&d Frame As Link...)
-
:Frame &Properties
}

I&mage{
macros(ReloadImage, Reload Image)
&View Image=ID_VIEW_IMAGE
macros(ZoomInImage,Zoom I&n)
macros(ZoomOutImage,Zoom Ou&t)
-
&Save Image As...=ID_SAVE_IMAGE_AS
macros(EmailImageURL,Sen&d Image As Link...)
-
C&opy Image=ID_COPY_IMAGE_CONTENT
&Copy Image URL=ID_COPY_IMAGE_LOCATION
%ifplugin macros
-
macros(ImageInfo,Image &Properties)
macros(ImageCache,Cache &Information)
%endif
}

# ----- Documents

Document{
!Nav
-
bookmarks(Add,Add Page To &Bookmarks\tCtrl+D)
favorites(Add,Add Page To Fa&vorites)
hotlist(Add,Add Page To H&otlist)
&Save Page As...\tCtrl+S=ID_FILE_SAVE_AS
macros(EmailURL,Sen&d Page As Link...)
%ifplugin macros
:Op&en Page With
%endif
-
!DocumentSelection
-
}

DocumentPopup{
!Document
tongue sticking out smileyage &Properties
!Fullscreen
bmpmenu()
}
DocumentImagePopup{
!Document
tongue sticking out smileyage Pro&perties
!Fullscreen
bmpmenu()
}

FrameDocumentPopup{
!Document
tongue sticking out smileyage &Properties
:&Frame
!Fullscreen
bmpmenu()
}
FrameDocumentImagePopup{
!Document
tongue sticking out smileyage Pro&perties
:&Frame
!Fullscreen
bmpmenu()
}

# ----- Links

LinkPopup{
!Link
bmpmenu()
}
ImageLinkPopup{
!Link
:I&mage
bmpmenu()
}
FrameLinkPopup{
!Link
:&Frame
bmpmenu()
}
FrameImageLinkPopup{
!Link
:I&mage
:&Frame
bmpmenu()
}

# ----- Images

ImagePopup{
!I&mage
bmpmenu()
}
FrameImagePopup{
!I&mage
-
:&Frame
bmpmenu()
}

# ----- Text

TextPopup{
&Undo\tCtrl+Z=ID_EDIT_UNDO
-
!Edit
-
confused smileyelected Te&xt
bmpmenu()
}
FrameTextPopup{
&Undo\tCtrl+Z=ID_EDIT_UNDO
-
!Edit
-
confused smileyelected Te&xt
:&Frame
bmpmenu()
}

Yours: Rapido

Options: ReplyQuote
Re: Problem to add searchbar and searchmacros
Posted by: kko
Date: June 26, 2007 11:32AM

The search engine configuration in km 1.1 is easier then ever. You neither need search9.kmm nor any old fashioned macros and menus to add your own search engines.

In the km 1.1 default configuration, simply go to Tools > Web Search > Configure...

On the tab "Web Search" you will find a number of drop-down lists. Each drop-down list is representing an entry in the "Web Search" menu. The selected engine is the engine displayed in the menu. To remove a menu entry, remove the related drop-down list by selecting "Remove this entry" from that drop-down list. To add a new menu entry, add a new drop-down list by clicking the button "Add Entry" at the bottom of the page and select the desired engine. You can add as many engines to the "Web Search" menu as you like. Changes take effect immediately, you don't need to restart km.

The list of engines that is displayed in all these drop-down lists can be edited in the tab "Search Engines". To remove or to edit an engine, you have to select it first. Half of your engines is anyway on the km 1.1 default list. Simply add those you're missing. The list is stored in the file search.xml located in your profile directory. You can easily copy this file to other profiles (just like bookmarks.html).

Options: ReplyQuote
Re: Problem to add searchbar and searchmacros
Posted by: Rapido
Date: June 26, 2007 01:16PM

Yes I know that but I have a searchbar that gives me access to 21 searchengines and it is easier to just click on the searchbar instead. But when I add this bar the drop-down list and the already activated engines dissapears so it must be something wrong with my macro and menufiles.

Yours: Rapido

Options: ReplyQuote
Re: Problem to add searchbar and searchmacros
Posted by: kko
Date: June 26, 2007 03:30PM

Rapido, what searchbar are you talking about? Do you mean a custom toolbar (defined in toolbars.cfg) to make search engines accessible?

Options: ReplyQuote
Re: Problem to add searchbar and searchmacros
Posted by: Rapido
Date: June 26, 2007 10:20PM

Yes that is just what I mean. You could do such a thing in earlier versions before Km1.1 but now it's been more difficult to make this working.

Yours: Rapido

Options: ReplyQuote
Re: Problem to add searchbar and searchmacros
Posted by: kko
Date: June 27, 2007 05:42PM

OK, then.

1) Theoretically, it's possible to write a macro module which creates a toolbar that contains the same (configurable) search engines as the Web Search menu. I've tried it and had partly success. Practically, there are some limitations and bugs (I've experienced crashes) which make this way no go for now.

2) The only practicable way, I see for now, is using search9.kmm. Simply migrate your search macros from your old macros.cfg to search9.kmm. That works - I've tried it with your macros. Simply follow the comments and examples. To get your search bar, you also have to copy its definition from your old toolbars.cfg into the new. That's all. (You don't need to edit menus.cfg)

2a) When you want your search macros only in the toolbar, but not in the menu, then simply copy your search macros from macros.cfg to search9.kmm (replacing the examples in the first section) and empty the macros EngineSync and EngineMenu:

EngineSync{
}
EngineMenu{
}

2b) When you want your search macros also in the menu, then you have to replace the macro EngineSync in search9.kmm with the one from your macros.cfg and in the macro EngineMenu you have to add a line for each of your macros (simply follow the comments and examples). Check your EngineSync macro in this case!

A search macro looks like this:

macroName{
&OldSearch; $search = "engineName";
$eng = "<--URL-->";
&SetSearch;
}

The related line in EngineSync must look like this:

setcheck("macros(macroName)", getpref(STRING, $sen) == "engineName" ? true:false);

engineName must be the same in macro macroName and in macro EngineSync! You are partly using different strings - that can't work.

Same can be said for the lines you have to add in macro EngineMenu:

setmenu(_Search9,macro,"engineName","macroName");

Options: ReplyQuote
Re: Problem to add searchbar and searchmacros
Posted by: Rapido
Date: June 27, 2007 09:31PM

Hi! kko write a complete exampel here so I can see how it should look like to make it easier for me please..

Yours: Rapido

Options: ReplyQuote
Re: Problem to add searchbar and searchmacros
Posted by: kko
Date: June 28, 2007 05:09AM

My dear! What the hell is the problem? It's just copy and paste!

search9.kmm:
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# ---------- Custom Search Engine Macros (K-Meleon 0.9 Style) ------------------------------------------------------
#
# Dependencies	: search.kmm
# Resources	: -
# Preferences	: -
#
# ------------------------------------------------------------------------------------------------------------------

# Here in this section you can insert your custom search engine macros. Numerous macros can be
# found in the K-Meleon Wiki (http://kmeleon.sourceforge.net/wiki/index.php?id=Search+Engines)

Google{
&OldSearch; $search = "Google";
$eng = "http://www.google.com/search?q=";;
&SetSearch;
}
Icerocket{
&OldSearch; $search = "Icerocket";
$eng = "http://www.icerocket.com/search?tab=web&q=";;
&SetSearch;
}
Kartoo{
&OldSearch; $search = "Kartoo";
$eng = "http://www.kartoo.com/en/servlet/H?q=";;
&SetSearch;
}
AltaVista{
&OldSearch; $search = "AltaVista";
$eng = "http://www.altavista.com/web/results?itag=wrx&q=";;
&SetSearch;
}
Hotbot{
&OldSearch; $search = "Hotbot";
$eng = "http://search.hotbot.co.uk/cgi-bin/pursuit?query=";;
&SetSearch;
}
IMDB{
&OldSearch; $search = "Internet Movie Database";
$eng = "http://www.imdb.com/find?";;
&SetSearch;
}
Findtarget{
&OldSearch; $search = "Findtarget";
$eng = "http://search.findtarget.com/search.php?q=";;
&SetSearch;
}
JoyScape{
&OldSearch; $search = "JoyScape";
$eng = "http://www.joyscape.com/search/s?q=";;
&SetSearch;
}
Clusty{
&OldSearch; $search = "Clusty";
$eng = "http://clusty.com/search?query=";;
&SetSearch;
}
Astalavista{
&OldSearch; $search = "Astalavista";
$eng = "http://www.astalavista.us/search.php?s=";;
&SetSearch;
}
MSCracks{
&OldSearch; $search = "MSCracks";
$eng = "http://mscracks.com/search.php?q=";;
&SetSearch;
}
Mamma{
&OldSearch; $search = "Mamma";
$eng = "http://www.mamma.com/Mamma?query=";;
&SetSearch;
}
IPDB{
&OldSearch; $search = "Internet Pinball Database";
$eng = "http://www.ipdb.org/search.pl?any=";;
&SetSearch;
}
ClustyImages{
&OldSearch; $search = "Clusty Images";
$eng = "http://clusty.com/search?v%3aproject=clusty-images&query=";;
&SetSearch;
}
FindtargetImages{
&OldSearch; $search = "Findtarget Images";
$eng = "http://search.findtarget.com/imagesearch.php?q=";;
&SetSearch;
}
IcerocketImages {
&OldSearch; $search = "Icerocket Images";
$eng = "http://www.icerocket.com/search?tab=image&q=";;
&SetSearch;
}
IxquickImages{
&OldSearch; $search = "Ixquick Images";
$eng = "http://eu.ixquick.com/do/metasearch.pl?cat=pics&cmd =process_search&language=english&ff=&query=";
&SetSearch;
}
JoyScapeImages{
&OldSearch; $search = "JoyScape Images";
$eng = "http://www.joyscape.com/search/s?t=images&tmplt=msearch.htm&gbs=no&q=";;
&SetSearch;
}
MondoMolePics{
&OldSearch; $search = "MondoMole Images";
$eng = "http://www.mondomole.com/search?&NextEntry=0&Search=Search&FF=1&QueryStr=";;
&SetSearch;
}
GoogleImages{
&OldSearch; $search = "Google Images";
$eng = "http://images.google.com/images?btnG=Google+Search&safe=off&filter=0&q=";;
&SetSearch;
}
YahooImages{
&OldSearch; $search = "Yahoo Images";
$eng = "http://images.search.yahoo.com/search/images?p=";;
&SetSearch;
}


# ------------------------------------------------------------------------------------------------------------------

EngineSync{
# Here in this macro you have to insert a line of code for each macro in the section
# above, as shown below or as described in the K-Meleon Wiki.

setcheck("macros(Google)", getpref(STRING, $sen) == "Google" ? true:false);
setcheck("macros(Icerocket)", getpref(STRING, $sen) == "Icerocket" ? true:false);
setcheck("macros(Kartoo)", getpref(STRING, $sen) == "Kartoo" ? true:false);
setcheck("macros(AltaVista)", getpref(STRING, $sen) == "AltaVista" ? true:false);
setcheck("macros(Hotbot)", getpref(STRING, $sen) == "Hotbot" ? true:false);
setcheck("macros(IMDcool smiley", getpref(STRING, $sen) == "Internet Movie Database" ? true:false);
setcheck("macros(Findtarget)", getpref(STRING, $sen) == "Findtarget" ? true:false);
setcheck("macros(JoyScape)", getpref(STRING, $sen) == "JoyScape" ? true:false);
setcheck("macros(Clusty)", getpref(STRING, $sen) == "Clusty" ? true:false);
setcheck("macros(Astalavista)", getpref(STRING, $sen) == "Astalavista" ? true:false);
setcheck("macros(MSCracks)", getpref(STRING, $sen) == "MSCracks" ? true:false);
setcheck("macros(Mamma)", getpref(STRING, $sen) == "Mamma" ? true:false);
setcheck("macros(IPDcool smiley", getpref(STRING, $sen) == "Internet Pinball Database" ? true:false);
setcheck("macros(ClustyImages)", getpref(STRING, $sen) == "Clusty Images" ? true:false);
setcheck("macros(FindtargetImages)", getpref(STRING, $sen) == "Findtarget Images" ? true:false);
setcheck("macros(IcerocketImages)", getpref(STRING, $sen) == "Icerocket Images" ? true:false);
setcheck("macros(IxquickImages)", getpref(STRING, $sen) == "Ixquick Images" ? true:false);
setcheck("macros(JoyScapeImages)", getpref(STRING, $sen) == "JoyScape Images" ? true:false);
setcheck("macros(MondoMolePics)", getpref(STRING, $sen) == "MondoMole Images" ? true:false);
setcheck("macros(GoogleImages)", getpref(STRING, $sen) == "Google Images" ? true:false);
setcheck("macros(YahooImages)", getpref(STRING, $sen) == "Yahoo Images" ? true:false);
}

EngineMenu{
# Here in this macro you have to insert a line of code for each macro in the section
# above, as shown below.
#
# Syntax: setmenu(_Search9,macro,"<Your macro's menu label>","<Your macro's name>");

setmenu(_Search9,macro,"Google","Google");
setmenu(_Search9,macro,"Icerocket","Icerocket");
setmenu(_Search9,macro,"Kartoo","Kartoo");
setmenu(_Search9,macro,"AltaVista","AltaVista");
setmenu(_Search9,macro,"Hotbot","Hotbot");
setmenu(_Search9,macro,"Internet Movie Database","IMDB");
setmenu(_Search9,macro,"Findtarget","Findtarget");
setmenu(_Search9,macro,"JoyScape","JoyScape");
setmenu(_Search9,macro,"Clusty","Clusty");
setmenu(_Search9,macro,"Astalavista","Astalavista");
setmenu(_Search9,macro,"MSCracks","MSCracks");
setmenu(_Search9,macro,"Mamma","Mamma");
setmenu(_Search9,macro,"Internet Pinball Database ","IPDB");
setmenu(_Search9,macro,"Clusty Images","ClustyImages");
setmenu(_Search9,macro,"Findtarget Images","FindtargetImages");
setmenu(_Search9,macro,"Icerocket Images","IcerocketImages");
setmenu(_Search9,macro,"Ixquick Images","IxquickImages");
setmenu(_Search9,macro,"JoyScape Images","JoyScapeImages");
setmenu(_Search9,macro,"MondoMole Images","MondoMolePics");
setmenu(_Search9,macro,"Google Images","GoogleImages");
setmenu(_Search9,macro,"Yahoo Images","YahooImages");
}

# ---------- DO NOT EDIT ANYTHING BELOW THIS LINE ------------------------------------------------------------------

Locked{
getpref(BOOL,$_Search_pref_Locked)==true?&SetSearch:macros("Search_ToggleEngineLock;SetSearch;Search_ToggleEngineLock");
}
OldSearch{
}
SetSearch{
$_Search_EngineURL=$eng; $_Search_EngineName=$search; &_Search_Init;
}
$sen="";

_Search9_BuildMenu{
setmenu(_Search_Engines,inline,_Search9);
&EngineMenu;
}
_Search9_OnInit{
index($macroModules,";Search;")>-1?&_Search9_BuildMenu:0;
}
$OnInit=$OnInit."_Search9_OnInit;";

_Search9_Init{
$sen=$_Search_pref_DefaultName;
&EngineSync;
# hook into search.kmm's menu sync
$_Search_SyncMenu=$_Search_SyncMenu."EngineSync;";
}
_Search9_OnStartup{
index($macroModules,";Search;")>-1?&_Search9_Init:0;
}
$OnStartup=$OnStartup."_Search9_OnStartup;";

# ------------------------------------------------------------------------------------------------------------------
$macroModules=$macroModules."Search9;";


Options: ReplyQuote
Re: Problem to add searchbar and searchmacros
Posted by: Rapido
Date: June 28, 2007 11:24AM

Thanks kko for all your help. It now works just fine kko.

Yours: Rapido

Options: ReplyQuote
xtrvem gtyw
Posted by: sdavmrfc akrpo
Date: August 26, 2008 07:40AM

qrnzsy eowaqmkb nhvtfslur funysz hdwvpjr jiekglqho eqif

Options: ReplyQuote


K-Meleon forum is powered by Phorum.