<commit_before>/**
* Each Enyo-provided library will annotate this structure with its own
* version info. Why? In general, Enyo and its libraries are versioned
* and released together, but libraries may be versioned separately in
* the future. Also, since libraries are checked out and updated
* individually, a project may be using "mismatched" libraries at any
* given time (e.g., the last stable release of Enyo core, but an
* unreleased checkout from the master branch of `layout`).
*
* Enyo uses semantic versioning. Official releases have version
* numbers	of the form `'X.y.z'`. Prereleases are indicated by a suffix
* of the form `'-pre.N'`, where `N` is incremented for each prerelease.
* Between releases, version numbers include an additional `'-dev'`
* suffix.
*
* @name enyo.version
* @type {Object}
* @property {String} enyo - The current release version string.
* @public
*/
enyo.version = {
	enyo: '2.5.3-zzz.7'
};
<commit_msg>Update version string to 2.5.3-pre.2<commit_after>/**
* Each Enyo-provided library will annotate this structure with its own
* version info. Why? In general, Enyo and its libraries are versioned
* and released together, but libraries may be versioned separately in
* the future. Also, since libraries are checked out and updated
* individually, a project may be using "mismatched" libraries at any
* given time (e.g., the last stable release of Enyo core, but an
* unreleased checkout from the master branch of `layout`).
*
* Enyo uses semantic versioning. Official releases have version
* numbers	of the form `'X.y.z'`. Prereleases are indicated by a suffix
* of the form `'-pre.N'`, where `N` is incremented for each prerelease.
* Between releases, version numbers include an additional `'-dev'`
* suffix.
*
* @name enyo.version
* @type {Object}
* @property {String} enyo - The current release version string.
* @public
*/
enyo.version = {
	enyo: '2.5.3-pre.2'
};
<|endoftext|>


<commit_before>/* jshint node: true */

module.exports = function(environment) {
  var ENV = {
    modulePrefix: 'dummy',
    environment: environment,
    rootURL: '/',
    locationType: 'auto',
    EmberENV: {
      FEATURES: {
        // Here you can enable experimental features on an ember canary build
        // e.g. 'with-controller': true
      }
    },

    APP: {
      // Here you can pass flags/options to your application instance
      // when it is created
    }
  };

  if (environment === 'development') {
    // ENV.APP.LOG_RESOLVER = true;
    // ENV.APP.LOG_ACTIVE_GENERATION = true;
    // ENV.APP.LOG_TRANSITIONS = true;
    // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
    // ENV.APP.LOG_VIEW_LOOKUPS = true;
  }

  if (environment === 'test') {
    // Testem prefers this...
    ENV.locationType = 'none';

    // keep test console output quieter
    ENV.APP.LOG_ACTIVE_GENERATION = false;
    ENV.APP.LOG_VIEW_LOOKUPS = false;

    ENV.APP.rootElement = '#ember-testing';
  }

  if (environment === 'production') {
    ENV.locationType = 'hash';
    ENV.rootUrl = '/ember-eline/';

  }

  return ENV;
};
<commit_msg>gh-pages fix<commit_after>/* jshint node: true */

module.exports = function(environment) {
  var ENV = {
    modulePrefix: 'dummy',
    environment: environment,
    rootURL: '/',
    locationType: 'auto',
    EmberENV: {
      FEATURES: {
        // Here you can enable experimental features on an ember canary build
        // e.g. 'with-controller': true
      }
    },

    APP: {
      // Here you can pass flags/options to your application instance
      // when it is created
    }
  };

  if (environment === 'development') {
    // ENV.APP.LOG_RESOLVER = true;
    // ENV.APP.LOG_ACTIVE_GENERATION = true;
    // ENV.APP.LOG_TRANSITIONS = true;
    // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
    // ENV.APP.LOG_VIEW_LOOKUPS = true;
  }

  if (environment === 'test') {
    // Testem prefers this...
    ENV.locationType = 'none';

    // keep test console output quieter
    ENV.APP.LOG_ACTIVE_GENERATION = false;
    ENV.APP.LOG_VIEW_LOOKUPS = false;

    ENV.APP.rootElement = '#ember-testing';
  }

  if (environment === 'production') {
    ENV.locationType = 'hash';
    ENV.rootURL = '/ember-eline/';
  }

  return ENV;
};
<|endoftext|>


<commit_before>/*global define */
define(["dojo/number"], function (number) {
	"use strict";

	/**
	 * @constructor
	 */
	function PovertyData(queryResults) {
		/** @member {number} */
		this.totalPopulation = queryResults.Total_POV || 0;
		/** @member {number} */
		this.federalTotalInPoverty = queryResults.Poverty_Fed || 0;
		/////** @member {number} */
		////this.stateTotalInPoverty = queryResults.Poverty_State || 0;

		this.nonPoverty = (this.totalPopulation - this.federalTotalInPoverty) || 0;

		/** @member {number} */
		this.medianIncome = queryResults.Income || 0;
	}

	/**
	 * @returns {number}
	 */
	PovertyData.prototype.getPercentInPovertyForState = function () {
		return (this.stateTotalInPoverty / this.totalPopulation) * 100;
	};

	/**
	 * @returns {number}
	 */
	PovertyData.prototype.getPercentInPovertyForFederal = function () {
		return (this.federalTotalInPoverty / this.totalPopulation) * 100;
	};

	/**
	 * @typedef ColumnChartSeriesItem
	 * @property {number} y - The y value.
	 * @property {string} text - The label.
	 * @property {string} stroke - The color of the outline.
	 * @property {string} fill - The fill color.
	 * @property {stirng} tooltip - The string used for the tooltip.
	 */

	/** Creates objects used to populate a column chart.
	 * @returns {ColumnChartSeriesItem[]}
	 */
	PovertyData.prototype.toChartSeries = function () {
		var output, pctInPoverty;

		pctInPoverty = Math.round(this.getPercentInPovertyForFederal());

		output = [
			{
				y: this.federalTotalInPoverty,
				text: "Poverty",
				stroke: "black",
				fill: "red",
				tooltip: ["Poverty: ", number.format(this.federalInPoverty), "(~", pctInPoverty, "%)"].join("")
			}, {
				y: this.nonPoverty,
				text: "Non-Poverty",
				stroke: "black",
				fill: "gray",
				tooltip: ["Non-Poverty: ", number.format(this.nonPoverty), "(~", 100 - pctInPoverty, "%)"].join("")
			}
		];

		return output;
	};

	return PovertyData;
});<commit_msg>Updated colors on poverty charts.<commit_after>/*global define */
define(["dojo/number"], function (number) {
	"use strict";

	/**
	 * @constructor
	 */
	function PovertyData(queryResults) {
		/** @member {number} */
		this.totalPopulation = queryResults.Total_POV || 0;
		/** @member {number} */
		this.federalTotalInPoverty = queryResults.Poverty_Fed || 0;
		/////** @member {number} */
		////this.stateTotalInPoverty = queryResults.Poverty_State || 0;

		this.nonPoverty = (this.totalPopulation - this.federalTotalInPoverty) || 0;

		/** @member {number} */
		this.medianIncome = queryResults.Income || 0;
	}

	/**
	 * @returns {number}
	 */
	PovertyData.prototype.getPercentInPovertyForState = function () {
		return (this.stateTotalInPoverty / this.totalPopulation) * 100;
	};

	/**
	 * @returns {number}
	 */
	PovertyData.prototype.getPercentInPovertyForFederal = function () {
		return (this.federalTotalInPoverty / this.totalPopulation) * 100;
	};

	/**
	 * @typedef ColumnChartSeriesItem
	 * @property {number} y - The y value.
	 * @property {string} text - The label.
	 * @property {string} stroke - The color of the outline.
	 * @property {string} fill - The fill color.
	 * @property {stirng} tooltip - The string used for the tooltip.
	 */

	/** Creates objects used to populate a column chart.
	 * @returns {ColumnChartSeriesItem[]}
	 */
	PovertyData.prototype.toChartSeries = function () {
		var output, pctInPoverty;

		pctInPoverty = Math.round(this.getPercentInPovertyForFederal());

		output = [
			{
				y: this.federalTotalInPoverty,
				text: "Poverty",
				stroke: "black",
				fill: "RGB(87,145,101)",
				tooltip: ["Poverty: ", number.format(this.federalInPoverty), "(~", pctInPoverty, "%)"].join("")
			}, {
				y: this.nonPoverty,
				text: "Non-Poverty",
				stroke: "black",
				fill: "RGB(220,245,233)",
				tooltip: ["Non-Poverty: ", number.format(this.nonPoverty), "(~", 100 - pctInPoverty, "%)"].join("")
			}
		];

		return output;
	};

	return PovertyData;
});<|endoftext|>


<commit_before>// Copyright 2015-present 650 Industries. All rights reserved.

'use strict';

import fs from 'fs-extra';
import glob from 'glob-promise';
import indentString from 'indent-string';
import JsonFile from '@expo/json-file';
import path from 'path';

import { parseSdkMajorVersion } from './ExponentTools';

function _validatePodfileSubstitutions(substitutions) {
  const validKeys = [
    // a pod dependency on ExpoKit (can be local or remote)
    'EXPOKIT_DEPENDENCY',
    // local path to ExpoKit dependency
    'EXPOKIT_PATH',
    // tag to use for ExpoKit dependency
    'EXPOKIT_TAG',
    // the contents of dependencies.json enumerated as deps in podfile format
    'EXPONENT_CLIENT_DEPS',
    // postinstall for detached projects (defines EX_DETACHED among other things)
    'PODFILE_DETACHED_POSTINSTALL',
    // ExponentIntegrationTests
    'PODFILE_TEST_TARGET',
    // unversioned react native pod dependency, probably at the path given in
    // REACT_NATIVE_PATH, with a bunch of subspecs.
    'PODFILE_UNVERSIONED_RN_DEPENDENCY',
    // postinstall hook for unversioned deps
    'PODFILE_UNVERSIONED_POSTINSTALL',
    // versioned rn dependencies (paths to versioned-react-native directories)
    // read from template files
    'PODFILE_VERSIONED_RN_DEPENDENCIES',
    // versioned rn postinstall hooks read from template files
    'PODFILE_VERSIONED_POSTINSTALLS',
    // path to use for the unversioned react native dependency
    'REACT_NATIVE_PATH',
    // name of the main build target, e.g. Exponent
    'TARGET_NAME',
    // path from Podfile to versioned-react-native
    'VERSIONED_REACT_NATIVE_PATH',
  ];

  for (const key in substitutions) {
    if (substitutions.hasOwnProperty(key)) {
      if (!validKeys.includes(key)) {
        throw new Error(`Unrecognized Podfile template key: ${key}`);
      }
    }
  }
  return true;
}

function _renderExpoKitDependency(options) {
  let attributes;
  if (options.expoKitPath) {
    attributes = {
      path: options.expoKitPath,
    };
  } else if (options.expoKitTag) {
    attributes = {
      git: 'http://github.com/expo/expo.git',
      tag: options.expoKitTag,
    };
  } else {
    attributes = {
      git: 'http://github.com/expo/expo.git',
      branch: 'master',
    };
  }
  attributes.subspecs = ['Core', 'CPP'];

  let dependency = `pod 'ExpoKit',
${indentString(_renderDependencyAttributes(attributes), 2)}`;

  return indentString(dependency, 2);
}

/**
 * @param sdkVersion if specified, indicates which sdkVersion this project uses
 *  as 'UNVERSIONED', e.g. if we are detaching a sdk15 project, we render
 *  an unversioned dependency pointing at RN#sdk-15.
 */
