<commit_before>{% load i18n %}
<script type="text/javascript">
/* copied from django admin javascript files */
function id_to_windowname(text) {
    text = text.replace(/\./g, '__dot__');
    text = text.replace(/\-/g, '__dash__');
    return text;
}

function windowname_to_id(text) {
    text = text.replace(/__dot__/g, '.');
    text = text.replace(/__dash__/g, '-');
    return text;
}

function dismissRelatedLookupPopup(win, chosenId) {
    var name = windowname_to_id(win.name);
    var elem = document.getElementById(name);
    if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) {
        elem.value += ',' + chosenId;
    } else {
        document.getElementById(name).value = chosenId;
    }
    win.close();
}
/* until here */


pagecontent_init_handlers.push(function(){
    $('.order-machine input[name$=-mediafile]:visible').each(function(){
        var elem = $(this);

        elem.siblings('span').remove().end();
        elem.css('width', '50px').after('<span style="color:red" class="mediafile" id="lookup_'+this.id+'"> {% trans "Choose" %}</span>');
    });
});
$(function(){
    $('span.mediafile').livequery('click', function(){
        var name = id_to_windowname(this.id.replace(/^lookup_/, ''));
        var win = window.open('../../../medialibrary/mediafile/?pop=1', name, 'height=500,width=800,resizable=yes,scrollbars=yes');
        win.focus();
        return false;
    });
});
</script>
<style type="text/css">
span.mediafile {
    cursor: pointer;
}
</style>
<commit_msg>MediaFileContent admin: Remove file link when selecting another file<commit_after>{% load i18n %}
<script type="text/javascript">
/* copied from django admin javascript files */
function id_to_windowname(text) {
    text = text.replace(/\./g, '__dot__');
    text = text.replace(/\-/g, '__dash__');
    return text;
}

function windowname_to_id(text) {
    text = text.replace(/__dot__/g, '.');
    text = text.replace(/__dash__/g, '-');
    return text;
}

function dismissRelatedLookupPopup(win, chosenId) {
    var name = windowname_to_id(win.name);
    var elem = document.getElementById(name);
    if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) {
        elem.value += ',' + chosenId;
    } else {
        document.getElementById(name).value = chosenId;
    }
    win.close();

    $('#'+name).siblings('a, br').remove();
}
/* until here */


pagecontent_init_handlers.push(function(){
    $('.order-machine input[name$=-mediafile]:visible').each(function(){
        var elem = $(this);

        elem.siblings('span').remove().end();
        elem.css('width', '50px').after('<span style="color:red" class="mediafile" id="lookup_'+this.id+'"> {% trans "Choose" %}</span>');
    });
});
$(function(){
    $('span.mediafile').livequery('click', function(){
        var name = id_to_windowname(this.id.replace(/^lookup_/, ''));
        var win = window.open('../../../medialibrary/mediafile/?pop=1', name, 'height=500,width=800,resizable=yes,scrollbars=yes');
        win.focus();
        return false;
    });
});
</script>
<style type="text/css">
span.mediafile {
    cursor: pointer;
}
</style>

{'fraction_non_alphanumeric': 0.19936708860759494, 'fraction_numerical': 0.007594936708860759, 'mean_word_length': 3.5416666666666665, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '1785006', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1032, 'n_words': 182}