Skip to content

Commit ab53058

Browse files
committed
More whitespace harmonization
1 parent 8626f06 commit ab53058

File tree

1 file changed

+49
-49
lines changed

1 file changed

+49
-49
lines changed

scholia/app/static/scholia.js

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -96,63 +96,63 @@ function convertDataTableData(data, columns) {
9696
}
9797
}
9898
for (var i = 0 ; i < data.length ; i++) {
99-
var convertedRow = {};
100-
for (var key in data[i]) {
101-
if (key.slice(-11) == 'Description') {
102-
convertedRow[key.slice(0, key.length - 11) + ' description'] = data[i][key];
99+
var convertedRow = {};
100+
for (var key in data[i]) {
101+
if (key.slice(-11) == 'Description') {
102+
convertedRow[key.slice(0, key.length - 11) + ' description'] = data[i][key];
103103

104-
} else if (
105-
key + 'Label' in data[i] &&
104+
} else if (
105+
key + 'Label' in data[i] &&
106106
key + 'Url' in data[i]
107-
) {
107+
) {
108108
convertedRow[key] = '<a href="' +
109-
data[i][key + 'Url'] +
110-
'">' + data[i][key + 'Label'] + '</a>';
109+
data[i][key + 'Url'] +
110+
'">' + data[i][key + 'Label'] + '</a>';
111111

112-
} else if (key.slice(-17) == 'ChemicalStructure') {
112+
} else if (key.slice(-17) == 'ChemicalStructure') {
113113
convertedRow[key.slice(0, key.length - 17) + ' structure'] = '<img loading="lazy" src="' +
114114
'https://cdkdepict.toolforge.org/depict/bow/svg?smi=' +
115-
encodeURIComponent(data[i][key]) +
115+
encodeURIComponent(data[i][key]) +
116116
'&abbr=on&hdisp=bridgehead&showtitle=false&zoom=2&annotate=cip' +
117-
'" />';
117+
'" />';
118118

119-
} else if (
120-
key + 'Label' in data[i] &&
121-
/^http/.test(data[i][key]) &&
122-
data[i][key].length > 30
123-
) {
124-
convertedRow[key] = '<a href="../' +
125-
data[i][key].slice(31) +
126-
'">' + data[i][key + 'Label'] + '</a>';
119+
} else if (
120+
key + 'Label' in data[i] &&
121+
/^http/.test(data[i][key]) &&
122+
data[i][key].length > 30
123+
) {
124+
convertedRow[key] = '<a href="../' +
125+
data[i][key].slice(31) +
126+
'">' + data[i][key + 'Label'] + '</a>';
127127

128128
} else if (key.slice(-5) == 'Label') {
129-
// pass
130-
131-
} else if (key + 'Url' in data[i]) {
132-
convertedRow[key] = '<a href="' +
133-
data[i][key + 'Url'] +
134-
'">' + data[i][key] + '</a>';
135-
136-
} else if (key.slice(-3) == 'Url') {
137-
// pass
138-
139-
} else if (key.slice(-3) == 'url') {
140-
// Convert URL to a link
141-
convertedRow[key] = "<a href='" +
142-
data[i][key] + "'>" +
143-
$("<div>").text(data[i][key]).html() + '</a>';
144-
145-
} else if (key == 'orcid') {
146-
// Add link to ORCID website
147-
convertedRow[key] = '<a href="https://orcid.org/' +
148-
data[i][key] + '">' +
149-
data[i][key] + '</a>';
150-
151-
} else if (key == 'doi') {
152-
// Add link to Crossref
153-
convertedRow[key] = '<a href="https://doi.org/' +
154-
encodeURIComponent(data[i][key]) + '">' +
155-
$("<div>").text(data[i][key]).html() + '</a>';
129+
// pass
130+
131+
} else if (key + 'Url' in data[i]) {
132+
convertedRow[key] = '<a href="' +
133+
data[i][key + 'Url'] +
134+
'">' + data[i][key] + '</a>';
135+
136+
} else if (key.slice(-3) == 'Url') {
137+
// pass
138+
139+
} else if (key.slice(-3) == 'url') {
140+
// Convert URL to a link
141+
convertedRow[key] = "<a href='" +
142+
data[i][key] + "'>" +
143+
$("<div>").text(data[i][key]).html() + '</a>';
144+
145+
} else if (key == 'orcid') {
146+
// Add link to ORCID website
147+
convertedRow[key] = '<a href="https://orcid.org/' +
148+
data[i][key] + '">' +
149+
data[i][key] + '</a>';
150+
151+
} else if (key == 'doi') {
152+
// Add link to Crossref
153+
convertedRow[key] = '<a href="https://doi.org/' +
154+
encodeURIComponent(data[i][key]) + '">' +
155+
$("<div>").text(data[i][key]).html() + '</a>';
156156

157157
} else {
158158
var convertedRowValue = data[i][key];
@@ -282,7 +282,7 @@ function sparqlToDataTablePost2(url, editURL, sparql, element, filename, options
282282
};
283283
columns.push(column);
284284
}
285-
285+
286286
if (convertedData.data.length <= 10) {
287287
paging = false;
288288
}
@@ -364,7 +364,7 @@ function sparqlToDataTable2(url, editURL, sparql, element, filename, options = {
364364
var paging = (typeof options.paging === 'undefined') ? true : options.paging;
365365
var sDom = (typeof options.sDom === 'undefined') ? 'lfrtip' : options.sDom;
366366
var sparqlEndpointName = (typeof options.sparqlEndpointName === 'undefined')
367-
? window.jsConfig.sparqlEndpointName : options.sparqlEndpointName;
367+
? window.jsConfig.sparqlEndpointName : options.sparqlEndpointName;
368368

369369
// overwrite the central URLs of SPARQL specific URLs are found
370370
configFromSPARQL = extractConfig(sparql);

0 commit comments

Comments
 (0)