<commit_before>var path = "";
var marked = [];

function mark(item) {
    if ($.inArray(item, marked) !== -1) {
        marked = jQuery.grep(marked, function (value) {
            return value != item;
        });
    } else {
        marked.push(item);
    }
}

function doDelete() {
    var data = JSON.stringify(marked);
    arcAjaxRequest("arc/mediamanagerdelete", {items: data}, uploadComplete, null);
}

$(document).ready(function () {
    getManager();
});

function getManager() {
    arcAjaxRequest("arc/mediamanagerget", {path: path}, null, getComplete);
}

function getComplete(data) {
    var jdata = arcGetJson(data);
    $("#managerView").html(jdata.html);
    $('[data-toggle="popover"]').popover();
    marked = [];
}

$(document).on('change', '.btn-file :file', function () {
    arcAjaxRequest("arc/mediamanagerupload", $(this)[0].files[0], uploadComplete, null, {path: path});
});

function uploadComplete() {
    arcGetStatus();
    getManager();
}

function getFolderPath(folderPath) {
    path = folderPath;
    getManager();
}

function createFolder() {
    arcAjaxRequest("arc/mediamanagercreate", {path: path, name: $("#folderName").val()}, uploadComplete, null);
}

function getLink() {
    var data = JSON.stringify(marked);
    arcAjaxRequest("arc/mediamanagergetlink", {items: data}, null, getLinkComplete);
}

function getLinkComplete(data) {
    var jdata = arcGetJson(data);
    $("#linkText").val(jdata.links);
    $("#getLinkModal").modal('show');
}<commit_msg>Added function to allow external code capture mediamanager links.<commit_after>var path = "";
var marked = [];

function mark(item) {
    if ($.inArray(item, marked) !== -1) {
        marked = jQuery.grep(marked, function (value) {
            return value != item;
        });
    } else {
        marked.push(item);
    }
}

function doDelete() {
    var data = JSON.stringify(marked);
    arcAjaxRequest("arc/mediamanagerdelete", {items: data}, uploadComplete, null);
}

$(document).ready(function () {
    getManager();
});

function getManager() {
    arcAjaxRequest("arc/mediamanagerget", {path: path}, null, getComplete);
}

function getComplete(data) {
    var jdata = arcGetJson(data);
    $("#managerView").html(jdata.html);
    $('[data-toggle="popover"]').popover();
    marked = [];
}

$(document).on('change', '.btn-file :file', function () {
    arcAjaxRequest("arc/mediamanagerupload", $(this)[0].files[0], uploadComplete, null, {path: path});
});

function uploadComplete() {
    arcGetStatus();
    getManager();
}

function getFolderPath(folderPath) {
    path = folderPath;
    getManager();
}

function createFolder() {
    arcAjaxRequest("arc/mediamanagercreate", {path: path, name: $("#folderName").val()}, uploadComplete, null);
}

function getLink() {
    var data = JSON.stringify(marked);
    arcAjaxRequest("arc/mediamanagergetlink", {items: data}, null, getLinkComplete);
}

function getLinkComplete(data) {
    var jdata = arcGetJson(data);
    if (typeof (getLinkText) == "function") {
        getLinkText(jdata.links);
    } else {
        $("#linkText").val(jdata.links);
        $("#getLinkModal").modal('show');
        console.log("Implement a getLinkText function to capture links.");
    }
}
{'fraction_non_alphanumeric': 0.1780397022332506, 'fraction_numerical': 0.0018610421836228288, 'mean_word_length': 3.9387442572741196, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5028325', 'n_tokens_mistral': 1022, 'n_tokens_neox': 1010, 'n_words': 203}