<commit_before>'use strict';
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');
var _ = require('lodash');

module.exports = yeoman.Base.extend({
  init: function () {

  },

  prompting: function () {
    // Have Yeoman greet the user.
    this.log(yosay(
      'Welcome to this fantastic ' + chalk.red('Angular - Seed') + ' generator!'
    ));

    this.log("We will now ask a bunch of questions so that we can scaffold a really nice application for you");
    this.log("")
    var prompts = [
      {
                type: 'checkbox',
                name: 'jslibs',
                message: 'Which JS libraries would you like to include?',
                choices: [
                    {
                        name: 'lodash',
                        value: 'lodash',
                        checked: true
                    },
                    {
                        name: 'Moment.js',
                        value: 'momentjs',
                        checked: true
                    },
                    {
                        name: 'Angular-UI Utils',
                        value: 'angularuiutils',
                        checked: true
                    },
                    {
                        name: 'Highcharts',
                        value: 'highchart',
                        checked: true
                    }
                ]
            },
      //   {
      //   type: 'list',
      //   name: 'type',
      //   message: 'What type of application do you want to create?',
      //   default: 'ng2',
      //   choices: [
      //     {
      //       name: 'Angular2 raw (no core)',
      //       value: 'ng2'
      //     }, {
      //       name: 'Angular2 and Core WebApi',
      //       value: 'webapi_ng2'
      //     }, {
      //       name: 'Angular2 with ASP.Net Core ',
      //       value: 'ng2_core'
      //     }
      //   ]
      // },
      // {
      //   type: 'list',
      //   name: 'ui',
      //   message: 'Which UI framework would you like to use?',
      //   default: 'none',
      //   choices: [
      //      {
      //       name: 'None',
      //       value: 'none'
      //     },{
      //       name: 'Bootstrap (3.3.6)',
      //       value: 'bootstrap'
      //     },
      //     {
      //       name: 'Semantic UI (2.1.8)',
      //       value: 'semantic'
      //     }
      //   ],
      //   // when: function (answers) {
      //   //   return answers.type === 'ng2';
      //   // }

      // },
      {
        name: 'appName',
        message: 'What is your application name?',
        default: "Avento Angular2 App"
      },
      {
        name: 'description',
        message: 'Please give a short description of the app?',
        default: ""
      },
      {
        name: 'port',
        message: 'Please specify the port you want the localhost to use?',
        default: "3000"
      },
      {
        type: 'confirm',
        name: 'downloadModules',
        message: 'Do you want to download node modules now?',
        default: false
      }
    ];

    return this.prompt(prompts).then(function (props) {
      // To access props later use this.props.someAnswer;
      this.props = props;
    }.bind(this));
  },

  writing: function () {
    this._writeNg2App();

    // console.log("writing: ", this.props.type)
    // switch (this.props.type) {

    //   case 'ng2':
    //     this._writeNg2App();
    //     break;
    // }

  },

  install: function () {
    if (this.props.downloadModules) {
      this.installDependencies();
    }

  },

  _writeNg2App: function () {
    var root = "ng2raw/";
    var args = {
      developer: "Hans-Petter Eitvet",
      port: this.props.port,
      appName: this.props.appName,
      appNameKebab: _.kebabCase(this.props.appName),
      version: "1.0.0",
      description: this.props.description
    }

    // root files
    this.fs.copyTpl(this.templatePath(root + '_package.json'), this.destinationPath('package.json'), args);
    this.fs.copy(this.templatePath(root + 'tsconfig.json'), this.destinationPath('tsconfig.json'));
    this.copy(root + 'webpack.config.js', 'webpack.config.js');
    this.copy(root + 'README.md', 'README.md');

    // config
    this.copy(root + 'config/prod.config.js', 'config/prod.config.js');

    // src files
    this.copy(root + 'src/vendor.browser.ts', 'src/vendor.browser.ts');
    this.copy(root + 'src/polyfills.browser.ts', 'src/polyfills.browser.ts');
    this.copy(root + 'src/main.browser.ts', 'src/main.browser.ts');
    this.copy(root + 'src/custom-typings.d.ts', 'src/custom-typings.d.ts');
    this.copy(root + 'src/favicon.ico', 'src/favicon.ico');
    this.fs.copyTpl(this.templatePath(root + 'src/index.html'), this.destinationPath('src/index.html'), args);

    // src/assets files
    this.copy(root + 'src/assets/styles.css', 'src/assets/styles.css');

    // src/app files
    this.copy(root + 'src/app/App.Settings.ts', 'src/app/app.settings.ts');
    this.copy(root + 'src/app/App.routes.ts', 'src/app/app.routes.ts');
    this.copy(root + 'src/app/App.module.ts', 'src/app/app.module.ts');
    this.copy(root + 'src/app/App.component.ts', 'src/app/app.component.ts');
    this.fs.copyTpl(this.templatePath(root + 'src/app/app.component.html'), this.destinationPath('src/app/app.component.html'), args);

    // shared
    this.copy(root + 'src/app/shared/_PageNotFound.ts', 'src/app/shared/page-not-found.ts');

    // core
    this.copy(root + 'src/app/core/rxjs-extensions.ts', 'src/app/core/rxjs-extensions.ts');

    // scr/app/home files
    this.copy(root + 'src/app/home/home.component.html', 'src/app/home/home.component.html');
    this.copy(root + 'src/app/home/home.component.ts', 'src/app/home/home.component.ts');
    this.copy(root + 'src/app/home/home.component.css', 'src/app/home/home.component.css');

  }
});
<commit_msg>added kebab case on _package title<commit_after>'use strict';
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');
var _ = require('lodash');

module.exports = yeoman.Base.extend({
  init: function () {

  },

  prompting: function () {
    // Have Yeoman greet the user.
    this.log(yosay(
      'Welcome to this fantastic ' + chalk.red('Angular - Seed') + ' generator!'
    ));

    this.log("We will now ask a bunch of questions so that we can scaffold a really nice application for you");
    this.log("")
    var prompts = [
      {
                type: 'checkbox',
                name: 'jslibs',
                message: 'Which JS libraries would you like to include?',
                choices: [
                    {
                        name: 'lodash',
                        value: 'lodash',
                        checked: true
                    },
                    {
                        name: 'Moment.js',
                        value: 'momentjs',
                        checked: true
                    },
                    {
                        name: 'Angular-UI Utils',
                        value: 'angularuiutils',
                        checked: true
                    },
                    {
                        name: 'Highcharts',
                        value: 'highchart',
                        checked: true
                    }
                ]
            },
      //   {
      //   type: 'list',
      //   name: 'type',
      //   message: 'What type of application do you want to create?',
      //   default: 'ng2',
      //   choices: [
      //     {
      //       name: 'Angular2 raw (no core)',
      //       value: 'ng2'
      //     }, {
      //       name: 'Angular2 and Core WebApi',
      //       value: 'webapi_ng2'
      //     }, {
      //       name: 'Angular2 with ASP.Net Core ',
      //       value: 'ng2_core'
      //     }
      //   ]
      // },
      // {
      //   type: 'list',
      //   name: 'ui',
      //   message: 'Which UI framework would you like to use?',
      //   default: 'none',
      //   choices: [
      //      {
      //       name: 'None',
      //       value: 'none'
      //     },{
      //       name: 'Bootstrap (3.3.6)',
      //       value: 'bootstrap'
      //     },
      //     {
      //       name: 'Semantic UI (2.1.8)',
      //       value: 'semantic'
      //     }
      //   ],
      //   // when: function (answers) {
      //   //   return answers.type === 'ng2';
      //   // }

      // },
      {
        name: 'appName',
        message: 'What is your application name?',
        default: "Avento Angular2 App"
      },
      {
        name: 'description',
        message: 'Please give a short description of the app?',
        default: ""
      },
      {
        name: 'port',
        message: 'Please specify the port you want the localhost to use?',
        default: "3000"
      },
      {
        type: 'confirm',
        name: 'downloadModules',
        message: 'Do you want to download node modules now?',
        default: false
      }
    ];

    return this.prompt(prompts).then(function (props) {
      // To access props later use this.props.someAnswer;
      this.props = props;
    }.bind(this));
  },

  writing: function () {
    this._writeNg2App();

    // console.log("writing: ", this.props.type)
    // switch (this.props.type) {

    //   case 'ng2':
    //     this._writeNg2App();
    //     break;
    // }

  },

  install: function () {
    if (this.props.downloadModules) {
      this.installDependencies();
    }

  },

  _writeNg2App: function () {
    var root = "ng2raw/";
    var args = {
      developer: "Hans-Petter Eitvet",
      port: this.props.port,
      appName: this.props.appName,
      appNameKebab: _.kebabCase(this.props.appName),
      version: "1.0.0",
      description: this.props.description
    }

    // root files
    this.fs.copyTpl(this.templatePath(root + '_package.json'), this.destinationPath('package.json'), args);
    this.fs.copy(this.templatePath(root + 'tsconfig.json'), this.destinationPath('tsconfig.json'));
    this.copy(root + 'webpack.config.js', 'webpack.config.js');
    this.copy(root + 'README.md', 'README.md');

    // config
    this.copy(root + 'config/prod.config.js', 'config/prod.config.js');

    // src files
    this.copy(root + 'src/vendor.browser.ts', 'src/vendor.browser.ts');
    this.copy(root + 'src/polyfills.browser.ts', 'src/polyfills.browser.ts');
    this.copy(root + 'src/main.browser.ts', 'src/main.browser.ts');
    this.copy(root + 'src/custom-typings.d.ts', 'src/custom-typings.d.ts');
    this.copy(root + 'src/favicon.ico', 'src/favicon.ico');
    this.fs.copyTpl(this.templatePath(root + 'src/index.html'), this.destinationPath('src/index.html'), args);

    // src/assets files
    this.copy(root + 'src/assets/styles.css', 'src/assets/styles.css');

    // src/app files
    this.copy(root + 'src/app/App.Settings.ts', 'src/app/app.settings.ts');
    this.copy(root + 'src/app/App.routes.ts', 'src/app/app.routes.ts');
    this.copy(root + 'src/app/App.module.ts', 'src/app/app.module.ts');
    this.copy(root + 'src/app/App.component.ts', 'src/app/app.component.ts');
    this.fs.copyTpl(this.templatePath(root + 'src/app/app.component.html'), this.destinationPath('src/app/app.component.html'), args);

    // shared
    this.copy(root + 'src/app/shared/_PageNotFound.ts', 'src/app/shared/page-not-found.ts');

    // core
    this.copy(root + 'src/app/core/rxjs-extensions.ts', 'src/app/core/rxjs-extensions.ts');

    // scr/app/home files
    this.copy(root + 'src/app/home/home.component.html', 'src/app/home/home.component.html');
    this.copy(root + 'src/app/home/home.component.ts', 'src/app/home/home.component.ts');
    this.copy(root + 'src/app/home/home.component.css', 'src/app/home/home.component.css');

  }
});
<|endoftext|>


