modified file wp-piwik
This commit is contained in:
@ -0,0 +1,272 @@
|
||||
.activitypub-settings {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.settings_page_activitypub .notice {
|
||||
max-width: 800px;
|
||||
margin: 0 auto 30px;
|
||||
}
|
||||
|
||||
.settings_page_activitypub .update-nag {
|
||||
margin: 25px 20px 15px 22px;
|
||||
}
|
||||
|
||||
.settings_page_activitypub .wrap {
|
||||
padding-left: 22px;
|
||||
}
|
||||
|
||||
.activitypub-settings-header {
|
||||
text-align: center;
|
||||
margin: 0 0 1rem;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #dcdcde;
|
||||
}
|
||||
|
||||
.activitypub-settings-header h1 {
|
||||
display: inline-block;
|
||||
font-weight: 600;
|
||||
margin: 0 0.8rem 1rem;
|
||||
font-size: 23px;
|
||||
padding: 9px 0 4px;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.activitypub-settings-title-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
clear: both;
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
.settings_page_activitypub #wpcontent {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.activitypub-settings-tabs-wrapper {
|
||||
display: inline-flex;
|
||||
vertical-align: top;
|
||||
flex-wrap: nowrap;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.activitypub-settings-tab.active {
|
||||
box-shadow: inset 0 -3px #3582c4;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.activitypub-settings-tab {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
padding: .5rem 1rem 1rem;
|
||||
margin: 0 1rem;
|
||||
transition: box-shadow .5s ease-in-out;
|
||||
}
|
||||
|
||||
.activitypub-settings .row {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.activitypub-settings .row > div {
|
||||
max-width: calc(100% - 24px);
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.activitypub-settings .row .description {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.wp-header-end {
|
||||
visibility: hidden;
|
||||
margin: -2px 0 0;
|
||||
}
|
||||
|
||||
summary {
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
color: #2271b1;
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion {
|
||||
border: 1px solid #c3c4c7;
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion-heading {
|
||||
margin: 0;
|
||||
border-top: 1px solid #c3c4c7;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
font-weight: 600;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion-heading:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion-panel {
|
||||
margin: 0;
|
||||
padding: 1em 1.5em;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion-trigger {
|
||||
background: #fff;
|
||||
border: 0;
|
||||
color: #2c3338;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
font-weight: 400;
|
||||
margin: 0;
|
||||
padding: 1em 3.5em 1em 1.5em;
|
||||
min-height: 46px;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
-webkit-user-select: auto;
|
||||
user-select: auto;
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion-trigger {
|
||||
color: #2c3338;
|
||||
cursor: pointer;
|
||||
font-weight: 400;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion-trigger .title {
|
||||
pointer-events: none;
|
||||
font-weight: 600;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion-trigger .icon,
|
||||
.activitypub-settings-accordion-viewed .icon {
|
||||
border: solid #50575e medium;
|
||||
border-width: 0 2px 2px 0;
|
||||
height: .5rem;
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
right: 1.5em;
|
||||
top: 50%;
|
||||
transform: translateY(-70%) rotate(45deg);
|
||||
width: .5rem;
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion-trigger[aria-expanded="true"] .icon {
|
||||
transform: translateY(-30%) rotate(-135deg);
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion-trigger:active,
|
||||
.activitypub-settings-accordion-trigger:hover {
|
||||
background: #f6f7f7;
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion-trigger:focus {
|
||||
color: #1d2327;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
outline-offset: -1px;
|
||||
outline: 2px solid #2271b1;
|
||||
background-color: #f6f7f7;
|
||||
}
|
||||
|
||||
.activitypub-settings
|
||||
input.blog-user-identifier {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.activitypub-settings
|
||||
.header-image {
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
position: relative;
|
||||
display: block;
|
||||
margin-bottom: 40px;
|
||||
background-image: rgb(168,165,175);
|
||||
background-image: linear-gradient(180deg, red, yellow);
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.activitypub-settings .logo {
|
||||
height: 80px;
|
||||
width: 80px;
|
||||
position: relative;
|
||||
top: 40px;
|
||||
left: 40px;
|
||||
}
|
||||
|
||||
.settings_page_activitypub .plugin-recommendations {
|
||||
border-bottom: none;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
#dashboard_right_now li a.activitypub-followers::before {
|
||||
content: "\f307";
|
||||
font-family: dashicons;
|
||||
}
|
||||
|
||||
.repost .dashboard-comment-wrap,
|
||||
.like .dashboard-comment-wrap {
|
||||
padding-inline-start: 63px;
|
||||
}
|
||||
|
||||
.repost .dashboard-comment-wrap .comment-author,
|
||||
.like .dashboard-comment-wrap .comment-author {
|
||||
margin-block: 0;
|
||||
}
|
||||
|
||||
.activitypub-settings .welcome-tab-close {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
font-size: 13px;
|
||||
padding: 0 5px 0 20px;
|
||||
text-decoration: none;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.activitypub-settings .welcome-tab-close::before {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0;
|
||||
transition: all .1s ease-in-out;
|
||||
font: normal 16px/20px dashicons;
|
||||
content: '\f335';
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.activitypub-notice .count {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
box-sizing: border-box;
|
||||
margin: 1px 0 -1px 2px;
|
||||
padding: 0 5px;
|
||||
min-width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 9px;
|
||||
background-color: #dba617;
|
||||
color: #fff;
|
||||
font-size: 11px;
|
||||
line-height: 1.6;
|
||||
text-align: center;
|
||||
z-index: 26;
|
||||
}
|
||||
|
||||
.activitypub-notice .dashicons-warning {
|
||||
color: #dba617;
|
||||
}
|
||||
|
||||
.extra-fields-nav a + a {
|
||||
margin-left: 8px;
|
||||
}
|
||||
.rtl .extra-fields-nav a + a {
|
||||
margin-left: auto;
|
||||
margin-right: 8px;
|
||||
}
|
||||
@ -0,0 +1,115 @@
|
||||
/**
|
||||
* ActivityPub embed styles.
|
||||
*/
|
||||
|
||||
.activitypub-embed {
|
||||
background: #fff;
|
||||
border: 1px solid #e6e6e6;
|
||||
border-radius: 12px;
|
||||
padding: 0;
|
||||
max-width: 100%;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.activitypub-reply-block .activitypub-embed {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.activitypub-embed-header {
|
||||
padding: 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.activitypub-embed-header img {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.activitypub-embed-header-text {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.activitypub-embed-header-text h2 {
|
||||
color: #000;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.activitypub-embed-header-text .ap-account {
|
||||
color: #687684;
|
||||
font-size: 14px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.activitypub-embed-content {
|
||||
padding: 0 15px 15px;
|
||||
}
|
||||
|
||||
.activitypub-embed-content .ap-title {
|
||||
font-size: 23px;
|
||||
font-weight: 600;
|
||||
margin: 0 0 10px;
|
||||
padding: 0;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.activitypub-embed-content .ap-subtitle {
|
||||
font-size: 15px;
|
||||
color: #000;
|
||||
margin: 0 0 15px;
|
||||
}
|
||||
|
||||
.activitypub-embed-content .ap-preview {
|
||||
border: 1px solid #e6e6e6;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.activitypub-embed-content .ap-preview img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.activitypub-embed-content .ap-preview-text {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.activitypub-embed-meta {
|
||||
padding: 15px;
|
||||
border-top: 1px solid #e6e6e6;
|
||||
color: #687684;
|
||||
font-size: 13px;
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.activitypub-embed-meta .ap-stat {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
||||
@media only screen and (max-width: 399px) {
|
||||
.activitypub-embed-meta span.ap-stat {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.activitypub-embed-meta a.ap-stat {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.activitypub-embed-meta strong {
|
||||
font-weight: 600;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.activitypub-embed-meta .ap-stat-label {
|
||||
color: #687684;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@ -0,0 +1,21 @@
|
||||
jQuery( function( $ ) {
|
||||
// Accordion handling in various areas.
|
||||
$( '.activitypub-settings-accordion' ).on( 'click', '.activitypub-settings-accordion-trigger', function() {
|
||||
var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
|
||||
|
||||
if ( isExpanded ) {
|
||||
$( this ).attr( 'aria-expanded', 'false' );
|
||||
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true );
|
||||
} else {
|
||||
$( this ).attr( 'aria-expanded', 'true' );
|
||||
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', false );
|
||||
}
|
||||
} );
|
||||
|
||||
$(document).on( 'wp-plugin-install-success', function( event, response ) {
|
||||
setTimeout( function() {
|
||||
$( '.activate-now' ).removeClass( 'thickbox open-plugin-details-modal' );
|
||||
}, 1200 );
|
||||
} );
|
||||
|
||||
} );
|
||||
@ -0,0 +1,271 @@
|
||||
/**
|
||||
* Handle the header image setting in
|
||||
*
|
||||
* This is based on site-icon.js
|
||||
*
|
||||
* @see wp-admin/js/site-icon.js
|
||||
*/
|
||||
|
||||
/* global jQuery, wp */
|
||||
|
||||
( function ( $ ) {
|
||||
var $chooseButton = $( '#activitypub-choose-from-library-button' ),
|
||||
$headerImagePreviewWrapper = $( '#activitypub-header-image-preview-wrapper' ),
|
||||
$headerImagePreview = $( '#activitypub-header-image-preview' ),
|
||||
$hiddenDataField = $( '#activitypub_header_image' ),
|
||||
$removeButton = $( '#activitypub-remove-header-image' ),
|
||||
frame,
|
||||
ImageCropperNoCustomizer;
|
||||
|
||||
/**
|
||||
* We register our own handler because the Core one invokes the Customizer, which fails the request unnecessarily
|
||||
* for users who don't have the 'customize' capability.
|
||||
* See https://github.com/Automattic/wordpress-activitypub/issues/846
|
||||
*/
|
||||
ImageCropperNoCustomizer = wp.media.controller.CustomizeImageCropper.extend( {
|
||||
doCrop: function( attachment ) {
|
||||
var cropDetails = attachment.get( 'cropDetails' ),
|
||||
control = this.get( 'control' ),
|
||||
ratio = cropDetails.width / cropDetails.height;
|
||||
|
||||
// Use crop measurements when flexible in both directions.
|
||||
if ( control.params.flex_width && control.params.flex_height ) {
|
||||
cropDetails.dst_width = cropDetails.width;
|
||||
cropDetails.dst_height = cropDetails.height;
|
||||
|
||||
// Constrain flexible side based on image ratio and size of the fixed side.
|
||||
} else {
|
||||
cropDetails.dst_width = control.params.flex_width ? control.params.height * ratio : control.params.width;
|
||||
cropDetails.dst_height = control.params.flex_height ? control.params.width / ratio : control.params.height;
|
||||
}
|
||||
|
||||
return wp.ajax.post( 'crop-image', {
|
||||
// where wp_customize: 'on' would be in Core, for no good reason I understand.
|
||||
nonce: attachment.get( 'nonces' ).edit,
|
||||
id: attachment.get( 'id' ),
|
||||
context: control.id,
|
||||
cropDetails: cropDetails
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Calculate image selection options based on the attachment dimensions.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param {Object} attachment The attachment object representing the image.
|
||||
* @return {Object} The image selection options.
|
||||
*/
|
||||
function calculateImageSelectOptions( attachment ) {
|
||||
var realWidth = attachment.get( 'width' ),
|
||||
realHeight = attachment.get( 'height' ),
|
||||
xInit = 1500,
|
||||
yInit = 500,
|
||||
ratio = xInit / yInit,
|
||||
xImg = xInit,
|
||||
yImg = yInit,
|
||||
x1,
|
||||
y1,
|
||||
imgSelectOptions;
|
||||
|
||||
if ( realWidth / realHeight > ratio ) {
|
||||
yInit = realHeight;
|
||||
xInit = yInit * ratio;
|
||||
} else {
|
||||
xInit = realWidth;
|
||||
yInit = xInit / ratio;
|
||||
}
|
||||
|
||||
x1 = ( realWidth - xInit ) / 2;
|
||||
y1 = ( realHeight - yInit ) / 2;
|
||||
|
||||
imgSelectOptions = {
|
||||
aspectRatio: xInit + ':' + yInit,
|
||||
handles: true,
|
||||
keys: true,
|
||||
instance: true,
|
||||
persistent: true,
|
||||
imageWidth: realWidth,
|
||||
imageHeight: realHeight,
|
||||
minWidth: xImg > xInit ? xInit : xImg,
|
||||
minHeight: yImg > yInit ? yInit : yImg,
|
||||
x1: x1,
|
||||
y1: y1,
|
||||
x2: xInit + x1,
|
||||
y2: yInit + y1,
|
||||
};
|
||||
|
||||
return imgSelectOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the media frame for selecting or cropping an image.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*/
|
||||
$chooseButton.on( 'click', function () {
|
||||
var $el = $( this );
|
||||
var userId = $el.data( 'userId' );
|
||||
var mediaQuery = { type: 'image' };
|
||||
if ( userId ) {
|
||||
mediaQuery.author = userId;
|
||||
}
|
||||
|
||||
// Create the media frame.
|
||||
frame = wp.media( {
|
||||
button: {
|
||||
// Set the text of the button.
|
||||
text: $el.data( 'update' ),
|
||||
|
||||
// Don't close, we might need to crop.
|
||||
close: false,
|
||||
},
|
||||
states: [
|
||||
new wp.media.controller.Library( {
|
||||
title: $el.data( 'choose-text' ),
|
||||
library: wp.media.query( mediaQuery ),
|
||||
date: false,
|
||||
suggestedWidth: $el.data( 'width' ),
|
||||
suggestedHeight: $el.data( 'height' ),
|
||||
} ),
|
||||
new ImageCropperNoCustomizer( {
|
||||
control: {
|
||||
id: 'activitypub-header-image',
|
||||
params: {
|
||||
width: $el.data( 'width' ),
|
||||
height: $el.data( 'height' ),
|
||||
},
|
||||
},
|
||||
imgSelectOptions: calculateImageSelectOptions,
|
||||
} ),
|
||||
],
|
||||
} );
|
||||
|
||||
frame.on( 'cropped', function ( attachment ) {
|
||||
$hiddenDataField.val( attachment.id );
|
||||
switchToUpdate( attachment );
|
||||
frame.close();
|
||||
|
||||
// Start over with a frame that is so fresh and so clean clean.
|
||||
frame = null;
|
||||
} );
|
||||
|
||||
// When an image is selected, run a callback.
|
||||
frame.on( 'select', function () {
|
||||
// Grab the selected attachment.
|
||||
var attachment = frame.state().get( 'selection' ).first(),
|
||||
targetRatio = $el.data( 'width' ) / $el.data( 'height' ),
|
||||
currentRatio = attachment.attributes.width / attachment.attributes.height,
|
||||
alreadyCropped = false;
|
||||
|
||||
// Check if the image already has the correct aspect ratio (with a small tolerance).
|
||||
if ( Math.abs( currentRatio - targetRatio ) < 0.01 ) {
|
||||
// Check if this is the same image that was already selected.
|
||||
if ( attachment.id !== parseInt( $hiddenDataField.val(), 10 ) ) {
|
||||
// This is a new image with the correct aspect ratio.
|
||||
$hiddenDataField.val( attachment.id );
|
||||
}
|
||||
|
||||
alreadyCropped = true;
|
||||
}
|
||||
|
||||
if ( alreadyCropped ) {
|
||||
// Skip cropping for already cropped images.
|
||||
switchToUpdate( attachment.attributes );
|
||||
frame.close();
|
||||
} else {
|
||||
frame.setState( 'cropper' );
|
||||
}
|
||||
} );
|
||||
|
||||
frame.open();
|
||||
} );
|
||||
|
||||
/**
|
||||
* Update the UI when a header is selected.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param {array} attributes The attributes for the attachment.
|
||||
*/
|
||||
function switchToUpdate( attributes ) {
|
||||
var i18nAppAlternativeString, i18nBrowserAlternativeString;
|
||||
|
||||
if ( attributes.alt ) {
|
||||
i18nBrowserAlternativeString = wp.i18n.sprintf(
|
||||
/* translators: %s: The selected image alt text. */
|
||||
wp.i18n.__( 'Header Image preview: Current image: %s' ),
|
||||
attributes.alt
|
||||
);
|
||||
} else {
|
||||
i18nAppAlternativeString = wp.i18n.sprintf(
|
||||
/* translators: %s: The selected image filename. */
|
||||
wp.i18n.__(
|
||||
'Header Image preview: The current image has no alternative text. The file name is: %s'
|
||||
),
|
||||
attributes.filename
|
||||
);
|
||||
i18nBrowserAlternativeString = wp.i18n.sprintf(
|
||||
/* translators: %s: The selected image filename. */
|
||||
wp.i18n.__(
|
||||
'Header Image preview: The current image has no alternative text. The file name is: %s'
|
||||
),
|
||||
attributes.filename
|
||||
);
|
||||
}
|
||||
|
||||
// Set activitypub-header-image-preview src.
|
||||
$headerImagePreview.attr( {
|
||||
src: attributes.url,
|
||||
alt: i18nAppAlternativeString,
|
||||
} );
|
||||
|
||||
// Remove hidden class from header image preview div and remove button.
|
||||
$headerImagePreviewWrapper.removeClass( 'hidden' );
|
||||
$removeButton.removeClass( 'hidden' );
|
||||
|
||||
// If the choose button is not in the update state, swap the classes.
|
||||
if ( $chooseButton.attr( 'data-state' ) !== '1' ) {
|
||||
$chooseButton.attr( {
|
||||
class: $chooseButton.attr( 'data-alt-classes' ),
|
||||
'data-alt-classes': $chooseButton.attr( 'class' ),
|
||||
'data-state': '1',
|
||||
} );
|
||||
}
|
||||
|
||||
// Swap the text of the choose button.
|
||||
$chooseButton.text( $chooseButton.attr( 'data-update-text' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the click event of the remove button.
|
||||
*
|
||||
* @since 6.5.0
|
||||
*/
|
||||
$removeButton.on( 'click', function () {
|
||||
$hiddenDataField.val( 'false' );
|
||||
$( this ).toggleClass( 'hidden' );
|
||||
$headerImagePreviewWrapper.toggleClass( 'hidden' );
|
||||
$headerImagePreview.attr( {
|
||||
src: '',
|
||||
alt: '',
|
||||
} );
|
||||
|
||||
/**
|
||||
* Resets state to the button, for correct visual style and state.
|
||||
* Updates the text of the button.
|
||||
* Sets focus state to the button.
|
||||
*/
|
||||
$chooseButton
|
||||
.attr( {
|
||||
class: $chooseButton.attr( 'data-alt-classes' ),
|
||||
'data-alt-classes': $chooseButton.attr( 'class' ),
|
||||
'data-state': '',
|
||||
} )
|
||||
.text( $chooseButton.attr( 'data-choose-text' ) )
|
||||
.trigger( 'focus' );
|
||||
} );
|
||||
} )( jQuery );
|
||||
Reference in New Issue
Block a user