Skip to content
4 changes: 2 additions & 2 deletions config/_default/params.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[main]
aosAssetsVersion = "4.0.1"
jctAssetsVersion = "4.0.1"
aosAssetsVersion = "4.0.2"
jctAssetsVersion = "4.0.2"
feedbackButton = "Send us feedback"
alert = "The information provided by the <em>Journal Checker Tool</em> represents cOAlition S’s current understanding in relation to the policies of the journals contained within it. We will endeavour to keep it up to date and accurate, but we do not accept any liability in relation to any errors or omissions."
comingSoon = "Coming Soon"
Expand Down
2 changes: 1 addition & 1 deletion static/js/detailed_results.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ jct._yourQuery = (q) => {
}
}

let issns = jct.chosen.journal.issn.join(", ");
let issns = jct.chosen.journal.issns.join(", ");
let publisher = jct.chosen.journal.publisher !== undefined ? jct.chosen.journal.publisher : jct.lang.explain.your_query.publisher_not_known;

let journal = jct.lang.explain.your_query.journal_title_unknown;
Expand Down
38 changes: 29 additions & 9 deletions static/js/jct.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,25 @@ jct.d.toggle_detailed_results = () => {
}
}

jct.suggest_prepare = (txt, stop_words) => {
txt = txt.toLowerCase().trim();
for (let sw of stop_words) {
let fullThing = new RegExp("^" + sw + "$");
let atEnd = new RegExp(" " + sw + "$");
let atStart = new RegExp("^" + sw + " ");
let inMiddle = new RegExp(" " + sw + " ");

txt = txt.replace(fullThing, "").replace(atEnd, "").replace(atStart, "").replace(inMiddle, " ")
}
while (true) {
if (!(txt.includes(" "))) {
break
}
txt.replace(" ", " ")
}
return txt
}

//////////////////////////////////////////////////////////
// Initialisation

Expand Down Expand Up @@ -836,13 +855,13 @@ jct.setup = (manageUrl=true) => {
autocomplete: "off"
},
options : function(text, callback) {
let effectiveTextLength = text.length;
let pattern = /[0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9xX]/;
if (pattern.test(text)) {
text = text.toUpperCase();
} else {
text = text.toLowerCase().replace(' of','').replace('the ','');
if (!pattern.test(text)) {
let effective_text = jct.suggest_prepare(text, ["of", "the", "and", "journa", "journal"])
effectiveTextLength = effective_text.length;
}
if (text.length > 1) {
if (effectiveTextLength >= 3) {
let ourcb = (xhr) => {
let js = JSON.parse(xhr.response);
callback(js.data);
Expand All @@ -852,7 +871,7 @@ jct.setup = (manageUrl=true) => {
},
optionsTemplate : function(obj) {
let t = obj.title;
let issns = obj.issn.join(", ");
let issns = obj.issns.join(", ");
let publisher = obj.publisher;
let frag = "<a class='optionsTemplate'>";

Expand All @@ -871,7 +890,7 @@ jct.setup = (manageUrl=true) => {
},
selectedTemplate : function(obj) {
let t = obj.title;
let issns = obj.issn;
let issns = obj.issns;
let publisher = obj.publisher;

let frag = "";
Expand Down Expand Up @@ -967,8 +986,9 @@ jct.setup = (manageUrl=true) => {
autocomplete: "off"
},
options : function(text, callback) {
text = text.toLowerCase().replace(' of','').replace('the ','');
if (text.length > 1) {
let effective_text = jct.suggest_prepare(text, ["of", "the", "and", "universi", "universit", "university"])
let effectiveTextLength = effective_text.length;
if (effectiveTextLength >= 3) {
let ourcb = (xhr) => {
let js = JSON.parse(xhr.response);
callback(js.data);
Expand Down
34 changes: 26 additions & 8 deletions static/js/jct_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,21 @@ jct.d.toggle_detailed_results = () => {
}
}

jct.suggest_prepare = (txt, stop_words) => {
txt = txt.toLowerCase().trim();
for (let sw of stop_words) {
// FIXME: need to make the second and third only replace at the start and the end
txt = txt.replace(" " + sw + " ", " ").replace(sw + " ", "").replace(" " + sw, "")
}
while (true) {
if (!(txt.includes(" "))) {
break
}
txt.replace(" ", " ")
}
return txt
}

//////////////////////////////////////////////////////////
// Initialisation

Expand Down Expand Up @@ -1174,23 +1189,26 @@ jct.setup = (manageUrl=true) => {
autocomplete: "off"
},
options : function(text, callback) {
let effectiveTextLength = text.length;
let pattern = /[0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9xX]/;
if (pattern.test(text)) {
text = text.toUpperCase();
} else {
text = text.toLowerCase().replace(' of','').replace('the ','');
if (!pattern.test(text)) {
// let effective_text = text.toLowerCase().replace(' of','').replace('the ','');
let effective_text = jct.suggest_prepare(text, ["of", "the", "and", "journa", "journal"])
effectiveTextLength = effective_text.length
// text = text.toLowerCase().replace(' of','').replace('the ','');
}
if (text.length > 1) {
if (effectiveTextLength > 3) {
let ourcb = (xhr) => {
let js = JSON.parse(xhr.response);
callback(js.data);
}
// jct.jx('suggest/journal/'+text, false, ourcb);
jct.jx('suggest/journal/'+text, false, ourcb);
}
},
optionsTemplate : function(obj) {
let t = obj.title;
let issns = obj.issn.join(", ");
let issns = obj.issns.join(", ");
let publisher = obj.publisher;
let frag = "<a class='optionsTemplate'>";

Expand All @@ -1209,7 +1227,7 @@ jct.setup = (manageUrl=true) => {
},
selectedTemplate : function(obj) {
let t = obj.title;
let issns = obj.issn;
let issns = obj.issns;
let publisher = obj.publisher;

let frag = "";
Expand Down Expand Up @@ -1305,7 +1323,7 @@ jct.setup = (manageUrl=true) => {
autocomplete: "off"
},
options : function(text, callback) {
text = text.toLowerCase().replace(' of','').replace('the ','');
text = text.toLowerCase(); //.replace(' of','').replace('the ','');
if (text.length > 1) {
let ourcb = (xhr) => {
let js = JSON.parse(xhr.response);
Expand Down