dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Revert "Make mw.widgets.SearchInputWidget extend OO.ui.SearchInputWidget""
[lhc/web/wiklou.git]
/
resources
/
src
/
mediawiki.widgets
/
MediaSearch
/
mw.widgets.MediaSearchWidget.js
diff --git
a/resources/src/mediawiki.widgets/MediaSearch/mw.widgets.MediaSearchWidget.js
b/resources/src/mediawiki.widgets/MediaSearch/mw.widgets.MediaSearchWidget.js
index
5cbd2ec
..
08266f0
100644
(file)
--- a/
resources/src/mediawiki.widgets/MediaSearch/mw.widgets.MediaSearchWidget.js
+++ b/
resources/src/mediawiki.widgets/MediaSearch/mw.widgets.MediaSearchWidget.js
@@
-208,7
+208,7
@@
var queryValue = this.query.getValue().trim();
if ( queryValue.match( this.externalLinkUrlProtocolsRegExp ) ) {
var queryValue = this.query.getValue().trim();
if ( queryValue.match( this.externalLinkUrlProtocolsRegExp ) ) {
- queryValue = queryValue.match( /.+\/([^
\
/]+)/ )[ 1 ];
+ queryValue = queryValue.match( /.+\/([^/]+)/ )[ 1 ];
}
return queryValue;
};
}
return queryValue;
};
@@
-351,7
+351,7
@@
};
/**
};
/**
- * Respond to
add
results event in the results widget.
+ * Respond to
change
results event in the results widget.
* Override the way SelectWidget and GroupElement append the items
* into the group so we can append them in groups of rows.
*
* Override the way SelectWidget and GroupElement append the items
* into the group so we can append them in groups of rows.
*
@@
-374,6
+374,12
@@
// Go over the added items
row = search.getAvailableRow();
for ( i = 0, ilen = items.length; i < ilen; i++ ) {
// Go over the added items
row = search.getAvailableRow();
for ( i = 0, ilen = items.length; i < ilen; i++ ) {
+
+ // Check item has just been added
+ if ( items[ i ].row !== null ) {
+ continue;
+ }
+
itemWidth = items[ i ].$element.outerWidth( true );
// Add items to row until it is full
itemWidth = items[ i ].$element.outerWidth( true );
// Add items to row until it is full
@@
-408,6
+414,7
@@
// Append the item
search.rows[ row ].$element.append( items[ i ].$element );
// Append the item
search.rows[ row ].$element.append( items[ i ].$element );
+
}
// If we have less than 4 rows, call for more images
}
// If we have less than 4 rows, call for more images