<commit_before>(function (OC, window, $, undefined) {
    'use strict';

$(document).ready(function () {

    // this notes object holds all our notes
    var Papers = function (baseUrl) {
        this._baseUrl = baseUrl;
        this._papers = [];
        this._activePaper = undefined;
    };

    Papers.prototype = {
        load: function (id) {
            var self = this;
            this._papers.forEach(function (paper) {
                if (paper.id === id) {
                    paper.active = true;
                    self._activeNote = paper;
                } else {
                    paper.active = false;
                }
            });
        },
        getActive: function () {
            return this._activePaper;
        },
        getAll: function () {
            return this._papers;
        },
        loadAll: function () {
            var deferred = $.Deferred();
            var self = this;
            $.get(this._baseUrl).done(function (papers) {
                self._activePaper = undefined;
                self._papers = papers;
                deferred.resolve();
            }).fail(function () {
                deferred.reject();
            });
            return deferred.promise();
        },
        create: function (paper) {
            var deferred = $.Deferred();
            var self = this;
            $.ajax({
                url: this._baseUrl,
                method: 'POST',
                contentType: 'application/json',
                data: JSON.stringify(paper)
            }).done(function (paper) {
                self._papers.push(paper);
                self._activeNote = paper;
                self.load(paper.id);
                deferred.resolve();
            }).fail(function () {
                deferred.reject();
            });
            return deferred.promise();
        }
    };

    // this will be the view that is used to update the html
    var View = function (papers) {
        this._papers = papers;
    };

    View.prototype = {
        renderContent: function () {
            var tmpl = $.templates("#content-template");
            var paper = {papers: this._papers.getActive()};
            var html = tmpl.render(paper);
            $("#paper-content").html(html);
        },
        renderList: function () {
            var tmpl = $.templates("#list-template");
            var papers = {papers: this._papers.getAll()};
            var html = tmpl.render(papers);
            $("#paper-list").find("ul").html(html);

            $('#app-content-list').find('.paper-item').click(function () {
                var id = parseInt($(this).parent().data('id'), 10);
                self._papers.load(id);
                self.render();
            });
        },
        renderNavigation: function () {
            var self = this;
            $('#add_button').click(function () {
                var paper = {
                    url: $('#add_url').val()
                };

                self._papers.create(paper).done(function() {
                    self.render();
                    $('#add_url').val('');
                }).fail(function () {
                    alert('Could not add new paper');<commit_msg>Fixed clicking<commit_after>(function (OC, window, $, undefined) {
    'use strict';

$(document).ready(function () {

    // this notes object holds all our notes
    var Papers = function (baseUrl) {
        this._baseUrl = baseUrl;
        this._papers = [];
        this._activePaper = undefined;
    };

    Papers.prototype = {
        load: function (id) {
            var self = this;
            this._papers.forEach(function (paper) {
                if (paper.id === id) {
                    paper.active = true;
                    self._activeNote = paper;
                } else {
                    paper.active = false;
                }
            });
        },
        getActive: function () {
            return this._activePaper;
        },
        getAll: function () {
            return this._papers;
        },
        loadAll: function () {
            var deferred = $.Deferred();
            var self = this;
            $.get(this._baseUrl).done(function (papers) {
                self._activePaper = undefined;
                self._papers = papers;
                deferred.resolve();
            }).fail(function () {
                deferred.reject();
            });
            return deferred.promise();
        },
        create: function (paper) {
            var deferred = $.Deferred();
            var self = this;
            $.ajax({
                url: this._baseUrl,
                method: 'POST',
                contentType: 'application/json',
                data: JSON.stringify(paper)
            }).done(function (paper) {
                self._papers.push(paper);
                self._activeNote = paper;
                self.load(paper.id);
                deferred.resolve();
            }).fail(function () {
                deferred.reject();
            });
            return deferred.promise();
        }
    };

    // this will be the view that is used to update the html
    var View = function (papers) {
        this._papers = papers;
    };

    View.prototype = {
        renderContent: function () {
            var tmpl = $.templates("#content-template");
            var paper = {papers: this._papers.getActive()};
            var html = tmpl.render(paper);
            $("#paper-content").html(html);
        },
        renderList: function () {
            var tmpl = $.templates("#list-template");
            var papers = {papers: this._papers.getAll()};
            var html = tmpl.render(papers);
            $("#paper-list").find("ul").html(html);

            $('.paper-item').click(function () {
                var id = parseInt($(this).parent().data('id'), 10);
                self._papers.load(id);
                self.render();
            });
        },
        renderNavigation: function () {
            var self = this;
            $('#add_button').click(function () {
                var paper = {
                    url: $('#add_url').val()
                };

                self._papers.create(paper).done(function() {
                    self.render();
                    $('#add_url').val('');
                }).fail(function () {
                    alert('Could not add new paper');
{'fraction_non_alphanumeric': 0.13676814988290398, 'fraction_numerical': 0.000624512099921936, 'mean_word_length': 1.2870403427347377, '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': '2299014', 'n_tokens_mistral': 1657, 'n_tokens_neox': 1549, 'n_words': 338}