function _renderUnversionedReactNativeDependency(options, sdkVersion) {
  let sdkMajorVersion = parseSdkMajorVersion(sdkVersion);
  if (sdkMajorVersion === 14) {
    return indentString(
      `
${_renderUnversionedReactDependency(options)}
`,
      2
    );
  } else if (sdkMajorVersion < 21) {
    return indentString(
      `
${_renderUnversionedReactDependency(options, sdkVersion)}
${_renderUnversionedYogaDependency(options, sdkVersion)}
`,
      2
    );
  } else {
    return indentString(
      `
${_renderUnversionedReactDependency(options, sdkVersion)}
${_renderUnversionedYogaDependency(options, sdkVersion)}
${_renderUnversionedThirdPartyDependency(
        'DoubleConversion',
        path.join('third-party-podspecs', 'DoubleConversion.podspec'),
        options
      )}
${_renderUnversionedThirdPartyDependency(
        'Folly',
        path.join('third-party-podspecs', 'Folly.podspec'),
        options
      )}
${_renderUnversionedThirdPartyDependency(
        'GLog',
        path.join('third-party-podspecs', 'GLog.podspec'),
        options
      )}
`,
      2
    );
  }
}

function _renderUnversionedReactDependency(options, sdkVersion) {
  let attributes;
  if (options.reactNativePath) {
    attributes = {
      path: options.reactNativePath,
    };
  } else {
    throw new Error(`Unsupported options for RN dependency: ${options}`);
  }

  attributes.subspecs = [
    'Core',
    'ART',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTCameraRoll',
    'RCTGeolocation',
    'RCTImage',
    'RCTNetwork',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
  ];

  let sdkMajorVersion = parseSdkMajorVersion(sdkVersion);
  if (!(sdkMajorVersion < 16)) {
    attributes.subspecs.push('DevSupport');
  }
  if (!(sdkMajorVersion < 21)) {
    attributes.subspecs.push('CxxBridge');
  } else if (!(sdkMajorVersion < 18)) {
    attributes.subspecs.push('BatchedBridge');
  }

  return `pod 'React',
${indentString(_renderDependencyAttributes(attributes), 2)}`;
}

function _renderUnversionedYogaDependency(options, sdkVersion) {
  let attributes;
  let sdkMajorVersion = parseSdkMajorVersion(sdkVersion);
  if (options.reactNativePath) {
    attributes = {
      path: path.join(
        options.reactNativePath,
        'ReactCommon',
        sdkMajorVersion < 22 ? 'Yoga' : 'yoga'
      ),
    };
  } else {
    throw new Error(`Unsupported options for Yoga dependency: ${options}`);
  }
  return `pod '${sdkMajorVersion < 22 ? 'Yoga' : 'yoga'}',
${indentString(_renderDependencyAttributes(attributes), 2)}`;
}

function _renderUnversionedThirdPartyDependency(podName, podspecRelativePath, options) {
  let attributes;
  if (options.reactNativePath) {
    attributes = {
      podspec: path.join(options.reactNativePath, podspecRelativePath),
      inhibit_warnings: true,
    };
  } else {
    throw new Error(`Unsupported options for ${podName} dependency: ${options}`);
  }
  return `pod '${podName}',
${indentString(_renderDependencyAttributes(attributes), 2)}`;
}

function _renderDependencyAttributes(attributes) {
  let attributesStrings = [];
  for (let key of Object.keys(attributes)) {
    let value = JSON.stringify(attributes[key], null, 2);
    attributesStrings.push(`:${key} => ${value}`);
  }
  return attributesStrings.join(',\n');
}

async function _renderVersionedReactNativeDependenciesAsync(
  templatesDirectory,
  versionedReactNativePath
) {
  let result = await _concatTemplateFilesInDirectoryAsync(
    path.join(templatesDirectory, 'versioned-react-native', 'dependencies')
  );
  result = result.replace(/\$\{VERSIONED_REACT_NATIVE_PATH\}/g, versionedReactNativePath);
  return result;
}

async function _renderVersionedReactNativePostinstallsAsync(templatesDirectory) {
  // TODO: write these files with versioning script
  return _concatTemplateFilesInDirectoryAsync(
    path.join(templatesDirectory, 'versioned-react-native', 'postinstalls')
  );
}

async function _concatTemplateFilesInDirectoryAsync(directory) {
  let templateFilenames = await glob(path.join(directory, '*.rb'));
  let templateStrings = [];
  await Promise.all(
    templateFilenames.map(async filename => {
      let templateString = await fs.readFile(filename, 'utf8');
      if (templateString) {
        templateStrings.push(templateString);
      }
    })
  );
  return templateStrings.join('\n');
}

function _renderDetachedPostinstall(sdkVersion) {
  let podsRootSub = '${PODS_ROOT}';
  return `
    if target.pod_name == 'ExpoKit'
      target.native_target.build_configurations.each do |config|
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'EX_DETACHED=1'
        # needed for GoogleMaps 2.x
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= []
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${podsRootSub}/GoogleMaps/Base/Frameworks'
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${podsRootSub}/GoogleMaps/Maps/Frameworks'
      end
    end
`;
}

function _renderUnversionedPostinstall() {
  return `
    if target.pod_name == 'AppAuth'
      target.native_target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
      end
    end
    # Build React Native with RCT_DEV enabled
    next unless target.pod_name == 'React'
    target.native_target.build_configurations.each do |config|
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_DEV=1'
    end
`;
}

function _renderTestTarget(reactNativePath) {
  return `
  target 'ExponentIntegrationTests' do
    inherit! :search_paths
  end
`;
}

async function _renderPodDependenciesAsync(dependenciesConfigPath, options) {
  let dependencies = await new JsonFile(dependenciesConfigPath).readAsync();
  let type = options.isPodfile ? 'pod' : 'ss.dependency';
  let depsStrings = dependencies.map(
    dependency => `  ${type} '${dependency.name}', '${dependency.version}'`
  );
  return depsStrings.join('\n');
}

async function renderExpoKitPodspecAsync(pathToTemplate, pathToOutput, moreSubstitutions) {
  let templatesDirectory = path.dirname(pathToTemplate);
  let templateString = await fs.readFile(pathToTemplate, 'utf8');
  let dependencies = await _renderPodDependenciesAsync(
    path.join(templatesDirectory, 'dependencies.json'),
    { isPodfile: false }
  );
  let result = templateString.replace(/\$\{IOS_EXPOKIT_DEPS\}/g, indentString(dependencies, 2));
  if (moreSubstitutions && moreSubstitutions.IOS_EXPONENT_CLIENT_VERSION) {
    result = result.replace(
      /\$\{IOS_EXPONENT_CLIENT_VERSION\}/g,
      moreSubstitutions.IOS_EXPONENT_CLIENT_VERSION
    );
  }

  await fs.writeFile(pathToOutput, result);
}

/**
 *  @param pathToTemplate path to template Podfile
 *  @param pathToOutput path to render final Podfile
 *  @param moreSubstitutions dictionary of additional substitution keys and values to replace
 *         in the template, such as: TARGET_NAME, REACT_NATIVE_PATH
 */
async function renderPodfileAsync(
  pathToTemplate,
  pathToOutput,
  moreSubstitutions,
  sdkVersion = 'UNVERSIONED'
) {
  if (!moreSubstitutions) {
    moreSubstitutions = {};
  }
  let templatesDirectory = path.dirname(pathToTemplate);
  let templateString = await fs.readFile(pathToTemplate, 'utf8');

  let reactNativePath = moreSubstitutions.REACT_NATIVE_PATH;
  let rnDependencyOptions;
  if (reactNativePath) {
    rnDependencyOptions = { reactNativePath };
  } else {
    rnDependencyOptions = {};
  }

  const expoKitPath = moreSubstitutions.EXPOKIT_PATH;
  const expoKitTag = moreSubstitutions.EXPOKIT_TAG;
  let expoKitDependencyOptions = {};
  if (expoKitPath) {
    expoKitDependencyOptions = { expoKitPath };
  } else if (expoKitTag) {
    expoKitDependencyOptions = { expoKitTag };
  }

  let versionedRnPath = moreSubstitutions.VERSIONED_REACT_NATIVE_PATH;
  if (!versionedRnPath) {
    versionedRnPath = './versioned-react-native';
  }

  let versionedDependencies = await _renderVersionedReactNativeDependenciesAsync(
    templatesDirectory,
    versionedRnPath
  );
  let versionedPostinstalls = await _renderVersionedReactNativePostinstallsAsync(
    templatesDirectory
  );
  let podDependencies = await _renderPodDependenciesAsync(
    path.join(templatesDirectory, 'dependencies.json'),
    { isPodfile: true }
  );

  let substitutions = {
    EXPONENT_CLIENT_DEPS: podDependencies,
    EXPOKIT_DEPENDENCY: _renderExpoKitDependency(expoKitDependencyOptions),
    PODFILE_UNVERSIONED_RN_DEPENDENCY: _renderUnversionedReactNativeDependency(
      rnDependencyOptions,
      sdkVersion
    ),
    PODFILE_UNVERSIONED_POSTINSTALL: _renderUnversionedPostinstall(),
    PODFILE_DETACHED_POSTINSTALL: _renderDetachedPostinstall(sdkVersion),
    PODFILE_VERSIONED_RN_DEPENDENCIES: versionedDependencies,
    PODFILE_VERSIONED_POSTINSTALLS: versionedPostinstalls,
    PODFILE_TEST_TARGET: _renderTestTarget(reactNativePath),
    ...moreSubstitutions,
  };
  _validatePodfileSubstitutions(substitutions);

  let result = templateString;
  for (let key in substitutions) {
    if (substitutions.hasOwnProperty(key)) {
      let replacement = substitutions[key];
      result = result.replace(new RegExp(`\\\$\\\{${key}\\\}`, 'g'), replacement);
    }
  }

  await fs.writeFile(pathToOutput, result);
}

export { renderExpoKitPodspecAsync, renderPodfileAsync };
<commit_msg>Use ExpoOptional in Expo Client, but not in ExpoKit<commit_after>// Copyright 2015-present 650 Industries. All rights reserved.

'use strict';

import fs from 'fs-extra';
import glob from 'glob-promise';
import indentString from 'indent-string';
import JsonFile from '@expo/json-file';
import path from 'path';

import { parseSdkMajorVersion } from './ExponentTools';

function _validatePodfileSubstitutions(substitutions) {
  const validKeys = [
    // a pod dependency on ExpoKit (can be local or remote)
    'EXPOKIT_DEPENDENCY',
    // local path to ExpoKit dependency
    'EXPOKIT_PATH',
    // tag to use for ExpoKit dependency
    'EXPOKIT_TAG',
    // the contents of dependencies.json enumerated as deps in podfile format
    'EXPONENT_CLIENT_DEPS',
    // postinstall for detached projects (defines EX_DETACHED among other things)
    'PODFILE_DETACHED_POSTINSTALL',
    // ExponentIntegrationTests
    'PODFILE_TEST_TARGET',
    // unversioned react native pod dependency, probably at the path given in
    // REACT_NATIVE_PATH, with a bunch of subspecs.
    'PODFILE_UNVERSIONED_RN_DEPENDENCY',
    // postinstall hook for unversioned deps
    'PODFILE_UNVERSIONED_POSTINSTALL',
    // versioned rn dependencies (paths to versioned-react-native directories)
    // read from template files
    'PODFILE_VERSIONED_RN_DEPENDENCIES',
    // versioned rn postinstall hooks read from template files
    'PODFILE_VERSIONED_POSTINSTALLS',
    // list of generated Expo subspecs to include under a versioned react native dependency
    'REACT_NATIVE_EXPO_SUBSPECS',
    // path to use for the unversioned react native dependency
    'REACT_NATIVE_PATH',
    // name of the main build target, e.g. Exponent
    'TARGET_NAME',
    // path from Podfile to versioned-react-native
    'VERSIONED_REACT_NATIVE_PATH',
  ];

  for (const key in substitutions) {
    if (substitutions.hasOwnProperty(key)) {
      if (!validKeys.includes(key)) {
        throw new Error(`Unrecognized Podfile template key: ${key}`);
      }
    }
  }
  return true;
}

