support multiple disambiguations

pull/52/head
Kai Labusch 5 years ago
parent 026d73c7f9
commit 6f2c28de6e

@ -565,21 +565,32 @@ function setupInterface(data, file, urls) {
if (column == 'ID') { if (column == 'ID') {
fillAction = fillAction =
function(td,content) { function(td,content) {
if (String(content).match(/^Q[0-9]+$/g) == null) { if (String(content).match(/^Q[0-9]+.*/g) == null) {
td.text(content); td.text(content);
} }
else { else {
td.html(""); td.html("");
let link = $('<a href="https://www.wikidata.org/wiki/' + content + '">' + var reg = /.*?(Q[0-9]+).*?/g;
content + "</a>") var result;
link.click( let count = 0;
function(event) { while((element = reg.exec(content)) !== null) {
event.stopPropagation();
} if (count > 2) break;
);
console.log(element);
td.append(link); let link = $('<a href="https://www.wikidata.org/wiki/' + element[1] + '">' +
element[1] + "</a>")
link.click(
function(event) {
event.stopPropagation();
}
);
td.append(link);
td.append($("<br>"))
count++;
}
} }
} }
} }

Loading…
Cancel
Save