X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=www%2Fdemo%2Fsearch.js;h=b7754e0c27090d66bcfb44f89c9ab3ec86a295a2;hb=a2cfdccb04612a30626546b1e6b9914d5a5e15fb;hp=feed8f83d45416b523c0320c8e9b346df3362f6a;hpb=d5691695e6a22fc0db9c9bffc9ed6f85e908d8c1;p=pazpar2-moved-to-github.git diff --git a/www/demo/search.js b/www/demo/search.js index feed8f8..b7754e0 100644 --- a/www/demo/search.js +++ b/www/demo/search.js @@ -1,4 +1,4 @@ -/* $Id: search.js,v 1.32 2007-01-16 19:42:20 quinn Exp $ +/* $Id: search.js,v 1.34 2007-01-17 02:15:12 quinn Exp $ * --------------------------------------------------- * Javascript container */ @@ -222,6 +222,8 @@ function displayname(name) return 'ISBN'; else if (name == 'md-publisher') return 'Publisher'; + else if (name == 'md-url') + return 'URL'; else return name; } @@ -232,6 +234,8 @@ function hyperlink_field(name) return 'au'; else if (name == 'md-subject') return 'su'; + else if (name == 'md-url') + return 'URL'; else return 0; } @@ -290,10 +294,18 @@ function paint_details(body, xml) if (hyl) { nv = create_element('a', value); - nv.setAttribute('href', '#'); - nv.setAttribute('term', value); - nv.setAttribute('searchfield', hyl); - nv.onclick = function() { hyperlink_search(this); return false; }; + if (hyl == 'URL') + { + nv.setAttribute('href', value); + nv.setAttribute('target', '_blank'); + } + else + { + nv.setAttribute('href', '#'); + nv.setAttribute('term', value); + nv.setAttribute('searchfield', hyl); + nv.onclick = function() { hyperlink_search(this); return false; }; + } } else nv = document.createTextNode(value); @@ -329,6 +341,15 @@ function show_details() cur_id = id; cur_rec = xml; + var nodes = document.getElementsByName('listrecord'); + var i; + for (i = 0; i < nodes.length; i++) + { + var dets = nodes[i].getElementsByTagName('div'); + if (dets[0]) + dets[0].style.display = 'none'; + } + var body = document.getElementById('rec_' + id); if (!body) return; @@ -347,14 +368,6 @@ function hyperlink_search(obj) function fetch_details(id) { cur_id = -1; - var nodes = document.getElementsByName('listrecord'); - var i; - for (i = 0; i < nodes.length; i++) - { - var dets = nodes[i].getElementsByTagName('div'); - if (dets[0]) - dets[0].style.display = 'none'; - } if (id == cur_id) { cur_id = -1; @@ -435,7 +448,7 @@ function show_records() record_div.setAttribute('name', 'listrecord'); var record_cell = create_element('a', title); - record_cell.setAttribute('href', '#'); + record_cell.setAttribute('href', '#' + id); record_cell.setAttribute('onclick', 'fetch_details(' + id + '); return false'); record_div.appendChild(record_cell); if (author)