<commit_before>import { bindable, inject, ObserverLocator } from 'aurelia-framework';


@inject(ObserverLocator)
export class AotInfosCustomElement {
    @bindable type = null;
    @bindable infos = null;
    display = false;
    _timeout;

    constructor(observerLocator) {
        observerLocator
            .getObserver(this, 'infos')
            .subscribe(() => {
                this.display = false;
                if (this._timeout !== undefined) {
                    clearTimeout(this._timeout);
                }

                if (!this.infos.event) {
                    return;
                } else if (this.infos.visible) {
                    this._timeout = setTimeout(() => (this.display = true, 2500));
                }


                if (this.type === 'trumps') {
                    let trumpsContainer = document.getElementById('player-trumps');
                    let infosElement = document.getElementById('trumps-element-infos');
                    let target = this.infos.event.target;

                    let infosHeight = 150;
                    let top = 0;
                    let element = target;
                    do {
                        top += element.offsetTop  || 0;
                        element = element.offsetParent;
                    } while (element);

                    infosElement.style.top = top - infosHeight + 'px';
                    infosElement.style.left = trumpsContainer.getBoundingClientRect().right + 'px';
                } else if (this.type === 'cards') {
                    let cardsContainer = document.getElementById('cards-container');
                    let infosElement = document.getElementById('cards-element-infos');
                    let target = this.infos.event.target;

                    let halfCardWidth = 69 / 2;
                    let halfInfosWidth = 150 / 2;

                    infosElement.style.bottom = cardsContainer.getBoundingClientRect().bottom -
                        cardsContainer.getBoundingClientRect().top +<commit_msg>fix(infos): improve horizontal position of trumps infobox<commit_after>import { bindable, inject, ObserverLocator } from 'aurelia-framework';


@inject(ObserverLocator)
export class AotInfosCustomElement {
    @bindable type = null;
    @bindable infos = null;
    display = false;
    _timeout;

    constructor(observerLocator) {
        observerLocator
            .getObserver(this, 'infos')
            .subscribe(() => {
                this.display = false;
                if (this._timeout !== undefined) {
                    clearTimeout(this._timeout);
                }

                if (!this.infos.event) {
                    return;
                } else if (this.infos.visible) {
                    this._timeout = setTimeout(() => (this.display = true, 2500));
                }


                if (this.type === 'trumps') {
                    let trumpsContainer = document.getElementById('player-trumps');
                    let infosElement = document.getElementById('trumps-element-infos');
                    let target = this.infos.event.target;

                    let infosHeight = 150;
                    let top = 0;
                    let element = target;
                    do {
                        top += element.offsetTop  || 0;
                        element = element.offsetParent;
                    } while (element);

                    infosElement.style.top = top - infosHeight + 'px';
                    infosElement.style.left = trumpsContainer.getBoundingClientRect().width + 'px';
                } else if (this.type === 'cards') {
                    let cardsContainer = document.getElementById('cards-container');
                    let infosElement = document.getElementById('cards-element-infos');
                    let target = this.infos.event.target;

                    let halfCardWidth = 69 / 2;
                    let halfInfosWidth = 150 / 2;

                    infosElement.style.bottom = cardsContainer.getBoundingClientRect().bottom -
                        cardsContainer.getBoundingClientRect().top +
{'fraction_non_alphanumeric': 0.09917953667953668, 'fraction_numerical': 0.007722007722007722, 'mean_word_length': 1.4512123004139563, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1439367', 'n_tokens_mistral': 1066, 'n_tokens_neox': 952, 'n_words': 208}