function _renderExpoKitDependency(options) {
  let attributes;
  if (options.expoKitPath) {
    attributes = {
      path: options.expoKitPath,
    };
  } else if (options.expoKitTag) {
    attributes = {
      git: 'http://github.com/expo/expo.git',
      tag: options.expoKitTag,
    };
  } else {
    attributes = {
      git: 'http://github.com/expo/expo.git',
      branch: 'master',
    };
  }
  attributes.subspecs = ['Core', 'CPP'];

  let dependency = `pod 'ExpoKit',
${indentString(_renderDependencyAttributes(attributes), 2)}`;

  return indentString(dependency, 2);
}

/**
 * @param sdkVersion if specified, indicates which sdkVersion this project uses
 *  as 'UNVERSIONED', e.g. if we are detaching a sdk15 project, we render
 *  an unversioned dependency pointing at RN#sdk-15.
 */
function _renderUnversionedReactNativeDependency(options, sdkVersion) {
  let sdkMajorVersion = parseSdkMajorVersion(sdkVersion);
  if (sdkMajorVersion === 14) {
    return indentString(
      `
${_renderUnversionedReactDependency(options)}
`,
      2
    );
  } else if (sdkMajorVersion < 21) {
    return indentString(
      `
${_renderUnversionedReactDependency(options, sdkVersion)}
${_renderUnversionedYogaDependency(options, sdkVersion)}
`,
      2
    );
  } else {
    return indentString(
      `
${_renderUnversionedReactDependency(options, sdkVersion)}
${_renderUnversionedYogaDependency(options, sdkVersion)}
${_renderUnversionedThirdPartyDependency(
        'DoubleConversion',
        path.join('third-party-podspecs', 'DoubleConversion.podspec'),
        options
      )}
${_renderUnversionedThirdPartyDependency(
        'Folly',
        path.join('third-party-podspecs', 'Folly.podspec'),
        options
      )}
${_renderUnversionedThirdPartyDependency(
        'GLog',
        path.join('third-party-podspecs', 'GLog.podspec'),
        options
      )}
`,
      2
    );
  }
}

function _renderUnversionedReactDependency(options, sdkVersion) {
  let attributes;
  if (options.reactNativePath) {
    attributes = {
      path: options.reactNativePath,
    };
  } else {
    throw new Error(`Unsupported options for RN dependency: ${options}`);
  }

  attributes.subspecs = [
    'Core',
    'ART',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTCameraRoll',
    'RCTGeolocation',
    'RCTImage',
    'RCTNetwork',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
  ];

  let sdkMajorVersion = parseSdkMajorVersion(sdkVersion);
  if (!(sdkMajorVersion < 16)) {
    attributes.subspecs.push('DevSupport');
  }
  if (!(sdkMajorVersion < 21)) {
    attributes.subspecs.push('CxxBridge');
  } else if (!(sdkMajorVersion < 18)) {
    attributes.subspecs.push('BatchedBridge');
  }

  return `pod 'React',
${indentString(_renderDependencyAttributes(attributes), 2)}`;
}

function _renderUnversionedYogaDependency(options, sdkVersion) {
  let attributes;
  let sdkMajorVersion = parseSdkMajorVersion(sdkVersion);
  if (options.reactNativePath) {
    attributes = {
      path: path.join(
        options.reactNativePath,
        'ReactCommon',
        sdkMajorVersion < 22 ? 'Yoga' : 'yoga'
      ),
    };
  } else {
    throw new Error(`Unsupported options for Yoga dependency: ${options}`);
  }
  return `pod '${sdkMajorVersion < 22 ? 'Yoga' : 'yoga'}',
${indentString(_renderDependencyAttributes(attributes), 2)}`;
}

function _renderUnversionedThirdPartyDependency(podName, podspecRelativePath, options) {
  let attributes;
  if (options.reactNativePath) {
    attributes = {
      podspec: path.join(options.reactNativePath, podspecRelativePath),
      inhibit_warnings: true,
    };
  } else {
    throw new Error(`Unsupported options for ${podName} dependency: ${options}`);
  }
  return `pod '${podName}',
${indentString(_renderDependencyAttributes(attributes), 2)}`;
}

function _renderDependencyAttributes(attributes) {
  let attributesStrings = [];
  for (let key of Object.keys(attributes)) {
    let value = JSON.stringify(attributes[key], null, 2);
    attributesStrings.push(`:${key} => ${value}`);
  }
  return attributesStrings.join(',\n');
}

async function _renderVersionedReactNativeDependenciesAsync(
  templatesDirectory,
  versionedReactNativePath,
  expoSubspecs
) {
  let result = await _concatTemplateFilesInDirectoryAsync(
    path.join(templatesDirectory, 'versioned-react-native', 'dependencies')
  );
  expoSubspecs = expoSubspecs.map(subspec => `'${subspec}'`).join(', ');
  result = result.replace(/\$\{VERSIONED_REACT_NATIVE_PATH\}/g, versionedReactNativePath);
  result = result.replace(/\$\{REACT_NATIVE_EXPO_SUBSPECS\}/g, expoSubspecs);
  return result;
}

async function _renderVersionedReactNativePostinstallsAsync(templatesDirectory) {
  // TODO: write these files with versioning script
  return _concatTemplateFilesInDirectoryAsync(
    path.join(templatesDirectory, 'versioned-react-native', 'postinstalls')
  );
}

async function _concatTemplateFilesInDirectoryAsync(directory) {
  let templateFilenames = await glob(path.join(directory, '*.rb'));
  let templateStrings = [];
  await Promise.all(
    templateFilenames.map(async filename => {
      let templateString = await fs.readFile(filename, 'utf8');
      if (templateString) {
        templateStrings.push(templateString);
      }
    })
  );
  return templateStrings.join('\n');
}

function _renderDetachedPostinstall(sdkVersion) {
  let podsRootSub = '${PODS_ROOT}';
  return `
    if target.pod_name == 'ExpoKit'
      target.native_target.build_configurations.each do |config|
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'EX_DETACHED=1'
        # needed for GoogleMaps 2.x
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= []
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${podsRootSub}/GoogleMaps/Base/Frameworks'
        config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${podsRootSub}/GoogleMaps/Maps/Frameworks'
      end
    end
`;
}

function _renderUnversionedPostinstall() {
  return `
    if target.pod_name == 'AppAuth'
      target.native_target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
      end
    end
    # Build React Native with RCT_DEV enabled
    next unless target.pod_name == 'React'
    target.native_target.build_configurations.each do |config|
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_DEV=1'
    end
`;
}

function _renderTestTarget(reactNativePath) {
  return `
  target 'ExponentIntegrationTests' do
    inherit! :search_paths
  end
`;
}

async function _renderPodDependenciesAsync(dependenciesConfigPath, options) {
  let dependencies = await new JsonFile(dependenciesConfigPath).readAsync();
  let type = options.isPodfile ? 'pod' : 'ss.dependency';
  let depsStrings = dependencies.map(
    dependency => `  ${type} '${dependency.name}', '${dependency.version}'`
  );
  return depsStrings.join('\n');
}

async function renderExpoKitPodspecAsync(pathToTemplate, pathToOutput, moreSubstitutions) {
  let templatesDirectory = path.dirname(pathToTemplate);
  let templateString = await fs.readFile(pathToTemplate, 'utf8');
  let dependencies = await _renderPodDependenciesAsync(
    path.join(templatesDirectory, 'dependencies.json'),
    { isPodfile: false }
  );
  let result = templateString.replace(/\$\{IOS_EXPOKIT_DEPS\}/g, indentString(dependencies, 2));
  if (moreSubstitutions && moreSubstitutions.IOS_EXPONENT_CLIENT_VERSION) {
    result = result.replace(
      /\$\{IOS_EXPONENT_CLIENT_VERSION\}/g,
      moreSubstitutions.IOS_EXPONENT_CLIENT_VERSION
    );
  }

  await fs.writeFile(pathToOutput, result);
}

/**
 *  @param pathToTemplate path to template Podfile
 *  @param pathToOutput path to render final Podfile
 *  @param moreSubstitutions dictionary of additional substitution keys and values to replace
 *         in the template, such as: TARGET_NAME, REACT_NATIVE_PATH
 */
async function renderPodfileAsync(
  pathToTemplate,
  pathToOutput,
  moreSubstitutions,
  sdkVersion = 'UNVERSIONED'
) {
  if (!moreSubstitutions) {
    moreSubstitutions = {};
  }
  let templatesDirectory = path.dirname(pathToTemplate);
  let templateString = await fs.readFile(pathToTemplate, 'utf8');

  let reactNativePath = moreSubstitutions.REACT_NATIVE_PATH;
  let rnDependencyOptions;
  if (reactNativePath) {
    rnDependencyOptions = { reactNativePath };
  } else {
    rnDependencyOptions = {};
  }

  const expoKitPath = moreSubstitutions.EXPOKIT_PATH;
  const expoKitTag = moreSubstitutions.EXPOKIT_TAG;
  let expoKitDependencyOptions = {};
  if (expoKitPath) {
    expoKitDependencyOptions = { expoKitPath };
  } else if (expoKitTag) {
    expoKitDependencyOptions = { expoKitTag };
  }

  let versionedRnPath = moreSubstitutions.VERSIONED_REACT_NATIVE_PATH;
  if (!versionedRnPath) {
    versionedRnPath = './versioned-react-native';
  }
  let rnExpoSubspecs = moreSubstitutions.REACT_NATIVE_EXPO_SUBSPECS;
  if (!rnExpoSubspecs) {
    rnExpoSubspecs = ['Expo'];
  }

  let versionedDependencies = await _renderVersionedReactNativeDependenciesAsync(
    templatesDirectory,
    versionedRnPath,
    rnExpoSubspecs
  );
  let versionedPostinstalls = await _renderVersionedReactNativePostinstallsAsync(
    templatesDirectory
  );
  let podDependencies = await _renderPodDependenciesAsync(
    path.join(templatesDirectory, 'dependencies.json'),
    { isPodfile: true }
  );

  let substitutions = {
    EXPONENT_CLIENT_DEPS: podDependencies,
    EXPOKIT_DEPENDENCY: _renderExpoKitDependency(expoKitDependencyOptions),
    PODFILE_UNVERSIONED_RN_DEPENDENCY: _renderUnversionedReactNativeDependency(
      rnDependencyOptions,
      sdkVersion
    ),
    PODFILE_UNVERSIONED_POSTINSTALL: _renderUnversionedPostinstall(),
    PODFILE_DETACHED_POSTINSTALL: _renderDetachedPostinstall(sdkVersion),
    PODFILE_VERSIONED_RN_DEPENDENCIES: versionedDependencies,
    PODFILE_VERSIONED_POSTINSTALLS: versionedPostinstalls,
    PODFILE_TEST_TARGET: _renderTestTarget(reactNativePath),
    ...moreSubstitutions,
  };
  _validatePodfileSubstitutions(substitutions);

  let result = templateString;
  for (let key in substitutions) {
    if (substitutions.hasOwnProperty(key)) {
      let replacement = substitutions[key];
      result = result.replace(new RegExp(`\\\$\\\{${key}\\\}`, 'g'), replacement);
    }
  }

  await fs.writeFile(pathToOutput, result);
}

export { renderExpoKitPodspecAsync, renderPodfileAsync };
<|endoftext|>


