PageRenderTime 189ms CodeModel.GetById 11ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/kai/templates/search.mako

https://bitbucket.org/bbangert/kai/
Mako | 148 lines | 121 code | 27 blank | 0 comment | 3 complexity | abfb4af7e56e20b6da9194315b5325a9 MD5 | raw file
  1<div class="yui-b content">
  2    <div id="searchcontrol"/>
  3    </div>
  4</div>
  5<%def name="styles()">
  6${parent.styles()}
  7<link href="http://www.google.com/uds/css/gsearch.css" type="text/css" rel="stylesheet"/>
  8<script src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0&amp;key=ABQIAAAAgvmgA94hbkqC7kh6JzKluxQQvUAzTIjSyGWv2egO9TxsQcw_PhRfptE4k-DD1r2KrOOojaXEJjVp-Q" type="text/javascript"></script>
  9<script type="text/javascript">
 10var fixurl = {update: function (searchControl, searcher, query) {
 11    window.location.hash = encodeURIComponent(query).replace(/%20/g, "+");
 12}};
 13
 14function cse() {
 15    // Grab the form element we use
 16    var sFormDiv = document.getElementById("searchcontrol");
 17    
 18    // Create a search control
 19    var searchControl = new GSearchControl();
 20    var options;
 21    var searcher;
 22    var cseId = "017012331895443894274:qqjvs4jj_ag";
 23    
 24    searcher = new GwebSearch();
 25    options = new GsearcherOptions();
 26    options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
 27    searcher.setSiteRestriction(cseId, null);
 28    searcher.setUserDefinedLabel("Web");
 29    searchControl.addSearcher(searcher, options);
 30    
 31    searcher = new GwebSearch();
 32    options = new GsearcherOptions();
 33    options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
 34    searcher.setSiteRestriction(cseId, "IRCLogs");
 35    searcher.setUserDefinedLabel("IRC Logs");
 36    searchControl.addSearcher(searcher, options);
 37
 38
 39    searcher = new GblogSearch();
 40    options = new GsearcherOptions();
 41    searcher.setQueryAddition("pylons python");
 42    searcher.setUserDefinedLabel("Blogs");
 43    searchControl.addSearcher(searcher, options);
 44
 45    // Setup search control settings
 46    searchControl.setSearchStartingCallback(fixurl, fixurl.update)
 47    searchControl.setResultSetSize(GSearch.LARGE_RESULTSET);
 48    
 49    var drawOptions = new GdrawOptions();
 50    drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED);
 51
 52    // Tell the searcher to draw itself and tell it where to attach
 53    searchControl.draw(sFormDiv, drawOptions);
 54
 55    // Execute an inital search, use the existing anchor param if present
 56    var query = decodeURIComponent(location.hash.substring(1).replace(/\+/g, "%20"));
 57    if (query) {
 58        searchControl.execute(query);
 59    } else {
 60        searchControl.execute("wsgi response");
 61    }
 62}
 63
 64function OnLoad() {
 65new cse();
 66}
 67GSearch.setOnLoadCallback(OnLoad);
 68</script>
 69<style type="text/css">
 70
 71body #searchcontrol, #searchcontrol p, .gs-snippet {
 72  background-color: white;
 73  font-family: Arial, sans-serif;
 74  font-size: 13px;
 75}
 76
 77h1 .tagline,
 78h1 a,
 79h1 a .tagline {
 80font-size : 13px;
 81font-weight : normal;
 82color : rgb(9, 122, 182);
 83cursor : pointer;
 84text-decoration : none;
 85}
 86
 87a span.tagline:hover {
 88text-decoration : underline;
 89color : rgb(237, 92, 11);
 90}
 91
 92a, a:link, a:visited, a:active {
 93    border-bottom: none;
 94}
 95
 96.gsc-control {
 97    width:100%;
 98    max-width: 600px;
 99}
100
101form .gsc-search-box {
102    width: 350px;
103}
104
105table.gsc-branding {
106    width: 350px;
107}
108
109table.gsc-resultsHeader, div.gsc-blogConfig {
110    width: 400px;
111}
112
113/* disable twiddle and size selectors for left column */
114#searchcontrol .gsc-twiddle {
115  background-image : none;
116}
117
118#searchcontrol .gsc-resultsHeader .gsc-title {
119  padding-left : 0px;
120  font-weight : bold;
121  font-size : 14px;
122}
123
124#searchcontrol .gsc-resultsHeader {
125  width: 200px;
126}
127
128#searchcontrol .gsc-resultsHeader div.gsc-results-selector {
129  display : none;
130}
131
132#searchcontrol .gsc-resultsRoot {
133  padding-top : 6px;
134}
135
136/* long form visible urls should be on */
137.gsc-webResult div.gs-visibleUrl-short {
138    display: none;
139}
140
141.gsc-webResult div.gs-visibleUrl-long {
142    display: block;
143}
144
145</style>
146</%def>
147<%def name="title()">${parent.title()} - ${_('Search')}</%def>
148<%inherit file="/layout.mako" />