<commit_before>'use strict';
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');
var mkdirp = require('mkdirp');
var _ = require('lodash');
var path = require('path');
var exec = require('child_process').exec;

function createProject(name) {
  name = _.kebabCase(name);
  return name;
}

module.exports = yeoman.Base.extend({
  initializing: function () {
    // Yeoman greets user and outputs version
    this.log(yosay('This is PUNK\'s ' + chalk.blue('custom boilerplate') + ' generator!\n\n'));
    this.props = {};
  },

  prompting: function () {
    var done = this.async();
    this.log('Follow the prompts to get your project started.\n');

    var prompts = [{
      type: 'input',
      name: 'name',
      message: 'Your project name',
      default: createProject(path.basename(process.cwd())),
      filter: createProject,
      validate: function (str) {
        return str.length > 0;
      },
      store: true
    }];

    return this.prompt(prompts).then(function (props) {
      // To access props later use this.props.someAnswer;
      this.props = props;
      this.log('Your project name is', this.props.name, '\n');

      done();
    }.bind(this));
  },

  default: function () {
    if (path.basename(this.destinationPath()) !== this.props.name) {
      this.log('If this directory has not been created I\'ll automatically create one for you. \n');
      mkdirp(this.props.name);
      this.destinationRoot(this.destinationPath(this.props.name));
    }
  },

  scaffolding: function () {
    mkdirp('dev');

    mkdirp('dev/assets');
    mkdirp('dev/assets/css');
    mkdirp('dev/assets/js');
    mkdirp('dev/assets/sass');
    mkdirp('dev/assets/img');
    mkdirp('dev/assets/fonts');

    mkdirp('dev/templates');
    mkdirp('dev/templates/partials');

    this.log('Scaffold created \n');
  },

  writing: function () {
    // copy base template
    this.fs.copy(
      this.templatePath('_index.html'),
      this.destinationPath('dev/templates/index.html')
    );

    this.fs.copy(
      this.templatePath('_header.html'),
      this.destinationPath('dev/templates/partials/header.html')
    );

    this.fs.copy(
      this.templatePath('_footer.html'),
      this.destinationPath('dev/templates/partials/footer.html')
    );

    this.fs.copy(
      this.templatePath('_default.sass'),
      this.destinationPath('dev/assets/sass/default.sass')
    );

    this.fs.copy(
      this.templatePath('_smart.sass'),
      this.destinationPath('dev/assets/sass/smart.sass')
    );

    this.fs.copy(
      this.templatePath('_library.sass'),
      this.destinationPath('dev/assets/sass/_library.sass')
    );

    this.fs.copy(
      this.templatePath('_normalize.sass'),
      this.destinationPath('dev/assets/sass/normalize.sass')
    );

    this.fs.copy(
      this.templatePath('_index.js'),
      this.destinationPath('dev/assets/js/index.js')
    );

    // copy config files
    this.fs.copyTpl(
      this.templatePath('_package.json'),
      this.destinationPath('package.json'), {
        name: this.props.name
      }
    );

    this.fs.copy(
      this.templatePath('_gruntfile.js'),
      this.destinationPath('Gruntfile.js')
    );

    this.fs.copy(
      this.templatePath('_config.js'),
      this.destinationPath('config.js')
    );

    this.fs.copy(
      this.templatePath('_server.js'),
      this.destinationPath('server.js')
    );
  },

  git: function () {
    // Init git
    this.log(chalk.blue('Will reinit git repo if there is an existing one otherwise will init one for you in the newly created project.'));
    // this.spawnCommand('git', ['init']);
    exec('git init');
    exec('touch .gitignore');
  },

  end: function () {
    this.log(chalk.bgGreen('Everything is prepared. Now make sure you have the right node version and run npm install'));
    this.log(yosay('Goodbye! '));
  }
});

<commit_msg>Added Laravel as an option to be generated<commit_after>'use strict';
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');
var mkdirp = require('mkdirp');
var _ = require('lodash');
var path = require('path');
var exec = require('child_process').exec;
var execs = require('child_process').execSync;

function createProject(name) {
  name = _.kebabCase(name);
  return name;
}

function initLaravel(name, context) {
  context.log(chalk.blue('Creating Laravel project via Composer in ' + path.resolve('./' + name)));
  execs('composer create-project laravel/laravel ./' + name, {
    stdio: [0,1,2]
  });
}

module.exports = yeoman.Base.extend({
  initializing: function () {
    // Yeoman greets user and outputs version
    this.log(yosay('This is PUNK\'s ' + chalk.blue('custom boilerplate') + ' generator!\n\n'));
    this.props = {};
  },

  prompting: function () {
    var done = this.async();
    this.log('Follow the prompts to get your project started.\n');

    var prompts = [{
      type: 'input',
      name: 'name',
      message: 'Your project name',
      default: createProject(path.basename(process.cwd())),
      filter: createProject,
      validate: function (str) {
        return str.length > 0;
      },
      store: true
    },{
      type: 'list',
      name: 'backend',
      message: 'Are you generating a static project, or using a framework?',
      filter: function(val) {
        if(val !== '1' && val !== '2') {
          val = '1';
        }

        return val;
      },
      choices: [{
        name: 'Static',
        value: '1'
      },{
        name: 'Laravel',
        value: '2'
      }],
      store: true
    }];

    return this.prompt(prompts).then(function (props) {
      // To access props later use this.props.someAnswer;
      this.props = props;
      this.log('Your project name is', this.props.name, '\n');

      this.props.basedir = path.resolve(process.cwd() + '/' + this.props.name);
      this.log(chalk.green('Project basedir set to: ' + this.props.basedir));

      if(this.props.backend == '2') {
        initLaravel(this.props.name, this);
      }

      done();
    }.bind(this));
  },

  default: function () {
    if (path.basename(this.destinationPath()) !== this.props.name) {
      this.log('If this directory has not been created I\'ll automatically create one for you. \n');
      mkdirp(this.props.name);
      this.destinationRoot(this.destinationPath(this.props.name));
    }
  },

  directories: function() {
    // Static template
    if(this.props.backend === '1') {
      this.props.dir_base = 'dev';
      this.props.dir_assets = 'dev/assets';
      this.props.dir_css = 'dev/assets/css';
      this.props.dir_js = 'dev/assets/js';
      this.props.dir_sass = 'dev/assets/sass';
      this.props.dir_img = 'dev/assets/img';
      this.props.dir_fonts = 'dev/assets/fonts';
      this.props.dir_templates = 'dev/templates';
      this.props.dir_partials = 'dev/templates/partials';
    }
    // Laravel project
    else if(this.props.backend === '2') {
      this.props.dir_base = 'resources';
      this.props.dir_assets = 'resources/assets';
      this.props.dir_css = 'resources/assets/css';
      this.props.dir_js = 'resources/assets/js';
      this.props.dir_sass = 'resources/assets/sass';
      this.props.dir_img = 'public/assets/img';
      this.props.dir_fonts = 'public/assets/fonts';
      this.props.dir_templates = 'resources/views';
      this.props.dir_partials = 'resources/views/partials';
    }
  },

  scaffolding: function () {
    mkdirp(this.props.dir_base);

    mkdirp(this.props.dir_assets);
    mkdirp(this.props.dir_css);
    mkdirp(this.props.dir_js);
    mkdirp(this.props.dir_sass);
    mkdirp(this.props.dir_img);
    mkdirp(this.props.dir_fonts);

    mkdirp(this.props.dir_templates);
    mkdirp(this.props.dir_partials);

    this.log('Scaffold created \n');
  },

  writing: function () {
    // copy base template
    this.fs.copy(
      this.templatePath('_index.html'),
      this.destinationPath(this.props.dir_templates + '/index.html')
    );

    this.fs.copy(
      this.templatePath('_header.html'),
      this.destinationPath(this.props.dir_partials + '/header.html')
    );

    this.fs.copy(
      this.templatePath('_footer.html'),
      this.destinationPath(this.props.dir_partials + '/footer.html')
    );

    this.fs.copy(
      this.templatePath('_default.sass'),
      this.destinationPath(this.props.dir_sass + '/default.sass')
    );

    this.fs.copy(
      this.templatePath('_smart.sass'),
      this.destinationPath(this.props.dir_sass + '/smart.sass')
    );

    this.fs.copy(
      this.templatePath('_library.sass'),
      this.destinationPath(this.props.dir_sass + '/_library.sass')
    );

    this.fs.copy(
      this.templatePath('_normalize.sass'),
      this.destinationPath(this.props.dir_sass + '/normalize.sass')
    );

    this.fs.copy(
      this.templatePath('_index.js'),
      this.destinationPath(this.props.dir_js + '/index.js')
    );

    // copy config files
    this.fs.copyTpl(
      this.templatePath('_package.json'),
      this.destinationPath('package.json'), {
        name: this.props.name
      }
    );

    this.fs.copy(
      this.templatePath('_gruntfile.js'),
      this.destinationPath('Gruntfile.js')
    );

    this.fs.copy(
      this.templatePath('_config.js'),
      this.destinationPath('config.js')
    );

    this.fs.copy(
      this.templatePath('_server.js'),
      this.destinationPath('server.js')
    );
  },

  git: function () {
    // Init git
    this.log(chalk.blue('Will reinit git repo if there is an existing one otherwise will init one for you in the newly created project.'));
    // this.spawnCommand('git', ['init']);
    exec('git init');
    exec('touch .gitignore');
  },

  end: function () {
    this.log(chalk.bgGreen('Everything is prepared. Now make sure you have the right node version and run npm install'));
    this.log(yosay('Goodbye! '));
  }
});
<|endoftext|>


