Want autofill, inline dictionary lookup or highlighting? A few new macros...
OK I recently tried K-Meleon again and found it had improved greatly so I started customising it. Assign these macros buttons on your toolbar and K-Meleon gets a lot more powerful.
Autofill
autofill {
#Cool javascript code by efritz.net.
#Macro conversion by Neil Jenkins.
#Fill in the following variables with your details.
#Made up variables included to give examples of values and in case you want to use it as an anonymous autofiller:
$gender="male";
$birthmonth="january";
$birthday="1";
$birthyear="1950";
$country="united kingdom";
$country_code="uk";
$email="john@nospam.com";
$surname="Smith";
$forename="John";
$city="London";
$prefix="Mr.";
$postcode="L1 ABC";
$addressline1="3 My Street";
$addressline2="Green Gables";
$age="101";
$middle_initial="A";
$area_phone_code="020";
$phone="123 4567";
$phone_extension="";
$fax="";
$fax_area_code="";
$company="";
#Cool javascript code to do all the work :-)
$acode1="javascript:function q(Dname){c=false;for(r=1;r<q.arguments.length;r++){if(Dname.toUpperCase().indexOf(q.arguments[r].toUpperCase())!=-1){c=true}}return c;}function p(){var jkl=0;var fx=0;var phone=0;var fx=0;var xy=0;var i=0,abc='',j,A='anonymous',D,E,F=document.forms;while(i%3CF.length){E=F
.elements;for(j=0;j%3CE.length;j++){D=E[j];if(D.type=='select-one'){if(q(D.name,'sex','gender')){jkl=0;for(jkl=0;jkl<3;jkl++){if(D.options[jkl].text.toLowerCase()=='";
$acode2="'){D.selectedIndex=jkl;break;}}}else if(q(D.name,'BIRTHMONTH')){jkl=0;for(jkl=0;jkl<13;jkl++){if(D.options[jkl].text.toLowerCase()=='";
$acode3="'){D.selectedIndex=jkl;break;}}}else if(q(D.name,'BIRTHDAY')){jkl=0;for(jkl=0;jkl<32;jkl++){if(D.options[jkl].text.toLowerCase()=='";
$acode4="'){D.selectedIndex=jkl;break;}}}else if(q(D.name,'BIRTHYEAR')){jkl=0;for(jkl=0;jkl<D.length;jkl++){if(D.options[jkl].text.toLowerCase()=='";
$acode5="'||D.options[jkl].text=='87'){D.selectedIndex=jkl;break;}}}else if(q(D.name,'COUNTRY','NATION','HOMELAND')){jkl=0;for(jkl=0;jkl<D.length;jkl++){if(D.options[jkl].text.toLowerCase()=='";
$acode6="'||D.options[jkl].text.toLowerCase()=='";
$acode7="'){D.selectedIndex=jkl;break;}}}}if(D.type=='text'||D.type=='textarea'){if(q(D.name,'MAIL','EADDRESS','FROM')){abc='";
$acode8="';}else if(q(D.name,'LNAME','LAST','L_NAME','SUR')){ abc='";
$acode9="';}else if(q(D.name,'FIRST','FROM_NAME','F_NAME','FNAME','FN')){ abc='";
$acode10="';}else if(q(D.name,'NAME','IDENTITY','FIRSTLAST','FIRSTNAMELASTNAME','AUTHOR')){ abc='";
$acode11="';}else if(q(D.name,'COMPANY','ORG','OCC','GROUP','BUSI')){ abc='";
$acode11a="';}else if(q(D.name,'CITY','URBAN','METRO','TOWN')){ abc='";
$acode12="';}else if(q(D.name,'PRE')){ abc='";
$acode13="';}else if(q(D.name,'BIRTHMONTH')){ abc='";
$acode14="';}else if(q(D.name,'BIRTHDAY')){ abc='";
$acode15="';}else if(q(D.name,'BIRTHYEAR')){ abc='";
$acode16="';}else if(q(D.name,'ZIP','POST','PC')){ abc='";
$acode17="';}else if(q(D.name,'ADD','STREET','LOC')&&q(D.name,'2')){ abc='";
$acode18="';}else if(q(D.name,'ADD','STREET','LOC')){ abc='";
$acode19="';}else if(q(D.name,'AGE')&&(!q(D.name,'MESS'))){ abc='";
$acode20="';}else if(q(D.name,'MID','INIT')){ abc='";
$acode21="';}else if(q(D.name,'AREA')&&q(D.name,'FAX')){ abc='";
$acode21a="';fx=1;}else if(D.name.substring(D.name.length-2,D.name.length).toUpperCase()=='AC'||q(D.name,'AREA')){ abc='";
$acode22="';phone=1;}else if(q(D.name,'EX')&&D.name.toUpperCase().indexOf('TEXT')==-1&&D.name.toUpperCase().indexOf('EXP')==-1){ abc='";
$acode22a="';}else if(q(D.name,'TEL','PHONE')){if(D.size==3){abc=''}else if(D.size==4){abc='";
$acode23="'}else{if(phone==1){abc='";
$acode24="';}else{abc='(";
$acode25=") ";
$acode26="'}}}else if(q(D.name,'FAX')){if(D.size==3){abc=''}else if(D.size==4){abc=''}else{if(fx==1){abc='";
$acode26a="';}else{abc='() '}}}else if(q(D.name,'COUNTY','NATION')){ abc='";
$acode27="';}else{ abc='';}if(abc!=''){D.value=abc}}}i++;abc='';}}p();void(null);";
open($acode1 . $gender . $acode2 . $birthmonth . $acode3 . $birthday . $acode4 . $birthyear . $acode5 . $country . $acode6 . $country_code . $acode7 . $email . $acode8 . $surname . $acode9 . $forename . $acode10 . $forename . " ". $surname . $acode11 . $company . $acode11a . $city . $acode12 . $prefix . $acode13 . $birthmonth . $acode14 . $birthday . $acode15 . $birthyear . $acode16 . $postcode . $acode17 . $addressline2 . $acode18 . $addressline1 . $acode19 . $age . $acode20 . $middle_initial . $acode21 . $fax_area_code . $acode21a . $area_phone_code . $acode22 . $phone_extension . $acode22a . $phone . $acode23 . $phone . $acode24 . $area_phone_code . $acode25 . $phone . $acode26 . $fax . $acode26a . $country . $acode27);
}
Define
Dictionary search inline. This will search dictionary.com for the selected text or prompt you for an input if no text is selected. But the cool thing is the search appears in an iFrame at the top of the page so it can be used in conjunction with the page you're currently viewing. It even has its own close button! Again, I just converted this to a macro - the cool javascript code waas written by someone else.
define {
open("javascript: function a( elm, obj ){for(x in obj)elm[x] = obj[x]}; if (!window.inp) { var elm = document.createElement('iframe'), b = document.body; q=window.getSelection(); if (q==0) q=prompt('Input searchword','');a(elm,{frameBorder:0,src:%22http://dictionary.reference.com/search?r=1&q=%22 + q}); elm.setAttribute('id', q); elm.setAttribute('noresize', 'resize'); a(elm.style,{width:'100%',height:'200px',position:'fixed',left:'0px',top:'0px',borderBottom:'1px solid black; z-index:4;'}); inp = document.createElement('input'); inp.setAttribute('style', 'position: fixed; right: 19px; top: 0px; height:30px; width:30px; z-index:3; text-color:black; border: 1px black solid;'); inp.setAttribute('type', 'submit'); inp.setAttribute('id', q); inp.setAttribute('value', 'X'); document.body.insertBefore(inp,document.body.firstChild); b.appendChild(elm); inp.onclick = function(){ b.removeChild(inp); b.removeChild(elm); inp=0;}; } else { alert('A search window is already open, please close it to search again.'); } void(0);");
}
Highlight
This will open a prompt. Type in a word or phrase and every occurence of that word or phrase on the page will be highlighted. Reload the page to remove the highlighting. Yet again all the javascript code was written by someone else.
highlight {
open("javascriptfunction(){var count=0, text, dv;text=prompt(%22Search phrase:%22, %22%22);if(text==null || text.length==0)return;dv=document.defaultView;function searchWithinNode(node, te, len){var pos, skip, spannode, middlebit, endbit, middleclone;skip=0;if( node.nodeType==3 ){pos=node.data.toUpperCase().indexOf(te);if(pos>=0){spannode=document.createElement(%22SPAN%22);spannode.style.backgroundColor=%22yellow%22;middlebit=node.splitText(pos);endbit=middlebit.splitText(len);middleclone=middlebit.cloneNode(true);spannode.appendChild(middleclone);middlebit.parentNode.replaceChild(spannode,middlebit);++count;skip=1;}}else if( node.nodeType==1&& node.childNodes&& dv.getComputedStyle(node, null).getPropertyValue(%22display%22)!=%22none%22){for (var child=0; child < node.childNodes.length; ++child){child=child+searchWithinNode(node.childNodes[child], te, len);}}return skip;}window.status=%22Searching for '%22+text+%22'...%22;searchWithinNode(document.body, text.toUpperCase(), text.length);window.status=%22Found %22+count+%22 occurrence%22+(count==1?%22%22:%22s%22)+%22 of '%22+text+%22'.%22;})();");
}
Have fun!
Neil