<commit_before>#!/usr/bin/env node

const mri = require('mri')
const getStdin = require('get-stdin')
const { run, format, check } = require('./')
const chalk = require('chalk')

const cliHelp = `
Prettier and standard brought together!

Usage
  $ prettier-standard [<glob>]

Options
  --format  Format all files
  --changed Format only changed files
  --lint    Lint code with eslint after formatting it
  --since   Format only changed files since given revision
  --check   Do not format, just check formatting
  --parser  Force parser to use for stdin (default: babel)
  --lines   Format only changed lines (warning: experimental!)

Examples
  $ prettier-standard --lint '**/*.{js,css}'
  $ prettier-standard --changed --lint
  $ prettier-standard --since master
  $ echo 'const {foo} = "bar";' | prettier-standard
  $ echo '.foo { color: "red"; }' | prettier-standard --parser css
`

function help () {
  console.log(cliHelp)
  process.exit(1)
}

async function main () {
  const flags = mri(process.argv.slice(2), {
    string: ['parser', 'since'],
    default: {
      format: false,
      lint: false,
      changed: false,
      lines: true,
      check: false,
      help: false
    }
  })

  if (flags._ && flags._.length > 0) {
    flags.patterns = flags._
  }

  const hasStdin = process.stdin.isTTY !== true

  if (flags.changed && hasStdin) {
    return new Error('--changed flag does not support stdin')
  }

  if (flags.since && hasStdin) {
    return new Error('--since flag does not support stdin')
  }

  if (
    flags.help ||
    (!hasStdin &&
      !flags.changed &&
      !flags.check &&
      !flags.since &&
      !flags.lint &&
      !flags.format &&
      flags._.length === 0)
  ) {
    help()
  }

  const options = {}

  if (flags.parser) {
    options.parser = flags.parser
  }

  if (hasStdin) {
    const stdin = await getStdin()

    options.filepath = '(stdin)'

    if (flags.check) {
      try {
        const valid = check(stdin, options)
        if (!valid) {
          console.log('(stdin)')
          return 1
        }
      } catch (e) {
        if (e.message.match(/SyntaxError/)) {
          return e
        }
        throw e
      }
    } else {
      const output = format(stdin, options)
      process.stdout.write(output)
    }
  } else {
    let allStandard = true

    let results = []
    let engine

    const error = run(process.cwd(), {
      format: flags.format,
      patterns: flags.patterns,
      check: flags.check,
      changed: flags.changed,
      since: flags.since,
      lint: flags.lint,
      precise: flags.precise,
      options,
      onStart: params => {
        if (params.engine) {
          engine = params.engine
        }
      },
      onProcessed: ({ file, formatted, report, check, runtime }) => {
        if (check) {
          if (!formatted) {
            if (allStandard === true) {
              console.log('Code style issues found in following files:')
              allStandard = false
            }
            console.log(file)
          }
        } else {
          console.log(`${formatted ? chalk.grey(file) : file} ${runtime}ms`)
        }

        if (report) {
          results = results.concat(report.results)
        }
      }
    })

    if (error) {
      return error
    }

    const errorCount = results.map(r => r.errorCount).reduce((a, b) => a + b, 0)

    if (engine && errorCount > 0) {
      const formatter = engine.getFormatter()
      const output = formatter(results)
      if (output) {
        console.error(output)
      }
      allStandard = false
    } else {
      if ((flags.check || flags.lint) && allStandard) {
        console.log('All matched files use Standard code style!')
      }
    }

    if (allStandard === false) {
      process.exit(1)
    }
  }
}

main().then(
  function index (result) {
    if (typeof result === 'number') {
      process.exit(result)
    }

    if (result instanceof Error) {
      console.error(result.message)
      process.exit(2)
    }
  },
  function (error) {
    console.error(error)
    process.exit(2)
  }
)
<commit_msg>Fix lint-staged interop<commit_after>#!/usr/bin/env node

const mri = require('mri')
const getStdin = require('get-stdin')
const { run, format, check } = require('./')
const chalk = require('chalk')

const cliHelp = `
Prettier and standard brought together!

Usage
  $ prettier-standard [<glob>]

Options
  --format  Format all files
  --changed Format only changed files
  --lint    Lint code with eslint after formatting it
  --since   Format only changed files since given revision
  --check   Do not format, just check formatting
  --parser  Force parser to use for stdin (default: babel)
  --lines   Format only changed lines (warning: experimental!)

Examples
  $ prettier-standard --lint '**/*.{js,css}'
  $ prettier-standard --changed --lint
  $ prettier-standard --since master
  $ echo 'const {foo} = "bar";' | prettier-standard
  $ echo '.foo { color: "red"; }' | prettier-standard --parser css
`

function help () {
  console.log(cliHelp)
  process.exit(1)
}

async function main () {
  const flags = mri(process.argv.slice(2), {
    string: ['parser', 'since'],
    default: {
      format: false,
      lint: false,
      changed: false,
      lines: true,
      check: false,
      help: false
    }
  })

  if (flags._ && flags._.length > 0) {
    flags.patterns = flags._
  }

  const hasStdin = process.stdin.isTTY !== true && flags.patterns.length === 0

  if (flags.changed && hasStdin) {
    return new Error('--changed flag does not support stdin')
  }

  if (flags.since && hasStdin) {
    return new Error('--since flag does not support stdin')
  }

  if (
    flags.help ||
    (!hasStdin &&
      !flags.changed &&
      !flags.check &&
      !flags.since &&
      !flags.lint &&
      !flags.format &&
      flags._.length === 0)
  ) {
    help()
  }

  const options = {}

  if (flags.parser) {
    options.parser = flags.parser
  }

  if (hasStdin) {
    const stdin = await getStdin()

    options.filepath = '(stdin)'

    if (flags.check) {
      try {
        const valid = check(stdin, options)
        if (!valid) {
          console.log('(stdin)')
          return 1
        }
      } catch (e) {
        if (e.message.match(/SyntaxError/)) {
          return e
        }
        throw e
      }
    } else {
      const output = format(stdin, options)
      process.stdout.write(output)
    }
  } else {
    let allStandard = true

    let results = []
    let engine

    const error = run(process.cwd(), {
      format: flags.format,
      patterns: flags.patterns,
      check: flags.check,
      changed: flags.changed,
      since: flags.since,
      lint: flags.lint,
      precise: flags.precise,
      options,
      onStart: params => {
        if (params.engine) {
          engine = params.engine
        }
      },
      onProcessed: ({ file, formatted, report, check, runtime }) => {
        if (check) {
          if (!formatted) {
            if (allStandard === true) {
              console.log('Code style issues found in following files:')
              allStandard = false
            }
            console.log(file)
          }
        } else {
          console.log(`${formatted ? chalk.grey(file) : file} ${runtime}ms`)
        }

        if (report) {
          results = results.concat(report.results)
        }
      }
    })

    if (error) {
      return error
    }

    const errorCount = results.map(r => r.errorCount).reduce((a, b) => a + b, 0)

    if (engine && errorCount > 0) {
      const formatter = engine.getFormatter()
      const output = formatter(results)
      if (output) {
        console.error(output)
      }
      allStandard = false
    } else {
      if ((flags.check || flags.lint) && allStandard) {
        console.log('All matched files use Standard code style!')
      }
    }

    if (allStandard === false) {
      process.exit(1)
    }
  }
}

main().then(
  function index (result) {
    if (typeof result === 'number') {
      process.exit(result)
    }

    if (result instanceof Error) {
      console.error(result.message)
      process.exit(2)
    }
  },
  function (error) {
    console.error(error)
    process.exit(2)
  }
)
<|endoftext|>


