Make WordPress Core

Ticket #28873: 28873.4.patch

File 28873.4.patch, 4.1 KB (added by afercia, 9 years ago)
  • src/wp-admin/css/forms.css

     
    748748        box-shadow: 0 10px 8px rgba(0, 0, 0, 0.6);
    749749}
    750750
     751.pressthis button.show-pressthis-code {
     752        margin-left: 2em;
     753}
     754
     755.pressthis-code-wrap {
     756        /* avoid a few pixels jump on slideToggle making this a new formatting context */
     757        overflow: hidden;
     758}
     759
     760.pressthis-code-wrap textarea.pressthis-code {
     761        height: 100px;
     762        width: 60em;
     763        max-width: 100%;
     764        margin: 1em 0;
     765}
     766
    751767/*------------------------------------------------------------------------------
    752768  20.0 - Settings
    753769------------------------------------------------------------------------------*/
  • src/wp-admin/tools.php

     
    4141        <p><?php _e('Press This is a bookmarklet: a little app that runs in your browser and lets you grab bits of the web.');?></p>
    4242
    4343        <p><?php _e('Use Press This to clip text, images and videos from any web page. Then edit and add more straight from Press This before you save or publish it in a post on your site.'); ?></p>
    44         <p class="description"><?php _e('Drag-and-drop the following link to your bookmarks bar or right click it and add it to your favorites for a posting shortcut.') ?></p>
    45         <p class="pressthis"><a onclick="return false;" oncontextmenu="if(window.navigator.userAgent.indexOf('WebKit')!=-1||window.navigator.userAgent.indexOf('MSIE')!=-1){jQuery('.pressthis-code').show().find('textarea').focus().select();return false;}" href="<?php echo htmlspecialchars( get_shortcut_link() ); ?>"><span><?php _e('Press This') ?></span></a></p>
    46         <div class="pressthis-code" style="display:none;">
    47         <p class="description"><?php _e('If your bookmarks toolbar is hidden: copy the code below, open your Bookmarks manager, create new bookmark, type Press This into the name field and paste the code into the URL field.') ?></p>
    48         <p><textarea rows="5" cols="120" readonly="readonly"><?php echo htmlspecialchars( get_shortcut_link() ); ?></textarea></p>
     44        <p class="description"><?php _e( 'Drag-and-drop the following link to your bookmarks bar or copy the link code and follow instructions for a posting shortcut.' ) ?></p>
     45        <p class="pressthis">
     46                <a onclick="return false;" oncontextmenu="return false;" href="<?php echo htmlspecialchars( get_shortcut_link() ); ?>"><span><?php _e( 'Press This link' ) ?></span></a>
     47                <button type="button" class="button button-large show-pressthis-code" aria-expanded="false" aria-controls="pressthis-code-wrap"><?php _e( 'Copy Press This code' ); ?></button>
     48        </p>
     49        <div class="pressthis-code-wrap hidden" id="pressthis-code-wrap">
     50        <p class="description" id="pressthis-code-desc"><?php _e( 'Copy the selected code below, open your Bookmarks manager, create new bookmark, type Press This into the name field and paste the code into the URL field.' ) ?></p>
     51        <label for="pressthis-code" class="screen-reader-text"><?php _e( 'Press This code' ); ?></label>
     52        <textarea rows="5" cols="120" readonly="readonly" id="pressthis-code" class="pressthis-code" aria-labelledby="pressthis-code-desc"><?php echo htmlspecialchars( get_shortcut_link() ); ?></textarea>
    4953        </div>
     54        <script>
     55        jQuery( document ).ready( function( $ ) {
     56                var $pressthisCode = $( '.pressthis-code' );
     57
     58                $( 'button.show-pressthis-code' ).on( 'click', function( event ) {
     59                        var $that = $( this );
     60                        $( '.pressthis-code-wrap' ).slideToggle( 200, function() {
     61                                if ( $( this ).is( ':visible' ) ) {
     62                                        // Give screen readers time to announce "expanded".
     63                                        setTimeout( function() { $pressthisCode.focus(); }, 1000 );
     64                                        $that.attr( 'aria-expanded', true );
     65                                } else {
     66                                        $that.attr( 'aria-expanded', false );
     67                                }
     68                        });
     69                });
     70                // Select code even when tabbing inside already open textarea.
     71                $pressthisCode.on( 'focus', function() {
     72                        var self = this;
     73                        setTimeout( function() { self.select(); }, 50 );
     74                });
     75        });
     76        </script>
    5077</div>
    5178<?php
    5279endif;