X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=experiments%2Fspclient%2Fmkws.js;h=0d9498691241f676f15ba5360fd54bbb055de297;hb=2bce14ac89ba8f5641af052dcb2e6bb0dbe8f903;hp=105c70238f338b512c9e9c51ad1c92a14b6058f5;hpb=329d15ab4df8a20033013c056b03a845c54f1ec0;p=mkws-moved-to-github.git diff --git a/experiments/spclient/mkws.js b/experiments/spclient/mkws.js index 105c702..0d94986 100644 --- a/experiments/spclient/mkws.js +++ b/experiments/spclient/mkws.js @@ -113,7 +113,7 @@ function my_oninit() { function my_onshow(data) { totalRec = data.merged; // move it out - var pager = document.getElementById("pager"); + var pager = document.getElementById("mkwsPager"); pager.innerHTML = ""; pager.innerHTML +='
' + M('Displaying') + ': ' + (data.start + 1) + ' ' + M('to') + ' ' + (data.start + data.num) + @@ -121,14 +121,14 @@ function my_onshow(data) { + data.total + ')
'; drawPager(pager); // navi - var results = document.getElementById("results"); + var results = document.getElementById("mkwsResults"); var html = []; for (var i = 0; i < data.hits.length; i++) { var hit = data.hits[i]; - html.push('
' + html.push('
' +''+ (i + 1 + recPerPage * (curPage - 1)) +'. ' - +'' + hit["md-title"] +' '); if (hit["md-title-remainder"] !== undefined) { @@ -160,31 +160,31 @@ function my_onstat(data) { function my_onterm(data) { // no facets if (!mkws_config.facets || mkws_config.facets.length == 0) { - $("#termlist").parent().hide(); + $("#mkwsTermlists").parent().hide(); return; } // display if we first got results - $("#termlist").parent().show(); + $("#mkwsTermlists").parent().show(); - var termlists = []; - termlists.push('
' + M('Termlists') + '
'); + var acc = []; + acc.push('
' + M('Termlists') + '
'); var facets = mkws_config.facets; for(var i = 0; i < facets.length; i++) { if (facets[i] == "sources") { - add_single_facet(termlists, "Sources", data.xtargets, SourceMax, null); + add_single_facet(acc, "Sources", data.xtargets, SourceMax, null); } else if (facets[i] == "subjects") { - add_single_facet(termlists, "Subjects", data.subject, SubjectMax, "su"); + add_single_facet(acc, "Subjects", data.subject, SubjectMax, "su"); } else if (facets[i] == "authors") { - add_single_facet(termlists, "Authors", data.author, AuthorMax, "au"); + add_single_facet(acc, "Authors", data.author, AuthorMax, "au"); } else { alert("bad facet configuration: '" + facets[i] + "'"); } } - var termlist = document.getElementById("termlist"); - replaceHtml(termlist, termlists.join('')); + var termlist = document.getElementById("mkwsTermlists"); + replaceHtml(termlist, acc.join('')); } function add_single_facet(acc, caption, data, max, cclIndex) { @@ -210,16 +210,16 @@ function my_onrecord(data) { // FIXME: record is async!! clearTimeout(my_paz.recordTimer); // in case on_show was faster to redraw element - var detRecordDiv = document.getElementById('det_'+data.recid); + var detRecordDiv = document.getElementById('mkwsDet_'+data.recid); if (detRecordDiv) return; curDetRecData = data; - var recordDiv = document.getElementById('recdiv_'+curDetRecData.recid); + var recordDiv = document.getElementById('mkwsRecdiv_'+curDetRecData.recid); var html = renderDetails(curDetRecData); recordDiv.innerHTML += html; } function my_onbytarget(data) { - var targetDiv = document.getElementById("bytarget"); + var targetDiv = document.getElementById("mkwsBytarget"); var table ='' +''; @@ -242,9 +242,9 @@ function my_onbytarget(data) { function domReady () { document.search.onsubmit = onFormSubmitEventHandler; - document.search.query.value = ''; - document.select.sort.onchange = onSelectDdChange; - document.select.perpage.onchange = onSelectDdChange; + document.search.mkwsQuery.value = ''; + document.mkwsSelect.mkwsSort.onchange = onSelectDdChange; + document.mkwsSelect.mkwsPerpage.onchange = onSelectDdChange; } // when search button pressed @@ -275,13 +275,13 @@ function resetPage() function triggerSearch () { - my_paz.search(document.search.query.value, recPerPage, curSort, curFilter); + my_paz.search(document.search.mkwsQuery.value, recPerPage, curSort, curFilter); } function loadSelect () { - curSort = document.select.sort.value; - recPerPage = document.select.perpage.value; + curSort = document.mkwsSelect.mkwsSort.value; + recPerPage = document.mkwsSelect.mkwsPerpage.value; } // limit the query after clicking the facet @@ -294,7 +294,7 @@ function limitQuery (field, value) // limit by target functions function limitTarget (id, name) { - var navi = document.getElementById('navi'); + var navi = document.getElementById('mkwsNavi'); navi.innerHTML = 'Source: ' + name + ''; @@ -308,7 +308,7 @@ function limitTarget (id, name) function delimitTarget () { - var navi = document.getElementById('navi'); + var navi = document.getElementById('mkwsNavi'); navi.innerHTML = ''; curFilter = null; resetPage(); @@ -414,12 +414,12 @@ function switchView(view) { // detailed record drawing function showDetails (prefixRecId) { - var recId = prefixRecId.replace('rec_', ''); + var recId = prefixRecId.replace('mkwsRec_', ''); var oldRecId = curDetRecId; curDetRecId = recId; // remove current detailed view if any - var detRecordDiv = document.getElementById('det_'+oldRecId); + var detRecordDiv = document.getElementById('mkwsDet_'+oldRecId); // lovin DOM! if (detRecordDiv) detRecordDiv.parentNode.removeChild(detRecordDiv); @@ -450,7 +450,7 @@ function replaceHtml(el, html) { function renderDetails(data, marker) { - var details = '
Target IDHitsDiagsRecordsState
'; + var details = '
'; if (marker) details += ''; details += renderField("Title", data["md-title"], data["md-title-remainder"], data["md-title-responsibility"]); @@ -532,12 +532,12 @@ function mkws_html_all(config) { mkws_html_lang(mkws_config); // For some reason, doing this programmatically results in - // document.search.query being undefined, hence the raw HTML. + // document.search.mkwsQuery being undefined, hence the raw HTML. debug("HTML search form"); $("#mkwsSearch").html('\ - \ - \ - \ + \ + \ + \ '); debug("HTML records"); @@ -545,19 +545,19 @@ function mkws_html_all(config) {
'+ marker + '
\ \ \ \ \
\ -
\ +
\
\ -
\ -
\ +
\ + \ ' + M('Sort by') + ' ' + mkws_html_sort(config) + '\ ' + M('and show') + ' ' + mkws_html_perpage(config) + '\ ' + M('per page') + '.\ \
\ -
\ - \ -
\ +
\ +
\ +
\
'); @@ -573,7 +573,7 @@ function mkws_html_all(config) { domReady(); // on first page, hide the termlist - $(document).ready(function() { $("#termlist").parent().hide(); } ); + $(document).ready(function() { $("#mkwsTermlists").parent().hide(); } ); } /* Responsive web design - change layout on the fly depending on @@ -621,7 +621,7 @@ function mkws_html_switch(config) { debug("HTML targets"); $("#mkwsTargets").html('\ -
\ +
\ No information available yet.\
'); $("#mkwsTargets").css("display", "none"); @@ -634,7 +634,7 @@ function mkws_html_switch(config) { function mkws_html_sort(config) { debug("HTML sort"); - var sort_html = ''; for(var i = 0; i < config.sort.length; i++) { var key = config.sort[i][0]; @@ -653,7 +653,7 @@ function mkws_html_sort(config) { function mkws_html_perpage(config) { debug("HTML perpage"); - var perpage_html = ''; for(var i = 0; i < config.perpage.length; i++) { var key = config.perpage[i]; @@ -747,15 +747,15 @@ function mkws_mobile_resize () { $("#" + list[i]).hide(); } - $("#termlist").parent().hide(); - obj = $("#termlist").parent().html(); - $("#mkwsTermlist").html("
" + obj); + $("#mkwsTermlists").parent().hide(); + obj = $("#mkwsTermlists").parent().html(); + $("#mkwsShiftedTermlists").html("
" + obj); } else { for(var i = 0; i < list.length; i++) { $("#" + list[i]).show(); } - $("#termlist").parent().show(); - $("#mkwsTermlist").html(""); + $("#mkwsTermlists").parent().show(); + $("#mkwsShiftedTermlists").html(""); } }; @@ -787,7 +787,7 @@ jQuery.extend({
\
\
\ -