<commit_before>export default ({
  host: 'http://realty.kipr.ru',

  formActionUrls: {
    rentShort: '/rent/search/results',
    rentLong: '/long-term-rentals/search/results',
    sale: '/sale/search/results'
  },

  sendQueryPath: '/realty_requests/new',

  paramGetPrefixRent: 'rent_search_form',
  paramGetPrefixSale: 'sale_search_form',

  getParams: {
    duration: {
      name: 'availability_category',
      title: 'Вариант поиска',
      values: [
        { title: 'Аренда', value: 'short_rent' },
        { title: 'Год и более', value: 'long_rent' },
        { title: 'Покупка', value: 'sale' }
      ]
    },

    bedrooms: {
      name: 'bedrooms',
      title: 'Спальни',
      values: [
        { title: 'Не важно', value: '' },
        { title: '1', value: 1 },
        { title: '2', value: 2 },
        { title: '3', value: 3 },
        { title: '4', value: 4 },
        { title: '5', value: 5 },
        { title: '6', value: 6 }
      ]
    },

    beds: {
      name: 'sleeps_max',
      title: 'Спальных мест',
      values: [
        { title: 'Не важно', value: '' },
        { title: '1', value: 1 },
        { title: '2', value: 2 },
        { title: '3', value: 3 },
        { title: '4', value: 4 },
        { title: '5', value: 5 },
        { title: '6', value: 6 },
        { title: '7', value: 7 },
        { title: '8', value: 8 },
        { title: '9', value: 9 },
        { title: '10', value: 10 },
        { title: '11', value: 11 },
        { title: '12', value: 12 },
        { title: '13', value: 13 },
        { title: '14', value: 14 },
        { title: '15', value: 15 }
      ]
    },

    checkInDate: {
      name: 'check_in_date',
      title: 'Дата заезда'
    },

    realtyType: {
      name: 'variant_id',
      title: 'Тип недвижимости',
      values: [
        { title: 'Апартаменты', value: 1292 },
        { title: 'Вилла', value: 1285 },
        { title: 'Мезонет', value: 1299 },
        { title: 'Смежный дом', value: 1286 }
      ],
      valuesSale: [
        { title: 'Бунгало', value: 1283 },
        { title: 'Земельные участки', value: 1217 }
      ]
    },

    region: {
      name: 'region_geo_id',
      title: 'Регион',
      values: [
        { title: 'Все варианты', value: '' },
        { title: 'Айа-Напа', value: 280 },
        { title: 'Ларнака', value: 281 },
        { title: 'Лимассол', value: 282 },
        { title: 'Никосия', value: 288 },
        { title: 'Паралимни', value: 286 },
        { title: 'Пафос', value: 283 },
        { title: 'Полис', value: 284 },
        { title: 'Протарас', value: 285 },
        { title: 'Троодос', value: 287 }
      ]
    },

    daysCount: {
      name: 'days_count',
      title: 'Дней отдыха',
      values: [
        { title: 'Не важно', value: '' },
        { title: '3 дня', value: 3 },
        { title: '4 дня', value: 4 },
        { title: '5 дней', value: 5 },
        { title: '6 дней', value: 6 },
        { title: '7 дней', value: 7 },
        { title: '8 дней', value: 8 },
        { title: '9 дней', value: 9 },
        { title: '10 дней', value: 10 },
        { title: '11 дней', value: 11 },
        { title: '12 дней', value: 12 },
        { title: '13 дней', value: 13 },
        { title: '14 дней', value: 14 },
        { title: '15 дней', value: 15 },
        { title: '16 дней', value: 16 },
        { title: '17 дней', value: 17 },
        { title: '18 дней', value: 18 },
        { title: '19 дней', value: 19 },
        { title: '20 дней', value: 20 },
        { title: '21 день', value: 21 },
        { title: '22 дня', value: 22 },
        { title: '23 дня', value: 23 },
        { title: '24 дня', value: 24 },
        { title: '25 дней', value: 25 },
        { title: '26 дней', value: 26 },
        { title: '27 дней', value: 27 },
        { title: '28 дней', value: 28 },
        { title: '29 дней', value: 29 },
        { title: '30 дней', value: 30 },
        { title: '1 месяц', value: 30 },
        { title: '1,5 месяца', value: 45 },
        { title: '2 месяца', value: 60 },
        { title: '2,5 месяца', value: 75 },
        { title: '3 месяца', value: 90 }
      ]
    }
  }
});
<commit_msg>Typo fixed.<commit_after>export default ({
  host: 'http://realty.kipr.ru',

  formActionUrls: {
    rentShort: '/rent/search/results',
    rentLong: '/long-term-rentals/search/results',
    sale: '/sale/search/results'
  },

  sendQueryPath: '/realty_requests/new',

  paramGetPrefixRent: 'rent_search_form',
  paramGetPrefixSale: 'sale_search_form',

  getParams: {
    duration: {
      name: 'availability_category',
      title: 'Вариант поиска',
      values: [
        { title: 'Арендовать', value: 'short_rent' },
        { title: 'Аренда от года', value: 'long_rent' },
        { title: 'Покупка', value: 'sale' }
      ]
    },

    bedrooms: {
      name: 'bedrooms',
      title: 'Спальни',
      values: [
        { title: 'Не важно', value: '' },
        { title: '1', value: 1 },
        { title: '2', value: 2 },
        { title: '3', value: 3 },
        { title: '4', value: 4 },
        { title: '5', value: 5 },
        { title: '6', value: 6 }
      ]
    },

    beds: {
      name: 'sleeps_max',
      title: 'Спальных мест',
      values: [
        { title: 'Не важно', value: '' },
        { title: '1', value: 1 },
        { title: '2', value: 2 },
        { title: '3', value: 3 },
        { title: '4', value: 4 },
        { title: '5', value: 5 },
        { title: '6', value: 6 },
        { title: '7', value: 7 },
        { title: '8', value: 8 },
        { title: '9', value: 9 },
        { title: '10', value: 10 },
        { title: '11', value: 11 },
        { title: '12', value: 12 },
        { title: '13', value: 13 },
        { title: '14', value: 14 },
        { title: '15', value: 15 }
      ]
    },

    checkInDate: {
      name: 'check_in_date',
      title: 'Дата заезда'
    },

    realtyType: {
      name: 'variant_id',
      title: 'Тип недвижимости',
      values: [
        { title: 'Апартаменты', value: 1292 },
        { title: 'Вилла', value: 1285 },
        { title: 'Мезонет', value: 1299 },
        { title: 'Смежный дом', value: 1286 }
      ],
      valuesSale: [
        { title: 'Бунгало', value: 1283 },
        { title: 'Земельные участки', value: 1217 }
      ]
    },

    region: {
      name: 'region_geo_id',
      title: 'Регион',
      values: [
        { title: 'Все варианты', value: '' },
        { title: 'Айа-Напа', value: 280 },
        { title: 'Ларнака', value: 281 },
        { title: 'Лимассол', value: 282 },
        { title: 'Никосия', value: 288 },
        { title: 'Паралимни', value: 286 },
        { title: 'Пафос', value: 283 },
        { title: 'Полис', value: 284 },
        { title: 'Протарас', value: 285 },
        { title: 'Троодос', value: 287 }
      ]
    },

    daysCount: {
      name: 'days_count',
      title: 'Дней отдыха',
      values: [
        { title: 'Не важно', value: '' },
        { title: '3 дня', value: 3 },
        { title: '4 дня', value: 4 },
        { title: '5 дней', value: 5 },
        { title: '6 дней', value: 6 },
        { title: '7 дней', value: 7 },
        { title: '8 дней', value: 8 },
        { title: '9 дней', value: 9 },
        { title: '10 дней', value: 10 },
        { title: '11 дней', value: 11 },
        { title: '12 дней', value: 12 },
        { title: '13 дней', value: 13 },
        { title: '14 дней', value: 14 },
        { title: '15 дней', value: 15 },
        { title: '16 дней', value: 16 },
        { title: '17 дней', value: 17 },
        { title: '18 дней', value: 18 },
        { title: '19 дней', value: 19 },
        { title: '20 дней', value: 20 },
        { title: '21 день', value: 21 },
        { title: '22 дня', value: 22 },
        { title: '23 дня', value: 23 },
        { title: '24 дня', value: 24 },
        { title: '25 дней', value: 25 },
        { title: '26 дней', value: 26 },
        { title: '27 дней', value: 27 },
        { title: '28 дней', value: 28 },
        { title: '29 дней', value: 29 },
        { title: '30 дней', value: 30 },
        { title: '1 месяц', value: 30 },
        { title: '1,5 месяца', value: 45 },
        { title: '2 месяца', value: 60 },
        { title: '2,5 месяца', value: 75 },
        { title: '3 месяца', value: 90 }
      ]
    }
  }
});
<|endoftext|>


<commit_before>'use strict';

/**
 * Fetch command line arguments
 */
const argv = (() => {
  let tba = null;
  return process.argv.reduce((options, arg) => {
    if (arg.startsWith('--')) {
      tba = arg.replace(/^--/, '');
      options[tba] = true;
    } else {
      if (tba) {
        options[tba] = arg;
      }
      tba = null;
    }
    return options;
  }, {});
})();

/**
 * Core configuration details.
 */
