Yurik has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/374111 )
Change subject: expose sample url vars for overriding ...................................................................... expose sample url vars for overriding The hardcoded Wikidata sample URLs need to be overridable in order to be used on other sites. This is just a first step - eventually we should make them globally configurable, but I think we would greatly benefit from ES6 refactoring first. Change-Id: I8041dbfb0b9599287edda04ff9a21cf91693c0b0 --- M wikibase/queryService/api/QuerySamples.js 1 file changed, 7 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui refs/changes/11/374111/1 diff --git a/wikibase/queryService/api/QuerySamples.js b/wikibase/queryService/api/QuerySamples.js index 1485e58..687e5ee 100644 --- a/wikibase/queryService/api/QuerySamples.js +++ b/wikibase/queryService/api/QuerySamples.js @@ -5,11 +5,6 @@ wikibase.queryService.api.QuerySamples = ( function ( $ ) { 'use strict'; - var API_SERVER = 'https://www.wikidata.org/', - API_ENDPOINT = API_SERVER + 'api/rest_v1/page/html/', - PAGE_TITLE = 'Wikidata:SPARQL_query_service/queries/examples', - PAGE_URL = API_SERVER + 'wiki/' + PAGE_TITLE; - /** * QuerySamples API for the Wikibase query service * @@ -22,6 +17,10 @@ */ function SELF( language ) { this._language = language; + this.API_SERVER = 'https://www.wikidata.org/'; + this.API_ENDPOINT = this.API_SERVER + 'api/rest_v1/page/html/'; + this.PAGE_TITLE = 'Wikidata:SPARQL_query_service/queries/examples'; + this.PAGE_URL = this.API_SERVER + 'wiki/' + this.PAGE_TITLE; } /** @@ -37,12 +36,12 @@ var self = this; return $.ajax( { - url: API_ENDPOINT + encodeURIComponent( PAGE_TITLE + '/' + self._language ) + '?redirect=false', + url: self.API_ENDPOINT + encodeURIComponent( self.PAGE_TITLE + '/' + self._language ) + '?redirect=false', dataType: 'html' } ).catch( function() { // retry without language return $.ajax( { - url: API_ENDPOINT + encodeURIComponent( PAGE_TITLE ) + '?redirect=false', + url: self.API_ENDPOINT + encodeURIComponent( self.PAGE_TITLE ) + '?redirect=false', dataType: 'html' } ); } ).then( function ( data ) { @@ -136,7 +135,7 @@ return { title: title, query: query, - href: PAGE_URL + '#' + encodeURIComponent( title.replace( / /g, '_' ) ).replace( /%/g, '.' ), + href: this.PAGE_URL + '#' + encodeURIComponent( title.replace( / /g, '_' ) ).replace( /%/g, '.' ), tags: self._extractTagsFromSPARQL( query ), category: self._findPrevHeader( titleEl ).text().trim() }; -- To view, visit https://gerrit.wikimedia.org/r/374111 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8041dbfb0b9599287edda04ff9a21cf91693c0b0 Gerrit-PatchSet: 1 Gerrit-Project: wikidata/query/gui Gerrit-Branch: master Gerrit-Owner: Yurik <yuriastrak...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits