# The K-Meleon Files: macros.cfg, menus.cfg, User.js, userContent.css
#
# Macro Definition File for K-Meleon
#
# Jeff Doozan 
#
# Profile for Trenton  November 10, 2003
#
# BOOGOMATIC MACROS

#OnOpenWindow {
#    id(ID_VIEW_STATUS_BAR);
#}

go_online {
    menu = "Online with &3Web\tCtrl+Alt+3";
    exec("C:\\Program Files\\3web\\3web.exe");
}


email_text{
    menu = "&Email Selected Text";
    open("javascript:{var subject=document.title;var body=escape(document.getSelection());self.location=\'mailto:?subject=\'+subject+\'&body=\'+body;}");
}

email_link {
    menu = "&Email this Link";
    open("mailto:?body=" . "Check this site out: " . $LinkURL . "?subject=" . "Here is a link for you");
}

email_page_link {
    menu = "Email &Link to Page";
    open("mailto:?body=" . "Check this site out: " . $URL . "?subject=" . $TITLE );
}

view_clipboard {
    menu = "View &Clipboard";
    exec("C:\\WINDOWS\\CLIPBRD.EXE");
}

paste_notepad {
    menu = "&Paste Text to NotePad";
    id(ID_EDIT_COPY);
    exec("C:\\Program Files\\Arachnophilia\\arach.exe");
}

WinAmp {
    menu = "Open &WinAmp"
    exec("C:\\Program Files\\Winamp\\winamp.exe");
}


textlink{
    menu = "Link Selected &Text";
    $textlink = getclipboard();
    id(ID_EDIT_COPY);
    pluginmsg(layers,"OpenURL","".getclipboard()."");
    setclipboard($textlink);
}

aboutBlank {
    menu = "About &Blank";
    open(about:blank);
}

aboutCache {
    menu = "About &Cache";
    open(about:cache);
}

JSconsole {
    menu = "Open &Javascript Console";
    open(javascript:);
}

aboutMoz {
    menu = "About &Mozilla";
    open(about:mozilla);
    statusbar("See information about Mozilla");
}

aboutKM {
    menu = "About &K-Meleon";
    open(about:);
    statusbar("See information about K-Meleon");
}
config {
    menu = "About Configuratio&n";
    open(about:config);
    statusbar("See information about configuration preferences");
}

view_address {
    menu = "View Link's &URL";
    $ladr = $LinkURL;
    $ladr = prompt("This is the URL of the current link. Do you want to go to this site?", "THE URL OF CURRENT LINK", $ladr);
    $ladr == "" ? "" : pluginmsg(layers,"OpenURL", $ladr);
}

to_address {
    menu = "Enter &URL address";
    $adr = prompt("Enter the URL of the page you wish to view.", "- ENTER THE ADDRESS - eg. http://www.boogomatic.com", "");
    $adr == "" ? "" : open($adr);
}

Search_word {
    menu = "Search Selected &Word";
    $tmp = getclipboard();
    id(ID_EDIT_COPY);
    pluginmsg(layers,"OpenURL","http://www.google.com/search?ie=UTF- 8&oe=UTF-8&num=50&q=" . getclipboard());
    setclipboard($tmp);
}

arach {
    menu = "&Arachnophilia\tALT+A";
    exec("C:\\Program Files\\Arachnophilia\\arach.exe");
}

aol_messenger {
    menu = "&AIM Instant Messenger";
    exec("C:\\Program Files\\instant messenger\\aim.exe");
}

Define{
    menu = "De&fine Selected Word";
    $tmp = getclipboard();
    id(ID_EDIT_COPY);
    pluginmsg(layers,"OpenURL","http://www.dictionary.com/search?q=" . getclipboard());
    setclipboard($tmp);
}

layers_catch {
    menu = "Catch New &Windows";
    $acro = getpref(BOOL, "kmeleon.plugins.layers.catch");
    $acro = prompt("Type new value: false = disable; true = enable", "Layers catch new windows", $acro);
    setpref(BOOL, "kmeleon.plugins.layers.catch", $acro);
}

