<commit_before>import * as gridHacks from 'common/gridHacks';

let booted = false;

export function start(container: HTMLElement) {
  // Chrome, Chromium, Brave, Opera, Safari 12+ are OK
  if (window.chrome) return;

  const runHacks = () => fixChatHeight(container);

  gridHacks.runner(runHacks);

  gridHacks.bindChessgroundResizeOnce(runHacks);

  if (!booted) {
    lichess.pubsub.on('chat.resize', runHacks);
    booted = true;
  }
}

function fixChatHeight(container: HTMLElement) {
  const chat = container.querySelector('.mchat') as HTMLElement,
    board = container.querySelector('.analyse__board .cg-wrap') as HTMLElement,
    side = container.querySelector('.analyse__side') as HTMLElement;
  if (chat && board && side) {
    const height = board.offsetHeight - side.offsetHeight;
    if (height) chat.style.height = `calc(${height}px - 2vmin)`;<commit_msg>chrome too needs the CSS grid hack in analysis, now<commit_after>import * as gridHacks from 'common/gridHacks';

let booted = false;

export function start(container: HTMLElement) {
  // Chrome, Chromium, Brave, Opera, Safari 12+ are OK
  // Update: since chromium 93 the hack is needed!
  // if (window.chrome) return;

  const runHacks = () => fixChatHeight(container);

  gridHacks.runner(runHacks);

  gridHacks.bindChessgroundResizeOnce(runHacks);

  if (!booted) {
    lichess.pubsub.on('chat.resize', runHacks);
    booted = true;
  }
}

function fixChatHeight(container: HTMLElement) {
  const chat = container.querySelector('.mchat') as HTMLElement,
    board = container.querySelector('.analyse__board .cg-wrap') as HTMLElement,
    side = container.querySelector('.analyse__side') as HTMLElement;
  if (chat && board && side) {
    const height = board.offsetHeight - side.offsetHeight;
    if (height) chat.style.height = `calc(${height}px - 2vmin)`;
{'fraction_non_alphanumeric': 0.12827510917030568, 'fraction_numerical': 0.004366812227074236, 'mean_word_length': 4.391176470588236, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4910209', 'n_tokens_mistral': 600, 'n_tokens_neox': 593, 'n_words': 144}