<commit_before>/* This file is part of Indico.
 * Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
 *
 * Indico is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 3 of the
 * License, or (at your option) any later version.
 *
 * Indico is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Indico; if not, see <http://www.gnu.org/licenses/>.
 */

(function(global) {
    'use strict';

    global.setupEventDisplay = function setupEventDisplay() {
        $('.js-go-to-day').dropdown({
            always_listen: true
        }).find('li a').on('menu_select', function() {
            window.location = $(this).attr('href');
            return false;
        });

        var selectors = ['.notes-editor', '.notes-compile',
                         '.contribution-edit', '.subcontribution-edit'].join(', ');
        $(selectors).on('click', function(e) {
            e.preventDefault();
            var $this = $(this);
            ajaxDialog({
                title: $this.data('title'),
                url: $this.data('href'),
                confirmCloseUnsaved: true,
                onClose: function(data, customData) {
                    if (data || customData) {
                        location.reload();
                    }
                }
            });
            return false;
        });

        $(document).ready(function() {
            $('h1, .subLevelTitle, .subEventLevelTitle, .topLevelTitle').mathJax();
        });
    };

    global.toggleNote = function toggleNote(element, visible, immediate) {
        // Note for event
        var note = element.closest('#event-note-section');
        // Note for other elements
        if (note.length === 0) {
            note = element.closest('li').children('.note-area-wrapper');
        }
        var content = note.hasClass('togglable') ? note : note.find('.togglable');
        if (immediate) {
            content.toggle(visible);
        } else {
            content[visible === undefined ? 'slideToggle' : visible ? 'slideDown' : 'slideUp']();
        }
    };

    $(document).ready(function() {
        $('.event-service-row > .trigger').on('click', function() {
            var toggler = $(this);
            toggler.siblings('.event-service-details').slideToggle({
                start: function() {
                    toggler.toggleClass('icon-expand icon-collapse');
                },
                duration: 'fast'
            });
        });

        $('.event-service-row-toggle').on('click', function(e) {
            e.preventDefault();
            var toggler = $(this);
            var toggler_button = $(this).parent().siblings('.trigger');
            toggler.parent().siblings('.event-service-details').slideToggle({
                start: function() {
                    toggler_button.toggleClass('icon-expand icon-collapse');
                },
                duration: 'fast'
            });
        });

        var gradientLayer = $('.participant-list-wrapper > .gradient-layer');
        var heightControl = $('<div>', {'class': 'height-control'});
        gradientLayer.append(heightControl);
        var threeRowsHeight = heightControl.height();
        $('.participant-list-wrapper').toggleClass('collapsible collapsed',
            $('.participant-list').height() > threeRowsHeight);
        var initialHeight = $('.participant-list-wrapper').height();
        heightControl.remove();

        $('.participant-list-wrapper > .trigger, .participant-list-wrapper > .gradient-layer').on('click', function() {
            var toggler = $('.participant-list-wrapper > .trigger');
            var participantList = toggler.siblings('.participant-list');<commit_msg>Fix snake case naming in JS<commit_after>/* This file is part of Indico.
 * Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
 *
 * Indico is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 3 of the
 * License, or (at your option) any later version.
 *
 * Indico is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Indico; if not, see <http://www.gnu.org/licenses/>.
 */

(function(global) {
    'use strict';

    global.setupEventDisplay = function setupEventDisplay() {
        $('.js-go-to-day').dropdown({
            always_listen: true
        }).find('li a').on('menu_select', function() {
            window.location = $(this).attr('href');
            return false;
        });

        var selectors = ['.notes-editor', '.notes-compile',
                         '.contribution-edit', '.subcontribution-edit'].join(', ');
        $(selectors).on('click', function(e) {
            e.preventDefault();
            var $this = $(this);
            ajaxDialog({
                title: $this.data('title'),
                url: $this.data('href'),
                confirmCloseUnsaved: true,
                onClose: function(data, customData) {
                    if (data || customData) {
                        location.reload();
                    }
                }
            });
            return false;
        });

        $(document).ready(function() {
            $('h1, .subLevelTitle, .subEventLevelTitle, .topLevelTitle').mathJax();
        });
    };

    global.toggleNote = function toggleNote(element, visible, immediate) {
        // Note for event
        var note = element.closest('#event-note-section');
        // Note for other elements
        if (note.length === 0) {
            note = element.closest('li').children('.note-area-wrapper');
        }
        var content = note.hasClass('togglable') ? note : note.find('.togglable');
        if (immediate) {
            content.toggle(visible);
        } else {
            content[visible === undefined ? 'slideToggle' : visible ? 'slideDown' : 'slideUp']();
        }
    };

    $(document).ready(function() {
        $('.event-service-row > .trigger').on('click', function() {
            var toggler = $(this);
            toggler.siblings('.event-service-details').slideToggle({
                start: function() {
                    toggler.toggleClass('icon-expand icon-collapse');
                },
                duration: 'fast'
            });
        });

        $('.event-service-row-toggle').on('click', function(e) {
            e.preventDefault();
            var toggler = $(this);
            var togglerButton = $(this).parent().siblings('.trigger');
            toggler.parent().siblings('.event-service-details').slideToggle({
                start: function() {
                    togglerButton.toggleClass('icon-expand icon-collapse');
                },
                duration: 'fast'
            });
        });

        var gradientLayer = $('.participant-list-wrapper > .gradient-layer');
        var heightControl = $('<div>', {'class': 'height-control'});
        gradientLayer.append(heightControl);
        var threeRowsHeight = heightControl.height();
        $('.participant-list-wrapper').toggleClass('collapsible collapsed',
            $('.participant-list').height() > threeRowsHeight);
        var initialHeight = $('.participant-list-wrapper').height();
        heightControl.remove();

        $('.participant-list-wrapper > .trigger, .participant-list-wrapper > .gradient-layer').on('click', function() {
            var toggler = $('.participant-list-wrapper > .trigger');
            var participantList = toggler.siblings('.participant-list');
{'fraction_non_alphanumeric': 0.14334554334554334, 'fraction_numerical': 0.002686202686202686, 'mean_word_length': 2.0540641312453394, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 0, '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': '5928683', 'n_tokens_mistral': 2157, 'n_tokens_neox': 2073, 'n_words': 524}