Skip to content

Commit

Permalink
Minor formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arunshenoy99 committed Dec 17, 2024
1 parent ea3bf5c commit fae8475
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
1 change: 0 additions & 1 deletion components/advancedSettings/JetpackBoost/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const JetpackBoost = ( { methods, constants } ) => {
value: NewfoldRuntime.sdk.performance.jetpack_boost_critical_css,
type: 'toggle',
externalText: sprintf(
// translators: %1$s is the opening <a> tag, %2$s is the closing </a> tag.
constants.text.jetpackBoostDiscoverMore,
'<a href="' +
siteUrl +
Expand Down
18 changes: 9 additions & 9 deletions components/linkPrefetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const LinkPrefetch = ( { methods, constants } ) => {
const [ settings, setSettings ] = methods.useState(
methods.NewfoldRuntime.sdk.linkPrefetch.settings
);
const [ ignoreKeywords, setIgnoreKeywords ] = methods.useState( settings.ignoreKeywords )
const [ ignoreKeywords, setIgnoreKeywords ] = methods.useState(
settings.ignoreKeywords
);
const [ isError, setIsError ] = methods.useState( false );
const apiUrl = methods.NewfoldRuntime.createApiUrl(
'/newfold-performance/v1/link-prefetch/settings'
Expand All @@ -33,13 +35,13 @@ const LinkPrefetch = ( { methods, constants } ) => {
} );
};

const handleChangeOptionIgnoreKeywords = (value) => {
clearTimeout(ignoreKeywordsTimer);
const handleChangeOptionIgnoreKeywords = ( value ) => {
clearTimeout( ignoreKeywordsTimer );
setIgnoreKeywords( value );
ignoreKeywordsTimer = setTimeout(function () {
ignoreKeywordsTimer = setTimeout( function () {
handleChangeOption( 'ignoreKeywords', value );
}, 700);
}
}, 700 );
};

methods.useUpdateEffect( () => {
methods.setStore( {
Expand Down Expand Up @@ -214,9 +216,7 @@ const LinkPrefetch = ( { methods, constants } ) => {
constants.text.linkPrefetchIgnoreKeywordsDescription
}
onChange={ ( e ) =>
handleChangeOptionIgnoreKeywords(
e.target.value
)
handleChangeOptionIgnoreKeywords( e.target.value )
}
value={ ignoreKeywords }
/>
Expand Down
6 changes: 5 additions & 1 deletion components/performance/defaultText.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ const defaultText = {
'Activation failed',
'wp-module-performance'
),
jetpackBoostDiscoverMore: __( 'Discover more %1$shere%2$s', 'wp-plugin-hostgator' ),
// translators: %1$s is the opening <a> tag, %2$s is the closing </a> tag.
jetpackBoostDiscoverMore: __(
'Discover more %1$shere%2$s',
'wp-module-performance'
),
optionSet: __( 'Option saved correctly', 'wp-module-performance' ),
optionNotSet: __( 'Error saving option', 'wp-module-performance' ),
};
Expand Down
5 changes: 4 additions & 1 deletion components/performance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ const Performance = ( { methods, constants, Components, ...props } ) => {
>
<AdvancedSettings constants={ constants } methods={ methods } />
</Container.Block>
<Container.Block className={ 'newfold-link-prefetch' } separator={ true }>
<Container.Block
className={ 'newfold-link-prefetch' }
separator={ true }
>
<LinkPrefetch methods={ methods } constants={ constants } />
</Container.Block>
</>
Expand Down
11 changes: 5 additions & 6 deletions scripts/linkPrefetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ document.addEventListener( 'DOMContentLoaded', () => {
activeOnDesktop: config.activeOnDesktop,
behavior: config.behavior,
hoverDelay: parseInt( config.hoverDelay ) || 60,
ignoreKeywords: config.ignoreKeywords ? config.ignoreKeywords.split( ',' ) : '',
ignoreKeywords: config.ignoreKeywords
? config.ignoreKeywords.split( ',' )
: '',
instantClick: config.instantClick,
mobileActive: config.activeOnMobile,
isMobile: config.isMobile,
Expand Down Expand Up @@ -142,11 +144,8 @@ document.addEventListener( 'DOMContentLoaded', () => {
if (
url.replace( /\/$/, '' ) ===
location.href.replace( /\/$/, '' ) ||
(
this.ignoreKeywords !== '' &&
this.ignoreKeywords.some( ( k ) => url.includes( k ) )
)

( this.ignoreKeywords !== '' &&
this.ignoreKeywords.some( ( k ) => url.includes( k ) ) )
) {
return false;
}
Expand Down

0 comments on commit fae8475

Please sign in to comment.