X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=experiments%2Fspclient%2Fmkws.js;h=3bf3069a7776a14980fe11cc9ab76bb93669737f;hb=4a1ea6a97841cd64a5f9efd6c6bf3557689eac2b;hp=e7217ad0e9cd5b60c9a075f8944ded72fadd37f6;hpb=9be3659050370303cf91cb8b74303466565e455b;p=mkws-moved-to-github.git diff --git a/experiments/spclient/mkws.js b/experiments/spclient/mkws.js index e7217ad..3bf3069 100644 --- a/experiments/spclient/mkws.js +++ b/experiments/spclient/mkws.js @@ -175,30 +175,24 @@ function my_onterm(data) { } termlists.push(''); - termlists.push('
'); - termlists.push('
' + M('Subjects') + '
'); - for (var i = 0; i < data.subject.length && i < SubjectMax; i++ ) { - termlists.push('' - + data.subject[i].name - + ' (' - + data.subject[i].freq - + ')
'); - } - termlists.push('
'); + add_single_facet(termlists, "Subjects", data.subject, SubjectMax, "su"); + add_single_facet(termlists, "Authors", data.author, AuthorMax, "au"); + + var termlist = document.getElementById("termlist"); + replaceHtml(termlist, termlists.join('')); +} +function add_single_facet(termlists, caption, data, max, cclIndex) { termlists.push('
'); - termlists.push('
' + M('Authors') + '
'); - for (var i = 0; i < data.author.length && i < AuthorMax; i++ ) { - termlists.push('' - + data.author[i].name + termlists.push('
' + M(caption) + '
'); + for (var i = 0; i < data.length && i < max; i++ ) { + termlists.push('
' + + data[i].name + ' (' - + data.author[i].freq + + data[i].freq + ')
'); } termlists.push('
'); - - var termlist = document.getElementById("termlist"); - replaceHtml(termlist, termlists.join('')); } function my_onrecord(data) {