Make WordPress Core


Ignore:
Timestamp:
12/04/2012 07:29:56 PM (9 years ago)
Author:
nacin
Message:

Move utils.js (cookie and user setting functions) to wp-includes to enable front-end use.

Make it a dependency of media-views (and therefore media-editor). Move its userSettings JS object from admin-header to being paired with the script in script loader.

see #22730.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/script-loader.php

    r22994 r23036  
    6060    $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    6161
    62     $scripts->add( 'utils', "/wp-admin/js/utils$suffix.js" );
     62    $scripts->add( 'utils', "/wp-includes/js/utils$suffix.js" );
     63    did_action( 'init' ) && $scripts->localize( 'utils', 'userSettings', array(
     64        'url' => (string) SITECOOKIEPATH,
     65        'uid' => (string) get_current_user_id(),
     66        'time' => (string) time(),
     67    ) );
    6368
    6469    $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), false, 1 );
     
    330335    // To enqueue media-views or media-editor, call wp_enqueue_media().
    331336    // Both rely on numerous settings, styles, and templates to operate correctly.
    332     $scripts->add( 'media-views',  "/wp-includes/js/media-views$suffix.js",  array( 'media-models', 'wp-plupload', 'jquery-ui-sortable' ), false, 1 );
     337    $scripts->add( 'media-views',  "/wp-includes/js/media-views$suffix.js",  array( 'utils', 'media-models', 'wp-plupload', 'jquery-ui-sortable' ), false, 1 );
    333338    $scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
    334339    $scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'media-models' ), false, 1 );
Note: See TracChangeset for help on using the changeset viewer.