<commit_before>document.addEventListener("DOMContentLoaded", function(){

	var twitchUrl = "https://twitch.tv/"
	var baseAPIUrl = "https://api.twitch.tv/kraken/search/streams?q=";

	var searchForm = document.getElementsByTagName("form")[0];
	searchForm.addEventListener("submit", returnSearchResults);
	var searchBar = searchForm.children[0];
	var searchEntryText = document.getElementById("search-entry")

	var resultsMessage = document.getElementById("results-message");
	var searchResults = document.getElementById("search-results");
	var searchResultsList = document.getElementById("search-results-list");
	var resultsCountText = document.getElementById("results-count");

	var pageIndex = document.getElementById("page-index");
	var currentPageNumber = document.getElementById("current-page-number");
	var totalPageCount = document.getElementById("total-num-pages");
	var nextPageLink = document.getElementsByClassName("next-link")[0];
	var previousPageLink = document.getElementsByClassName("previous-link")[0];
	nextPageLink.addEventListener("click", navigateToPage);
	previousPageLink.addEventListener("click", navigateToPage);

	function navigateToPage(event, url){
		url = typeof url !== "undefined" ? url : this.href;
		event.preventDefault();
		clearSearchResultsList();
		var loadingImage = document.getElementById("loading-image")
		var xmlhttp;
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp =new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp =new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp.onreadystatechange=function()
		  {
		  if(xmlhttp.readyState >= 1 && xmlhttp.readyState <= 3){
		  	if(!loadingImage){
		  	loadingImage = new Image("454", "70");
		  	loadingImage.src = "./imgs/twitching.png";
		  	loadingImage.classList.add("block", "mrg-0-auto");
		  	loadingImage.setAttribute("id", "loading-image");
		  	searchResults.appendChild(loadingImage);
		  	}
		  }
		  if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
		    {
		    searchResults.removeChild(loadingImage);
		    var queryResults = JSON.parse(xmlhttp.responseText);
		    updateResults(queryResults["_total"]);
		    handlePagination(queryResults);

		    var streamResults = queryResults["streams"];
		    streamResults.forEach(function(result){
		    	var newRow = createSearchResultRow(result);
		    	searchResultsList.appendChild(newRow);
		    	newRow.appendChild(createThumbnailImage(result));
		    	var infoBox = createInfoBox(result);
		    	newRow.appendChild(infoBox);
		    })
		    searchResultsList.appendChild(addScrollToTopButton());
		    }
		  else if(xmlhttp.readyState == 4 && xmlhttp.status == 400){
		  	searchResults.removeChild(loadingImage);
		  	updateResults();
		  }
		  }
		xmlhttp.open("GET", url, true);
		xmlhttp.send();
	}

	function clearSearchResultsList(){
		searchResultsList.innerHTML = "";
	}

	function resetSearchBar(){
		searchBar.value = "";
	}

	function returnSearchResults(event){
		resultsMessage.style.visibility = "visible";

		var searchQuery = searchBar.value;
		searchEntryText.innerText = searchQuery
		var url = baseAPIUrl + searchQuery;
		navigateToPage(event, url);
		resetSearchBar();
	}

	function throwNoResultsMessage(){
		toggleDisplay(pageIndex, "none");
		var noResultsMessage = document.createElement("p");
		noResultsMessage.innerText = "Sorry, we couldn't find anything. Try something else!";
		searchResultsList.appendChild(noResultsMessage);
	}

	function updateResults(resultsCount){
		if(resultsCount === 0 || resultsCount === undefined){
			toggleDisplay(resultsMessage, "none")
			throwNoResultsMessage();
			toggleDisplay(previousPageLink, "none");
			toggleDisplay(nextPageLink, "none");
		}
		else{
			toggleDisplay(pageIndex, "inline");
			resultsCountText.innerText = resultsCount;
			toggleDisplay(resultsMessage, "inline")
		}
	}

	function handlePagination(queryResults){
		toggleDisplay(previousPageLink, "none");
		toggleDisplay(nextPageLink, "none");
		if(queryResults["_total"] > 10){
			var indexOfResultPageNumber = queryResults["_links"]["self"].indexOf("offset");

			var indexOfLimitParam = queryResults["_links"]["self"].indexOf("limit");
			var indexOfQueryParam = queryResults["_links"]["self"].indexOf("&q");

			var resultPageNumber = parseInt( (queryResults["_links"]["self"].substring(indexOfResultPageNumber + 7, indexOfQueryParam)) / 10) + 1;
			currentPageNumber.innerText = resultPageNumber;

			var requestLimit = queryResults["_links"]["self"].substring(indexOfLimitParam + 6, indexOfLimitParam + 8);
			var totalNumOfPages = Math.ceil(queryResults["_total"] / requestLimit);
			totalPageCount.innerText = totalNumOfPages;

			if(queryResults["_links"]["next"] && resultPageNumber !== totalNumOfPages){
				toggleDisplay(nextPageLink, "inline");
				nextPageLink.setAttribute("href", queryResults["_links"]["next"]);
			}
			if(queryResults["_links"]["prev"]){
				toggleDisplay(previousPageLink, "inline");
				previousPageLink.setAttribute("href", queryResults["_links"]["prev"]);
			}
		}
	}

	function toggleDisplay(domElement, displayValue){
		domElement.style.display = displayValue;
	}

	function createSearchResultRow(streamObject){
		var resultDiv = document.createElement("div");
		resultDiv.classList.add("row", "w-100");
		return resultDiv;
	}

	function createThumbnailImage(streamObject){
		var thumbnailUrl = streamObject["preview"]["medium"];
		var thumbnailImage = new Image("180", "180");
		thumbnailImage.classList.add("thumbnail-img", "inline-b");
		thumbnailImage.src = thumbnailUrl;
		return thumbnailImage;
	}

	function createInfoBox(streamObject){
		var infoBox = document.createElement("div");
		infoBox.classList.add("info-box", "pos-abs", "mrg-left-20p", "inline-b");
		infoBox.appendChild(renderStreamName(streamObject));
		infoBox.appendChild(renderViewersCount(streamObject));
		infoBox.appendChild(renderStreamDescription(streamObject));
		return infoBox;
	}

	function renderStreamName(streamObject){
		var streamName = document.createElement("h3");
		streamName.classList.add("mrg-top-0", "pad-right-40p");
		var streamLink = document.createElement("a")
		streamLink.setAttribute("href", twitchUrl + streamObject["channel"]["display_name"]);
		streamLink.classList.add("link", "twitch-color");
		streamLink.innerText = streamObject["channel"]["status"];
		streamName.appendChild(streamLink);
		return streamName;
	}

	function renderViewersCount(streamObject){
		var viewersCount = document.createElement("p");
		viewersCount.innerText = streamObject.game + " - " + streamObject.viewers + " viewers";
		return viewersCount;
	}

	function renderStreamDescription(streamObject){
		var streamDescription = document.createElement("p");
		streamDescription.classList.add("stream-description")
		var channelName = streamObject["channel"]["display_name"];
		var gameName = streamObject["channel"]["game"];
		streamDescription.innerText = channelName + " playing " + gameName;
		streamDescription.setAttribute("id", channelName)
		return streamDescription;
	}

	function addScrollToTopButton(){
		var scrollButton = document.createElement("button")
		scrollButton.classList.add("page-button", "fl-right", "twitch-color", "link", "mrg-top-60p", "mrg-bot-60p");
		scrollButton.innerText = "^";
		scrollButton.addEventListener("click", scrollToTop);
		return scrollButton;
	}

	function scrollToTop(event){
		event.preventDefault();
		window.scrollTo(0, 0)
	}

})
<commit_msg>Continue setting up logic to prepare channel profile tooltip.<commit_after>document.addEventListener("DOMContentLoaded", function(){

	var twitchUrl = "https://twitch.tv/"
	var baseAPIUrl = "https://api.twitch.tv/kraken/search/streams?q=";
	var baseChannelAPIUrl = "https://api.twitch.tv/kraken/channels/"

	var searchForm = document.getElementsByTagName("form")[0];
	searchForm.addEventListener("submit", returnSearchResults);
	var searchBar = searchForm.children[0];
	var searchEntryText = document.getElementById("search-entry")

	var resultsMessage = document.getElementById("results-message");
	var searchResults = document.getElementById("search-results");
	var searchResultsList = document.getElementById("search-results-list");
	var resultsCountText = document.getElementById("results-count");

	var pageIndex = document.getElementById("page-index");
	var currentPageNumber = document.getElementById("current-page-number");
	var totalPageCount = document.getElementById("total-num-pages");
	var nextPageLink = document.getElementsByClassName("next-link")[0];
	var previousPageLink = document.getElementsByClassName("previous-link")[0];
	nextPageLink.addEventListener("click", navigateToPage);
	previousPageLink.addEventListener("click", navigateToPage);

	function navigateToPage(event, url){
		url = typeof url !== "undefined" ? url : this.href;
		event.preventDefault();
		clearSearchResultsList();
		var loadingImage = document.getElementById("loading-image")
		var xmlhttp;
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp =new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp =new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp.onreadystatechange=function()
		  {
		  if(xmlhttp.readyState >= 1 && xmlhttp.readyState <= 3){
		  	if(!loadingImage){
		  	loadingImage = new Image("454", "70");
		  	loadingImage.src = "./imgs/twitching.png";
		  	loadingImage.classList.add("block", "mrg-0-auto");
		  	loadingImage.setAttribute("id", "loading-image");
		  	searchResults.appendChild(loadingImage);
		  	}
		  }
		  if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
		    {
		    searchResults.removeChild(loadingImage);
		    var queryResults = JSON.parse(xmlhttp.responseText);
		    updateResults(queryResults["_total"]);
		    handlePagination(queryResults);

		    var streamResults = queryResults["streams"];
		    streamResults.forEach(function(result){
		    	var newRow = createSearchResultRow(result);
		    	searchResultsList.appendChild(newRow);
		    	newRow.appendChild(createThumbnailImage(result));
		    	var infoBox = createInfoBox(result);
		    	newRow.appendChild(infoBox);
		    })
		    searchResultsList.appendChild(addScrollToTopButton());
		    }
		  else if(xmlhttp.readyState == 4 && xmlhttp.status == 400){
		  	searchResults.removeChild(loadingImage);
		  	updateResults();
		  }
		  }
		xmlhttp.open("GET", url, true);
		xmlhttp.send();
	}

	function clearSearchResultsList(){
		searchResultsList.innerHTML = "";
	}

	function resetSearchBar(){
		searchBar.value = "";
	}

	function returnSearchResults(event){
		resultsMessage.style.visibility = "visible";

		var searchQuery = searchBar.value;
		searchEntryText.innerText = searchQuery
		var url = baseAPIUrl + searchQuery;
		navigateToPage(event, url);
		resetSearchBar();
	}

	function throwNoResultsMessage(){
		toggleDisplay(pageIndex, "none");
		var noResultsMessage = document.createElement("p");
		noResultsMessage.innerText = "Sorry, we couldn't find anything. Try something else!";
		searchResultsList.appendChild(noResultsMessage);
	}

	function updateResults(resultsCount){
		if(resultsCount === 0 || resultsCount === undefined){
			toggleDisplay(resultsMessage, "none")
			throwNoResultsMessage();
			toggleDisplay(previousPageLink, "none");
			toggleDisplay(nextPageLink, "none");
		}
		else{
			toggleDisplay(pageIndex, "inline");
			resultsCountText.innerText = resultsCount;
			toggleDisplay(resultsMessage, "inline")
		}
	}

	function handlePagination(queryResults){
		toggleDisplay(previousPageLink, "none");
		toggleDisplay(nextPageLink, "none");
		if(queryResults["_total"] > 10){
			var indexOfResultPageNumber = queryResults["_links"]["self"].indexOf("offset");

			var indexOfLimitParam = queryResults["_links"]["self"].indexOf("limit");
			var indexOfQueryParam = queryResults["_links"]["self"].indexOf("&q");

			var resultPageNumber = parseInt( (queryResults["_links"]["self"].substring(indexOfResultPageNumber + 7, indexOfQueryParam)) / 10) + 1;
			currentPageNumber.innerText = resultPageNumber;

			var requestLimit = queryResults["_links"]["self"].substring(indexOfLimitParam + 6, indexOfLimitParam + 8);
			var totalNumOfPages = Math.ceil(queryResults["_total"] / requestLimit);
			totalPageCount.innerText = totalNumOfPages;

			if(queryResults["_links"]["next"] && resultPageNumber !== totalNumOfPages){
				toggleDisplay(nextPageLink, "inline");
				nextPageLink.setAttribute("href", queryResults["_links"]["next"]);
			}
			if(queryResults["_links"]["prev"]){
				toggleDisplay(previousPageLink, "inline");
				previousPageLink.setAttribute("href", queryResults["_links"]["prev"]);
			}
		}
	}

	function toggleDisplay(domElement, displayValue){
		domElement.style.display = displayValue;
	}

	function createSearchResultRow(streamObject){
		var resultDiv = document.createElement("div");
		resultDiv.classList.add("row", "w-100");
		return resultDiv;
	}

	function createThumbnailImage(streamObject){
		var thumbnailUrl = streamObject["preview"]["medium"];
		var thumbnailImage = new Image("180", "180");
		thumbnailImage.classList.add("thumbnail-img", "inline-b");
		thumbnailImage.src = thumbnailUrl;
		return thumbnailImage;
	}

	function createInfoBox(streamObject){
		var infoBox = document.createElement("div");
		infoBox.classList.add("info-box", "pos-abs", "mrg-left-20p", "inline-b");
		infoBox.appendChild(renderStreamName(streamObject));
		infoBox.appendChild(renderViewersCount(streamObject));
		infoBox.appendChild(renderStreamDescription(streamObject));
		return infoBox;
	}

	function renderStreamName(streamObject){
		var streamName = document.createElement("h3");
		streamName.classList.add("mrg-top-0", "pad-right-40p");
		var streamLink = document.createElement("a")
		streamLink.setAttribute("href", twitchUrl + streamObject["channel"]["display_name"]);
		streamLink.classList.add("link", "twitch-color");
		streamLink.innerText = streamObject["channel"]["status"];
		streamName.appendChild(streamLink);
		return streamName;
	}

	function renderViewersCount(streamObject){
		var viewersCount = document.createElement("p");
		viewersCount.innerText = streamObject.game + " - " + streamObject.viewers + " viewers";
		return viewersCount;
	}

	function renderStreamDescription(streamObject){
		var streamDescription = document.createElement("p");
		streamDescription.classList.add("stream-description")
		var channelName = streamObject["channel"]["display_name"];
		var gameName = streamObject["channel"]["game"];
		streamDescription.innerText = channelName + " playing " + gameName;
		streamDescription.setAttribute("id", channelName)
		streamDescription.addEventListener("mouseover", addTooltip)
		return streamDescription;
	}

	function addScrollToTopButton(){
		var scrollButton = document.createElement("button")
		scrollButton.classList.add("page-button", "fl-right", "twitch-color", "link", "mrg-top-60p", "mrg-bot-60p");
		scrollButton.innerText = "^";
		scrollButton.addEventListener("click", scrollToTop);
		return scrollButton;
	}

	function scrollToTop(event){
		event.preventDefault();
		window.scrollTo(0, 0)
	}

	function addTooltip(){
		var tooltip = document.createElement('span')
		tooltip.style.backgroundColor = 'red'
		tooltip.style.position = 'relative'
		tooltip.style.height = '200px'
		tooltip.style.width = '200px'
		tooltip.innerText = 'hi'
		tooltip.style.zIndex = '1'
		tooltip.style.display = 'visible'
		this.appendChild(tooltip)
	}
})
<|endoftext|>


