<commit_before>// Create control and add some layers
// ----------------------------------
// ** advanced use **
var fpControl = new OpenLayers.Control.FeaturePopups({
    boxSelectionOptions: {},
    // ** Options for the SelectFeature control to select **
    selectOptions: {clickout: true},
    // ** Close the window when displaying the detail of an item **
    popupListItemOptions: {relatedToClear: ['list', 'single']},
    // ** Don't use close box on popups
    mode: OpenLayers.Control.FeaturePopups.DEFAULT & 
          ~OpenLayers.Control.FeaturePopups.CLOSE_BOX,
    // ** Overwrites html of the list popups adding a vacuum <li> before each item **
    popupListOptions: {eventListeners: {
        "beforepopupdisplayed": function(e){
            var html = [],
                htmlAux = [],
                feature0 = null;
            for (var i = 0, iLen = e.selection.length; i < iLen; i++) {
                var sel = e.selection[i],
                    layerObj = sel.layerObj;
                for (var ii = 0, iiLen = sel.features.length; ii < iiLen; ii++) {
                    if (ii > 0) { // remove the first feature to simulate a filter.
                        feature0 = sel.features[ii];
                        htmlAux.push(
                            layerObj.renderTemplate(layerObj.templates.item, feature0)
                        );
                    }
                }
            }
            if (htmlAux.length === 1) {
                layerObj.control.popupObjs.single.showPopup({
                        layerObj: layerObj,
                        layer: layerObj.layer,
                        feature: feature0
                    }, 
                    feature0.geometry.getBounds().getCenterLonLat(), 
                    layerObj.getSingleHtml(feature0).html, 
                    true
                );
                return false;
            }
            html.push(layerObj.renderTemplate(
                layerObj.templates.list, {
                    layer: sel.layer,
                    count: sel.features.length,
                    html: htmlAux.join('\n')
                }
            ));
            e.html = html.join('\n');
        }
    }},    
    // ** Overwrites html of the hover list popups adding a vacuum <hr> before each item **
    popupHoverListOptions: {eventListeners: {
        "beforepopupdisplayed": function(e){
            var htmlAux = [];
            var sel = e.selection,
                layerObj = sel.layerObj;<commit_msg>Make the simulation filter to work with more than one layer.<commit_after>// Create control and add some layers
// ----------------------------------
// ** advanced use **
var fpControl = new OpenLayers.Control.FeaturePopups({
    boxSelectionOptions: {},
    // ** Options for the SelectFeature control to select **
    selectOptions: {clickout: true},
    // ** Close the window when displaying the detail of an item **
    popupListItemOptions: {relatedToClear: ['list', 'single']},
    // ** Don't use close box on popups
    mode: OpenLayers.Control.FeaturePopups.DEFAULT & 
          ~OpenLayers.Control.FeaturePopups.CLOSE_BOX,
    // ** Overwrites html of the list popups adding a vacuum <li> before each item **
    popupListOptions: {eventListeners: {
        "beforepopupdisplayed": function(e){
            var html = [],
                feature0 = null,
                layerObj0 = null,
                count = 0;
            for (var i = 0, iLen = e.selection.length; i < iLen; i++) {
                var sel = e.selection[i],
                    htmlAux = [],
                    layerObj = sel.layerObj;
                for (var ii = 0, iiLen = sel.features.length; ii < iiLen; ii++) {
                    if (ii > 0 || iiLen === 1) { // remove the first feature to simulate a filter.
                        feature0 = sel.features[ii];
                        layerObj0 = layerObj;
                        count++;
                        htmlAux.push(
                            layerObj.renderTemplate(layerObj.templates.item, feature0)
                        );
                    }
                }
                html.push(layerObj.renderTemplate(
                    layerObj.templates.list, {
                        layer: sel.layer,
                        count: sel.features.length,
                        html: htmlAux.join('\n')
                    }
                ));
            }
            if (count === 1) {
                layerObj0.control.popupObjs.single.showPopup({
                        layerObj: layerObj0,
                        layer: layerObj.layer,
                        feature: feature0
                    }, 
                    feature0.geometry.getBounds().getCenterLonLat(), 
                    layerObj0.getSingleHtml(feature0).html, 
                    true
                );
                layerObj0 = null;
                feature0 = null;
                return false;
            }
            e.html = html.join('\n');
        }
    }},    
    // ** Overwrites html of the hover list popups adding a vacuum <hr> before each item **
    popupHoverListOptions: {eventListeners: {
        "beforepopupdisplayed": function(e){
            var htmlAux = [];
            var sel = e.selection,
                layerObj = sel.layerObj;
{'fraction_non_alphanumeric': 0.11309411985722337, 'fraction_numerical': 0.005448055607739997, 'mean_word_length': 1.2918639690055962, 'pattern_counts': {'":': 4, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '644393', 'n_tokens_mistral': 1378, 'n_tokens_neox': 1287, 'n_words': 338}