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> |
| 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> |