From: Mike Taylor Date: Fri, 24 Jan 2014 13:52:16 +0000 (+0000) Subject: Merge branch 'master' of ssh://git.indexdata.com/home/git/private/mkws X-Git-Tag: 1.0.0~1609 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=d184860c42c779063d3ce515ce625836d5451b2e;hp=19bfbdb9160d75459dc25ad708908c9d448f3512;p=mkws-moved-to-github.git Merge branch 'master' of ssh://git.indexdata.com/home/git/private/mkws --- diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index cce9148..e52e0f8 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -208,10 +208,17 @@ describe("Check Termlist", function () { it("limit search to first author", function () { var hits_all_targets = get_hit_counter(); var author_number = 2; // 2=first author - var author_name = $("div#mkwsFacetAuthors div.term:nth-child(" + author_number + ") a").text(); - // do not click on author with numbers, e.g.: Bower, James M. Beeman, David, 1938- - if (author_name.match(/[0-9].+[0-9]/)) { - author_number++; + // do not click on author with numbers, e.g.: "Bower, James M. Beeman, David, 1938-" + // do not click on author names without a comma, e.g.: "Joe Barbara" + var terms = $("div#mkwsFacetAuthors div.term a"); + for (var i = 0; i < terms.length; i++) { + var term = terms[i].text; + if (term.match(/[0-9].+[0-9]/i) || !term.match(/,/)) { + debug("ignore author facet: " + term); + author_number++; + } else { + break; + } } var click = $("div#mkwsFacetAuthors div.term:nth-child(" + author_number + ") a").trigger("click"); @@ -232,10 +239,15 @@ describe("Check Termlist", function () { it("limit search to first source", function () { var hits_all_targets = get_hit_counter(); var source_number = 2; // 2=first source - var source_name = $("div#mkwsFacetSources div.term:nth-child(" + source_number + ") a").text(); // do not click on wikipedia link - no author or subject facets possible - if (source_name.match(/wikipedia/i)) { - source_number++; + var terms = $("div#mkwsFacetSources div.term a"); + for (var i = 0; i < terms.length; i++) { + if (terms[i].text.match(/wikipedia/i)) { + debug("ignore source facet: " + terms[i].text); + source_number++; + } else { + break; + } } var click = $("div#mkwsFacetSources div.term:nth-child(" + source_number + ") a").trigger("click"); diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index 9f98f32..68892ea 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -1283,8 +1283,12 @@ function _mkws_jquery_plugin ($) { // wrapper to call _make_mkws_team() after page load (function (j) { function log(s) { - if (console && console.log) console.log(s); + if (typeof console === "undefined" || typeof console.log === "undefined") { /* ARGH!!! old IE */ + return; + } + console.log(s); } + // enable before page load, so we could call it before mkws() runs _mkws_jquery_plugin(j);