<commit_before>/**
 * Created by azu.
 * Date: 11/05/25 18:04
 * License: MIT License
 */

$(function () {
    var app = window.app || {};
    var vm = new app.model.JSerModel();
    ko.bindingHandlers.sortable.afterMove = function (arg) {
        var article = arg.item;
        window.app.visited.setItem(article.url, new Date());
    }
    ko.applyBindings(vm);

    Handlebars.registerHelper('auto_format', function (text) {
        // autolinkTwitter 内でHTMLエスケープされているためHandlebarではしない
        var linkedText = window.autolinkTwitter(text);
        return linkedText.replace(/\n/g, "<br />");
    });
    function getOutputJSON() {
        var json = ko.toJS(vm.outputModels);
        return json.filter(function (model) {
            return model.articles.length > 0;
        });
    }

    $('#copy-markdown').button().on("click", function () {
        var filteredJSON = getOutputJSON();
        var source = $("#article-markdown-template").html();
        var template = Handlebars.compile(source);
        var result = template({
            Groups: filteredJSON
        });
        $("#js-dialog-textarea").text(result.trim());
        $("#jq-dialog").dialog({
            title: "Markdown",
            width: 700,
            height: 500
        });
    });
    $('#copy-html').button().on("click", function () {
        var source = $("#article-template").html();
        var template = Handlebars.compile(source);
        var result = template({
            Groups: getOutputJSON()
        });
        $("#js-dialog-textarea").text(result.trim());
        $("#jq-dialog").dialog({
            title: "HTML",
            width: 700,
            height: 500
        });
    });
    function format0(str, len) {
        return ('_' + Math.pow(10, len) + str).slice(-len);
    }

    var pickedCalendarHandler = function (cal) {
        var date = cal.currentDate;
        var fileDirPath = "data/" + date.getFullYear() + '/' + format0((date.getMonth() + 1), 2);
        var JSONFilePath = fileDirPath + "/index.json?" + new Date().getTime();
        window.app.client.load(JSONFilePath).done(function (data) {<commit_msg>feat(viewer) : auto select all for dialog<commit_after>/**
 * Created by azu.
 * Date: 11/05/25 18:04
 * License: MIT License
 */

$(function () {
    var app = window.app || {};
    var vm = new app.model.JSerModel();
    ko.bindingHandlers.sortable.afterMove = function (arg) {
        var article = arg.item;
        window.app.visited.setItem(article.url, new Date());
    }
    ko.applyBindings(vm);

    Handlebars.registerHelper('auto_format', function (text) {
        // autolinkTwitter 内でHTMLエスケープされているためHandlebarではしない
        var linkedText = window.autolinkTwitter(text);
        return linkedText.replace(/\n/g, "<br />");
    });
    function getOutputJSON() {
        var json = ko.toJS(vm.outputModels);
        return json.filter(function (model) {
            return model.articles.length > 0;
        });
    }

    $("#jq-dialog").on("dialogfocus", function (evt,ui) {
        $("#js-dialog-textarea").select();
    });
    $('#copy-markdown').button().on("click", function () {
        var filteredJSON = getOutputJSON();
        var source = $("#article-markdown-template").html();
        var template = Handlebars.compile(source);
        var result = template({
            Groups: filteredJSON
        });
        $("#js-dialog-textarea").text(result.trim());
        $("#jq-dialog").dialog({
            title: "Markdown",
            width: 700,
            height: 500
        });
    });
    $('#copy-html').button().on("click", function () {
        var source = $("#article-template").html();
        var template = Handlebars.compile(source);
        var result = template({
            Groups: getOutputJSON()
        });
        $("#js-dialog-textarea").text(result.trim());
        $("#jq-dialog").on("dialogbeforeclose", function (event, ui) {
        });
        dialog({
            title: "HTML",
            width: 700,
            height: 500
        });
    });
    function format0(str, len) {
        return ('_' + Math.pow(10, len) + str).slice(-len);
    }

    var pickedCalendarHandler = function (cal) {
        var date = cal.currentDate;
        var fileDirPath = "data/" + date.getFullYear() + '/' + format0((date.getMonth() + 1), 2);
        var JSONFilePath = fileDirPath + "/index.json?" + new Date().getTime();
        window.app.client.load(JSONFilePath).done(function (data) {
{'fraction_non_alphanumeric': 0.16860725481415137, 'fraction_numerical': 0.012987012987012988, 'mean_word_length': 2.2558309037900877, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6737228', 'n_tokens_mistral': 1372, 'n_tokens_neox': 1298, 'n_words': 261}