Révision 136a805a
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/panels/js/panels-base.js | ||
---|---|---|
13 | 13 |
} |
14 | 14 |
}; |
15 | 15 |
|
16 |
Drupal.Panels.AddContentModalQuickFilter = function() { |
|
17 |
var input_field = $('.panels-add-content-modal input[name=quickfilter]'); |
|
18 |
input_field.data.panelsAddContentModalQuickFilter = { |
|
19 |
keyupTimeout: false, |
|
20 |
filter: function(e) { |
|
21 |
if (this.val().length) { |
|
22 |
var search_expression = this.val().toLowerCase(); |
|
23 |
$('.panels-add-content-modal .panels-section-columns .content-type-button').each(function(i, elem) { |
|
24 |
if ($(elem).text().toLowerCase().search(search_expression) > -1) { |
|
25 |
$(elem).show(); |
|
26 |
} |
|
27 |
else { |
|
28 |
$(elem).hide(); |
|
29 |
} |
|
30 |
}); |
|
31 |
} |
|
32 |
else { |
|
33 |
$('.panels-add-content-modal .panels-section-columns .content-type-button').show(); |
|
34 |
} |
|
35 |
} |
|
36 |
} |
|
37 |
// Use timeout to reduce the iteration over the DOM tree. |
|
38 |
input_field.bind('keyup.AddContentModalQuickFilter', jQuery.proxy(function(e){ |
|
39 |
var filter = $(this).data.panelsAddContentModalQuickFilter; |
|
40 |
if (filter.keyupTimeout) { |
|
41 |
window.clearTimeout(filter.timeout); |
|
42 |
filter.keyupTimeout = false; |
|
43 |
} |
|
44 |
// If there's only one item left and enter is hit select it right away. |
|
45 |
if (e.keyCode == 13 && $('.panels-add-content-modal .panels-section-columns .content-type-button:visible').length == 1) { |
|
46 |
$('.panels-add-content-modal .panels-section-columns .content-type-button:visible a').trigger('click'); |
|
47 |
} |
|
48 |
else { |
|
49 |
filter.keyupTimeout = window.setTimeout(jQuery.proxy(filter.filter, this), 200); |
|
50 |
} |
|
51 |
}, input_field)); |
|
52 |
input_field.focus(); |
|
53 |
}; |
|
54 |
|
|
16 | 55 |
Drupal.Panels.restripeTable = function(table) { |
17 | 56 |
// :even and :odd are reversed because jquery counts from 0 and |
18 | 57 |
// we count from 1, so we're out of sync. |
Formats disponibles : Unified diff
Weekly update of contrib modules