Last change on this file since 13017 was 13017, checked in by imath, 4 years ago |
---|
Make sure regular users can edit field visibility in wp-admin/extended
As we're very close to 9.0.0-RC1, we're also updating credits to include leahkoerper to the list.
Props leahkoerper
Fixes #8529
|
File size: 1.4 KB |
Line | |
---|
1 | /* exported clear */ |
---|
2 | |
---|
3 | ( function( $ ) { |
---|
4 | // Profile Visibility Settings |
---|
5 | $( '.visibility-toggle-link' ).on( 'click', function( event ) { |
---|
6 | event.preventDefault(); |
---|
7 | |
---|
8 | $( this ).attr( 'aria-expanded', 'true' ).parent().hide() |
---|
9 | .siblings( '.field-visibility-settings' ).show(); |
---|
10 | } ); |
---|
11 | |
---|
12 | $( '.field-visibility-settings-close' ).on( 'click', function( event ) { |
---|
13 | event.preventDefault(); |
---|
14 | |
---|
15 | $( '.visibility-toggle-link' ).attr( 'aria-expanded', 'false' ); |
---|
16 | |
---|
17 | var settings_div = $( this ).parent(), |
---|
18 | vis_setting_text = settings_div.find( 'input:checked' ).parent().text(); |
---|
19 | |
---|
20 | settings_div.hide() |
---|
21 | .siblings( '.field-visibility-settings-toggle' ) |
---|
22 | .find( '.current-visibility-level' ).text( vis_setting_text ).end() |
---|
23 | .show(); |
---|
24 | } ); |
---|
25 | |
---|
26 | } )( jQuery ); |
---|
27 | |
---|
28 | |
---|
29 | /** |
---|
30 | * Deselects any select options or input options for the specified field element. |
---|
31 | * |
---|
32 | * @param {String} container HTML ID of the field |
---|
33 | * @since 1.0.0 |
---|
34 | */ |
---|
35 | function clear( container ) { |
---|
36 | container = document.getElementById( container ); |
---|
37 | if ( ! container ) { |
---|
38 | return; |
---|
39 | } |
---|
40 | |
---|
41 | var radioButtons = container.getElementsByTagName( 'INPUT' ), |
---|
42 | options = container.getElementsByTagName( 'OPTION' ), |
---|
43 | i = 0; |
---|
44 | |
---|
45 | if ( radioButtons ) { |
---|
46 | for ( i = 0; i < radioButtons.length; i++ ) { |
---|
47 | radioButtons[i].checked = ''; |
---|
48 | } |
---|
49 | } |
---|
50 | |
---|
51 | if ( options ) { |
---|
52 | for ( i = 0; i < options.length; i++ ) { |
---|
53 | options[i].selected = false; |
---|
54 | } |
---|
55 | } |
---|
56 | } |
---|
Note: See
TracBrowser for help on using the repository browser.