Make WordPress Core

Ticket #21811: 21811-09-27473-load-scripts.patch

File 21811-09-27473-load-scripts.patch, 3.0 KB (added by tomauger, 11 years ago)

Moved image-edit script out of is_admin() section. Also moved media and set-post-thumbnail

  • src/wp-includes/script-loader.php

     
    393393        $scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
    394394        $scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'media-models' ), false, 1 );
    395395
     396        $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), false, 1 );
     397        did_action( 'init' ) && $scripts->localize( 'media', 'attachMediaBoxL10n', array(
     398                'error' => __( 'An error has occured. Please reload the page and try again.' )
     399        ));
     400
     401        $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), false, 1 );
     402        did_action( 'init' ) && $scripts->localize( 'image-edit', 'imageEditL10n', array(
     403                'error' => __( 'Could not load the preview image. Please reload the page and try again.' )
     404        ));
     405
     406        $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
     407        did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
     408                'setThumbnail' => __( 'Use as featured image' ),
     409                'saving' => __( 'Saving...' ),
     410                'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
     411                'done' => __( 'Done' )
     412        ) );
     413
    396414        if ( is_admin() ) {
    397415                $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('jquery', 'wp-ajax-response'), false, 1 );
    398416                did_action( 'init' ) && $scripts->localize( 'admin-tags', 'tagsl10n', array(
     
    493511
    494512                $scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" );
    495513
    496                 $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), false, 1 );
    497                 did_action( 'init' ) && $scripts->localize( 'media', 'attachMediaBoxL10n', array(
    498                         'error' => __( 'An error has occured. Please reload the page and try again.' )
    499                 ));
    500 
    501                 $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), false, 1 );
    502                 did_action( 'init' ) && $scripts->localize( 'image-edit', 'imageEditL10n', array(
    503                         'error' => __( 'Could not load the preview image. Please reload the page and try again.' )
    504                 ));
    505 
    506                 $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
    507                 did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
    508                         'setThumbnail' => __( 'Use as featured image' ),
    509                         'saving' => __( 'Saving...' ),
    510                         'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
    511                         'done' => __( 'Done' )
    512                 ) );
    513 
    514514                // Navigation Menus
    515515                $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox' ) );
    516516                did_action( 'init' ) && $scripts->localize( 'nav-menu', 'navMenuL10n', array(