<commit_before>'use strict';

import * as _ from 'lodash'
import * as React from 'react'
import * as humanize from 'humanize-plus'

import {DragDropMixin} from 'react-dnd'
import itemTypes from '../models/itemTypes'
import semesterName from '../helpers/semesterName'

function findSemesterList() {
	return [
		{id: 1, title: 'Fall 2012-13'},
		{id: 2, title: 'Interim 2012-13'},
		{id: 3, title: 'Spring 2012-13'},
	];
}

var ExpandedCourse = React.createClass({
	displayName: 'ExpandedCourse',

	removeFromSemester() {
		this.props.schedule.removeCourse(this.props.info.clbid)
	},

	render() {
		let course = this.props.info;
		let tools = [];

		///////

		let titleText = course.type === 'Topic' ? course.name : course.title;
		let title = React.createElement('h1', {className: 'title'}, titleText)

		let identifier = React.createElement('span',
			{className: 'identifier'},
			course.dept, ' ', course.num, course.sect);

		let professors = React.createElement('span',
			{className: 'professors'},
			humanize.oxford(course.profs));

		let summary = React.createElement('p',
			{className: 'summary'},
			identifier, professors);

		///////

		let offerings = React.createElement('p',
			{className: 'offerings'},
			course.times)

		let gereqs = React.createElement('ul',
			{className: 'gereqs'},
			_.map(course.gereqs, ge => React.createElement('li',
				{key: ge}, ge)))

		let description = React.createElement('p',
			{className: 'description'},
			course.desc)

		let credits = React.createElement('span',
			{className: 'credits'},
			course.credits + ' ' + humanize.pluralize(course.credits, 'credit'))

		let classInstanceOffered = React.createElement('span',
			{className: 'instance'},
			semesterName(course.sem) + ' ' + course.year)

		let info = React.createElement('p',
			{className: 'info'},
			credits, classInstanceOffered)

		let details = React.createElement('div',
			{className: 'details'},
			offerings, gereqs, description, info)

		///////

		let semesterList = React.createElement('select',
			{className: 'semester-select'},
			_.map(findSemesterList(), (s =>
				React.createElement('option', {value: s.id, key: s.id}, s.title))))
		tools.push(semesterList)

		let deleteButton = React.createElement('button',
			{className: 'remove-course', onClick: this.removeFromSemester},
			'Remove Course');
		tools.push(deleteButton)

		let toolsEls = React.createElement('div',
			{className: 'tools', onClick: function(ev) {ev.stopPropagation()}},
			tools)

		///////

		return React.createElement('div', {className: 'info-rows'}, summary, title, details, toolsEls)
	}
})

var CollapsedCourse = React.createClass({
	displayName: 'CollapsedCourse',

	render() {
		let course = this.props.info;

		let titleText = course.type === 'Topic' ? course.name : course.title;
		let title = React.createElement('h1', {className: 'title'}, titleText)

		let identifier = React.createElement('span',
			{className: 'identifier'},
			course.dept, ' ', course.num, course.sect);

		let professors = React.createElement('span',
			{className: 'professors'},
			humanize.oxford(course.profs));

		let summary = React.createElement('p',
			{className: 'summary'},
			identifier, professors);

		return React.createElement('div', {className: 'info-rows'}, title, summary)
	}
})

var Course = React.createClass({
	displayName: 'Course',
	mixins: [DragDropMixin],

	configureDragDrop(registerType) {
		registerType(itemTypes.COURSE, {
			dragSource: {
				beginDrag() {
					return {
						item: {clbid: this.props.info.clbid}
					}
				},
				endDrag(didDrop) {
					if (didDrop) {
						if (this.props.schedule) {
							console.log(
								'removing course', this.props.info.clbid,
								'from', this.props.schedule.id)
							this.props.schedule.removeCourse(this.props.info.clbid)
						}
					}
				}
			}
		})
	},

	getInitialState() {
		return {
			isOpen: false
		}
	},

	toggle() {
		console.log(this.state.isOpen ? 'collapse' : 'expand')
		this.setState({
			isOpen: !this.state.isOpen
		})
	},

	removeFromSemester() {
		this.props.schedule.removeCourse(this.props.info.clbid)
	},

	findWarnings() {
		let thisYear = new Date().getFullYear();
		let warnings = [];

		if (this.props.schedule && (this.props.info.year !== this.props.schedule.year) && this.props.schedule.year <= thisYear) {
			warnings.push({msg: 'This course (from ' + this.props.info.year + ') is not offered in this year (' + this.props.schedule.year + ').'})
		}

		if (this.props.schedule && this.props.info.sem !== this.props.schedule.semester) {
			warnings.push({msg: 'This course (from ' + semesterName(this.props.info.sem) + ') is not offered in this semester.', icon: 'ios7-calendar-outline'})
		}

		if (this.props.conflicts && !_.isUndefined(this.props.index)) {
			let i = this.props.index;
			if (_.any(this.props.conflicts[i])) {
				let conflictIndex = _.findIndex(this.props.conflicts[i], item => item === true)
				conflictIndex = conflictIndex + 1; // because humans don't 0-index lists
				warnings.push({msg: 'This course has a time conflict with the ' + humanize.ordinal(conflictIndex) + ' course.', icon: 'ios7-clock-outline'})
			}
		}

		let warningEls = React.createElement('span',
			{title: _.map(warnings, w => '- ' + w.msg + '\n')},
			_.map(warnings, w => {
				let icon = w.icon ? w.icon : 'alert-circled';
				return React.createElement('i', {className: 'ion-' + icon, key: icon})
			}))

		return React.createElement('div',
			{className: 'warnings'},
			warnings.length ? warningEls : null)
	},

	render() {
		let course = this.props.info;

		let courseInfo = this.state.isOpen ?
			React.createElement(ExpandedCourse, _.extend({}, this.props)) :
			React.createElement(CollapsedCourse, _.extend({}, this.props));

		let warnings = this.findWarnings();

		return React.createElement('article',
			_.extend(
				{
					className: 'course ' + (this.state.isOpen ? 'expanded' : 'collapsed'),
					onClick: this.toggle
				},
				this.dragSourceFor(itemTypes.COURSE)),

			courseInfo, warnings
		);
	}
})

var EmptyCourseSlot = React.createClass({
	displayName: 'EmptyCourseSlot',
	render() {
		let title = 'Empty Slot ' + this.props.index

		let titleEl = React.createElement('h1', {className: 'title'}, title)
		let details = React.createElement('span', {className: 'details'}, 'no details')

		return React.createElement('article', {className: 'course empty'},
			React.createElement('div', {className: 'info-rows'}, titleEl, details));
	}
})

export default Course
export {EmptyCourseSlot}
<commit_msg>Only show the "Remove from Semester" button if there is an associated schedule to be removed from<commit_after>'use strict';

import * as _ from 'lodash'
import * as React from 'react'
import * as humanize from 'humanize-plus'

import {DragDropMixin} from 'react-dnd'
import itemTypes from '../models/itemTypes'
import semesterName from '../helpers/semesterName'

function findSemesterList() {
	return [
		{id: 1, title: 'Fall 2012-13'},
		{id: 2, title: 'Interim 2012-13'},
		{id: 3, title: 'Spring 2012-13'},
	];
}

var ExpandedCourse = React.createClass({
	displayName: 'ExpandedCourse',

	removeFromSemester() {
		this.props.schedule.removeCourse(this.props.info.clbid)
	},

	render() {
		let course = this.props.info;
		let tools = [];

		///////

		let titleText = course.type === 'Topic' ? course.name : course.title;
		let title = React.createElement('h1', {className: 'title'}, titleText)

		let identifier = React.createElement('span',
			{className: 'identifier'},
			course.dept, ' ', course.num, course.sect);

		let professors = React.createElement('span',
			{className: 'professors'},
			humanize.oxford(course.profs));

		let summary = React.createElement('p',
			{className: 'summary'},
			identifier, professors);

		///////

		let offerings = React.createElement('p',
			{className: 'offerings'},
			course.times)

		let gereqs = React.createElement('ul',
			{className: 'gereqs'},
			_.map(course.gereqs, ge => React.createElement('li',
				{key: ge}, ge)))

		let description = React.createElement('p',
			{className: 'description'},
			course.desc)

		let credits = React.createElement('span',
			{className: 'credits'},
			course.credits + ' ' + humanize.pluralize(course.credits, 'credit'))

		let classInstanceOffered = React.createElement('span',
			{className: 'instance'},
			semesterName(course.sem) + ' ' + course.year)

		let info = React.createElement('p',
			{className: 'info'},
			credits, classInstanceOffered)

		let details = React.createElement('div',
			{className: 'details'},
			offerings, gereqs, description, info)

		///////

		let semesterList = React.createElement('select',
			{className: 'semester-select'},
			_.map(findSemesterList(), (s =>
				React.createElement('option', {value: s.id, key: s.id}, s.title))))
		tools.push(semesterList)

		let deleteButton = this.props.schedule ?
			React.createElement('button',
				{className: 'remove-course', onClick: this.removeFromSemester},
				'Remove Course') :
			null;
		tools.push(deleteButton);

		let toolsEls = React.createElement('div',
			{className: 'tools', onClick: function(ev) {ev.stopPropagation()}},
			tools)

		///////

		return React.createElement('div', {className: 'info-rows'}, summary, title, details, toolsEls)
	}
})

