Ticket #44588: 44588.7.diff
| File 44588.7.diff, 6.4 KB (added by , 6 years ago) |
|---|
-
src/js/_enqueues/admin/privacy-tools.js
77 77 78 78 appendResultsAfterRow( $requestRow, 'notice-success', summaryMessage, [] ); 79 79 $this.hide(); 80 80 81 81 if ( 'undefined' !== typeof zipUrl ) { 82 82 window.location = zipUrl; 83 83 } else if ( ! sendAsEmail ) { … … 232 232 233 233 // Privacy policy page, copy button. 234 234 $( document ).on( 'click', function( event ) { 235 var $target = $( event.target ); 236 var $parent, $container, range; 235 var $parent, 236 $container, 237 range, 238 __ = wp.i18n.__, 239 $target = $( event.target ), 240 copiedNotice = $target.siblings( '.success' ); 237 241 238 242 if ( $target.is( 'button.privacy-text-copy' ) ) { 239 243 $parent = $target.parent().parent(); … … 253 257 window.getSelection().addRange( range ); 254 258 document.execCommand( 'copy' ); 255 259 260 copiedNotice.addClass( 'visible' ); 261 wp.a11y.speak( __( 'The section has been copied to your clipboard.' ) ); 262 256 263 $container.removeClass( 'hide-privacy-policy-tutorial' ); 257 264 window.getSelection().removeAllRanges(); 265 266 setTimeout( function(){ copiedNotice.removeClass( 'visible' ); }, 3000 ); 258 267 } catch ( er ) {} 259 268 } 260 269 } -
src/wp-admin/css/edit.css
714 714 padding-bottom: 6px; 715 715 } 716 716 717 .privacy-text-actions .success { 718 display: none; 719 color: #40860a; 720 float: right; 721 padding-right: 1em; 722 } 723 724 .privacy-text-actions .success.visible { 725 display: inline-block; 726 height: 32px; 727 } 728 717 729 .wp-privacy-policy-guide .policy-text h2 { 718 730 margin: 1.2em 0 1em; 719 731 padding: 0; -
src/wp-admin/includes/class-wp-privacy-policy-content.php
371 371 public static function privacy_policy_guide() { 372 372 373 373 $content_array = self::get_suggested_policy_text(); 374 375 374 $content = ''; 376 375 $toc = array( '<li><a href="#wp-privacy-policy-guide-introduction">' . __( 'Introduction' ) . '</a></li>' ); 377 376 $date_format = __( 'F j, Y' ); 378 $copy = __( 'Copy this section to clipboard' );379 $return_to_top = '<a href="#" class="return-to-top">' . __( '↑ Return to Top' ) . '</a>';380 377 381 378 foreach ( $content_array as $section ) { 382 379 $class = ''; … … 384 381 $removed = ''; 385 382 386 383 if ( ! empty( $section['removed'] ) ) { 387 $class = ' text-removed';384 $class = 'text-removed'; 388 385 $date = date_i18n( $date_format, $section['removed'] ); 389 386 /* translators: %s: Date of plugin deactivation. */ 390 387 $meta = sprintf( __( 'Removed %s.' ), $date ); … … 393 390 $removed = __( 'You deactivated this plugin on %s and may no longer need this policy.' ); 394 391 $removed = '<div class="error inline"><p>' . sprintf( $removed, $date ) . '</p></div>'; 395 392 } elseif ( ! empty( $section['updated'] ) ) { 396 $class = ' text-updated';393 $class = 'text-updated'; 397 394 $date = date_i18n( $date_format, $section['updated'] ); 398 395 /* translators: %s: Date of privacy policy text update. */ 399 396 $meta = sprintf( __( 'Updated %s.' ), $date ); … … 407 404 $toc_id = 'wp-privacy-policy-guide-' . sanitize_title( $plugin_name ); 408 405 $toc[] = sprintf( '<li><a href="#%1$s">%2$s</a>' . $meta . '</li>', $toc_id, $plugin_name ); 409 406 410 $content .= '<div class="privacy-text-section ' . $class . '">';407 $content .= '<div class="privacy-text-section ' . $class . '">'; 411 408 $content .= '<a id="' . $toc_id . '"> </a>'; 412 409 /* translators: %s: Plugin name. */ 413 410 $content .= '<h2>' . sprintf( __( 'Source: %s' ), $plugin_name ) . '</h2>'; … … 414 411 $content .= $removed; 415 412 416 413 $content .= '<div class="policy-text">' . $section['policy_text'] . '</div>'; 417 $content .= $return_to_top;414 $content .= '<a href="#" class="return-to-top">' . __( '↑ Return to Top' ) . '</a>'; 418 415 419 416 if ( empty( $section['removed'] ) ) { 420 $content .= '<div class="privacy-text-actions">'; 421 $content .= '<button type="button" class="privacy-text-copy button">'; 422 $content .= $copy; 423 $content .= '<span class="screen-reader-text">'; 424 /* translators: %s: Plugin name. */ 425 $content .= sprintf( __( 'Copy suggested policy text from %s.' ), $plugin_name ); 426 $content .= '</span>'; 427 $content .= '</button>'; 428 $content .= '</div>'; 417 $content .= '<div class="privacy-text-actions">'; 418 $content .= '<button type="button" class="privacy-text-copy button">'; 419 $content .= __( 'Copy this section to clipboard' ); 420 $content .= '<span class="screen-reader-text">'; 421 /* translators: %s: Plugin name. */ 422 $content .= sprintf( __( 'Copy suggested policy text from %s.' ), $plugin_name ); 423 $content .= '</span>'; 424 $content .= '</button>'; 425 $content .= '<span class="success" aria-hidden="true">' . __( 'Copied!' ) . '</span>'; 426 $content .= '</div>'; 429 427 } 430 428 431 $content .= "</div> \n"; // End of .privacy-text-section.429 $content .= "</div>"; // End of .privacy-text-section. 432 430 } 433 431 434 432 if ( count( $toc ) > 2 ) { 435 433 ?> 436 <div class="privacy-text-box-toc">434 <div class="privacy-text-box-toc"> 437 435 <p><?php _e( 'Table of Contents' ); ?></p> 438 436 <ol> 439 <?php echo implode( "\n",$toc ); ?>437 <?php echo implode( $toc ); ?> 440 438 </ol> 441 439 </div> 442 440 <?php -
src/wp-includes/script-loader.php
1463 1463 $scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y', 'wp-i18n' ), false, 1 ); 1464 1464 $scripts->set_translations( 'site-health' ); 1465 1465 1466 $scripts->add( 'privacy-tools', "/wp-admin/js/privacy-tools$suffix.js", array( 'jquery' ), false, 1 );1466 $scripts->add( 'privacy-tools', "/wp-admin/js/privacy-tools$suffix.js", array( 'jquery', 'wp-a11y', 'wp-i18n' ), false, 1 ); 1467 1467 did_action( 'init' ) && $scripts->localize( 1468 1468 'privacy-tools', 1469 1469 'privacyToolsL10n',