<commit_before>/**
 * @class Denkmal_Page_Events
 * @extends Denkmal_Page_Abstract
 */
var Denkmal_Page_Events = Denkmal_Page_Abstract.extend({

  /** @type String */
  _class: 'Denkmal_Page_Events',

  /** @type SwipeCarousel */
  _carousel: null,

  _stateParams: ['date'],

  events: {
    'swipeCarousel-change .swipeCarousel': function(event, data) {
      var delaySetUrl = !data.immediateSetUrl;
      this._onShowPane($(data.element), delaySetUrl);
    }
  },

  childrenEvents: {
    'Denkmal_Component_Event toggleDetails-open': function(view) {
      view.$el.closest('.scrollable').scrollTo(view.$el);
    }
  },

  ready: function() {
    this._onShowPaneSetUrlDelayed = _.debounce(this._onShowPaneSetUrl, 2000);

    var $carousel = this.$('.swipeCarousel');
    this._carousel = new SwipeCarousel($carousel);
    this._carousel.init();

    var self = this;
    this.on('destruct', function() {
      self._carousel.destroy();
    });

    this.on('swipe', function() {
      _.each(this.getChildren('Denkmal_Component_EventList'), function(eventListView) {
        eventListView.closeAllEvents();
      });
    });
  },

  /**
   * @param {String} date
   * @returns Boolean
   */
  showPane: function(date) {
    var $element = this.$('.dateList > .date[data-date="' + date + '"]');
    if ($element.length) {
      this._carousel.showPane($element.index(), {immediateSetUrl: true}, !Modernizr.touchevents);
      this._onShowPane($element);
      return true;
    } else {
      return false;
    }
  },

  /**
   * @param {jQuery} $element
   * @param {Boolean} [delaySetUrl]
   */
  _onShowPane: function($element, delaySetUrl) {
    var title = $element.data('title');
    var url = $element.data('url');
    var date = $element.data('date');
    var menuEntryHash = $element.data('menu-hash');

    cm.getLayout()._onPageSetup(title, [menuEntryHash]);

    if (delaySetUrl) {
      this._onShowPaneSetUrlDelayed(url, date);
    } else {
      this._onShowPaneSetUrl(url, date);
    }

    this.trigger('swipe', $element);
  },

  /**
   * @param {String} url
   * @param {String} date
   */
  _onShowPaneSetUrl: function(url, date) {
    if (!$.contains(document, this.el)) {
      return; // View has been destroyed in the meantime
    }
    var nextState = {date: date};
    if (!_.isEqual(nextState, this.getState())) {
      cm.router.pushState(url);
      this.setState(nextState);
    }
  },

  /**
   * @param {Boolean} state
   */
  _changeState: function(state) {
    var date = state['date'];
    if (!date) {
      date = this.$('.dateList > .date:first').data('date');
      this.setState({date: date});
    }
    return this.showPane(date);
  }
});
<commit_msg>Make banner dismissable<commit_after>/**
 * @class Denkmal_Page_Events
 * @extends Denkmal_Page_Abstract
 */
var Denkmal_Page_Events = Denkmal_Page_Abstract.extend({

  /** @type String */
  _class: 'Denkmal_Page_Events',

  /** @type SwipeCarousel */
  _carousel: null,

  _stateParams: ['date'],

  events: {
    'swipeCarousel-change .swipeCarousel': function(event, data) {
      var delaySetUrl = !data.immediateSetUrl;
      this._onShowPane($(data.element), delaySetUrl);
    },

    'click .dismissBanner': function(event) {
      $(event.currentTarget).closest('.banner').slideUp();
    }
  },

  childrenEvents: {
    'Denkmal_Component_Event toggleDetails-open': function(view) {
      view.$el.closest('.scrollable').scrollTo(view.$el);
    }
  },

  ready: function() {
    this._onShowPaneSetUrlDelayed = _.debounce(this._onShowPaneSetUrl, 2000);

    var $carousel = this.$('.swipeCarousel');
    this._carousel = new SwipeCarousel($carousel);
    this._carousel.init();

    var self = this;
    this.on('destruct', function() {
      self._carousel.destroy();
    });

    this.on('swipe', function() {
      _.each(this.getChildren('Denkmal_Component_EventList'), function(eventListView) {
        eventListView.closeAllEvents();
      });
    });
  },

  /**
   * @param {String} date
   * @returns Boolean
   */
  showPane: function(date) {
    var $element = this.$('.dateList > .date[data-date="' + date + '"]');
    if ($element.length) {
      this._carousel.showPane($element.index(), {immediateSetUrl: true}, !Modernizr.touchevents);
      this._onShowPane($element);
      return true;
    } else {
      return false;
    }
  },

  /**
   * @param {jQuery} $element
   * @param {Boolean} [delaySetUrl]
   */
  _onShowPane: function($element, delaySetUrl) {
    var title = $element.data('title');
    var url = $element.data('url');
    var date = $element.data('date');
    var menuEntryHash = $element.data('menu-hash');

    cm.getLayout()._onPageSetup(title, [menuEntryHash]);

    if (delaySetUrl) {
      this._onShowPaneSetUrlDelayed(url, date);
    } else {
      this._onShowPaneSetUrl(url, date);
    }

    this.trigger('swipe', $element);
  },

  /**
   * @param {String} url
   * @param {String} date
   */
  _onShowPaneSetUrl: function(url, date) {
    if (!$.contains(document, this.el)) {
      return; // View has been destroyed in the meantime
    }
    var nextState = {date: date};
    if (!_.isEqual(nextState, this.getState())) {
      cm.router.pushState(url);
      this.setState(nextState);
    }
  },

  /**
   * @param {Boolean} state
   */
  _changeState: function(state) {
    var date = state['date'];
    if (!date) {
      date = this.$('.dateList > .date:first').data('date');
      this.setState({date: date});
    }
    return this.showPane(date);
  }
});
<|endoftext|>


<commit_before>//     telegram-tl-node
//     Copyright 2014 Enrico Stara 'enrico.stara@gmail.com'
//     Released under the MIT License
//     https://github.com/enricostara/telegram-tl-node

//     TypeVector class
//
// This class is the `TypeLanguage` List implementation, a sub-class of the `TypeObject` class

// Import dependencies
var util = require('util');
var TypeObject = require('./type-object');
var TypeBuilder = require('./type-builder');

// TypeVector extends TypeObject
util.inherits(TypeVector, TypeObject);

// To get an instance for `serialization`:
//
//      new TypeVector({type: 'long', list: [1,2,3]});
// Provide the `list` property to fill the vector and the type of the content, `int` is the default:
//
// To get an instance for `de-serialization`:
//
//      new TypeVector({type: 'int128', buffer: myBuffer, offset: currentPosition});
// Provide a `buffer` and eventually an `offset` where start
//
// The `constructor`:
function TypeVector(options) {
    var opts = util._extend({ type: 'int'}, options);
    this.constructor.super_.call(this, opts.buffer, opts.offset);
    this.id = '15c4b51c';
    manageType.call(this, opts.type);
    this._list = !opts.list ? [] : opts.list;
    this.constructor.logger = require('get-log')('TypeVector');
}

function manageType (type) {
    var isBare = type.charAt(0) === '%';
    type = isBare ? type.slice(1) : type;
    if(type.charAt(0) === type.charAt(0).toUpperCase()) {
        // Manage Object type
        this.type = type;
        this['write' + type] = function(obj) {
            this._writeBytes(obj.serialize({isBare: isBare}));
        };
        this['read' + type] = function() {
            var Type = TypeBuilder.requireTypeByName(type);
            return new Type({buffer: this._buffer, offset: this.getReadOffset()}).deserialize({isBare: isBare}, true);
        };
    } else {
        // Manage primitive type
        this.type = type.charAt(0).toUpperCase() + type.slice(1);
    }
}

