2015-06-05 20:17:55 +00:00
/ * *
2017-05-19 22:12:53 +00:00
* DO NOT EDIT THIS FILE .
* See the following change record for more information ,
2017-05-23 14:30:14 +00:00
* https : //www.drupal.org/node/2815083
2017-05-19 22:12:53 +00:00
* @ preserve
* * /
2015-06-05 20:17:55 +00:00
2021-08-10 10:05:02 +00:00
function _slicedToArray ( arr , i ) { return _arrayWithHoles ( arr ) || _iterableToArrayLimit ( arr , i ) || _unsupportedIterableToArray ( arr , i ) || _nonIterableRest ( ) ; }
function _nonIterableRest ( ) { throw new TypeError ( "Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ; }
function _unsupportedIterableToArray ( o , minLen ) { if ( ! o ) return ; if ( typeof o === "string" ) return _arrayLikeToArray ( o , minLen ) ; var n = Object . prototype . toString . call ( o ) . slice ( 8 , - 1 ) ; if ( n === "Object" && o . constructor ) n = o . constructor . name ; if ( n === "Map" || n === "Set" ) return Array . from ( o ) ; if ( n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/ . test ( n ) ) return _arrayLikeToArray ( o , minLen ) ; }
function _arrayLikeToArray ( arr , len ) { if ( len == null || len > arr . length ) len = arr . length ; for ( var i = 0 , arr2 = new Array ( len ) ; i < len ; i ++ ) { arr2 [ i ] = arr [ i ] ; } return arr2 ; }
2021-10-27 20:02:41 +00:00
function _iterableToArrayLimit ( arr , i ) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr [ Symbol . iterator ] || arr [ "@@iterator" ] ; if ( _i == null ) return ; var _arr = [ ] ; var _n = true ; var _d = false ; var _s , _e ; try { for ( _i = _i . call ( arr ) ; ! ( _n = ( _s = _i . next ( ) ) . done ) ; _n = true ) { _arr . push ( _s . value ) ; if ( i && _arr . length === i ) break ; } } catch ( err ) { _d = true ; _e = err ; } finally { try { if ( ! _n && _i [ "return" ] != null ) _i [ "return" ] ( ) ; } finally { if ( _d ) throw _e ; } } return _arr ; }
2021-08-10 10:05:02 +00:00
function _arrayWithHoles ( arr ) { if ( Array . isArray ( arr ) ) return arr ; }
Issue #2056089 by BarisW, TR, mgifford, rodvolpe, Dom., nambisolo, nod_, katewelling, Manjit.Singh, jhodgdon, Bojhan, Wim Leers: UI problems on the Modules/Extend page
2015-07-27 12:03:51 +00:00
( function ( $ , Drupal , debounce ) {
2014-01-27 21:41:32 +00:00
Drupal . behaviors . tableFilterByText = {
2017-05-19 22:12:53 +00:00
attach : function attach ( context , settings ) {
2021-08-10 10:05:02 +00:00
var _once = once ( 'table-filter-text' , 'input.table-filter-text' ) ,
_once2 = _slicedToArray ( _once , 1 ) ,
input = _once2 [ 0 ] ;
if ( ! input ) {
return ;
}
var $table = $ ( input . getAttribute ( 'data-table' ) ) ;
2020-01-30 09:08:38 +00:00
var $rowsAndDetails ;
var $rows ;
var $details ;
2014-03-24 14:55:57 +00:00
var searching = false ;
2014-07-02 18:48:06 +00:00
2014-01-27 21:41:32 +00:00
function hidePackageDetails ( index , element ) {
2014-05-24 13:59:54 +00:00
var $packDetails = $ ( element ) ;
Issue #2056089 by BarisW, TR, mgifford, rodvolpe, Dom., nambisolo, nod_, katewelling, Manjit.Singh, jhodgdon, Bojhan, Wim Leers: UI problems on the Modules/Extend page
2015-07-27 12:03:51 +00:00
var $visibleRows = $packDetails . find ( 'tbody tr:visible' ) ;
2014-05-24 13:59:54 +00:00
$packDetails . toggle ( $visibleRows . length > 0 ) ;
2013-02-09 00:41:02 +00:00
}
2014-01-27 21:41:32 +00:00
function filterModuleList ( e ) {
Issue #2056089 by BarisW, TR, mgifford, rodvolpe, Dom., nambisolo, nod_, katewelling, Manjit.Singh, jhodgdon, Bojhan, Wim Leers: UI problems on the Modules/Extend page
2015-07-27 12:03:51 +00:00
var query = $ ( e . target ) . val ( ) ;
2020-01-30 09:08:38 +00:00
var re = new RegExp ( "\\b" . concat ( query ) , 'i' ) ;
2014-01-27 21:41:32 +00:00
function showModuleRow ( index , row ) {
var $row = $ ( row ) ;
Issue #2056089 by BarisW, TR, mgifford, rodvolpe, Dom., nambisolo, nod_, katewelling, Manjit.Singh, jhodgdon, Bojhan, Wim Leers: UI problems on the Modules/Extend page
2015-07-27 12:03:51 +00:00
var $sources = $row . find ( '.table-filter-text-source, .module-name, .module-description' ) ;
var textMatch = $sources . text ( ) . search ( re ) !== - 1 ;
2014-01-27 21:41:32 +00:00
$row . closest ( 'tr' ) . toggle ( textMatch ) ;
}
2017-05-19 22:12:53 +00:00
2014-07-29 09:09:48 +00:00
$rowsAndDetails . show ( ) ;
2014-01-27 21:41:32 +00:00
if ( query . length >= 2 ) {
2014-03-24 14:55:57 +00:00
searching = true ;
2014-01-27 21:41:32 +00:00
$rows . each ( showModuleRow ) ;
2014-07-29 09:09:48 +00:00
$details . not ( '[open]' ) . attr ( 'data-drupal-system-state' , 'forced-open' ) ;
$details . attr ( 'open' , true ) . each ( hidePackageDetails ) ;
2018-08-09 15:49:18 +00:00
Drupal . announce ( Drupal . t ( '!modules modules are available in the modified list.' , {
'!modules' : $rowsAndDetails . find ( 'tbody tr:visible' ) . length
} ) ) ;
2017-05-19 22:12:53 +00:00
} else if ( searching ) {
2014-03-24 14:55:57 +00:00
searching = false ;
2014-01-27 21:41:32 +00:00
$rowsAndDetails . show ( ) ;
2017-05-19 22:12:53 +00:00
$details . filter ( '[data-drupal-system-state="forced-open"]' ) . removeAttr ( 'data-drupal-system-state' ) . attr ( 'open' , false ) ;
2014-01-27 21:41:32 +00:00
}
2013-02-09 00:41:02 +00:00
}
Issue #2056089 by BarisW, TR, mgifford, rodvolpe, Dom., nambisolo, nod_, katewelling, Manjit.Singh, jhodgdon, Bojhan, Wim Leers: UI problems on the Modules/Extend page
2015-07-27 12:03:51 +00:00
function preventEnterKey ( event ) {
if ( event . which === 13 ) {
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
}
}
2014-01-27 21:41:32 +00:00
if ( $table . length ) {
$rowsAndDetails = $table . find ( 'tr, details' ) ;
$rows = $table . find ( 'tbody tr' ) ;
$details = $rowsAndDetails . filter ( '.package-listing' ) ;
2021-08-10 10:05:02 +00:00
$ ( input ) . on ( {
Issue #2056089 by BarisW, TR, mgifford, rodvolpe, Dom., nambisolo, nod_, katewelling, Manjit.Singh, jhodgdon, Bojhan, Wim Leers: UI problems on the Modules/Extend page
2015-07-27 12:03:51 +00:00
keyup : debounce ( filterModuleList , 200 ) ,
keydown : preventEnterKey
} ) ;
2014-01-27 21:41:32 +00:00
}
2013-02-09 00:41:02 +00:00
}
2014-01-27 21:41:32 +00:00
} ;
2017-05-19 22:12:53 +00:00
} ) ( jQuery , Drupal , Drupal . debounce ) ;