<commit_before>const { app, BrowserWindow, Notification } = require('electron');
const urlLib = require('url');
const http = require('http');
const path = require('path');
const storage = require('electron-json-storage');
const settings = require('electron-settings');
const CssInjector = require('../js/css-injector');
const { download } = require('electron-dl');

const playerUrl = 'http://www.xiami.com/play';
const playlistUrl = 'http://www.xiami.com/song/playlist';
const getLyricUrl = 'http://img.xiami.net/lyric/';

const language = settings.get('language', 'en');
const Locale = language === 'en' ? require('../locale/locale_en') : require('../locale/locale_sc');

class XiamiPlayer {
  constructor() {
    this.init();
  }

  init() {
    const customLayout = settings.get('customLayout', 'default');

    if(customLayout === 'mini') {
      this.window = new BrowserWindow({show: false, width: 520, height: 160, frame: false, autoHideMenuBar: true, fullscreenable: false,
        webPreferences: {javascript: true, plugins: true, webSecurity: false, nodeIntegration: false}});
    } else {
      if (process.platform === 'darwin') {
        this.window = new BrowserWindow({show: false, width: 1000, height: 670, titleBarStyle: 'hiddenInset',
          webPreferences: {javascript: true, plugins: true, webSecurity: false, nodeIntegration: false}});
      } else {
        this.window = new BrowserWindow({show: false, width: 1000, height: 670, frame: true, autoHideMenuBar: true,
          webPreferences: {javascript: true, plugins: true, webSecurity: false, nodeIntegration: false}});
      }
    }

    // load xiami player page.
    this.window.loadURL(playerUrl);

    // inject the custom layout.
    this.window.webContents.on('dom-ready', () => {

      this.window.webContents.insertCSS(CssInjector.main);
      
      if (process.platform == 'darwin') {
        this.window.webContents.insertCSS(CssInjector.macos);
      }

      switch (customLayout) {
        case 'hideSidebar':
          this.window.webContents.insertCSS(CssInjector.hideSidebar);
          break;
        case 'hideLyrics':
          this.window.webContents.insertCSS(CssInjector.hideLyrics);
          break;
        case 'songListOnly':<commit_msg>Disable the resize window in mini mode<commit_after>const { app, BrowserWindow, Notification } = require('electron');
const urlLib = require('url');
const http = require('http');
const path = require('path');
const storage = require('electron-json-storage');
const settings = require('electron-settings');
const CssInjector = require('../js/css-injector');
const { download } = require('electron-dl');

const playerUrl = 'http://www.xiami.com/play';
const playlistUrl = 'http://www.xiami.com/song/playlist';
const getLyricUrl = 'http://img.xiami.net/lyric/';

const language = settings.get('language', 'en');
const Locale = language === 'en' ? require('../locale/locale_en') : require('../locale/locale_sc');

class XiamiPlayer {
  constructor() {
    this.init();
  }

  init() {
    const customLayout = settings.get('customLayout', 'default');

    if(customLayout === 'mini') {
      this.window = new BrowserWindow({show: false, width: 520, height: 160, frame: false, autoHideMenuBar: true, fullscreenable: false, resizable: false,
        webPreferences: {javascript: true, plugins: true, webSecurity: false, nodeIntegration: false}});
    } else {
      if (process.platform === 'darwin') {
        this.window = new BrowserWindow({show: false, width: 1000, height: 670, titleBarStyle: 'hiddenInset',
          webPreferences: {javascript: true, plugins: true, webSecurity: false, nodeIntegration: false}});
      } else {
        this.window = new BrowserWindow({show: false, width: 1000, height: 670, frame: true, autoHideMenuBar: true,
          webPreferences: {javascript: true, plugins: true, webSecurity: false, nodeIntegration: false}});
      }
    }

    // load xiami player page.
    this.window.loadURL(playerUrl);

    // inject the custom layout.
    this.window.webContents.on('dom-ready', () => {

      this.window.webContents.insertCSS(CssInjector.main);
      
      if (process.platform == 'darwin') {
        this.window.webContents.insertCSS(CssInjector.macos);
      }

      switch (customLayout) {
        case 'hideSidebar':
          this.window.webContents.insertCSS(CssInjector.hideSidebar);
          break;
        case 'hideLyrics':
          this.window.webContents.insertCSS(CssInjector.hideLyrics);
          break;
        case 'songListOnly':
{'fraction_non_alphanumeric': 0.1487530346501876, 'fraction_numerical': 0.008828073273008165, 'mean_word_length': 3.5916919959473153, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5813454', 'n_tokens_mistral': 1393, 'n_tokens_neox': 1329, 'n_words': 309}