// The method de-serializes the list starting from the initialized buffer
TypeVector.prototype.deserialize = function () {
    if (!this.constructor.super_.prototype.deserialize.call(this)) {
        return false;
    }
    var listLength = this.readInt();
    for (var i = 0; i < listLength; i++) {
        this._list[i] = this['read' + this.type]();
    }
    return this;
};

// The method serializes the list starting from the initialized buffer
TypeVector.prototype.serialize = function () {
    if (!this.constructor.super_.prototype.serialize.call(this)) {
        return false;
    }
    var listLength = this._list.length;
    this.writeInt(listLength);
    for (var i = 0; i < listLength; i++) {
        this['write' + this.type](this._list[i]);
    }
    return this.retrieveBuffer();
};

// The method retrieves a copy of the internal list
TypeVector.prototype.getList = function () {
    return this._list.slice();
};

// Export the class
module.exports = exports = TypeVector;

<commit_msg>Add 'options' param on calling super.serialize() and super.deserialize() in TypeVector<commit_after>//     telegram-tl-node
//     Copyright 2014 Enrico Stara 'enrico.stara@gmail.com'
//     Released under the MIT License
//     https://github.com/enricostara/telegram-tl-node

//     TypeVector class
//
// This class is the `TypeLanguage` List implementation, a sub-class of the `TypeObject` class

// Import dependencies
var util = require('util');
var TypeObject = require('./type-object');
var TypeBuilder = require('./type-builder');

// TypeVector extends TypeObject
util.inherits(TypeVector, TypeObject);

// To get an instance for `serialization`:
//
//      new TypeVector({type: 'long', list: [1,2,3]});
// Provide the `list` property to fill the vector and the type of the content, `int` is the default:
//
// To get an instance for `de-serialization`:
//
//      new TypeVector({type: 'int128', buffer: myBuffer, offset: currentPosition});
// Provide a `buffer` and eventually an `offset` where start
//
// The `constructor`:
function TypeVector(options) {
    var opts = util._extend({ type: 'int'}, options);
    this.constructor.super_.call(this, opts.buffer, opts.offset);
    this.id = '15c4b51c';
    manageType.call(this, opts.type);
    this._list = !opts.list ? [] : opts.list;
    this.constructor.logger = require('get-log')('TypeVector');
}

function manageType (type) {
    var isBare = type.charAt(0) === '%';
    type = isBare ? type.slice(1) : type;
    if(type.charAt(0) === type.charAt(0).toUpperCase()) {
        // Manage Object type
        this.type = type;
        this['write' + type] = function(obj) {
            this._writeBytes(obj.serialize({isBare: isBare}));
        };
        this['read' + type] = function() {
            var Type = TypeBuilder.requireTypeByName(type);
            return new Type({buffer: this._buffer, offset: this.getReadOffset()}).deserialize({isBare: isBare}, true);
        };
    } else {
        // Manage primitive type
        this.type = type.charAt(0).toUpperCase() + type.slice(1);
    }
}

// The method de-serializes the list starting from the initialized buffer
TypeVector.prototype.deserialize = function (options) {
    if (!this.constructor.super_.prototype.deserialize.call(this, options)) {
        return false;
    }
    var listLength = this.readInt();
    for (var i = 0; i < listLength; i++) {
        this._list[i] = this['read' + this.type]();
    }
    return this;
};

// The method serializes the list starting from the initialized buffer
TypeVector.prototype.serialize = function (options) {
    if (!this.constructor.super_.prototype.serialize.call(this, options)) {
        return false;
    }
    var listLength = this._list.length;
    this.writeInt(listLength);
    for (var i = 0; i < listLength; i++) {
        this['write' + this.type](this._list[i]);
    }
    return this.retrieveBuffer();
};

// The method retrieves a copy of the internal list
TypeVector.prototype.getList = function () {
    return this._list.slice();
};

// Export the class
module.exports = exports = TypeVector;

<|endoftext|>


<commit_before>/*
 * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 *
 */

/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define */

define({
    "GENERATE_INSPECT_CONTROLS"                              : "edgeinspect.handleinspectcontrols",

   // for inspect
    "INSPECT_BUTTON"                                         : "Adobe Edge Inspect CC",
    "INSPECT_waiting"                                        : "Waiting for a connection...",
    "INSPECT_syncbrowseoff"                                  : "Synchronized Browsing is off.",
    "INSPECT_dmerror"                                        : "Please start the Edge Inspect CC Application...",
    "INSPECT_getedgeinspect"                                 : "Get Edge Inspect CC.",
    "INSPECT_dmexpired"                                      : "Edge Inspect CC Has Expired. Please Download a new version.",
    "INSPECT_subscriptionexpiredPrefix"                      : "You no longer have access to Edge Inspect CC full version features.",
    "INSPECT_subscriptionexpiredSuffix"                      : " or continue with limited features.",
    "INSPECT_screenshotsarepremiumPrefix"                    : "Screenshots are an Edge Inspect CC full version feature.",
    "INSPECT_seconddeviceispremiumPrefix"                    : "Use of multiple devices is an Edge Inspect CC full version feature.",
    "INSPECT_renewlink"                                      : "Renew now",
    "INSPECT_upgradelink"                                    : "Upgrade now to connect multiple devices concurrently.",
    "INSPECT_buyitnowPrefix"                                 : "You are currently using Edge Inspect CC Free. Login or ",
    "INSPECT_upgrade"                                        : "Upgrade",
    "INSPECT_buyitnowSuffix"                                 : " to use the Full version.",
    "INSPECT_shadmessagePrefix"                              : "Help us improve by filling out",
    "INSPECT_shadmessageSuffix"                              : "this two-question survey",
    "INSPECT_welcomemessage"                                 : "This is a friendly reminder to let you know that a major update is coming soon; all $arg1$ apps must be updated in order to work.",
    "INSPECT_welcomeaction"                                  : "Continue",
    "INSPECT_feedback"                                       : "Satisfied with Edge Inspect CC?",
    "INSPECT_remove"                                         : "Authorized Devices",
    "INSPECT_problems"                                       : "Need help?",
    "INSPECT_removetext"                                     : "Deauthorize a device to prevent automatic reconnection.",
    "INSPECT_cancelscreenshot"                               : "Cancel transfer",
    "INSPECT_completedscreenshot"                            : "Screenshot(s) transferred",
    "INSPECT_downloadiso"                                    : "Edge Inspect CC for iPad®, iPhone® and iPod®...",
    "INSPECT_downloadandroid"                                : "Edge Inspect CC for Android™ devices...",
    "INSPECT_downloadamazon"                                 : "Edge Inspect CC for Kindle devices...",
    "INSPECT_emptylog"                                       : "Clear",
    "INSPECT_versioninfo"                                    : "DM Build: ",
    "INSPECT_screenshotsfoldertitle"                         : "Screenshots Folder",
    "INSPECT_change"                                         : "Change",
    "INSPECT_logtitle"                                       : "Log",
    "INSPECT_weinretitle"                                    : "weinre Server",
    "INSPECT_weinredefault"                                  : "Default (Adobe)",
    "INSPECT_weinrecustom"                                   : "Custom",
    "INSPECT_weinreexample"                                  : "e.g., localhost:8080, or 172.18.5.4:8081",
    "INSPECT_save"                                           : "Save",
    "INSPECT_edit"                                           : "Edit",
    "INSPECT_remove_tt"                                      : "Remove",
    "INSPECT_disconnect_tt"                                  : "Disconnect",
    "INSPECT_default_passcode"                               : "Passcode",
    "INSPECT_cancel_tt"                                      : "Cancel",
    "INSPECT_deauthorize_tt"                                 : "De-Authorize",
    "INSPECT_authorize_tt"                                   : "Authorize",
    "INSPECT_remoteinspect_tt"                               : "Remote Inspection",
    "INSPECT_progress_tt"                                    : "Screenshot progress",
    "INSPECT_screenshotfolder_tt"                            : "Open folder containing screenshots",
    "INSPECT_screenshot_tt"                                  : "Request screenshots",
    "INSPECT_forcerefresh_tt"                                : "Refresh all devices",
    "INSPECT_showchrome_tt"                                  : "Exit full screen on devices",
    "INSPECT_fullscreen_tt"                                  : "Show full screen on devices",
    "INSPECT_browsingon_tt"                                  : "Turn Off Synchronized Browsing",
    "INSPECT_browsingtooltipNoDM_tt"                         : "Disabled",
    "INSPECT_browsingoff_tt"                                 : "Turn On Synchronized Browsing",
    "INSPECT_gettingstartedintroheader"                      : "Edge Inspect CC Getting Started Guide",
    "INSPECT_gettingstartedintro"                            : "Edge Inspect CC is for web designers and developers targeting mobile browsers. After installing Edge Inspect, you will be able to pair devices, have them browse in sync with your computer, perform remote inspection/debugging and see HTML/CSS/JavaScript changes instantly on your device. ",
    "INSPECT_gettingstartedsamenetworkheader"                : "1. Ensure Devices are on the Same Network",
    "INSPECT_gettingstartedsamenetwork"                      : "Edge Inspect requires your computer and devices to be on the same network. Computer and devices must be on the same subnet for auto-discovery. If you cannot see your computer, try a Manual Connection.",
    "INSPECT_gettingstartedconnectingheader"                 : "2. Connecting Devices to computer",
    "INSPECT_gettingstartedconnectingautodiscoveryheader"    : "A. Auto-Discovery",
    "INSPECT_gettingstartedconnectingautodiscovery"          : "The device running Edge Inspect will look for computers also running Edge Inspect. Tap the computer you would like to connect to. Enter the passcode into the Chrome Extension. This creates a wireless connection between your computer and device",
    "INSPECT_gettingstartedconnectingmanualconnectionheader" : "B. Manual Connection",
    "INSPECT_gettingstartedconnectingmanualconnectionp1"     : "If you can't find the computer you want to connect to, tap the \"+\" button to perform a Manual Connect. A list of IP Addresses associated with your computer is located at the bottom of the Chrome Extension. Insert the IP Address into the text field on the device.",
    "INSPECT_gettingstartedconnectingmanualconnectionp2"     : "When a device is connected, Edge Inspect CC will prevent the screen from dimming or going to sleep.",
    "INSPECT_gettingstartedremoteinspectionheader"           : "3. Inspecting & debugging the page on your device",
    "INSPECT_gettingstartedremoteinspection"                 : " In the Chrome Extension, click on the \"< >\" button next to the device you'd like to inspect or debug and the Developer Tools window will open; you can use remote inspection on one device at a time."
});
<commit_msg>Change the toolbar hover text according to PM direction.<commit_after>/*
 * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 *
 */

/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define */

