Changeset 14423 for lang/python
- Timestamp:
- 06/22/08 21:52:08 (5 months ago)
- Location:
- lang/python/incsearch/djangoapp
- Files:
-
- 1 added
- 4 modified
-
docsearch/templates/docsearch/index.html (modified) (1 diff)
-
docsearch/templates/docsearch/index_en.html (added)
-
docsearch/urls.py (modified) (1 diff)
-
docsearch/views.py (modified) (2 diffs)
-
static/docsearch.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/python/incsearch/djangoapp/docsearch/templates/docsearch/index.html
r14402 r14423 1 1 <html> 2 2 <head> 3 <title> DocSearch</title>3 <title>Python Module Search</title> 4 4 <script src="/d/static/jquery-1.2.3.pack.js"></script> 5 <script src="/d/static/jquery.shortkeys.js" type="text/javascript"></script>6 5 <script src="/d/static/docsearch.js"></script> 7 6 </head> 8 7 <body onload="loadfunc()"> 9 <table border=0> 10 <tr><td> 11 <h1>DocSearch</h1> 12 </td> 13 <td> 8 <img src="/d/static/pythonmodulesearch.gif" border="0"/> 14 9 <form name="queryform"> 15 <input type="text" id="querybox" name="query" size="30" onkeyup="search(this)"/> <input type="button" value="Search" onclick="search()"/>10 Module name, function name, etc...-> <input type="text" id="querybox" name="query" size="30" onkeyup="search(this)"/> 16 11 </form> 17 </td>18 </tr>19 </table>20 12 <table id="tbl"> 21 13 <tr> -
lang/python/incsearch/djangoapp/docsearch/urls.py
r14402 r14423 14 14 #検索 15 15 url(r"^s/$", "docsearch.views.search"), 16 17 #英語版TOPページ 18 url(r"^en/$", direct_to_template, {"template": "docsearch/index_en.html"}, 19 name="top"), 20 21 #検索 22 url(r"^en/s/$", "docsearch.views.search_en"), 23 16 24 ) 17 25 -
lang/python/incsearch/djangoapp/docsearch/views.py
r14402 r14423 7 7 8 8 from incsearch.searcher import find_dangerous 9 10 from settings import DOCSEARCHINDEX, DOCSEARCHINDEX_EN 9 11 10 12 def search(request): … … 20 22 if len(query) < 2: 21 23 return returnnone() 22 res = find_dangerous( "/users/ayu/work/incsearch/testdb", str(query))24 res = find_dangerous(DOCSEARCHINDEX, str(query)) 23 25 response.write(json.write(map(lambda x:str(x).split("\t"), res))) 24 26 return response 25 27 28 def search_en(request): 29 response = HttpResponse(mimetype="text/javascript") 30 31 def returnnone(): 32 response.write(json.write(None)) 33 return response 34 print dir(request) 35 if request.method != "GET": 36 return returnnone() 37 query = request.GET.get("q", "u") 38 if len(query) < 2: 39 return returnnone() 40 res = find_dangerous(DOCSEARCHINDEX_EN, str(query)) 41 response.write(json.write(map(lambda x:str(x).split("\t"), res))) 42 return response 43 -
lang/python/incsearch/djangoapp/static/docsearch.js
r14402 r14423 48 48 eventsetter(); 49 49 focussetter(); 50 } 51 52 function search_en(e){ 53 var query = document.queryform.query.value; 54 if(prevquery == query) return; 55 prevquery = query; 56 $.ajax({ 57 url: "/d/ds/en/s/?q=" + query, 58 type: "GET", 59 data: {}, 60 dataType: "json", 61 timeout: 10000, 62 error: function(){$("#searchresult").html("error");}, 63 success: function(data){ 64 if(data){ 65 buf = ""; 66 items = []; 67 $(data).each(function(i){ 68 var item; 69 if(this[2]=="-") 70 item = "/d/static/docsearch/endata/enlib/"+this[1]; 71 else 72 item = "/d/static/docsearch/endata/enlib/"+this[1]+"#incsearch_"+this[2]; 73 items.push(item); 74 buf += "<a href='"+item+"' target='win' id='item_"+i+"'> * " +this[3]+ "</a><br/>"; 75 }); 76 if(items.length == 0){ 77 $("#searchresult").html("Not found."); 78 return; 79 } 80 $("#searchresult").html(buf); 81 if(curdoc != items[0]){ 82 frames["win"].document.location.href=items[0]; 83 curdoc = items[0]; 84 } 85 $("#item_0").css("background-color", "#ccccff"); 86 curpos = 0; 87 } 88 } 89 }); 50 90 } 51 91
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)