<commit_before>'use strict';

const electron = require('electron');
const shell = electron.shell;
const BrowserWindow = electron.BrowserWindow;

const platformUtil = require('../../../platform-util');
const pref = require('../pref');

let browserWindow = null;

function createWindow(cb) {
  browserWindow = new BrowserWindow({
    width: 800,
    height: 510,
    alwaysOnTop: true,
    center: true,
    frame: false,
    show: false,
    closable: false,
    minimizable: false,
    maximizable: false,
    moveable: false,
    resizable: false,
    skipTaskbar: true
  });

  if (cb) {
    browserWindow.webContents.on('did-finish-load', cb);
  }

  browserWindow.webContents.on('will-navigate', (evt, url) => {
    shell.openExternal(url);
    evt.preventDefault();
  });
  browserWindow.loadURL(`file://${__dirname}/../../../dist/index.html`);
  browserWindow.on('blur', () => {
    if (browserWindow.webContents.isDevToolsOpened())
      return;
    hideAndRefreshWindow(true);
  });
}

function _centerWindowOnSelectedScreen(window) {
  const screen = electron.screen;

  let selectedDisplay = screen.getPrimaryDisplay();
  const displays = screen.getAllDisplays();
  const cursorPos = screen.getCursorScreenPoint();
<commit_msg>Hook `new-window` event of iframe<commit_after>'use strict';

const electron = require('electron');
const shell = electron.shell;
const BrowserWindow = electron.BrowserWindow;

const platformUtil = require('../../../platform-util');
const pref = require('../pref');

let browserWindow = null;

function createWindow(cb) {
  browserWindow = new BrowserWindow({
    width: 800,
    height: 510,
    alwaysOnTop: true,
    center: true,
    frame: false,
    show: false,
    closable: false,
    minimizable: false,
    maximizable: false,
    moveable: false,
    resizable: false,
    skipTaskbar: true
  });

  if (cb) {
    browserWindow.webContents.on('did-finish-load', cb);
  }

  browserWindow.webContents.on('new-window', (evt, url) => {
    shell.openExternal(encodeURI(url));
    evt.preventDefault();
  });
  browserWindow.loadURL(`file://${__dirname}/../../../dist/index.html`);
  browserWindow.on('blur', () => {
    if (browserWindow.webContents.isDevToolsOpened())
      return;
    hideAndRefreshWindow(true);
  });
}

function _centerWindowOnSelectedScreen(window) {
  const screen = electron.screen;

  let selectedDisplay = screen.getPrimaryDisplay();
  const displays = screen.getAllDisplays();
  const cursorPos = screen.getCursorScreenPoint();

{'fraction_non_alphanumeric': 0.14908073541167066, 'fraction_numerical': 0.004796163069544364, 'mean_word_length': 3.832046332046332, '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': '1065534', 'n_tokens_mistral': 773, 'n_tokens_neox': 757, 'n_words': 160}