Calypso {
    statusbar( Opening the Calypso email program );
    menu = "&Read Email\tALT+R";
    exec("C:\\Program Files\\Calypso3\\Calypso.exe" . " /DEFAULT");
}

irfan {
    menu = "&Irfan View\tALT+I";
    exec("C:\\Program Files\\IrfanView\\i_view32.exe");
}

strokeit {
    menu = "Mouse &Gestures";
    exec("C:\\Program Files\\Strokeit\\strokeit.exe");
}

close_layer {
    plugin(layers, "Close");
}

open_layer {
    plugin(layers, "Open");
}

EditPad {
    menu = "Edit &Pad\tALT+P";
    exec("C:\\windows\\notepad.exe");
}

sendMail {
    menu = "Send E&mail\tALT+M";
    exec("C:\\Program Files\\Calypso3\\Calypso.exe" . " /DEFAULT" . " /MAILTO name@domain.com");
}
#    open("mailto:@.<*>");

plugins {
    menu = "About &Plugins";
    open(about:plugins);
    statusbar("See information about the installed plugins");
}

#-------- Disable Style Sheets Macro --------
Disable_Style {
menu="Disable Style Sheets";
open("javascript:(function(){var i,x;for(i=0;x=document.styleSheets[i];++i)x.disabled=true;})();");
}
Enable_Style {
menu="Enable Style Sheets";
open("javascript:(function(){var i,x;for(i=0;x=document.styleSheets[i];++i)x.disabled=false;})();");
}
#--------end

#--------Search K-Meleon Forums--------
$forums = "http://kmeleon.sourceforge.net/forum/search.php?f=3&globalsearch=1&match=1&date=180&fldsubject=1&fldbody=1&search=";
forums {
   menu = "Search &K-Meleon Forums"
   $word = prompt("Enter Search Query:", "Search K-Meleon Forums");
   $word == "" ? "" : open( $forums . $word );
}
#--------end

#--------Source Code in PopUp - Show source as in IE----------
#--------- Mirek Koárek - 09-04-2003----------

source_popup {
	menu="Page &Source";
	open(" javascript:(function(){var windowprops = '';var sourcewin = window.open('','source',windowprops);sourcewin.document.open();sourcewin.location.href = 'view-source:'+ parent.document.location.href;sourcewin.document.close();})(); ");
}
#--------end

# URL BAR MACROS

up_directory {
    menu = "Up to &Parent Directory";
    $var = dirname($URL); 
    $var == "." ? "" : open($var);
}

ctrl_enter{
$oldclip = getclipboard();
id(ID_SELECT_URL);
id(ID_EDIT_COPY);
$prefix = "http://www.";
$theurl = getclipboard();
$suffix = ".com";
setclipboard($oldclip);
open($prefix . $theurl . $suffix);
}


# BOOKMARK MACROS

FileBook{
plugin(bookmarks, Add);
plugin(bookmarks, Edit);
}
FileFav{
plugin(favorites, Add);
plugin(favorites, Edit);
}
FileHot{
plugin(hotlist, Add);
plugin(hotlist, Edit);
}


# SEARCH MACROS

$search = "http://www.google.com/search?ie=UTF-8&oe=UTF-8&num=50&q="
#$search = "http://search.yahoo.com/bin/search?p=";

# $dictionary = "http://dict.org/bin/Dict?Form=Dict2&Database=*&Query=";
# $dictionary = "http://www.m-w.com/cgi-bin/dictionary?";
$dictionary = "http://www.dictionary.com/search?q=";
# $dictionary = "http://www.wikipedia.org/w/wiki.phtml?search=";
# Century dictionary
# $dictionary = "http://216.156.253.178/cgi-bin/nph-chw?type=dict1&query=";

search_dictionary {
    menu = "Input &Dictionary Search";
    $word = prompt("Enter search query:", "Dictionary Search");
    $word == "" ? "" : open( $dictionary . $word );
}

