Extensions :  K-Meleon Forum
All about K-Meleon extensions. 
auto agentswitch (revision)
Posted by: disrupted
Date: July 08, 2009 11:58PM

supplement macro has been combined with main macro. main macro revision so restart no longer required to toggle agent switcher off and on.. changes take effect instantly which is much more practical when you want to test a useragent string on a website and when autoswitcher is on; will always revert to default or change to firefox if a badsite is detected unless you restart.. this is nolonger required as toggle off will immediately stop auto agent switcher. the new macro is set to off on first run, to turn it on; just go tools>useragent> and select autoswitcher. this macro is best used with 'auto-reset' on

if you have downloaded auto agent switcher before..please delete the 2 old macros from kmeleon macros folder:
1. agentswitcher.kmm
2. agentswitcher-sup.kmm

download new macro and extract 7z extension in kmeleon's folder:
http://kmext.sourceforge.net/macros/agentswitcherplus.7z
badlist.txt is included with klm domains added


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

# ----------auto agent switcher----------------------------

$_badlist=getfolder(RootFolder)."\\macros\\badlist.txt";


tog_autoswitch{
menuchecked=getpref(BOOL,"kmeleon.agentswitcher.active");
togglepref(BOOL,"kmeleon.agentswitcher.active");
statusbar("Toggles auto-agentswitcher");
}

editbad{
setclipboard("");
$HOST=hostname( $URL );
$badstring=(";".$HOST);
setclipboard($badstring);
exec("notepad.exe " .$_badlist);
statusbar("edit badlists, for convenience current page host has been copied to clipboard with semicolon prefix");
}

addbadsite{
menugrayed=(hostname($URL)=="");
$HOST=hostname( $URL );
$badstring=(";".$HOST);
pluginmsg(utils, "append", $_badlist, $badstring);
$pendmess=("Fireslut useragent will now be used for this address: ".$HOST);
alert($pendmess,"Website added to badlist" ,INFO);
}

_autoswitchagent_BuildMenu{
setmenu("&User Agent",inline,auto_agentswitch,-1);
setmenu(auto_agentswitch,macro,"Auto Switcher",tog_autoswitch);
setmenu(auto_agentswitch,macro,"Add Website",addbadsite);
setmenu(auto_agentswitch,macro,"Edit Switchlist",editbad);
}

defaultagent{
getpref(BOOL,$_UserAgent_Reset)?delpref($_UserAgent_Active):0;
}

switcher{
$fireslut=getpref(STRING, "kmeleon.privacy.useragent1.string");
$switcher=setpref(STRING, "general.useragent.override", $fireslut);
}

checkswitchactive{
$switchactive=getpref(BOOL,"kmeleon.agentswitcher.active");
$isactive=("true");
$switchactive==$isactive?&badchecker:0;
}

badchecker{
$badcheck=readfile($_badlist);
$checkh=hostname( $URL );
$find1=gsub($checkh, "crappysite", $badcheck);
$find2=gsub("crappysite", "crapcrap", $find1);
$find1==$find2?&defaultagent:&switcher;
#prompt($find1, "tester" , $find2 );
}

$OnLoad=$OnLoad."checkswitchactive;";
$OnInit=$OnInit."_autoswitchagent_BuildMenu;";
# --------------------------------------------------------------------
$macroModules=$macroModules."agentswitch;";


Options: ReplyQuote
Re: auto agentswitch (revision)
Posted by: disrupted
Date: July 10, 2009 01:40AM

slight update: now displays proper switcher status in statusbar instead of just (toggles auto agent switcher) download from same link

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

# ----------auto agent switcher----------------------------

$_badlist=getfolder(RootFolder)."\\macros\\badlist.txt";


tog_autoswitch{
menuchecked=getpref(BOOL,"kmeleon.agentswitcher.active");
togglepref(BOOL,"kmeleon.agentswitcher.active");
$switchactive=getpref(BOOL,"kmeleon.agentswitcher.active");
$noactive=("false");
$switchactive==$noactive?&statusfalse:&statustrue;
}

statusfalse{
statusbar("auto-agentswitcher inactive");
}

statustrue{
statusbar("auto-agentswitcher active");
}

editbad{
setclipboard("");
$HOST=hostname( $URL );
$badstring=(";".$HOST);
setclipboard($badstring);
exec("notepad.exe " .$_badlist);
statusbar("edit badlists, for convenience current page host has been copied to clipboard with semicolon prefix");
}

addbadsite{
menugrayed=(hostname($URL)=="");
$HOST=hostname( $URL );
$badstring=(";".$HOST);
pluginmsg(utils, "append", $_badlist, $badstring);
$pendmess=("Fireslut useragent will now be used for this address: ".$HOST);
alert($pendmess,"Website added to badlist" ,INFO);
}

