Skip to content

Commit

Permalink
Merge pull request #20411 from Yoast/dom-text-reinterpreted-as-html
Browse files Browse the repository at this point in the history
Code cleanup outdated addons tabs in metabox
  • Loading branch information
enricobattocchi authored Jun 19, 2023
2 parents c503f67 + 4cf2f31 commit b8b8c55
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 178 deletions.
126 changes: 0 additions & 126 deletions css/src/metabox.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion inc/class-wpseo-meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ public static function keyword_usage( $keyword, $post_id ) {
->find_array();

// Get object_id from each subarray in $post_ids.
$post_ids = array_column( $post_ids, 'object_id' );
$post_ids = ( is_array( $post_ids ) ) ? array_column( $post_ids, 'object_id' ) : [];

/*
* If Premium is installed, get the additional keywords as well.
Expand Down
12 changes: 0 additions & 12 deletions packages/js/src/analysis/TermDataCollector.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,4 @@ TermDataCollector.prototype.saveInclusiveLanguageScore = function( score ) {
$( "#hidden_wpseo_inclusive_language_score" ).val( score );
};

/**
* Initializes keyword tab with the correct template.
*
* @returns {void}
*/
TermDataCollector.prototype.initKeywordTabTemplate = function() {
// Remove default functionality to prevent scrolling to top.
$( ".wpseo-metabox-tabs" ).on( "click", ".wpseo_tablink", function( ev ) {
ev.preventDefault();
} );
};

export default TermDataCollector;
31 changes: 0 additions & 31 deletions packages/js/src/initializers/metabox-tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,34 +157,6 @@ export default function initTabs( jQuery ) {
* @returns {void}
*/
function wpseoInitTabs() {
// When there's only one add-on tab, change its link to a span element.
var addonsTabsLinks = jQuery( "#wpseo-meta-section-addons .wpseo_tablink" );
if ( addonsTabsLinks.length === 1 ) {
addonsTabsLinks.replaceWith( "<span class='" + addonsTabsLinks[ 0 ].className + "'>" + addonsTabsLinks.text() + "</span>" );
}

// Tabs within the main tabs, e.g.: Facebook, Twitter, Video, and News.
if ( jQuery( ".wpseo-metabox-tabs-div" ).length > 0 ) {
jQuery( ".wpseo-metabox-tabs" )
.on( "click", "a.wpseo_tablink", function( ev ) {
ev.preventDefault();

jQuery( ".wpseo-meta-section.active .wpseo-metabox-tabs li" ).removeClass( "active" );
jQuery( ".wpseo-meta-section.active .wpseotab" ).removeClass( "active" );

var targetElem = jQuery( jQuery( this ).attr( "href" ) );
targetElem.addClass( "active" );
jQuery( this ).parent( "li" ).addClass( "active" );

// Not used at the moment.
if ( jQuery( this ).hasClass( "scroll" ) ) {
jQuery( "html, body" ).animate( {
scrollTop: jQuery( targetElem ).offset().top,
}, 500 );
}
} );
}

// Main tabs.
if ( jQuery( ".wpseo-meta-section" ).length > 0 ) {
const tabLinks = jQuery( ".wpseo-meta-section-link" );
Expand Down Expand Up @@ -232,8 +204,6 @@ export default function initTabs( jQuery ) {
wpseoAriaTabSetActiveAttributes( this, tabLinks );
} );
}

jQuery( ".wpseo-metabox-tabs" ).show();
// End Tabs code.
}

Expand All @@ -243,7 +213,6 @@ export default function initTabs( jQuery ) {

// Set up the first tab and panel within the main tabs.
jQuery( ".wpseo-meta-section" ).each( function( index, el ) {
jQuery( el ).find( ".wpseo-metabox-tabs li:first" ).addClass( "active" );
jQuery( el ).find( ".wpseotab:first" ).addClass( "active" );
} );

Expand Down
10 changes: 2 additions & 8 deletions packages/js/src/initializers/term-scraper.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,11 @@ export default function initTermScraper( $, store, editorData ) {
/**
* Initializes keyword analysis.
*
* @param {TermDataCollector} termScraper The post scraper object.
*
* @returns {void}
*/
function initializeKeywordAnalysis( termScraper ) {
function initializeKeywordAnalysis() {
var savedKeywordScore = $( "#hidden_wpseo_linkdex" ).val();

termScraper.initKeywordTabTemplate();

var indicator = getIndicatorForScore( savedKeywordScore );

updateTrafficLight( indicator );
Expand Down Expand Up @@ -373,8 +369,6 @@ export default function initTermScraper( $, store, editorData ) {
app.seoAssessorPresenter.assessor = app.seoAssessor;
}

termScraper.initKeywordTabTemplate();

// Init Plugins.
window.YoastSEO.wp = {};
window.YoastSEO.wp.replaceVarsPlugin = new YoastReplaceVarPlugin( app, store );
Expand All @@ -392,7 +386,7 @@ export default function initTermScraper( $, store, editorData ) {
), refreshDelay ) );

if ( isKeywordAnalysisActive() ) {
initializeKeywordAnalysis( termScraper );
initializeKeywordAnalysis();
}

if ( isContentAnalysisActive() ) {
Expand Down

0 comments on commit b8b8c55

Please sign in to comment.