var CollapsedCourse = React.createClass({
	displayName: 'CollapsedCourse',

	render() {
		let course = this.props.info;

		let titleText = course.type === 'Topic' ? course.name : course.title;
		let title = React.createElement('h1', {className: 'title'}, titleText)

		let identifier = React.createElement('span',
			{className: 'identifier'},
			course.dept, ' ', course.num, course.sect);

		let professors = React.createElement('span',
			{className: 'professors'},
			humanize.oxford(course.profs));

		let summary = React.createElement('p',
			{className: 'summary'},
			identifier, professors);

		return React.createElement('div', {className: 'info-rows'}, title, summary)
	}
})

var Course = React.createClass({
	displayName: 'Course',
	mixins: [DragDropMixin],

	configureDragDrop(registerType) {
		registerType(itemTypes.COURSE, {
			dragSource: {
				beginDrag() {
					return {
						item: {clbid: this.props.info.clbid}
					}
				},
				endDrag(didDrop) {
					if (didDrop) {
						if (this.props.schedule) {
							console.log(
								'removing course', this.props.info.clbid,
								'from', this.props.schedule.id)
							this.props.schedule.removeCourse(this.props.info.clbid)
						}
					}
				}
			}
		})
	},

	getInitialState() {
		return {
			isOpen: false
		}
	},

	toggle() {
		console.log(this.state.isOpen ? 'collapse' : 'expand')
		this.setState({
			isOpen: !this.state.isOpen
		})
	},

	removeFromSemester() {
		this.props.schedule.removeCourse(this.props.info.clbid)
	},

	findWarnings() {
		let thisYear = new Date().getFullYear();
		let warnings = [];

		if (this.props.schedule && (this.props.info.year !== this.props.schedule.year) && this.props.schedule.year <= thisYear) {
			warnings.push({msg: 'This course (from ' + this.props.info.year + ') is not offered in this year (' + this.props.schedule.year + ').'})
		}

		if (this.props.schedule && this.props.info.sem !== this.props.schedule.semester) {
			warnings.push({msg: 'This course (from ' + semesterName(this.props.info.sem) + ') is not offered in this semester.', icon: 'ios7-calendar-outline'})
		}

		if (this.props.conflicts && !_.isUndefined(this.props.index)) {
			let i = this.props.index;
			if (_.any(this.props.conflicts[i])) {
				let conflictIndex = _.findIndex(this.props.conflicts[i], item => item === true)
				conflictIndex = conflictIndex + 1; // because humans don't 0-index lists
				warnings.push({msg: 'This course has a time conflict with the ' + humanize.ordinal(conflictIndex) + ' course.', icon: 'ios7-clock-outline'})
			}
		}

		let warningEls = React.createElement('span',
			{title: _.map(warnings, w => '- ' + w.msg + '\n')},
			_.map(warnings, w => {
				let icon = w.icon ? w.icon : 'alert-circled';
				return React.createElement('i', {className: 'ion-' + icon, key: icon})
			}))

		return React.createElement('div',
			{className: 'warnings'},
			warnings.length ? warningEls : null)
	},

	render() {
		let course = this.props.info;

		let courseInfo = this.state.isOpen ?
			React.createElement(ExpandedCourse, _.extend({}, this.props)) :
			React.createElement(CollapsedCourse, _.extend({}, this.props));

		let warnings = this.findWarnings();

		return React.createElement('article',
			_.extend(
				{
					className: 'course ' + (this.state.isOpen ? 'expanded' : 'collapsed'),
					onClick: this.toggle
				},
				this.dragSourceFor(itemTypes.COURSE)),

			courseInfo, warnings
		);
	}
})

var EmptyCourseSlot = React.createClass({
	displayName: 'EmptyCourseSlot',
	render() {
		let title = 'Empty Slot ' + this.props.index

		let titleEl = React.createElement('h1', {className: 'title'}, title)
		let details = React.createElement('span', {className: 'details'}, 'no details')

		return React.createElement('article', {className: 'course empty'},
			React.createElement('div', {className: 'info-rows'}, titleEl, details));
	}
})

export default Course
export {EmptyCourseSlot}
<|endoftext|>