let baseConfig = {

  /**
   * Default configuration schema.
   *
   * A schema element describes a configuration parameter.
   * argName and/or default will be used if set to source the value for a parameter.
   *
   * Example Schema:
   *
   FOO: {
      argName:     '--foo',         // Command line arg name
      description: 'Foo Parameter', // Description
      default:     'foo value'      // Default value
      alias:       'foo'            // Alias (this parameter can be mapped to another name)
                                    // Useful to support different naming styles
    },
   *
   */
  schema : {
    PROJECT:             { description: 'ACS Project Name',                        alias: 'project'           },
    PROJECT_VERSION:     { description: 'ACS Project Version (e.g. poc, mvp1)',    alias: 'projectVersion'    },
    PROJECT_PREFIX:      { description: 'ACS Project Prefix',                      alias: 'projectPrefix'     },
    API_PACKAGE_PREFIX:  { description: 'API Package Prefix',  default: 'api-',    alias: 'apiPackagePrefix'  },
    API_PACKAGE_VERSION: { description: 'API Package Version', default: '0.0.1',   alias: 'apiPackageVersion' },
    AWS_PROFILE:         { description: 'AWS Profile',         argName: 'profile', alias: 'awsProfile'        },
    AWS_REGION:          { description: 'AWS Region',          argName: 'region',  alias: 'awsRegion'         },
    ENVIRONMENT_STAGE:   { description: 'Environment stage',   argName: 'env',     alias: 'environmentStage'  },
    ORGANIZATION:        { description: 'Organization Tag',    argName: 'org',     alias: 'organization'      },
    TENANT:              { description: 'Tenant',              argName: 'tenant',  alias: 'tenant'            }
  },

  /**
   * Initialize configuration.
   * @param configuration configuration setup for this session
   */
  init : (configuration) => {
    if (configuration.config) { Object.assign(baseConfig, configuration.config); }
    if (configuration.schema) { Object.assign(baseConfig.schema, configuration.schema); }
  },

  /**
   * Prime AWS environment and return AWS object.
   */
  get AWS() {
    process.env.AWS_PROFILE = config.AWS_PROFILE;
    process.env.AWS_REGION = config.AWS_REGION;

    delete this.AWS;
    this.AWS = require('aws-sdk');

    this.AWS.config.maxRetries = 7;
    this.AWS.retryDelayOptions = {base: Math.random() * (3000 - 900) + 900};

    return this.AWS;
  },

  /**
   * Get a logger for this session. Sets up a bunyan logger is not already set.
   */
  get logger() {
    // If logger not specified use bunyan by default
    let bunyan = require('bunyan');
    let PrettyStream = require('bunyan-prettystream');

    let prettyStdOut = new PrettyStream(); prettyStdOut.pipe(process.stdout);
    let prettyStdErr = new PrettyStream(); prettyStdErr.pipe(process.stderr);
    let name = config.PROJECT_PREFIX.slice(0, -1);

    delete this.logger;
    return this.logger = bunyan.createLogger({
      name: name,
      streams: [{
        level: 'debug',
        type: 'raw',
        stream: prettyStdOut,
        reemitErrorEvents: true
      }]
    });
  },
  set logger(logger) {
    delete this.logger;
    this.logger = logger;
  },

  /**
   * Get the name of a core resource with the given suffix
   * @param suffix
   * @return {*}
   */
  getResourceName : (suffix) => {
    return config.getResourcePrefix() + suffix;
  },

  /**
   * Get the prefix for all core resources
   * @return {string}
   */
  getResourcePrefix : () => {
    return config.PROJECT_PREFIX + config.ENVIRONMENT_STAGE + '-';
  },

  /**
   * Get the name of an org resource with the given suffix
   * @param suffix
   * @return {*}
   */
  getOrgResourceName : (suffix) => {
    return config.getOrgResourcePrefix() + suffix;
  },

  /**
   * Get the prefix for all org resources
   * @return {string}
   */
  getOrgResourcePrefix : () => {
    return config.PROJECT_PREFIX + config.ORGANIZATION + '-' + config.ENVIRONMENT_STAGE + '-';
  },

  /**
   * Get the name of an tenant resource with the given suffix
   * @param suffix
   * @return {*}
   */
  getTenantResourceName : (suffix) => {
    return config.getTenantResourcePrefix() + suffix;
  },

  /**
   * Get the prefix for all tenant resources
   * @return {string}
   */
  getTenantResourcePrefix : () => {
    return config.PROJECT_PREFIX + config.TENANT + '-' + config.ENVIRONMENT_STAGE + '-';
  },

  /**
   * Get the name of a core parameter with the given name
   * @param name
   * @return {*}
   */
  getParameterName : (name) => {
    return config.getParameterPrefix() + name;
  },

  /**
   * Get the prefix for all core parameters
   * @return {string}
   */
  getParameterPrefix : () => {
    return config.PROJECT_PREFIX + config.ENVIRONMENT_STAGE + '-' + config.AWS_REGION + '-';
  },

  /**
   * Get the name of a org parameter with the given name
   * @param name
   * @return {*}
   */
  getOrgParameterName : (name) => {
    return config.getOrgParameterPrefix() + name;
  },

  /**
   * Get the prefix for all org parameters
   * @return {string}
   */
  getOrgParameterPrefix : () => {
    return config.PROJECT_PREFIX + config.ORGANIZATION + '-' + config.ENVIRONMENT_STAGE + '-' + config.AWS_REGION + '-';
  },

  /**
   * Get the name of a tenant parameter with the given name
   * @param name
   * @return {*}
   */
  getTenantParameterName : (name) => {
    return config.getTenantParameterPrefix() + name;
  },

  /**
   * Get the prefix for all tenant parameters
   * @return {string}
   */
  getTenantParameterPrefix : () => {
    return config.PROJECT_PREFIX + config.TENANT + '-' + config.ENVIRONMENT_STAGE + '-' + config.AWS_REGION + '-';
  },

  /**
   * Get the name of the lambda zip file
   * @return {string}
   */
  getLambdaZipName : () => {
    return config.API_PACKAGE_PREFIX + config.API_PACKAGE_VERSION + '.zip';
  },

  /**
   * Get the S3 object key for the lambda bundle
   * @return {string}
   */
  getLambdaZipS3Key : () => {
    return 'api/' + config.getLambdaZipName();
  }

};

/**
 * Configuration details.
 */
let config = new Proxy(baseConfig, {
  /**
   * Get the specified config parameter (value will be sourced from command line, alias or schema default if available)
   */
  get: (target, parameter) => {
    if (!target.hasOwnProperty(parameter) && parameter !== 'inspect' && typeof(parameter) === 'string') {
      let value = undefined;
      let schema = target.schema[parameter] ||
        target.schema[Object.keys(target.schema).find(p => target.schema[p].alias === parameter)] || {};
      if (schema.argName && argv[schema.argName]) {
        value = argv[schema.argName];
      } else if (schema.alias) {
        value = target[schema.alias]
      }
      if (!value && schema.default) {
        value = schema.default;
      }
      if (value === undefined) {
        let error = (schema.argName) ?
          `${schema.description || parameter} is unset. Did you forget to set '--${schema.argName}' on command line?` :
          `${schema.description || parameter} is unset. Did you forget to set \'config.${parameter}\'?`;
        throw new Error(error);
      }
      return target.parameter = value;
    }
    return target[parameter];
  },

  /**
   * Check if the specified config parameter has been defined (either directly, via command line, alias or default)
   */
  has: (target, parameter) => {
    if (!target.hasOwnProperty(parameter)) {
      let schema = target.schema[parameter] ||
        target.schema[Object.keys(target.schema).find(p => target.schema[p].alias === parameter)] || {};
      return (
        (schema.argName && argv[schema.argName]) ||
        (schema.alias && schema.alias in target) ||
        (schema.default));
    }
    return true;
  }

});

module.exports = config;
<commit_msg>Increasing retry attempts and duration to address rate throttling on CF.describeStack<commit_after>'use strict';

/**
 * Fetch command line arguments
 */
const argv = (() => {
  let tba = null;
  return process.argv.reduce((options, arg) => {
    if (arg.startsWith('--')) {
      tba = arg.replace(/^--/, '');
      options[tba] = true;
    } else {
      if (tba) {
        options[tba] = arg;
      }
      tba = null;
    }
    return options;
  }, {});
})();

/**
 * Core configuration details.
 */
let baseConfig = {

  /**
   * Default configuration schema.
   *
   * A schema element describes a configuration parameter.
   * argName and/or default will be used if set to source the value for a parameter.
   *
   * Example Schema:
   *
   FOO: {
      argName:     '--foo',         // Command line arg name
      description: 'Foo Parameter', // Description
      default:     'foo value'      // Default value
      alias:       'foo'            // Alias (this parameter can be mapped to another name)
                                    // Useful to support different naming styles
    },
   *
   */
  schema : {
    PROJECT:             { description: 'ACS Project Name',                        alias: 'project'           },
    PROJECT_VERSION:     { description: 'ACS Project Version (e.g. poc, mvp1)',    alias: 'projectVersion'    },
    PROJECT_PREFIX:      { description: 'ACS Project Prefix',                      alias: 'projectPrefix'     },
    API_PACKAGE_PREFIX:  { description: 'API Package Prefix',  default: 'api-',    alias: 'apiPackagePrefix'  },
    API_PACKAGE_VERSION: { description: 'API Package Version', default: '0.0.1',   alias: 'apiPackageVersion' },
    AWS_PROFILE:         { description: 'AWS Profile',         argName: 'profile', alias: 'awsProfile'        },
    AWS_REGION:          { description: 'AWS Region',          argName: 'region',  alias: 'awsRegion'         },
    ENVIRONMENT_STAGE:   { description: 'Environment stage',   argName: 'env',     alias: 'environmentStage'  },
    ORGANIZATION:        { description: 'Organization Tag',    argName: 'org',     alias: 'organization'      },
    TENANT:              { description: 'Tenant',              argName: 'tenant',  alias: 'tenant'            }
  },

  /**
   * Initialize configuration.
   * @param configuration configuration setup for this session
   */
  init : (configuration) => {
    if (configuration.config) { Object.assign(baseConfig, configuration.config); }
    if (configuration.schema) { Object.assign(baseConfig.schema, configuration.schema); }
  },

  /**
   * Prime AWS environment and return AWS object.
   */
  get AWS() {
    process.env.AWS_PROFILE = config.AWS_PROFILE;
    process.env.AWS_REGION = config.AWS_REGION;

    delete this.AWS;
    this.AWS = require('aws-sdk');

    this.AWS.config.maxRetries = 12;
    this.AWS.retryDelayOptions = {base: Math.random() * (4000 - 800) + 800};

    return this.AWS;
  },

  /**
   * Get a logger for this session. Sets up a bunyan logger is not already set.
   */
  get logger() {
    // If logger not specified use bunyan by default
    let bunyan = require('bunyan');
    let PrettyStream = require('bunyan-prettystream');

    let prettyStdOut = new PrettyStream(); prettyStdOut.pipe(process.stdout);
    let prettyStdErr = new PrettyStream(); prettyStdErr.pipe(process.stderr);
    let name = config.PROJECT_PREFIX.slice(0, -1);

    delete this.logger;
    return this.logger = bunyan.createLogger({
      name: name,
      streams: [{
        level: 'debug',
        type: 'raw',
        stream: prettyStdOut,
        reemitErrorEvents: true
      }]
    });
  },
  set logger(logger) {
    delete this.logger;
    this.logger = logger;
  },

  /**
   * Get the name of a core resource with the given suffix
   * @param suffix
   * @return {*}
   */
  getResourceName : (suffix) => {
    return config.getResourcePrefix() + suffix;
  },

  /**
   * Get the prefix for all core resources
   * @return {string}
   */
  getResourcePrefix : () => {
    return config.PROJECT_PREFIX + config.ENVIRONMENT_STAGE + '-';
  },

  /**
   * Get the name of an org resource with the given suffix
   * @param suffix
   * @return {*}
   */
  getOrgResourceName : (suffix) => {
    return config.getOrgResourcePrefix() + suffix;
  },

  /**
   * Get the prefix for all org resources
   * @return {string}
   */
  getOrgResourcePrefix : () => {
    return config.PROJECT_PREFIX + config.ORGANIZATION + '-' + config.ENVIRONMENT_STAGE + '-';
  },

  /**
   * Get the name of an tenant resource with the given suffix
   * @param suffix
   * @return {*}
   */
  getTenantResourceName : (suffix) => {
    return config.getTenantResourcePrefix() + suffix;
  },

  /**
   * Get the prefix for all tenant resources
   * @return {string}
   */
  getTenantResourcePrefix : () => {
    return config.PROJECT_PREFIX + config.TENANT + '-' + config.ENVIRONMENT_STAGE + '-';
  },

  /**
   * Get the name of a core parameter with the given name
   * @param name
   * @return {*}
   */
  getParameterName : (name) => {
    return config.getParameterPrefix() + name;
  },

  /**
   * Get the prefix for all core parameters
   * @return {string}
   */
  getParameterPrefix : () => {
    return config.PROJECT_PREFIX + config.ENVIRONMENT_STAGE + '-' + config.AWS_REGION + '-';
  },

  /**
   * Get the name of a org parameter with the given name
   * @param name
   * @return {*}
   */
  getOrgParameterName : (name) => {
    return config.getOrgParameterPrefix() + name;
  },

  /**
   * Get the prefix for all org parameters
   * @return {string}
   */
  getOrgParameterPrefix : () => {
    return config.PROJECT_PREFIX + config.ORGANIZATION + '-' + config.ENVIRONMENT_STAGE + '-' + config.AWS_REGION + '-';
  },

  /**
   * Get the name of a tenant parameter with the given name
   * @param name
   * @return {*}
   */
  getTenantParameterName : (name) => {
    return config.getTenantParameterPrefix() + name;
  },

  /**
   * Get the prefix for all tenant parameters
   * @return {string}
   */
  getTenantParameterPrefix : () => {
    return config.PROJECT_PREFIX + config.TENANT + '-' + config.ENVIRONMENT_STAGE + '-' + config.AWS_REGION + '-';
  },

  /**
   * Get the name of the lambda zip file
   * @return {string}
   */
  getLambdaZipName : () => {
    return config.API_PACKAGE_PREFIX + config.API_PACKAGE_VERSION + '.zip';
  },

  /**
   * Get the S3 object key for the lambda bundle
   * @return {string}
   */
  getLambdaZipS3Key : () => {
    return 'api/' + config.getLambdaZipName();
  }

};

/**
 * Configuration details.
 */
let config = new Proxy(baseConfig, {
  /**
   * Get the specified config parameter (value will be sourced from command line, alias or schema default if available)
   */
  get: (target, parameter) => {
    if (!target.hasOwnProperty(parameter) && parameter !== 'inspect' && typeof(parameter) === 'string') {
      let value = undefined;
      let schema = target.schema[parameter] ||
        target.schema[Object.keys(target.schema).find(p => target.schema[p].alias === parameter)] || {};
      if (schema.argName && argv[schema.argName]) {
        value = argv[schema.argName];
      } else if (schema.alias) {
        value = target[schema.alias]
      }
      if (!value && schema.default) {
        value = schema.default;
      }
      if (value === undefined) {
        let error = (schema.argName) ?
          `${schema.description || parameter} is unset. Did you forget to set '--${schema.argName}' on command line?` :
          `${schema.description || parameter} is unset. Did you forget to set \'config.${parameter}\'?`;
        throw new Error(error);
      }
      return target.parameter = value;
    }
    return target[parameter];
  },

  /**
   * Check if the specified config parameter has been defined (either directly, via command line, alias or default)
   */
  has: (target, parameter) => {
    if (!target.hasOwnProperty(parameter)) {
      let schema = target.schema[parameter] ||
        target.schema[Object.keys(target.schema).find(p => target.schema[p].alias === parameter)] || {};
      return (
        (schema.argName && argv[schema.argName]) ||
        (schema.alias && schema.alias in target) ||
        (schema.default));
    }
    return true;
  }

});

module.exports = config;
<|endoftext|>


<commit_before>import {extend, isObject} from 'vega-util';

export default function(configs) {
  var output = defaults();
  (configs || []).forEach(function(config) {
    var key;
    if (config) for (key in config) {
      output[key] = isObject(output[key])
        ? extend(output[key], config[key])
        : output[key] = config[key];
    }
  });
  return output;
}

var defaultFont = 'sans-serif',
    defaultSymbolSize = 30,
    defaultStrokeWidth = 2,
    defaultColor = '#4c78a8',
    black = "#000",
    gray = '#888',
    lightGray = '#ddd';

/**
 * Standard configuration defaults for Vega specification parsing.
 * Users can provide their own (sub-)set of these default values
 * by passing in a config object to the top-level parse method.
 */
function defaults() {
  return {
    // default padding around visualization
    padding: 0,

    // default for automatic sizing; options: "none", "pad", "fit"
    // or provide an object (e.g., {"type": "pad", "resize": true})
    autosize: 'pad',

    // default view background color
    // covers the entire view component
    background: null,

    // default event handling configuration
    // preventDefault for view-sourced event types except 'wheel'
    events: {
      defaults: {allow: ['wheel']}
    },

    // defaults for top-level group marks
    // accepts mark properties (fill, stroke, etc)
    // covers the data rectangle within group width/height
    group: null,

    // defaults for basic mark types
    // each subset accepts mark properties (fill, stroke, etc)
    mark: null,
    arc: { fill: defaultColor },
    area: { fill: defaultColor },
    image: null,
    line: {
      stroke: defaultColor,
      strokeWidth: defaultStrokeWidth
    },
    path: { stroke: defaultColor },
    rect: { fill: defaultColor },
    rule: { stroke: black },
    shape: { stroke: defaultColor },
    symbol: {
      fill: defaultColor,
      size: 64
    },
    text: {
      fill: black,
      font: defaultFont,
      fontSize: 11
    },

    // style definitions
    style: {
      // axis & legend labels
      "guide-label": {
        fill: black,
        font: defaultFont,
        fontSize: 10
      },
      // axis & legend titles
      "guide-title": {
        fill: black,
        font: defaultFont,
        fontSize: 11,
        fontWeight: 'bold'
      },
      // headers, including chart title
      "group-title": {
        fill: black,
        font: defaultFont,
        fontSize: 13,
        fontWeight: 'bold'
      },
      // defaults for styled point marks in Vega-Lite
      point: {
        size: defaultSymbolSize,
        strokeWidth: defaultStrokeWidth,
        shape: 'circle'
      },
      circle: {
        size: defaultSymbolSize,
        strokeWidth: defaultStrokeWidth
      },
      square: {
        size: defaultSymbolSize,
        strokeWidth: defaultStrokeWidth,
        shape: 'square'
      },
      // defaults for styled group marks in Vega-Lite
      cell: {
        fill: 'transparent',
        stroke: lightGray
      }
    },

    // defaults for axes
    axis: {
      minExtent: 0,
      maxExtent: 200,
      bandPosition: 0.5,
      domain: true,
      domainWidth: 1,
      domainColor: gray,
      grid: false,
      gridWidth: 1,
      gridColor: lightGray,
      gridDash: [],
      gridOpacity: 1,
      labels: true,
      labelAngle: 0,
      labelLimit: 180,
      labelPadding: 2,
      ticks: true,
      tickColor: gray,
      tickOffset: 0,
      tickRound: true,
      tickSize: 5,
      tickWidth: 1,
      titleAlign: 'center',
      titlePadding: 2
    },

    // correction for centering bias
    axisBand: {
      tickOffset: -1
    },

    // defaults for legends
    legend: {
      orient: 'right',
      offset: 18,
      padding: 0,
      entryPadding: 5,
      titlePadding: 5,
      gradientWidth: 100,
      gradientHeight: 20,
      gradientStrokeColor: lightGray,
      gradientStrokeWidth: 0,
      gradientLabelBaseline: 'top',
      gradientLabelOffset: 2,
      labelAlign: 'left',
      labelBaseline: 'middle',
      labelOffset: 8,
      labelLimit: 160,
      symbolType: 'circle',
      symbolSize: 100,
      symbolFillColor: 'transparent',
      symbolStrokeColor: gray,
      symbolStrokeWidth: 1.5,
      titleAlign: 'left',
      titleBaseline: 'top',
      titleLimit: 180
    },

    // defaults for group title
    title: {
      orient: 'top',
      anchor: 'middle',
      offset: 2
    },

    // defaults for scale ranges
    range: {
      category: {
        scheme: 'tableau10'
      },
      ordinal: {
        scheme: 'blues',
        extent: [0.2, 1]
      },
      heatmap: {
        scheme: 'viridis'
      },
      ramp: {
        scheme: 'blues',
        extent: [0.2, 1]
      },
      diverging: {
        scheme: 'blueorange'
      },
      symbol: [
        'circle',
        'square',
        'triangle-up',
        'cross',
        'diamond',
        'triangle-right',
        'triangle-down',
        'triangle-left'
      ]
    }
  };
}
<commit_msg>Update configuration merge for style entries.<commit_after>import {extend} from 'vega-util';

export default function(configs) {
  var output = defaults();
  (configs || []).forEach(function(config) {
    var key, style;
    if (config) {
      for (key in config) {
        if (key === 'style') {
          style = output.style || (output.style = {});
          for (key in config.style) {
            style[key] = extend(style[key] || {}, config.style[key]);
          }
        } else {
          output[key] = extend(output[key] || {}, config[key]);
        }
      }
    }
  });
  return output;
}

var defaultFont = 'sans-serif',
    defaultSymbolSize = 30,
    defaultStrokeWidth = 2,
    defaultColor = '#4c78a8',
    black = "#000",
    gray = '#888',
    lightGray = '#ddd';

/**
 * Standard configuration defaults for Vega specification parsing.
 * Users can provide their own (sub-)set of these default values
 * by passing in a config object to the top-level parse method.
 */
function defaults() {
  return {
    // default padding around visualization
    padding: 0,

    // default for automatic sizing; options: "none", "pad", "fit"
    // or provide an object (e.g., {"type": "pad", "resize": true})
    autosize: 'pad',

    // default view background color
    // covers the entire view component
    background: null,

    // default event handling configuration
    // preventDefault for view-sourced event types except 'wheel'
    events: {
      defaults: {allow: ['wheel']}
    },

    // defaults for top-level group marks
    // accepts mark properties (fill, stroke, etc)
    // covers the data rectangle within group width/height
    group: null,

    // defaults for basic mark types
    // each subset accepts mark properties (fill, stroke, etc)
    mark: null,
    arc: { fill: defaultColor },
    area: { fill: defaultColor },
    image: null,
    line: {
      stroke: defaultColor,
      strokeWidth: defaultStrokeWidth
    },
    path: { stroke: defaultColor },
    rect: { fill: defaultColor },
    rule: { stroke: black },
    shape: { stroke: defaultColor },
    symbol: {
      fill: defaultColor,
      size: 64
    },
    text: {
      fill: black,
      font: defaultFont,
      fontSize: 11
    },

    // style definitions
    style: {
      // axis & legend labels
      "guide-label": {
        fill: black,
        font: defaultFont,
        fontSize: 10
      },
      // axis & legend titles
      "guide-title": {
        fill: black,
        font: defaultFont,
        fontSize: 11,
        fontWeight: 'bold'
      },
      // headers, including chart title
      "group-title": {
        fill: black,
        font: defaultFont,
        fontSize: 13,
        fontWeight: 'bold'
      },
      // defaults for styled point marks in Vega-Lite
      point: {
        size: defaultSymbolSize,
        strokeWidth: defaultStrokeWidth,
        shape: 'circle'
      },
      circle: {
        size: defaultSymbolSize,
        strokeWidth: defaultStrokeWidth
      },
      square: {
        size: defaultSymbolSize,
        strokeWidth: defaultStrokeWidth,
        shape: 'square'
      },
      // defaults for styled group marks in Vega-Lite
      cell: {
        fill: 'transparent',
        stroke: lightGray
      }
    },

    // defaults for axes
    axis: {
      minExtent: 0,
      maxExtent: 200,
      bandPosition: 0.5,
      domain: true,
      domainWidth: 1,
      domainColor: gray,
      grid: false,
      gridWidth: 1,
      gridColor: lightGray,
      gridDash: [],
      gridOpacity: 1,
      labels: true,
      labelAngle: 0,
      labelLimit: 180,
      labelPadding: 2,
      ticks: true,
      tickColor: gray,
      tickOffset: 0,
      tickRound: true,
      tickSize: 5,
      tickWidth: 1,
      titleAlign: 'center',
      titlePadding: 2
    },

    // correction for centering bias
    axisBand: {
      tickOffset: -1
    },

    // defaults for legends
    legend: {
      orient: 'right',
      offset: 18,
      padding: 0,
      entryPadding: 5,
      titlePadding: 5,
      gradientWidth: 100,
      gradientHeight: 20,
      gradientStrokeColor: lightGray,
      gradientStrokeWidth: 0,
      gradientLabelBaseline: 'top',
      gradientLabelOffset: 2,
      labelAlign: 'left',
      labelBaseline: 'middle',
      labelOffset: 8,
      labelLimit: 160,
      symbolType: 'circle',
      symbolSize: 100,
      symbolFillColor: 'transparent',
      symbolStrokeColor: gray,
      symbolStrokeWidth: 1.5,
      titleAlign: 'left',
      titleBaseline: 'top',
      titleLimit: 180
    },

    // defaults for group title
    title: {
      orient: 'top',
      anchor: 'middle',
      offset: 2
    },

    // defaults for scale ranges
    range: {
      category: {
        scheme: 'tableau10'
      },
      ordinal: {
        scheme: 'blues',
        extent: [0.2, 1]
      },
      heatmap: {
        scheme: 'viridis'
      },
      ramp: {
        scheme: 'blues',
        extent: [0.2, 1]
      },
      diverging: {
        scheme: 'blueorange'
      },
      symbol: [
        'circle',
        'square',
        'triangle-up',
        'cross',
        'diamond',
        'triangle-right',
        'triangle-down',
        'triangle-left'
      ]
    }
  };
}
<|endoftext|>


<commit_before>/**
 * config.js - The configuration for the loader
 */

var BASE_RE = /^(.+?\/)(\?\?)?(seajs\/)+/

// The root path to use for id2uri parsing
// If loaderUri is `http://test.com/libs/seajs/[??][seajs/1.2.3/]sea.js`, the
// baseUri should be `http://test.com/libs/`
data.base = (loaderDir.match(BASE_RE) || ["", loaderDir])[1]

// The loader directory
data.dir = loaderDir

// The current working directory
data.cwd = cwd

// The charset for requesting files
data.charset = "utf-8"

// Modules that are needed to load before all other modules
data.preload = (function() {
  var plugins = []

  // Convert `seajs-xxx` to `seajs-xxx=1`
  // NOTE: use `seajs-xxx=1` flag in uri or cookie to preload `seajs-xxx`
  var str = loc.search.replace(/(seajs-\w+)(&|$)/g, "$1=1$2")

  // Add cookie string
  str += " " + doc.cookie

  // Exclude seajs-xxx=0
  str.replace(/seajs-(\w+)=1/g, function(m, name) {
    plugins.push(name)
  })

  return plugins
})()

// data.debug - Debug mode. The default value is false
// data.alias - An object containing shorthands of module id
// data.paths - An object containing path shorthands in module id
// data.vars - The {xxx} variables in module id
// data.map - An array containing rules to map module uri
// data.plugins - An array containing needed plugins

