<commit_before>import { ng } from '../ng-start';
import { $ } from '../libs/jquery/jquery';

export let dropdownButtons = ng.directive('dropdownButtons', () => {
    return {
        restrict: 'E',
        link: (scope, element, attributes) => {
            const setClasses = () => {
                if(element.offset().left > $(window).width() / 2){
                    element.addClass('right');
                }
                else{
                    element.removeClass('right');
                }
                if(element.offset().top > $(window).height() / 2){
                    element.addClass('bottom');
                }
                else{
                    element.removeClass('bottom');
                }
            };

            setTimeout(() => setClasses(), 1000);
            $(window).on('resize', setClasses);

            element.find('open').on('click', () => {
                if(element.hasClass('opened')){
                    element.removeClass('opened');
                }
                else{
                    element.addClass('opened');
                }<commit_msg>load position classes after render<commit_after>import { ng } from '../ng-start';
import { $ } from '../libs/jquery/jquery';

export let dropdownButtons = ng.directive('dropdownButtons', () => {
    return {
        restrict: 'E',
        link: (scope, element, attributes) => {
            const setClasses = () => {
                if(element.offset().left > $(window).width() / 2){
                    element.addClass('right');
                }
                else{
                    element.removeClass('right');
                }
                if(element.offset().top > $(window).height() / 2){
                    element.addClass('bottom');
                }
                else{
                    element.removeClass('bottom');
                }

                if(element.css('position') === 'static'){
                    setTimeout(() => setClasses(), 500);
                }
                
            };

            setClasses();
            $(window).on('resize', setClasses);

            element.find('open').on('click', () => {
                if(element.hasClass('opened')){
                    element.removeClass('opened');
                }
                else{
                    element.addClass('opened');
                }
{'fraction_non_alphanumeric': 0.15264928511354078, 'fraction_numerical': 0.004625735912531539, 'mean_word_length': 1.2212885154061626, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '393463', 'n_tokens_mistral': 591, 'n_tokens_neox': 538, 'n_words': 91}