window.jetpackModules = window.jetpackModules || {}; window.jetpackModules.models = ( function ( window, $, _, Backbone ) { 'use strict'; var models = {}; models.Modules = Backbone.Model.extend( { visibles: {}, /** * Updates modules.items dataset to be a reflection of both the current * modules.raw data, as well as any filters or sorting that may be in effect. */ filter_and_sort: function () { var subsubsub = $( '.subsubsub .current a' ), items = this.get( 'raw' ), m_filter = $( '.button-group.filter-active .active' ), m_sort = $( '.button-group.sort .active' ), m_search = $( '#srch-term-search-input' ).val().toLowerCase(), groups; // If a module filter has been selected, filter it! if ( ! subsubsub.closest( 'li' ).hasClass( 'all' ) ) { items = _.filter( items, function ( item ) { return _.contains( item.module_tags, subsubsub.data( 'title' ) ); } ); } if ( m_filter.data( 'filter-by' ) ) { items = _.filter( items, function ( item ) { return item[ m_filter.data( 'filter-by' ) ] === m_filter.data( 'filter-value' ); } ); } if ( m_search.length ) { items = _.filter( items, function ( item ) { var search_text = item.name + ' ' + item.description + ' ' + item.long_description + ' ' + item.search_terms + ' ' + item.module_tags; return -1 !== search_text.toLowerCase().indexOf( m_search ); } ); } if ( m_sort.data( 'sort-by' ) ) { items = _.sortBy( items, m_sort.data( 'sort-by' ) ); if ( 'reverse' === m_sort.data( 'sort-order' ) ) { items.reverse(); } } // Sort unavailable modules to the end if the user is running in local mode. groups = _.groupBy( items, 'available' ); if ( _.has( groups, 'false' ) ) { items = [].concat( groups.true, groups.false ); } // Now shove it back in. this.set( 'items', items ); return this; }, initialize: function () { var items = this.get( 'items' ); this.set( 'raw', items ); }, } ); return models; } )( window, jQuery, _, Backbone );
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
blocks | Folder | 0755 |
|
|
build | Folder | 0755 |
|
|
fonts | Folder | 0755 |
|
|
genericons | Folder | 0755 |
|
|
lib | Folder | 0755 |
|
|
social-logos | Folder | 0755 |
|
|
accessible-focus.js | File | 620 B | 0644 |
|
blogging-prompts.php | File | 8.49 KB | 0644 |
|
class.jetpack-provision.php | File | 9.33 KB | 0644 |
|
crowdsignal-shortcode.js | File | 649 B | 0644 |
|
crowdsignal-survey.js | File | 277 B | 0644 |
|
deprecate.js | File | 2.28 KB | 0644 |
|
facebook-embed.js | File | 1 KB | 0644 |
|
gallery-settings.js | File | 1 KB | 0644 |
|
genericons.php | File | 508 B | 0644 |
|
jetpack-admin.js | File | 1.56 KB | 0644 |
|
jetpack-deactivate-dialog.js | File | 2.9 KB | 0644 |
|
jetpack-modules.js | File | 2.37 KB | 0644 |
|
jetpack-modules.models.js | File | 2.07 KB | 0644 |
|
jetpack-modules.views.js | File | 1.69 KB | 0644 |
|
polldaddy-shortcode.js | File | 2.64 KB | 0644 |
|
social-logos.php | File | 956 B | 0644 |
|
twitter-timeline.js | File | 351 B | 0644 |
|