Aude has uploaded a new change for review.
https://gerrit.wikimedia.org/r/142504
Change subject: extract creation of the data object in _initDefaultSource to
seperate method
......................................................................
extract creation of the data object in _initDefaultSource to seperate method
Change-Id: I900baeeea42e78d24f4949704429bb91feb8d791
---
M lib/resources/jquery.wikibase/jquery.wikibase.entityselector.js
1 file changed, 18 insertions(+), 10 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/04/142504/1
diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.entityselector.js
b/lib/resources/jquery.wikibase/jquery.wikibase.entityselector.js
index 135ebc0..e5e149b 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.entityselector.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.entityselector.js
@@ -171,6 +171,23 @@
},
/**
+ * Create and return the data object for the api call.
+ * @param {string} term
+ * @return {object}
+ */
+ _getData: function( term ) {
+ return {
+ action: 'wbsearchentities',
+ search: term,
+ format: 'json',
+ language: this.options.language,
+ type: this.options.type,
+ 'continue': this._cache[term] &&
this._cache[term].nextSuggestionOffset
+ ? this._cache[term].nextSuggestionOffset : 0
+ };
+ },
+
+ /**
* Initializes the default source pointing the the
"wbsearchentities" API module via the
* URL provided in the options.
*
@@ -182,16 +199,7 @@
return function( term ) {
var deferred = $.Deferred();
- var data = {
- action: 'wbsearchentities',
- search: term,
- format: 'json',
- language: self.options.language,
- type: self.options.type,
- 'continue': self._cache[term] &&
self._cache[term].nextSuggestionOffset
- ?
self._cache[term].nextSuggestionOffset
- : 0
- };
+ var data = self._getData( term );
if( self.options.limit ) {
$.extend( data, {
--
To view, visit https://gerrit.wikimedia.org/r/142504
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I900baeeea42e78d24f4949704429bb91feb8d791
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: mw1.24-wmf8
Gerrit-Owner: Aude <[email protected]>
Gerrit-Reviewer: Alexander.lehmann
<[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits