Make WordPress Core

Changeset 27642


Ignore:
Timestamp:
03/20/2014 10:22:25 PM (12 years ago)
Author:
wonderboymusic
Message:

Add JSDoc blocks to media-audiovideo.js.

See #27016.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/media-audiovideo.js

    r27640 r27642  
    821821                },
    822822
     823                /**
     824                 * Remove a setting's UI when the model unsets it
     825                 *
     826                 * @fires wp.media.view.MediaDetails#media:setting:remove
     827                 *
     828                 * @param {Event} e
     829                 */
    823830                removeSetting : function (e) {
    824831                        var wrap = $( e.currentTarget ).parent(), setting;
     
    834841                },
    835842
     843                /**
     844                 *
     845                 * @fires wp.media.view.MediaDetails#media:setting:remove
     846                 */
    836847                setTracks : function () {
    837848                        var tracks = '';
     
    845856                },
    846857
     858                /**
     859                 * @global MediaElementPlayer
     860                 */
    847861                setPlayer : function () {
    848862                        if ( ! this.player && this.media ) {
     
    870884                },
    871885
     886                /**
     887                 * @global _wpmejsSettings
     888                 *
     889                 * @returns {media.view.MediaDetails} Returns itself to allow chaining
     890                 */
    872891                render: function() {
    873892                        var self = this, settings = {
     
    9861005                /**
    9871006                 * Determine how many audio and video files the user has uploaded
     1007                 *
     1008                 * @global wp.media.view.settings
     1009                 *
     1010                 * @param {Object} settings
     1011                 * @returns {Object}
    9881012                 */
    9891013                counts : (function (settings) {
     
    11081132        } );
    11091133
     1134        /**
     1135         * Tiny MCE Views
     1136         *
     1137         */
     1138
     1139        /**
     1140         * These are base methods that are shared by each shortcode's MCE controller
     1141         *
     1142         * @mixin
     1143         */
    11101144        wp.mce.media = {
     1145                /**
     1146                 * @global wp.shortcode
     1147                 *
     1148                 * @param {string} content
     1149                 * @returns {Object}
     1150                 */
    11111151                toView:  function( content ) {
    11121152                        var match = wp.shortcode.next( this.shortcode, content );
     
    11251165                },
    11261166
     1167                /**
     1168                 * Called when a TinyMCE view is clicked for editing.
     1169                 * - Parses the shortcode out of the element's data attribute
     1170                 * - Calls the `edit` method on the shortcode model
     1171                 * - Launches the model window
     1172                 * - Bind's an `update` callback which updates the element's data attribute
     1173                 *   re-renders the view
     1174                 *
     1175                 * @param {HTMLElement} node
     1176                 */
    11271177                edit: function( node ) {
    11281178                        var media = wp.media[ this.shortcode ],
     
    11471197        };
    11481198
     1199        /**
     1200         * Base View class for audio and video shortcodes
     1201         *
     1202         * @constructor
     1203         * @augments wp.mce.View
     1204         * @mixes wp.media.mixin
     1205         */
    11491206        wp.mce.media.View = wp.mce.View.extend({
    11501207                initialize: function( options ) {
     
    11541211                },
    11551212
     1213                /**
     1214                 * Creates the player instance for the current node
     1215                 *
     1216                 * @global MediaElementPlayer
     1217                 * @global _wpmejsSettings
     1218                 *
     1219                 * @param {Event} e
     1220                 * @param {HTMLElement} node
     1221                 */
    11561222                setPlayer: function (e, node) {
    11571223                        // if the ready event fires on an empty node
     
    11991265                },
    12001266
     1267                /**
     1268                 * Pass data to the View's Underscore template and return the compiled output
     1269                 *
     1270                 * @returns {string}
     1271                 */
    12011272                getHtml: function() {
    12021273                        var attrs = this.shortcode.attrs.named;
     
    12061277        _.extend( wp.mce.media.View.prototype, wp.media.mixin );
    12071278
     1279        /**
     1280         * TinyMCE handler for the video shortcode
     1281         *
     1282         * @mixes wp.mce.media
     1283         */
    12081284        wp.mce.video = _.extend( {}, wp.mce.media, {
    12091285                shortcode: 'video',
     
    12141290                })
    12151291        } );
    1216 
    12171292        wp.mce.views.register( 'video', wp.mce.video );
    12181293
     1294        /**
     1295         * TinyMCE handler for the audio shortcode
     1296         *
     1297         * @mixes wp.mce.media
     1298         */
    12191299        wp.mce.audio = _.extend( {}, wp.mce.media, {
    12201300                shortcode: 'audio',
     
    12251305                })
    12261306        } );
    1227 
    12281307        wp.mce.views.register( 'audio', wp.mce.audio );
    12291308
     1309        /**
     1310         * Base View class for playlist shortcodes
     1311         *
     1312         * @constructor
     1313         * @augments wp.mce.View
     1314         * @mixes wp.media.mixin
     1315         */
    12301316        wp.mce.media.PlaylistView = wp.mce.View.extend({
    12311317                className: 'editor-playlist',
     
    12401326                },
    12411327
     1328                /**
     1329                 * Set the element context for the view, and then fetch the playlist's
     1330                 *   associated attachments.
     1331                 *
     1332                 * @param {Event} e
     1333                 * @param {HTMLElement} node
     1334                 */
    12421335                setNode: function (e, node) {
    12431336                        this.node = node;
     
    12451338                },
    12461339
     1340                /**
     1341                 * Asynchronously fetch the shortcode's attachments
     1342                 */
    12471343                fetch: function() {
    12481344                        this.attachments = wp.media[ this.shortcode.tag ].attachments( this.shortcode );
     
    12501346                },
    12511347
     1348                /**
     1349                 * Get the HTML for the view (which also set's the data), replace the
     1350                 *   current HTML, and then invoke the WPPlaylistView instance to render
     1351                 *   the playlist in the editor
     1352                 *
     1353                 * @global WPPlaylistView
     1354                 * @global tinymce.editors
     1355                 */
    12521356                setPlayer: function () {
    12531357                        var p,
     
    12781382                },
    12791383
     1384                /**
     1385                 * Set the data that will be used to compile the Underscore template,
     1386                 *  compile the template, and then return it.
     1387                 *
     1388                 * @returns {string}
     1389                 */
    12801390                getHtml: function() {
    12811391                        var data = this.shortcode.attrs.named,
     
    13441454        _.extend( wp.mce.media.PlaylistView.prototype, wp.media.mixin );
    13451455
     1456        /**
     1457         * TinyMCE handler for the playlist shortcode
     1458         *
     1459         * @mixes wp.mce.media
     1460         */
    13461461        wp.mce.playlist = _.extend( {}, wp.mce.media, {
    13471462                shortcode: 'playlist',
     
    13491464                View: wp.mce.media.PlaylistView
    13501465        } );
    1351 
    13521466        wp.mce.views.register( 'playlist', wp.mce.playlist );
    13531467
     1468        /**
     1469         * TinyMCE handler for the video-playlist shortcode
     1470         *
     1471         * @mixes wp.mce.media
     1472         */
    13541473        wp.mce['video-playlist'] = _.extend( {}, wp.mce.media, {
    13551474                shortcode: 'video-playlist',
     
    13571476                View: wp.mce.media.PlaylistView
    13581477        } );
    1359 
    13601478        wp.mce.views.register( 'video-playlist', wp.mce['video-playlist'] );
    13611479
     1480        /**
     1481         * Event binding
     1482         */
    13621483        function init() {
    13631484                $(document.body)
Note: See TracChangeset for help on using the changeset viewer.