ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > FARR Plugins and Aliases

Fingers in the nose guide to build javascript plugins. Does that mean its easy ?

(1/8) > >>

ecaradec:
I wrote a short documentation on how to use the Javascript SDK. It is just a beautiful thing of litterature. It is packaged with a javascript plugin sample sample and appropriately named the_fingers_in_the_nose_guide_to_build_javascript_plugin_for_farr.txt
Start hacking at : http://e.craft.free.fr/farr/FScript/FScriptSample.rar

M. 8)

mouser:
file not found.

ecaradec:
Oups! Characters case issue. Fixed. Thank.

czb:
Hi, I am working on "Character table" javascript plugin. I have several questions.
1)Could you please describe what UNKNOWN=0; FILE=1; FOLDER=2; ALIAS=3; URL=4; PLUGIN=5; CLIP=5; does? I am completely newbie concerning most of programming :)
2) Another question targeting to mouser: is there any way how to make all chars visible correctly? Now when I type "chars d" it displays completely mess (it should display those chars:"ð","đ","ď","dž","∂","δ"), I saved the text file as UTF-8 to have all the chars saved corectly :(
3) Is there any way how to display all result not only 9 of them? I now user can write "+sall" but I would prefer if for this plugin this would be set as default

Here is my code til now.. but still working on it:

--- ---// plugin script :
displayname="Character Table";
versionstring="1.00.01";
releasedatestring="Apr 1st, 2007";
author="Oldrich Svec<[email protected]>";
updateurl="";
homepageurl="";
shortdescription="Character Table";
longdescription="Character Table";
advconfigstring="Character Table";
readmestring="Character Table";
iconfilename="Delicious.ico";

aliasstr="chars";
regexstr="chars/.*";       // this is the farr regex
scriptregex=/chars\/(.*)/; // this is the plugin regexp (the group are not transfered to the onRegExSearchMatch currently )
regexfilterstr="$$1";
keywordstr="";
scorestr="300";
//autoreload=true;


// type
UNKNOWN=0;
FILE=1;
FOLDER=2;
ALIAS=3;
URL=4;
PLUGIN=5;
CLIP=5;

// Postprocessing
IMMEDIATE_DISPLAY=0;
ADDSCORE=1;
MATCH_AGAINST_SEARCH=2;

var string = new Array();
string[":"] = new Array("^_^","=^_^=","¬_¬");
string["$"] = new Array("¢","£","¤","¥","€","₣","₤","₧","₨","₠");
string["!"] = new Array("¡","¬");
string["?"] = new Array("¿");
string["^"] = new Array("¹","²","³","ⁿ");
string["/"] = new Array("÷","¼","½","¾","⅛","⅜","⅝","⅞");
string["+"] = new Array("±");
string["-"] = new Array("−","±");
string["*"] = new Array("×");
string["="] = new Array("≈","≠","≡","≤","≥");
string["."] = new Array("…");
string["a"] = new Array("á","à","ä","â","å","ā","ă","ą","ǎ","æ","ǟ","ǡ","ǣ","ǻ","ǽ","α");
string["A"] = new Array("Á","À","Ä","Â","Å","Ā","Ă","Ą","Ǎ","Æ","Ǟ","Ǡ","Ǣ","Ǻ","Ǽ","Α");
string["b"] = new Array("ß","β");
string["B"] = new Array("Β");
string["c"] = new Array("ç","č","ć","ċ","ĉ","©","χ");
string["C"] = new Array("Ç","Č","Ć","Ċ","Ĉ","©","Χ");
string["d"] = new Array("ð","đ","ď","dž","∂","δ");
string["D"] = new Array("Ð","Đ","Ď","DŽ","Dž","Δ");
string["e"] = new Array("é","è","ë","ê","ē","ĕ","ė","ę","ě","ǝ","℮","€","ε","η");
string["E"] = new Array("É","È","Ë","Ê","Ē","Ĕ","Ė","Ę","Ě","€","Ε");
string["f"] = new Array("φ");
string["F"] = new Array("₣","Φ");
string["g"] = new Array("ĝ","ğ","ġ","ģ","ǥ","ǧ","γ");
string["G"] = new Array("Ĝ","Ğ","Ġ","Ģ","Ǥ","Ǧ","Γ");
string["h"] = new Array("ĥ","ħ");
string["H"] = new Array("Ĥ","Ħ","Η");
string["i"] = new Array("í","ì","ï","î","ĩ","ī","ĭ","į","ı","ǐ","ij","∞","∫","η","ι");
string["I"] = new Array("Í","Ì","Ï","Î","Ĩ","Ī","Ĭ","İ","Į","Ǐ","IJ","Η","Ι");
string["j"] = new Array("ĵ","ij");
string["J"] = new Array("Ĵ","IJ");
string["k"] = new Array("ķ","ĸ","ǩ","κ","χ");
string["K"] = new Array("Ķ","Ǩ","Κ","Χ");
string["l"] = new Array("ĺ","ļ","ľ","ŀ","ł","lj","λ");
string["L"] = new Array("Ĺ","Ļ","Ľ","Ŀ","Ł","LJ","Lj","₤","Λ");
string["m"] = new Array("μ");
string["M"] = new Array("Μ");
string["n"] = new Array("ñ","ń","ņ","ň","ʼn","ŋ","nj","η","ν");
string["N"] = new Array("Ñ","Ń","Ņ","Ň","Ŋ","NJ","Nj","Η","Ν");
string["o"] = new Array("ø","ó","ò","ö","ô","õ","ō","ŏ","ő","ǒ","ǫ","ǭ","œ","°","ο","ω");
string["O"] = new Array("Ø","Ó","Ò","Ö","Ô","Õ","Ō","Ŏ","Ő","Ǒ","Ǫ","Ǭ","Œ","Ο","Ω");
string["p"] = new Array("þ","₧","π","ψ");
string["P"] = new Array("Þ","ß","Π","Ψ");
string["r"] = new Array("ŕ","ŗ","ř","ȑ","ȓ","®","√","ρ");
string["R"] = new Array("Ŕ","Ŗ","Ř","Ȑ","Ȓ","®","Ρ");
string["s"] = new Array("š","ś","ŝ","ş","ß","Σ","√","∫","σ","ς");
string["S"] = new Array("Š","Ś","Ŝ","Ş","Σ");
string["t"] = new Array("ţ","ť","ŧ","™","θ","τ");
string["T"] = new Array("Ţ","Ť","Ŧ","Θ","Τ");
string["u"] = new Array("ú","ù","ü","û","ũ","ū","ŭ","ů","ű","ų","ǔ","ǖ","ǘ","ǚ","ǜ","ȕ","ȗ","υ");
string["U"] = new Array("Ú","Ù","Ü","Û","Ũ","Ū","Ŭ","Ů","Ű","Ų","Ǔ","Ǖ","Ǘ","Ǚ","Ǜ","Ȕ","Ȗ","Υ");
string["w"] = new Array("ŵ");
string["W"] = new Array("Ŵ");
string["x"] = new Array("ξ","χ");
string["X"] = new Array("Ξ","Χ");
string["y"] = new Array("ý","ÿ","ŷ");
string["Y"] = new Array("Ý","Ÿ","Ŷ");
string["z"] = new Array("ź","ż","ž","ζ");
string["Z"] = new Array("Ź","Ż","Ž","Ζ");