define({
    "GENERATE_INSPECT_CONTROLS"                              : "edgeinspect.handleinspectcontrols",

   // for inspect
    "INSPECT_BUTTON"                                         : "Preview on devices using Edge Inspect CC",
    "INSPECT_waiting"                                        : "Waiting for a connection...",
    "INSPECT_syncbrowseoff"                                  : "Synchronized Browsing is off.",
    "INSPECT_dmerror"                                        : "Please start the Edge Inspect CC Application...",
    "INSPECT_getedgeinspect"                                 : "Get Edge Inspect CC.",
    "INSPECT_dmexpired"                                      : "Edge Inspect CC Has Expired. Please Download a new version.",
    "INSPECT_subscriptionexpiredPrefix"                      : "You no longer have access to Edge Inspect CC full version features.",
    "INSPECT_subscriptionexpiredSuffix"                      : " or continue with limited features.",
    "INSPECT_screenshotsarepremiumPrefix"                    : "Screenshots are an Edge Inspect CC full version feature.",
    "INSPECT_seconddeviceispremiumPrefix"                    : "Use of multiple devices is an Edge Inspect CC full version feature.",
    "INSPECT_renewlink"                                      : "Renew now",
    "INSPECT_upgradelink"                                    : "Upgrade now to connect multiple devices concurrently.",
    "INSPECT_buyitnowPrefix"                                 : "You are currently using Edge Inspect CC Free. Login or ",
    "INSPECT_upgrade"                                        : "Upgrade",
    "INSPECT_buyitnowSuffix"                                 : " to use the Full version.",
    "INSPECT_shadmessagePrefix"                              : "Help us improve by filling out",
    "INSPECT_shadmessageSuffix"                              : "this two-question survey",
    "INSPECT_welcomemessage"                                 : "This is a friendly reminder to let you know that a major update is coming soon; all $arg1$ apps must be updated in order to work.",
    "INSPECT_welcomeaction"                                  : "Continue",
    "INSPECT_feedback"                                       : "Satisfied with Edge Inspect CC?",
    "INSPECT_remove"                                         : "Authorized Devices",
    "INSPECT_problems"                                       : "Need help?",
    "INSPECT_removetext"                                     : "Deauthorize a device to prevent automatic reconnection.",
    "INSPECT_cancelscreenshot"                               : "Cancel transfer",
    "INSPECT_completedscreenshot"                            : "Screenshot(s) transferred",
    "INSPECT_downloadiso"                                    : "Edge Inspect CC for iPad®, iPhone® and iPod®...",
    "INSPECT_downloadandroid"                                : "Edge Inspect CC for Android™ devices...",
    "INSPECT_downloadamazon"                                 : "Edge Inspect CC for Kindle devices...",
    "INSPECT_emptylog"                                       : "Clear",
    "INSPECT_versioninfo"                                    : "DM Build: ",
    "INSPECT_screenshotsfoldertitle"                         : "Screenshots Folder",
    "INSPECT_change"                                         : "Change",
    "INSPECT_logtitle"                                       : "Log",
    "INSPECT_weinretitle"                                    : "weinre Server",
    "INSPECT_weinredefault"                                  : "Default (Adobe)",
    "INSPECT_weinrecustom"                                   : "Custom",
    "INSPECT_weinreexample"                                  : "e.g., localhost:8080, or 172.18.5.4:8081",
    "INSPECT_save"                                           : "Save",
    "INSPECT_edit"                                           : "Edit",
    "INSPECT_remove_tt"                                      : "Remove",
    "INSPECT_disconnect_tt"                                  : "Disconnect",
    "INSPECT_default_passcode"                               : "Passcode",
    "INSPECT_cancel_tt"                                      : "Cancel",
    "INSPECT_deauthorize_tt"                                 : "De-Authorize",
    "INSPECT_authorize_tt"                                   : "Authorize",
    "INSPECT_remoteinspect_tt"                               : "Remote Inspection",
    "INSPECT_progress_tt"                                    : "Screenshot progress",
    "INSPECT_screenshotfolder_tt"                            : "Open folder containing screenshots",
    "INSPECT_screenshot_tt"                                  : "Request screenshots",
    "INSPECT_forcerefresh_tt"                                : "Refresh all devices",
    "INSPECT_showchrome_tt"                                  : "Exit full screen on devices",
    "INSPECT_fullscreen_tt"                                  : "Show full screen on devices",
    "INSPECT_browsingon_tt"                                  : "Turn Off Synchronized Browsing",
    "INSPECT_browsingtooltipNoDM_tt"                         : "Disabled",
    "INSPECT_browsingoff_tt"                                 : "Turn On Synchronized Browsing",
    "INSPECT_gettingstartedintroheader"                      : "Edge Inspect CC Getting Started Guide",
    "INSPECT_gettingstartedintro"                            : "Edge Inspect CC is for web designers and developers targeting mobile browsers. After installing Edge Inspect, you will be able to pair devices, have them browse in sync with your computer, perform remote inspection/debugging and see HTML/CSS/JavaScript changes instantly on your device. ",
    "INSPECT_gettingstartedsamenetworkheader"                : "1. Ensure Devices are on the Same Network",
    "INSPECT_gettingstartedsamenetwork"                      : "Edge Inspect requires your computer and devices to be on the same network. Computer and devices must be on the same subnet for auto-discovery. If you cannot see your computer, try a Manual Connection.",
    "INSPECT_gettingstartedconnectingheader"                 : "2. Connecting Devices to computer",
    "INSPECT_gettingstartedconnectingautodiscoveryheader"    : "A. Auto-Discovery",
    "INSPECT_gettingstartedconnectingautodiscovery"          : "The device running Edge Inspect will look for computers also running Edge Inspect. Tap the computer you would like to connect to. Enter the passcode into the Chrome Extension. This creates a wireless connection between your computer and device",
    "INSPECT_gettingstartedconnectingmanualconnectionheader" : "B. Manual Connection",
    "INSPECT_gettingstartedconnectingmanualconnectionp1"     : "If you can't find the computer you want to connect to, tap the \"+\" button to perform a Manual Connect. A list of IP Addresses associated with your computer is located at the bottom of the Chrome Extension. Insert the IP Address into the text field on the device.",
    "INSPECT_gettingstartedconnectingmanualconnectionp2"     : "When a device is connected, Edge Inspect CC will prevent the screen from dimming or going to sleep.",
    "INSPECT_gettingstartedremoteinspectionheader"           : "3. Inspecting & debugging the page on your device",
    "INSPECT_gettingstartedremoteinspection"                 : " In the Chrome Extension, click on the \"< >\" button next to the device you'd like to inspect or debug and the Developer Tools window will open; you can use remote inspection on one device at a time."
});
<|endoftext|>


<commit_before>var Style = Backbone.Model.extend({

    defaults: {

        // Style selected (expanded).
        selected: false,

        // Apply CSS rule.
        active: true,

        // Highlight selected elements.
        highlight: false,

        // Selector used in CSS rule.
        selector: '',

        // Properties below control the CSS output.
        // If a property is enabled, the value is applied to the CSS rule.

        family: '',
        familyEnabled: true,

        weight: '',
        weightEnabled: false,

        fontSize: '16px',
        fontSizeEnabled: false,

        fontStyle: '',
        fontStyleEnabled: false,

        color: '#00f',
        colorEnabled: false,

        lineHeight: '1.5',
        lineHeightEnabled: false,

        textAlign: 'left',
        textAlignEnabled: false,

        textTransform: '',
        textTransformEnabled: false,

        letterSpacing: '0',
        letterSpacingEnabled: false

    },

    initialize: function() {
        this.rule = stylesheet.newRule();
        this.on('change toggle temporary', this.updateCSS);
        this.on('toggle:selected', function(value) {
            var evt = value ? 'select' : 'deselect';
            this.trigger(evt);
        });
        this.on('destroy', function() {
            this.rule.destroy();
        });
    },

    getState: function() {
        return _.clone(this.attributes);
    },

    css: {
        family:        'font-family: %value%',
        weight:        'font-weight: %value%',
        fontSize:      'font-size: %value%',
        fontStyle:     'font-style: %value%',
        color:         'color: %value%',
        lineHeight:    'line-height: %value%',
        textAlign:     'text-align: %value%',
        textTransform: 'text-transform: %value%',
        letterSpacing: 'letter-spacing: %value%',
        highlight:     'text-shadow: 0 0 5px rgba(255, 255, 255, 0.85), 0 0 10px rgba(0, 125, 255, 0.85), 0 0 20px #0CF, 0 0 30px #FFF'
    },

    temp: {},

    _toggleMap: {
        selected: 'selected',
        active: 'active',
        highlight: 'highlight'
    },

    _toggleProp: function(prop, value) {
        return this._toggleMap[prop] || prop + 'Enabled';
    },

    _setToggleProp: function(prop, value) {
        var property = this._toggleProp(prop);
        var changes = {};

        if (this.get(property) !== value) {
            this.set(property, value);
            changes[prop] = value;
            this.trigger('toggle:' + prop, value);
            this.trigger('toggle', changes);
        }
    },

    isActive: function() {
        return !!(this.get('active') && this.get('selector'));
    },

    propEnabled: function(prop) {
        return !!this.get(this._toggleProp(prop));
    },

    enable: function(prop) {
        this._setToggleProp(prop, true);
        return this;
    },

    disable: function(prop) {
        this._setToggleProp(prop, false);
        return this;
    },

    toggle: function(prop) {
        if (this.propEnabled(prop)) {
            this.disable(prop);
        } else {
            this.enable(prop);
        }

        return this;
    },

    setTemp: function(object) {

        if (!object) return this;

        var changed = false;
        var changes = {};

        for (var prop in object) {
            if (this.temp[prop] !== object[prop]) {
                changes[prop] = this.temp[prop] = object[prop];
                this.trigger('temporary:' + prop, object[prop]);
                changed = true;
            }
        }

        if (changed) {
            this.trigger('temporary', changes);
        }

        return this;
    },

    unsetTemp: function(prop) {

        if (this.temp[prop] !== undefined) {
            delete this.temp[prop];
            this.trigger('temporary:' + prop);
            this.trigger('temporary');
        }

        return this;
    },

    generateCSS: function(beautify) {

        var style = this;
        var state = this.getState();
        var temporary = this.temp;

        var prefix = '    ';
        var suffix = (beautify) ? ';' : ' !important;';
        var props = [];

        props.push(state.selector + ' {');

        _.forEach(this.css, function(css, prop) {
            if (style.propEnabled(prop) && state[prop] || temporary[prop]) {
                var value = temporary[prop] || state[prop];
                var property = css.split('%value%').join(value);
                props.push( prefix + property + suffix );
            }
        });

        props.push('}');

        return props.join('\n');
    },

    updateCSS: function() {

        if (this.isActive()) {
            this.rule.set(this.generateCSS());
        } else {
            this.rule.set(' ');
        }

        return this;
    }

});
<commit_msg>Renamed _setToggleProp method<commit_after>var Style = Backbone.Model.extend({

    defaults: {

        // Style selected (expanded).
        selected: false,

        // Apply CSS rule.
        active: true,

        // Highlight selected elements.
        highlight: false,

        // Selector used in CSS rule.
        selector: '',

        // Properties below control the CSS output.
        // If a property is enabled, the value is applied to the CSS rule.

        family: '',
        familyEnabled: true,

        weight: '',
        weightEnabled: false,

        fontSize: '16px',
        fontSizeEnabled: false,

        fontStyle: '',
        fontStyleEnabled: false,

        color: '#00f',
        colorEnabled: false,

        lineHeight: '1.5',
        lineHeightEnabled: false,

        textAlign: 'left',
        textAlignEnabled: false,

        textTransform: '',
        textTransformEnabled: false,

        letterSpacing: '0',
        letterSpacingEnabled: false

    },

    initialize: function() {
        this.rule = stylesheet.newRule();
        this.on('change toggle temporary', this.updateCSS);
        this.on('toggle:selected', function(value) {
            var evt = value ? 'select' : 'deselect';
            this.trigger(evt);
        });
        this.on('destroy', function() {
            this.rule.destroy();
        });
    },

    getState: function() {
        return _.clone(this.attributes);
    },

    css: {
        family:        'font-family: %value%',
        weight:        'font-weight: %value%',
        fontSize:      'font-size: %value%',
        fontStyle:     'font-style: %value%',
        color:         'color: %value%',
        lineHeight:    'line-height: %value%',
        textAlign:     'text-align: %value%',
        textTransform: 'text-transform: %value%',
        letterSpacing: 'letter-spacing: %value%',
        highlight:     'text-shadow: 0 0 5px rgba(255, 255, 255, 0.85), 0 0 10px rgba(0, 125, 255, 0.85), 0 0 20px #0CF, 0 0 30px #FFF'
    },

    temp: {},

    _toggleMap: {
        selected: 'selected',
        active: 'active',
        highlight: 'highlight'
    },

    _toggleProp: function(prop) {
        return this._toggleMap[prop] || prop + 'Enabled';
    },

    _setToggle: function(prop, value) {
        var property = this._toggleProp(prop);
        var changes = {};

        if (this.get(property) !== value) {
            this.set(property, value);
            changes[prop] = value;
            this.trigger('toggle:' + prop, value);
            this.trigger('toggle', changes);
        }
    },

    isActive: function() {
        return !!(this.get('active') && this.get('selector'));
    },

    propEnabled: function(prop) {
        return !!this.get(this._toggleProp(prop));
    },

    enable: function(prop) {
        this._setToggle(prop, true);
        return this;
    },

    disable: function(prop) {
        this._setToggle(prop, false);
        return this;
    },

    toggle: function(prop) {
        if (this.propEnabled(prop)) {
            this.disable(prop);
        } else {
            this.enable(prop);
        }

        return this;
    },

    setTemp: function(object) {

        if (!object) return this;

        var changed = false;
        var changes = {};

        for (var prop in object) {
            if (this.temp[prop] !== object[prop]) {
                changes[prop] = this.temp[prop] = object[prop];
                this.trigger('temporary:' + prop, object[prop]);
                changed = true;
            }
        }

        if (changed) {
            this.trigger('temporary', changes);
        }

        return this;
    },

    unsetTemp: function(prop) {

        if (this.temp[prop] !== undefined) {
            delete this.temp[prop];
            this.trigger('temporary:' + prop);
            this.trigger('temporary');
        }

        return this;
    },

    generateCSS: function(beautify) {

        var style = this;
        var state = this.getState();
        var temporary = this.temp;

        var prefix = '    ';
        var suffix = (beautify) ? ';' : ' !important;';
        var props = [];

        props.push(state.selector + ' {');

        _.forEach(this.css, function(css, prop) {
            if (style.propEnabled(prop) && state[prop] || temporary[prop]) {
                var value = temporary[prop] || state[prop];
                var property = css.split('%value%').join(value);
                props.push( prefix + property + suffix );
            }
        });

        props.push('}');

        return props.join('\n');
    },

    updateCSS: function() {

        if (this.isActive()) {
            this.rule.set(this.generateCSS());
        } else {
            this.rule.set(' ');
        }

        return this;
    }

});
<|endoftext|>


