PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 6.2
Jetpack – WP Security, Backup, Speed, & Growth v6.2
16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / _inc / jetpack-modules.js
jetpack-modules.js
72 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1
2 ( function( window, $, items, models, views, i18n, modalinfo, nonces ) {
3 'use strict';
4
5 var modules, list_table, handle_module_tag_click, $the_table, $the_filters, $the_search, $jp_frame, $bulk_button;
6
7 $the_table = $( '.wp-list-table.jetpack-modules' );
8 $the_filters = $( '.navbar-form' );
9 $the_search = $( '#srch-term-search-input' );
10 $jp_frame = $( '.jp-frame' );
11 $bulk_button = $( '#doaction' );
12
13 modules = new models.Modules( {
14 items : items
15 } );
16
17 list_table = new views.List_Table( {
18 el : '#the-list',
19 model : modules
20 } );
21
22 // Kick off an initial redraw.
23 modules.trigger( 'change' );
24
25 // Handle the filtering of modules.
26 handle_module_tag_click = function( event ) {
27 // Switch the item in the subsubsub list that's flagged as current.
28 $( '.subsubsub' ).find( 'a[data-title="' + $(this).data('title') + '"]' ).addClass( 'current' )
29 .closest( 'li' ).siblings().find( 'a.current' ).removeClass( 'current' );
30
31 event.preventDefault();
32 modules.trigger( 'change' );
33 };
34
35 $( '.subsubsub a' ).on( 'click', { modules : modules }, handle_module_tag_click );
36
37 $the_filters.on( 'click', '.button-group .button', { modules : modules }, function( event ) {
38 event.preventDefault();
39 $(this).addClass('active').siblings('.active').removeClass('active');
40 modules.trigger( 'change' );
41 } );
42
43 $the_search.on( 'keyup search', function( e ) {
44 // Don't trigger change on tab, since it's only used for accessibility
45 // anyway, and will remove all checked boxes
46 if ( e.keyCode !== 9 ) {
47 modules.trigger( 'change' );
48 }
49 } );
50
51 $the_search.prop( 'placeholder', i18n.search_placeholder );
52
53 $bulk_button.on( 'click', function( event ) {
54 var selectedModules = $('.jetpack-modules-list-table-form').serialize(),
55 selectedAction = $(this).siblings('select').val(),
56 url;
57
58 if ( selectedModules.length && '-1' !== selectedAction ) {
59 url = 'admin.php?page=jetpack&action=' + encodeURIComponent( selectedAction );
60 url += '&' + selectedModules;
61 url += '&_wpnonce=' + encodeURIComponent( nonces.bulk );
62
63 window.location.href = url;
64 } else {
65 // Possibly add in an alert here explaining why nothing's happening?
66 }
67
68 event.preventDefault();
69 } );
70
71 } ) ( this, jQuery, window.jetpackModulesData.modules, this.jetpackModules.models, this.jetpackModules.views, window.jetpackModulesData.i18n, window.jetpackModulesData.modalinfo, window.jetpackModulesData.nonces );
72