war/src/main/webapp/scripts/hudson-behavior.js
// set up logic behind the search box
set up logic behind the search box
set up logic behind the search box
function createSearchBox(searchURL) {
    var ds = new YAHOO.util.XHRDataSource(searchURL+"suggest");
    ds.responseType = YAHOO.util.XHRDataSource.TYPE_JSON;
    ds.responseSchema = {
        resultsList: "suggestions",
        fields: ["name"]
    };
    var ac = new YAHOO.widget.AutoComplete("search-box","search-box-completion",ds);
    ac.typeAhead = false;
    ac.autoHighlight = false;
    ac.formatResult = ac.formatEscapedResult;
    ac.maxResultsDisplayed = 25;
    var box   = $("search-box");
    var sizer = $("search-box-sizer");
    var comp  = $("search-box-completion");
    var minW  = $("search-box-minWidth");
    Behaviour.addLoadEvent(function(){
        function copyFontStyle(s,d) {
            var ds = d.style;
            ds.fontFamily = getStyle(s,"fontFamily");
            ds.fontSize = getStyle(s,"fontSize");
            ds.fontStyle = getStyle(s,"fontStyle");
            ds.fontWeight = getStyle(s,"fontWeight");
        }
        copyFontStyle(box,sizer);
        copyFontStyle(box,minW);
    });
    function updatePos() {
        function max(a,b) { if(a>b) return a; else return b; }
        sizer.innerHTML = box.value.escapeHTML();
        var w = max(sizer.offsetWidth,minW.offsetWidth);
        box.style.width =
        comp.style.width = 
        comp.firstChild.style.width = (w+60)+"px";
        var pos = YAHOO.util.Dom.getXY(box);
        pos[1] += YAHOO.util.Dom.get(box).offsetHeight + 2;
        YAHOO.util.Dom.setXY(comp, pos);
    }
    updatePos();
    box.onkeyup = updatePos;
}
function createSearchBox ( searchURL ) { var ds = new YAHOO . util . XHRDataSource ( searchURL + "suggest" ) ; ds . responseType = YAHOO . util . XHRDataSource . TYPE_JSON ; ds . responseSchema = { resultsList : "suggestions" , fields : [ "name" ] } ; var ac = new YAHOO . widget . AutoComplete ( "search-box" , "search-box-completion" , ds ) ; ac . typeAhead = false ; ac . autoHighlight = false ; ac . formatResult = ac . formatEscapedResult ; ac . maxResultsDisplayed = 25 ; var box = $ ( "search-box" ) ; var sizer = $ ( "search-box-sizer" ) ; var comp = $ ( "search-box-completion" ) ; var minW = $ ( "search-box-minWidth" ) ; Behaviour . addLoadEvent ( function ( ) { function copyFontStyle ( s , d ) { var ds = d . style ; ds . fontFamily = getStyle ( s , "fontFamily" ) ; ds . fontSize = getStyle ( s , "fontSize" ) ; ds . fontStyle = getStyle ( s , "fontStyle" ) ; ds . fontWeight = getStyle ( s , "fontWeight" ) ; } copyFontStyle ( box , sizer ) ; copyFontStyle ( box , minW ) ; } ) ; function updatePos ( ) { function max ( a , b ) { if ( a > b ) return a ; else return b ; } sizer . innerHTML = box . value . escapeHTML ( ) ; var w = max ( sizer . offsetWidth , minW . offsetWidth ) ; box . style . width = comp . style . width = comp . firstChild . style . width = ( w + 60 ) + "px" ; var pos = YAHOO . util . Dom . getXY ( box ) ; pos [ 1 ] += YAHOO . util . Dom . get ( box ) . offsetHeight + 2 ; YAHOO . util . Dom . setXY ( comp , pos ) ; } updatePos ( ) ; box . onkeyup = updatePos ; }
set up logic behind the search box
set up logic behind the search box
// make sure all three components have the same font settings // update positions and sizes of the components relevant to search