<commit_before>// ==UserScript==
// @name         O Antagonista - Speed Reading
// @namespace    http://oantagonista.com/speedread
// @version      0.6.3
// @description  Fast reading of the micro blog!
// @author       ViZeke
// @match        http://www.oantagonista.com/
// @match        http://www.oantagonista.com/pagina/*
// @grant        none
// @require      https://code.jquery.com/jquery-2.1.4.min.js
// ==/UserScript==

(function($) {
    'use strict';

    function addGlobalStyle(css) {
        var head, style;
        head = document.getElementsByTagName('head')[0];
        if (!head) { return; }
        style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = css;
        head.appendChild(style);
    }

    function procArticles($articles){
        var baseUrlPosts = 'http://www.oantagonista.com';

        $articles.each(function(i, itemPost) {
            var url = baseUrlPosts + $(itemPost).first().find('a').first().attr('href');

            $.get(url)
                .success(function(response) {

                var $content = $(response).find('div.l-main-right:first');
                $content.find('h2').remove();
                $content.find('span.post-meta').remove();
                $content.find('div.cpt-post.container-cpt').remove();
                $content.find('div.share').remove();
                $content.find('div.OUTBRAIN').remove();
                $content.find('div.l-main-right').remove();
                $content.find('script').remove();

                $(itemPost).attr('processed', 1);
                $(itemPost).find('p').remove();
                $(itemPost).find('.post-more').remove();
                $(itemPost).find('.post-summary').append($content);
            });
        });
    }

    function cleanAds(){
        $('div.banner').remove();
        $('aside').remove();
        $('ins').remove();
        $('div.ob-widget').remove();
        $('div.header-newsletter').remove()
    }

    var procArticle = true;
    var procClean = true;

    $(document).scroll(function(){
        if (procArticle){
            setTimeout(function(){
                procArticles($('article.post[processed!=1]'));
                procArticle = true;
            }, 1000);
        }
        if (procClean){
            setTimeout(function(){
                cleanAds();
                procClean = true;
            }, 2000);
        }
        procArticle = false;
        procClean = false;
    });

    //Init
    addGlobalStyle('div.post-summary { width: auto; }');
    addGlobalStyle('article.post.first-post { margin-top: 25px; }');

    cleanAds();
    procArticles($('article.post[processed!=1]'));

})(jQuery);

//Init on global context
$(document).ready(function(){
    //specific site function in case of overlay adds
    if (dclk_hide_overlay)
        dclk_hide_overlay();
});<commit_msg>improve procArticles. Take care of TV Antagonista<commit_after>// ==UserScript==
// @name         O Antagonista - Speed Reading
// @namespace    http://oantagonista.com/speedread
// @version      0.7.0
// @description  Fast reading of the micro blog!
// @author       ViZeke
// @match        http://www.oantagonista.com/
// @match        http://www.oantagonista.com/pagina/*
// @grant        none
// @require      https://code.jquery.com/jquery-2.1.4.min.js
// ==/UserScript==

(function($) {
    'use strict';

    let tvAntagonista = false;

    let addGlobalStyle = (css) => {
        var head, style;
        head = document.getElementsByTagName('head')[0];
        if (!head) { return; }
        style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = css;
        head.appendChild(style);
    };

    function procArticles($articles){
        const baseUrlPosts = 'http://www.oantagonista.com';

        $articles.each( (i, itemPost) => {
            const url = baseUrlPosts + $(itemPost).first().find('a').first().attr('href');

            $.get(url)
                .success( response => {

                let $allContent = $(response).find('div.l-main-right:first');
                let $content = $allContent.find('div.the-content-text');
                if (!tvAntagonista){
                    $content.append($allContent.find('#dm_jukebox_iframe'));
                    tvAntagonista = true;
                }

                $(itemPost).attr('processed', 1);
                $(itemPost).find('p').remove();
                $(itemPost).find('.post-more').remove();
                $(itemPost).find('.post-summary').append($content);
            });
        });
    }

    let cleanAds = () => {
        $('div.banner').remove();
        $('aside').remove();
        $('ins').remove();
        $('div.ob-widget').remove();
    };

    let procArticle = true;
    let procClean = true;

    $(document).scroll( () => {
        if ( procArticle ){
            setTimeout( () => {
                procArticles($('article.post[processed!=1]'));
                procArticle = true;
            }, 1000);
        }
        if ( procClean ){
            setTimeout( () => {
                cleanAds();
                procClean = true;
            }, 2000);
        }
        procArticle = false;
        procClean = false;
    });

    //Init
    addGlobalStyle('div.post-summary { width: auto; }');
    addGlobalStyle('article.post.first-post { margin-top: 25px; }');

    cleanAds();
    procArticles($('article.post[processed!=1]'));
})(jQuery);

//Init on global context
$(document).ready( () => {
    //specific site function in case of overlay adds
    if (dclk_hide_overlay) {
        dclk_hide_overlay();
    }
});
{'fraction_non_alphanumeric': 0.1746871144015512, 'fraction_numerical': 0.00722721664022563, 'mean_word_length': 1.8948979591836734, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '642960', 'n_tokens_mistral': 1720, 'n_tokens_neox': 1611, 'n_words': 282}