<commit_before>/**
 * Created by anderson.santos on 24/02/2017.
 */
//todo refatorar e unificar este módulo com o Bitbucket

var jiraClientServicesHelper = {
    buildApiUrl:function(data,url){

        if(data){
            var keys = url.match(/\{[a-zA-Z]+}/g);
            if(keys){
                keys.forEach(function(key){
                    url = url.replace(key,data[key.replace(/\{|}/g,"")]);
                });
                return url
            }
            else{
                return url;
            }
        }
        else{
            return url;
        }
    },
    getJiraData: function(apiUrl,bodyData,connectionData,success,fail){
        var options = {
            host: connectionData.host,
            port: connectionData.port,
            path: apiUrl,
            headers:{
                "Authorization": "Basic " + new Buffer(connectionData.userName +":" + connectionData.password).toString('base64')
            }
        };
        require(connectionData.protocol).get(options, function(resp){
            var data = '';
            resp.on('data', function(chunk){
                data = data + chunk.toString();
            });
            resp.on("end", function(){
                try{
                    success(JSON.parse(data));
                }
                catch(ex){
                    console.log(data);
                    fail(data,ex);
                }

            });
        }).on("error", function(e){
            fail(e);
        });
    },
    postJiraData:function(apiUrl,data,connectionData,success,fail){
        var api = apiUrl;
        var body = JSON.stringify(data||{});
        var options = {
            host: connectionData.host,
            port:  connectionData.port,
            path: api,
            method:"POST",
            headers:{
                "X-Atlassian-Token":" no-check",
                "content-type": "application/json",
                "Content-Length": Buffer.byteLength(body),
                'Accept': 'application/json',
                "Authorization": "Basic " + new Buffer(connectionData.userName +":" + connectionData.password).toString('base64')
            }
        };
        var post_req = require(connectionData.protocol).request(options, function(resp){
            var data = '';
            resp.on('data', function(chunk){
                data = data + chunk.toString();
            });
            resp.on("end", function(){
                try{
                    success(JSON.parse(data));
                }
                catch(ex){
                    console.log(ex,data);
                }
            });
            resp.on("error", function(e){
                fail(e);
            })
        });
        post_req.end(body);
    }
};
module.exports = {

    get:function (url,params,data, connectionData ,success, fail) {
        jiraClientServicesHelper.getJiraData(jiraClientServicesHelper.buildApiUrl(params,url),data,connectionData,success,fail);
    },
    post:function(url,params,data, connectionData ,success, fail){
        jiraClientServicesHelper.postJiraData(jiraClientServicesHelper.buildApiUrl(params,url),data,connectionData,success,fail);
    }
};<commit_msg>refatoração para depuração de problema na requisição à api JIRA<commit_after>/**
 * Created by anderson.santos on 24/02/2017.
 */
//todo refatorar e unificar este módulo com o Bitbucket

var jiraClientServicesHelper = {
    buildApiUrl:function(data,url){

        if(data){
            var keys = url.match(/\{[a-zA-Z]+}/g);
            if(keys){
                keys.forEach(function(key){
                    url = url.replace(key,data[key.replace(/\{|}/g,"")]);
                });
                return url
            }
            else{
                return url;
            }
        }
        else{
            return url;
        }
    },
    getJiraData: function(apiUrl,bodyData,connectionData,success,fail){
        var options = {
            host: connectionData.host,
            port: connectionData.port,
            path: apiUrl,
            headers:{
                "Authorization": "Basic " + new Buffer(connectionData.userName +":" + connectionData.password).toString('base64')
            }
        };
        var protocol = require(connectionData.protocol);
        protocol.get(options, function(resp){
            var data = '';
            resp.on('data', function(chunk){
                data = data + chunk.toString();
            });
            resp.on("end", function(){
                try{
                    success(JSON.parse(data));
                }
                catch(ex){
                    console.log(data);
                    fail(data,ex);
                }

            });
        }).on("error", function(e){
            fail(e);
        });
    },
    postJiraData:function(apiUrl,data,connectionData,success,fail){
        var api = apiUrl;
        var body = JSON.stringify(data||{});
        var options = {
            host: connectionData.host,
            port:  connectionData.port,
            path: api,
            method:"POST",
            headers:{
                "X-Atlassian-Token":" no-check",
                "content-type": "application/json",
                "Content-Length": Buffer.byteLength(body),
                'Accept': 'application/json',
                "Authorization": "Basic " + new Buffer(connectionData.userName +":" + connectionData.password).toString('base64')
            }
        };
        var post_req = require(connectionData.protocol).request(options, function(resp){
            var data = '';
            resp.on('data', function(chunk){
                data = data + chunk.toString();
            });
            resp.on("end", function(){
                try{
                    success(JSON.parse(data));
                }
                catch(ex){
                    console.log(ex,data);
                }
            });
            resp.on("error", function(e){
                fail(e);
            })
        });
        post_req.end(body);
    }
};
module.exports = {

    get:function (url,params,data, connectionData ,success, fail) {
        jiraClientServicesHelper.getJiraData(jiraClientServicesHelper.buildApiUrl(params,url),data,connectionData,success,fail);
    },
    post:function(url,params,data, connectionData ,success, fail){
        jiraClientServicesHelper.postJiraData(jiraClientServicesHelper.buildApiUrl(params,url),data,connectionData,success,fail);
    }
};<|endoftext|>


<commit_before>import { moduleForComponent, test } from 'ember-qunit';

moduleForComponent( 'sl-alert', 'Unit | Component | sl alert', {
    unit: true
});

test( 'themeClassName computed property is observing the correct properties', function( assert ) {
    const component = this.subject();

    assert.strictEqual(
        component.themeClassName._dependentKeys.join(),
        'theme',
        'themeClassName computed property observes the correct properties'
    );
});
<commit_msg>refactored dependent keys unit testing<commit_after>import { moduleForComponent, test } from 'ember-qunit';

moduleForComponent( 'sl-alert', 'Unit | Component | sl alert', {
    unit: true
});

test( 'Dependent keys are correct', function( assert ) {
    const component = this.subject();

    const themeClassNameDependentKeys = [
        'theme',
    ];

    assert.deepEqual(
        component.themeClassName._dependentKeys,
        themeClassNameDependentKeys,
        'Dependent keys are correct for themeClassName()'
    );
});<|endoftext|>


<commit_before>/* @flow */

const path = require('path');
const normalize = require('normalize-path');
const fs = require('fs');
const mkdirp = require('mkdirp');
const glob = require('glob');
const yargs = require('yargs');
const transform = require('./transform');

const { argv } = yargs
  .usage('Usage: $0 [options] <files ...>')
  .option('config', {
    alias: 'c',
    type: 'string',
    description: 'Path to a config file',
    requiresArg: true,
  })
  .option('out-dir', {
    alias: 'o',
    type: 'string',
    description: 'Output directory for the extracted CSS files',
    demandOption: true,
    requiresArg: true,
  })
  .option('source-maps', {
    alias: 's',
    type: 'boolean',
    description: 'Generate source maps for the CSS files',
    default: false,
  })
  .option('source-root', {
    alias: 'r',
    type: 'string',
    description: 'Directory containing the source JS files',
    requiresArg: true,
  })
  .option('insert-css-requires', {
    alias: 'i',
    type: 'string',
    description:
      'Directory containing JS files to insert require statements for the CSS files',
    requiresArg: true,
  })
  .implies('insert-css-requires', 'source-root')
  .alias('help', 'h')
  .alias('version', 'v')
  .strict();