WebSearch{
$tmp = getclipboard();
id(ID_EDIT_COPY);
opennew($search . getclipboard());
setclipboard($tmp);
}

Dictionary{
$tmp = getclipboard();
id(ID_EDIT_COPY);
opennew($dictionary . getclipboard());
setclipboard($tmp);
}

Hyperlink{
$tmp = getclipboard();
id(ID_EDIT_COPY);
opennew(getclipboard());
setclipboard($tmp);
}


#TOGGLE BUTTON MACROS

$popups = "dom.disable_open_during_load"
$jscript = "javascript.enabled"
$java = "security.enable_java"
$images = "network.image.imageBehavior"
$cookies = "network.cookie.cookieBehavior"

buttonSync{
getpref(BOOL, $popups) ? pluginmsg(toolbars, "CheckButton", "Tool Bar, macros(PBToggle), 1") : pluginmsg(toolbars, "CheckButton", "Tool Bar, macros(PBToggle), 0");
#getpref(INT, $images) ? pluginmsg(toolbars, "CheckButton", "Tool Bar, macros(ImgToggle), 1") : pluginmsg(toolbars, "CheckButton", "Tool Bar, macros(ImgToggle), 0");
}
 
PBToggle{
$tmp = (getpref(BOOL, $popups) ? false : true);
setpref(BOOL, $popups, $tmp);
statusbar("Popups " . ($tmp ? "BLOCKED" : "ALLOWED"));
&buttonSync;
}

ImgToggle {
$tmp = (getpref(INT, $images) ? 0 : 2);
setpref(INT, $images, $tmp);
statusbar("Images " . ($tmp ? "BLOCKED" : "ALLOWED"));
&buttonSync;
}

OnLoad{
&buttonSync;
}


# IMAGE MACROS

ImageInfo {
open(" javascript:function XyZ(){if(document.images.length>0){var i;for(i=0;i -1){alert(\"*I M A G E   P R O P E R T I E S*\\r\\n\\r\\nWIDTH: \" + document.images[ i ].width + \"\\r\\nHEIGHT: \" + document.images[ i ].height + \"\\r\\nALT: \" + document.images[ i ].alt  + \"\\r\\nURL: \" + document.images[ i ].src);}}}}void(XyZ()); ");
}

ImageCache{
$i = index($ImageURL, "#");
$addr = $i==-1 ? $ImageURL : substr($ImageURL, 0, $i);
$client = index($addr, "https://")==0 ? "HTTP-memory-only" : "HTTP";
$var = "about:cache-entry?client=" . $client . "&sb=1&key=" . $addr;
index($addr, "http")==0 ? opennew($var) : "";
}

ZoomIn {
$loc = $IMAGEURL;
open("javascript:(function(){ function zoomImage(image, amt) { if(image.initialHeight == null) { /* avoid losing height information due to integer rounding while zooming out */ image.initialHeight = image.height; image.initialWidth = image.width; image.scalingFactor = 1; } image.scalingFactor *= amt; image.width = image.scalingFactor * image.initialWidth; image.height = image.scalingFactor * image.initialHeight; } for (i=0; i -1) zoomImage(document.images[ i ], 2); } )();");
}

ZoomOut {
$loc = $IMAGEURL;
open("javascript:(function(){ function zoomImage(image, amt) { if(image.initialHeight == null) { /* avoid losing height information due to integer rounding while zooming out */ image.initialHeight = image.height; image.initialWidth = image.width; image.scalingFactor = 1; } image.scalingFactor *= amt; image.width = image.scalingFactor * image.initialWidth; image.height = image.scalingFactor * image.initialHeight; } for (i=0; i -1)zoomImage(document.images[i], .5); })();");
}

LinkInfo {
    alert($LinkURL, "URL OF SELECTED LINK:",INFO);
}

detach{
	$oldclip = getclipboard();
	id(ID_SELECT_URL);
	id(ID_EDIT_COPY);
	plugin(layers,Close);
	opennew(getclipboard());
	setclipboard($oldclip);
}