function config(configData) {

  for (var key in configData) {
    var curr = configData[key]
    var prev = data[key]

    // Merge object config such as alias, vars
    if (prev && isObject(prev)) {
      for (var k in curr) {
        prev[k] = curr[k]
      }
    }
    else {
      // Concat array config such as map, preload
      if (isArray(prev)) {
        curr = prev.concat(curr)
      }
      // Make sure that `data.base` is an absolute path
      else if (key === "base") {
        (curr.slice(-1) === "/") || (curr += "/")
        curr = addBase(curr)
      }

      // Set config
      data[key] = curr
    }
  }

  emit("config", configData)
  return seajs
}

seajs.config = config

<commit_msg>Fix a bug for initial preload<commit_after>/**
 * config.js - The configuration for the loader
 */

var BASE_RE = /^(.+?\/)(\?\?)?(seajs\/)+/

// The root path to use for id2uri parsing
// If loaderUri is `http://test.com/libs/seajs/[??][seajs/1.2.3/]sea.js`, the
// baseUri should be `http://test.com/libs/`
data.base = (loaderDir.match(BASE_RE) || ["", loaderDir])[1]

// The loader directory
data.dir = loaderDir

// The current working directory
data.cwd = cwd

// The charset for requesting files
data.charset = "utf-8"

// Modules that are needed to load before all other modules
data.preload = (function() {
  var plugins = []

  // Convert `seajs-xxx` to `seajs-xxx=1`
  // NOTE: use `seajs-xxx=1` flag in uri or cookie to preload `seajs-xxx`
  var str = loc.search.replace(/(seajs-\w+)(&|$)/g, "$1=1$2")

  // Add cookie string
  str += " " + doc.cookie

  // Exclude seajs-xxx=0
  str.replace(/(seajs-\w+)=1/g, function(m, name) {
    plugins.push(name)
  })

  return plugins
})()

// data.debug - Debug mode. The default value is false
// data.alias - An object containing shorthands of module id
// data.paths - An object containing path shorthands in module id
// data.vars - The {xxx} variables in module id
// data.map - An array containing rules to map module uri
// data.plugins - An array containing needed plugins

function config(configData) {

  for (var key in configData) {
    var curr = configData[key]
    var prev = data[key]

    // Merge object config such as alias, vars
    if (prev && isObject(prev)) {
      for (var k in curr) {
        prev[k] = curr[k]
      }
    }
    else {
      // Concat array config such as map, preload
      if (isArray(prev)) {
        curr = prev.concat(curr)
      }
      // Make sure that `data.base` is an absolute path
      else if (key === "base") {
        (curr.slice(-1) === "/") || (curr += "/")
        curr = addBase(curr)
      }

      // Set config
      data[key] = curr
    }
  }

  emit("config", configData)
  return seajs
}

seajs.config = config

<|endoftext|>


<commit_before>/**
 * @file
 * @author zdying
 */
var Rsync = require('rsync');
var path = require('path');
var colors = require('colors');

var root = process.cwd();

var logPrex = '[log]'.green;
var warnPrex = '[warn]'.yellow;
var errPrex = '[error]'.red;

function uploadFile(configPath){
    var configPath = configPath || 'dev.json';
    var config = require(path.join(root, configPath));
    var source = config.source || './';
    var _path = config.path || config.dest;
    var server = config.server;
    var isSudo = config.sudo === undefined ? true : config.sudo;
    var errorField = [];

    if(typeof _path !== 'string' || _path.length === 0){
        errorField.push('path')
    }

    if(typeof server !== 'string' || server.length === 0){
        errorField.push('server')
    }

    if(errorField.length > 0){
        console.log('[error]'.red, 'invalid config field', errorField.join(', ').bold.yellow, 'at', (root + '/dev.json').bold.yellow);
        console.log('\nconfig example: \n');
        console.log('  {');
        console.log('    "source": "./",');
        console.log('    "exclude": [".idea", ".git", "node_modules", "prd", "loc", "env", "src", "dll"],');
        console.log('    "sudo": true,');
        console.log('    "path": "/root/username/project_name",');
        console.log('    "server": "root@192.168.111.111"');
        console.log('  }');
        console.log('\n');
        return
    }

    // Build the command
    var rsync = new Rsync()
        .debug(true)
        .shell('ssh')
        .flags('rzcv')
        .exclude(config.exclude)
        .source(source)
        .destination(server + ':' + _path);

    rsync.cwd(root);

    rsync.set('chmod', 'a+rX,u+w');
    rsync.set('rsync-path', (isSudo ? 'sudo ' : '') + 'rsync');

    console.log(logPrex, '执行:', rsync.command().bold);

    rsync.output(
        function(data){
            var str = data.toString();
            if(str.match(/\d+ files\.\.\./)){
                return
            }
            console.log(logPrex, str.split('\n')[0]);
        }, function(data){
            console.log(errPrex, data.toString());
        }
    );

    // Execute the command
    rsync.execute(function(err, code, cmd){
        // we're done
        if(err){
            console.log(errPrex, err.stack)
        }else{
            console.log(logPrex, 'sync finish'.magenta.bold);
        }
    });
}

module.exports = {
    sync: uploadFile
};<commit_msg>修改提示文字<commit_after>/**
 * @file
 * @author zdying
 */
var Rsync = require('rsync');
var path = require('path');
var colors = require('colors');

var root = process.cwd();

var logPrex = '[log]'.green;
var warnPrex = '[warn]'.yellow;
var errPrex = '[error]'.red;

function uploadFile(configPath){
    var configPath = configPath || 'dev.json';
    var config = require(path.join(root, configPath));
    var source = config.source || './';
    var _path = config.path || config.dest;
    var server = config.server;
    var isSudo = config.sudo === undefined ? true : config.sudo;
    var errorField = [];

    if(typeof _path !== 'string' || _path.length === 0){
        errorField.push('path')
    }

    if(typeof server !== 'string' || server.length === 0){
        errorField.push('server')
    }

    if(errorField.length > 0){
        console.log('[error]'.red, 'invalid config field', errorField.join(', ').bold.yellow, 'at', (root + '/' + configPath).bold.yellow);
        console.log('\nconfig example: \n');
        console.log('  {');
        console.log('    "source": "./",');
        console.log('    "exclude": [".idea", ".git", "node_modules", "prd", "loc", "env", "src", "dll"],');
        console.log('    "sudo": true,');
        console.log('    "path": "/root/username/project_name",');
        console.log('    "server": "root@192.168.111.111"');
        console.log('  }');
        console.log('\n');
        return
    }

    // Build the command
    var rsync = new Rsync()
        .debug(true)
        .shell('ssh')
        .flags('rzcv')
        .exclude(config.exclude)
        .source(source)
        .destination(server + ':' + _path);

    rsync.cwd(root);

    rsync.set('chmod', 'a+rX,u+w');
    rsync.set('rsync-path', (isSudo ? 'sudo ' : '') + 'rsync');

    console.log(logPrex, '执行:', rsync.command().bold);

    rsync.output(
        function(data){
            var str = data.toString();
            if(str.match(/\d+ files\.\.\./)){
                return
            }
            console.log(logPrex, str.split('\n')[0]);
        }, function(data){
            console.log(errPrex, data.toString());
        }
    );

    // Execute the command
    rsync.execute(function(err, code, cmd){
        // we're done
        if(err){
            console.log(errPrex, err.stack)
        }else{
            console.log(logPrex, 'sync finish'.magenta.bold);
        }
    });
}

module.exports = {
    sync: uploadFile
};<|endoftext|>


<commit_before>import {Binder} from './binder';

class InjectorBuilder {
	constructor(...modules) {
		this._modules = modules;

	}
}<commit_msg>Remove unused file `injector_builder`<commit_after><|endoftext|>


<commit_before>
kff.StyleBinder = kff.createClass(
{
	extend: kff.Binder
},
/** @lends kff.StyleBinder.prototype */
{
	/**
	 * One-way data binder (model to DOM) for any CSS style property.
	 * Sets the CSS property of the element to defined value when model atrribute changes.
	 *
	 * @constructs
	 * @augments kff.Binder
	 * @param {Object} options Options objectt
	 */
	constructor: function(options)
	{
		kff.Binder.call(this, options);
	},

	init: function()
	{
		this.styleProperty = this.options.params[0] || null;
		this.styleUnit = this.options.params[1] || '';
		kff.StyleBinder._super.init.call(this);
	},

	refresh: function()
	{
		var value = this.value;
		if(this.styleUnit) value += this.styleUnit;
		if(this.styleProperty) this.$element.css(this.styleProperty, this.value + this.styleUnit);
	}
});

kff.BindingView.registerBinder('style', kff.StyleBinder);
<commit_msg>refactor(kff.StyleBinder): use direct DOM access to style properties instead of jQuery.css method<commit_after>
kff.StyleBinder = kff.createClass(
{
	extend: kff.Binder
},
/** @lends kff.StyleBinder.prototype */
{
	/**
	 * One-way data binder (model to DOM) for any CSS style property.
	 * Sets the CSS property of the element to defined value when model atrribute changes.
	 *
	 * @constructs
	 * @augments kff.Binder
	 * @param {Object} options Options objectt
	 */
	constructor: function(options)
	{
		kff.Binder.call(this, options);
	},

	init: function()
	{
		this.styleProperty = this.options.params[0] || null;
		this.styleUnit = this.options.params[1] || '';
		kff.StyleBinder._super.init.call(this);
	},

	refresh: function()
	{
		var value = this.value;

		if(this.styleProperty)
		{
			if(value === undefined) delete this.$element[0].style[this.styleProperty];
			else
			{
				if(this.styleUnit) value += this.styleUnit;
				this.$element[0].style[this.styleProperty] = value;
			}
		}
	}
});

kff.BindingView.registerBinder('style', kff.StyleBinder);
<|endoftext|>


<commit_before>export const POST_FORM_TITLE_MAX = 120
export const POST_FORM_HUBS_MAX = 3
<commit_msg>Изменить POST_FORM_HUBS_MAX: 3 > 5<commit_after>export const POST_FORM_TITLE_MAX = 120
export const POST_FORM_HUBS_MAX = 5
<|endoftext|>