processFiles(argv._, {
  outDir: argv['out-dir'],
  sourceMaps: argv['source-maps'],
  sourceRoot: argv['source-root'],
  insertCssRequires: argv['insert-css-requires'],
  configFile: argv.config,
});

type Options = {
  outDir: string,
  sourceMaps?: boolean,
  sourceRoot?: string,
  insertCssRequires?: string,
  configFile?: string,
};

function processFiles(files: string[], options: Options) {
  let count = 0;

  const resolvedFiles = files.reduce(
    (acc, pattern) => [...acc, ...glob.sync(pattern, { absolute: true })],
    []
  );

  resolvedFiles.forEach(filename => {
    const outputFilename = resolveOutputFilename(filename, options.outDir);

    const { cssText, sourceMap, cssSourceMapText } = transform(
      fs.readFileSync(filename).toString(),
      {
        filename,
        outputFilename,
        pluginOptions: {
          configFile: options.configFile,
        },
      }
    );

    if (cssText) {
      mkdirp.sync(path.dirname(outputFilename));

      const cssContent =
        options.sourceMaps && sourceMap
          ? `${cssText}\n/*# sourceMappingURL=${outputFilename}.map */`
          : cssText;

      fs.writeFileSync(outputFilename, cssContent);

      if (
        options.sourceMaps &&
        sourceMap &&
        typeof cssSourceMapText !== 'undefined'
      ) {
        fs.writeFileSync(`${outputFilename}.map`, cssSourceMapText);
      }

      if (options.insertCssRequires && options.sourceRoot) {
        const inputFilename = path.resolve(
          options.insertCssRequires,
          path.relative(options.sourceRoot, filename)
        );

        const relativePath = normalize(
          path.relative(path.dirname(inputFilename), outputFilename)
        );

        const requireStatement = `\nrequire('${
          relativePath.startsWith('.') ? relativePath : `./${relativePath}`
        }');`;

        const inputContent = fs.readFileSync(inputFilename, 'utf-8');

        if (!inputContent.trim().endsWith(requireStatement)) {
          fs.writeFileSync(
            inputFilename,
            `${inputContent}\n${requireStatement}\n`
          );
        }
      }

      count++;
    }
  });

  console.log(`Successfully extracted ${count} CSS files.`);
}

