Add upstream

This commit is contained in:
root
2019-10-24 00:12:05 +02:00
parent 85d41e4216
commit ac980f592c
3504 changed files with 1049983 additions and 29971 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,132 @@
/* Remove min-height from menu elements that was causing them to render incorrectly */
.my-sites li {
min-height: unset !important;
}
/* Overwrite a core style which breaks the overflow for .my-sites in Safari */
#wpadminbar li.menupop.my-sites {
overflow: visible;
}
/* Add a focus style for menu items */
.accessible-focus #wpadminbar li.menupop a.ab-item:focus,
.accessible-focus #wpadminbar li#wp-admin-bar-notes.menupop .ab-item:focus,
.accessible-focus #wpadminbar ul li#wp-admin-bar-ab-new-post a:focus {
-webkit-box-shadow: inset 2px 2px 0 #668eaa,
inset -2px -2px 0 #668eaa;
box-shadow: inset 2px 2px 0 #668eaa,
inset -2px -2px 0 #668eaa;
}
/* Menu items in panels are inside `ab-empty-item` */
.accessible-focus #wpadminbar li.menupop .ab-empty-item a.ab-item:focus,
.accessible-focus #wpadminbar li.menupop .ab-empty-item a.ab-secondary:focus,
.accessible-focus #wpadminbar li.menupop .ab-empty-item a.username:focus {
-webkit-box-shadow: inset 2px 2px 0 #2e4354,
inset -2px -2px 0 #2e4354;
box-shadow: inset 2px 2px 0 #2e4354,
inset -2px -2px 0 #2e4354;
}
.accessible-focus #wpadminbar .quicklinks li#wp-admin-bar-my-account #wp-admin-bar-user-info .ab-sign-out:focus {
-webkit-box-shadow: inset 2px 2px 0 #2e4354,
inset -2px -2px 0 #2e4354 !important;
box-shadow: inset 2px 2px 0 #2e4354,
inset -2px -2px 0 #2e4354 !important;
}
.accessible-focus #wpadminbar:not(.mobile) .ab-top-menu > li > .ab-item:focus {
background: transparent;
}
/* Hide the panels initially */
#wpadminbar li#wp-admin-bar-blog.menupop > .ab-sub-wrapper, /* My Sites */
#wpadminbar li#wp-admin-bar-newdash.menupop > .ab-sub-wrapper, /* Reader */
#wpadminbar li#wp-admin-bar-my-account.menupop > .ab-sub-wrapper, /* Me */
#wpadminbar li#wp-admin-bar-notes.menupop > #wpnt-notes-panel2 { /* Notifications */
display: block !important;
}
/* Change notification icon the match the one on WP.com */
#wp-admin-bar-notes .noticon-bell:before {
content: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cmVjdCB4PSIwIiBmaWxsPSJub25lIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiLz48Zz48cGF0aCBmaWxsPSIjZmZmZmZmIiBkPSJNNi4xNCAxNC45N2wyLjgyOCAyLjgyN2MtLjM2Mi4zNjItLjg2Mi41ODYtMS40MTQuNTg2LTEuMTA1IDAtMi0uODk1LTItMiAwLS41NTIuMjI0LTEuMDUyLjU4Ni0xLjQxNHptOC44NjcgNS4zMjRMMTQuMyAyMSAzIDkuN2wuNzA2LS43MDcgMS4xMDIuMTU3Yy43NTQuMTA4IDEuNjktLjEyMiAyLjA3Ny0uNTFsMy44ODUtMy44ODRjMi4zNC0yLjM0IDYuMTM1LTIuMzQgOC40NzUgMHMyLjM0IDYuMTM1IDAgOC40NzVsLTMuODg1IDMuODg2Yy0uMzg4LjM4OC0uNjE4IDEuMzIzLS41MSAyLjA3N2wuMTU3IDEuMXoiLz48L2c+PC9zdmc+") !important;
}
#wp-admin-bar-notes.active .noticon-bell:before {
content: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cmVjdCB4PSIwIiBmaWxsPSJub25lIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiLz48Zz48cGF0aCBmaWxsPSIjMjMyODJkIiBkPSJNNi4xNCAxNC45N2wyLjgyOCAyLjgyN2MtLjM2Mi4zNjItLjg2Mi41ODYtMS40MTQuNTg2LTEuMTA1IDAtMi0uODk1LTItMiAwLS41NTIuMjI0LTEuMDUyLjU4Ni0xLjQxNHptOC44NjcgNS4zMjRMMTQuMyAyMSAzIDkuN2wuNzA2LS43MDcgMS4xMDIuMTU3Yy43NTQuMTA4IDEuNjktLjEyMiAyLjA3Ny0uNTFsMy44ODUtMy44ODRjMi4zNC0yLjM0IDYuMTM1LTIuMzQgOC40NzUgMHMyLjM0IDYuMTM1IDAgOC40NzVsLTMuODg1IDMuODg2Yy0uMzg4LjM4OC0uNjE4IDEuMzIzLS41MSAyLjA3N2wuMTU3IDEuMXoiLz48L2c+PC9zdmc+") !important;
}
/* Fit width of sign out button to content */
#wpadminbar .quicklinks li#wp-admin-bar-my-account #wp-admin-bar-user-info .ab-sign-out {
display: inline-block;
}
/* Move the admin menu toggle in Gutenberg - https://github.com/Automattic/jetpack/issues/12320 */
.jetpack-masterbar.post-new-php.block-editor-page #wpadminbar #wp-admin-bar-ab-new-post {
display: none;
}
.jetpack-masterbar.post-new-php.block-editor-page #wpadminbar #wp-admin-bar-menu-toggle {
top: -4px;
position: relative;
}
.jetpack-masterbar.post-new-php.block-editor-page #wpadminbar #wp-admin-bar-menu-toggle .ab-icon:before {
color: #fff !important;
font-size: 28px;
}
.jetpack-masterbar #wpadminbar #wp-admin-bar-recovery-mode {
background-color: #ca4a1f;
color: #fff;
margin-right: 1em;
}
@media screen and (max-width: 480px) {
.jetpack-masterbar.post-new-php.block-editor-page #wp-toolbar ul li {
flex: 1;
width: auto !important;
}
.jetpack-masterbar.post-new-php.block-editor-page #wpadminbar ul#wp-admin-bar-root-default {
width: 60%;
}
.jetpack-masterbar.post-new-php.block-editor-page #wpadminbar ul#wp-admin-bar-top-secondary {
width: 40%;
}
.wp-admin.jetpack-masterbar.post-new-php.block-editor-page .wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle {
left: 0;
}
}
@media screen and (max-width: 782px) {
.wp-admin.jetpack-masterbar.post-new-php.block-editor-page .wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle {
left: 0 !important;
}
.jetpack-masterbar.post-new-php.block-editor-page #wp-toolbar,
.jetpack-masterbar.post-new-php.block-editor-page #wp-toolbar ul {
display: flex;
}
.jetpack-masterbar.post-new-php.block-editor-page #wpadminbar ul#wp-admin-bar-root-default {
flex-grow: 1;
}
.jetpack-masterbar.post-new-php.block-editor-page #wpadminbar li#wp-admin-bar-menu-toggle {
order: 1;
}
.jetpack-masterbar.post-new-php.block-editor-page #wpadminbar li#wp-admin-bar-blog {
order: 2;
}
.jetpack-masterbar.post-new-php.block-editor-page #wpadminbar li#wp-admin-bar-newdash {
order: 3;
}
.jetpack-masterbar #wpadminbar #wp-admin-bar-recovery-mode {
display: none;
}
}