<commit_before>// the semi-colon before function invocation is a safety net against concatenated
// scripts and/or other plugins which may not be closed properly.
;(function ( $, window, document, undefined ) {

	"use strict";

	// undefined is used here as the undefined global variable in ECMAScript 3 is
	// mutable (ie. it can be changed by someone else). undefined isn't really being
	// passed in so we can ensure the value of it is truly undefined. In ES5, undefined
	// can no longer be modified.

	// window and document are passed through as local variable rather than global
	// as this (slightly) quickens the resolution process and can be more efficiently
	// minified (especially when both are regularly referenced in your plugin).

  //Some JSHint directives
  /* globals YT, onPlayerStateChange, onPlayerReady */

	// Create the defaults once
	var pluginName = "YoutubeBackgroundPlayer",

	//Player data
	defaults = {
		currentvideo: 0,
		expansionpercent: 50,
		mute: 1,
		overlay: 1,
		videos: [],
		ytbgcontrols: 1,

		//YouTube API player options: https://developers.google.com/youtube/player_parameters?playerVersion=HTML5#Parameters
		autohide: 0,
		autoplay: 1,
		cc_load_policy: 0,
		color: 'red',
		controls: 0,
		disablekb: 1,
		enablejsapi: 1,
		fs: 0,
		iv_load_policy: 3,
		loop: 0,
		modestbranding: 1,
		origin: null,
		playsinline: 0,
		rel: 0,
		showinfo: 0,
		wmode: 'opaque',

		//Image preload list
		images: [
			'http://wiki.famfamfam.googlecode.com/hg/images/control_play_blue.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_play.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_play_blue_faded.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_pause_blue.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_pause.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_pause_blue_faded.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_fastforward_blue.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_fastforward.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_fastforward_blue_faded.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_rewind_blue.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_rewind.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_rewind_blue_faded.png',
		]

	};

	// The actual plugin constructor
	function YoutubeBackgroundPlayer ( element, options ) {
		this.element = element;
		// jQuery has an extend method which merges the contents of two or
		// more objects, storing the result in the first object. The first object
		// is generally empty as we don't want to alter the default options for
		// future instances of the plugin
		this.settings = $.extend( {}, defaults, options );
		this._defaults = defaults;
		this._name = pluginName;

		this.overlay = jQuery('
');
    this.controldiv = jQuery('

');
    jQuery('body').prepend(this.controldiv);
		this.playing = false;
		this.player = null;
		this.currentvideo = this.settings.currentvideo;
		this.videos = this.settings.videos;
		this.ytbgcontrols = null;

		this.init();
	}

	// Avoid Plugin.prototype conflicts
	$.extend(YoutubeBackgroundPlayer.prototype, {
		init: function () {
			// Place initialization logic here
			// You already have access to the DOM element and
			// the options via the instance, e.g. this.element
			// and this.settings
			// you can add more functions like the one below and
			// call them like so: this.yourOtherFunction(this.element, this.settings).

			if(this.settings.overlay) jQuery('#ytbgcontroldiv').append(this.overlay);

      //jQuery('#ytbg').width(jQuery(window).width() + 14);
      //jQuery('#ytbg').height(jQuery(window).height() + 14);
			//this.overlay.remove();

			//Create our custom events to be fired by events from YouTube API
			var _this = this; //need a context closure

			//Register our handling of the YouTube API events into the global functions the API calls
			window.onYouTubeIframeAPIReady = jQuery.proxy(_this.onYouTubeIframeAPIReady, this);
			window.onPlayerReady = jQuery.proxy(_this.onPlayerReady, this);
			window.onPlayerStateChange = jQuery.proxy(_this.onPlayerStateChange, this);

			//Prep the videos array, merging with options
			var videobase = {
				autohide: this.settings.autohide,
				autoplay: this.settings.autoplay,
				cc_load_policy: this.settings.cc_load_policy,
				color: this.settings.color,
				controls: this.settings.controls,
				disablekb: this.settings.disablekb,
				enablejsapi: this.settings.enablejsapi,
				fs: this.settings.fs,
				iv_load_policy: this.settings.iv_load_policy,
				loop: this.settings.loop,
				modestbranding: this.settings.modestbranding,
				origin: this.settings.origin,
				playsinline: this.settings.playsinline,
				rel: this.settings.rel,
				showinfo: this.settings.showinfo,
				wmode: this.settings.wmode
			};

			jQuery.each(this.videos, function(k,v){

				jQuery.extend(v, {videoId: v.video, startSeconds: v.start, endSeconds: v.end}, videobase);

			});

			//Load up the YouTube API asynchronously
			var tag = document.createElement('script');
			tag.src = "https://www.youtube.com/iframe_api";
			var firstScriptTag = document.getElementsByTagName('script')[0];
			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
			var target = jQuery('body');
			//Blatant theft from https://github.com/okfocus/okvideo, to achieve fullscreen background, expand video to push ads offscreen
			var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
			var position = 'fixed';
			target.css({position: 'relative'});
			var zIndex = 9999999999;
			var mask = jQuery('

');
			var overlap = this.settings.expansionpercent/2;
			var size = 100 + this.settings.expansionpercent;
			target.prepend('

');
			mask.css("background-image", "url(" + BLANK_GIF + ")");

			//Load up the player controls, if required
			if(this.settings.ytbgcontrols) {
				this.ytbgcontrols = jQuery('
');
				this.ytbgcontrols.append(jQuery(''));
				this.ytbgcontrols.append(jQuery(''));
				this.ytbgcontrols.append(jQuery(''));
				this.ytbgcontrols.append(jQuery(''));
				jQuery('body').append(this.ytbgcontrols);

        //this.ytbgcontrols.show();

				jQuery('#ytbgcontrols img').hover(function(){
						jQuery(this).prop('src', jQuery(this).prop('src').replace('_blue', ''));
					},function(){
						jQuery(this).prop('src', jQuery(this).prop('src').replace('.png', '_blue.png'));
				});

				jQuery('#ytbgcontrols img').on('mousedown', function(){
					jQuery(this).prop('src', jQuery(this).prop('src').replace('.png', '_blue_faded.png'));
				});

				jQuery('#ytbgcontrols img').on('mouseup', function(){
					jQuery(this).prop('src', jQuery(this).prop('src').replace('_blue_faded', ''));
				});

				jQuery('#ytbgcontrols img').on('click', function(){
					var pattern = /control_.*(_|\.)/ig;
					var str = jQuery(this).prop('src');
					var action = str.match(pattern);
					action = action[0].replace('control','').replace('_','').replace('.','');
					switch(action)
					{
						case 'play' :
							_this.player.playVideo();
							break;
						case 'pause' :
							_this.player.pauseVideo();
							break;
						case 'fastforward' :
							_this.nextVideo();
							break;
						case 'rewind' :
							_this.nextVideo(true);
							break;
					}
				});

			}

		},

		preloadImages: function () {
			jQuery.each(this.images, function(k, v){
				jQuery('')[0].src = v;
			});
		},

		onYouTubeIframeAPIReady: function() {
      jQuery(document).trigger('ytbg:onYouTubeIframeAPIReady');
			this.player = new YT.Player('ytbgplayer', {
				height: '390',
				width: '640',
				videoId: this.videos[this.currentvideo].videoId,
				events: {
					'onReady': onPlayerReady,
					'onStateChange': onPlayerStateChange
				},
				playerVars: this.videos[this.currentvideo],
			});
		},

		onPlayerReady: function(event) {
			if(this.settings.mute) event.target.mute();
			event.target.playVideo();
		},

		onPlayerStateChange: function(event) {

			if(event.data === YT.PlayerState.PLAYING) {
				if(this.settings.overlay) this.overlay.fadeOut(1500);
				if(this.settings.ytbgcontrols && !jQuery(this.ytbgcontrols).is(':visible')) this.ytbgcontrols.fadeIn(1500);
				this.playing = true;
			}

			if(event.data === YT.PlayerState.ENDED) {
				if(this.playing)
				{
					this.playing = false;
					this.nextVideo();
				}
			}

		},

		nextVideo: function(previous) {
			if(this.settings.overlay) this.overlay.fadeIn(500);
			//if(this.settings.ytbgcontrols) this.ytbgcontrols.fadeOut(500);

			if(previous) {
				this.currentvideo--;
				if(this.currentvideo < 0) this.currentvideo = this.videos.length -1;
			}
			else {
				this.currentvideo++;
				if(this.currentvideo >= this.videos.length) this.currentvideo = 0;
			}

			this.player.loadVideoById(this.videos[this.currentvideo]);
		}

	});

	// A really lightweight plugin wrapper around the constructor,
	// preventing against multiple instantiations
	$.fn[ pluginName ] = function ( options ) {
		return this.each(function() {
			if ( !$.data( this, "plugin_" + pluginName ) ) {
				$.data( this, "plugin_" + pluginName, new YoutubeBackgroundPlayer( this, options ) );
			}
		});
	};

})( jQuery, window, document );
<commit_msg>Added a couple more event emissions.<commit_after>// the semi-colon before function invocation is a safety net against concatenated
// scripts and/or other plugins which may not be closed properly.
;(function ( $, window, document, undefined ) {

	"use strict";

	// undefined is used here as the undefined global variable in ECMAScript 3 is
	// mutable (ie. it can be changed by someone else). undefined isn't really being
	// passed in so we can ensure the value of it is truly undefined. In ES5, undefined
	// can no longer be modified.

	// window and document are passed through as local variable rather than global
	// as this (slightly) quickens the resolution process and can be more efficiently
	// minified (especially when both are regularly referenced in your plugin).

  //Some JSHint directives
  /* globals YT, onPlayerStateChange, onPlayerReady */

	// Create the defaults once
	var pluginName = "YoutubeBackgroundPlayer",

	//Player data
	defaults = {
		currentvideo: 0,
		expansionpercent: 50,
		mute: 1,
		overlay: 1,
		videos: [],
		ytbgcontrols: 1,

		//YouTube API player options: https://developers.google.com/youtube/player_parameters?playerVersion=HTML5#Parameters
		autohide: 0,
		autoplay: 1,
		cc_load_policy: 0,
		color: 'red',
		controls: 0,
		disablekb: 1,
		enablejsapi: 1,
		fs: 0,
		iv_load_policy: 3,
		loop: 0,
		modestbranding: 1,
		origin: null,
		playsinline: 0,
		rel: 0,
		showinfo: 0,
		wmode: 'opaque',

		//Image preload list
		images: [
			'http://wiki.famfamfam.googlecode.com/hg/images/control_play_blue.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_play.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_play_blue_faded.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_pause_blue.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_pause.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_pause_blue_faded.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_fastforward_blue.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_fastforward.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_fastforward_blue_faded.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_rewind_blue.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_rewind.png',
			'http://wiki.famfamfam.googlecode.com/hg/images/control_rewind_blue_faded.png',
		]

	};

	// The actual plugin constructor
	function YoutubeBackgroundPlayer ( element, options ) {
		this.element = element;
		// jQuery has an extend method which merges the contents of two or
		// more objects, storing the result in the first object. The first object
		// is generally empty as we don't want to alter the default options for
		// future instances of the plugin
		this.settings = $.extend( {}, defaults, options );
		this._defaults = defaults;
		this._name = pluginName;

		this.overlay = jQuery('
');
    this.controldiv = jQuery('

');
    jQuery('body').prepend(this.controldiv);
		this.playing = false;
		this.player = null;
		this.currentvideo = this.settings.currentvideo;
		this.videos = this.settings.videos;
		this.ytbgcontrols = null;

		this.init();
	}

	// Avoid Plugin.prototype conflicts
	$.extend(YoutubeBackgroundPlayer.prototype, {
		init: function () {
			// Place initialization logic here
			// You already have access to the DOM element and
			// the options via the instance, e.g. this.element
			// and this.settings
			// you can add more functions like the one below and
			// call them like so: this.yourOtherFunction(this.element, this.settings).

			if(this.settings.overlay) jQuery('#ytbgcontroldiv').append(this.overlay);

      //jQuery('#ytbg').width(jQuery(window).width() + 14);
      //jQuery('#ytbg').height(jQuery(window).height() + 14);
			//this.overlay.remove();

			//Create our custom events to be fired by events from YouTube API
			var _this = this; //need a context closure

			//Register our handling of the YouTube API events into the global functions the API calls
			window.onYouTubeIframeAPIReady = jQuery.proxy(_this.onYouTubeIframeAPIReady, this);
			window.onPlayerReady = jQuery.proxy(_this.onPlayerReady, this);
			window.onPlayerStateChange = jQuery.proxy(_this.onPlayerStateChange, this);

			//Prep the videos array, merging with options
			var videobase = {
				autohide: this.settings.autohide,
				autoplay: this.settings.autoplay,
				cc_load_policy: this.settings.cc_load_policy,
				color: this.settings.color,
				controls: this.settings.controls,
				disablekb: this.settings.disablekb,
				enablejsapi: this.settings.enablejsapi,
				fs: this.settings.fs,
				iv_load_policy: this.settings.iv_load_policy,
				loop: this.settings.loop,
				modestbranding: this.settings.modestbranding,
				origin: this.settings.origin,
				playsinline: this.settings.playsinline,
				rel: this.settings.rel,
				showinfo: this.settings.showinfo,
				wmode: this.settings.wmode
			};

			jQuery.each(this.videos, function(k,v){

				jQuery.extend(v, {videoId: v.video, startSeconds: v.start, endSeconds: v.end}, videobase);

			});

			//Load up the YouTube API asynchronously
			var tag = document.createElement('script');
			tag.src = "https://www.youtube.com/iframe_api";
			var firstScriptTag = document.getElementsByTagName('script')[0];
			firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
			var target = jQuery('body');
			//Blatant theft from https://github.com/okfocus/okvideo, to achieve fullscreen background, expand video to push ads offscreen
			var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D";
			var position = 'fixed';
			target.css({position: 'relative'});
			var zIndex = 9999999999;
			var mask = jQuery('

');
			var overlap = this.settings.expansionpercent/2;
			var size = 100 + this.settings.expansionpercent;
			target.prepend('

');
			mask.css("background-image", "url(" + BLANK_GIF + ")");

			//Load up the player controls, if required
			if(this.settings.ytbgcontrols) {
				this.ytbgcontrols = jQuery('
');
				this.ytbgcontrols.append(jQuery(''));
				this.ytbgcontrols.append(jQuery(''));
				this.ytbgcontrols.append(jQuery(''));
				this.ytbgcontrols.append(jQuery(''));
				jQuery('body').append(this.ytbgcontrols);

        //this.ytbgcontrols.show();

				jQuery('#ytbgcontrols img').hover(function(){
						jQuery(this).prop('src', jQuery(this).prop('src').replace('_blue', ''));
					},function(){
						jQuery(this).prop('src', jQuery(this).prop('src').replace('.png', '_blue.png'));
				});

				jQuery('#ytbgcontrols img').on('mousedown', function(){
					jQuery(this).prop('src', jQuery(this).prop('src').replace('.png', '_blue_faded.png'));
				});

				jQuery('#ytbgcontrols img').on('mouseup', function(){
					jQuery(this).prop('src', jQuery(this).prop('src').replace('_blue_faded', ''));
				});

				jQuery('#ytbgcontrols img').on('click', function(){
					var pattern = /control_.*(_|\.)/ig;
					var str = jQuery(this).prop('src');
					var action = str.match(pattern);
					action = action[0].replace('control','').replace('_','').replace('.','');
					switch(action)
					{
						case 'play' :
							_this.player.playVideo();
							break;
						case 'pause' :
							_this.player.pauseVideo();
							break;
						case 'fastforward' :
							_this.nextVideo();
							break;
						case 'rewind' :
							_this.nextVideo(true);
							break;
					}
				});

			}

		},

		preloadImages: function () {
			jQuery.each(this.images, function(k, v){
				jQuery('')[0].src = v;
			});
		},

		onYouTubeIframeAPIReady: function() {
      jQuery(document).trigger('ytbg:onYouTubeIframeAPIReady');
			this.player = new YT.Player('ytbgplayer', {
				height: '390',
				width: '640',
				videoId: this.videos[this.currentvideo].videoId,
				events: {
					'onReady': onPlayerReady,
					'onStateChange': onPlayerStateChange
				},
				playerVars: this.videos[this.currentvideo],
			});
		},

		onPlayerReady: function(event) {
			if(this.settings.mute) event.target.mute();
			event.target.playVideo();
      jQuery(document).trigger('ytbg:startMovie');
		},

		onPlayerStateChange: function(event) {

			if(event.data === YT.PlayerState.PLAYING) {
				if(this.settings.overlay) this.overlay.fadeOut(1500);
				if(this.settings.ytbgcontrols && !jQuery(this.ytbgcontrols).is(':visible')) this.ytbgcontrols.fadeIn(1500);
        jQuery(document).trigger('ytbg:startMovie');
				this.playing = true;
			}

			if(event.data === YT.PlayerState.ENDED) {
				if(this.playing)
				{
					this.playing = false;
          jQuery(document).trigger('ytbg:endMovie');
					this.nextVideo();
				}
			}

		},

		nextVideo: function(previous) {
      jQuery(document).trigger('ytbg:endMovie');
			if(this.settings.overlay) this.overlay.fadeIn(500);
			//if(this.settings.ytbgcontrols) this.ytbgcontrols.fadeOut(500);

			if(previous) {
				this.currentvideo--;
				if(this.currentvideo < 0) this.currentvideo = this.videos.length -1;
			}
			else {
				this.currentvideo++;
				if(this.currentvideo >= this.videos.length) this.currentvideo = 0;
			}

			this.player.loadVideoById(this.videos[this.currentvideo]);
		}

	});

	// A really lightweight plugin wrapper around the constructor,
	// preventing against multiple instantiations
	$.fn[ pluginName ] = function ( options ) {
		return this.each(function() {
			if ( !$.data( this, "plugin_" + pluginName ) ) {
				$.data( this, "plugin_" + pluginName, new YoutubeBackgroundPlayer( this, options ) );
			}
		});
	};

})( jQuery, window, document );
<|endoftext|>


<commit_before>/* by Grexsys, LLC  */

/*   */
/*   */
/*   */
/*   */
/*   */
/*   */
/* =========== Add Commmas =========== */
/* This function adds a comma between first and second digit such as 1,000 and 1,000,000 */
function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}
/* =========== Format Phone Number =========== */
/* This function formats a phone number */
function formatPhone(obj) {
            var numbers = obj.value.replace(/\D/g, ''),
        	char = {0:'(',3:') ',6:' - '};
    		obj.value = '';
    		for (var i = 0; i < numbers.length; i++) {
        	obj.value += (char[i]||'') + numbers[i];
    }
}

/* This function is to create a go back link */
function goBack() {
  window.history.back()
}
/* =========== End go back function =========== */
<commit_msg>A few Changes<commit_after>/* by Grexsys, LLC  */

/*   */
/*   */
/*   */
/*   */
/*   */
/*   */
/* =========== Add Commmas =========== */
/* This function adds a comma between first and second digit such as 1,000 and 1,000,000 */
function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}
/* =========== Format Phone Number =========== */
/* This function formats a phone number */
function formatPhone(obj) {
            var numbers = obj.value.replace(/\D/g, ''),
        	char = {0:'(',3:') ',6:' - '};
    		obj.value = '';
    		for (var i = 0; i < numbers.length; i++) {
        	obj.value += (char[i]||'') + numbers[i];
    }
}

/* This function is to create a go back link */
function goBack() {
  window.history.back()
}
/* =========== End go back function =========== */<|endoftext|>


<commit_before>/**
 * Full HTML5 compatibility rule set
 * These rules define which tags and css classes are supported and which tags should be specially treated.
 *
 * Examples based on this rule set:
 *
 *    foo
 *    ... becomes ...
 *    foo
 *
 *
 *    ... becomes ...
 *
 *
 *
foo

 *    ... becomes ...
 *
foo

 *
 *    <marquee>foo</marquee>
 *    ... becomes ...
 *    foo
 *
 *    foo
 bar
 *    ... becomes ...
 *    foo
 bar
 *
 *
hello

 *    ... becomes ...
 *
hello

 *
 *    hello
 *    ... becomes ...
 *
hello

 */
var wysihtml5ParserRules = {
    /**
     * CSS Class white-list
     * Following css classes won't be removed when parsed by the wysihtml5 html parser
     */
    "classes": {
        "wysiwyg-clear-both": 1,
        "wysiwyg-clear-left": 1,
        "wysiwyg-clear-right": 1,
        "wysiwyg-color-aqua": 1,
        "wysiwyg-color-black": 1,
        "wysiwyg-color-blue": 1,
        "wysiwyg-color-fuchsia": 1,
        "wysiwyg-color-gray": 1,
        "wysiwyg-color-green": 1,
        "wysiwyg-color-lime": 1,
        "wysiwyg-color-maroon": 1,
        "wysiwyg-color-navy": 1,
        "wysiwyg-color-olive": 1,
        "wysiwyg-color-purple": 1,
        "wysiwyg-color-red": 1,
        "wysiwyg-color-silver": 1,
        "wysiwyg-color-teal": 1,
        "wysiwyg-color-white": 1,
        "wysiwyg-color-yellow": 1,
        "wysiwyg-float-left": 1,
        "wysiwyg-float-right": 1,
        "wysiwyg-font-size-large": 1,
        "wysiwyg-font-size-larger": 1,
        "wysiwyg-font-size-medium": 1,
        "wysiwyg-font-size-small": 1,
        "wysiwyg-font-size-smaller": 1,
        "wysiwyg-font-size-x-large": 1,
        "wysiwyg-font-size-x-small": 1,
        "wysiwyg-font-size-xx-large": 1,
        "wysiwyg-font-size-xx-small": 1,
        "wysiwyg-text-align-center": 1,
        "wysiwyg-text-align-justify": 1,
        "wysiwyg-text-align-left": 1,
        "wysiwyg-text-align-right": 1
    },
    /**
     * Tag list
     *
     * Following options are available:
     *
     *    - add_class:        converts and deletes the given HTML4 attribute (align, clear, ...) via the given method to a css class
     *                        The following methods are implemented in wysihtml5.dom.parse:
     *                          - align_text:  converts align attribute values (right/left/center/justify) to their corresponding css class "wysiwyg-text-align-*")

foo
 ... becomes ...
 class="wysiwyg-text-align-center">foo

     *                          - clear_br:    converts clear attribute values left/right/all/both to their corresponding css class "wysiwyg-clear-*"
     *
 ... becomes ...

     *                          - align_img:    converts align attribute values (right/left) on  to their corresponding css class "wysiwyg-float-*"
     *
     *    - remove:             removes the element and it's content
     *
     *    - rename_tag:         renames the element to the given tag
     *
     *    - set_class:          adds the given class to the element (note: make sure that the class is in the "classes" white list above)
     *
     *    - set_attributes:     sets/overrides the given attributes
     *
     *    - check_attributes:   checks the given HTML attribute via the given method
     *                            - url:            allows only valid urls (starting with http:// or https://)
     *                            - src:            allows something like "/foobar.jpg", "http://google.com", ...
     *                            - href:           allows something like "mailto:bert@foo.com", "http://google.com", "/foobar.jpg"
     *                            - alt:            strips unwanted characters. if the attribute is not set, then it gets set (to ensure valid and compatible HTML)
     *                            - numbers:  ensures that the attribute only contains numeric characters
     */
    "tags": {
        "tr": {
            "add_class": {
                "align": "align_text"
            }
        },
        "strike": {
            "remove": 1
        },
        "form": {
            "rename_tag": "div"
        },
        "rt": {
            "rename_tag": "span"
        },
        "code": {},
        "acronym": {
            "rename_tag": "span"
        },
        "br": {
            "add_class": {
                "clear": "clear_br"
            }
        },
        "details": {
            "rename_tag": "div"
        },
        "h4": {
            "add_class": {
                "align": "align_text"
            }
        },
        "em": {},
        "title": {
            "remove": 1
        },
        "multicol": {
            "rename_tag": "div"
        },
        "figure": {
            "rename_tag": "div"
        },
        "xmp": {
            "rename_tag": "span"
        },
        "small": {
            "rename_tag": "span",
            "set_class": "wysiwyg-font-size-smaller"
        },
        "area": {
            "remove": 1
        },
        "time": {
            "rename_tag": "span"
        },
        "dir": {
            "rename_tag": "ul"
        },
        "bdi": {
            "rename_tag": "span"
        },
        "command": {
            "remove": 1
        },
        "ul": {},
        "progress": {
            "rename_tag": "span"
        },
        "dfn": {
            "rename_tag": "span"
        },
        "iframe": {
            "remove": 1
        },
        "figcaption": {
            "rename_tag": "div"
        },
        "a": {
            "check_attributes": {
                "href": "href"
            },
            "set_attributes": {
                "rel": "nofollow",
                "target": "_blank"
            }
        },
        "img": {
            "check_attributes": {
                "width": "numbers",
                "alt": "alt",
                "src": "src",
                "height": "numbers"
            },
            "add_class": {
                "align": "align_img"
            }
        },
        "rb": {
            "rename_tag": "span"
        },
        "footer": {
            "rename_tag": "div"
        },
        "noframes": {
            "remove": 1
        },
        "abbr": {
            "rename_tag": "span"
        },
        "u": {},
        "bgsound": {
            "remove": 1
        },
        "sup": {
            "rename_tag": "span"
        },
        "address": {
            "rename_tag": "div"
        },
        "basefont": {
            "remove": 1
        },
        "nav": {
            "rename_tag": "div"
        },
        "h1": {
            "add_class": {
                "align": "align_text"
            }
        },
        "head": {
            "remove": 1
        },
        "tbody": {
            "add_class": {
                "align": "align_text"
            }
        },
        "dd": {
            "rename_tag": "div"
        },
        "s": {
            "rename_tag": "span"
        },
        "li": {},
        "td": {
            "check_attributes": {
                "rowspan": "numbers",
                "colspan": "numbers"
            },
            "add_class": {
                "align": "align_text"
            }
        },
        "object": {
            "remove": 1
        },
        "div": {
            "add_class": {
                "align": "align_text"
            }
        },
        "option": {
            "rename_tag": "span"
        },
        "select": {
            "rename_tag": "span"
        },
        "i": {},
        "track": {
            "remove": 1
        },
        "wbr": {
            "remove": 1
        },
        "fieldset": {
            "rename_tag": "div"
        },
        "big": {
            "rename_tag": "span",
            "set_class": "wysiwyg-font-size-larger"
        },
        "button": {
            "rename_tag": "span"
        },
        "noscript": {
            "remove": 1
        },
        "svg": {
            "remove": 1
        },
        "input": {
            "remove": 1
        },
        "table": {},
        "keygen": {
            "remove": 1
        },
        "h5": {
            "add_class": {
                "align": "align_text"
            }
        },
        "meta": {
            "remove": 1
        },
        "map": {
            "rename_tag": "div"
        },
        "isindex": {
            "remove": 1
        },
        "mark": {
            "rename_tag": "span"
        },
        "caption": {
            "add_class": {
                "align": "align_text"
            }
        },
        "tfoot": {
            "add_class": {
                "align": "align_text"
            }
        },
        "base": {
            "remove": 1
        },
        "video": {
            "remove": 1
        },
        "strong": {},
        "canvas": {
            "remove": 1
        },
        "output": {
            "rename_tag": "span"
        },
        "marquee": {
            "rename_tag": "span"
        },
        "b": {},
        "q": {
            "check_attributes": {
                "cite": "url"
            }
        },
        "applet": {
            "remove": 1
        },
        "span": {},
        "rp": {
            "rename_tag": "span"
        },
        "spacer": {
            "remove": 1
        },
        "source": {
            "remove": 1
        },
        "aside": {
            "rename_tag": "div"
        },
        "frame": {
            "remove": 1
        },
        "section": {
            "rename_tag": "div"
        },
        "body": {
            "rename_tag": "div"
        },
        "ol": {},
        "nobr": {
            "rename_tag": "span"
        },
        "html": {
            "rename_tag": "div"
        },
        "summary": {
            "rename_tag": "span"
        },
        "var": {
            "rename_tag": "span"
        },
        "del": {
            "remove": 1
        },
        "blockquote": {
            "check_attributes": {
                "cite": "url"
            }
        },
        "style": {
            "remove": 1
        },
        "device": {
            "remove": 1
        },
        "meter": {
            "rename_tag": "span"
        },
        "h3": {
            "add_class": {
                "align": "align_text"
            }
        },
        "textarea": {
            "rename_tag": "span"
        },
        "embed": {
            "remove": 1
        },
        "hgroup": {
            "rename_tag": "div"
        },
        "font": {
            "rename_tag": "span",
            "add_class": {
                "size": "size_font"
            }
        },
        "tt": {
            "rename_tag": "span"
        },
        "noembed": {
            "remove": 1
        },
        "thead": {
            "add_class": {
                "align": "align_text"
            }
        },
        "blink": {
            "rename_tag": "span"
        },
        "plaintext": {
            "rename_tag": "span"
        },
        "xml": {
            "remove": 1
        },
        "h6": {
            "add_class": {
                "align": "align_text"
            }
        },
        "param": {
            "remove": 1
        },
        "th": {
            "check_attributes": {
                "rowspan": "numbers",
                "colspan": "numbers"
            },
            "add_class": {
                "align": "align_text"
            }
        },
        "legend": {
            "rename_tag": "span"
        },
        "hr": {},
        "label": {
            "rename_tag": "span"
        },
        "dl": {
            "rename_tag": "div"
        },
        "kbd": {
            "rename_tag": "span"
        },
        "listing": {
            "rename_tag": "div"
        },
        "dt": {
            "rename_tag": "span"
        },
        "nextid": {
            "remove": 1
        },
        "pre": {},
        "center": {
            "rename_tag": "div",
            "set_class": "wysiwyg-text-align-center"
        },
        "audio": {
            "remove": 1
        },
        "datalist": {
            "rename_tag": "span"
        },
        "samp": {
            "rename_tag": "span"
        },
        "col": {
            "remove": 1
        },
        "article": {
            "rename_tag": "div"
        },
        "cite": {},
        "link": {
            "remove": 1
        },
        "script": {
            "remove": 1
        },
        "bdo": {
            "rename_tag": "span"
        },
        "menu": {
            "rename_tag": "ul"
        },
        "colgroup": {
            "remove": 1
        },
        "ruby": {
            "rename_tag": "span"
        },
        "h2": {
            "add_class": {
                "align": "align_text"
            }
        },
        "ins": {
            "rename_tag": "span"
        },
        "p": {
            "add_class": {
                "align": "align_text"
            }
        },
        "sub": {
            "rename_tag": "span"
        },
        "comment": {
            "remove": 1
        },
        "frameset": {
            "remove": 1
        },
        "optgroup": {
            "rename_tag": "span"
        },
        "header": {
            "rename_tag": "div"
        }
    }
};<commit_msg>Correct some typos<commit_after>/**
 * Full HTML5 compatibility rule set
 * These rules define which tags and CSS classes are supported and which tags should be specially treated.
 *
 * Examples based on this rule set:
 *
 *    foo
 *    ... becomes ...
 *    foo
 *
 *
 *    ... becomes ...
 *
 *
 *
foo

 *    ... becomes ...
 *
foo

 *
 *    <marquee>foo</marquee>
 *    ... becomes ...
 *    foo
 *
 *    foo
 bar
 *    ... becomes ...
 *    foo
 bar
 *
 *
hello

 *    ... becomes ...
 *
hello

 *
 *    hello
 *    ... becomes ...
 *
hello

 */
var wysihtml5ParserRules = {
    /**
     * CSS Class white-list
     * Following CSS classes won't be removed when parsed by the wysihtml5 HTML parser
     */
    "classes": {
        "wysiwyg-clear-both": 1,
        "wysiwyg-clear-left": 1,
        "wysiwyg-clear-right": 1,
        "wysiwyg-color-aqua": 1,
        "wysiwyg-color-black": 1,
        "wysiwyg-color-blue": 1,
        "wysiwyg-color-fuchsia": 1,
        "wysiwyg-color-gray": 1,
        "wysiwyg-color-green": 1,
        "wysiwyg-color-lime": 1,
        "wysiwyg-color-maroon": 1,
        "wysiwyg-color-navy": 1,
        "wysiwyg-color-olive": 1,
        "wysiwyg-color-purple": 1,
        "wysiwyg-color-red": 1,
        "wysiwyg-color-silver": 1,
        "wysiwyg-color-teal": 1,
        "wysiwyg-color-white": 1,
        "wysiwyg-color-yellow": 1,
        "wysiwyg-float-left": 1,
        "wysiwyg-float-right": 1,
        "wysiwyg-font-size-large": 1,
        "wysiwyg-font-size-larger": 1,
        "wysiwyg-font-size-medium": 1,
        "wysiwyg-font-size-small": 1,
        "wysiwyg-font-size-smaller": 1,
        "wysiwyg-font-size-x-large": 1,
        "wysiwyg-font-size-x-small": 1,
        "wysiwyg-font-size-xx-large": 1,
        "wysiwyg-font-size-xx-small": 1,
        "wysiwyg-text-align-center": 1,
        "wysiwyg-text-align-justify": 1,
        "wysiwyg-text-align-left": 1,
        "wysiwyg-text-align-right": 1
    },
    /**
     * Tag list
     *
     * The following options are available:
     *
     *    - add_class:        converts and deletes the given HTML4 attribute (align, clear, ...) via the given method to a css class
     *                        The following methods are implemented in wysihtml5.dom.parse:
     *                          - align_text:  converts align attribute values (right/left/center/justify) to their corresponding css class "wysiwyg-text-align-*")
     *
foo
 ... becomes ...
 class="wysiwyg-text-align-center">foo

     *                          - clear_br:    converts clear attribute values left/right/all/both to their corresponding css class "wysiwyg-clear-*"
     *
 ... becomes ...

     *                          - align_img:    converts align attribute values (right/left) on  to their corresponding css class "wysiwyg-float-*"
     *
     *    - remove:             removes the element and its content
     *
     *    - rename_tag:         renames the element to the given tag
     *
     *    - set_class:          adds the given class to the element (note: make sure that the class is in the "classes" white list above)
     *
     *    - set_attributes:     sets/overrides the given attributes
     *
     *    - check_attributes:   checks the given HTML attribute via the given method
     *                            - url:            allows only valid urls (starting with http:// or https://)
     *                            - src:            allows something like "/foobar.jpg", "http://google.com", ...
     *                            - href:           allows something like "mailto:bert@foo.com", "http://google.com", "/foobar.jpg"
     *                            - alt:            strips unwanted characters. if the attribute is not set, then it gets set (to ensure valid and compatible HTML)
     *                            - numbers:  ensures that the attribute only contains numeric characters
     */
    "tags": {
        "tr": {
            "add_class": {
                "align": "align_text"
            }
        },
        "strike": {
            "remove": 1
        },
        "form": {
            "rename_tag": "div"
        },
        "rt": {
            "rename_tag": "span"
        },
        "code": {},
        "acronym": {
            "rename_tag": "span"
        },
        "br": {
            "add_class": {
                "clear": "clear_br"
            }
        },
        "details": {
            "rename_tag": "div"
        },
        "h4": {
            "add_class": {
                "align": "align_text"
            }
        },
        "em": {},
        "title": {
            "remove": 1
        },
        "multicol": {
            "rename_tag": "div"
        },
        "figure": {
            "rename_tag": "div"
        },
        "xmp": {
            "rename_tag": "span"
        },
        "small": {
            "rename_tag": "span",
            "set_class": "wysiwyg-font-size-smaller"
        },
        "area": {
            "remove": 1
        },
        "time": {
            "rename_tag": "span"
        },
        "dir": {
            "rename_tag": "ul"
        },
        "bdi": {
            "rename_tag": "span"
        },
        "command": {
            "remove": 1
        },
        "ul": {},
        "progress": {
            "rename_tag": "span"
        },
        "dfn": {
            "rename_tag": "span"
        },
        "iframe": {
            "remove": 1
        },
        "figcaption": {
            "rename_tag": "div"
        },
        "a": {
            "check_attributes": {
                "href": "href"
            },
            "set_attributes": {
                "rel": "nofollow",
                "target": "_blank"
            }
        },
        "img": {
            "check_attributes": {
                "width": "numbers",
                "alt": "alt",
                "src": "src",
                "height": "numbers"
            },
            "add_class": {
                "align": "align_img"
            }
        },
        "rb": {
            "rename_tag": "span"
        },
        "footer": {
            "rename_tag": "div"
        },
        "noframes": {
            "remove": 1
        },
        "abbr": {
            "rename_tag": "span"
        },
        "u": {},
        "bgsound": {
            "remove": 1
        },
        "sup": {
            "rename_tag": "span"
        },
        "address": {
            "rename_tag": "div"
        },
        "basefont": {
            "remove": 1
        },
        "nav": {
            "rename_tag": "div"
        },
        "h1": {
            "add_class": {
                "align": "align_text"
            }
        },
        "head": {
            "remove": 1
        },
        "tbody": {
            "add_class": {
                "align": "align_text"
            }
        },
        "dd": {
            "rename_tag": "div"
        },
        "s": {
            "rename_tag": "span"
        },
        "li": {},
        "td": {
            "check_attributes": {
                "rowspan": "numbers",
                "colspan": "numbers"
            },
            "add_class": {
                "align": "align_text"
            }
        },
        "object": {
            "remove": 1
        },
        "div": {
            "add_class": {
                "align": "align_text"
            }
        },
        "option": {
            "rename_tag": "span"
        },
        "select": {
            "rename_tag": "span"
        },
        "i": {},
        "track": {
            "remove": 1
        },
        "wbr": {
            "remove": 1
        },
        "fieldset": {
            "rename_tag": "div"
        },
        "big": {
            "rename_tag": "span",
            "set_class": "wysiwyg-font-size-larger"
        },
        "button": {
            "rename_tag": "span"
        },
        "noscript": {
            "remove": 1
        },
        "svg": {
            "remove": 1
        },
        "input": {
            "remove": 1
        },
        "table": {},
        "keygen": {
            "remove": 1
        },
        "h5": {
            "add_class": {
                "align": "align_text"
            }
        },
        "meta": {
            "remove": 1
        },
        "map": {
            "rename_tag": "div"
        },
        "isindex": {
            "remove": 1
        },
        "mark": {
            "rename_tag": "span"
        },
        "caption": {
            "add_class": {
                "align": "align_text"
            }
        },
        "tfoot": {
            "add_class": {
                "align": "align_text"
            }
        },
        "base": {
            "remove": 1
        },
        "video": {
            "remove": 1
        },
        "strong": {},
        "canvas": {
            "remove": 1
        },
        "output": {
            "rename_tag": "span"
        },
        "marquee": {
            "rename_tag": "span"
        },
        "b": {},
        "q": {
            "check_attributes": {
                "cite": "url"
            }
        },
        "applet": {
            "remove": 1
        },
        "span": {},
        "rp": {
            "rename_tag": "span"
        },
        "spacer": {
            "remove": 1
        },
        "source": {
            "remove": 1
        },
        "aside": {
            "rename_tag": "div"
        },
        "frame": {
            "remove": 1
        },
        "section": {
            "rename_tag": "div"
        },
        "body": {
            "rename_tag": "div"
        },
        "ol": {},
        "nobr": {
            "rename_tag": "span"
        },
        "html": {
            "rename_tag": "div"
        },
        "summary": {
            "rename_tag": "span"
        },
        "var": {
            "rename_tag": "span"
        },
        "del": {
            "remove": 1
        },
        "blockquote": {
            "check_attributes": {
                "cite": "url"
            }
        },
        "style": {
            "remove": 1
        },
        "device": {
            "remove": 1
        },
        "meter": {
            "rename_tag": "span"
        },
        "h3": {
            "add_class": {
                "align": "align_text"
            }
        },
        "textarea": {
            "rename_tag": "span"
        },
        "embed": {
            "remove": 1
        },
        "hgroup": {
            "rename_tag": "div"
        },
        "font": {
            "rename_tag": "span",
            "add_class": {
                "size": "size_font"
            }
        },
        "tt": {
            "rename_tag": "span"
        },
        "noembed": {
            "remove": 1
        },
        "thead": {
            "add_class": {
                "align": "align_text"
            }
        },
        "blink": {
            "rename_tag": "span"
        },
        "plaintext": {
            "rename_tag": "span"
        },
        "xml": {
            "remove": 1
        },
        "h6": {
            "add_class": {
                "align": "align_text"
            }
        },
        "param": {
            "remove": 1
        },
        "th": {
            "check_attributes": {
                "rowspan": "numbers",
                "colspan": "numbers"
            },
            "add_class": {
                "align": "align_text"
            }
        },
        "legend": {
            "rename_tag": "span"
        },
        "hr": {},
        "label": {
            "rename_tag": "span"
        },
        "dl": {
            "rename_tag": "div"
        },
        "kbd": {
            "rename_tag": "span"
        },
        "listing": {
            "rename_tag": "div"
        },
        "dt": {
            "rename_tag": "span"
        },
        "nextid": {
            "remove": 1
        },
        "pre": {},
        "center": {
            "rename_tag": "div",
            "set_class": "wysiwyg-text-align-center"
        },
        "audio": {
            "remove": 1
        },
        "datalist": {
            "rename_tag": "span"
        },
        "samp": {
            "rename_tag": "span"
        },
        "col": {
            "remove": 1
        },
        "article": {
            "rename_tag": "div"
        },
        "cite": {},
        "link": {
            "remove": 1
        },
        "script": {
            "remove": 1
        },
        "bdo": {
            "rename_tag": "span"
        },
        "menu": {
            "rename_tag": "ul"
        },
        "colgroup": {
            "remove": 1
        },
        "ruby": {
            "rename_tag": "span"
        },
        "h2": {
            "add_class": {
                "align": "align_text"
            }
        },
        "ins": {
            "rename_tag": "span"
        },
        "p": {
            "add_class": {
                "align": "align_text"
            }
        },
        "sub": {
            "rename_tag": "span"
        },
        "comment": {
            "remove": 1
        },
        "frameset": {
            "remove": 1
        },
        "optgroup": {
            "rename_tag": "span"
        },
        "header": {
            "rename_tag": "div"
        }
    }
};<|endoftext|>


<commit_before>var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var BUILD_DIR = path.resolve(__dirname, 'build');
var APP_DIR = path.resolve(__dirname, 'src');

module.exports = {
	entry: {
		main: './src/main.js',
		app: ['./src/app.ts']
	},
	target: 'electron',
	output: {
		path: __dirname + '/build',
		filename: '[name].js'
	},
	resolve: {
		extensions: ['', '.web.js', '.ts', '.tsx', '.js']
	},
	module: {
		loaders: [
			{ test: /\.tsx?$/, loader: 'ts-loader' }
		]
	},
	node: {
		__dirname: false,
		__filename: false
    },
	plugins: [
		new HtmlWebpackPlugin({
			title: 'Gluon',
			filename: 'index.html',
			template: 'src/index-template.html'
		})
	]
};<commit_msg>Updated webpack config to exclude main chunk.<commit_after>var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var BUILD_DIR = path.resolve(__dirname, 'build');
var APP_DIR = path.resolve(__dirname, 'src');

module.exports = {
	entry: {
		main: APP_DIR + '/main.js',
		app: [ APP_DIR + '/app.ts']
	},
	target: 'electron',
	output: {
		path: __dirname + '/build',
		filename: '[name].js'
	},
	resolve: {
		extensions: ['', '.web.js', '.ts', '.tsx', '.js']
	},
	module: {
		loaders: [
			{ test: /\.tsx?$/, loader: 'ts-loader' }
		]
	},
	node: {
		__dirname: false,
		__filename: false
    },
	plugins: [
		new HtmlWebpackPlugin({
			title: 'Gluon',
			excludeChunks: ['main'],
			filename: 'index.html',
			template: APP_DIR + '/index-template.html'
		})
	]
};<|endoftext|>