<commit_before>
import Wreqr from 'backbone.wreqr';
import Marionette from 'backbone.marionette';
import CONST from 'const';
import template from 'templates/select/tile/tileColumn.ejs';
import templateListItem from 'templates/select/tile/item.ejs';


export default Marionette.LayoutView.extend({
    template,
    templateListItem,

    behaviors() {
        return {
            l20n: {},
            column: {
                appendToBody: true,
                destroyOnClose: true,
                routeOnClose: this.options.previousRoute,
            },
        };
    },

    ui: {
        column: '.column',
        tileList: '.tile_list',
        tiles: '.tile_list input',
        displayMore: '.display_more',
    },

    events: {
        'click @ui.tiles': 'onClickTiles',
        'click @ui.displayMore': 'onClickdisplayMore',
    },

    initialize() {
        this._radio = Wreqr.radio.channel('global');

        this.listenTo(this.model, 'change:tiles', this.onChangeModelTiles);

        this._radio.vent.on('theme:rendered', this.onRender.bind(this));

        this._moreTilesDisplayed = false;
    },

    onRender() {
        let tile;
        let checked;
        let html = '';
        let tiles = this.model.get('tiles');

        if (this._moreTilesDisplayed) {
            this.ui.displayMore.addClass('hide');

            tiles = Object.keys(CONST.map.tiles);
        }
        else {
            this.ui.displayMore.removeClass('hide');
        }

        this._fragment = this._radio.reqres.request('theme:fragment');
        const storage = JSON.parse( localStorage.getItem(`mapState-${this._fragment}`) ) || {};

        if ( storage.selectedTile ) {
            this._selectedInStorage = storage.selectedTile;
        }

        tiles.forEach((id) => {
            tile = CONST.map.tiles[id];

            if (!tile) {
                return;
            }

            let thumbnailHtml = '';

            for (let urlTemplate of tile.urlTemplate) {
                urlTemplate = urlTemplate.replace(/\{s\}/g, 'a')
                    .replace(/\{z\}/g, '9')
                    .replace(/\{y\}/g, '181');

                const urlTemplate1 = urlTemplate.replace(/\{x\}/g, '265');
                const urlTemplate2 = urlTemplate.replace(/\{x\}/g, '266');
<commit_msg>Keep the highlighted tiles on top of the list<commit_after>
import Wreqr from 'backbone.wreqr';
import Marionette from 'backbone.marionette';
import CONST from 'const';
import template from 'templates/select/tile/tileColumn.ejs';
import templateListItem from 'templates/select/tile/item.ejs';


export default Marionette.LayoutView.extend({
    template,
    templateListItem,

    behaviors() {
        return {
            l20n: {},
            column: {
                appendToBody: true,
                destroyOnClose: true,
                routeOnClose: this.options.previousRoute,
            },
        };
    },

    ui: {
        column: '.column',
        tileList: '.tile_list',
        tiles: '.tile_list input',
        displayMore: '.display_more',
    },

    events: {
        'click @ui.tiles': 'onClickTiles',
        'click @ui.displayMore': 'onClickdisplayMore',
    },

    initialize() {
        this._radio = Wreqr.radio.channel('global');

        this.listenTo(this.model, 'change:tiles', this.onChangeModelTiles);

        this._radio.vent.on('theme:rendered', this.onRender.bind(this));

        this._moreTilesDisplayed = false;
    },

    onRender() {
        let tile;
        let checked;
        let html = '';
        const tiles = this.model.get('tiles');

        if (this._moreTilesDisplayed) {
            this.ui.displayMore.addClass('hide');

            const supplementalTiles = Object.keys(CONST.map.tiles)
                .filter(tile => tiles.indexOf(tile) === -1);

            tiles.push(...supplementalTiles);
        }
        else {
            this.ui.displayMore.removeClass('hide');
        }

        this._fragment = this._radio.reqres.request('theme:fragment');
        const storage = JSON.parse( localStorage.getItem(`mapState-${this._fragment}`) ) || {};

        if ( storage.selectedTile ) {
            this._selectedInStorage = storage.selectedTile;
        }

        tiles.forEach((id) => {
            tile = CONST.map.tiles[id];

            if (!tile) {
                return;
            }

            let thumbnailHtml = '';

            for (let urlTemplate of tile.urlTemplate) {
                urlTemplate = urlTemplate.replace(/\{s\}/g, 'a')
                    .replace(/\{z\}/g, '9')
                    .replace(/\{y\}/g, '181');

                const urlTemplate1 = urlTemplate.replace(/\{x\}/g, '265');
                const urlTemplate2 = urlTemplate.replace(/\{x\}/g, '266');

{'fraction_non_alphanumeric': 0.1395007342143906, 'fraction_numerical': 0.006083490664988462, 'mean_word_length': 1.8653846153846154, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '955889', 'n_tokens_mistral': 1427, 'n_tokens_neox': 1362, 'n_words': 249}