<commit_before>"use strict";
/**
 * Wrap skrollr.js
 * @author SOON_
 * @module sn.skrollr
 */
angular.module("sn.skrollr", [])

/**
 * Provider to configuring skrollr
 * @example
 *      snSkrollrProvider.config({ smoothScrolling: true });
 *      snSkrollr.init();
 */
.provider("snSkrollr", function snSkrollrProvider() {

    var _this = this;

    /**
     * Skrollr initialisation options
     * @property {Object} config
     */
    this.config = {};

    /**
     * Instance of Skrollr
     * @property {Object}  skrollrInstance
     */
    this.skrollrInstance = {};

    /**
     * Has the skrollInstance been initialised
     * @property {Boolean} hasBeenInitialised
     */
    this.hasBeenInitialised = false;

    /**
     * Methods returned on snSkrollr service
     * @property {Object} serviceMethods
     */
    this.serviceMethods = {};

    /**
     * snSkroller service
     */
    this.$get = [
        "$window",
        "$document",
        "$rootScope",
        /**
         * @constructor
         * @param   {Object}  $window    angular wrapper for window
         * @param   {Object}  $document  angular wrapper for document
         * @param   {Object}  $rootScope angular root application scope
         */
        function($window, $document, $rootScope) {

            _this.serviceMethods = {

                /**
                 * Initialise skrollrjs with config options
                 * @method init
                 */
                init: function() {

                    var skrollrInit = function skrollrInit(){
                        _this.skrollrInstance = $window.skrollr.init(_this.config);
                        _this.hasBeenInitialised = true;
                        _this.serviceMethods.refresh();
                    };

                    $document.ready(function () {
                        if (!$rootScope.$$phase) {
                            $rootScope.$apply(skrollrInit);
                        } else {
                            skrollrInit();
                        }
                    });

                },

                /**
                 * Call refresh on Skrollr instance
                 * Useful for resetting skrollr after modifying the DOM
                 * @method refresh
                 */
                refresh: function() {
                    if (_this.hasBeenInitialised) {
                        _this.skrollrInstance.refresh();
                    }
                }
            };

            return _this.serviceMethods;
        }
    ];
})

/**
 * Refresh skrollrjs on element init
 * @class  snSkrollr
 */
.directive("snSkrollr", [
    "snSkrollr",
    /**
     * @constructor
     */
    function (snSkrollr){
        return {<commit_msg>add destroy method to snSkrollr<commit_after>"use strict";
/**
 * Wrap skrollr.js
 * @author SOON_
 * @module sn.skrollr
 */
angular.module("sn.skrollr", [])

/**
 * Provider to configuring skrollr
 * @example
 *      snSkrollrProvider.config({ smoothScrolling: true });
 *      snSkrollr.init();
 */
.provider("snSkrollr", function snSkrollrProvider() {

    var _this = this;

    /**
     * Skrollr initialisation options
     * @property {Object} config
     */
    this.config = {};

    /**
     * Instance of Skrollr
     * @property {Object}  skrollrInstance
     */
    this.skrollrInstance = {};

    /**
     * Has the skrollInstance been initialised
     * @property {Boolean} hasBeenInitialised
     */
    this.hasBeenInitialised = false;

    /**
     * Methods returned on snSkrollr service
     * @property {Object} serviceMethods
     */
    this.serviceMethods = {};

    /**
     * snSkroller service
     */
    this.$get = [
        "$window",
        "$document",
        "$rootScope",
        /**
         * @constructor
         * @param   {Object}  $window    angular wrapper for window
         * @param   {Object}  $document  angular wrapper for document
         * @param   {Object}  $rootScope angular root application scope
         */
        function($window, $document, $rootScope) {

            _this.serviceMethods = {

                /**
                 * Initialise skrollrjs with config options
                 * @method init
                 */
                init: function() {

                    var skrollrInit = function skrollrInit(){
                        _this.skrollrInstance = $window.skrollr.init(_this.config);
                        _this.hasBeenInitialised = true;
                        _this.serviceMethods.refresh();
                    };

                    $document.ready(function () {
                        if (!$rootScope.$$phase) {
                            $rootScope.$apply(skrollrInit);
                        } else {
                            skrollrInit();
                        }
                    });

                },

                /**
                 * Call refresh on Skrollr instance
                 * Useful for resetting skrollr after modifying the DOM
                 * @method refresh
                 */
                refresh: function() {
                    if (_this.hasBeenInitialised) {
                        _this.skrollrInstance.refresh();
                    }
                },

                /**
                 * Call skrollr.destroy()
                 * @method refresh
                 */
                destroy: function() {
                    if (_this.hasBeenInitialised) {
                        $window.skrollr.destroy();
                        _this.hasBeenInitialised = false;
                    }
                }
            };

            return _this.serviceMethods;
        }
    ];
})

/**
 * Refresh skrollrjs on element init
 * @class  snSkrollr
 */
.directive("snSkrollr", [
    "snSkrollr",
    /**
     * @constructor
     */
    function (snSkrollr){
        return {
{'fraction_non_alphanumeric': 0.10674157303370786, 'fraction_numerical': 0.0, 'mean_word_length': 1.280667701863354, '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': '2309304', 'n_tokens_mistral': 1554, 'n_tokens_neox': 1483, 'n_words': 311}