<commit_before>var temp = [
	"egret/core/HashObject.js",
    "egret/events/Event.js",
    "egret/events/TouchEvent.js",
    "egret/events/TimerEvent.js",
    "egret/events/EventPhase.js",
    "egret/events/EventDispatcher.js",
    "egret/core/MainContext.js",
    "egret/core/Profiler.js",
    "egret/core/Ticker.js",
    "egret/utils/Timer.js",
    "egret/utils/getQualifiedClassName.js",
    "egret/utils/toColorString.js",
    "egret/geom/Matrix.js",
    "egret/geom/Point.js",
    "egret/geom/Rectangle.js",
    "egret/core/Logger.js",
    "egret/core/Constant.js",
    "egret/core/StageDelegate.js",
    "egret/core/RenderFilter.js",
    "egret/display/DisplayObject.js",
    "egret/display/DisplayObjectContainer.js",
    "egret/display/Stage.js",
    "egret/display/Bitmap.js",
    "egret/text/BitmapText.js",
    "egret/display/Shape.js",
	"egret/text/TextAlign.js",
    "egret/text/VerticalAlign.js",
    "egret/text/TextField.js",
    "egret/display/SpriteSheet.js",
    "egret/text/TextInput.js",
    "egret/display/MovieClip.js",
    "egret/context/display/StageText.js",
    "egret/context/renderer/RendererContext.js",
    "egret/context/renderer/HTML5CanvasRenderer.js",
	"egret/interactive/InteractionMode.js",
    "egret/interactive/TouchContext.js",
    "egret/resource/ResourceLoader.js",
    "egret/resource/LoadingController.js",
    "egret/texture/Texture.js",
    "egret/texture/TextureCache.js",
    "egret/context/net/NetContext.js",
    "egret/context/net/HTML5NetContext.js",
    //utils start
    "jslib/ZipUtils.js",
    "jslib/base64.js",
    "jslib/gzip.js",
    "jslib/zlib.min.js",
    "egret/utils/SAXParser.js",
    "egret/utils/FrameworkUtils.js",
    "egret/utils/XML.js",
    "egret/utils/Recycler.js",
    //utils end
    //tween start
    "egret/tween/Tween.js",
    "egret/tween/Ease.js",
    //tween end
    "egret/context/sound/SoundContext.js",
    "egret/context/sound/HTML5SoundContext.js",

    //扩展
    //tileMap start
    "extension/tilemap/TMXTileMap.js",
    "extension/tilemap/TMXLayer.js",
    "extension/tilemap/TMXConst.js",
    "extension/tilemap/TMXMapInfo.js",
    //tileMap end

    //GUI start
    "extension/gui/collections/ArrayCollection.js",
    "extension/gui/managers/LayoutManager.js",
    "extension/gui/managers/layoutClass/DepthQueue.js",
    "extension/gui/core/UIGlobals.js",
    "extension/gui/core/UIComponent.js",
    "extension/gui/core/PopUpPosition.js",
    "extension/gui/core/NavigationUnit.js",
    "extension/gui/core/ScrollPolicy.js",
    "extension/gui/core/ClassFactory.js",
    "extension/gui/states/OverrideBase.js",
    "extension/gui/states/AddItems.js",
    "extension/gui/states/SetProperty.js",
    "extension/gui/states/State.js",
    "extension/gui/states/StateClientHelper.js",
    "extension/gui/components/UIAsset.js",
    "extension/gui/components/SkinnableComponent.js",
    "extension/gui/components/supportClasses/DefaultSkinAdapter.js",
    "extension/gui/components/supportClasses/SkinBasicLayout.js",
    "extension/gui/components/supportClasses/ButtonBase.js",
    "extension/gui/components/supportClasses/TextBase.js",
    "extension/gui/components/supportClasses/GroupBase.js",
    "extension/gui/components/supportClasses/ItemRenderer.js",
    "extension/gui/components/Label.js",
    "extension/gui/components/Button.js",
    "extension/gui/components/Group.js",
    "extension/gui/components/Skin.js",
    "extension/gui/components/DataGroup.js",
    "extension/gui/events/UIEvent.js",
    "extension/gui/events/PropertyChangeEvent.js",
    "extension/gui/events/PropertyChangeEventKind.js",
    "extension/gui/events/MoveEvent.js",
    "extension/gui/events/ResizeEvent.js",
    "extension/gui/events/SkinPartEvent.js",
    "extension/gui/events/CloseEvent.js",
    "extension/gui/events/CollectionEvent.js",
    "extension/gui/events/ElementExistenceEvent.js",
    "extension/gui/events/IndexChangeEvent.js",
    "extension/gui/events/ListEvent.js",
    "extension/gui/events/PopUpEvent.js",
    "extension/gui/events/RendererExistenceEvent.js",
    "extension/gui/events/StateChangeEvent.js",
    "extension/gui/events/TrackBaseEvent.js",
    "extension/gui/events/TreeEvent.js",
    "extension/gui/layouts/supportClasses/LayoutBase.js",
    "extension/gui/layouts/BasicLayout.js",
    "extension/gui/layouts/ColumnAlign.js",
    "extension/gui/layouts/HorizontalAlign.js",
    "extension/gui/layouts/RowAlign.js",
    "extension/gui/layouts/TileOrientation.js",
    "extension/gui/layouts/VerticalAlign.js",
    "extension/gui/layouts/VerticalLayout.js",
    "extension/gui/layouts/HorizontalLayout.js",
    "extension/gui/layouts/TileLayout.js",
    //GUI end
    "extension/gui/component/ScaleBitmap.js",
    "extension/gui/component/DynamicBitmap.js",
    "extension/dragonbones/dragonBones.js",
    "extension/dragonbones/DragonBonesEgretBridge.js",
    "jslib/DEBUG.js",
    "jslib/box2d.js"
]

if (true) {//浏览器
    temp.push("egret/context/devices/HTML5DeviceContext.js");
    temp.push("egret/context/renderer/NativeRendererContext.js");
}
else {
    temp.push("egret/context/devices/NativeDeviceContext.js");
    temp.push("egret/context/renderer/NativeRendererContext.js");
}

jsFileList = temp;
egret_file_list = temp;

var __extends = this.__extends || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    if (!b){
        console.log(d.toString() + "extends Error");
    }
    __.prototype = b.prototype;
    d.prototype = new __();
};<commit_msg>更新egret_file_list.js<commit_after>var temp = [
	"egret/core/HashObject.js",
    "egret/events/Event.js",
    "egret/events/TouchEvent.js",
    "egret/events/TimerEvent.js",
    "egret/events/EventPhase.js",
    "egret/events/EventDispatcher.js",
    "egret/core/MainContext.js",
    "egret/core/Profiler.js",
    "egret/core/Ticker.js",
    "egret/utils/Timer.js",
    "egret/utils/getQualifiedClassName.js",
    "egret/utils/toColorString.js",
    "egret/geom/Matrix.js",
    "egret/geom/Point.js",
    "egret/geom/Rectangle.js",
    "egret/core/Logger.js",
    "egret/core/Constant.js",
    "egret/core/StageDelegate.js",
    "egret/core/RenderFilter.js",
    "egret/display/DisplayObject.js",
    "egret/display/DisplayObjectContainer.js",
    "egret/display/Stage.js",
    "egret/display/Bitmap.js",
    "egret/text/BitmapText.js",
    "egret/display/Shape.js",
	"egret/text/TextAlign.js",
    "egret/text/VerticalAlign.js",
    "egret/text/TextField.js",
    "egret/display/SpriteSheet.js",
    "egret/text/TextInput.js",
    "egret/display/MovieClip.js",
    "egret/context/display/StageText.js",
    "egret/context/renderer/RendererContext.js",
    "egret/context/renderer/HTML5CanvasRenderer.js",
	"egret/interactive/InteractionMode.js",
    "egret/interactive/TouchContext.js",
    "egret/resource/ResourceLoader.js",
    "egret/resource/LoadingController.js",
    "egret/texture/Texture.js",
    "egret/texture/TextureCache.js",
    "egret/context/net/NetContext.js",
    "egret/context/net/HTML5NetContext.js",
    //utils start
    "jslib/ZipUtils.js",
    "jslib/base64.js",
    "jslib/gzip.js",
    "jslib/zlib.min.js",
    "egret/utils/SAXParser.js",
    "egret/utils/FrameworkUtils.js",
    "egret/utils/XML.js",
    "egret/utils/Recycler.js",
    //utils end
    //tween start
    "egret/tween/Tween.js",
    "egret/tween/Ease.js",
    //tween end
    "egret/context/sound/SoundContext.js",
    "egret/context/sound/HTML5SoundContext.js",

    //扩展
    //tileMap start
    "extension/tilemap/TMXTileMap.js",
    "extension/tilemap/TMXLayer.js",
    "extension/tilemap/TMXConst.js",
    "extension/tilemap/TMXMapInfo.js",
    //tileMap end

    //GUI start
    "extension/gui/collections/ArrayCollection.js",
    "extension/gui/managers/LayoutManager.js",
    "extension/gui/managers/layoutClass/DepthQueue.js",
    "extension/gui/core/UIGlobals.js",
    "extension/gui/core/UIComponent.js",
    "extension/gui/core/PopUpPosition.js",
    "extension/gui/core/NavigationUnit.js",
    "extension/gui/core/ScrollPolicy.js",
    "extension/gui/core/ClassFactory.js",
    "extension/gui/states/OverrideBase.js",
    "extension/gui/states/AddItems.js",
    "extension/gui/states/SetProperty.js",
    "extension/gui/states/State.js",
    "extension/gui/states/StateClientHelper.js",
    "extension/gui/components/UIAsset.js",
    "extension/gui/components/SkinnableComponent.js",
    "extension/gui/components/supportClasses/DefaultSkinAdapter.js",
    "extension/gui/components/supportClasses/SkinBasicLayout.js",
    "extension/gui/components/supportClasses/ButtonBase.js",
    "extension/gui/components/supportClasses/TextBase.js",
    "extension/gui/components/supportClasses/GroupBase.js",
    "extension/gui/components/supportClasses/ItemRenderer.js",
    "extension/gui/components/Label.js",
    "extension/gui/components/Button.js",
    "extension/gui/components/Group.js",
    "extension/gui/components/Skin.js",
    "extension/gui/components/DataGroup.js",
    "extension/gui/events/UIEvent.js",
    "extension/gui/events/PropertyChangeEvent.js",
    "extension/gui/events/PropertyChangeEventKind.js",
    "extension/gui/events/MoveEvent.js",
    "extension/gui/events/ResizeEvent.js",
    "extension/gui/events/SkinPartEvent.js",
    "extension/gui/events/CloseEvent.js",
    "extension/gui/events/CollectionEvent.js",
    "extension/gui/events/CollectionEventKind.js",
    "extension/gui/events/ElementExistenceEvent.js",
    "extension/gui/events/IndexChangeEvent.js",
    "extension/gui/events/ListEvent.js",
    "extension/gui/events/PopUpEvent.js",
    "extension/gui/events/RendererExistenceEvent.js",
    "extension/gui/events/StateChangeEvent.js",
    "extension/gui/events/TrackBaseEvent.js",
    "extension/gui/events/TreeEvent.js",
    "extension/gui/layouts/supportClasses/LayoutBase.js",
    "extension/gui/layouts/BasicLayout.js",
    "extension/gui/layouts/ColumnAlign.js",
    "extension/gui/layouts/HorizontalAlign.js",
    "extension/gui/layouts/RowAlign.js",
    "extension/gui/layouts/TileOrientation.js",
    "extension/gui/layouts/VerticalAlign.js",
    "extension/gui/layouts/VerticalLayout.js",
    "extension/gui/layouts/HorizontalLayout.js",
    "extension/gui/layouts/TileLayout.js",
    //GUI end
    "extension/gui/component/ScaleBitmap.js",
    "extension/gui/component/DynamicBitmap.js",
    "extension/dragonbones/dragonBones.js",
    "extension/dragonbones/DragonBonesEgretBridge.js",
    "jslib/DEBUG.js",
    "jslib/box2d.js"
]

if (true) {//浏览器
    temp.push("egret/context/devices/HTML5DeviceContext.js");
    temp.push("egret/context/renderer/NativeRendererContext.js");
}
else {
    temp.push("egret/context/devices/NativeDeviceContext.js");
    temp.push("egret/context/renderer/NativeRendererContext.js");
}

jsFileList = temp;
egret_file_list = temp;

var __extends = this.__extends || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    if (!b){
        console.log(d.toString() + "extends Error");
    }
    __.prototype = b.prototype;
    d.prototype = new __();
};<|endoftext|>


<commit_before>const path = require("path");

module.exports = (app) => {
  let API_PREFIX = "/v1";

  app.use(API_PREFIX + '/auth', require('./auth'));
  app.use(API_PREFIX + '/groups', require('./groups'));
  app.use(API_PREFIX + '/tickets', require('./tickets'));

  app.use((req, res, next) => {
    if(req.accepts('json')) {
      return res
        .status(404)
        .json({
          "error": "The resource is not found."
        });
    }

    res
      .status(406)
      .send('Page not found');
  });
};
<commit_msg>added support for CORS<commit_after>const path = require("path");

module.exports = (app) => {
  let API_PREFIX = "/v1";
  if (!process.env.CORS_CLIENT_DOMAIN) {
    console.log('[WARN] The CORS_CLIENT_DOMAIN for Cross Origin Control is not set.')
  }

  app.use((req, res, next) => {
    res.header('Access-Control-Allow-Origin', process.env.CORS_CLIENT_DOMAIN || '*');
    res.header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS');
    res.header('Access-Control-Allow-Headers', 'Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With');
    if ('OPTIONS' === req.method) {
      return res.status(200).send();
    }
    next();
  });

  app.use(API_PREFIX + '/auth', require('./auth'));
  app.use(API_PREFIX + '/groups', require('./groups'));
  app.use(API_PREFIX + '/tickets', require('./tickets'));

  app.use((req, res, next) => {
    if(req.accepts('json')) {
      return res
        .status(404)
        .json({
          "error": "The resource is not found."
        });
    }

    res
      .status(406)
      .send('Page not found');
  });
};
<|endoftext|>


<commit_before>'use strict'
const printChat = require('./printChat.js')

