<commit_before>﻿var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
    name:'Wordpress',
    version:'2.2',
    prepareImgLinks:function (callback) {
        var res = [];

        $('img[src*="wp-content"]').each(function () {
            var img = $(this),
                //re = /-\d+x\d+\./,
                //a global search is needed
                //ex:"https://globalvoices.org/wp-content/uploads/2018/11/Migrants_in_Hungary_2015_Aug_018-800x450-400x300.jpg"
                // or: https://www.ece.fr/ecole-ingenieur/wp-content/uploads/2013/08/prepa-integree-ecole-ingenieur-454x240-c-default.jpg
                re = /-\d\d+x\d\d+/ig,
                src = this.src;
            if (src.match(re)) {
                src = src.replace('-c-default', '').replace(re, '');
                img.data().hoverZoomSrc = [src, src.replace(/jpg$/, 'jpeg')];
                res.push(img);
            }
        });

        // background images
        $('[style]').each(function() {

            // extract url from style
            // ex: style="background-image: url(https://globalvoices.org/wp-content/uploads/2019/01/20160507_KAR5877-400x300.jpg)"
            var backgroundImage = this.style.backgroundImage;
            if (backgroundImage.indexOf('wp-content') != -1) {
                var reUrl = /.*url\s*\(\s*(.*)\s*\).*/i
                backgroundImage = backgroundImage.replace(reUrl, '$1');
                // remove leading & trailing quotes
                var backgroundImageUrl = backgroundImage.replace(/^['"]/,"").replace(/['"]+$/,"");
                var reThumb = /-\d\d+x\d\d+/ig
                var fullsizeUrl = backgroundImageUrl.replace('-c-default', '').replace(reThumb, '');
                if (fullsizeUrl != backgroundImageUrl) {
                    var link = $(this);
                    if (link.data().hoverZoomSrc == undefined) { link.data().hoverZoomSrc = [] }
                    if (link.data().hoverZoomSrc.indexOf(fullsizeUrl) == -1) {
                        link.data().hoverZoomSrc.unshift(fullsizeUrl);
                        res.push(link);
                    }
                }
            }
        });

        callback($(res), this.name);
    }
});<commit_msg>Style fix for wordpress plugin<commit_after>﻿var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
    name:'Wordpress',
    version:'2.2',
    prepareImgLinks:function (callback) {
        var res = [];

        $('img[src*="wp-content"]').each(function () {
            let img = $(this),
                // a global search is needed
                // ex:"https://globalvoices.org/wp-content/uploads/2018/11/Migrants_in_Hungary_2015_Aug_018-800x450-400x300.jpg"
                // or: https://www.ece.fr/ecole-ingenieur/wp-content/uploads/2013/08/prepa-integree-ecole-ingenieur-454x240-c-default.jpg
                re = /-\d\d+x\d\d+/ig,
                src = this.src;
            if (src.match(re)) {
                src = src.replace('-c-default', '').replace(re, '');
                img.data().hoverZoomSrc = [src, src.replace(/jpg$/, 'jpeg')];
                res.push(img);
            }
        });

        // background images
        $('[style]').each(function() {
            // extract url from style
            // ex: style="background-image: url(https://globalvoices.org/wp-content/uploads/2019/01/20160507_KAR5877-400x300.jpg)"
            let backgroundImage = this.style.backgroundImage;
            if (backgroundImage.indexOf('wp-content') !== -1) {
                const reUrl = /.*url\s*\(\s*(.*)\s*\).*/i;
                let backgroundImageUrl = backgroundImage.replace(reUrl, '$1');
                // remove leading & trailing quotes
                backgroundImageUrl = backgroundImageUrl.replace(/^['"]/, "").replace(/['"]+$/, "");
                const reThumb = /-\d\d+x\d\d+/ig;
                const fullsizeUrl = backgroundImageUrl.replace('-c-default', '').replace(reThumb, '');
                if (fullsizeUrl !== backgroundImageUrl) {
                    const link = $(this);
                    if (link.data().hoverZoomSrc === undefined) { link.data().hoverZoomSrc = [] }
                    if (link.data().hoverZoomSrc.indexOf(fullsizeUrl) === -1) {
                        link.data().hoverZoomSrc.unshift(fullsizeUrl);
                        res.push(link);
                    }
                }
            }
        });

        callback($(res), this.name);
    }
});
{'fraction_non_alphanumeric': 0.17110266159695817, 'fraction_numerical': 0.029523596510847686, 'mean_word_length': 1.668257756563246, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, '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': '200074', 'n_tokens_mistral': 1446, 'n_tokens_neox': 1292, 'n_words': 185}