diff --git a/languages/en.ini b/languages/en.ini index c7306d9616a772232dfe77d6e8c34aa45d14eaa0..0909d0b98b1cebcd0af571786aa7788c8c369ef4 100644 --- a/languages/en.ini +++ b/languages/en.ini @@ -553,6 +553,7 @@ More options = "More options" More Summon results = "More Summon results" More Topics = "More Topics" more_info_toggle = "Show/hide more info." +more_topics = "%%count%% more topics" Most Recent Received Issues = "Most Recent Received Issues" Multiple Call Numbers = "Multiple Call Numbers" Multiple Locations = "Multiple Locations" @@ -635,6 +636,7 @@ old_password = "Old Password" On Reserve = "On Reserve" On Reserve - Ask at Circulation Desk = "On Reserve - Ask at Circulation Desk" on_reserve = "Reserves - Ask at Circulation" +on_topic = "%%count%% item(s) on this topic" Online Access = "Online Access" online_resources = "Full Text" operator_contains = "contains" diff --git a/themes/blueprint/templates/Recommend/VisualFacets.phtml b/themes/blueprint/templates/Recommend/VisualFacets.phtml index d58c2acf216b65c2a61ed30b191195b658c0c160..301e0e5d75cdbab1e346d160a7107ab349be82a5 100644 --- a/themes/blueprint/templates/Recommend/VisualFacets.phtml +++ b/themes/blueprint/templates/Recommend/VisualFacets.phtml @@ -172,7 +172,7 @@ pivotdata.children[facetindex].children = resizedData; var more = new Object(); - more.name = "<?=$this->transEsc('More topics')?>"; + more.name = "<?=$this->transEsc('More Topics')?>"; more.size = morefacet/totalbyfirstpivot * facetdata.size; more.field = "topic_facet"; more.count = morecount; @@ -186,15 +186,15 @@ .data(treemap.nodes) .enter().append("a") .attr("href", function(d) { - if (d.parentlevel && d.name != "<?=$this->transEsc('More topics')?>") { + if (d.parentlevel && d.name != "<?=$this->transEsc('More Topics')?>") { return window.location + "&filter[]=" + d.field + ":\"" + d.name + "\"&filter[]=callnumber-first:\"" + d.parentlevel + "\"&view=list"; - } else if (d.name == "More topics") { + } else if (d.name == "<?=$this->transEsc('More Topics')?>") { return window.location + "&filter[]=callnumber-first:\"" + d.parentlevel + "\""; } else if (d.name != "theData") { return window.location + "&filter[]=" + d.field + ":\"" + d.name + "\""; } }) - .append("div") + .append("div") .attr("class", function(d) { return d.field == "callnumber-first" ? "node toplevel" : "node secondlevel" }) .attr("id", function(d) { return d.name.replace(/\s+/g, ''); }) .call(position) @@ -204,7 +204,9 @@ .attr("tabindex", 0) .append("div") .call(settext) - .attr("class", function(d) { return d.children ? "label" : "notalabel";} ); + .attr("class", function(d) { return d.children ? "label" : "notalabel";} ) + .insert("div") + .call(setscreenreader); } }); @@ -220,20 +222,28 @@ function settext() { this.text(function(d) { if (!d.children && d.field == "callnumber-first") {return "";} if (d.field == "callnumber-first") {return d.name + " (" + d.count + ")"; } - if (d.field == "topic_facet" && d.name == "<?=$this->transEsc('More topics')?>") {return d.name + " (" + d.count + " <?=$this->transEsc('other topics')?>)"; } + if (d.field == "topic_facet" && d.name == "<?=$this->transEsc('More Topics')?>") {var topics = "<?=$this->translate('more_topics')?>"; return topics.replace("%%count%%", d.count); } if (d.field == "topic_facet") {return d.name + " (" + d.count + ")"; } }); } -function settitle() { - this.attr("title", function(d) { - if (d.field == "callnumber-first" && d.count == "1") {return d.name + " (" + d.count + " item total)"; } - if (d.field == "callnumber-first") {return d.name + " (" + d.count + " items total)"; } - if (d.field == "topic_facet" && d.name == "More topics") {return d.name + " (" + d.count + " other topics)"; } - if (d.field == "topic_facet" && d.count == "1") {return d.name + " (" + d.count + " item on this topic)"; } - if (d.field == "topic_facet") {return d.name + " (" + d.count + " items on this topic)"; } - }); +function setscreenreader() { + this.attr("class", "offscreen") + .text(function(d) { + if (d.field == "topic_facet") { + return "<?=$this->transEsc('From')?> " + d.parentlevel; + } else { + return ""; + } + }); +} +function settitle() { + this.attr("title", function(d) { + if (d.field == "callnumber-first") {return d.name + " (" + d.count + " <?=$this->transEsc('items')?>)"; } + if (d.field == "topic_facet" && d.name == "<?=$this->transEsc('More Topics')?>") {var topics = "<?=$this->translate('more_topics')?>"; return topics.replace("%%count%%", d.count); } + if (d.field == "topic_facet") {var on_topic = "<?=$this->translate('on_topic')?>"; return d.name + " (" + on_topic.replace("%%count%%", d.count) + ")"; } + }); } </script> diff --git a/themes/bootstrap3/templates/Recommend/VisualFacets.phtml b/themes/bootstrap3/templates/Recommend/VisualFacets.phtml index 9e50474abb46474b8e97b43fa146a3ed961d9f5d..cf6fdd55dffb435b0b45cccc480136d5368e2931 100644 --- a/themes/bootstrap3/templates/Recommend/VisualFacets.phtml +++ b/themes/bootstrap3/templates/Recommend/VisualFacets.phtml @@ -155,7 +155,7 @@ //If we're keeping the "More" facet, let's size it properly pivotdata.children[facetindex].children = resizedData; var more = new Object(); - more.name = "<?=$this->transEsc('More topics')?>"; + more.name = "<?=$this->transEsc('More Topics')?>"; more.size = morefacet/totalbyfirstpivot * facetdata.size; more.field = "topic_facet"; more.count = morecount; @@ -169,9 +169,9 @@ .data(treemap.nodes) .enter().append("a") .attr("href", function(d) { - if (d.parentlevel && d.name != "<?=$this->transEsc('More topics')?>") { + if (d.parentlevel && d.name != "<?=$this->transEsc('More Topics')?>") { return window.location + "&filter[]=" + d.field + ":\"" + d.name + "\"&filter[]=callnumber-first:\"" + d.parentlevel + "\"&view=list"; - } else if (d.name == "More topics") { + } else if (d.name == "<?=$this->transEsc('More Topics')?>") { return window.location + "&filter[]=callnumber-first:\"" + d.parentlevel + "\""; } else if (d.name != "theData") { return window.location + "&filter[]=" + d.field + ":\"" + d.name + "\""; @@ -187,8 +187,10 @@ .attr("tabindex", 0) .append("div") .call(settext) - .attr("class", function(d) { return d.children ? "label" : "notalabel";} ); - } + .attr("class", function(d) { return d.children ? "label" : "notalabel";} ) + .insert("div") + .call(setscreenreader); + } }); function position() { @@ -202,18 +204,27 @@ function settext() { this.text(function(d) { if (!d.children && d.field == "callnumber-first") {return "";} if (d.field == "callnumber-first") {return d.name + " (" + d.count + ")"; } - if (d.field == "topic_facet" && d.name == "<?=$this->transEsc('More topics')?>") {return d.name + " (" + d.count + " <?=$this->transEsc('other topics')?>)"; } + if (d.field == "topic_facet" && d.name == "<?=$this->transEsc('More Topics')?>") {var topics = "<?=$this->translate('more_topics')?>"; return topics.replace("%%count%%", d.count); } if (d.field == "topic_facet") {return d.name + " (" + d.count + ")"; } }); } +function setscreenreader() { + this.attr("class", "sr-only") + .text(function(d) { + if (d.field == "topic_facet") { + return "<?=$this->transEsc('From')?> " + d.parentlevel; + } else { + return ""; + } + }); +} + function settitle() { this.attr("title", function(d) { - if (d.field == "callnumber-first" && d.count == "1") {return d.name + " (" + d.count + " item total)"; } - if (d.field == "callnumber-first") {return d.name + " (" + d.count + " items total)"; } - if (d.field == "topic_facet" && d.name == "More topics") {return d.name + " (" + d.count + " other topics)"; } - if (d.field == "topic_facet" && d.count == "1") {return d.name + " (" + d.count + " item on this topic)"; } - if (d.field == "topic_facet") {return d.name + " (" + d.count + " items on this topic)"; } + if (d.field == "callnumber-first") {return d.name + " (" + d.count + " <?=$this->transEsc('items')?>)"; } + if (d.field == "topic_facet" && d.name == "<?=$this->transEsc('More Topics')?>") {return d.count + " <?=$this->transEsc('More Topics')?>"; } + if (d.field == "topic_facet") {var on_topic = "<?=$this->translate('on_topic')?>"; return d.name + " (" + on_topic.replace("%%count%%", d.count) + ")"; } }); }