module.exports = function patterns (cy) {
  // flagged attributes
  const pattern = ['wireless', 'perception']
  let flaggedNodes = ''

  // apply the faded class to all the elements
  cy.elements().addClass('faded')

  // check all the nodes in graph for the search terms
  cy.nodes().map((node) => {
    const nodeData = node.data().info
    Object.keys(nodeData).map(value => {
      pattern.map(i => {
        if (nodeData[value] === i) {
          flaggedNodes += `• ${node.data().label} -> ${i}\n`
          // remove faded class from the search nodes
          node.removeClass('faded')
        }
      })
    })
  })
  printChat(flaggedNodes)
}
<commit_msg>:sparkles: user input in patterns<commit_after>'use strict'
const printChat = require('./printChat.js')

module.exports = function patterns (cy) {
  // remove the created form element
  const removeElement = () => {
    const parentEl = document.getElementById('info-nodes-id')
    const formEl = document.getElementById('form-id')
    if (formEl !== null) {
      parentEl.removeChild(formEl)
    }
  }
  // search pattern
  const flagNodes = pattern => {
    // flagged attributes
    let flaggedNodes = ''
    // apply the faded class to all the elements
    cy.elements().addClass('faded')

    // check all the nodes in graph for the search terms
    cy.nodes().map(node => {
      const nodeData = node.data().info
      Object.keys(nodeData).map(value => {
        pattern.map(i => {
          if (nodeData[value] === i) {
            flaggedNodes += `• ${node.data().label} -> ${i}\n`
            // remove faded class from the search nodes
            node.removeClass('faded')
          }
        })
      })
    })
    printChat(flaggedNodes)
  }

  const htmlElement = document.getElementById('info-nodes-id')

  const form = document.createElement('form')
  form.className = 'bubble'
  form.id = 'form-id'
  let label = document.createElement('label')
  let input = document.createElement('input')
  input.className = 'input-form'
  input.id = 'pattern-id'
  input.type = 'text'
  label.textContent = `keywords (spaces): `
  form.appendChild(label)
  form.appendChild(input)

  // create a submit button
  const submit = document.createElement('input')
  submit.className = 'submit-form'
  submit.type = 'submit'
  submit.value = 'Submit'
  form.appendChild(submit)
  htmlElement.appendChild(form)

  const formId = document.getElementById('form-id')
  formId.onsubmit = () => {
    let keywords = document.getElementById('pattern-id')
    let pattern = `${keywords.value}`.split(' ')
    removeElement()
    flagNodes(pattern)
    // return false to prevent the default form behavior
    return false
  }
  // focus on the description attribute of the form
  document.getElementById('pattern-id').focus()
}
<|endoftext|>


<commit_before>var krbb = {
    root: 'https://fish-ball.github.io/krbb-plugins/upload-photo'
};

// 先把 jQuery 替换掉
$('body').append('');

var jqLoaded = setInterval(function() {
    var version = jQuery.fn.jquery;
    console.log(version);
    if(version == '2.0.0') {
        clearInterval(jqLoaded);
        main();
    }
}, 50);