<commit_before>// Copyright 2014 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

var infer = require('tern/lib/infer');

/**
 * Weights used for stand-in object and constructor types before the actual type
 * implementation is loaded.
 * @enum {number}
 */
var Weight = {
  TEMP_OBJ: 40,
  TEMP_CTOR: 50
};

/**
 * A class for managing Closure types.
 * @param {tern.Server} ternServer
 * @param {{findFile: function(name: string, cb: function(file: string))}}
 *     fileFinder
 * @constructor
 * @struct
 */
var TypeManager = function(ternServer, fileFinder) {
  /** @private {tern.Server} */
  this.ternServer_ = ternServer;

  /**
   * @private {{
   *     findFile: function(name: string, cb: function(file: string))}}
   */
  this.fileFinder_ = fileFinder;
};
module.exports = TypeManager;

/**
 * Gets an AVal for a type, given its qualified name. Creates stand-in
 * AVals for types and namespaces that have not been defined yet.
 * @param {string} name The type name.
 * @param {infer.AVal=} innerType In the case of a type application, the
 *     applied type.
 * @return {!infer.AVal}
 */
TypeManager.prototype.getQualifiedType = function(name, innerType) {
  // Handle primitives.
  if (/^(number|integer)$/i.test(name)) {
    return infer.cx().num;
  }
  if (/^bool(ean)?$/i.test(name)) {
    return infer.cx().bool;
  }
  if (/^string$/i.test(name)) {
    return infer.cx().str;
  }
  if (/^array$/i.test(name)) {
    return new infer.Arr(innerType);
  }
  if (/^object$/i.test(name)) {
    var objType = new infer.Obj(true /* null proto */);
    if (innerType) {
      innerType.propagate(objType.defProp('<i>'));
    }
    return objType;
  }

  // This is a class instance.
  var ctorType = this.defineQualifiedName(name);
  if (!(ctorType.getType() instanceof infer.Fn)) {
    // Create a fake constructor function to stand in for the real one.
    var fakeFnType = new infer.Fn(name, infer.ANull /* self */, [] /* args */,
        [] /* argNames */, infer.ANull /* retVal */);
    // Propagate it with reduced weight so it will be overriden if the real
    // constructor function loads.
    fakeFnType.propagate(ctorType, Weight.TEMP_CTOR);
  }

  var type = new infer.AVal();
  // Say that the final property type is the constructor of the commented value.
  ctorType.propagate(new infer.IsCtor(type));
  return type;
};

/**
 * Defines the given fully-qualified name as a property on the global scope. If
 * any part of the name is already defined, uses the existing value.
 * @param {string} name
 * @return {AVal} The abstract value for the name.
 */
TypeManager.prototype.defineQualifiedName = function(name) {
  // TODO: Deal with goog.scope by walking up the scope tree.
  // TODO: Put in temp origin nodes?
  // TODO: Investigate using getProp on AVals or infer.PropIsSubset directly.
  var parts = name.split('.');
  var base = infer.cx().topScope;
  var prop;
  for (var i = 0; i < parts.length; i++) {
    prop = base.defProp(parts[i]);
    if (prop.getType()) {
      base = prop.getType();
    } else {
      base = new infer.Obj(true, parts.slice(0, i + 1).join('.'));
      // Use a custom origin to prevent the purging of stand-in types on file
      // reload.
      base.origin = 'closure';
      base.propagate(prop, Weight.TEMP_OBJ);
    }
  }
  // Try to load the file providing the name.
  if (this.fileFinder_) {
    this.fileFinder_.findFile(
        name, this.addFile_.bind(this, infer.cx().curOrigin));
  }
  return prop;
};

/**
 * Gets an AVal representing the union of the given AVals.
 * @param {!Array.<!infer.AVal>} types The types to unionize.
 * @return {!infer.AVal}
 */
TypeManager.prototype.getUnionType = function(types) {
  // TODO: Decide if this behaves better with a synthetic 'Union' type #18.
  var aval = new infer.AVal();
  for (var i = 0; i < types.length; i++) {
    types[i].propagate(aval);
  }
  return aval;
};

/**
 * Add a file to the server.
 * @param {string} parentFile The file this is being included from.
 * @param {string} file The path to the file.
 * @private
 */
TypeManager.prototype.addFile_ = function(parentFile, file) {
  if (file) {
    this.ternServer_.addFile(file, null /* text */, parentFile);
    // TODO: Group adds into fewer flushes, to help with prioritizing.
    this.ternServer_.flush(function() {});
  }
};
<commit_msg>Do not search for names from defs.<commit_after>// Copyright 2014 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

var infer = require('tern/lib/infer');

/**
 * Weights used for stand-in object and constructor types before the actual type
 * implementation is loaded.
 * @enum {number}
 */
var Weight = {
  TEMP_OBJ: 40,
  TEMP_CTOR: 50
};

/**
 * A class for managing Closure types.
 * @param {tern.Server} ternServer
 * @param {{findFile: function(name: string, cb: function(file: string))}}
 *     fileFinder
 * @constructor
 * @struct
 */
var TypeManager = function(ternServer, fileFinder) {
  /** @private {tern.Server} */
  this.ternServer_ = ternServer;

  /**
   * @private {{findFile: function(name: string, cb: function(file: string))}}
   */
  this.fileFinder_ = fileFinder;
};
module.exports = TypeManager;

/**
 * Gets an AVal for a type, given its qualified name. Creates stand-in
 * AVals for types and namespaces that have not been defined yet.
 * @param {string} name The type name.
 * @param {infer.AVal=} innerType In the case of a type application, the
 *     applied type.
 * @return {!infer.AVal}
 */
TypeManager.prototype.getQualifiedType = function(name, innerType) {
  // Handle primitives.
  if (/^(number|integer)$/i.test(name)) {
    return infer.cx().num;
  }
  if (/^bool(ean)?$/i.test(name)) {
    return infer.cx().bool;
  }
  if (/^string$/i.test(name)) {
    return infer.cx().str;
  }
  if (/^array$/i.test(name)) {
    return new infer.Arr(innerType);
  }
  if (/^object$/i.test(name)) {
    var objType = new infer.Obj(true /* null proto */);
    if (innerType) {
      innerType.propagate(objType.defProp('<i>'));
    }
    return objType;
  }

  // This is a class instance.
  var ctorType = this.defineQualifiedName(name);
  if (!(ctorType.getType() instanceof infer.Fn)) {
    // Create a fake constructor function to stand in for the real one.
    var fakeFnType = new infer.Fn(name, infer.ANull /* self */, [] /* args */,
        [] /* argNames */, infer.ANull /* retVal */);
    // Propagate it with reduced weight so it will be overriden if the real
    // constructor function loads.
    fakeFnType.propagate(ctorType, Weight.TEMP_CTOR);
  }

  var type = new infer.AVal();
  // Say that the final property type is the constructor of the commented value.
  ctorType.propagate(new infer.IsCtor(type));
  return type;
};

/**
 * Defines the given fully-qualified name as a property on the global scope. If
 * any part of the name is already defined, uses the existing value.
 * @param {string} name
 * @return {AVal} The abstract value for the name.
 */
TypeManager.prototype.defineQualifiedName = function(name) {
  // TODO: Deal with goog.scope by walking up the scope tree.
  // TODO: Put in temp origin nodes?
  // TODO: Investigate using getProp on AVals or infer.PropIsSubset directly.
  var parts = name.split('.');
  var base = infer.cx().topScope;
  var prop;
  for (var i = 0; i < parts.length; i++) {
    prop = base.defProp(parts[i]);
    if (prop.getType()) {
      base = prop.getType();
    } else {
      base = new infer.Obj(true, parts.slice(0, i + 1).join('.'));
      // Use a custom origin to prevent the purging of stand-in types on file
      // reload.
      base.origin = 'closure_temp';
      base.propagate(prop, Weight.TEMP_OBJ);
    }
  }
  // Try to load the file providing the name, if the name is not from a JSON
  // type definition file.
  if (this.fileFinder_ && !infer.cx().definitions[base.origin]) {
    this.fileFinder_.findFile(
        name, this.addFile_.bind(this, infer.cx().curOrigin));
  }
  return prop;
};

/**
 * Gets an AVal representing the union of the given AVals.
 * @param {!Array.<!infer.AVal>} types The types to unionize.
 * @return {!infer.AVal}
 */
TypeManager.prototype.getUnionType = function(types) {
  // TODO: Decide if this behaves better with a synthetic 'Union' type #18.
  var aval = new infer.AVal();
  for (var i = 0; i < types.length; i++) {
    types[i].propagate(aval);
  }
  return aval;
};

/**
 * Add a file to the server.
 * @param {string} parentFile The file this is being included from.
 * @param {string} file The path to the file.
 * @private
 */
TypeManager.prototype.addFile_ = function(parentFile, file) {
  if (file) {
    this.ternServer_.addFile(file, null /* text */, parentFile);
    // TODO: Group adds into fewer flushes, to help with prioritizing.
    this.ternServer_.flush(function() {});
  }
};
<|endoftext|>