View File

@@ -0,0 +1,55 @@
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
if ( ! class_exists( 'WP_Admin_Bar' ) ) {
require_once ABSPATH . '/wp-includes/class-wp-admin-bar.php';
}
/**
* We are using this class to replace core WP_Admin_Bar in cases when
* we need to override the default styles with rtl ones. This is
* achieved by adding 'rtl' class to #wpadminbar div. Apart from that
* the output of render method should be the same as the one of base class.
*/
class RTL_Admin_Bar extends WP_Admin_Bar {
/**
* Display the admin bar.
*/
public function render() {
global $is_IE;
$root = $this->_bind();
// Add browser and RTL classes.
// We have to do this here since admin bar shows on the front end.
$class = 'nojq nojs rtl';
if ( $is_IE ) {
if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 7' ) ) {
$class .= ' ie7';
} elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 8' ) ) {
$class .= ' ie8';
} elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 9' ) ) {
$class .= ' ie9';
}
} elseif ( wp_is_mobile() ) {
$class .= ' mobile';
}
?>
<div id="wpadminbar" class="<?php echo esc_attr( $class ); ?>">
<?php if ( ! is_admin() ) : ?>
<a class="screen-reader-shortcut" href="#wp-toolbar" tabindex="1"><?php esc_html_e( 'Skip to toolbar', 'jetpack' ); ?></a>
<?php endif; ?>
<div class="quicklinks" id="wp-toolbar" role="navigation" aria-label="<?php esc_attr_e( 'Toolbar', 'jetpack' ); ?>" tabindex="0">
<?php
foreach ( $root->children as $group ) :
$this->_render_group( $group );
endforeach;
?>
</div>
<?php if ( is_user_logged_in() ) : ?>
<a class="screen-reader-shortcut" href="<?php echo esc_url( wp_logout_url() ); ?>"><?php esc_html_e( 'Log Out', 'jetpack' ); ?></a>
<?php endif; ?>
</div>
<?php
}
}

