var search_colors = { textbase : 0 , resultgen: 0 , trait: 0 , page : { result: 0 , pertinence : 150 } , file: { result : 0 , pertinence : 150 } , background2 : 29, backgroundover : 13, complement : -1 } ; function search_color( s ) { var t = s.split( "." ) ; var v = search_colors ; for ( var i = 0 ; i < t.length ; i++ ) v = v[ t[ i ] ] ; // 10_11_16 julien : maintenant le fond est tjs blanc ( getpagebackgroundcolor = rgb(255,255,255) ) if ( v == -1 ) return rgbcomplement( "rgb(255,255,255)" ) ; if ( v == 0 ) return bwcontrastcolor( "rgb(255,255,255)" ) ; //if ( v == 150 ) return rgbcontrastcolor150( "rgb(255,255,255)" ) ; return rgbcontrastcolor( "rgb(255,255,255)", v ) ; } function search_getpagename( f ) { var getfullpagename = ( window.quomodoclient && quomodoclient.search && quomodoclient.search.getfullpagename ) || false ; var domain = f.replace ( /\/.*$/ , "" ) ; var s = f.replace( /^[^\/]+\// , "" ) ; var tf = s.split( "/" ) ; if ( tf[ 0 ] == "uploads" ) return [ domain , "file" , s , decodeURIComponent( tf[ 2 ] ) ] ; var id = ( ( tf[ 0 ] == "__src" ) ? tf[ 1 ] : tf[ 0 ] ).replace( /_([0-9]+)_([^.]+).*/ , function () { return "#" + arguments[ 1 ] + "#" + ( { forum : "artemadisq@intl" , page : "artemapage@intl" } )[ arguments[ 2 ] ] ; } ) ; var wdata = web_svctopages ; if ( window.domains_svctopages ) wdata = domains_svctopages[ domain ] ; for ( var i = 0 ; i < wdata.length ; i++ ) { if ( id == wdata[ i ].id && getfullpagename && /#[0-9]+#artemapage@intl/.test( id ) ) { var pathsIndex = q_sitemap_getpath( id ) ; var arrayName = [] ; var currItem = { items : spacexml.sitemap } ; for ( var j = 0 ; j < pathsIndex.length - 1 ; j ++ ) { currItem = currItem.items[ pathsIndex [ j ] ] ; arrayName.push ( currItem.name ) ; } arrayName.push( wdata[ i ].pagename ) ; return [ domain , "page" , wdata[ i ].name , arrayName.join( " " ) , wdata[ i ].tabname ] ; } else if ( id == wdata[ i ].id ) return [ domain , "page" , wdata[ i ].name , wdata[ i ].pagename , wdata[ i ].tabname ] ; } return [ domain , "page" , s , decodeURIComponent( s ) ] ; } function search_addrows( nstart ) { var suppressrubriquenametd = ( window.quomodoclient && quomodoclient.search && quomodoclient.search.suppressrubriquenametd ) || false ; var suppresssearchnumbertd = ( window.quomodoclient && quomodoclient.search && quomodoclient.search.suppresssearchnumbertd ) || false ; var table = ge( "searchout_table" ) ; var rows = table.rows ; for ( var i = 0 ; i < searchres_json.searchentriesperpage ; i++ ) if ( ! rows[ 5 ].id ) table.deleteRow( 5 ) ; var listf = searchres_json.listf ; var p = searchres_json.pertinence ; var fact = p.length && searchres_json.pertinencemax ? 100 / searchres_json.pertinencemax : 0 ; for ( var i = 0 ; i < listf.length ; i++ ) { var t = search_getpagename( listf[ i ] ) ; var typer = t[ 1 ] ; var r = table.insertRow( 5 + i ) ; $( r ).attr( { "id" : "result_" + ( i+1 ), "class" : "search_result" } ) ; var elem = $( "#" + typer + "_template" ).clone() ; $( ".search_number", elem ).html( nstart + i + 1 ) ; if ( window.domains_svctopages ) $( ".search_website", elem ).show().html( t[ 0 ] ); $( ".result_a", elem ) .attr( "href", t[ 2 ] ) .html( t[ 3 ] ) .addClass( "rpd-link" ) ; //.css( "color", search_color( typer+".result" ) ); if ( typer == "page" ) $( ".rubrique_name", elem ) .html( qlub_message[ "search_rubricname" ] || "( page web )" ) .css( "color", search_color( typer + ".result" ) ); $( ".pertinence", elem ) .css( { "width" : Math.round( 1 + p[ i ] * fact ) + "px", "background-color" : $( "#searchtextout" ).css( "border-color" ), "padding" : "0" } ) .addClass( "rpd-list-item" ); var tds = $( "td", elem ) .addClass( "rpd-list-item" ) .attr( "align", "left" ) .get(); var thelength = tds.length ; var $r = $( r ) ; $r.html( $( elem ).html() ) ; if ( suppressrubriquenametd ) $r.find( '.infos_results' ).remove( ) ; if ( suppresssearchnumbertd ) $r.find( 'td.search_number' ).remove( ) ; var xsHTML = "" ; if ( ! suppressrubriquenametd ) xsHTML += '' + $( ".search_number", $r ).html() + ' ' ; xsHTML += $( ".result_a", $r ).parent().html() ; if ( ! suppressrubriquenametd ) xsHTML += ' ' + $( ".rubrique_name", $r ).html() + '' ; $( ".result_xs", $r ).html( xsHTML ) ; } $( "#searchout_table .search_result" ).before( '
' ) ; $( "#searchout_table .search_result" ).last().after( '
' ) ; } function search_get( options ) { if ( search_submitted ) return false ; search_submitted = true ; options = $.extend( { privatedomain : qlub_getprivatedomain() , lang : q_lang } , searchres_json , options ) ; window.location.href = search_get_url( options ) ; } function search_get_url( options ) { options = $.extend( { privatedomain : qlub_getprivatedomain() , lang : q_lang } , searchres_json , options ) ; var query = "" ; if ( options.searchbackurl ) query = "searchbackurl=" + encodeURIComponent( options.searchbackurl ) + "&" ; query += "searchtext=" + options.searchtext + "&privatedomain=" + options.privatedomain + "&lang=" + options.lang + "&searchentriesperpage=" + options.searchentriesperpage + "&searchstartnumber=" + options.searchstartnumber + "&mission=search&time=" + (new Date).getTime() ; return "search?" + query ; } var search_back_url ; function search_get_params( privatedomain ) { var x = { searchtext : $( "#searchtextout" ).val() , searchentriesperpage : document.searchform2.searchentriesperpage.value , searchstartnumber : document.searchform2.searchstartnumber.value } if ( privatedomain ) x.privatedomain = privatedomain.replace( /__.*/, "") ; if ( search_back_url ) x.searchbackurl = search_back_url ; return x ; } function qlub_search_submit2() { search_get( search_get_params() ) ; } function search_initresults() { var o = q_geturlparams() ; if ( o.searchbackurl ) { search_back_url = o.searchbackurl ; $( "#search_back" ).attr( "href", search_back_url ) ; } var addmoreresults = /__.*/.test( qlub_getprivatedomain( ) ) ; var suppressrubriquenametd = ( window.quomodoclient && quomodoclient.search && quomodoclient.search.suppressrubriquenametd ) || false ; var suppresssearchnumbertd = ( window.quomodoclient && quomodoclient.search && quomodoclient.search.suppresssearchnumbertd ) || false ; if ( typeof searchres_json == "string" ) searchres_json = null ; $( "#searchout" ).css( "color", search_color( "textbase" ) ); var tdNumbers = 5 ; if ( suppressrubriquenametd ) tdNumbers--; if ( suppresssearchnumbertd ) tdNumbers--; if ( ! window.domains_svctopages ) tdNumbers--; $( "#searchoutno > td" ).attr( "colspan", tdNumbers ); $( "#searchoutyes > td" ).attr( "colspan", tdNumbers ); $( "#searchoutyestrait > td" ).attr( "colspan", tdNumbers ); $( "#search_tdx" ).attr( "colspan", tdNumbers ); if ( ! searchres_json ) return ; $( "#searchtextout" ).val( searchres_json.searchtext ) ; var nhits = searchres_json.nhits ; var nmax = parseInt( searchres_json.searchentriesperpage , 10 ) ; var nstart = parseInt( searchres_json.searchstartnumber , 10 ) ;// 0-based var currentpage = Math.ceil( ( nstart + 1 ) / nmax ) ; if ( nhits>0 ) { elem = $( "#searchhits" ).css( "color", search_color( "resultgen" ) ); var s ; if ( nhits > nmax ) s = qlub_message[ "Results2" ].replace( /%values/ , ( 1 + nstart ) +"-" + Math.min( nstart + searchres_json.searchentriesperpage , nhits ) ) + nhits ; else s = qlub_message[ "Results" ] + nhits ; elem.html( s ) ; } if ( addmoreresults ) { $ ( "#search_buttonstable tr" ).first().append( '' ) ; $( "#widen_search" ).attr( "href", search_get_url( search_get_params( qlub_getprivatedomain() ) ) ).html( qlub_message[ "results_more" ] ) ; $( '#searchtextout' ).change( function() { $( "#widen_search" ).attr( "href", search_get_url( search_get_params( qlub_getprivatedomain() ) ) ) ; } ) ; } $( "#searchoutyes" ).toggle( nhits > 0 ) ; $( "#searchoutno" ).toggle( nhits <= 0 && searchres_json.searchtext != undefined ) ; $( "#searchout_table" ).css( "color", search_color( "resultgen" ) ) ; search_addrows( nstart ) ; if ( nhits > nmax ) { var nbpage = Math.ceil( nhits / nmax ) ; $( "#searchpagenav" ) .show() .attr( "currentpage", currentpage ) .attr( "maxpage", nbpage - 1 ); var td = $( "#searchpagenav tr:first td:eq(1)" ); for ( var i = 0 ; i < nbpage ; i++ ) { var c = $( '' + ( i + 1 ) + '' ).insertBefore( td ).data( "page" , i + 1 ) ; if ( ( i + 1 ) == currentpage ) $( "a", c ).css( { "color" : search_color( "complement" ), "font-weight" : "bold", "text-decoration" : "underline" } ); else { c.click( function() { search_get( { searchstartnumber : ( $( this ).data( "page" ) - 1 ) * nmax } ) ; } ) ; $( "a", c ).css( "color" , search_color( "resultgen" ) ); } } $( "#searchnext" ).show() ; $( "#searchpagenext a" ).css( "color", search_color( "resultgen" ) ).toggle( currentpage != nbpage ) ; $( "#searchpageprec a" ).css( "color", search_color( "resultgen" ) ).toggle( currentpage != 1 ) ; } $( '#searchout_table tr[id^="result"]:first td' ).css( "border-top-width", "1px" ); } function search_nextpage() { search_get( { searchstartnumber : ( eval ( $( "#searchpagenav" ).attr( "currentpage" ) ) + 1 - 1 ) * parseInt( searchres_json.searchentriesperpage , 10 ) } ) ; } function search_prevpage() { search_get( { searchstartnumber : ( eval ( $( "#searchpagenav" ).attr( "currentpage" ) ) - 1 - 1 ) * parseInt( searchres_json.searchentriesperpage , 10 ) } ) ; }