Make WordPress Core

Changeset 40914


Ignore:
Timestamp:
06/15/2017 01:23:22 PM (9 years ago)
Author:
peterwilsoncc
Message:

Docs: Add wp-admin/js/custom-background.js documentation.

Props jipmoors.
Fixes #41067.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/custom-background.js

    r38948 r40914  
    11/* global ajaxurl */
     2
     3/**
     4 * @summary Registers all events for customizing the background.
     5 *
     6 * @since 3.0.0
     7 *
     8 * @requires jQuery
     9 */
    210(function($) {
    311        $(document).ready(function() {
     
    513                        bgImage = $( '#custom-background-image' );
    614
     15                /**
     16                 * @summary Instantiates the WordPress color picker and binds the change and clear events.
     17                 *
     18                 * @since 3.5.0
     19                 *
     20                 * @returns {void}
     21                 */
    722                $('#background-color').wpColorPicker({
    823                        change: function( event, ui ) {
     
    1429                });
    1530
     31                /**
     32                 * @summary Alters the background size CSS property whenever the background size input has changed.
     33                 *
     34                 * @since 4.7.0
     35                 *
     36                 * @returns {void}
     37                 */
    1638                $( 'select[name="background-size"]' ).change( function() {
    1739                        bgImage.css( 'background-size', $( this ).val() );
    1840                });
    1941
     42                /**
     43                 * @summary Alters the background position CSS property whenever the background position input has changed.
     44                 *
     45                 * @since 4.7.0
     46                 *
     47                 * @returns {void}
     48                 */
    2049                $( 'input[name="background-position"]' ).change( function() {
    2150                        bgImage.css( 'background-position', $( this ).val() );
    2251                });
    2352
     53                /**
     54                 * @summary Alters the background repeat CSS property whenever the background repeat input has changed.
     55                 *
     56                 * @since 3.0.0
     57                 *
     58                 * @returns {void}
     59                 */
    2460                $( 'input[name="background-repeat"]' ).change( function() {
    2561                        bgImage.css( 'background-repeat', $( this ).is( ':checked' ) ? 'repeat' : 'no-repeat' );
    2662                });
    2763
     64                /**
     65                 * @summary Alters the background attachment CSS property whenever the background attachment input has changed.
     66                 *
     67                 * @since 4.7.0
     68                 *
     69                 * @returns {void}
     70                 */
    2871                $( 'input[name="background-attachment"]' ).change( function() {
    2972                        bgImage.css( 'background-attachment', $( this ).is( ':checked' ) ? 'scroll' : 'fixed' );
    3073                });
    3174
     75                /**
     76                 * @summary Binds the event for opening the WP Media dialog.
     77                 *
     78                 * @since 3.5.0
     79                 *
     80                 * @returns {void}
     81                 */
    3282                $('#choose-from-library-link').click( function( event ) {
    3383                        var $el = $(this);
     
    55105                                        // Set the text of the button.
    56106                                        text: $el.data('update'),
    57                                         // Tell the button not to close the modal, since we're
    58                                         // going to refresh the page when the image is selected.
     107                                        /*
     108                                         * Tell the button not to close the modal, since we're
     109                                         * going to refresh the page when the image is selected.
     110                                         */
    59111                                        close: false
    60112                                }
    61113                        });
    62114
    63                         // When an image is selected, run a callback.
     115                        /**
     116                         * @summary When an image is selected, run a callback.
     117                         *
     118                         * @since 3.5.0
     119                         *
     120                         * @returns {void}
     121                         */
    64122                        frame.on( 'select', function() {
    65123                                // Grab the selected attachment.
Note: See TracChangeset for help on using the changeset viewer.