
var totale_parole = 0;
var index_totale = 0;

if(SYRUS_THEME_OPTIONS_ADS.includes('post_blocco_1'))
    delete args_single_post.blocchi[0];

if(SYRUS_THEME_OPTIONS_ADS.includes('post_blocco_2'))
    delete args_single_post.blocchi[1];

if(SYRUS_THEME_OPTIONS_ADS.includes('post_blocco_3'))
    delete args_single_post.blocchi[2];

jQuery(document).ready(() => {
    jQuery('#single-post-the-content').find('p').each((index,element) => {
        let parole_paragrafo = jQuery(element).text().split(" ").length;
        totale_parole += parole_paragrafo;
    
        if(totale_parole > 149 && index_totale < 3){
            if(typeof args_single_post.blocchi[index_totale] != 'undefined')
                jQuery("<div id='syrus_theme_option_ads_blocco_" + (index_totale + 1) + "'>" + args_single_post.blocchi[index_totale] + "</div>").appendTo(jQuery(element));
            totale_parole = 0;
            index_totale++;
        }
    });
})