View File

@@ -0,0 +1,159 @@
/*globals jQuery, JSON */
( function( $ ) {
var eventName = 'masterbar_click';
var linksTracksEvents = {
//top level items
'wp-admin-bar-blog': 'my_sites',
'wp-admin-bar-newdash': 'reader',
'wp-admin-bar-ab-new-post': 'write_button',
'wp-admin-bar-my-account': 'my_account',
'wp-admin-bar-notes': 'notifications',
//my sites - top items
'wp-admin-bar-switch-site': 'my_sites_switch_site',
'wp-admin-bar-blog-info': 'my_sites_blog_info',
'wp-admin-bar-site-view': 'my_sites_view_site',
'wp-admin-bar-blog-stats': 'my_sites_blog_stats',
'wp-admin-bar-activity': 'my_sites_activity',
'wp-admin-bar-plan': 'my_sites_plan',
'wp-admin-bar-plan-badge': 'my_sites_plan_badge',
//my sites - manage
'wp-admin-bar-edit-page': 'my_sites_manage_site_pages',
'wp-admin-bar-new-page-badge': 'my_sites_manage_add_page',
'wp-admin-bar-edit-post': 'my_sites_manage_blog_posts',
'wp-admin-bar-new-post-badge': 'my_sites_manage_add_new_post',
'wp-admin-bar-edit-attachment': 'my_sites_manage_media',
'wp-admin-bar-new-attachment-badge': 'my_sites_manage_add_media',
'wp-admin-bar-comments': 'my_sites_manage_comments',
'wp-admin-bar-edit-testimonial': 'my_sites_manage_testimonials',
'wp-admin-bar-new-testimonial': 'my_sites_manage_add_testimonial',
'wp-admin-bar-edit-portfolio': 'my_sites_manage_portfolio',
'wp-admin-bar-new-portfolio': 'my_sites_manage_add_portfolio',
//my sites - personalize
'wp-admin-bar-themes': 'my_sites_personalize_themes',
'wp-admin-bar-cmz': 'my_sites_personalize_themes_customize',
//my sites - configure
'wp-admin-bar-sharing': 'my_sites_configure_sharing',
'wp-admin-bar-people': 'my_sites_configure_people',
'wp-admin-bar-people-add': 'my_sites_configure_people_add_button',
'wp-admin-bar-plugins': 'my_sites_configure_plugins',
'wp-admin-bar-plugins-add': 'my_sites_configure_manage_plugins',
'wp-admin-bar-blog-settings': 'my_sites_configure_settings',
//reader
'wp-admin-bar-followed-sites': 'reader_followed_sites',
'wp-admin-bar-reader-followed-sites-manage': 'reader_manage_followed_sites',
'wp-admin-bar-discover-discover': 'reader_discover',
'wp-admin-bar-discover-search': 'reader_search',
'wp-admin-bar-discover-recommended-blogs': 'reader_recommendations',
'wp-admin-bar-my-activity-my-likes': 'reader_my_likes',
//account
'wp-admin-bar-user-info': 'my_account_user_name',
// account - profile
'wp-admin-bar-my-profile': 'my_account_profile_my_profile',
'wp-admin-bar-account-settings': 'my_account_profile_account_settings',
'wp-admin-bar-billing': 'my_account_profile_manage_purchases',
'wp-admin-bar-security': 'my_account_profile_security',
'wp-admin-bar-notifications': 'my_account_profile_notifications',
//account - special
'wp-admin-bar-get-apps': 'my_account_special_get_apps',
'wp-admin-bar-next-steps': 'my_account_special_next_steps',
'wp-admin-bar-help': 'my_account_special_help',
};
var notesTracksEvents = {
openSite: function( data ) {
return {
clicked: 'masterbar_notifications_panel_site',
site_id: data.siteId,
};
},
openPost: function( data ) {
return {
clicked: 'masterbar_notifications_panel_post',
site_id: data.siteId,
post_id: data.postId,
};
},
openComment: function( data ) {
return {
clicked: 'masterbar_notifications_panel_comment',
site_id: data.siteId,
post_id: data.postId,
comment_id: data.commentId,
};
},
};
function parseJson( s, defaultValue ) {
try {
return JSON.parse( s );
} catch ( e ) {
return defaultValue;
}
}
$( document ).ready( function() {
var trackableLinks =
'.mb-trackable .ab-item:not(div),' +
'#wp-admin-bar-notes .ab-item,' +
'#wp-admin-bar-user-info .ab-item,' +
'.mb-trackable .ab-secondary';
$( trackableLinks ).on( 'click touchstart', function( e ) {
if ( ! window.jpTracksAJAX || 'function' !== typeof window.jpTracksAJAX.record_ajax_event ) {
return;
}
var $target = $( e.target ),
$parent = $target.closest( 'li' );
if ( ! $target.is( 'a' ) ) {
$target = $target.closest( 'a' );
}
if ( ! $parent || ! $target ) {
return;
}
var trackingId = $target.attr( 'ID' ) || $parent.attr( 'ID' );
if ( ! linksTracksEvents.hasOwnProperty( trackingId ) ) {
return;
}
var eventProps = { clicked: linksTracksEvents[ trackingId ] };
if ( $parent.hasClass( 'menupop' ) ) {
window.jpTracksAJAX.record_ajax_event( eventName, 'click', eventProps );
} else {
e.preventDefault();
window.jpTracksAJAX.record_ajax_event( eventName, 'click', eventProps ).always( function() {
window.location = $target.attr( 'href' );
} );
}
} );
} );
// listen for postMessage events from the notifications iframe
$( window ).on( 'message', function( e ) {
if ( ! window.jpTracksAJAX || 'function' !== typeof window.jpTracksAJAX.record_ajax_event ) {
return;
}
var event = ! e.data && e.originalEvent.data ? e.originalEvent : e;
if ( event.origin !== 'https://widgets.wp.com' ) {
return;
}
var data = 'string' === typeof event.data ? parseJson( event.data, {} ) : event.data;
if ( 'notesIframeMessage' !== data.type ) {
return;
}
var eventData = notesTracksEvents[ data.action ];
if ( ! eventData ) {
return;
}
window.jpTracksAJAX.record_ajax_event( eventName, 'click', eventData( data ) );
} );
} )( jQuery );