<commit_before>var $body;
var $modal;
var $modalCover;
var $newComponentItem;
var $changedInput;
var $spinner;
var $newComponentTypePicker;
var $newComponentTemplatePickers;
var $newComponentButton;

$(document).ready(function () {
    $body = $('body');
    $modal = $('.history-modal');
    $modalCover = $('<div class="modal-cover">');
    // cdodge: this looks funny, but on AWS instances, this base.js get's wrapped in a separate scope as part of Django static
    // pipelining (note, this doesn't happen on local runtimes). So if we set it on window, when we can access it from other
    // scopes (namely the course-info tab)
    window.$modalCover = $modalCover;

    $body.append($modalCover);
    $newComponentItem = $('.new-component-item');
    $newComponentTypePicker = $('.new-component');
    $newComponentTemplatePickers = $('.new-component-templates');
    $newComponentButton = $('.new-component-button');
    $spinner = $('<span class="spinner-in-field-icon"></span>');
    $body.bind('keyup', onKeyUp);

    $('.expand-collapse-icon').bind('click', toggleSubmodules);
    $('.visibility-options').bind('change', setVisibility);

    $modal.bind('click', hideModal);
    $modalCover.bind('click', hideModal);
    $('.uploads .upload-button').bind('click', showUploadModal);
    $('.upload-modal .close-button').bind('click', hideModal);

    $body.on('click', '.embeddable-xml-input', function () {
        $(this).select();
    });

    $('body').addClass('js');

    $('.unit .item-actions .delete-button').bind('click', deleteUnit);
    $('.new-unit-item').bind('click', createNewUnit);

    // lean/simple modal
    $('a[rel*=modal]').leanModal({overlay : 0.80, closeButton: '.action-modal-close' });
    $('a.action-modal-close').click(function(e){
        (e).preventDefault();
    });

    // nav - dropdown related
    $body.click(function (e) {
        $('.nav-dropdown .nav-item .wrapper-nav-sub').removeClass('is-shown');
        $('.nav-dropdown .nav-item .title').removeClass('is-selected');
    });

    $('.nav-dropdown .nav-item .title').click(function (e) {

        $subnav = $(this).parent().find('.wrapper-nav-sub');
        $title = $(this).parent().find('.title');
        e.preventDefault();
        e.stopPropagation();

        if ($subnav.hasClass('is-shown')) {
            $subnav.removeClass('is-shown');
            $title.removeClass('is-selected');
        }

        else {
            $('.nav-dropdown .nav-item .title').removeClass('is-selected');
            $('.nav-dropdown .nav-item .wrapper-nav-sub').removeClass('is-shown');
            $title.addClass('is-selected');
            $subnav.addClass('is-shown');
        }
    });

    // general link management - new window/tab<commit_msg>studio - alerts: adding back in manual close behavior to base.js (needed across app)<commit_after>var $body;
var $modal;
var $modalCover;
var $newComponentItem;
var $changedInput;
var $spinner;
var $newComponentTypePicker;
var $newComponentTemplatePickers;
var $newComponentButton;

$(document).ready(function () {
    $body = $('body');
    $modal = $('.history-modal');
    $modalCover = $('<div class="modal-cover">');
    // cdodge: this looks funny, but on AWS instances, this base.js get's wrapped in a separate scope as part of Django static
    // pipelining (note, this doesn't happen on local runtimes). So if we set it on window, when we can access it from other
    // scopes (namely the course-info tab)
    window.$modalCover = $modalCover;

    $body.append($modalCover);
    $newComponentItem = $('.new-component-item');
    $newComponentTypePicker = $('.new-component');
    $newComponentTemplatePickers = $('.new-component-templates');
    $newComponentButton = $('.new-component-button');
    $spinner = $('<span class="spinner-in-field-icon"></span>');
    $body.bind('keyup', onKeyUp);

    $('.expand-collapse-icon').bind('click', toggleSubmodules);
    $('.visibility-options').bind('change', setVisibility);

    $modal.bind('click', hideModal);
    $modalCover.bind('click', hideModal);
    $('.uploads .upload-button').bind('click', showUploadModal);
    $('.upload-modal .close-button').bind('click', hideModal);

    $body.on('click', '.embeddable-xml-input', function () {
        $(this).select();
    });

    $('body').addClass('js');

    $('.unit .item-actions .delete-button').bind('click', deleteUnit);
    $('.new-unit-item').bind('click', createNewUnit);

    // lean/simple modal
    $('a[rel*=modal]').leanModal({overlay : 0.80, closeButton: '.action-modal-close' });
    $('a.action-modal-close').click(function(e){
        (e).preventDefault();
    });

    // alerts - manual close
    $('.action-alert-close, .alert.has-actions .nav-actions a').click(function(e) {
        (e).preventDefault();
        $(this).closest('.wrapper-alert').removeClass('is-shown');
    });

    // notifications - manual & action-based close
    $('.action-notification-close').click(function(e) {
        (e).preventDefault();
        $(this).closest('.wrapper-notification').removeClass('is-shown').addClass('is-hiding');
    });

    // nav - dropdown related
    $body.click(function (e) {
        $('.nav-dropdown .nav-item .wrapper-nav-sub').removeClass('is-shown');
        $('.nav-dropdown .nav-item .title').removeClass('is-selected');
    });

    $('.nav-dropdown .nav-item .title').click(function (e) {

        $subnav = $(this).parent().find('.wrapper-nav-sub');
        $title = $(this).parent().find('.title');
        e.preventDefault();
        e.stopPropagation();

        if ($subnav.hasClass('is-shown')) {
            $subnav.removeClass('is-shown');
            $title.removeClass('is-selected');
        }

        else {
            $('.nav-dropdown .nav-item .title').removeClass('is-selected');
            $('.nav-dropdown .nav-item .wrapper-nav-sub').removeClass('is-shown');
            $title.addClass('is-selected');
            $subnav.addClass('is-shown');
        }
    });

    // general link management - new window/tab
{'fraction_non_alphanumeric': 0.19811007957559681, 'fraction_numerical': 0.0009946949602122016, 'mean_word_length': 3.14070006863418, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '5861281', 'n_tokens_mistral': 1851, 'n_tokens_neox': 1781, 'n_words': 351}