diff --git a/scholia/app/static/scholia.js b/scholia/app/static/scholia.js index 07fac0772..f560e4311 100644 --- a/scholia/app/static/scholia.js +++ b/scholia/app/static/scholia.js @@ -208,8 +208,7 @@ function addReloadButton(element, callback) { } } -function sparqlToResponse(sparql, doneCallback) { - var endpointUrl = "https://query.wikidata.org/bigdata/namespace/wdq/sparql"; +function sparqlToResponse2(endpointUrl, sparql, doneCallback) { var settings = { headers: { Accept: "application/sparql-results+json" }, data: { query: sparql }, @@ -218,6 +217,14 @@ function sparqlToResponse(sparql, doneCallback) { } +function sparqlToResponse(sparql, doneCallback) { + return sparqlToResponse2( + "https://query.wikidata.org/bigdata/namespace/wdq/sparql", + sparql, doneCallback + ); +} + + function sparqlDataToSimpleData(response) { // Convert long JSON data from from SPARQL endpoint to short form let data = response.results.bindings; @@ -235,10 +242,20 @@ function sparqlDataToSimpleData(response) { function sparqlToDataTablePost(sparql, element, filename, options = {}) { + sparqlToDataTablePost2( + "https://query.wikidata.org/sparql", + "https://query.wikidata.org/", + sparql, element, filename, options + ); +} + + +function sparqlToDataTablePost2(url, editURL, sparql, element, filename, options = {}) { // Options: paging= + if (!url) url = "https://query.wikidata.org/sparql"; + if (!editURL) editURL = "https://query.wikidata.org/"; var paging = (typeof options.paging === 'undefined') ? true : options.paging; var sDom = (typeof options.sDom === 'undefined') ? 'lfrtip' : options.sDom; - var url = "https://query.wikidata.org/sparql"; $(element).html("