var main = function() {

    // -----------------------------------
    //              库引入
    // -----------------------------------

    $.watch = function(fnCase) {
        return $.Deferred(function(dfd) {
            var itv = setInterval(function() {
                var obj = fnCase();
                if(obj) {
                    clearInterval(itv);
                    dfd.resolve(obj);
                }
            }, 50);
        }).promise();
    };

    // jquery.formdata.js
    (function(c){"function"===typeof define&&define.amd?define(["jquery"],c):c("undefined"!=typeof jQuery?jQuery:window.Zepto)})(function(c){var l=window.TextEncoder?function(c){c=(new TextEncoder("utf8")).encode(c);for(var a="",d=0;d<c.length;++d)a+=String.fromCharCode(c[d]);return a}:function(c){return eval("'"+encodeURI(c).replace(/%/gm,"\\x")+"'")};c.ajaxFormData=function(f,a){"object"==typeof f&&(a=f,f=void 0);a=a||{};a.url=a.url||f||"";a.method=a.method||"post";var d=jQuery.ajaxSetup({},a);if("object"!==typeof d.data||!/^(GET|HEAD|OPTIONS|TRACE)$/.test(d.type))return c.ajax(d);var p=d.data,g="----JQBoundary"+btoa(Math.random().toString()).substr(0,12),m=[],e="",n=function(h,b){if(b instanceof File||b instanceof Blob)m.push(c.Deferred(function(c){var a=new FileReader;a.onload=function(a){a=a.target.result;var d=b.name&&l(b.name)||"blob";e+="--"+g+'\r\nContent-Disposition: form-data; name="'+h+'"; filename="'+d+'"\r\nContent-Type: '+(b.type||"application/octet-stream")+"\r\n\r\n"+a+"\r\n";c.resolve()};a.readAsBinaryString(b)}).promise());else if(/^data:image\/\w+;base64,/.test(b)){var a=b.search(";base64,"),d=b.substr(5,a-5),a=atob(b.substr(a+8));e+="--"+g+'\r\nContent-Disposition: form-data; name="'+h+'"; filename="blob"\r\nContent-Type: '+d+"\r\n\r\n"+a+"\r\n"}else"string"==typeof b||"number"==typeof b?e+="--"+g+'\r\nContent-Disposition: form-data; name="'+h+'"\r\n\r\n'+l(b.toString())+"\r\n":"boolean"===typeof b?b&&(e+="--"+g+'\r\nContent-Disposition: form-data; name="'+h+'"\r\n\r\non\r\n'):alert("jQuery.formdata: Post field type not supported,\nignore the field ["+h+"].")};c.each(p,function(a,b){b instanceof Array||b instanceof FileList?/\[]$/.test(a)?c.each(b,function(){n(a,this)}):alert("jQuery.formdata: an array field must have a `[]` suffix.\nignore the field ["+a+"]."):n(a,b)});return c.when.apply(c,m).then(function(){e+="--"+g+"--\r\n";var a;a:{a=e;for(var b=[],f,k=0;k<a.length;++k){f=a.charCodeAt(k);if(255<f){alert("Char code range out of 8 bit, parse error!");a=[];break a}b.push(a.charCodeAt(k))}a=new Uint8Array(b)}e=a.buffer;d.data=e;d.processData=!1;d.contentType="multipart/form-data; boundary="+g;return c.ajax(d)})}});

    // file to url
    var getFileURL = function(file) {
        var URL = window.URL || window.webkitURL;
        if(!URL) {
            alert('你的浏览器不支持客户端图片处理！');
            return false;
        }
        return imgURL = URL.createObjectURL(file);
    };

    // -----------------------------------
    //              执行脚本
    // -----------------------------------

    var galleries = [];
    var files = [];
    var $body = $('body');

    $.watch(function() {
        return $.ajaxFormData;
    }).then(function() {
        //menuonclick('BookList','2206768');
        OpenWinUpload('上传图片','图片',{menuid:228927,cateid:0,type:2});

        return $.watch(function() {
            return $(document.frame1.document).find('#xc_sel').children().length;
        });
    }).then(function() {
        $(document.frame1.document).find('#xc_sel').children().each(function() {
            galleries.push([$(this).html(), $(this).val()]);
        });
        $('head').append('<link rel="stylesheet" type="text/css" href="'+krbb.root+'/style.css" />');
        $body.html(
            '
幼教通图片上传增强插件 v0.1.0
' +
            '' +
            '    选择相册：' +
            '    <select id="gallery"></select>' +
            '    选择图片' +
            '    <input id="fileUpload" style="display: none;" type="file" name="images" multiple accept="image/*" />' +
            '' +
            '
' +
            '

' +
            '
上传
' +
            '
'
        );
        $.each(galleries, function() {
            $('#gallery').append('<option value="'+this[1]+'">'+this[0]+'</option>')
        });
        var $images = $('#images');
        var $upload = $('#fileUpload').change(function() {
            files = [];
            $.each($upload[0].files, function() {
                files.push(this);
                $images.append(
                    '
' +
                    '  ' +
                    '
'
                );
            });
        });
        var fileSizeText = function(sz) {
            var e = Math.pow(10, parseInt(Math.log10(sz))-2);
            sz = Math.round(sz/e)*e;
            if (sz < 1000) return sz + 'B';
            else if(sz < 1e6) return sz/1e3 + 'KB';
            else if(sz < 1e9) return sz/1e6 + 'MB';
            else return sz/1e9+ 'GB';
        };
        var doUpload = function() {
            if(files.length == 0) return;
            var file = files.shift();
            return $.getJSON('http://www.krbb.cn/NewWebSite/Manage/js/uploadify3.2/getcode.ashx?OperateType=1&time='+Math.random()).then(function(obj) {
                var code = obj.code;
                var gallery_id = $('#gallery').val();
                var filename = file.name;
                $images.find('li:first').append('

0%

');
                return $.ajaxFormData({
                    url: '/newwebsite/manage/js/uploadify3.2/Upload.ashx',
                    xhr: function() {
                        var xhr = $.ajaxSettings.xhr();
                        //绑定上传进度的回调函数
                        xhr.upload.addEventListener('progress', function(evt) {
                            if (evt.lengthComputable) {
                                var percentComplete = evt.loaded / evt.total;
                                $('#progress').html(
                                    '
' + parseInt(percentComplete*100)+'%
' +
                                    '
'+fileSizeText(evt.loaded)+'/'+fileSizeText(evt.total)+'
'
                                );
                            }
                        }, false);
                        return xhr;
                    },
                    data: {
                        Filename: filename,
                        Paras: gallery_id + '\t' + filename,
                        OperateType: 1,
                        CheckCode: code,
                        Filedata: file,
                        Upload: 'Submit Query'
                    }
                });
            }).then(function() {
                $images.find('li:first').fadeOut().detach();
            }).then(doUpload);
        };
        $('#submit').click(function() {
            doUpload();
        });

    });

};<commit_msg>修改了号码<commit_after>var krbb = {
    root: 'https://fish-ball.github.io/krbb-plugins/upload-photo'
};

// 先把 jQuery 替换掉
$('body').append('');

var jqLoaded = setInterval(function() {
    var version = jQuery.fn.jquery;
    console.log(version);
    if(version == '2.0.0') {
        clearInterval(jqLoaded);
        main();
    }
}, 50);

var main = function() {

    // -----------------------------------
    //              库引入
    // -----------------------------------

    $.watch = function(fnCase) {
        return $.Deferred(function(dfd) {
            var itv = setInterval(function() {
                var obj = fnCase();
                if(obj) {
                    clearInterval(itv);
                    dfd.resolve(obj);
                }
            }, 50);
        }).promise();
    };

    // jquery.formdata.js
    (function(c){"function"===typeof define&&define.amd?define(["jquery"],c):c("undefined"!=typeof jQuery?jQuery:window.Zepto)})(function(c){var l=window.TextEncoder?function(c){c=(new TextEncoder("utf8")).encode(c);for(var a="",d=0;d<c.length;++d)a+=String.fromCharCode(c[d]);return a}:function(c){return eval("'"+encodeURI(c).replace(/%/gm,"\\x")+"'")};c.ajaxFormData=function(f,a){"object"==typeof f&&(a=f,f=void 0);a=a||{};a.url=a.url||f||"";a.method=a.method||"post";var d=jQuery.ajaxSetup({},a);if("object"!==typeof d.data||!/^(GET|HEAD|OPTIONS|TRACE)$/.test(d.type))return c.ajax(d);var p=d.data,g="----JQBoundary"+btoa(Math.random().toString()).substr(0,12),m=[],e="",n=function(h,b){if(b instanceof File||b instanceof Blob)m.push(c.Deferred(function(c){var a=new FileReader;a.onload=function(a){a=a.target.result;var d=b.name&&l(b.name)||"blob";e+="--"+g+'\r\nContent-Disposition: form-data; name="'+h+'"; filename="'+d+'"\r\nContent-Type: '+(b.type||"application/octet-stream")+"\r\n\r\n"+a+"\r\n";c.resolve()};a.readAsBinaryString(b)}).promise());else if(/^data:image\/\w+;base64,/.test(b)){var a=b.search(";base64,"),d=b.substr(5,a-5),a=atob(b.substr(a+8));e+="--"+g+'\r\nContent-Disposition: form-data; name="'+h+'"; filename="blob"\r\nContent-Type: '+d+"\r\n\r\n"+a+"\r\n"}else"string"==typeof b||"number"==typeof b?e+="--"+g+'\r\nContent-Disposition: form-data; name="'+h+'"\r\n\r\n'+l(b.toString())+"\r\n":"boolean"===typeof b?b&&(e+="--"+g+'\r\nContent-Disposition: form-data; name="'+h+'"\r\n\r\non\r\n'):alert("jQuery.formdata: Post field type not supported,\nignore the field ["+h+"].")};c.each(p,function(a,b){b instanceof Array||b instanceof FileList?/\[]$/.test(a)?c.each(b,function(){n(a,this)}):alert("jQuery.formdata: an array field must have a `[]` suffix.\nignore the field ["+a+"]."):n(a,b)});return c.when.apply(c,m).then(function(){e+="--"+g+"--\r\n";var a;a:{a=e;for(var b=[],f,k=0;k<a.length;++k){f=a.charCodeAt(k);if(255<f){alert("Char code range out of 8 bit, parse error!");a=[];break a}b.push(a.charCodeAt(k))}a=new Uint8Array(b)}e=a.buffer;d.data=e;d.processData=!1;d.contentType="multipart/form-data; boundary="+g;return c.ajax(d)})}});

    // file to url
    var getFileURL = function(file) {
        var URL = window.URL || window.webkitURL;
        if(!URL) {
            alert('你的浏览器不支持客户端图片处理！');
            return false;
        }
        return imgURL = URL.createObjectURL(file);
    };

    // ------------------------------------
    //              执行脚本
    // ------------------------------------

    var galleries = [];
    var files = [];
    var $body = $('body');

    $.watch(function() {
        return $.ajaxFormData;
    }).then(function() {
        //menuonclick('BookList','2206768');
        OpenWinUpload('上传图片','图片',{menuid:228927,cateid:0,type:2});

        return $.watch(function() {
            return $(document.frame1.document).find('#xc_sel').children().length;
        });
    }).then(function() {
        $(document.frame1.document).find('#xc_sel').children().each(function() {
            galleries.push([$(this).html(), $(this).val()]);
        });
        $('head').append('<link rel="stylesheet" type="text/css" href="'+krbb.root+'/style.css" />');
        $body.html(
            '
幼教通图片上传增强插件 v0.1.0
' +
            '' +
            '    选择相册：' +
            '    <select id="gallery"></select>' +
            '    选择图片' +
            '    <input id="fileUpload" style="display: none;" type="file" name="images" multiple accept="image/*" />' +
            '' +
            '
' +
            '

' +
            '
上传
' +
            '
'
        );
        $.each(galleries, function() {
            $('#gallery').append('<option value="'+this[1]+'">'+this[0]+'</option>')
        });
        var $images = $('#images');
        var $upload = $('#fileUpload').change(function() {
            files = [];
            $.each($upload[0].files, function() {
                files.push(this);
                $images.append(
                    '
' +
                    '  ' +
                    '
'
                );
            });
        });
        var fileSizeText = function(sz) {
            var e = Math.pow(10, parseInt(Math.log10(sz))-2);
            sz = Math.round(sz/e)*e;
            if (sz < 1000) return sz + 'B';
            else if(sz < 1e6) return sz/1e3 + 'KB';
            else if(sz < 1e9) return sz/1e6 + 'MB';
            else return sz/1e9+ 'GB';
        };
        var doUpload = function() {
            if(files.length == 0) return;
            var file = files.shift();
            return $.getJSON('http://www.krbb.cn/NewWebSite/Manage/js/uploadify3.2/getcode.ashx?OperateType=1&time='+Math.random()).then(function(obj) {
                var code = obj.code;
                var gallery_id = $('#gallery').val();
                var filename = file.name;
                $images.find('li:first').append('

0%

');
                return $.ajaxFormData({
                    url: '/newwebsite/manage/js/uploadify3.2/Upload.ashx',
                    xhr: function() {
                        var xhr = $.ajaxSettings.xhr();
                        //绑定上传进度的回调函数
                        xhr.upload.addEventListener('progress', function(evt) {
                            if (evt.lengthComputable) {
                                var percentComplete = evt.loaded / evt.total;
                                $('#progress').html(
                                    '
' + parseInt(percentComplete*100)+'%
' +
                                    '
'+fileSizeText(evt.loaded)+'/'+fileSizeText(evt.total)+'
'
                                );
                            }
                        }, false);
                        return xhr;
                    },
                    data: {
                        Filename: filename,
                        Paras: gallery_id + '\t' + filename,
                        OperateType: 1,
                        CheckCode: code,
                        Filedata: file,
                        Upload: 'Submit Query'
                    }
                });
            }).then(function() {
                $images.find('li:first').fadeOut().detach();
            }).then(doUpload);
        };
        $('#submit').click(function() {
            doUpload();
        });

    });

};<|endoftext|>


<commit_before>import Config from '../config';
import {
  getScope,
  getDataAttribute,
  isObject,
  toArray,
  find,
  getPath,
  hasPath,
  isNullOrUndefined,
  isCallable,
  deepParseInt,
  fillRulesFromElement,
} from './utils';

/**
 * Generates the options required to construct a field.
 */
export default class Resolver {
  static generate (el, binding, vnode) {
    const model = Resolver.resolveModel(binding, vnode);
    const options = Config.resolve(vnode.context);

    return {
      name: Resolver.resolveName(el, vnode),
      el: el,
      listen: !binding.modifiers.disable,
      bails: binding.modifiers.bails ? true : (binding.modifiers.continues === true ? false : undefined),
      scope: Resolver.resolveScope(el, binding, vnode),
      vm: Resolver.makeVM(vnode.context),
      expression: binding.value,
      component: vnode.componentInstance,
      classes: options.classes,
      classNames: options.classNames,
      getter: Resolver.resolveGetter(el, vnode, model),
      events: Resolver.resolveEvents(el, vnode) || options.events,
      model,
      delay: Resolver.resolveDelay(el, vnode, options),
      rules: Resolver.resolveRules(el, binding, vnode),
      immediate: !!binding.modifiers.initial || !!binding.modifiers.immediate,
      validity: options.validity,
      aria: options.aria,
      initialValue: Resolver.resolveInitialValue(vnode)
    };
  }

  static getCtorConfig (vnode) {
    if (!vnode.componentInstance) return null;

    const config = getPath('componentInstance.$options.$_veeValidate', vnode);

    return config;
  }

  /**
   * Resolves the rules defined on an element.
   */
  static resolveRules (el, binding, vnode) {
    let rules = '';
    if (!binding.value && (!binding || !binding.expression)) {
      rules = getDataAttribute(el, 'rules');
    }

    if (binding.value && ~['string', 'object'].indexOf(typeof binding.value.rules)) {
      rules = binding.value.rules;
    } else if (binding.value) {
      rules = binding.value;
    }

    if (vnode.componentInstance) {
      return rules;
    }

    return fillRulesFromElement(el, rules);
  }

  /**
   * @param {*} vnode
   */
  static resolveInitialValue (vnode) {
    const model = vnode.data.model || find(vnode.data.directives, d => d.name === 'model');

    return model && model.value;
  }

  /**
   * Creates a non-circular partial VM instance from a Vue instance.
   * @param {*} vm
   */
  static makeVM (vm) {
    return {
      get $el () {
        return vm.$el;
      },
      get $refs () {
        return vm.$refs;
      },
      $watch: vm.$watch ? vm.$watch.bind(vm) : () => {},
      $validator: vm.$validator ? {
        errors: vm.$validator.errors,
        validate: vm.$validator.validate.bind(vm.$validator),
        update: vm.$validator.update.bind(vm.$validator)
      } : null
    };
  }

  /**
   * Resolves the delay value.
   * @param {*} el
   * @param {*} vnode
   * @param {Object} options
   */
  static resolveDelay (el, vnode, options) {
    let delay = getDataAttribute(el, 'delay');
    const globalDelay = (options && 'delay' in options) ? options.delay : 0;

    if (!delay && vnode.componentInstance && vnode.componentInstance.$attrs) {
      delay = vnode.componentInstance.$attrs['data-vv-delay'];
    }

    if (!isObject(globalDelay)) {
      return deepParseInt(delay || globalDelay);
    }

    if (!isNullOrUndefined(delay)) {
      globalDelay.input = delay;
    }

    return deepParseInt(globalDelay);
  }

  /**
   * Resolves the events to validate in response to.
   * @param {*} el
   * @param {*} vnode
   */
  static resolveEvents (el, vnode) {
    // resolve it from the root element.
    let events = getDataAttribute(el, 'validate-on');

    // resolve from data-vv-validate-on if its a vue component.
    if (!events && vnode.componentInstance && vnode.componentInstance.$attrs) {
      events = vnode.componentInstance.$attrs['data-vv-validate-on'];
    }

    // resolve it from $_veeValidate options.
    if (!events && vnode.componentInstance) {
      const config = Resolver.getCtorConfig(vnode);
      events = config && config.events;
    }

    if (Config.current.events) {
      events = Config.current.events;
    }

    // resolve the model event if its configured for custom components.
    if (events && vnode.componentInstance && events.includes('input')) {
      const { event } = vnode.componentInstance.$options.model || { event: 'input' };
      events = events.replace('input', event);
    }

    return events;
  }

  /**
   * Resolves the scope for the field.
   * @param {*} el
   * @param {*} binding
   */
  static resolveScope (el, binding, vnode = {}) {
    let scope = null;
    if (vnode.componentInstance && isNullOrUndefined(scope)) {
      scope = vnode.componentInstance.$attrs && vnode.componentInstance.$attrs['data-vv-scope'];
    }

    return !isNullOrUndefined(scope) ? scope : getScope(el);
  }

  /**
   * Checks if the node directives contains a v-model or a specified arg.
   * Args take priority over models.
   *
   * @return {Object}
   */
  static resolveModel (binding, vnode) {
    if (binding.arg) {
      return { expression: binding.arg };
    }

    const model = vnode.data.model || find(vnode.data.directives, d => d.name === 'model');
    if (!model) {
      return null;
    }

    // https://github.com/vuejs/vue/blob/dev/src/core/util/lang.js#L26
    const watchable = !/[^\w.$]/.test(model.expression) && hasPath(model.expression, vnode.context);
    const lazy = !!(model.modifiers && model.modifiers.lazy);

    if (!watchable) {
      return { expression: null, lazy };
    }

    return { expression: model.expression, lazy };
  }

  /**
   * Resolves the field name to trigger validations.
   * @return {String} The field name.
   */
  static resolveName (el, vnode) {
    let name = getDataAttribute(el, 'name');

    if (!name && !vnode.componentInstance) {
      return el.name;
    }

    if (!name && vnode.componentInstance && vnode.componentInstance.$attrs) {
      name = vnode.componentInstance.$attrs['data-vv-name'] || vnode.componentInstance.$attrs['name'];
    }

    if (!name && vnode.componentInstance) {
      const config = Resolver.getCtorConfig(vnode);
      if (config && isCallable(config.name)) {
        const boundGetter = config.name.bind(vnode.componentInstance);

        return boundGetter();
      }

      return vnode.componentInstance.name;
    }

    return name;
  }

  /**
   * Returns a value getter input type.
   */
  static resolveGetter (el, vnode, model) {
    if (model && model.expression) {
      return () => {
        return getPath(model.expression, vnode.context);
      };
    }

    if (vnode.componentInstance) {
      const path = getDataAttribute(el, 'value-path') || (vnode.componentInstance.$attrs && vnode.componentInstance.$attrs['data-vv-value-path']);
      if (path) {
        return () => {
          return getPath(path, vnode.componentInstance);
        };
      }

      const config = Resolver.getCtorConfig(vnode);
      if (config && isCallable(config.value)) {
        const boundGetter = config.value.bind(vnode.componentInstance);

        return () => {
          return boundGetter();
        };
      }

      const { prop } = vnode.componentInstance.$options.model || { prop: 'value' };

      return () => {
        return vnode.componentInstance[prop];
      };
    }

    switch (el.type) {
    case 'checkbox': return () => {
      let els = document.querySelectorAll(`input[name="${el.name}"]`);

      els = toArray(els).filter(el => el.checked);
      if (!els.length) return undefined;

      return els.map(checkbox => checkbox.value);
    };
    case 'radio': return () => {
      const els = document.querySelectorAll(`input[name="${el.name}"]`);
      const elm = find(els, el => el.checked);

      return elm && elm.value;
    };
    case 'file': return (context) => {
      return toArray(el.files);
    };
    case 'select-multiple': return () => {
      return toArray(el.options).filter(opt => opt.selected).map(opt => opt.value);
    };
    default: return () => {
      return el && el.value;
    };
    }
  }
}
<commit_msg>fix: only use global events if its not defined locally<commit_after>import Config from '../config';
import {
  getScope,
  getDataAttribute,
  isObject,
  toArray,
  find,
  getPath,
  hasPath,
  isNullOrUndefined,
  isCallable,
  deepParseInt,
  fillRulesFromElement,
} from './utils';

/**
 * Generates the options required to construct a field.
 */
export default class Resolver {
  static generate (el, binding, vnode) {
    const model = Resolver.resolveModel(binding, vnode);
    const options = Config.resolve(vnode.context);

    return {
      name: Resolver.resolveName(el, vnode),
      el: el,
      listen: !binding.modifiers.disable,
      bails: binding.modifiers.bails ? true : (binding.modifiers.continues === true ? false : undefined),
      scope: Resolver.resolveScope(el, binding, vnode),
      vm: Resolver.makeVM(vnode.context),
      expression: binding.value,
      component: vnode.componentInstance,
      classes: options.classes,
      classNames: options.classNames,
      getter: Resolver.resolveGetter(el, vnode, model),
      events: Resolver.resolveEvents(el, vnode) || options.events,
      model,
      delay: Resolver.resolveDelay(el, vnode, options),
      rules: Resolver.resolveRules(el, binding, vnode),
      immediate: !!binding.modifiers.initial || !!binding.modifiers.immediate,
      validity: options.validity,
      aria: options.aria,
      initialValue: Resolver.resolveInitialValue(vnode)
    };
  }

  static getCtorConfig (vnode) {
    if (!vnode.componentInstance) return null;

    const config = getPath('componentInstance.$options.$_veeValidate', vnode);

    return config;
  }

  /**
   * Resolves the rules defined on an element.
   */
  static resolveRules (el, binding, vnode) {
    let rules = '';
    if (!binding.value && (!binding || !binding.expression)) {
      rules = getDataAttribute(el, 'rules');
    }

    if (binding.value && ~['string', 'object'].indexOf(typeof binding.value.rules)) {
      rules = binding.value.rules;
    } else if (binding.value) {
      rules = binding.value;
    }

    if (vnode.componentInstance) {
      return rules;
    }

    return fillRulesFromElement(el, rules);
  }

  /**
   * @param {*} vnode
   */
  static resolveInitialValue (vnode) {
    const model = vnode.data.model || find(vnode.data.directives, d => d.name === 'model');

    return model && model.value;
  }

  /**
   * Creates a non-circular partial VM instance from a Vue instance.
   * @param {*} vm
   */
  static makeVM (vm) {
    return {
      get $el () {
        return vm.$el;
      },
      get $refs () {
        return vm.$refs;
      },
      $watch: vm.$watch ? vm.$watch.bind(vm) : () => {},
      $validator: vm.$validator ? {
        errors: vm.$validator.errors,
        validate: vm.$validator.validate.bind(vm.$validator),
        update: vm.$validator.update.bind(vm.$validator)
      } : null
    };
  }

  /**
   * Resolves the delay value.
   * @param {*} el
   * @param {*} vnode
   * @param {Object} options
   */
  static resolveDelay (el, vnode, options) {
    let delay = getDataAttribute(el, 'delay');
    const globalDelay = (options && 'delay' in options) ? options.delay : 0;

    if (!delay && vnode.componentInstance && vnode.componentInstance.$attrs) {
      delay = vnode.componentInstance.$attrs['data-vv-delay'];
    }

    if (!isObject(globalDelay)) {
      return deepParseInt(delay || globalDelay);
    }

    if (!isNullOrUndefined(delay)) {
      globalDelay.input = delay;
    }

    return deepParseInt(globalDelay);
  }

  /**
   * Resolves the events to validate in response to.
   * @param {*} el
   * @param {*} vnode
   */
  static resolveEvents (el, vnode) {
    // resolve it from the root element.
    let events = getDataAttribute(el, 'validate-on');

    // resolve from data-vv-validate-on if its a vue component.
    if (!events && vnode.componentInstance && vnode.componentInstance.$attrs) {
      events = vnode.componentInstance.$attrs['data-vv-validate-on'];
    }

    // resolve it from $_veeValidate options.
    if (!events && vnode.componentInstance) {
      const config = Resolver.getCtorConfig(vnode);
      events = config && config.events;
    }

    if (!events && Config.current.events) {
      events = Config.current.events;
    }

    // resolve the model event if its configured for custom components.
    if (events && vnode.componentInstance && events.includes('input')) {
      const { event } = vnode.componentInstance.$options.model || { event: 'input' };
      events = events.replace('input', event);
    }

    return events;
  }

  /**
   * Resolves the scope for the field.
   * @param {*} el
   * @param {*} binding
   */
  static resolveScope (el, binding, vnode = {}) {
    let scope = null;
    if (vnode.componentInstance && isNullOrUndefined(scope)) {
      scope = vnode.componentInstance.$attrs && vnode.componentInstance.$attrs['data-vv-scope'];
    }

    return !isNullOrUndefined(scope) ? scope : getScope(el);
  }

  /**
   * Checks if the node directives contains a v-model or a specified arg.
   * Args take priority over models.
   *
   * @return {Object}
   */
  static resolveModel (binding, vnode) {
    if (binding.arg) {
      return { expression: binding.arg };
    }

    const model = vnode.data.model || find(vnode.data.directives, d => d.name === 'model');
    if (!model) {
      return null;
    }

    // https://github.com/vuejs/vue/blob/dev/src/core/util/lang.js#L26
    const watchable = !/[^\w.$]/.test(model.expression) && hasPath(model.expression, vnode.context);
    const lazy = !!(model.modifiers && model.modifiers.lazy);

    if (!watchable) {
      return { expression: null, lazy };
    }

    return { expression: model.expression, lazy };
  }

  /**
   * Resolves the field name to trigger validations.
   * @return {String} The field name.
   */
  static resolveName (el, vnode) {
    let name = getDataAttribute(el, 'name');

    if (!name && !vnode.componentInstance) {
      return el.name;
    }

    if (!name && vnode.componentInstance && vnode.componentInstance.$attrs) {
      name = vnode.componentInstance.$attrs['data-vv-name'] || vnode.componentInstance.$attrs['name'];
    }

    if (!name && vnode.componentInstance) {
      const config = Resolver.getCtorConfig(vnode);
      if (config && isCallable(config.name)) {
        const boundGetter = config.name.bind(vnode.componentInstance);

        return boundGetter();
      }

      return vnode.componentInstance.name;
    }

    return name;
  }

  /**
   * Returns a value getter input type.
   */
  static resolveGetter (el, vnode, model) {
    if (model && model.expression) {
      return () => {
        return getPath(model.expression, vnode.context);
      };
    }

    if (vnode.componentInstance) {
      const path = getDataAttribute(el, 'value-path') || (vnode.componentInstance.$attrs && vnode.componentInstance.$attrs['data-vv-value-path']);
      if (path) {
        return () => {
          return getPath(path, vnode.componentInstance);
        };
      }

      const config = Resolver.getCtorConfig(vnode);
      if (config && isCallable(config.value)) {
        const boundGetter = config.value.bind(vnode.componentInstance);

        return () => {
          return boundGetter();
        };
      }

      const { prop } = vnode.componentInstance.$options.model || { prop: 'value' };

      return () => {
        return vnode.componentInstance[prop];
      };
    }

    switch (el.type) {
    case 'checkbox': return () => {
      let els = document.querySelectorAll(`input[name="${el.name}"]`);

      els = toArray(els).filter(el => el.checked);
      if (!els.length) return undefined;

      return els.map(checkbox => checkbox.value);
    };
    case 'radio': return () => {
      const els = document.querySelectorAll(`input[name="${el.name}"]`);
      const elm = find(els, el => el.checked);

      return elm && elm.value;
    };
    case 'file': return (context) => {
      return toArray(el.files);
    };
    case 'select-multiple': return () => {
      return toArray(el.options).filter(opt => opt.selected).map(opt => opt.value);
    };
    default: return () => {
      return el && el.value;
    };
    }
  }
}
<|endoftext|>


<commit_before>import esperanto from 'esperanto';
import fs from 'fs';
import path from 'path';
import lodash, {includes, result, template} from 'lodash';

import {aliasToReal} from 'lodash-cli/lib/mapping';

import chainableMethods from './lodash-chainable';

const buildPath = path.join(__dirname, '../templates/import-build.tpl');
const chainPath = path.join(__dirname, '../templates/chain-build.tpl');
const normalTemplate = template(fs.readFileSync(buildPath));
const chainTemplate = template(fs.readFileSync(chainPath));

export default function build(methods, modules, options) {
  let _path = result(options, 'lodashPath') || '';
  let {ext, dir, name, base} = path.parse(_path);
  // Don't rel a cjs import
  if (options.output != null &&
    (ext !== '' || dir !== '' || name !== base)
  ) {
    _path = path.relative(path.dirname(options.output), _path);
  }

  // Otherwise compile a file for them to the modularization
  let config = lodash.chain(methods)
    .map(name => {
      for (var category in modules) {
        if (includes(modules[category], name)) {
          break;
        }
      }
      let realName = result(aliasToReal, name, name);
      return {
        name,
        propString: `${name}: ${name}`,
        path: options.useNpmModules ?
          `lodash.${name.toLowerCase()}` :
          path.join(_path, category, realName),
        chained: chainableMethods[name]
      };
    })
    .partition(node => /\/chain\//.test(node.path))
    .value();

  let template = includes(methods, 'chain') ? chainTemplate : normalTemplate;
  let code = template({
    config: config[1],
    chainMethods: config[0],
    lodashPath: _path
  });

  let opts = {
    _evilES3SafeReExports: true,
    strict: false,
    name: options.global || '_'
  };
  switch (options.exports) {
    case 'cjs':
      return esperanto.toCjs(code, opts);
    case 'amd':
      return esperanto.toAmd(code, opts);
    case 'umd':
      return esperanto.toUmd(code, opts);
    case 'es6':
      return {code};
  }
  throw `Unsupported format: ${options.exports}`;
}
<commit_msg>Fix to use realName for path<commit_after>import esperanto from 'esperanto';
import fs from 'fs';
import path from 'path';
import lodash, {includes, result, template} from 'lodash';

import {aliasToReal} from 'lodash-cli/lib/mapping';

import chainableMethods from './lodash-chainable';

const buildPath = path.join(__dirname, '../templates/import-build.tpl');
const chainPath = path.join(__dirname, '../templates/chain-build.tpl');
const normalTemplate = template(fs.readFileSync(buildPath));
const chainTemplate = template(fs.readFileSync(chainPath));

export default function build(methods, modules, options) {
  let _path = result(options, 'lodashPath') || '';
  let {ext, dir, name, base} = path.parse(_path);
  // Don't rel a cjs import
  if (options.output != null &&
    (ext !== '' || dir !== '' || name !== base)
  ) {
    _path = path.relative(path.dirname(options.output), _path);
  }

  // Otherwise compile a file for them to the modularization
  let config = lodash.chain(methods)
    .map(name => {
      for (var category in modules) {
        if (includes(modules[category], name)) {
          break;
        }
      }
      let realName = result(aliasToReal, name, name);
      return {
        name,
        propString: `${name}: ${name}`,
        path: options.useNpmModules ?
          `lodash.${realName.toLowerCase()}` :
          path.join(_path, category, realName),
        chained: chainableMethods[name]
      };
    })
    .partition(node => /\/chain\//.test(node.path))
    .value();

  let template = includes(methods, 'chain') ? chainTemplate : normalTemplate;
  let code = template({
    config: config[1],
    chainMethods: config[0],
    lodashPath: _path
  });

  let opts = {
    _evilES3SafeReExports: true,
    strict: false,
    name: options.global || '_'
  };
  switch (options.exports) {
    case 'cjs':
      return esperanto.toCjs(code, opts);
    case 'amd':
      return esperanto.toAmd(code, opts);
    case 'umd':
      return esperanto.toUmd(code, opts);
    case 'es6':
      return {code};
  }
  throw `Unsupported format: ${options.exports}`;
}
<|endoftext|>