Make WordPress Core

Ticket #28577: 28577.2.diff

File 28577.2.diff, 5.4 KB (added by jorbin, 10 years ago)
  • src/wp-admin/css/install.css

     
    337337        height: 250px;
    338338}
    339339
    340 /* TODO:add focus style via JS */
    341340.language-chooser fieldset.focus {
    342341        border-color: #5b9dd9;
    343342        -webkit-box-shadow: 0 0 2px rgba(30,140,190,0.8);
     
    355354
    356355.language-chooser input:checked + label{
    357356          color:white;
     357          background: #777;
     358}
     359
     360.language-chooser .focus input:checked + label{
    358361          background: #0074A2;
    359362}
    360363
     364.language-chooser label:hover {
     365          background: #eee;
     366}
     367
    361368.language-chooser label{
    362369        display:block;
    363370}
  • src/wp-admin/includes/upgrade.php

     
    21622162function wp_install_language_form( $body ) {
    21632163        echo "<fieldset>\n";
    21642164        echo "<legend class='screen-reader-text'>Select a default language</legend>\n";
    2165         echo '<input type="radio" checked="checked" class="screen-reader-input" name="language" id="language_default" value="">';
     2165        echo '<input type="radio" checked="checked" class="screen-reader-input language-chooser-input" name="language" id="language_default" value="">';
    21662166        echo '<label for="language_default">English (United States)</label>';
    21672167        echo "\n";
    21682168
     
    21692169        if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && ( 'en_US' !== WPLANG ) ) {
    21702170                if ( isset( $body['languages'][WPLANG] ) ) {
    21712171                        $language = $body['languages'][WPLANG];
    2172                         echo '<input type="radio" name="language" checked="checked" class="' . esc_attr( $language['language'] ) . ' screen-reader-input" id="language_wplang" value="' . esc_attr( $language['language'] ) . '">';
     2172                        echo '<input type="radio" name="language" checked="checked" class="' . esc_attr( $language['language'] ) . ' screen-reader-input language-chooser-input" id="language_wplang" value="' . esc_attr( $language['language'] ) . '">';
    21732173                        echo '<label for="language_wplang">' . esc_html( $language['native_name'] ) . "</label>\n";
    21742174                }
    21752175        }
    21762176
    21772177        foreach ( $body['languages'] as $language ) {
    2178                 echo '<input type="radio" name="language" class="' . esc_attr( $language['language'] ) . ' screen-reader-input" id="language_'. esc_attr( $language['language'] ) .'" value="' . esc_attr( $language['language'] ) . '">';
     2178                echo '<input type="radio" name="language" class="' . esc_attr( $language['language'] ) . ' screen-reader-input language-chooser-input" id="language_'. esc_attr( $language['language'] ) .'" value="' . esc_attr( $language['language'] ) . '">';
    21792179                echo '<label for="language_' . esc_attr( $language['language'] ) . '">' . esc_html( $language['native_name'] ) . "</label>\n";
    21802180        }
    21812181        echo "</fieldset>\n";
  • src/wp-admin/install.php

     
    281281<script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script>
    282282<?php } ?>
    283283<?php wp_print_scripts( 'user-profile' ); ?>
     284<?php wp_print_scripts( 'language-chooser' ); ?>
    284285</body>
    285286</html>
  • src/wp-admin/js/language-chooser.js

     
     1(function($){
     2        if ( $('body').hasClass('language-chooser') === false )
     3                return;
     4
     5        var mouseDown = 0,
     6                $fieldset = $('fieldset');
     7
     8        // simple way to check if mousebutton is depressed while accounting for multiple mouse buttons being used independently
     9        document.body.onmousedown = function() {
     10                ++mouseDown;
     11        };
     12        document.body.onmouseup = function() {
     13                --mouseDown;
     14        };
     15
     16        /*
     17                we can't rely upon the focusout event
     18                since clicking on a label triggers it
     19        */
     20        function maybeRemoveFieldsetFocus(){
     21                if (mouseDown) {
     22                        setTimeout( maybeRemoveFieldsetFocus, 50);
     23                        return;
     24                }
     25                if ( $(':focus').hasClass('language-chooser-input') !== true ) {
     26                        $fieldset.removeClass('focus');
     27                }
     28        }
     29
     30        $fieldset.focusin( function() {
     31                $(this).addClass('focus');
     32        });
     33
     34        $fieldset.focusout( function() {
     35                setTimeout( maybeRemoveFieldsetFocus, 50);
     36        });
     37
     38})(jQuery);
  • src/wp-admin/setup-config.php

    Property changes on: src/wp-admin/js/language-chooser.js
    ___________________________________________________________________
    Added: svn:executable
    ## -0,0 +1 ##
    +*
    \ No newline at end of property
     
    317317        break;
    318318}
    319319?>
     320<?php wp_print_scripts( 'language-chooser' ); ?>
    320321</body>
    321322</html>
  • src/wp-includes/script-loader.php

     
    345345        ) );
    346346
    347347        $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter' ), false, 1 );
     348        $scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 );
    348349
    349350        $scripts->add( 'user-suggest', "/wp-admin/js/user-suggest$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 );
    350351