<commit_before>/*
 * Copyright 2016 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * The component that is used for the sticky sub navigation that mostly contains call to action buttons for the
 * current view.
 */
// @ngInject
class ActionBar {

    /**
     * Constructor.
     *
     * @param $scope
     * @param $element
     */
    constructor($scope, $element) {

        /**
         * The root element of the component.
         */
        this.rootEl = $element.children()[0];

        /**
         * The scroll handler.
         */
        this.scrollHandler = this.handleResize.bind(this);

        window.addEventListener('scroll', this.scrollHandler, false);

        $scope.$on('$destroy', () => {
            window.removeEventListener('scroll', this.scrollHandler, false);
            document.body.classList.remove('has-fixed-action-bar');
        });
    }

    /**
     * Depending on the scroll y value, toggles classes for fixing the action bar on the top.
     */
    handleResize() {
        if (this.$window.scrollY >= 42) {
            this.rootEl.classList.add('fixed');
            document.body.classList.add('has-fixed-action-bar');
        } else {
            this.rootEl.classList.remove('fixed');
            document.body.classList.remove('has-fixed-action-bar');
        }
    }
}

export const actionBar = {
    controller: ActionBar,
    transclude: true,
    template: `<commit_msg>fixed non fixed actionbar<commit_after>/*
 * Copyright 2016 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

const bodyClassName = 'has-fixed-action-bar';
const actionBarClassName = 'fixed';

/**
 * The component that is used for the sticky sub navigation that mostly contains call to action buttons for the
 * current view.
 */
// @ngInject
class ActionBar {

    /**
     * Constructor.
     *
     * @param $scope
     * @param $element
     */
    constructor($scope, $element) {

        /**
         * The root element of the component.
         */
        this.rootEl = $element.children()[0];

        /**
         * The scroll handler.
         */
        this.scrollHandler = this.handleResize.bind(this);

        window.addEventListener('scroll', this.scrollHandler, false);

        $scope.$on('$destroy', () => {
            window.removeEventListener('scroll', this.scrollHandler, false);
            document.body.classList.remove(bodyClassName);
        });
    }

    /**
     * Depending on the scroll y value, toggles classes for fixing the action bar on the top.
     */
    handleResize() {
        if (window.scrollY >= 42) {
            this.rootEl.classList.add(actionBarClassName);
            document.body.classList.add(bodyClassName);
        } else {
            this.rootEl.classList.remove(actionBarClassName);
            document.body.classList.remove(bodyClassName);
        }
    }
}

export const actionBar = {
    controller: ActionBar,
    transclude: true,
    template: `
{'fraction_non_alphanumeric': 0.10999497739829231, 'fraction_numerical': 0.0055248618784530384, 'mean_word_length': 2.4455017301038064, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6954982', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1045, 'n_words': 343}