jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/374107 )

Change subject: cleanup - regex single char alteration, css, ...
......................................................................


cleanup - regex single char alteration, css, ...

* "word-break: word-break" is invalid, switching to "normal"
* Assignments inside if statements are evil :)
* a regex capturing group for one char seems wrong

Change-Id: Iab7431daadcbea18d8171f0b3c7a760a4f4188f7
---
M wikibase/queryService/api/QuerySamples.js
M wikibase/queryService/api/Tracking.js
M wikibase/queryService/ui/QueryExampleDialog.js
3 files changed, 13 insertions(+), 13 deletions(-)

Approvals:
  Lucas Werkmeister (WMDE): Looks good to me, approved
  jenkins-bot: Verified



diff --git a/wikibase/queryService/api/QuerySamples.js 
b/wikibase/queryService/api/QuerySamples.js
index 1485e58..728a978 100644
--- a/wikibase/queryService/api/QuerySamples.js
+++ b/wikibase/queryService/api/QuerySamples.js
@@ -87,7 +87,7 @@
        };
 
        SELF.prototype._extractTagsFromSPARQL = function ( sparql ) {
-               var tags = sparql.replace( /\n/g, '' ).match( /(Q|P)[0-9]+/g );
+               var tags = sparql.replace( /\n/g, '' ).match( /[QP][0-9]+/g );
 
                if ( !tags ) {
                        return [];
diff --git a/wikibase/queryService/api/Tracking.js 
b/wikibase/queryService/api/Tracking.js
index 25a2111..844c93b 100644
--- a/wikibase/queryService/api/Tracking.js
+++ b/wikibase/queryService/api/Tracking.js
@@ -47,6 +47,7 @@
                }
 
                if ( location.hostname !== 'query.wikidata.org' ) {
+                       // FIXME: expected to return a promise
                        return;// only track on wikidata.org
                }
 
diff --git a/wikibase/queryService/ui/QueryExampleDialog.js 
b/wikibase/queryService/ui/QueryExampleDialog.js
index a84b989..208aad1 100644
--- a/wikibase/queryService/ui/QueryExampleDialog.js
+++ b/wikibase/queryService/ui/QueryExampleDialog.js
@@ -14,7 +14,7 @@
         * @license GNU GPL v2+
         *
         * @author Jonas Kress
-     * @author Florian Rämisch, <raemi...@ub.uni-leipzig.de>
+        * @author Florian Rämisch, <raemi...@ub.uni-leipzig.de>
         * @constructor
         *
         * @param {jQuery} $element
@@ -124,7 +124,7 @@
                        self._updateExamplesCount( examples.length );
 
                        $.each( examples, function( key, example ) {
-                               if ( example.category !==  category ) {
+                               if ( example.category !== category ) {
                                        category = example.category;
                                        self._$element.find( '.searchable' 
).append( $( '<tr>' ).addClass( 'active' )
                                                        .append( $( '<td 
colspan="4">' ).text( category ) ) );
@@ -156,8 +156,9 @@
                        jQCloudTags = [];
 
                this._getCloudTags().then( function ( tags ) {
+                       var tagCloud = $( '.tagCloud' );
                        $.each( tags, function ( i, tag ) {
-                               var label =  tag.label + ' (' + tag.id + ')';
+                               var label = tag.label + ' (' + tag.id + ')';
 
                                jQCloudTags.push( {
                                        text: label,
@@ -178,11 +179,11 @@
                        } );
 
                        if ( redraw ) {
-                               $( '.tagCloud' ).jQCloud( 'update', jQCloudTags 
);
+                               tagCloud.jQCloud( 'update', jQCloudTags );
                                return;
                        }
 
-                       $( '.tagCloud' ).jQCloud( jQCloudTags, {
+                       tagCloud.jQCloud( jQCloudTags, {
                                delayedMode: true,
                                autoResize: true
                        } );
@@ -271,7 +272,7 @@
                                        trigger: 'hover',
                                        container: 'body',
                                        title: self._i18n( 
'wdqs-dialog-examples-preview-query', 'Preview query' ),
-                                       content: $( '<pre 
style="white-space:pre-line; word-break:break-word;"/>' ).text( query ),
+                                       content: $( '<pre 
style="white-space:pre-line; word-break:normal;"/>' ).text( query ),
                                        html: true
                                } ),
                        $preview = $( '<a href="#">' ).addClass( 'glyphicon 
glyphicon-camera' ).clickover(
@@ -281,7 +282,7 @@
                     'esc_close': true,
                                        trigger: 'click',
                                        container: 'body',
-                                       title: self._i18n( 
'wdqs-dialog-examples-preview-result', 'Preview result'  ),
+                                       title: self._i18n( 
'wdqs-dialog-examples-preview-result', 'Preview result' ),
                                        content: $( '<iframe width="400" 
height="350" frameBorder="0" src="' +
                                                        ( self._previewUrl || 
'embed.html#' ) + encodeURIComponent( query ) + '">' ),
                                        html: true
@@ -359,13 +360,11 @@
         * @private
         */
        SELF.prototype._i18n = function( key, message ) {
-               var i18nMessage = null;
-
-               if ( !$.i18n || ( i18nMessage = $.i18n( key ) ) === key ) {
+               if ( !$.i18n ) {
                        return message;
                }
-
-               return i18nMessage;
+               var i18nMessage = $.i18n( key );
+               return i18nMessage === key ? message : i18nMessage;
        };
 
        return SELF;

-- 
To view, visit https://gerrit.wikimedia.org/r/374107
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iab7431daadcbea18d8171f0b3c7a760a4f4188f7
Gerrit-PatchSet: 5
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Yurik <yuriastrak...@gmail.com>
Gerrit-Reviewer: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de>
Gerrit-Reviewer: Lucas Werkmeister (WMDE) <lucas.werkmeis...@wikimedia.de>
Gerrit-Reviewer: Smalyshev <smalys...@wikimedia.org>
Gerrit-Reviewer: Yurik <yuriastrak...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to