function resolveOutputFilename(filename: string, outDir: string) {
  const folderStructure = path.relative(process.cwd(), path.dirname(filename));
  const outputBasename = path
    .basename(filename)
    .replace(path.extname(filename), '.css');

  return path.join(outDir, folderStructure, outputBasename);
}
<commit_msg>fix(cli): add typescript source files support (#396)<commit_after>/* @flow */

const path = require('path');
const normalize = require('normalize-path');
const fs = require('fs');
const mkdirp = require('mkdirp');
const glob = require('glob');
const yargs = require('yargs');
const transform = require('./transform');

const { argv } = yargs
  .usage('Usage: $0 [options] <files ...>')
  .option('config', {
    alias: 'c',
    type: 'string',
    description: 'Path to a config file',
    requiresArg: true,
  })
  .option('out-dir', {
    alias: 'o',
    type: 'string',
    description: 'Output directory for the extracted CSS files',
    demandOption: true,
    requiresArg: true,
  })
  .option('source-maps', {
    alias: 's',
    type: 'boolean',
    description: 'Generate source maps for the CSS files',
    default: false,
  })
  .option('source-root', {
    alias: 'r',
    type: 'string',
    description: 'Directory containing the source JS files',
    requiresArg: true,
  })
  .option('insert-css-requires', {
    alias: 'i',
    type: 'string',
    description:
      'Directory containing JS files to insert require statements for the CSS files',
    requiresArg: true,
  })
  .implies('insert-css-requires', 'source-root')
  .alias('help', 'h')
  .alias('version', 'v')
  .strict();

processFiles(argv._, {
  outDir: argv['out-dir'],
  sourceMaps: argv['source-maps'],
  sourceRoot: argv['source-root'],
  insertCssRequires: argv['insert-css-requires'],
  configFile: argv.config,
});

type Options = {
  outDir: string,
  sourceMaps?: boolean,
  sourceRoot?: string,
  insertCssRequires?: string,
  configFile?: string,
};

function processFiles(files: string[], options: Options) {
  let count = 0;

  const resolvedFiles = files.reduce(
    (acc, pattern) => [...acc, ...glob.sync(pattern, { absolute: true })],
    []
  );

  resolvedFiles.forEach(filename => {
    const outputFilename = resolveOutputFilename(filename, options.outDir);

    const { cssText, sourceMap, cssSourceMapText } = transform(
      fs.readFileSync(filename).toString(),
      {
        filename,
        outputFilename,
        pluginOptions: {
          configFile: options.configFile,
        },
      }
    );

    if (cssText) {
      mkdirp.sync(path.dirname(outputFilename));

      const cssContent =
        options.sourceMaps && sourceMap
          ? `${cssText}\n/*# sourceMappingURL=${outputFilename}.map */`
          : cssText;

      fs.writeFileSync(outputFilename, cssContent);

      if (
        options.sourceMaps &&
        sourceMap &&
        typeof cssSourceMapText !== 'undefined'
      ) {
        fs.writeFileSync(`${outputFilename}.map`, cssSourceMapText);
      }

      if (options.insertCssRequires && options.sourceRoot) {
        const inputFilename = path.resolve(
          options.insertCssRequires,
          path.relative(options.sourceRoot, filename)
        );

        const normalizedInputFilename = resolveRequireInsertionFilename(
          inputFilename
        );

        const relativePath = normalize(
          path.relative(path.dirname(inputFilename), outputFilename)
        );

        const requireStatement = `\nrequire('${
          relativePath.startsWith('.') ? relativePath : `./${relativePath}`
        }');`;

        const inputContent = fs.readFileSync(normalizedInputFilename, 'utf-8');

        if (!inputContent.trim().endsWith(requireStatement)) {
          fs.writeFileSync(
            normalizedInputFilename,
            `${inputContent}\n${requireStatement}\n`
          );
        }
      }

      count++;
    }
  });

  console.log(`Successfully extracted ${count} CSS files.`);
}

function resolveRequireInsertionFilename(filename: string) {
  return filename.replace(/\.tsx?/, '.js');
}

function resolveOutputFilename(filename: string, outDir: string) {
  const folderStructure = path.relative(process.cwd(), path.dirname(filename));
  const outputBasename = path
    .basename(filename)
    .replace(path.extname(filename), '.css');

  return path.join(outDir, folderStructure, outputBasename);
}
<|endoftext|>


<commit_before>import { expect } from 'chai';
import proxyquire from 'proxyquire';
import sinon from 'sinon';
import _ from 'underscore';

const {
    KEYWORDS
    } = proxyquire('../../../imports/search/FilterKeywords', {
    'meteor/underscore': { _, '@noCallThru': true}
});

const {
    TopicFilter
    } = proxyquire('../../../imports/TopicFilter', {
    'meteor/underscore': { _, '@noCallThru': true},
    './search/FilterKeywords': { KEYWORDS, '@noCallThru': true}
});

let QueryParserMock = function() { this.query = null};
QueryParserMock.prototype.parse = function(query) {
    this.query = query;
};
QueryParserMock.prototype.getSearchTokens = function() {
    if (this.query.substr(0,1) === '#') {
        return [];
    }
    return this.query.split(" ");
};
QueryParserMock.prototype.getFilterTokens = function() {
    return [];
};
QueryParserMock.prototype.getLabelTokens = function() {
    if (this.query.substr(0,1) === '#') {
        let token = this.query.substr(1);
        return [{token: token, ids: [token]}];
    }
    return [];
};
let caseSensitive = false;
QueryParserMock.prototype.isCaseSensitive = function () { return caseSensitive; };
QueryParserMock.prototype.reset = function() {};

describe('TopicFilter', function() {

    let topics, topicFilter;

    beforeEach(function() {
        topicFilter = new TopicFilter(new QueryParserMock());
        topics = [
            {
                subject: "One",
                infoItems: [{subject: "one.one", labels: ['L2', 'L1']}, {subject: "one.two", labels: []}]
            },
            {
                subject: "Two",
                infoItems: [
                    {subject: "two.one", labels: ['L1']},
                    {subject: "two.two", labels: []},
                    {subject: "two.three", labels: ['L1']}
                ]
            },
            {
                subject: "Three",
                infoItems: [
                    {subject: "three.one", labels: []},
                    {subject: "three.two", labels: []},
                    {subject: "three.three", labels: []},
                    {subject: "three.four", labels: []}
                ]
            }
        ];
    });

    it('does not change the original array of topics', function() {
        topicFilter.filter(topics, "three");

        expect(topics, "Length of the topic array should be 3").have.length(3);
        expect(topics[0].infoItems, "The first topic should contain two info items").to.have.length(2);
        expect(topics[1].infoItems, "The 2nd topic should contain three info items").to.have.length(3);
        expect(topics[2].infoItems, "The 3rd topic should contain four info items").to.have.length(4);
    });

    it('returns the filtered array of topics', function() {
        let res = topicFilter.filter(topics, "three");

        expect(res, "Length of the result topic array should be 2").have.length(2);
        expect(res[0].infoItems, "The first topic should contain one info items").to.have.length(1);
        expect(res[1].infoItems, "The 2nd topic should contain four info items").to.have.length(4);
    });

    it('can filter for multiple search tokens', function() {
        let res = topicFilter.filter(topics, "three two");

        expect(res, "Length of the result topic array should be 2").have.length(2);
        expect(res[0].infoItems, "The first topic should contain one info items").to.have.length(1);
        expect(res[1].infoItems, "The 2nd topic should contain one info items").to.have.length(1);
    });

    it('should return an topics array containing only info items matching the search query', function() {
        const query = "three";
        let res = topicFilter.filter(topics, query);
        res.forEach(topic => {
            topic.infoItems.forEach(item => {
                if (item.subject.indexOf(query) === -1) {
                    fail("Result array contains info item which does not match the search query");
                }
            });
        })
    });

    it('can filter for labels', function() {
        const query = "#L1";
        let res = topicFilter.filter(topics, query);
        expect(res, "Length of the result topic array should be 2").have.length(2);
        expect(res[0].infoItems, "The first topic should contain one info items").to.have.length(1);
        expect(res[1].infoItems, "The 2nd topic should contain two info items").to.have.length(2);
    });

    it('filters case insensitive per default for search tokens', function() {
        let res = topicFilter.filter(topics, "THREE TWO");

        expect(res, "Length of the result topic array should be 2").have.length(2);
        expect(res[0].infoItems, "The first topic should contain one info items").to.have.length(1);
        expect(res[1].infoItems, "The 2nd topic should contain one info items").to.have.length(1);
    });

    it('can enable case sensitive search', function() {
        caseSensitive = true;
        let res = topicFilter.filter(topics, "THREE");
        caseSensitive = false;

        expect(res, "Length of the result topic array should be 0").have.length(0);
    });

});<commit_msg>Fixed broken tests, really !<commit_after>import { expect } from 'chai';
import proxyquire from 'proxyquire';
import sinon from 'sinon';
import _ from 'underscore';

const {
    KEYWORDS
    } = proxyquire('../../../imports/search/FilterKeywords', {
    'meteor/underscore': { _, '@noCallThru': true}
});

const {
    TopicFilter
    } = proxyquire('../../../imports/TopicFilter', {
    'meteor/underscore': { _, '@noCallThru': true},
    './search/FilterKeywords': { KEYWORDS, '@noCallThru': true}
});

let QueryParserMock = function() { this.query = null};
QueryParserMock.prototype.parse = function(query) {
    this.query = query;
};
QueryParserMock.prototype.getSearchTokens = function() {
    if (this.query.substr(0,1) === '#') {
        return [];
    }
    return this.query.split(" ");
};
QueryParserMock.prototype.getFilterTokens = function() {
    return [];
};
QueryParserMock.prototype.getLabelTokens = function() {
    if (this.query.substr(0,1) === '#') {
        let token = this.query.substr(1);
        return [{token: token, ids: [token]}];
    }
    return [];
};
QueryParserMock.prototype.hasKeyword = function() {
    return true;
};
let caseSensitive = false;
QueryParserMock.prototype.isCaseSensitive = function () { return caseSensitive; };
QueryParserMock.prototype.reset = function() {};

describe('TopicFilter', function() {

    let topics, topicFilter;

    beforeEach(function() {
        topicFilter = new TopicFilter(new QueryParserMock());
        topics = [
            {
                subject: "One",
                infoItems: [{subject: "one.one", labels: ['L2', 'L1']}, {subject: "one.two", labels: []}]
            },
            {
                subject: "Two",
                infoItems: [
                    {subject: "two.one", labels: ['L1']},
                    {subject: "two.two", labels: []},
                    {subject: "two.three", labels: ['L1']}
                ]
            },
            {
                subject: "Three",
                infoItems: [
                    {subject: "three.one", labels: []},
                    {subject: "three.two", labels: []},
                    {subject: "three.three", labels: []},
                    {subject: "three.four", labels: []}
                ]
            }
        ];
    });

    it('does not change the original array of topics', function() {
        topicFilter.filter(topics, "three");

        expect(topics, "Length of the topic array should be 3").have.length(3);
        expect(topics[0].infoItems, "The first topic should contain two info items").to.have.length(2);
        expect(topics[1].infoItems, "The 2nd topic should contain three info items").to.have.length(3);
        expect(topics[2].infoItems, "The 3rd topic should contain four info items").to.have.length(4);
    });

    it('returns the filtered array of topics', function() {
        let res = topicFilter.filter(topics, "three");

        expect(res, "Length of the result topic array should be 2").have.length(2);
        expect(res[0].infoItems, "The first topic should contain one info items").to.have.length(1);
        expect(res[1].infoItems, "The 2nd topic should contain four info items").to.have.length(4);
    });

    it('can filter for multiple search tokens', function() {
        let res = topicFilter.filter(topics, "three two");

        expect(res, "Length of the result topic array should be 2").have.length(2);
        expect(res[0].infoItems, "The first topic should contain one info items").to.have.length(1);
        expect(res[1].infoItems, "The 2nd topic should contain one info items").to.have.length(1);
    });

    it('should return an topics array containing only info items matching the search query', function() {
        const query = "three";
        let res = topicFilter.filter(topics, query);
        res.forEach(topic => {
            topic.infoItems.forEach(item => {
                if (item.subject.indexOf(query) === -1) {
                    fail("Result array contains info item which does not match the search query");
                }
            });
        })
    });

    it('can filter for labels', function() {
        const query = "#L1";
        let res = topicFilter.filter(topics, query);
        expect(res, "Length of the result topic array should be 2").have.length(2);
        expect(res[0].infoItems, "The first topic should contain one info items").to.have.length(1);
        expect(res[1].infoItems, "The 2nd topic should contain two info items").to.have.length(2);
    });

    it('filters case insensitive per default for search tokens', function() {
        let res = topicFilter.filter(topics, "THREE TWO");

        expect(res, "Length of the result topic array should be 2").have.length(2);
        expect(res[0].infoItems, "The first topic should contain one info items").to.have.length(1);
        expect(res[1].infoItems, "The 2nd topic should contain one info items").to.have.length(1);
    });

    it('can enable case sensitive search', function() {
        caseSensitive = true;
        let res = topicFilter.filter(topics, "THREE");
        caseSensitive = false;

        expect(res, "Length of the result topic array should be 0").have.length(0);
    });

});<|endoftext|>


<commit_before>import fs                      from 'fs'
import minify                  from 'html-minify'
import mjmlEngine              from './index'
import { version as VERSION }  from '../package.json'

const engine = mjmlEngine.mjml2html

/*
 * The version number is the NPM
 * version number. It should be the same as the MJML engine
 */
const version = () => VERSION

/*
 * Turns a callback style to a Promise style one
 */
const promisify = fn =>
  (...args) =>
    new Promise((resolve, reject) =>
      fn(...args.concat((err, ...data) =>
        err ? reject(err) : resolve(...data))))

/*
 * Minimal Error Handling
 */
const error   = (e) => {
  console.log(e.stack ? e.stack : e)
}

/*
 * Utility functions
 * write: write to a file
 * read: read a fileexists: ensure the file exists
 */
const write   = promisify(fs.writeFile)
const read    = promisify(fs.readFile)
const exists  = promisify((file, cb) => fs.access(file, fs.R_OK | fs.W_OK, cb))

/*
 * Turns an MJML input file into a pretty HTML file
 * min: boolean that specify the output format (pretty/minified)
 */
const render = (input, { min, output, register }) => {
  exists(input)
    .then(()      => read(input))
    .then(mjml    => engine(mjml.toString()))
    .then(html    => min ? minify(html) : html)
    .then(result  => write(output, result))
    .catch(error)
}

/*
 * Watch changes on a specific input file by calling render on each change
 */
const watch = (input, options) =>
  fs.watch(input, () =>
    render(input, options))

const capitalize = name => name.charAt(0).toUpperCase() + name.slice(1).toLowerCase().replace(/-/g, '')

/*
* Return the code of an MJML component for a given name
*/
const createComponent = (name, ending) => {
  const lowerName = name.toLowerCase()

  return `
import React, { Component } from 'react'
import _ from 'loadash'
import {
  MJMLColumnElement,
  elements,
  registerElement,
} from 'mjml'

/*
 * Wrap your dependencies here.
 */
const {
  text: MjText,
} = elements;

const NAME = '${lowerName}'

@MJMLColumnElement({
  tagName: 'mj-${lowerName}',
  content: ' ',

  /*
   * These are your default css attributes
   */
  attributes: {
    'color': '#424242',
    'font-family': 'Helvetica',
    'margin-top': '10px'
  }
})
class ${name} extends Component {

  /*
   * Build your styling here
   */
  getStyles() {
    const { mjAttribute, color } = this.props

    return _.merge({}, this.constructor.baseStyles, {
      text: {
      /*
       * Get the color attribute
       * Example: <mj-${lowerName} color="blue">content</mj-${lowerName}>
       */
        color: mjAttribute('color')
      }
    })
  }

  render() {

    const css = this.getStyles(),
          content = 'Hello World!'

    return (
      <MjText style={ css }>
        { content }
      </MjText>
    )
  }
}

registerElement('${lowerName}', ${name}${ending ? ', true' : ''})
export default ${name}
`
}

/*
 * Create a new component based on the default template
 */
const initComponent = (name, ending) =>
  write(`./${capitalize(name)}.js`, createComponent(capitalize(name), ending))
    .then(() => console.log(`Component created: ${capitalize(name)}`))

module.exports = {
  initComponent: initComponent,
  render: render,
  watch: watch,
  version: version
}
<commit_msg>Update cli.js<commit_after>import fs                      from 'fs'
import minify                  from 'html-minify'
import mjmlEngine              from './index'
import { version as VERSION }  from '../package.json'

const engine = mjmlEngine.mjml2html

/*
 * The version number is the NPM
 * version number. It should be the same as the MJML engine
 */
const version = () => VERSION

/*
 * Turns a callback style to a Promise style one
 */
const promisify = fn =>
  (...args) =>
    new Promise((resolve, reject) =>
      fn(...args.concat((err, ...data) =>
        err ? reject(err) : resolve(...data))))

/*
 * Minimal Error Handling
 */
const error   = (e) => {
  console.log(e.stack ? e.stack : e)
}

/*
 * Utility functions
 * write: write to a file
 * read: read a fileexists: ensure the file exists
 */
const write   = promisify(fs.writeFile)
const read    = promisify(fs.readFile)
const exists  = promisify((file, cb) => fs.access(file, fs.R_OK | fs.W_OK, cb))

/*
 * Turns an MJML input file into a pretty HTML file
 * min: boolean that specify the output format (pretty/minified)
 */
const render = (input, { min, output }) => {
  exists(input)
    .then(()      => read(input))
    .then(mjml    => engine(mjml.toString()))
    .then(html    => min ? minify(html) : html)
    .then(result  => write(output, result))
    .catch(error)
}

/*
 * Watch changes on a specific input file by calling render on each change
 */
const watch = (input, options) =>
  fs.watch(input, () =>
    render(input, options))

const capitalize = name => name.charAt(0).toUpperCase() + name.slice(1).toLowerCase().replace(/-/g, '')

/*
* Return the code of an MJML component for a given name
*/
const createComponent = (name, ending) => {
  const lowerName = name.toLowerCase()

  return `
import React, { Component } from 'react'
import _ from 'loadash'
import {
  MJMLColumnElement,
  elements,
  registerElement,
} from 'mjml'

/*
 * Wrap your dependencies here.
 */
const {
  text: MjText,
} = elements;

const NAME = '${lowerName}'

@MJMLColumnElement({
  tagName: 'mj-${lowerName}',
  content: ' ',

  /*
   * These are your default css attributes
   */
  attributes: {
    'color': '#424242',
    'font-family': 'Helvetica',
    'margin-top': '10px'
  }
})
class ${name} extends Component {

  /*
   * Build your styling here
   */
  getStyles() {
    const { mjAttribute, color } = this.props

    return _.merge({}, this.constructor.baseStyles, {
      text: {
      /*
       * Get the color attribute
       * Example: <mj-${lowerName} color="blue">content</mj-${lowerName}>
       */
        color: mjAttribute('color')
      }
    })
  }

  render() {

    const css = this.getStyles(),
          content = 'Hello World!'

    return (
      <MjText style={ css }>
        { content }
      </MjText>
    )
  }
}

registerElement('${lowerName}', ${name}${ending ? ', true' : ''})
export default ${name}
`
}

/*
 * Create a new component based on the default template
 */
const initComponent = (name, ending) =>
  write(`./${capitalize(name)}.js`, createComponent(capitalize(name), ending))
    .then(() => console.log(`Component created: ${capitalize(name)}`))

module.exports = {
  initComponent: initComponent,
  render: render,
  watch: watch,
  version: version
}
<|endoftext|>


<commit_before>#! /usr/bin/env node
const util = require('util');
const program = require('commander');

const Hs100Api = require('.');
const Client = Hs100Api.Client;
const { ResponseError } = require('./utils');

let logLevel;
let client;

let outputError = function (err) {
  if (err instanceof ResponseError) {
    console.log(err.response);
  } else {
    console.error(err);
  }
};

let search = function (sysInfo, timeout, params) {
  try {
    console.log('Searching...');

    let commandParams = Object.assign({}, {discoveryInterval: 2000, discoveryTimeout: timeout}, params); // {discoveryInterval: 2000, discoveryTimeout: timeout, ...params};
    console.log(`startDiscovery(${util.inspect(commandParams)})`);
    client.startDiscovery(commandParams)
      .on('device-new', (device) => {
        console.log(`${device.model} ${device.deviceType} ${device.type} ${device.host} ${device.port} ${device.deviceId} ${device.alias}`);
        if (sysInfo) {
          console.dir(device.sysInfo, {colors: program.color === 'on', depth: 10});
        }
      });
  } catch (err) {
    outputError(err);
  }
};

let send = async function (host, port, payload, timeout) {
  try {
    console.log('Sending...');
    let data = await client.send({host, port, payload, timeout});
    console.log('response:');
    console.dir(data, {colors: program.color === 'on', depth: 10});
  } catch (err) {
    outputError(err);
  }
};

let sendCommand = async function (host, port, payload, timeout) {
  try {
    console.log('Sending command...');
    let device = await client.getDevice({host, port});
    let results = await device.sendCommand(payload, timeout);
    console.log('response:');
    console.dir(results, {colors: program.color === 'on', depth: 10});
  } catch (err) {
    outputError(err);
  }
};

let sendCommandDynamic = async function (host, port, command, commandParams = []) {
  try {
    console.log(`Sending ${command} command...`);
    let device = await client.getDevice({host, port});
    let results = await device[command](...commandParams);
    console.log('response:');
    console.dir(results, {colors: program.color === 'on', depth: 10});
  } catch (err) {
    outputError(err);
  }
};

let details = async function (host, port, timeout) {
  try {
    console.log('Getting details...');
    let device = await client.getDevice({host, port});
    console.dir({
      alias: device.alias,
      deviceId: device.deviceId,
      deviceName: device.deviceName,
      model: device.model,
      deviceType: device.deviceType,
      type: device.type,
      softwareVersion: device.softwareVersion,
      hardwareVersion: device.hardwareVersion,
      mac: device.mac
    }, {colors: program.color === 'on', depth: 10});
  } catch (err) {
    outputError(err);
  }
};

let info = async function (host, port, timeout) {
  try {
    console.log('Getting device info...');
    let device = await client.getDevice({host, port});
    let info = await device.getInfo();
    console.dir(info, {colors: program.color === 'on', depth: 10});
  } catch (err) {
    outputError(err);
  }
};

let blink = function (host, port, times, rate, timeout) {
  console.log('Sending blink commands...');
  client.getDevice({host, port}).then((device) => {
    return device.blink(times, rate).then(() => {
      console.log('Blinking complete');
    });
  }).catch((reason) => {
    outputError(reason);
  });
};

let toInt = (s) => {
  return parseInt(s);
};

let setupClient = function () {
  let client = new Client({timeout: program.timeout, logLevel});
  return client;
};

program
  .option('-D, --debug', 'turn on debug level logging', () => { logLevel = 'debug'; })
  .option('-t, --timeout <ms>', 'timeout (ms)', toInt, 5000)
  .option('-c, --color [on]', 'output will be styled with ANSI color codes', 'on');

program
  .command('search [params]')
  .description('Search for devices')
  .option('-s, --sysinfo', 'output sysInfo')
  .action(function (params, options) {
    client = setupClient();
    if (params) {
      console.dir(params);
      params = JSON.parse(params);
    }
    search(options.sysinfo, program.timeout, params);
  });

program
  .command('send <host> <payload>')
  .description('Send payload to device (using Client.send)')
  .action(function (host, payload, options) {
    client = setupClient();
    let [hostOnly, port] = host.split(':');
    send(hostOnly, port, payload, program.timeout);
  });

program
  .command('sendCommand <host> <payload>')
  .description('Send payload to device (using Device#sendCommand)')
  .action(function (host, payload, options) {
    client = setupClient();
    let [hostOnly, port] = host.split(':');
    sendCommand(hostOnly, port, payload, program.timeout);
  });

program
  .command('info <host>')
  .action(function (host, options) {
    client = setupClient();
    let [hostOnly, port] = host.split(':');
    info(hostOnly, port, program.timeout);
  });

program
  .command('details <host>')
  .action(function (host, options) {
    client = setupClient();
    let [hostOnly, port] = host.split(':');
    details(hostOnly, port, program.timeout);
  });

program
  .command('blink <host> [times] [rate]')
  .action(function (host, times = 5, rate = 500, options) {
    client = setupClient();
    let [hostOnly, port] = host.split(':');
    blink(hostOnly, port, times, rate, program.timeout);
  });

[ 'getSysInfo', 'getModel', 'getCloudInfo', 'setAlias', 'getScheduleNextAction', 'getScheduleRules',
  'getTime', 'getTimeZone', 'getScanInfo', 'getEmeterRealtime'
].forEach((command) => {
  program
    .command(`${command} <host> [params]`)
    .description(`Send ${command} to device (using Device#${command})`)
    .option('-t, --timeout [timeout]', 'timeout (ms)', toInt, 5000)
    .action(function (host, params, options) {
      client = setupClient();
      let [hostOnly, port] = host.split(':');
      sendCommandDynamic(hostOnly, port, command, params);
    });
});

program.parse(process.argv);

if (!process.argv.slice(2).length) {
  program.outputHelp();
}
<commit_msg>add encryption functions<commit_after>#! /usr/bin/env node
const util = require('util');
const program = require('commander');

const Hs100Api = require('.');
const Client = Hs100Api.Client;
const { ResponseError } = require('./utils');
const tplinkCrypto = require('./tplink-crypto');

let logLevel;
let client;

let outputError = function (err) {
  if (err instanceof ResponseError) {
    console.log(err.response);
  } else {
    console.error(err);
  }
};

let search = function (sysInfo, timeout, params) {
  try {
    console.log('Searching...');

    let commandParams = Object.assign({}, {discoveryInterval: 2000, discoveryTimeout: timeout}, params); // {discoveryInterval: 2000, discoveryTimeout: timeout, ...params};
    console.log(`startDiscovery(${util.inspect(commandParams)})`);
    client.startDiscovery(commandParams)
      .on('device-new', (device) => {
        console.log(`${device.model} ${device.deviceType} ${device.type} ${device.host} ${device.port} ${device.deviceId} ${device.alias}`);
        if (sysInfo) {
          console.dir(device.sysInfo, {colors: program.color === 'on', depth: 10});
        }
      });
  } catch (err) {
    outputError(err);
  }
};

let send = async function (host, port, payload, timeout) {
  try {
    console.log('Sending...');
    let data = await client.send({host, port, payload, timeout});
    console.log('response:');
    console.dir(data, {colors: program.color === 'on', depth: 10});
  } catch (err) {
    outputError(err);
  }
};

let sendCommand = async function (host, port, payload, timeout) {
  try {
    console.log('Sending command...');
    let device = await client.getDevice({host, port});
    let results = await device.sendCommand(payload, timeout);
    console.log('response:');
    console.dir(results, {colors: program.color === 'on', depth: 10});
  } catch (err) {
    outputError(err);
  }
};

let sendCommandDynamic = async function (host, port, command, commandParams = []) {
  try {
    console.log(`Sending ${command} command...`);
    let device = await client.getDevice({host, port});
    let results = await device[command](...commandParams);
    console.log('response:');
    console.dir(results, {colors: program.color === 'on', depth: 10});
  } catch (err) {
    outputError(err);
  }
};

let details = async function (host, port, timeout) {
  try {
    console.log('Getting details...');
    let device = await client.getDevice({host, port});
    console.dir({
      alias: device.alias,
      deviceId: device.deviceId,
      deviceName: device.deviceName,
      model: device.model,
      deviceType: device.deviceType,
      type: device.type,
      softwareVersion: device.softwareVersion,
      hardwareVersion: device.hardwareVersion,
      mac: device.mac
    }, {colors: program.color === 'on', depth: 10});
  } catch (err) {
    outputError(err);
  }
};

let info = async function (host, port, timeout) {
  try {
    console.log('Getting device info...');
    let device = await client.getDevice({host, port});
    let info = await device.getInfo();
    console.dir(info, {colors: program.color === 'on', depth: 10});
  } catch (err) {
    outputError(err);
  }
};

let blink = function (host, port, times, rate, timeout) {
  console.log('Sending blink commands...');
  client.getDevice({host, port}).then((device) => {
    return device.blink(times, rate).then(() => {
      console.log('Blinking complete');
    });
  }).catch((reason) => {
    outputError(reason);
  });
};

let toInt = (s) => {
  return parseInt(s);
};

let setupClient = function () {
  let client = new Client({timeout: program.timeout, logLevel});
  return client;
};

program
  .option('-D, --debug', 'turn on debug level logging', () => { logLevel = 'debug'; })
  .option('-t, --timeout <ms>', 'timeout (ms)', toInt, 5000)
  .option('-c, --color [on]', 'output will be styled with ANSI color codes', 'on');

program
  .command('search [params]')
  .description('Search for devices')
  .option('-s, --sysinfo', 'output sysInfo')
  .action(function (params, options) {
    client = setupClient();
    if (params) {
      console.dir(params);
      params = JSON.parse(params);
    }
    search(options.sysinfo, program.timeout, params);
  });

program
  .command('send <host> <payload>')
  .description('Send payload to device (using Client.send)')
  .action(function (host, payload, options) {
    client = setupClient();
    let [hostOnly, port] = host.split(':');
    send(hostOnly, port, payload, program.timeout);
  });

program
  .command('sendCommand <host> <payload>')
  .description('Send payload to device (using Device#sendCommand)')
  .action(function (host, payload, options) {
    client = setupClient();
    let [hostOnly, port] = host.split(':');
    sendCommand(hostOnly, port, payload, program.timeout);
  });

program
  .command('info <host>')
  .action(function (host, options) {
    client = setupClient();
    let [hostOnly, port] = host.split(':');
    info(hostOnly, port, program.timeout);
  });

program
  .command('details <host>')
  .action(function (host, options) {
    client = setupClient();
    let [hostOnly, port] = host.split(':');
    details(hostOnly, port, program.timeout);
  });

program
  .command('blink <host> [times] [rate]')
  .action(function (host, times = 5, rate = 500, options) {
    client = setupClient();
    let [hostOnly, port] = host.split(':');
    blink(hostOnly, port, times, rate, program.timeout);
  });

[ 'getSysInfo', 'getModel', 'getCloudInfo', 'setAlias', 'getScheduleNextAction', 'getScheduleRules',
  'getTime', 'getTimeZone', 'getScanInfo', 'getEmeterRealtime'
].forEach((command) => {
  program
    .command(`${command} <host> [params]`)
    .description(`Send ${command} to device (using Device#${command})`)
    .option('-t, --timeout [timeout]', 'timeout (ms)', toInt, 5000)
    .action(function (host, params, options) {
      client = setupClient();
      let [hostOnly, port] = host.split(':');
      sendCommandDynamic(hostOnly, port, command, params);
    });
});

program
  .command('encrypt <outputEncoding> <input> [firstKey=0xAB]')
  .action(function (outputEncoding, input, firstKey = 0xAB) {
    let outputBuf = tplinkCrypto.encrypt(input, firstKey);
    console.log(outputBuf.toString(outputEncoding));
  });
program
  .command('encryptWithHeader <outputEncoding> <input> [firstKey=0xAB]')
  .action(function (outputEncoding, input, firstKey = 0xAB) {
    let outputBuf = tplinkCrypto.encryptWithHeader(input, firstKey);
    console.log(outputBuf.toString(outputEncoding));
  });
program
  .command('decrypt <inputEncoding> <input> [firstKey=0xAB]')
  .action(function (inputEncoding, input, firstKey = 0xAB) {
    let inputBuf = Buffer.from(input, inputEncoding);
    let outputBuf = tplinkCrypto.decrypt(inputBuf, firstKey);
    console.log(outputBuf.toString());
  });
program
  .command('decryptWithHeader <inputEncoding> <input> [firstKey=0xAB]')
  .action(function (inputEncoding, input, firstKey = 0xAB) {
    let inputBuf = Buffer.from(input, inputEncoding);
    let outputBuf = tplinkCrypto.decryptWithHeader(inputBuf, firstKey);
    console.log(outputBuf.toString());
  });

program.parse(process.argv);

if (!process.argv.slice(2).length) {
  program.outputHelp();
}
<|endoftext|>


<commit_before>define(['tokenizer', 'postagger', 'keyphrase_extractor'], function (tokenizer,
  postagger, keyphrase_extractor) {
  var libnlp;

  if (typeof libnlp !== 'undefined') {
    return libnlp;
  }

  libnlp =  {
    tokenizer: tokenizer,
    postagger: postagger,
    keyphrase_extractor: keyphrase_extractor
  };

  return libnlp;
});
<commit_msg>[libnlp] Make loadable via nodejs<commit_after>(function () {
  var makeLibnlp = function (tokenizer, postagger, keyphrase_extractor) {
    return {
      tokenizer: tokenizer,
      postagger: postagger,
      keyphrase_extractor: keyphrase_extractor
    };
  };

  if (typeof define !== 'undefined' && define.amd) {
    define(
      ['tokenizer', 'postagger', 'keyphrase_extractor'],
      function (tokenizer, postagger, keyphrase_extractor) {
        return makeLibnlp(tokenizer, postagger, keyphrase_extractor);
      }
    );
  } else {
    var tokenizer = require('./tokenizer');
    var postagger = require('./postagger');
    var keyphrase_extractor = require('./keyphrase_extractor');
    module.exports = makeLibnlp(tokenizer, postagger, keyphrase_extractor);
  }
})();
<|endoftext|>


<commit_before>// ==UserScript==
// @name        Chatbox++
// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!
// @namespace   the_thrasher@gmail.com
// @include     http://aimgames.forummotion.com/
// @version     1.42
// @grant       none
// @license     MIT License (Expat); opensource.org/licenses/MIT
// ==/UserScript==
// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==// ==UserScript==// @name        Chatbox++// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!// @namespace   the_thrasher@gmail.com// @include     http://aimgames.forummotion.com/// @version     1.42// @grant       none// @license     MIT License (Expat); opensource.org/licenses/MIT// ==/UserScript==var chatboxElement,messages;function msgSender(a){return void 0!==a.getElementsByClassName("user-msg")[0]?a.getElementsByClassName("user-msg")[0].getElementsByClassName("chatbox-username")[0].innerHTML:null}function msgTimestamp(a){return a.getElementsByClassName("date-and-time")[0].innerHTML.substring(1,a.getElementsByClassName("date-and-time")[0].innerHTML.length-1)}function isDubs(a){a=a.substring(6,8);return"11"==a||"22"==a||"33"==a||"44"==a||"55"==a||"66"==a||"77"==a||"88"==a||"99"==a||"00"==a?!0:!1}var oldMessagesAmount;function newMsgs(){return messages.length-oldMessagesAmount}function resetNewMsgs(){oldMessagesAmount=messages.length}function checkDubs(){for(var a=0;a<messages.length;a++)if(isDubs(msgTimestamp(messages[a]))){var b=document.createElement("span");b.style="color: red; text-align: right; display: block; float: right;";b.innerHTML=" CHECK 'EM";messages[a].appendChild(b)}}var boxElement,ribbonElement,ribbonText;function makeBox(){console.log("is at cbox - "+getScrollTop()+" new msgs - "+newMsgs());1400>=getScrollTop()&&(1===newMsgs()?ribbonText.innerHTML="1 new msg":ribbonText.innerHTML=newMsgs()+" new msgs",0<newMsgs()?void 0===boxElement.children[0]&&boxElement.appendChild(ribbonElement):void 0!==boxElement.children[0]&&boxElement.removeChild(ribbonElement))}function remBox(){1400<getScrollTop()&&(resetNewMsgs(),void 0!==boxElement.children[0]&&boxElement.removeChild(ribbonElement))}var ribbonCSS="@import url('http://fonts.googleapis.com/css?family=Noto+Sans:400,700');.box{width: 0px;height: 0px;position: relative;border: 0px solid #BBB;background: #EEE;font-family: 'Noto Sans', sans-serif}.ribbon{width: 200px;background: #e43;position: absolute;top: 0px;left: -10px;text-align: center;line-height: 50px;letter-spacing: 1px;color: #ff0000;font-size: 18px}.ribbon span{width: 200px;background: #e43;position: absolute;top: 25px;left: -50px;text-align: center;line-height: 50px;letter-spacing: 1px;color: #f0f0f0;transform: rotate(-45deg);-webkit-transform: rotate(-45deg);font-size: 18px}.ribbon span::before{content: \"\";position:absolute;left:0px;top:100%;z-index:-1;border-left:3px solid #8F0808;border-right:3px solid transparent;border-bottom:3px solid transparent;border-top:3px solid #8F0808}.ribbon span::after{content:\"\";position:absolute;right:0px;top:100%;z-index:-1;border-left:3px solid transparent;border-right:3px solid #8F0808;border-bottom:3px solid transparent;border-top:3px solid #8F0808}";function injectCSS(a){var b;if(b=document.getElementsByTagName("head")[0]){var c=document.createElement("style");c.type="text/css";c.innerHTML=a;b.appendChild(c)}}function injectCSSURL(a){var b;if(b=document.getElementsByTagName("head")[0]){var c=document.createElement("link");c.rel="stylesheet";c.type="text/css";c.href=a;b.appendChild(c)}}function getScrollTop(){if(void 0!==window.scrollY)return window.scrollY;if("undefined"!==typeof window.pageYOffset)return window.pageYOffset;var a=document.documentElement;return a.clientHeight?a.scrollTop:document.body.scrollTop}function getUserTagsOnDocument(){for(var a=document.getElementsByTagName("a"),b=[],c=0;c<a.length;c++)a[c]&&a[c].href&&a[c].href.match(/\/u/)&&(b[b.length]=a[c]);return b}function getPageContents(a,b,c){var d=new XMLHttpRequest;void 0!==c?(d.open("POST",b,!0),d.setRequestHeader("Content-type","application/x-www-form-urlencoded")):d.open("GET",b,!0);d.onreadystatechange=function(){4==d.readyState&&200==d.status&&a(d.responseText)};d.send(c)}var lastHoveredProfileDetails,tempdoc;function getProfileDetailsCallback(a){tempdoc=document.implementation.createHTMLDocument();tempdoc.body.innerHTML=a;lastHoveredProfileDetails=tempdoc.getElementById("profile-advanced-details")}function getProfileDetails(a){getPageContents(getProfileDetailsCallback,a)}function reorganizeTimestamps(){for(var a=0;a<messages.length;a++){var b=messages[a].children,c=document.createElement("span");c.innerHTML=b[0].innerHTML;c.className="date-and-time";c.style="text-align: right;display:block;float:right;margin-left:10px;";var d=document.createElement("span");d.innerHTML=b[1].innerHTML;d.className="user-msg";messages[a].removeChild(messages[a].firstChild);messages[a].removeChild(messages[a].firstChild);messages[a].appendChild(d);messages[a].appendChild(c)}}function annoyingPrick(){for(var a=0;a<messages.length;a++)try{var b=messages[a].getElementsByClassName("msg")[0].children[0];0<b.children.length?"hoo"!=b.children[0].innerHTML.toLowerCase()&&"cookie"!=b.children[0].innerHTML.toLowerCase()&&"hoo cookie"!=b.children[0].innerHTML.toLowerCase()&&"cookie hoo"!=b.children[0].innerHTML.toLowerCase()||messages[a].parentNode.removeChild(messages[a]):"hoo"!=b.innerHTML.toLowerCase()&&"cookie"!=b.innerHTML.toLowerCase()&&"hoo cookie"!=b.innerHTML.toLowerCase()&&"cookie hoo"!=b.innerHTML.toLowerCase()||messages[a].parentNode.removeChild(messages[a])}catch(c){}}function addRefreshButton(){var a=document.createElement("span");a.innerHTML=" | ";var b=document.createElement("a");b.href="javascript:void(0)";var c=document.createElement("span");c.id="alive-refreshbutton";c.style="";c.onclick="chatbox.refresh()";c.innerHTML="Refresh";b.appendChild(c);c=chatboxFrame.getElementById("chatbox_display_archives");c.appendChild(b);c.appendChild(a)}var prevChatHTML;function checkChatboxChanged(){void 0!==prevChatHTML?chatboxElement.innerHTML!==prevChatHTML&&(annoyingPrick(),checkDubs()):(annoyingPrick(),checkDubs());prevChatHTML=chatboxElement.innerHTML}var chatboxFrame;function go(){null!==document.getElementById("i_logo")&&(document.getElementById("i_logo").src="http://i.imgur.com/LjuijqL.png");if(null!==document.getElementById("frame_chatbox"))chatboxFrame=document.getElementById("frame_chatbox").contentWindow.document,chatboxElement=chatboxFrame.getElementById("chatbox"),messages=chatboxElement.children,oldMessagesAmount=1,boxElement=document.createElement("div"),boxElement.className="box",boxElement.style="position: fixed;left: 1%;top: 2%;",ribbonElement=document.createElement("div"),ribbonElement.className="ribbon",ribbonText=document.createElement("span"),ribbonElement.appendChild(ribbonText),injectCSS(ribbonCSS),document.body.appendChild(boxElement),setInterval(function(){makeBox();checkChatboxChanged()},1E3),window.addEventListener("scroll",function(){remBox();var a=document.getElementById("box"),b=getScrollTop();null!==a&&(a.style.top=28>=b?"30px":b+2+"px")},!1),addRefreshButton();else throw"big chat is not supported by chatbox++, sorry";}window.addEventListener("load",go,!1);<commit_msg>Update chatboxplusplus.compiled.user.js<commit_after>// ==UserScript==
// @name        Chatbox++
// @description Adds a number of 'universal' enhancements for the AIM Games chatbox. Warning: This script is still in active development and may contain bugs!
// @namespace   the_thrasher@gmail.com
// @include     http://aimgames.forummotion.com/
// @version     1.42
// @grant       none
// @license     MIT License (Expat); opensource.org/licenses/MIT
// ==/UserScript==
alert('This script is broken, please switch to Chatbox++ v2');
<|endoftext|>


<commit_before>

var IsIoJS = parseInt(process.version.substr(1)) > 0;
if(IsIoJS){
  module.exports = require('./Source/Main');
} else {
  module.exports = require('./Dist/Main');
}
<commit_msg>:no_entry: Disallow running on normal nodejs<commit_after>

var IsIoJS = parseInt(process.version.substr(1)) > 0;
if(IsIoJS){
  module.exports = require('./Source/Main');
} else {
  throw new Error("Redis-Promise consumes generators so is only supported on io.js");
}
<|endoftext|>