function debug(msg) {
    if(typeof(WScript)!="undefined")
        WScript.StdOut.Write(msg+"\n");
}

function doQuery(query) {
     FARR.setState(1);
    if(query == ""){
      FARR.emitResult("Type a letter", "test", iconfilename,FILE,IMMEDIATE_DISPLAY,300);
    }else if(string[query] != undefined){
      for(var i=0; i<string[query].length; i++){
        FARR.emitResult(string[query][i], string[query][i], iconfilename,CLIP,IMMEDIATE_DISPLAY,300);
      }
    }else{
      FARR.emitResult("No match", "test", iconfilename,FILE,IMMEDIATE_DISPLAY,300);
    }
    FARR.setState(0);
}

function onSearchBegin(explicit, query, query_nokeyword) {
    if(!explicit) {
        if(aliasstr.indexOf(query)!=-1) {
            FARR.setState(1);
            FARR.emitResult(aliasstr, aliasstr, iconfilename,ALIAS,IMMEDIATE_DISPLAY,300);
            FARR.setState(0);
        }
        return;
    }

    doQuery(query_nokeyword);
}

function onRegexSearchMatch(query) {
    var query_nokeyword=query.match(scriptregex)[1]

    doQuery(query_nokeyword);
}

// There is no debugging when the script is executed in FARR
// Run the script with "cscript fscript.js" to debug it while developpement
if(typeof(FARR)=="undefined") {
    FARR={
        emitResult:function(title, path, icon, type, postproc,score) {
            WScript.StdOut.Write("title:"+title+"\n");
            WScript.StdOut.Write("path:"+path+"\n");
            WScript.StdOut.Write("icon:"+icon+"\n");
            WScript.StdOut.Write("type:"+type+"\n");
            WScript.StdOut.Write("postproc:"+postproc+"\n");
            WScript.StdOut.Write("score:"+score+"\n");
        },
        setState:function(s) {
            WScript.StdOut.Write(s+"\n");
        }
    }
    //onSearchBegin(true, "deli","test");
    onRegexSearchMatch("deli/joke")
    WScript.Sleep(1000);
}

mouser:
hi czechboy, let me try to help a little, and sorry for the delay in responding.

ok as for #1, these are different kinds of results that can be returned by plugins which help FARR know how to handle the results.  FILE type is most common when results are files.  most of the others are for internal use -- in your case you should probably use UNKNOWN, basically meaning that FARR shouldnt assume that the result is a file to launch.  Then you will handle the triggering of it.

#2 - i think what we have here is a problem with unicode text display or font character set, and FARR is not unicode compatible.  i'm thinking though that maybe the best solution for plugins that want to do unicode stuff is to add an ability for FARR to be told to display a special unicode display mode.. i'll have to look into that when i have a little more time -- i'm still in the middle of a job that takes up most of my time at the moment so it will have to wait a month or so :(  but i will find a way to do it so don't let this stop you from working on this nice plugin.

#3 - yes you can call the function to set a farr variable and pass the keyword: setshowallmode
that will trigger FARR to display all resutls not just a few.

Navigation

[0] Message Index

[#] Next page

Go to full version