<commit_before>(extp = window.extp || []).push(function (ext) {

  ext.define('RoomStyles', function (require, exports, module) {

    var Module = require('extplug/Module'),
      request = require('extplug/util/request'),
      fnUtils = require('extplug/util/function'),
      _ = require('underscore'),
      $ = require('jquery');

    module.exports = Module({
      name: 'Room Styles',

      init: function () {
        fnUtils.bound(this, 'colors');
        fnUtils.bound(this, 'css');
        fnUtils.bound(this, 'images');
        fnUtils.bound(this, 'unload');
      },

      enable: function () {
        this.all();

        this.ext.roomSettings
          .on('change:colors', this.colors)
          .on('change:css', this.css)
          .on('change:images', this.images);

        this.ext.on('room:left', this.unload);
      },

      disable: function () {
        this.ext.roomSettings
          .off('change:colors', this.colors)
          .off('change:css', this.css)
          .off('change:images', this.images);

        this.ext.off('room:left', this.unload);
      },

      colors: function () {
        var colors = this.ext.roomSettings.get('colors');
        if (_.isObject(colors)) {
          var colorStyles = this.Style();

          if (_.isObject(colors.chat)) {
            [ 'admin', 'ambassador', 'host', 'cohost', 'manager', 'bouncer', 'dj' ]
              .forEach(function (level) {
                if (colors.chat[level]) {
                  var value = { color: '#' + colors.chat[level] + ' !important' };
                  colorStyles
                    .set('#chat-messages .icon-chat-' + level + ' ~ .from', value)
                    .set('#user-rollover .icon-chat-' + level + ' + span', value)
                    .set('#user-lists    .icon-chat-' + level + ' + span', value)
                    .set('#waitlist      .icon-chat-' + level + ' + span', value);
                }
              });
          }
        }
      },

      css: function () {
        var css = this.ext.roomSettings.get('css');
        if (_.isObject(css)) {
          if (_.isObject(css.rule)) {
            this.Style(css.rule);
          }

          if (_.isArray(css.import)) {
            this._imports = $('<style>').text(
              css.import.map(function (url) {
                return '@import url(' + request.url(url) + ');';
              }).join('\n')
            );
          }
        }
      },

      images: function () {
        var images = this.ext.roomSettings.get('images');
        if (_.isObject(images)) {
          if (images.background) {
            this.Style({
              '.room-background': {
                'background-image': 'url(' + images.background + ') !important'
              }
            });
          }
          if (images.playback) {
            var playbackImg = this.$('#playback .background img');
            this._oldPlayback = playbackImg.attr('src');
            playbackImg.attr('src', images.playback);
          }
          if (images.booth) {
            this.$booth = $('<div />').css({
              'background': 'url(' + images.booth + ') no-repeat center center',
              'position': 'absolute',
              'width': '300px',
              'height': '100px',
              'left': '-64px',
              'top': '70px',
              'z-index': -1
            }).appendTo(this.$('#dj-booth'));
          }
        }
      },<commit_msg>fix custom dj booth position<commit_after>(extp = window.extp || []).push(function (ext) {

  ext.define('RoomStyles', function (require, exports, module) {

    var Module = require('extplug/Module'),
      request = require('extplug/util/request'),
      fnUtils = require('extplug/util/function'),
      _ = require('underscore'),
      $ = require('jquery');

    module.exports = Module({
      name: 'Room Styles',

      init: function () {
        fnUtils.bound(this, 'colors');
        fnUtils.bound(this, 'css');
        fnUtils.bound(this, 'images');
        fnUtils.bound(this, 'unload');
      },

      enable: function () {
        this.all();

        this.ext.roomSettings
          .on('change:colors', this.colors)
          .on('change:css', this.css)
          .on('change:images', this.images);

        this.ext.on('room:left', this.unload);
      },

      disable: function () {
        this.ext.roomSettings
          .off('change:colors', this.colors)
          .off('change:css', this.css)
          .off('change:images', this.images);

        this.ext.off('room:left', this.unload);
      },

      colors: function () {
        var colors = this.ext.roomSettings.get('colors');
        if (_.isObject(colors)) {
          var colorStyles = this.Style();

          if (_.isObject(colors.chat)) {
            [ 'admin', 'ambassador', 'host', 'cohost', 'manager', 'bouncer', 'dj' ]
              .forEach(function (level) {
                if (colors.chat[level]) {
                  var value = { color: '#' + colors.chat[level] + ' !important' };
                  colorStyles
                    .set('#chat-messages .icon-chat-' + level + ' ~ .from', value)
                    .set('#user-rollover .icon-chat-' + level + ' + span', value)
                    .set('#user-lists    .icon-chat-' + level + ' + span', value)
                    .set('#waitlist      .icon-chat-' + level + ' + span', value);
                }
              });
          }
        }
      },

      css: function () {
        var css = this.ext.roomSettings.get('css');
        if (_.isObject(css)) {
          if (_.isObject(css.rule)) {
            this.Style(css.rule);
          }

          if (_.isArray(css.import)) {
            this._imports = $('<style>').text(
              css.import.map(function (url) {
                return '@import url(' + request.url(url) + ');';
              }).join('\n')
            );
          }
        }
      },

      images: function () {
        var images = this.ext.roomSettings.get('images');
        if (_.isObject(images)) {
          if (images.background) {
            this.Style({
              '.room-background': {
                'background-image': 'url(' + images.background + ') !important'
              }
            });
          }
          if (images.playback) {
            var playbackImg = this.$('#playback .background img');
            this._oldPlayback = playbackImg.attr('src');
            playbackImg.attr('src', images.playback);
          }
          if (images.booth) {
            this.$booth = $('<div />').css({
              'background': 'url(' + images.booth + ') no-repeat center center',
              'position': 'absolute',
              'width': '300px',
              'height': '100px',
              'left': '15px',
              'top': '70px',
              'z-index': -1
            }).appendTo(this.$('#dj-booth'));
          }
        }
      },
{'fraction_non_alphanumeric': 0.17352855900260944, 'fraction_numerical': 0.0031893302406494637, 'mean_word_length': 1.5551851851851852, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4408479', 'n_tokens_mistral': 2022, 'n_tokens_neox': 1953, 'n_words': 356}