`
this.component.edge.context.before(frag);
- let offset = $(this.scrollTarget).offset().top
- window.scrollTo(0, offset);
+
+ if (this.scrollOnSearch) {
+ let offset = $(this.scrollTarget).offset().top
+ window.scrollTo(0, offset);
+ }
} else {
let that = this;
let idSelector = edges.css_id_selector(this.namespace, "loading", this);
@@ -4841,13 +5193,13 @@ $.extend(true, doaj, {
toggle = '';
}
var placeholder = 'Search ' + this.component.nodeCount + ' subjects';
- var frag = '
' + this.title + toggle + '
\
-
\
+ var frag = '
\
+
\
\
\
\
{{FILTERS}}
\
-
';
+
';
// substitute in the component parts
frag = frag.replace(/{{FILTERS}}/g, treeFrag);
@@ -5131,8 +5483,7 @@ $.extend(true, doaj, {
sortOptions = '
\
\
-
';
+ sortOptions += '\
+
';
}
// select box for fields to search on
@@ -5194,7 +5546,7 @@ $.extend(true, doaj, {
clearFrag = '
' + clearFrag + '
';
}
- var frag = searchBox + '
' + sortOptions + clearFrag + '
';
+ var frag = searchBox + '
' + sortOptions + clearFrag + '
';
comp.context.html(frag);
@@ -5274,13 +5626,14 @@ $.extend(true, doaj, {
};
this.setUISortField = function () {
+ let sb = this.component.sortBy
if (!this.component.sortBy) {
- return;
+ sb = "_score";
}
// get the selector we need
var sortSelector = edges.css_class_selector(this.namespace, "sortby", this);
var el = this.component.jq(sortSelector);
- el.val(this.component.sortBy);
+ el.val(sb);
};
this.setUISearchField = function () {
@@ -5497,15 +5850,15 @@ $.extend(true, doaj, {
var comp = this.component;
- var shareButtonFrag = "";
var shareButtonClass = edges.css_classes(this.namespace, "toggle-share", this);
var modalId = edges.css_id(this.namespace, "modal", this);
- shareButtonFrag = '';
+ let shareButtonFrag = '';
- var shorten = "";
+ let shorten = "";
if (this.component.urlShortener) {
var shortenClass = edges.css_classes(this.namespace, "shorten", this);
- shorten = '
Share a link to this search
'
+ var shortenButtonClass = edges.css_classes(this.namespace, "shorten-url", this)
+ shorten = '';
}
var embed = "";
if (this.component.embedSnippet) {
@@ -5515,11 +5868,11 @@ $.extend(true, doaj, {
}
var shareBoxClass = edges.css_classes(this.namespace, "share", this);
var shareUrlClass = edges.css_classes(this.namespace, "share-url", this);
- var shortenButtonClass = edges.css_classes(this.namespace, "shorten-url", this);
+
var shareFrag = '
\
- ' + shorten + '\
+
Share a link to this search
\
\
- \
+ ' + shorten + '\
' + embed + '\
';
@@ -5746,13 +6099,12 @@ $.extend(true, doaj, {
var textIdSelector = edges.css_id_selector(this.namespace, "text", this);
var text = this.component.jq(textIdSelector).val();
- if (text === "") {
- return;
- }
-
// if there is search text, then proceed to run the search
var val = this.component.jq(element).val();
this.component.setSearchField(val, false);
+ if (text === "") {
+ return;
+ }
this.component.setSearchText(text);
};
@@ -6028,10 +6380,10 @@ $.extend(true, doaj, {
if (this.togglable) {
toggle = '';
}
- var frag = '
' + this.component.display + toggle + '
\
-
\
+ var frag = '
\
+
\
{{FILTERS}}
\
-
';
+
';
// substitute in the component parts
frag = frag.replace(/{{FILTERS}}/g, filterFrag + results);
@@ -6075,7 +6427,7 @@ $.extend(true, doaj, {
//var i = toggle.find("i");
//for (var j = 0; j < openBits.length; j++) {
// i.removeClass(openBits[j]);
- // }
+ // }
//for (var j = 0; j < closeBits.length; j++) {
// i.addClass(closeBits[j]);
//}
@@ -6087,9 +6439,9 @@ $.extend(true, doaj, {
//var i = toggle.find("i");
//for (var j = 0; j < closeBits.length; j++) {
// i.removeClass(closeBits[j]);
- // }
+ // }
//for (var j = 0; j < openBits.length; j++) {
- // i.addClass(openBits[j]);
+ // i.addClass(openBits[j]);
//}
//results.hide();
@@ -6135,6 +6487,7 @@ $.extend(true, doaj, {
// whether to hide or just disable the facet if not active
this.hideInactive = edges.getParam(params.hideInactive, false);
+ this.hideEmpty = edges.getParam(params.hideEmpty, false)
// whether the facet should be open or closed
// can be initialised and is then used to track internal state
@@ -6199,6 +6552,9 @@ $.extend(true, doaj, {
// render each value, if it is not also a filter that has been set
for (var i = 0; i < ts.values.length; i++) {
var val = ts.values[i];
+ if (val.count === 0 && this.hideEmpty) {
+ continue
+ }
if ($.inArray(val.display, filterTerms) === -1) {
var ltData = "";
@@ -6275,10 +6631,10 @@ $.extend(true, doaj, {
if (this.togglable) {
toggle = '';
}
- var frag = '
' + this.component.display + toggle + '
\
-
\
+ var frag = '
\
+
\
{{FILTERS}}
\
-
';
+
';
// substitute in the component parts
frag = frag.replace(/{{FILTERS}}/g, filterFrag + results);
@@ -6333,7 +6689,7 @@ $.extend(true, doaj, {
//var i = toggle.find("i");
//for (var j = 0; j < openBits.length; j++) {
// i.removeClass(openBits[j]);
- // }
+ // }
//for (var j = 0; j < closeBits.length; j++) {
// i.addClass(closeBits[j]);
//}
@@ -6345,9 +6701,9 @@ $.extend(true, doaj, {
//var i = toggle.find("i");
//for (var j = 0; j < closeBits.length; j++) {
// i.removeClass(closeBits[j]);
- // }
+ // }
//for (var j = 0; j < openBits.length; j++) {
- // i.addClass(openBits[j]);
+ // i.addClass(openBits[j]);
//}
//results.hide();
@@ -6468,7 +6824,7 @@ $.extend(true, doaj, {
// the remove block looks different, depending on the kind of filter to remove
if (def.filter === "term" || def.filter === "terms") {
- filters += '';
+ filters += '';
filters += def.display + valDisplay;
filters += ' ';
filters += "";
@@ -6523,6 +6879,7 @@ $.extend(true, doaj, {
this.removeFilter = function (element) {
var el = this.component.jq(element);
+ var sf = this.component;
// if this is a compound filter, remove it by id
var compound = el.attr("data-compound");
@@ -6538,7 +6895,9 @@ $.extend(true, doaj, {
var value = false;
if (ft === "terms" || ft === "term") {
- value = el.attr("data-value");
+ let values = sf.mustFilters[field].values;
+ let idx = el.attr("data-value-idx")
+ value = values[idx].val
} else if (ft === "range") {
value = {};
@@ -6737,14 +7096,20 @@ $.extend(true, doaj, {
var seal = "";
if (edges.objVal("admin.seal", resultobj, false)) {
- seal = ''
+ seal = ''
if (this.widget){
- seal += ''
+ seal += ' DOAJ Seal'
}
else {
- seal += ''
+ seal += '\
+
DOAJ Seal
\
+ ';
}
- seal += ' DOAJ Seal';
}
var issn = resultobj.bibjson.pissn;
if (!issn) {
@@ -6775,9 +7140,9 @@ $.extend(true, doaj, {
// add the subjects
var subjects = "";
if (edges.hasProp(resultobj, "index.classification_paths") && resultobj.index.classification_paths.length > 0) {
- subjects = '
Journal subjects
';
- subjects += "
" + resultobj.index.classification_paths.join(",
") + "
";
- subjects += '
';
+ subjects = '
Journal subjects
';
+ subjects += "
" + resultobj.index.classification_paths.join(",
") + "
";
+ subjects += '
';
}
var update_or_added = "";
@@ -6814,6 +7179,15 @@ $.extend(true, doaj, {
}
apcs += '';
+ var rights = "";
+ if (resultobj.bibjson.copyright) {
+ var copyright_url = resultobj.bibjson.copyright.url;
+ rights += '';
+ rights += resultobj.bibjson.copyright.author_retains ? 'Author retains all rights' : 'Author doesn\'t retain all rights';
+ rights += '';
+ }
+
+
var licenses = "";
if (resultobj.bibjson.license && resultobj.bibjson.license.length > 0) {
var terms_url = resultobj.bibjson.ref.license_terms;
@@ -6821,7 +7195,7 @@ $.extend(true, doaj, {
var lic = resultobj.bibjson.license[i];
var license_url = lic.url || terms_url;
licenses += '' + edges.escapeHtml(lic.type) + '';
- if (i != (resultobj.bibjson.license.length-1)) {
+ if (i !== (resultobj.bibjson.license.length-1)) {
licenses += ', ';
}
}
@@ -6835,15 +7209,26 @@ $.extend(true, doaj, {
}
var actions = "";
+ var modals = "";
if (this.actions.length > 0) {
actions = '
Actions
';
for (var i = 0; i < this.actions.length; i++) {
var act = this.actions[i];
var actSettings = act(resultobj);
if (actSettings) {
+ let data = "";
+ if (actSettings.data) {
+ let dataAttrs = Object.keys(actSettings.data);
+ for(let j = 0; j < dataAttrs.length; j++) {
+ data += " data-" + dataAttrs[j] + "=" + actSettings.data[dataAttrs[j]];
+ }
+ }
actions += '