<commit_before>import { Inject, Injectable } from '@angular/core';
import { DOCUMENT } from '@angular/platform-browser';

@Injectable()
export class ToggleScrollService {
  /**
   * Setting position fixed on body will prevent scroll, and setting overflow
   * to scroll ensures the scrollbar is always visible.
   * IE 11 requires an empty string rather than null to unset styles.
   */
  set allowScroll(val: boolean) {
    this.document.body.style.position = val ? '' : 'fixed';
    this.document.body.style.overflowY = val ? '' : 'scroll';
  }

  constructor(@Inject(DOCUMENT) private document: any) { }

}<commit_msg>Check scrollTop in toggle scroll<commit_after>import { Inject, Injectable } from '@angular/core';
import { DOCUMENT } from '@angular/platform-browser';

@Injectable()
export class ToggleScrollService {
  /**
   * Setting position fixed on body will prevent scroll, and setting overflow
   * to scroll ensures the scrollbar is always visible.
   * IE 11 requires an empty string rather than null to unset styles.
   */
  set allowScroll(val: boolean) {
    const changeScroll = !val && this.document.documentElement.scrollTop === 0;
    this.document.body.style.position = changeScroll ? 'fixed' : '';
    this.document.body.style.overflowY = changeScroll ? 'scroll' : '';
  }

  constructor(@Inject(DOCUMENT) private document: any) { }

}
{'fraction_non_alphanumeric': 0.11405445180279618, 'fraction_numerical': 0.003679175864606328, 'mean_word_length': 4.037037037037037, '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': '4532242', 'n_tokens_mistral': 386, 'n_tokens_neox': 379, 'n_words': 123}