<commit_before>(function () {

    app(function (api) {

        api.on("load:detail", function (path) {

            var result = path.split("/")[1] && api.searchResults[path.split("/")[1]],
                tmpl = $("#tmpl-detail").innerHTML.trim();

            $("#detail section").innerHTML = riot.render(tmpl, {
                name: result.fileinfo.name,
                path: result.fileinfo.path,
                size: result.file.size ? Math.round(result.file.size / 1000) + " KB" : "Unknown",
                modified: result.file.lastModifiedDate ? result.file.lastModifiedDate.toDateString() : "Unknown",
                icontype: api.iconclass(result.file.type),
                i: path.split("/")[1],
                shareorpickid: api.activityRequest ? "pick" : "share",
                shareorpickclass: api.activityRequest ? "ok-circled" : "share"
            });

            // Preview button handler
            $("#previewbtn") && $("#previewbtn").addEventListener("click", function (e) {
                e.preventDefault();

                var activityname = "open",
                    result = api.searchResults[e.target.dataset.index];
                if (result.file.type === "application/pdf") {
                    activityname = "view";
                }

                var activity = new MozActivity({
                    name: activityname,
                    data: {
                        type: result.file.type,
                        blob: result.file
                    }
                });

                activity.onerror = function () {
                    alert("Cannot preview this file.");
                };

            }, false);

            // Share button handler
            $("#sharebtn") && $("#sharebtn").addEventListener("click", function (e) {
                e.preventDefault();

                var result = api.searchResults[e.target.dataset.index];

                var data = { blobs: [result.file], number: 1 };

                if (result.file.type.indexOf("image") === 0) {
                    data.type = "image/*";
                }

                var activity = new MozActivity({
                    name: "share",
                    data: data
                });

            }, false);

            // Memory cleanup
            result = tmpl = null;

        });

    });

})();
<commit_msg>Add handler for pick<commit_after>(function () {

    app(function (api) {

        api.on("load:detail", function (path) {

            var result = path.split("/")[1] && api.searchResults[path.split("/")[1]],
                tmpl = $("#tmpl-detail").innerHTML.trim();

            $("#detail section").innerHTML = riot.render(tmpl, {
                name: result.fileinfo.name,
                path: result.fileinfo.path,
                size: result.file.size ? Math.round(result.file.size / 1000) + " KB" : "Unknown",
                modified: result.file.lastModifiedDate ? result.file.lastModifiedDate.toDateString() : "Unknown",
                icontype: api.iconclass(result.file.type),
                i: path.split("/")[1],
                shareorpickid: api.activityRequest ? "pick" : "share",
                shareorpickclass: api.activityRequest ? "ok-circled" : "share"
            });

            // Preview button handler
            $("#previewbtn") && $("#previewbtn").addEventListener("click", function (e) {
                e.preventDefault();

                var activityname = "open",
                    result = api.searchResults[e.target.dataset.index];
                if (result.file.type === "application/pdf") {
                    activityname = "view";
                }

                var activity = new MozActivity({
                    name: activityname,
                    data: {
                        type: result.file.type,
                        blob: result.file
                    }
                });

                activity.onerror = function () {
                    alert("Cannot preview this file.");
                };

            }, false);

            // Share button handler
            $("#sharebtn") && $("#sharebtn").addEventListener("click", function (e) {
                e.preventDefault();

                var result = api.searchResults[e.target.dataset.index];

                var data = { blobs: [result.file], number: 1 };

                if (result.file.type.indexOf("image") === 0) {
                    data.type = "image/*";
                }

                var activity = new MozActivity({
                    name: "share",
                    data: data
                });

            }, false);

            // Pick button handler
            $("#pickbtn") && $("#pickbtn").addEventListener("click", function (e) {
                e.preventDefault();

                var result = api.searchResults[e.target.dataset.index];

                if (api.activityRequest.source.name === "pick") {
                    api.activityRequest.postResult({
                        type: result.file.type,
                        blob: result.file
                    });
                }
            }, false);

            // Memory cleanup
            result = tmpl = null;

        });

    });

})();

{'fraction_non_alphanumeric': 0.13872502378686966, 'fraction_numerical': 0.0034253092293054233, 'mean_word_length': 1.2951965065502185, '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': '4284337', 'n_tokens_mistral': 1356, 'n_tokens_neox': 1230, 'n_words': 249}