X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=www%2Fdemo%2Fsearch.js;h=054558c8470123609732d505702f08ed1530255a;hb=b3a18c85a3e60600d77ad6053211da7acce91149;hp=dd06abdeaeb0b4f0e4c0156bed24f37129fe52cd;hpb=6a218e89a107e70e1bbfcf8495a654417f0de332;p=pazpar2-moved-to-github.git diff --git a/www/demo/search.js b/www/demo/search.js index dd06abd..054558c 100644 --- a/www/demo/search.js +++ b/www/demo/search.js @@ -1,4 +1,4 @@ -/* $Id: search.js,v 1.3 2007-01-05 13:33:47 sondberg Exp $ +/* $Id: search.js,v 1.10 2007-01-10 09:19:05 sondberg Exp $ * --------------------------------------------------- * Javascript container */ @@ -21,6 +21,7 @@ var session_cells = Array('query', 'startrec', 'action_type'); var old_session = session_read(); var url_surveillence; var recstoshow = 15; +var page_window = 5; // Number of pages prior to and after the current page var facet_list; var cur_facet = 0; @@ -72,8 +73,6 @@ function start_session() xinitSession.onreadystatechange=session_started; xinitSession.open("GET", url); xinitSession.send(null); - - //url_surveillence = setInterval(session_check, 200); } function ping_session() @@ -145,6 +144,41 @@ function update_action (new_action) { } +function make_pager (hits, offset, max) { + var html = ''; + var off; + + for (off = offset - page_window * max; + off < hits && off < (offset + page_window * max); + off += max) { + + var class = ''; + + if (off < 0) + off = 0; + + var p = off / max + 1; + + if ((offset >= off) && (offset < (off + max))) + class = ' class="select"'; + + html += '' + p + '\n'; + } + + return html; +} + + +function update_offset (offset) { + document.search.startrec.value = offset; + update_action('page'); + check_search(); + update_history(); + return false; +} + + function show_records() { if (xshow.readyState != 4) @@ -166,10 +200,15 @@ function show_records() var start = Number(xml.getElementsByTagName('start')[0].childNodes[0].nodeValue); var num = Number(xml.getElementsByTagName('num')[0].childNodes[0].nodeValue); var clients = Number(xml.getElementsByTagName("activeclients")[0].childNodes[0].nodeValue); - body.innerHTML = 'Records : '; - body.innerHTML += (start + 1) + ' to ' + (start + num) + - ' of ' + merged + ' (total hits: ' + total + ')'; - + body.innerHTML = '
'; - body.innerHTML += (i + start + 1) + ': '; - var mk = hits[i].getElementsByTagName("title"); - if (mk[0]) - body.innerHTML += mk[0].childNodes[0].nodeValue; - body.innerHTML += '
'; + var mk = hits[i].getElementsByTagName("md-title"); + var html = ''; + var field = ''; + + if (mk[0]) { + field = mk[0].childNodes[0].nodeValue; + } + + html += field + ''; + body.innerHTML += html; } + + body.innerHTML += '