_autoswitchagent_BuildMenu{
setmenu("&User Agent",inline,auto_agentswitch,-1);
setmenu(auto_agentswitch,macro,"Auto Switcher",tog_autoswitch);
setmenu(auto_agentswitch,macro,"Add Website",addbadsite);
setmenu(auto_agentswitch,macro,"Edit Switchlist",editbad);
}

defaultagent{
getpref(BOOL,$_UserAgent_Reset)?delpref($_UserAgent_Active):0;
}

switcher{
$fireslut=getpref(STRING, "kmeleon.privacy.useragent1.string");
$switcher=setpref(STRING, "general.useragent.override", $fireslut);
}

checkswitchactive{
$switchactive=getpref(BOOL,"kmeleon.agentswitcher.active");
$isactive=("true");
$switchactive==$isactive?&badchecker:0;
}

badchecker{
$badcheck=readfile($_badlist);
$checkh=hostname( $URL );
$find1=gsub($checkh, "crappysite", $badcheck);
$find2=gsub("crappysite", "crapcrap", $find1);
$find1==$find2?&defaultagent:&switcher;
#prompt($find1, "tester" , $find2 );
}

$OnLoad=$OnLoad."checkswitchactive;";
$OnInit=$OnInit."_autoswitchagent_BuildMenu;";
# --------------------------------------------------------------------
$macroModules=$macroModules."agentswitch;";


Options: ReplyQuote
Re: auto agentswitch (revision)
Posted by: disrupted
Date: September 21, 2009 03:43AM

update: now will not allow adding of sites already included in the badlist.. download from same link.. badlist update, lite.facebook.com added to crappy sites
http://kmext.sourceforge.net/macros/agentswitcherplus.7z



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

# ----------auto agent switcher----------------------------

$_badlist=getfolder(RootFolder)."\\macros\\badlist.txt";


tog_autoswitch{
menuchecked=getpref(BOOL,"kmeleon.agentswitcher.active");
togglepref(BOOL,"kmeleon.agentswitcher.active");
$switchactive=getpref(BOOL,"kmeleon.agentswitcher.active");
$noactive=("false");
$switchactive==$noactive?&statusfalse:&statustrue;
}

statusfalse{
statusbar("auto-agentswitcher inactive");
}

statustrue{
statusbar("auto-agentswitcher active");
}

editbad{
setclipboard("");
$HOST=hostname( $URL );
$badstring=(";".$HOST);
setclipboard($badstring);
exec("notepad.exe " .$_badlist);
statusbar("edit badlists, for convenience current page host has been copied to clipboard with semicolon prefix");
}

addbadsite{
menugrayed=(hostname($URL)=="");
$HOST=hostname( $URL );
$badstring=(";".$HOST);
$badcheck=readfile($_badlist);
$checkh=hostname( $URL );
$find1=gsub($checkh, "crappysite", $badcheck);
$find2=gsub("crappysite", "crapcrap", $find1);
$find1==$find2?&addcrap:&noaddcrap;
}

addcrap{
pluginmsg(utils, "append", $_badlist, $badstring);
$pendmess=("Fireslut useragent will now be used for this address: ".$HOST);
alert($pendmess,"Website added to badlist" ,INFO);
statusbar($pendmess);
}

noaddcrap{
$pendmess=($HOST." is already included in the badlist. ");
alert($pendmess,"Website already added" ,INFO);
statusbar($pendmess);
}

_autoswitchagent_BuildMenu{
setmenu("&User Agent",inline,auto_agentswitch,-1);
setmenu(auto_agentswitch,macro,"Auto Switcher",tog_autoswitch);
setmenu(auto_agentswitch,macro,"Add Website",addbadsite);
setmenu(auto_agentswitch,macro,"Edit Switchlist",editbad);
}

defaultagent{
getpref(BOOL,$_UserAgent_Reset)?delpref($_UserAgent_Active):0;
}

switcher{
$fireslut=getpref(STRING, "kmeleon.privacy.useragent1.string");
$switcher=setpref(STRING, "general.useragent.override", $fireslut);
}

checkswitchactive{
$switchactive=getpref(BOOL,"kmeleon.agentswitcher.active");
$isactive=("true");
$switchactive==$isactive?&badchecker:0;
}

badchecker{
$badcheck=readfile($_badlist);
$checkh=hostname( $URL );
$find1=gsub($checkh, "crappysite", $badcheck);
$find2=gsub("crappysite", "crapcrap", $find1);
$find1==$find2?&defaultagent:&switcher;
#prompt($find1, "tester" , $find2 );
}

$OnLoad=$OnLoad."checkswitchactive;";
$OnInit=$OnInit."_autoswitchagent_BuildMenu;";
# --------------------------------------------------------------------
$macroModules=$macroModules."agentswitch;";


Options: ReplyQuote


K-Meleon forum is powered by Phorum.