<commit_before>/*global window, document, setTimeout, Ghost, $, _, Backbone, JST, shortcut, NProgress */

(function () {
    "use strict";
    NProgress.configure({ showSpinner: false });

    Ghost.ProgressModel = Backbone.Model.extend({

        // Adds in a call to start a loading bar
        // This is sets up a success function which completes the loading bar
        fetch : function (options) {
            options = options || {};

            NProgress.start();

            options.success = function () {
                NProgress.done();
            };

            return Backbone.Model.prototype.fetch.call(this, options);
        }
    });

    Ghost.ProgressCollection = Backbone.Collection.extend({

        // Adds in a call to start a loading bar
        // This is sets up a success function which completes the loading bar
        fetch : function (options) {
            options = options || {};

            NProgress.start();

            options.success = function () {
                NProgress.done();
            };

            return Backbone.Collection.prototype.fetch.call(this, options);
        }
    });
}());<commit_msg>Have NProgress called for all ajax calls<commit_after>/*global window, document, setTimeout, Ghost, $, _, Backbone, JST, shortcut, NProgress */

(function () {
    "use strict";
    NProgress.configure({ showSpinner: false });

    // Adds in a call to start a loading bar
    // This is sets up a success function which completes the loading bar
    function wrapSync(method, model, options) {
        if (options !== undefined && _.isObject(options)) {
            NProgress.start();

            var self = this,
                oldSuccess = options.success;

            options.success = function () {
                NProgress.done();
                return oldSuccess.apply(self, arguments);
            };
        }

        return Backbone.sync.call(this, method, model, options);
    }

    Ghost.ProgressModel = Backbone.Model.extend({
        sync: wrapSync
    });

    Ghost.ProgressCollection = Backbone.Collection.extend({
        sync: wrapSync
    });
}());
{'fraction_non_alphanumeric': 0.11298640412564463, 'fraction_numerical': 0.0, 'mean_word_length': 2.0269503546099292, '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': '2853193', 'n_tokens_mistral': 549, 'n_tokens_neox': 527, 'n_words': 160}