
');
+ for (i; i < this._max; i++) {
+ var slide = document.createElement('div');
+
+ slide.className = 'slide';
+ slide.id= i;
+ slide.insertAdjacentHTML('afterbegin', '
!['
+ + arr[i].img_caption
+ + ']('
+ + arr[i].img
+ +')
'
+ + arr[i].title
+ + '
'
+ + arr[i].text + '
');
+ frag.appendChild(slide);
+ }
+ console.log(frag);
+ document.getElementById('slides').appendChild(frag);
+ this.focusSlide(SimpleSlides._currentSelection, SimpleSlides._previousSelection);
+ document.getElementById('prev').addEventListener('click', SimpleSlides.prevSlide);
+ document.getElementById('next').addEventListener('click', SimpleSlides.nextSlide);
+ window.addEventListener('keydown', SimpleSlides.handleArrowKey);
+ },
+
+ focusSlide: function (curr, prev) {
+ // Bring a new slide in to view, move the previous one out of view
+ var c = document.getElementById(curr),
+ p = document.getElementById(prev),
+ height = document.getElementById('slider-container').offsetHeight;
+ c.style.left = 0;
+ c.style.top = -(height + 10) * curr + 'px';
+ p.style.left = '9000px';
+ },
+
+ prevSlide: function (e) {
+ // Bring the previous slide into focus if we're not at the first one
+ if (SimpleSlides._currentSelection > 0) {
+ SimpleSlides._previousSelection = SimpleSlides._currentSelection;
+ SimpleSlides._currentSelection -= 1;
+ SimpleSlides.focusSlide(SimpleSlides._currentSelection, SimpleSlides._previousSelection);
+ }
+ },
+
+ nextSlide: function (e) {
+ // Bring the next slide into focus if we're not at the last one
+ if (SimpleSlides._currentSelection < SimpleSlides._max - 1) {
+ SimpleSlides._previousSelection = SimpleSlides._currentSelection;
+ SimpleSlides._currentSelection += 1;
+ SimpleSlides.focusSlide(SimpleSlides._currentSelection, SimpleSlides._previousSelection);
+ }
+ },
+
+ handleArrowKey: function (e) {
+ // Allow the user to navigate the slideshow using the left and right arrow keys
+ if (e.keyCode === 39) {
+ SimpleSlides.nextSlide(e);
+ }
+
+ if (e.keyCode === 37) {
+ SimpleSlides.prevSlide(e);
+ }
+ }
+}
diff --git a/pool/shard011/JavaScript/0071295_interaction.js b/pool/shard011/JavaScript/0071295_interaction.js
new file mode 100644
index 0000000000000000000000000000000000000000..8443c8ff814817b674ebd4fd96ba67d000a29042
--- /dev/null
+++ b/pool/shard011/JavaScript/0071295_interaction.js
@@ -0,0 +1,248 @@
+wax = wax || {};
+
+wax.interaction = function() {
+ var gm = wax.gm(),
+ interaction = {},
+ _downLock = false,
+ _clickTimeout = null,
+ // Active feature
+ // Down event
+ _d,
+ // Touch tolerance
+ tol = 4,
+ grid,
+ attach,
+ detach,
+ parent,
+ map,
+ tileGrid;
+
+ var defaultEvents = {
+ mousemove: onMove,
+ touchstart: onDown,
+ mousedown: onDown
+ };
+
+ var touchEnds = {
+ touchend: onUp,
+ touchmove: onUp,
+ touchcancel: touchCancel
+ };
+
+ // Abstract getTile method. Depends on a tilegrid with
+ // grid[ [x, y, tile] ] structure.
+ function getTile(e) {
+ var g = grid();
+ for (var i = 0; i < g.length; i++) {
+ if ((g[i][0] < e.y) &&
+ ((g[i][0] + 256) > e.y) &&
+ (g[i][1] < e.x) &&
+ ((g[i][1] + 256) > e.x)) return g[i][2];
+ }
+ return false;
+ }
+
+ // Clear the double-click timeout to prevent double-clicks from
+ // triggering popups.
+ function killTimeout() {
+ if (_clickTimeout) {
+ window.clearTimeout(_clickTimeout);
+ _clickTimeout = null;
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function onMove(e) {
+ // If the user is actually dragging the map, exit early
+ // to avoid performance hits.
+ if (_downLock) return;
+
+ var pos = wax.u.eventoffset(e);
+
+ interaction.screen_feature(pos, function(feature) {
+ if (feature) {
+ bean.fire(interaction, 'on', {
+ parent: parent(),
+ data: feature,
+ formatter: gm.formatter().format,
+ e: e
+ });
+ } else {
+ bean.fire(interaction, 'off');
+ }
+ });
+ }
+
+ function dragEnd() {
+ _downLock = false;
+ }
+
+ // A handler for 'down' events - which means `mousedown` and `touchstart`
+ function onDown(e) {
+
+ // Prevent interaction offset calculations happening while
+ // the user is dragging the map.
+ //
+ // Store this event so that we can compare it to the
+ // up event
+ _downLock = true;
+ _d = wax.u.eventoffset(e);
+ if (e.type === 'mousedown') {
+ bean.add(document.body, 'click', onUp);
+ // track mouse up to remove lockDown when the drags end
+ bean.add(document.body, 'mouseup', dragEnd);
+
+ // Only track single-touches. Double-touches will not affect this
+ // control
+ } else if (e.type === 'touchstart' && e.touches.length === 1) {
+ // Don't make the user click close if they hit another tooltip
+ bean.fire(interaction, 'off');
+ // Touch moves invalidate touches
+ bean.add(e.srcElement, touchEnds);
+ }
+ }
+
+ function touchCancel(e) {
+ bean.remove(e.srcElement, touchEnds);
+ _downLock = false;
+ }
+
+ function onUp(e) {
+ var evt = {},
+ pos = wax.u.eventoffset(e);
+ _downLock = false;
+
+ // TODO: refine
+ for (var key in e) {
+ evt[key] = e[key];
+ }
+
+ bean.remove(document.body, 'mouseup', onUp);
+ bean.remove(e.srcElement, touchEnds);
+
+ if (e.type === 'touchend') {
+ // If this was a touch and it survived, there's no need to avoid a double-tap
+ // but also wax.u.eventoffset will have failed, since this touch
+ // event doesn't have coordinates
+ interaction.click(e, _d);
+ } else if (Math.round(pos.y / tol) === Math.round(_d.y / tol) &&
+ Math.round(pos.x / tol) === Math.round(_d.x / tol)) {
+ // Contain the event data in a closure.
+ // Ignore double-clicks by ignoring clicks within 300ms of
+ // each other.
+ if(!_clickTimeout) {
+ _clickTimeout = window.setTimeout(function() {
+ _clickTimeout = null;
+ interaction.click(evt, pos);
+ }, 300);
+ } else {
+ killTimeout();
+ }
+ }
+ return onUp;
+ }
+
+ // Handle a click event. Takes a second
+ interaction.click = function(e, pos) {
+ interaction.screen_feature(pos, function(feature) {
+ if (feature) bean.fire(interaction, 'on', {
+ parent: parent(),
+ data: feature,
+ formatter: gm.formatter().format,
+ e: e
+ });
+ });
+ };
+
+ interaction.screen_feature = function(pos, callback) {
+ var tile = getTile(pos);
+ if (!tile) callback(null);
+ gm.getGrid(tile.src, function(err, g) {
+ if (err || !g) return callback(null);
+ var feature = g.tileFeature(pos.x, pos.y, tile);
+ callback(feature);
+ });
+ };
+
+ // set an attach function that should be
+ // called when maps are set
+ interaction.attach = function(x) {
+ if (!arguments.length) return attach;
+ attach = x;
+ return interaction;
+ };
+
+ interaction.detach = function(x) {
+ if (!arguments.length) return detach;
+ detach = x;
+ return interaction;
+ };
+
+ // Attach listeners to the map
+ interaction.map = function(x) {
+ if (!arguments.length) return map;
+ map = x;
+ if (attach) attach(map);
+ bean.add(parent(), defaultEvents);
+ bean.add(parent(), 'touchstart', onDown);
+ return interaction;
+ };
+
+ // set a grid getter for this control
+ interaction.grid = function(x) {
+ if (!arguments.length) return grid;
+ grid = x;
+ return interaction;
+ };
+
+ // detach this and its events from the map cleanly
+ interaction.remove = function(x) {
+ if (detach) detach(map);
+ bean.remove(parent(), defaultEvents);
+ bean.fire(interaction, 'remove');
+ return interaction;
+ };
+
+ // get or set a tilejson chunk of json
+ interaction.tilejson = function(x) {
+ if (!arguments.length) return gm.tilejson();
+ gm.tilejson(x);
+ return interaction;
+ };
+
+ // return the formatter, which has an exposed .format
+ // function
+ interaction.formatter = function() {
+ return gm.formatter();
+ };
+
+ // ev can be 'on', 'off', fn is the handler
+ interaction.on = function(ev, fn) {
+ bean.add(interaction, ev, fn);
+ return interaction;
+ };
+
+ // ev can be 'on', 'off', fn is the handler
+ interaction.off = function(ev, fn) {
+ bean.remove(interaction, ev, fn);
+ return interaction;
+ };
+
+ // Return or set the gridmanager implementation
+ interaction.gridmanager = function(x) {
+ if (!arguments.length) return gm;
+ gm = x;
+ return interaction;
+ };
+
+ // parent should be a function that returns
+ // the parent element of the map
+ interaction.parent = function(x) {
+ parent = x;
+ return interaction;
+ };
+
+ return interaction;
+};
diff --git a/pool/shard011/JavaScript/0071296_index.js b/pool/shard011/JavaScript/0071296_index.js
new file mode 100644
index 0000000000000000000000000000000000000000..844749d16087a6becec6ca79bcda959acdc29ec6
--- /dev/null
+++ b/pool/shard011/JavaScript/0071296_index.js
@@ -0,0 +1,12 @@
+var write = require('csv-write-stream')
+var csv = require('csv-parser')
+var through = require('through0')
+var extend = require('xtend')
+
+function read(opts) {
+ return csv(extend({json: true}, opts))
+}
+
+module.exports.read = read
+module.exports.write = write
+module.exports.through = through
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071298_query-promise.js b/pool/shard011/JavaScript/0071298_query-promise.js
new file mode 100644
index 0000000000000000000000000000000000000000..80741bc065def69b85d6c8528ab398f01adc08eb
--- /dev/null
+++ b/pool/shard011/JavaScript/0071298_query-promise.js
@@ -0,0 +1,57 @@
+'use-strict';
+
+var app = require('../index'),
+ _ = require('lodash'),
+ Promise = require('bluebird'),
+ should = require('should');
+
+var Car = app.model('Car');
+var car;
+
+describe('Query-Promise', function(){
+ before(function(done){
+ this.timeout(10000);
+ app.connect('esodm-test')
+ .then(function(){
+ car = new Car({name:'Ford', slug: 'someslug'});
+ return car.save();
+ })
+ .then(function(){
+ done();
+ })
+ .catch(done);
+ });
+
+ it('wraps a .find() query', function(done){
+ Car.find()
+ .sort('createdOn')
+ .missing('asfasfasf')
+ .exists('name')
+ .must({name: car.name, slug: car.slug})
+ .then(function(res){
+ res.should.be.instanceof(Array);
+ res[0].should.have.property('name', car.name);
+ res[0].should.have.property('slug', car.slug);
+ done();
+ })
+ .catch(done);
+ });
+
+ it('can call .all() on array of query promises', function(done){
+ Promise.all([Car.findById(car.id), Car.findById(car.id)])
+ .spread(function(promise1, promise2){
+ promise1.should.be.instanceof(Object).and.have.property('id', car.id);
+ promise2.should.be.instanceof(Object).and.have.property('id', car.id);
+ done();
+ }).catch(done);
+ });
+
+ after(function(done){
+ this.timeout(10000);
+ Car.findAndRemove({name: car.name})
+ .then(function(){
+ done();
+ })
+ .catch(done);
+ });
+});
diff --git a/pool/shard011/JavaScript/0071301_orderby_reducer.js b/pool/shard011/JavaScript/0071301_orderby_reducer.js
new file mode 100644
index 0000000000000000000000000000000000000000..989133166831c472eca99fe74e8305864b579b00
--- /dev/null
+++ b/pool/shard011/JavaScript/0071301_orderby_reducer.js
@@ -0,0 +1,70 @@
+const fieldUnwrap = require('../utils/unwrap_field');
+const fieldRelativePath = require('../utils/field_relative');
+const mapReduce = require('../utils/map_reduce');
+const orderbyUnwrap = require('../utils/orderby_unwrap');
+const getFieldAttributes = require('../utils/field_attributes');
+
+module.exports = ({current_path, extract, table_schema}) => mapReduce(entry => {
+
+ let field = entry;
+ let direction = '';
+ if (typeof field === 'string') {
+
+ const obj = orderbyUnwrap(entry);
+ field = obj.field;
+ direction = obj.direction;
+
+ }
+
+ // Get the field address
+ const item = fieldUnwrap(field);
+
+ // Add direction
+ item.direction = direction;
+
+ const address = fieldRelativePath(current_path, item.field);
+
+ // Get the parent of the field
+ const address_split = address.split('.').filter(a => a);
+
+ if (address_split.length <= 1) {
+
+ // Get the alias
+ const {alias} = getFieldAttributes(table_schema[item.field_name]);
+
+ if (alias) {
+
+ // This is an alias column, override the field
+ item.field = alias;
+
+ }
+
+ // Persist the field...
+ return fieldWrap(item);
+
+ }
+
+ // Create a groupby in the associate model
+ const key = address_split.shift();
+
+ // Replace the field
+ item.field = address_split.join('.');
+
+ // Add to orderby
+ const value = fieldWrap(item);
+
+ // Extract
+ extract(key, [value]);
+
+ /*
+ * Dont return anything
+ * So it wont be included in the reduce list...
+ */
+
+});
+
+function fieldWrap(item) {
+
+ return item.prefix + item.field + item.suffix + item.direction;
+
+}
diff --git a/pool/shard011/JavaScript/0071306_Checkbox.story.js b/pool/shard011/JavaScript/0071306_Checkbox.story.js
new file mode 100644
index 0000000000000000000000000000000000000000..b986c476c2cd0f7d7b7c02a4bf3416d898edf632
--- /dev/null
+++ b/pool/shard011/JavaScript/0071306_Checkbox.story.js
@@ -0,0 +1,97 @@
+import React, { useState } from "react";
+import styled from "styled-components";
+import { storiesOf } from "@storybook/react";
+import { action } from "@storybook/addon-actions";
+
+import { Checkbox as CheckboxComponent, Switch } from ".";
+
+const checkboxStories = (moduleTitle, Checkbox) =>
+ storiesOf(moduleTitle, module)
+ .add("Default", () =>
)
+ .add("checked", () =>
)
+ .add("with state control", () => {
+ const WithState = () => {
+ const [checked, setChecked] = useState(false);
+
+ return (
+
{
+ setChecked(e.target.checked);
+ action("onChange")(e);
+ }}
+ />
+ );
+ };
+
+ return ;
+ })
+ .add("with text label", () => )
+
+ .add("with onChange event", () => (
+
+ ))
+ .add("disabled", () => )
+ .add("in a fieldset", () => (
+
+ ))
+ .add("extended style", () => {
+ // we can't use the styled-components' css prop here
+ // because it's converted at build time by the babel plugin
+ // while this `checkboxStories` generates the stories on the
+ // go for each given component
+ const StyledCheckbox = styled(Checkbox)`
+ .visibleCheckbox {
+ background: indigo;
+ }
+ .label {
+ font-family: monospace;
+ }
+ `;
+ return ;
+ })
+ .add("with loading state control", () => {
+ const WithState = () => {
+ const [checked, setChecked] = useState(false);
+ const [loading, setLoading] = useState(false);
+
+ return (
+ {
+ setLoading(true);
+ setChecked(e.target.checked);
+ setTimeout(() => {
+ setLoading(false);
+ }, 1000);
+ action("onChange")(e);
+ }}
+ label="Checkbox Label"
+ />
+ );
+ };
+
+ return ;
+ });
+
+checkboxStories("Checkbox/Checkbox Input", CheckboxComponent);
+checkboxStories("Checkbox/Switch Input", Switch);
diff --git a/pool/shard011/JavaScript/0071308_metalsmith-gingabulous-pug.js b/pool/shard011/JavaScript/0071308_metalsmith-gingabulous-pug.js
new file mode 100644
index 0000000000000000000000000000000000000000..5bd0bcd6286ef5f43fd71ab1d5b070a38f745ded
--- /dev/null
+++ b/pool/shard011/JavaScript/0071308_metalsmith-gingabulous-pug.js
@@ -0,0 +1,113 @@
+const pug = require('pug');
+const path = require('path');
+const debug = require('debug')('metalsmith-gingabulousLayouts');
+const replaceExtension = require('replace-ext');
+const markdown = require('jstransformer-markdown-it');
+
+function markdownToPug(options) {
+ // const transformedContent = markdown.render(content);
+ const DEFAULTS = {
+ layoutName: 'default',
+ blockName: 'main'
+ };
+ const refs = Object.assign({}, DEFAULTS, options);
+ return `
+extends ${refs.layoutName}
+
+block ${refs.blockName}
+ .container
+ .block!= transformedContent
+
+
+`;
+}
+
+function gingabulousLayouts(options) {
+ const parsedOptions = Object.assign({}, {
+ /**
+ * determines if files will be fully processed or not.
+ * If `false` then they will.
+ * @default inPlace
+ * @type {Boolean}
+ */
+ inPlace: false
+ }, options);
+
+ return (files, metalsmith, done) => {
+ setImmediate(done);
+ // check for any locals passed to the pug options object and merge them.
+ const data = Object.assign({}, parsedOptions.locals, metalsmith.metadata());
+ // debug(data);
+ // Loop through all files
+ Object.keys(files).forEach((filename) => {
+ // Get the file extension
+ const ext = path.extname(filename);
+ // Set conditonals
+ const isMarkdown = ext === '.md';
+ const isPug = ext === '.pug';
+ const inPlace = parsedOptions.inPlace;
+ let isPartial = false;
+ debug(`current file: ${filename}`);
+ debug(ext);
+ // if it isnt a pug or markdown file, then ignore.
+ if (isPug || isMarkdown) {
+ let file = files[filename];
+ let contents = file.contents.toString();
+
+ // Check if the file is a markdown file
+ // if so, convert it to valid pug
+ if (isMarkdown) {
+ debug(`${filename} is a markdown file`);
+ const transformedContent = markdown.render(contents, { html: true });
+
+ // Check for any options passed in file data
+ const refs = {};
+ if (file.extends) {
+ refs.layoutName = file.extends;
+ }
+ if (file.block_name) {
+ refs.blockName = file.block_name;
+ }
+
+ // If `inPlace` is true, then the file will remain as an HTML partial
+ if (inPlace) {
+ debug('HTML Partial Created')
+ contents = transformedContent;
+ isPartial = true;
+ } else {
+ file.transformedContent = transformedContent;
+ // convert file contents from markdown to pug
+ contents = markdownToPug(refs);
+ }
+ }
+
+ if (!isPartial) {
+ // parse file data and global data
+ const locals = Object.assign({}, data, file);
+
+ const pugOptions = Object.assign({}, parsedOptions, {
+ filename: path.join(metalsmith.source(), filename),
+ locals
+ });
+ // Compile pug to html
+ const compiled = pug.compile(contents, pugOptions);
+
+ contents = Buffer.from(compiled(locals));
+ }
+
+ // Assign the new contents of the file
+ file.contents = contents;
+ // Remove old file
+ delete files[filename];
+ // Create a new file
+ files[replaceExtension(filename, '.html')] = file;
+ } else {
+ debug('stuff did not match');
+ return; // eslint-disable-line no-useless-return
+ }
+ // return;
+ });
+ };
+}
+
+module.exports = gingabulousLayouts;
diff --git a/pool/shard011/JavaScript/0071309_forgot-password.controller.js b/pool/shard011/JavaScript/0071309_forgot-password.controller.js
new file mode 100644
index 0000000000000000000000000000000000000000..aec9d9f469da89d6d61c1aa0e63e618e2f2fec5a
--- /dev/null
+++ b/pool/shard011/JavaScript/0071309_forgot-password.controller.js
@@ -0,0 +1,24 @@
+angular.module('app')
+ .controller('ForgotPassowrdController', function ($scope, User, $state, $rootScope, LoopBackAuth, $timeout, cfpLoadingBar) {
+ $scope.email = "";
+ $rootScope.isAdmin = true;
+ $scope.reset_password = function () {
+ cfpLoadingBar.start()
+ if (!$scope.forgotPasswordForm.email.$invalid) {
+ User.resetPassword({ email: $scope.email }, function (response, headers) {
+ alert("Please check your email address to reset your password");
+ $state.go("login");
+ cfpLoadingBar.complete();
+ }, function (response) {
+ cfpLoadingBar.complete();
+ alert(JSON.stringify(response.data.error.message));
+ });
+ }
+ else {
+ $scope.forgotPasswordForm.email.$dirty = true;
+ cfpLoadingBar.complete();
+
+ }
+
+ }
+ })
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071311_programs.client.controller.tests.js b/pool/shard011/JavaScript/0071311_programs.client.controller.tests.js
new file mode 100644
index 0000000000000000000000000000000000000000..f56ffdae90c23f6da3cb635162cf707f8ca38c7f
--- /dev/null
+++ b/pool/shard011/JavaScript/0071311_programs.client.controller.tests.js
@@ -0,0 +1,210 @@
+'use strict';
+
+(function () {
+ // Programs Controller Spec
+ describe('Programs Controller Tests', function () {
+ // Initialize global variables
+ var ProgramsController,
+ scope,
+ $httpBackend,
+ $stateParams,
+ $location,
+ Authentication,
+ Programs,
+ mockProgram;
+
+ // The $resource service augments the response object with methods for updating and deleting the resource.
+ // If we were to use the standard toEqual matcher, our tests would fail because the test values would not match
+ // the responses exactly. To solve the problem, we define a new toEqualData Jasmine matcher.
+ // When the toEqualData matcher compares two objects, it takes only object properties into
+ // account and ignores methods.
+ beforeEach(function () {
+ jasmine.addMatchers({
+ toEqualData: function (util, customEqualityTesters) {
+ return {
+ compare: function (actual, expected) {
+ return {
+ pass: angular.equals(actual, expected)
+ };
+ }
+ };
+ }
+ });
+ });
+
+ // Then we can start by loading the main application module
+ beforeEach(module(ApplicationConfiguration.applicationModuleName));
+
+ // The injector ignores leading and trailing underscores here (i.e. _$httpBackend_).
+ // This allows us to inject a service but then attach it to a variable
+ // with the same name as the service.
+ beforeEach(inject(function ($controller, $rootScope, _$location_, _$stateParams_, _$httpBackend_, _Authentication_, _Programs_) {
+ // Set a new global scope
+ scope = $rootScope.$new();
+
+ // Point global variables to injected services
+ $stateParams = _$stateParams_;
+ $httpBackend = _$httpBackend_;
+ $location = _$location_;
+ Authentication = _Authentication_;
+ Programs = _Programs_;
+
+ // create mock program
+ mockProgram = new Programs({
+ _id: '525a8422f6d0f87f0e407a33',
+ title: 'An Program about MEAN',
+ content: 'MEAN rocks!'
+ });
+
+ // Mock logged in user
+ Authentication.user = {
+ roles: ['user']
+ };
+
+ // Initialize the Programs controller.
+ ProgramsController = $controller('ProgramsController', {
+ $scope: scope
+ });
+ }));
+
+ it('$scope.find() should create an array with at least one program object fetched from XHR', inject(function (Programs) {
+ // Create a sample programs array that includes the new program
+ var samplePrograms = [mockProgram];
+
+ // Set GET response
+ $httpBackend.expectGET('api/programs').respond(samplePrograms);
+
+ // Run controller functionality
+ scope.find();
+ $httpBackend.flush();
+
+ // Test scope value
+ expect(scope.programs).toEqualData(samplePrograms);
+ }));
+
+ it('$scope.findOne() should create an array with one program object fetched from XHR using a programId URL parameter', inject(function (Programs) {
+ // Set the URL parameter
+ $stateParams.programId = mockProgram._id;
+
+ // Set GET response
+ $httpBackend.expectGET(/api\/programs\/([0-9a-fA-F]{24})$/).respond(mockProgram);
+
+ // Run controller functionality
+ scope.findOne();
+ $httpBackend.flush();
+
+ // Test scope value
+ expect(scope.program).toEqualData(mockProgram);
+ }));
+
+ describe('$scope.create()', function () {
+ var sampleProgramPostData;
+
+ beforeEach(function () {
+ // Create a sample program object
+ sampleProgramPostData = new Programs({
+ title: 'An Program about MEAN',
+ content: 'MEAN rocks!'
+ });
+
+ // Fixture mock form input values
+ scope.title = 'An Program about MEAN';
+ scope.content = 'MEAN rocks!';
+
+ spyOn($location, 'path');
+ });
+
+ it('should send a POST request with the form input values and then locate to new object URL', inject(function (Programs) {
+ // Set POST response
+ $httpBackend.expectPOST('api/programs', sampleProgramPostData).respond(mockProgram);
+
+ // Run controller functionality
+ scope.create(true);
+ $httpBackend.flush();
+
+ // Test form inputs are reset
+ expect(scope.title).toEqual('');
+ expect(scope.content).toEqual('');
+
+ // Test URL redirection after the program was created
+ expect($location.path.calls.mostRecent().args[0]).toBe('programs/' + mockProgram._id);
+ }));
+
+ it('should set scope.error if save error', function () {
+ var errorMessage = 'this is an error message';
+ $httpBackend.expectPOST('api/programs', sampleProgramPostData).respond(400, {
+ message: errorMessage
+ });
+
+ scope.create(true);
+ $httpBackend.flush();
+
+ expect(scope.error).toBe(errorMessage);
+ });
+ });
+
+ describe('$scope.update()', function () {
+ beforeEach(function () {
+ // Mock program in scope
+ scope.program = mockProgram;
+ });
+
+ it('should update a valid program', inject(function (Programs) {
+ // Set PUT response
+ $httpBackend.expectPUT(/api\/programs\/([0-9a-fA-F]{24})$/).respond();
+
+ // Run controller functionality
+ scope.update(true);
+ $httpBackend.flush();
+
+ // Test URL location to new object
+ expect($location.path()).toBe('/programs/' + mockProgram._id);
+ }));
+
+ it('should set scope.error to error response message', inject(function (Programs) {
+ var errorMessage = 'error';
+ $httpBackend.expectPUT(/api\/programs\/([0-9a-fA-F]{24})$/).respond(400, {
+ message: errorMessage
+ });
+
+ scope.update(true);
+ $httpBackend.flush();
+
+ expect(scope.error).toBe(errorMessage);
+ }));
+ });
+
+ describe('$scope.remove(program)', function () {
+ beforeEach(function () {
+ // Create new programs array and include the program
+ scope.programs = [mockProgram, {}];
+
+ // Set expected DELETE response
+ $httpBackend.expectDELETE(/api\/programs\/([0-9a-fA-F]{24})$/).respond(204);
+
+ // Run controller functionality
+ scope.remove(mockProgram);
+ });
+
+ it('should send a DELETE request with a valid programId and remove the program from the scope', inject(function (Programs) {
+ expect(scope.programs.length).toBe(1);
+ }));
+ });
+
+ describe('scope.remove()', function () {
+ beforeEach(function () {
+ spyOn($location, 'path');
+ scope.program = mockProgram;
+
+ $httpBackend.expectDELETE(/api\/programs\/([0-9a-fA-F]{24})$/).respond(204);
+
+ scope.remove();
+ $httpBackend.flush();
+ });
+
+ it('should redirect to programs', function () {
+ expect($location.path).toHaveBeenCalledWith('programs');
+ });
+ });
+ });
+}());
diff --git a/pool/shard011/JavaScript/0071313_test_grid_columnwidth.js b/pool/shard011/JavaScript/0071313_test_grid_columnwidth.js
new file mode 100644
index 0000000000000000000000000000000000000000..b057fe80a4b88321f758c474a2983133df0c8800
--- /dev/null
+++ b/pool/shard011/JavaScript/0071313_test_grid_columnwidth.js
@@ -0,0 +1,129 @@
+require([
+ 'dojo/parser',
+ 'gridx/tests/support/data/MusicData',
+ 'gridx/tests/support/stores/Memory',
+ 'gridx/allModules',
+ 'gridx/Grid',
+ 'gridx/core/model/cache/Async',
+ 'dijit/layout/BorderContainer',
+ 'dijit/layout/TabContainer',
+ 'dijit/layout/ContentPane',
+ 'dijit/Dialog',
+ 'dojo/domReady!'
+], function(parser, dataSource, storeFactory, modules){
+
+ store = storeFactory({
+ dataSource: dataSource,
+ size: 200
+ });
+
+ mods = [
+ modules.ColumnResizer,
+ modules.RowHeader,
+ modules.TouchScroll,
+ modules.VirtualVScroller
+ ];
+
+ layout1 = [
+ {id: 'id', field: 'id', name: 'Identity', width: '50px'},
+ {id: 'Genre', field: 'Genre', name: 'Genre', width: '100px'},
+ {id: 'Artist', field: 'Artist', name: 'Artist', width: '100px'},
+ {id: 'Year', field: 'Year', name: 'Year', width: '80px'},
+ {id: 'Album', field: 'Album', name: 'Album', width: '150px'},
+ {id: 'Name', field: 'Name', name: 'Name', width: '160px'},
+ {id: 'Length', field: 'Length', name: 'Length', width: '80px'},
+ {id: 'Track', field: 'Track', name: 'Track', width: '50px'},
+ {id: 'Composer', field: 'Composer', name: 'Composer', width: '200px'},
+ {id: 'Download Date', field: 'Download Date', name: 'Download Date', width: '200px'},
+ {id: 'Last Played', field: 'Last Played', name: 'Last Played', width: '200px'},
+ {id: 'Heard', field: 'Heard', name: 'Heard', width: '80px'}
+ ];
+
+ layout2 = [
+ {id: 'id', field: 'id', name: 'Identity', width: '50px'},
+ {id: 'Genre', field: 'Genre', name: 'Genre (auto)'},
+ {id: 'Artist', field: 'Artist', name: 'Artist (auto)'},
+ {id: 'Year', field: 'Year', name: 'Year', width: '50px'},
+ {id: 'Album', field: 'Album', name: 'Album (auto)'},
+ {id: 'Name', field: 'Name', name: 'Name (auto)'},
+ {id: 'Length', field: 'Length', name: 'Length', width: '50px'},
+ {id: 'Track', field: 'Track', name: 'Track', width: '40px'}
+ ];
+
+ layout3 = [
+ {id: 'id', field: 'id', name: 'Identity', width: '120px'},
+ {id: 'Genre', field: 'Genre', name: 'Genre', width: '180px'},
+ {id: 'Artist', field: 'Artist', name: 'Artist', width: '220px'},
+ {id: 'Year', field: 'Year', name: 'Year', width: '100px'},
+ {id: 'Album', field: 'Album', name: 'Album', width: '260px'},
+ {id: 'Name', field: 'Name', name: 'Name (auto)'},
+ {id: 'Length', field: 'Length', name: 'Length (auto)'},
+ {id: 'Track', field: 'Track', name: 'Track (auto)'},
+ {id: 'Composer', field: 'Composer', name: 'Composer (auto)'},
+ {id: 'Download Date', field: 'Download Date', name: 'Download Date (auto)'},
+ {id: 'Last Played', field: 'Last Played', name: 'Last Played (auto)'},
+ {id: 'Heard', field: 'Heard', name: 'Heard (auto)'}
+ ];
+
+ layout4 = [
+ {id: 'id', field: 'id', name: 'Identity (auto)'},
+ {id: 'Year', field: 'Year', name: 'Year (auto)'},
+ {id: 'Genre', field: 'Genre', name: 'Genre (30%)', width: '30%'},
+ {id: 'Artist', field: 'Artist', name: 'Artist (20%)', width: '20%'},
+ {id: 'Name', field: 'Name', name: 'Name (30%)', width: '30%'}
+ ];
+
+ layout4_1 = [
+ {id: 'id', field: 'id', name: 'Identity (30%)', width: '30%'},
+ {id: 'Year', field: 'Year', name: 'Year (30%)', width: '30%'},
+ {id: 'Genre', field: 'Genre', name: 'Genre (20%)', width: '20%'},
+ {id: 'Artist', field: 'Artist', name: 'Artist (20%)', width: '20%'},
+ {id: 'Name', field: 'Name', name: 'Name (auto)', width: 'auto'}
+ ];
+
+ layout5 = [
+ {id: 'id', field: 'id', name: 'Identity', width: '50px'},
+ {id: 'Name', field: 'Name', name: 'Name (30%)', width: '30%'},
+ {id: 'Genre', field: 'Genre', name: 'Genre (20%)', width: '20%'},
+ {id: 'Year', field: 'Year', name: 'Year (auto)'},
+ {id: 'Length', field: 'Length', name: 'Length (auto)'},
+ {id: 'Track', field: 'Track', name: 'Track (auto)'},
+ {id: 'Artist', field: 'Artist', name: 'Artist (30%)', width: '30%'},
+ {id: 'Album', field: 'Album', name: 'Album (40%)', width: '40%'},
+ {id: 'Composer', field: 'Composer', name: 'Composer (30%)', width: '30%'}
+ ];
+
+ layout6 = [
+ {id: 'id', field: 'id', name: 'Identity (40px)', width: '40px'},
+ {id: 'Genre', field: 'Genre', name: 'Genre (10em)', width: '10em'},
+ {id: 'Artist', field: 'Artist', name: 'Artist (15%)', width: '15%'},
+ {id: 'Year', field: 'Year', name: 'Year (auto)'},
+ {id: 'Album', field: 'Album', name: 'Album (180px)', width: '180px'},
+ {id: 'Name', field: 'Name', name: 'Name (8em)', width: '8em'},
+ {id: 'Length', field: 'Length', name: 'Length (5%)', width: '5%'},
+ {id: 'Track', field: 'Track', name: 'Track (auto)'},
+ {id: 'Composer', field: 'Composer', name: 'Composer (auto)'}
+ ];
+
+ layout7 = [
+ {id: 'id', field: 'id', name: 'Identity', width: '50px'},
+ {id: 'Genre', field: 'Genre', name: 'Genre', width: '180px'},
+ {id: 'Artist', field: 'Artist', name: 'Artist', width: '200px'},
+ {id: 'Year', field: 'Year', name: 'Year', width: '50px'},
+ {id: 'Album', field: 'Album', name: 'Album', width: '230px'},
+ {id: 'Name', field: 'Name', name: 'Name', width: '200px'},
+ {id: 'Length', field: 'Length', name: 'Length', width: '5em'},
+ {id: 'Track', field: 'Track', name: 'Track'},
+ {id: 'Composer', field: 'Composer', name: 'Composer'}
+ ];
+
+ layout8 = [
+ {id: 'id', field: 'id', name: 'Identity', width: '5%'},
+ {id: 'Genre', field: 'Genre', name: 'Genre', width: '15%'},
+ {id: 'Artist', field: 'Artist', name: 'Artist', width: '20%'},
+ {id: 'Name', field: 'Name', name: 'Name', width: '30%'},
+ {id: 'Length', field: 'Length', name: 'Length'}
+ ];
+
+ parser.parse();
+});
diff --git a/pool/shard011/JavaScript/0071315_onestepcheckout.js b/pool/shard011/JavaScript/0071315_onestepcheckout.js
new file mode 100644
index 0000000000000000000000000000000000000000..020e15999cab63837d3fe6f21c9e2afda70647c2
--- /dev/null
+++ b/pool/shard011/JavaScript/0071315_onestepcheckout.js
@@ -0,0 +1,17 @@
+var ebanxRemoveOSCRequireDocument = country => { // eslint-disable-line no-unused-vars
+ const doc = document.getElementById('billing:taxvat');
+ const advice = document.getElementById(
+ 'advice-validate-taxvat-billing:taxvat'
+ );
+
+ if (!doc.classList.contains('validate-taxvat')) {
+ doc.classList.add('validate-taxvat');
+ }
+ if (!(country === 'BR' || country === 'CO' || country === 'CL')) {
+ doc.classList.remove('validate-taxvat');
+ doc.classList.remove('validation-failed');
+ if (advice) {
+ advice.remove();
+ }
+ }
+};
diff --git a/pool/shard011/JavaScript/0071317_jquery.highlight-3.js b/pool/shard011/JavaScript/0071317_jquery.highlight-3.js
new file mode 100644
index 0000000000000000000000000000000000000000..9310e5b93a255d343be2827a621c27fb675add9a
--- /dev/null
+++ b/pool/shard011/JavaScript/0071317_jquery.highlight-3.js
@@ -0,0 +1,55 @@
+/*
+
+highlight v3
+
+Highlights arbitrary terms.
+
+
+
+MIT license.
+
+Johann Burkard
+
+
+
+*/
+
+jQuery.fn.highlight = function(pat) {
+ if (pat != '') {
+ function innerHighlight(node, pat) {
+ var skip = 0;
+ if (node.nodeType == 3) {
+ var pos = node.data.toUpperCase().indexOf(pat);
+ if (pos >= 0) {
+ var spannode = document.createElement('span');
+ spannode.className = 'highlight';
+ var middlebit = node.splitText(pos);
+ var endbit = middlebit.splitText(pat.length);
+ var middleclone = middlebit.cloneNode(true);
+ spannode.appendChild(middleclone);
+ middlebit.parentNode.replaceChild(spannode, middlebit);
+ skip = 1;
+ }
+ }
+ else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
+ for (var i = 0; i < node.childNodes.length; ++i) {
+ i += innerHighlight(node.childNodes[i], pat);
+ }
+ }
+ return skip;
+ }
+ return this.each(function() {
+ innerHighlight(this, pat.toUpperCase());
+ });
+ }
+};
+
+jQuery.fn.removeHighlight = function() {
+ return this.find("span.highlight").each(function() {
+ this.parentNode.firstChild.nodeName;
+ with (this.parentNode) {
+ replaceChild(this.firstChild, this);
+ normalize();
+ }
+ }).end();
+};
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071318_logo_link.js b/pool/shard011/JavaScript/0071318_logo_link.js
new file mode 100644
index 0000000000000000000000000000000000000000..2ac2c6bc99a01c001acc3b2f9b0830b4eb8f3884
--- /dev/null
+++ b/pool/shard011/JavaScript/0071318_logo_link.js
@@ -0,0 +1,41 @@
+/*!
+ * Mets viewer
+ *
+ * Copyright 2011, the National Library of Finland
+ * Licensed under the 2-clause FreeBSD licence.
+ * See the LICENSE file in the root directory of this application.
+ *
+ * Author: Pasi Tuominen, Juho Vuori
+ */
+
+var logo_link = {};
+
+logo_link._construct = function() {
+
+ var BASE_PATH = "http://urn.fi/";
+
+
+ onCoreReady(function() {
+
+ var path;
+
+ if (viewer.itemType() == 'fragmenta') {
+ var URN = "URN:NBN:fi-" + viewer.currentItem();
+ path = BASE_PATH + URN;
+ } else {
+ path = BASE_PATH + viewer.currentItem();
+ }
+
+ $link = $('');
+ $link.attr('href', path);
+
+ $('#logo img').wrap($link);
+
+
+
+
+ });
+
+
+}
+logo_link._construct();
diff --git a/pool/shard011/JavaScript/0071320_MessageContent.js b/pool/shard011/JavaScript/0071320_MessageContent.js
new file mode 100644
index 0000000000000000000000000000000000000000..a35bb8a5232d1dab9554725c0783f5afdaae1a8e
--- /dev/null
+++ b/pool/shard011/JavaScript/0071320_MessageContent.js
@@ -0,0 +1,63 @@
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+var _extends2 = require('babel-runtime/helpers/extends');
+
+var _extends3 = _interopRequireDefault(_extends2);
+
+var _classnames = require('classnames');
+
+var _classnames2 = _interopRequireDefault(_classnames);
+
+var _propTypes = require('prop-types');
+
+var _propTypes2 = _interopRequireDefault(_propTypes);
+
+var _react = require('react');
+
+var _react2 = _interopRequireDefault(_react);
+
+var _lib = require('../../lib');
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/**
+ * A message can contain a content.
+ */
+function MessageContent(props) {
+ var children = props.children,
+ className = props.className;
+
+ var classes = (0, _classnames2.default)('content', className);
+ var rest = (0, _lib.getUnhandledProps)(MessageContent, props);
+ var ElementType = (0, _lib.getElementType)(MessageContent, props);
+
+ return _react2.default.createElement(
+ ElementType,
+ (0, _extends3.default)({}, rest, { className: classes }),
+ children
+ );
+}
+
+MessageContent.handledProps = ['as', 'children', 'className'];
+MessageContent._meta = {
+ name: 'MessageContent',
+ parent: 'Message',
+ type: _lib.META.TYPES.COLLECTION
+};
+
+MessageContent.propTypes = process.env.NODE_ENV !== "production" ? {
+ /** An element type to render as (string or function). */
+ as: _lib.customPropTypes.as,
+
+ /** Primary content. */
+ children: _propTypes2.default.node,
+
+ /** Additional classes. */
+ className: _propTypes2.default.string
+} : {};
+
+exports.default = MessageContent;
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071321_npm-postinstall.js b/pool/shard011/JavaScript/0071321_npm-postinstall.js
new file mode 100644
index 0000000000000000000000000000000000000000..9c4116447bf1aa8b70bbb341970d3a573bc1ebc7
--- /dev/null
+++ b/pool/shard011/JavaScript/0071321_npm-postinstall.js
@@ -0,0 +1,24 @@
+process.chdir(__dirname);
+console.log('compiling client...');
+
+const path = require("path");
+const {exec} = require('child_process');
+
+const projectFolder = path.dirname(__dirname);
+const binPath = path.resolve(projectFolder, 'node_modules/.bin');
+const webpackPath = path.join(binPath, 'webpack');
+const webpackConfigPath = path.join(projectFolder, 'webpack.config.js');
+
+const commandText = `"${webpackPath}" -p --env=production --progress --colors --profile --config "${webpackConfigPath}"`;
+console.log(commandText);
+const command = exec(commandText);
+
+command.stdout.on('data', function (data) {
+ process.stdout.write(data);
+});
+command.stderr.on('data', function (data) {
+ process.stderr.write(data);
+});
+command.on('error', function (err) {
+ process.stderr.write(err);
+});
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071329_test-https-client-get-url.js b/pool/shard011/JavaScript/0071329_test-https-client-get-url.js
new file mode 100644
index 0000000000000000000000000000000000000000..ae5613c1434b29f31954dc6e3d17fecd9e8d5ac5
--- /dev/null
+++ b/pool/shard011/JavaScript/0071329_test-https-client-get-url.js
@@ -0,0 +1,58 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// 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.
+
+if (!process.versions.openssl) {
+ console.error('Skipping because node compiled without OpenSSL.');
+ process.exit(0);
+}
+
+// disable strict server certificate validation by the client
+process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
+
+var common = require('../common');
+var assert = require('assert');
+var https = require('https');
+var fs = require('fs');
+
+var seen_req = false;
+
+var options = {
+ key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
+ cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
+};
+
+var server = https.createServer(options, function(req, res) {
+ assert.equal('GET', req.method);
+ assert.equal('/foo?bar', req.url);
+ res.writeHead(200, {'Content-Type': 'text/plain'});
+ res.write('hello\n');
+ res.end();
+ server.close();
+ seen_req = true;
+});
+
+server.listen(common.PORT, function() {
+ https.get('https://127.0.0.1:' + common.PORT + '/foo?bar');
+});
+
+process.on('exit', function() {
+ assert(seen_req);
+});
diff --git a/pool/shard011/JavaScript/0071332_hmac.js b/pool/shard011/JavaScript/0071332_hmac.js
new file mode 100644
index 0000000000000000000000000000000000000000..faff12d3b1de43888524f2811813a3c8bd856289
--- /dev/null
+++ b/pool/shard011/JavaScript/0071332_hmac.js
@@ -0,0 +1,47 @@
+'use strict';
+
+var utils = require('./utils');
+var assert = require('minimalistic-assert');
+
+function Hmac(hash, key, enc) {
+ if (!(this instanceof Hmac))
+ return new Hmac(hash, key, enc);
+ this.Hash = hash;
+ this.blockSize = hash.blockSize / 8;
+ this.outSize = hash.outSize / 8;
+ this.inner = null;
+ this.outer = null;
+
+ this._init(utils.toArray(key, enc));
+}
+module.exports = Hmac;
+
+Hmac.prototype._init = function init(key) {
+ // Shorten key, if needed
+ if (key.length > this.blockSize)
+ key = new this.Hash().update(key).digest();
+ assert(key.length <= this.blockSize);
+
+ // Add padding to key
+ for (var i = key.length; i < this.blockSize; i++)
+ key.push(0);
+
+ for (i = 0; i < key.length; i++)
+ key[i] ^= 0x36;
+ this.inner = new this.Hash().update(key);
+
+ // 0x36 ^ 0x5c = 0x6a
+ for (i = 0; i < key.length; i++)
+ key[i] ^= 0x6a;
+ this.outer = new this.Hash().update(key);
+};
+
+Hmac.prototype.update = function update(msg, enc) {
+ this.inner.update(msg, enc);
+ return this;
+};
+
+Hmac.prototype.digest = function digest(enc) {
+ this.outer.update(this.inner.digest());
+ return this.outer.digest(enc);
+};
diff --git a/pool/shard011/JavaScript/0071334_paginator.js.src.js b/pool/shard011/JavaScript/0071334_paginator.js.src.js
new file mode 100644
index 0000000000000000000000000000000000000000..438485b75933dec1874d02b3be2d086541a66d0f
--- /dev/null
+++ b/pool/shard011/JavaScript/0071334_paginator.js.src.js
@@ -0,0 +1,222 @@
+var __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __slice = [].slice;
+
+define(['underscore', 'marionette', './base'], function(_, Marionette, base) {
+ var EmptyPage, ListingPage, LoadingPage, Page, PageRoll, Paginator, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
+ EmptyPage = (function(_super) {
+ __extends(EmptyPage, _super);
+
+ function EmptyPage() {
+ _ref = EmptyPage.__super__.constructor.apply(this, arguments);
+ return _ref;
+ }
+
+ EmptyPage.prototype.message = 'No page results';
+
+ return EmptyPage;
+
+ })(base.EmptyView);
+ LoadingPage = (function(_super) {
+ __extends(LoadingPage, _super);
+
+ function LoadingPage() {
+ _ref1 = LoadingPage.__super__.constructor.apply(this, arguments);
+ return _ref1;
+ }
+
+ LoadingPage.prototype.message = 'Loading page...';
+
+ return LoadingPage;
+
+ })(base.LoadView);
+ Paginator = (function(_super) {
+ __extends(Paginator, _super);
+
+ function Paginator() {
+ _ref2 = Paginator.__super__.constructor.apply(this, arguments);
+ return _ref2;
+ }
+
+ Paginator.prototype.template = 'paginator';
+
+ Paginator.prototype.requestDelay = 250;
+
+ Paginator.prototype.className = 'paginator';
+
+ Paginator.prototype.ui = {
+ first: '[data-page=first]',
+ prev: '[data-page=prev]',
+ next: '[data-page=next]',
+ last: '[data-page=last]',
+ pageCount: '.page-count',
+ currentPage: '.current-page',
+ buttons: '[data-toggle=tooltip]'
+ };
+
+ Paginator.prototype.modelEvents = {
+ 'change:pagecount': 'renderPageCount',
+ 'change:currentpage': 'renderCurrentPage'
+ };
+
+ Paginator.prototype.events = {
+ 'click [data-page=first]': 'requestChangePage',
+ 'click [data-page=prev]': 'requestChangePage',
+ 'click [data-page=next]': 'requestChangePage',
+ 'click [data-page=last]': 'requestChangePage'
+ };
+
+ Paginator.prototype.initialize = function() {
+ return this._changePage = _.debounce(this.changePage, this.requestDelay);
+ };
+
+ Paginator.prototype.onRender = function() {
+ this.ui.buttons.tooltip({
+ animation: false,
+ placement: 'bottom'
+ });
+ if (!this.model.pageIsLoading()) {
+ this.renderPageCount(this.model, this.model.getPageCount());
+ return this.renderCurrentPage.apply(this, [this.model].concat(__slice.call(this.model.getCurrentPageStats())));
+ }
+ };
+
+ Paginator.prototype.renderPageCount = function(model, value, options) {
+ return this.ui.pageCount.text(value);
+ };
+
+ Paginator.prototype.renderCurrentPage = function(model, value, options) {
+ this.ui.currentPage.text(value);
+ this.ui.first.prop('disabled', !!options.first);
+ this.ui.prev.prop('disabled', !!options.first);
+ this.ui.next.prop('disabled', !!options.last);
+ this.ui.last.prop('disabled', !!options.last);
+ if (!!options.first) {
+ this.ui.first.tooltip('hide');
+ this.ui.prev.tooltip('hide');
+ }
+ if (!!options.last) {
+ this.ui.next.tooltip('hide');
+ return this.ui.last.tooltip('hide');
+ }
+ };
+
+ Paginator.prototype.changePage = function(newPage) {
+ switch (newPage) {
+ case "first":
+ return this.model.getFirstPage();
+ case "prev":
+ return this.model.getPreviousPage();
+ case "next":
+ return this.model.getNextPage();
+ case "last":
+ return this.model.getLastPage();
+ default:
+ throw new Error("Unknown paginator direction: " + newPage);
+ }
+ };
+
+ Paginator.prototype.requestChangePage = function(event) {
+ return this._changePage($(event.currentTarget).data('page'));
+ };
+
+ return Paginator;
+
+ })(Marionette.ItemView);
+ Page = (function(_super) {
+ __extends(Page, _super);
+
+ function Page() {
+ _ref3 = Page.__super__.constructor.apply(this, arguments);
+ return _ref3;
+ }
+
+ return Page;
+
+ })(Marionette.ItemView);
+ ListingPage = (function(_super) {
+ __extends(ListingPage, _super);
+
+ function ListingPage() {
+ _ref4 = ListingPage.__super__.constructor.apply(this, arguments);
+ return _ref4;
+ }
+
+ ListingPage.prototype.itemView = Page;
+
+ ListingPage.prototype.emptyPage = EmptyPage;
+
+ ListingPage.prototype.itemViewOptions = function(item, index) {
+ return _.defaults({
+ model: item,
+ index: index
+ }, this.options);
+ };
+
+ return ListingPage;
+
+ })(Marionette.CollectionView);
+ PageRoll = (function(_super) {
+ __extends(PageRoll, _super);
+
+ function PageRoll() {
+ _ref5 = PageRoll.__super__.constructor.apply(this, arguments);
+ return _ref5;
+ }
+
+ PageRoll.prototype.options = {
+ list: true
+ };
+
+ PageRoll.prototype.itemView = Page;
+
+ PageRoll.prototype.listView = ListingPage;
+
+ PageRoll.prototype.emptyView = LoadingPage;
+
+ PageRoll.prototype.getItemView = function() {
+ if (this.options.list) {
+ return this.listView;
+ } else {
+ return this.itemView;
+ }
+ };
+
+ PageRoll.prototype.listViewOptions = function(item, index) {
+ return {
+ collection: item.items
+ };
+ };
+
+ PageRoll.prototype.itemViewOptions = function(item, index) {
+ var options;
+ options = {
+ model: item,
+ index: index
+ };
+ if (this.options.list) {
+ _.extend(options, this.listViewOptions(item, index));
+ }
+ return _.defaults(options, this.options);
+ };
+
+ PageRoll.prototype.collectionEvents = {
+ 'change:currentpage': 'showCurentPage'
+ };
+
+ PageRoll.prototype.showCurentPage = function(model, num, options) {
+ return this.children.each(function(view) {
+ return view.$el.toggle(view.model.id === num);
+ });
+ };
+
+ return PageRoll;
+
+ })(Marionette.CollectionView);
+ return {
+ Paginator: Paginator,
+ Page: Page,
+ ListingPage: ListingPage,
+ PageRoll: PageRoll
+ };
+});
diff --git a/pool/shard011/JavaScript/0071338_index_ssl.js b/pool/shard011/JavaScript/0071338_index_ssl.js
new file mode 100644
index 0000000000000000000000000000000000000000..a651ef2763be09179b891b5e24c3780371c6cc45
--- /dev/null
+++ b/pool/shard011/JavaScript/0071338_index_ssl.js
@@ -0,0 +1,143 @@
+var https = require('https');
+var fs = require('fs');
+
+var processRequest = function(req, res) {
+ console.log("Request received.")
+};
+
+var app = https.createServer({
+ key: fs.readFileSync('../cert/server.key'),
+ cert: fs.readFileSync('../cert/server.crt')
+ }, processRequest).listen(8888);
+
+var WebSocketServer = require("ws").Server;
+
+var wss = new WebSocketServer({
+ server: app
+});
+
+var users = {};
+
+function sendTo(conn, message) {
+ conn.send(JSON.stringify(message));
+}
+
+wss.on('listening', function () {
+ console.log("Server started...");
+});
+
+wss.on("connection", function(connection) {
+ console.log("User connected");
+
+ connection.on("message", function(message) {
+ var data;
+
+ try {
+ data = JSON.parse(message);
+ } catch (e) {
+ console.log("Error parsing JSON");
+ data = {};
+ }
+ switch (data.type) {
+ case "login":
+ console.log("User logged in as", data.name);
+ if (users[data.name]) {
+ sendTo(connection, {
+ type: "login",
+ success: false
+ });
+ } else {
+ users[data.name] = connection;
+ connection.name = data.name;
+ sendTo(connection, {
+ type: "login",
+ success: true
+ });
+ }
+ break;
+
+ case "offer":
+ console.log("Sending offer to", data.name);
+ var conn = users[data.name];
+ if (conn != null) {
+ connection.otherName = data.name;
+ sendTo(conn, {
+ type: "offer",
+ offer: data.offer,
+ name: connection.name
+ });
+ }
+ break;
+
+ case "answer":
+ console.log("Sending answer to", data.name);
+
+ var conn = users[data.name];
+ if (conn != null) {
+ //Make sure offer was done first
+ if(conn.otherName != connection.name){
+ break;
+ }
+
+ connection.otherName = data.name;
+ sendTo(conn, {
+ type: "answer",
+ answer: data.answer
+ });
+ }
+ break;
+
+ case "candidate":
+ console.log("Sending candidate to", data.name);
+ var conn = users[data.name];
+ if (conn != null) {
+ sendTo(conn, {
+ type: "candidate",
+ candidate: data.candidate
+ });
+ }
+ break;
+
+ case "leave":
+ console.log("Disconnecting user from", data.name);
+ var conn = users[data.name];
+ conn.otherName = null;
+
+ if (connection.otherName)
+ connection.otherName = null;
+
+ if (conn != null) {
+ sendTo(conn, {
+ type: "leave"
+ });
+ }
+ break;
+
+ default:
+ sendTo(connection, {
+ type: "error ",
+ message: "Unrecognized command:" + data.type
+ });
+ break;
+ }
+ });
+
+ connection.on("close", function() {
+ console.log("Closing connection for", connection.name);
+ if (connection.name) {
+ delete users[connection.name];
+
+ if (connection.otherName) {
+ console.log("Disconnecting user from",
+ connection.otherName);
+ var conn = users[connection.otherName];
+ conn.otherName = null;
+ if (conn != null) {
+ sendTo(conn, {
+ type: "leave"
+ });
+ }
+ }
+ }
+ });
+});
diff --git a/pool/shard011/JavaScript/0071341_dom.js b/pool/shard011/JavaScript/0071341_dom.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5ccecf13d623a4eb5f117c54c428df1c784d18a
--- /dev/null
+++ b/pool/shard011/JavaScript/0071341_dom.js
@@ -0,0 +1,79 @@
+define(['jquery'], function ($) {
+ 'use strict';
+
+ var html = $.fn.html,
+ slice = Array.prototype.slice,
+ commentStart = '0/)
+ })
+})
diff --git a/pool/shard011/JavaScript/0071365_File.js b/pool/shard011/JavaScript/0071365_File.js
new file mode 100644
index 0000000000000000000000000000000000000000..23d35b71fed1ca93c2a0cb933af7f8ab50b49319
--- /dev/null
+++ b/pool/shard011/JavaScript/0071365_File.js
@@ -0,0 +1,398 @@
+/**
+ * A file upload field which has custom styling and allows control over the button text and other
+ * features of {@link Ext.form.field.Text text fields} like {@link Ext.form.field.Text#emptyText empty text}.
+ * It uses a hidden file input element behind the scenes to allow user selection of a file and to
+ * perform the actual upload during {@link Ext.form.Basic#submit form submit}.
+ *
+ * Because there is no secure cross-browser way to programmatically set the value of a file input,
+ * the standard Field `setValue` method is not implemented. The `{@link #getValue}` method will return
+ * a value that is browser-dependent; some have just the file name, some have a full path, some use
+ * a fake path.
+ *
+ * **IMPORTANT:** File uploads are not performed using normal 'Ajax' techniques; see the description for
+ * {@link Ext.form.Basic#hasUpload} for details.
+ *
+ * # Example Usage
+ *
+ * @example
+ * Ext.create('Ext.form.Panel', {
+ * title: 'Upload a Photo',
+ * width: 400,
+ * bodyPadding: 10,
+ * frame: true,
+ * renderTo: Ext.getBody(),
+ * items: [{
+ * xtype: 'filefield',
+ * name: 'photo',
+ * fieldLabel: 'Photo',
+ * labelWidth: 50,
+ * msgTarget: 'side',
+ * allowBlank: false,
+ * anchor: '100%',
+ * buttonText: 'Select Photo...'
+ * }],
+ *
+ * buttons: [{
+ * text: 'Upload',
+ * handler: function() {
+ * var form = this.up('form').getForm();
+ * if(form.isValid()){
+ * form.submit({
+ * url: 'photo-upload.php',
+ * waitMsg: 'Uploading your photo...',
+ * success: function(fp, o) {
+ * Ext.Msg.alert('Success', 'Your photo "' + o.result.file + '" has been uploaded.');
+ * }
+ * });
+ * }
+ * }
+ * }]
+ * });
+ */
+Ext.define('Ext.form.field.File', {
+ extend: 'Ext.form.field.Text',
+ alias: ['widget.filefield', 'widget.fileuploadfield'],
+ alternateClassName: ['Ext.form.FileUploadField', 'Ext.ux.form.FileUploadField', 'Ext.form.File'],
+ requires: [
+ 'Ext.form.field.FileButton',
+ 'Ext.form.trigger.Component'
+ ],
+
+ /**
+ * @cfg {String} emptyText
+ * Overridden to undefined as {@link #emptyText} is not supported with {@link #inputType inputType}:'file' and should be avoided.
+ * The default text to place into an empty field.
+ */
+ emptyText: undefined,
+
+ needArrowKeys: false,
+
+ triggers: {
+ filebutton: {
+ type: 'component',
+ hideOnReadOnly: false,
+ // Most form fields prevent the default browser action on mousedown of the trigger.
+ // This is intended to prevent the field's input element from losing focus when
+ // the trigger is clicked. File fields disable this behavior because:
+ // 1. The input element does not receive focus when the field is focused. The button does.
+ // 2. Preventing the default action of touchstart (translated from mousedown
+ // on mobile browsers) prevents the browser's file dialog from opening.
+ preventMouseDown: false
+ }
+ },
+
+ //
+ /**
+ * @cfg {String} buttonText
+ * The button text to display on the upload button. Note that if you supply a value for
+ * {@link #buttonConfig}, the buttonConfig.text value will be used instead if available.
+ */
+ buttonText: 'Browse...',
+ //
+
+ /**
+ * @cfg {Boolean} buttonOnly
+ * True to display the file upload field as a button with no visible text field. If true, all
+ * inherited Text members will still be available.
+ */
+ buttonOnly: false,
+
+ /**
+ * @cfg {Number} buttonMargin
+ * The number of pixels of space reserved between the button and the text field. Note that this only
+ * applies if {@link #buttonOnly} = false.
+ */
+ buttonMargin: 3,
+
+ /**
+ * @cfg {Boolean} clearOnSubmit
+ * True to clear the selected file value when the form this field belongs to
+ * is submitted to the server.
+ */
+ clearOnSubmit: true,
+
+ /**
+ * @cfg {Object} buttonConfig
+ * Specify optional custom button {@link Ext.button.Button} config (eg. iconCls, text) for the upload button
+ */
+
+ /**
+ * @event change
+ * Fires when the underlying file input field's value has changed from the user selecting a new file from the system
+ * file selection dialog.
+ * @param {Ext.ux.form.FileUploadField} this
+ * @param {String} value The file value returned by the underlying file input field
+ */
+
+ /**
+ * @property {Ext.dom.Element} fileInputEl
+ * A reference to the invisible file input element created for this upload field. Only populated after this
+ * component is rendered.
+ */
+
+ /**
+ * @property {Ext.button.Button} button
+ * A reference to the trigger Button component created for this upload field. Only populated after this component is
+ * rendered.
+ */
+
+
+ /**
+ * @private
+ */
+ extraFieldBodyCls: Ext.baseCSSPrefix + 'form-file-wrap',
+
+ /**
+ * @private
+ */
+ inputCls: Ext.baseCSSPrefix + 'form-text-file',
+
+ /**
+ * @cfg {Boolean} [readOnly=true]
+ * Unlike with other form fields, the readOnly config defaults to true in File field.
+ */
+ readOnly: true,
+
+ /**
+ * @cfg {Boolean} editable
+ * @inheritdoc
+ */
+ editable: false,
+
+ submitValue: false,
+
+ /**
+ * Do not show hand pointer over text field since file choose dialog is only shown when clicking in the button
+ * @private
+ */
+ triggerNoEditCls: '',
+
+ /**
+ * @private
+ * Extract the file element, button outer element, and button active element.
+ */
+ childEls: ['browseButtonWrap'],
+
+ /**
+ * @private
+ */
+ applyTriggers: function(triggers) {
+ var me = this,
+ triggerCfg = (triggers || {}).filebutton;
+
+ if (triggerCfg) {
+ triggerCfg.component = Ext.apply({
+ xtype: 'filebutton',
+ ownerCt: me,
+ id: me.id + '-button',
+ ui: me.ui,
+ disabled: me.disabled,
+ text: me.buttonText,
+ style: me.buttonOnly ? '' : me.getButtonMarginProp() + me.buttonMargin + 'px',
+ inputName: me.getName(),
+ listeners: {
+ scope: me,
+ change: me.onFileChange
+ }
+ }, me.buttonConfig);
+
+ return me.callParent([triggers]);
+ }
+ //
+ else {
+ Ext.raise(me.$className + ' requires a valid trigger config containing "filebutton" specification');
+ }
+ //
+ },
+
+ getSubTplData: function(fieldData) {
+ var data = this.callParent([fieldData]);
+
+ // Input field itself should not be focusable since it's always decorative;
+ // however the input element is naturally focusable (and tabbable) so we have to
+ // deactivate it by setting its tabIndex to -1.
+ data.tabIdx = -1;
+
+ return data;
+ },
+
+ /**
+ * @private
+ */
+ onRender: function() {
+ var me = this,
+ inputEl, button, buttonEl, trigger;
+
+ me.callParent(arguments);
+
+ inputEl = me.inputEl;
+ //name goes on the fileInput, not the text input
+ inputEl.dom.name = '';
+
+ // Some browsers will show a blinking cursor in the field, even if it's readonly. If we do happen
+ // to receive focus, forward it on to our focusEl. Also note that in IE, the file input is treated as
+ // 2 elements for tabbing purposes (the text, then the button). So as you tab through, it will take 2
+ // tabs to get to the next field. As far as I know there's no way around this in any kind of reasonable way.
+ inputEl.on('focus', me.onInputFocus, me);
+ inputEl.on('mousedown', me.onInputMouseDown, me);
+
+ trigger = me.getTrigger('filebutton');
+ button = me.button = trigger.component;
+ me.fileInputEl = button.fileInputEl;
+ buttonEl = button.el;
+
+ if (me.buttonOnly) {
+ me.inputWrap.setDisplayed(false);
+ me.shrinkWrap = 3;
+ }
+
+ // Ensure the trigger element is sized correctly upon render
+ trigger.el.setWidth(buttonEl.getWidth() + buttonEl.getMargin('lr'));
+ if (Ext.isIE) {
+ me.button.getEl().repaint();
+ }
+ },
+
+ /**
+ * Gets the markup to be inserted into the subTplMarkup.
+ */
+ getTriggerMarkup: function() {
+ return ' | ';
+ },
+
+ /**
+ * @private
+ * Event handler fired when the user selects a file.
+ */
+ onFileChange: function(button, e, value) {
+ this.duringFileSelect = true;
+ Ext.form.field.File.superclass.setValue.call(this, value);
+ delete this.duringFileSelect;
+ },
+
+ didValueChange: function(){
+ // In the case of the file field, the change event will only ever fire
+ // if the value actually changes, so we always want to fire the change event
+ // This affects Chrome specifically, because hitting the cancel button will
+ // reset the file upload.
+ return !!this.duringFileSelect;
+ },
+
+ /**
+ * @method setEmptyText
+ * @hide
+ */
+ setEmptyText: Ext.emptyFn,
+
+ /**
+ * @method setValue
+ * @hide
+ */
+ setValue: Ext.emptyFn,
+
+ reset : function(){
+ var me = this,
+ clear = me.clearOnSubmit;
+ if (me.rendered) {
+ me.button.reset(clear);
+ me.fileInputEl = me.button.fileInputEl;
+ if (clear) {
+ me.inputEl.dom.value = '';
+ // Reset the underlying value if we're clearing it
+ Ext.form.field.File.superclass.setValue.call(this, null);
+ }
+ }
+ me.callParent();
+ },
+
+ onShow: function(){
+ this.callParent();
+ // If we started out hidden, the button may have a messed up layout
+ // since we don't act like a container
+ this.button.updateLayout();
+ },
+
+ onDisable: function(){
+ this.callParent();
+ this.button.disable();
+ },
+
+ onEnable: function(){
+ this.callParent();
+ this.button.enable();
+ },
+
+ /**
+ * @method
+ * @inheritdoc
+ */
+ isFileUpload: Ext.returnTrue,
+
+ extractFileInput: function() {
+ var me = this,
+ fileInput;
+
+ if (me.rendered) {
+ fileInput = me.button.fileInputEl.dom;
+ me.reset();
+ } else {
+ // Create a fake empty field here so it will still be submitted.
+ // All other unrendered fields provide a value.
+ fileInput = document.createElement('input');
+ fileInput.type = 'file';
+ fileInput.className = Ext.baseCSSPrefix + 'hidden-display';
+ fileInput.name = me.getName();
+ }
+ return fileInput;
+ },
+
+ restoreInput: function(el) {
+ // If we're not rendered we don't need to do anything, it will be created
+ // when we get flushed to the DOM.
+ if (this.rendered) {
+ var button = this.button;
+ button.restoreInput(el);
+ this.fileInputEl = button.fileInputEl;
+ }
+ },
+
+ onDestroy: function(){
+ this.fileInputEl = this.button = null;
+ this.callParent();
+ },
+
+ getButtonMarginProp: function() {
+ return 'margin-left:';
+ },
+
+ onInputFocus: function(e) {
+ this.focus();
+
+ // Switching focus from read only input element to file input
+ // results in incorrect positioning of the file input.
+ // Adding and removing position: relative helps to fix that.
+ // See https://sencha.jira.com/browse/EXTJS-18933
+ if (Ext.isIE9m) {
+ this.fileInputEl.addCls(Ext.baseCSSPrefix + 'position-relative');
+ this.fileInputEl.removeCls(Ext.baseCSSPrefix + 'position-relative');
+ }
+ },
+
+ onInputMouseDown: function(e) {
+ // Some browsers will show the cursor even if the input is read only,
+ // which will be visible in the short instant between inputEl focusing
+ // and subsequent focus jump to the FileButton. Preventing inputEl from
+ // focusing eliminates that flicker.
+ e.preventDefault();
+
+ this.focus();
+ },
+
+ privates: {
+ getFocusEl: function() {
+ return this.button;
+ },
+
+ getFocusClsEl: Ext.privateFn
+ }
+});
diff --git a/pool/shard011/JavaScript/0071368_polydragger.js b/pool/shard011/JavaScript/0071368_polydragger.js
new file mode 100644
index 0000000000000000000000000000000000000000..fef9296a917d0c160b26c74e27a3dee53b8f00fb
--- /dev/null
+++ b/pool/shard011/JavaScript/0071368_polydragger.js
@@ -0,0 +1,86 @@
+/**
+ *
+ * @author petr.sloup@klokantech.com (Petr Sloup)
+ *
+ * Copyright 2013 Klokan Technologies Gmbh (www.klokantech.com)
+ */
+
+goog.provide('weapi.markers.PolyDragger');
+
+goog.require('goog.dom');
+goog.require('goog.style');
+
+goog.require('weapi.markers.AbstractMarker');
+
+
+
+/**
+ * @inheritDoc
+ * @param {number} lat .
+ * @param {number} lon .
+ * @param {!weapi.App} app .
+ * @param {?number} fixedId .
+ * @param {!function(number, number, number)} updateFunc .
+ * @param {!function(number)} deleteFunc .
+ * @param {(function(number, number) : number)=} opt_createFunc .
+ * @extends {weapi.markers.AbstractMarker}
+ * @constructor
+ */
+weapi.markers.PolyDragger = function(lat, lon, app, fixedId,
+ updateFunc, deleteFunc, opt_createFunc) {
+ var marker = goog.dom.createDom('div', {'class':
+ 'we-polydragger-' + (goog.isDefAndNotNull(fixedId) ? 'a' : 'b')});
+
+ goog.base(this, lat, lon, /** @type {!HTMLElement} */ (marker));
+
+ this.show(false);
+
+ goog.events.listen(marker, goog.events.EventType.MOUSEDOWN, function(e_) {
+ if (e_.button == 0) {
+ goog.events.listen(app.canvas,
+ goog.events.EventType.MOUSEMOVE, function(e) {
+ var carte = app.camera.camera.
+ pickEllipsoid(new Cesium.Cartesian2(e.offsetX, e.offsetY));
+ if (goog.isDefAndNotNull(carte)) {
+ var carto = Cesium.Ellipsoid.WGS84.cartesianToCartographic(carte);
+ this.lat = goog.math.toDegrees(carto.latitude);
+ this.lon = goog.math.toDegrees(carto.longitude);
+ this.setXY(e.offsetX, e.offsetY); //for smoother dragging
+ if (goog.isDefAndNotNull(fixedId)) {
+ updateFunc(fixedId, this.lat, this.lon);
+ } else if (opt_createFunc) {
+ fixedId = opt_createFunc(this.lat, this.lon);
+ marker.className = 'we-polydragger-a';
+ }
+ e.preventDefault();
+ }
+ }, false, this);
+ e_.preventDefault();
+ }
+ }, false, this);
+
+ goog.events.listen(marker, goog.events.EventType.CLICK, function(e) {
+ if (e.altKey && goog.isDefAndNotNull(fixedId)) {
+ deleteFunc(fixedId);
+ e.preventDefault();
+ }
+ }, false, this);
+
+ goog.events.listen(marker, goog.events.EventType.MOUSEUP, function(e) {
+ goog.events.removeAll(app.canvas,
+ goog.events.EventType.MOUSEMOVE);
+ }, false, this);
+};
+goog.inherits(weapi.markers.PolyDragger, weapi.markers.AbstractMarker);
+
+
+goog.style.installStyles(
+ '.we-polydragger-a{position:absolute;width:8px;height:8px;z-index:100;' +
+ 'margin-left:-4px;margin-top:-4px;background-color:#36f;' +
+ 'cursor:pointer;border:1px solid blue;}'
+);
+goog.style.installStyles(
+ '.we-polydragger-b{position:absolute;width:6px;height:6px;z-index:99;' +
+ 'margin-left:-3px;margin-top:-3px;background-color:rgba(180,220,250,0.9);' +
+ 'cursor:pointer;border:1px solid blue;}'
+);
diff --git a/pool/shard011/JavaScript/0071370_arc.js b/pool/shard011/JavaScript/0071370_arc.js
new file mode 100644
index 0000000000000000000000000000000000000000..ddec4425a894cc5f40ffd245e732aefc3a08ab18
--- /dev/null
+++ b/pool/shard011/JavaScript/0071370_arc.js
@@ -0,0 +1,33 @@
+import React from 'react'
+
+/**
+ * An HTML5 arc.
+ *
+ * Props:
+ * start={r, theta}
+ * stop={r, theta}
+ * service= coordinate transform service, injected by the parent.
+ * path= path2d injected by the parent.
+ *
+ * Radius for the arc comes from the start prop.
+ * The coordinates are referenced to the polar grid, not the canvas.
+ */
+export default class Arc extends React.Component {
+ constructor(props) {
+ super(props)
+ this.getPath = this.getPath.bind(this)
+ }
+
+ getPath(translate) {
+ const path = new Path2D()
+ let o = translate.offset
+ let s = translate.polarToCanvaspolar(this.props.start)
+ let e = translate.polarToCanvaspolar(this.props.end)
+ path.arc(o.x, o.y, s.theta, e.theta, s.r)
+ return path
+ }
+
+ render() {
+ return null
+ }
+}
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071375_app.js b/pool/shard011/JavaScript/0071375_app.js
new file mode 100644
index 0000000000000000000000000000000000000000..538bd716be74fbe0c92ff845418fecd4fcb184dd
--- /dev/null
+++ b/pool/shard011/JavaScript/0071375_app.js
@@ -0,0 +1,47 @@
+var app = angular.module('kitIoT', ['ngRoute']);
+
+app.config(function ($routeProvider) {
+ $routeProvider
+ .when('/', {
+ templateUrl: 'views/mainView.html',
+ controller : 'mainCtrl'
+ })
+ .when('/dashboard', {
+ templateUrl: 'views/dashboardView.html',
+ controller : 'dashBoardCtrl'
+ })
+ .when('/disconnect', {
+ templateUrl: 'views/disconnectView.html',
+ controller : 'disconnectCtrl'
+ })
+ .when('/logout', {
+ templateUrl: 'views/mainView.html',
+ controller : 'logoutCtrl'
+ })
+ .otherwise({
+ redirectTo: '/'
+ });
+ });
+
+app.run(function ($rootScope, $location, Auth, socket) {
+ $rootScope.$on('$routeChangeStart', function (event, next, current) {
+
+ //If saving data stop
+ socket.emit('stop');
+
+ if (!Auth.isLoggedIn()) {
+ $location.path('/dashboard');
+
+ } else if (next.templateUrl === 'views/disconnectView.html') {
+ $location.path('/disconnect');
+
+ } else {
+ $location.path('/dashboard');
+ }
+ });
+
+ $rootScope.$on("$routeChangeSuccess", function () {
+ $rootScope.url = $location.path();
+ });
+});
+
diff --git a/pool/shard011/JavaScript/0071377_init.js b/pool/shard011/JavaScript/0071377_init.js
new file mode 100644
index 0000000000000000000000000000000000000000..28780ed2052c62f94f32b207144846c92af7b741
--- /dev/null
+++ b/pool/shard011/JavaScript/0071377_init.js
@@ -0,0 +1,47 @@
+/**
+ * @version: $Id: init.js 4387 2015-02-19 12:24:35Z Radek Suski $
+ * @package: SobiPro Library
+
+ * @author
+ * Name: Sigrid Suski & Radek Suski, Sigsiu.NET GmbH
+ * Email: sobi[at]sigsiu.net
+ * Url: http://www.Sigsiu.NET
+
+ * @copyright Copyright (C) 2006 - 2015 Sigsiu.NET GmbH (http://www.sigsiu.net). All rights reserved.
+ * @license GNU/LGPL Version 3
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation, and under the additional terms according section 7 of GPL v3.
+ * See http://www.gnu.org/licenses/lgpl.html and http://sobipro.sigsiu.net/licenses.
+
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ * $Date: 2015-02-19 13:24:35 +0100 (Thu, 19 Feb 2015) $
+ * $Revision: 4387 $
+ * $Author: Radek Suski $
+ * File location: components/com_sobipro/lib/js/calendar/init.js $
+ */
+
+function SPCalendar( id, bid, format )
+{
+ if( !format ) {
+ format = "__FORMAT__";
+ }
+ var el = SP_id( id );
+ if ( calendar != null ) {
+ calendar.hide();
+ calendar.parseDate( el.value );
+ } else {
+ var cal = new Calendar( true, null, SPSelectedDate, SPCloseCal );
+ calendar = cal;
+ SobiCal = cal;
+ cal.setRange( 1800, 2300 );
+ calendar.create();
+ }
+ calendar.setDateFormat( format );
+ calendar.setTtDateFormat( "__FORMAT_TXT__" );
+ calendar.parseDate( el.value );
+ calendar.sel = el;
+ calendar.showAtElement( SP_id( id ) );
+ return false;
+}
+function SPCloseCal( c ) { c.hide(); }
+function SPSelectedDate( c, d ) { c.sel.value = d; }
diff --git a/pool/shard011/JavaScript/0071379_test_component_builder.js b/pool/shard011/JavaScript/0071379_test_component_builder.js
new file mode 100644
index 0000000000000000000000000000000000000000..825cab8dc12ad352d330e3af4622b61582bb1a63
--- /dev/null
+++ b/pool/shard011/JavaScript/0071379_test_component_builder.js
@@ -0,0 +1,218 @@
+/* */
+"format esm";
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+var __metadata = (this && this.__metadata) || function (k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
+};
+import { DynamicComponentLoader, Injector, Injectable } from 'angular2/core';
+import { DirectiveResolver, ViewResolver } from 'angular2/compiler';
+import { isPresent } from 'angular2/src/facade/lang';
+import { PromiseWrapper } from 'angular2/src/facade/async';
+import { MapWrapper } from 'angular2/src/facade/collection';
+import { el } from './utils';
+import { DOCUMENT } from 'angular2/src/platform/dom/dom_tokens';
+import { DOM } from 'angular2/src/platform/dom/dom_adapter';
+import { getDebugNode } from 'angular2/src/core/debug/debug_node';
+import { tick } from './fake_async';
+/**
+ * Fixture for debugging and testing a component.
+ */
+export class ComponentFixture {
+ constructor(componentRef) {
+ this.changeDetectorRef = componentRef.changeDetectorRef;
+ this.elementRef = componentRef.location;
+ this.debugElement = getDebugNode(this.elementRef.nativeElement);
+ this.componentInstance = componentRef.instance;
+ this.nativeElement = this.elementRef.nativeElement;
+ this.componentRef = componentRef;
+ }
+ /**
+ * Trigger a change detection cycle for the component.
+ */
+ detectChanges(checkNoChanges = true) {
+ this.changeDetectorRef.detectChanges();
+ if (checkNoChanges) {
+ this.checkNoChanges();
+ }
+ }
+ checkNoChanges() { this.changeDetectorRef.checkNoChanges(); }
+ /**
+ * Trigger component destruction.
+ */
+ destroy() { this.componentRef.destroy(); }
+}
+var _nextRootElementId = 0;
+/**
+ * Builds a ComponentFixture for use in component level tests.
+ */
+let TestComponentBuilder_1;
+export let TestComponentBuilder = TestComponentBuilder_1 = class TestComponentBuilder {
+ constructor(_injector) {
+ this._injector = _injector;
+ /** @internal */
+ this._bindingsOverrides = new Map();
+ /** @internal */
+ this._directiveOverrides = new Map();
+ /** @internal */
+ this._templateOverrides = new Map();
+ /** @internal */
+ this._viewBindingsOverrides = new Map();
+ /** @internal */
+ this._viewOverrides = new Map();
+ }
+ /** @internal */
+ _clone() {
+ var clone = new TestComponentBuilder_1(this._injector);
+ clone._viewOverrides = MapWrapper.clone(this._viewOverrides);
+ clone._directiveOverrides = MapWrapper.clone(this._directiveOverrides);
+ clone._templateOverrides = MapWrapper.clone(this._templateOverrides);
+ clone._bindingsOverrides = MapWrapper.clone(this._bindingsOverrides);
+ clone._viewBindingsOverrides = MapWrapper.clone(this._viewBindingsOverrides);
+ return clone;
+ }
+ /**
+ * Overrides only the html of a {@link ComponentMetadata}.
+ * All the other properties of the component's {@link ViewMetadata} are preserved.
+ *
+ * @param {Type} component
+ * @param {string} html
+ *
+ * @return {TestComponentBuilder}
+ */
+ overrideTemplate(componentType, template) {
+ var clone = this._clone();
+ clone._templateOverrides.set(componentType, template);
+ return clone;
+ }
+ /**
+ * Overrides a component's {@link ViewMetadata}.
+ *
+ * @param {Type} component
+ * @param {view} View
+ *
+ * @return {TestComponentBuilder}
+ */
+ overrideView(componentType, view) {
+ var clone = this._clone();
+ clone._viewOverrides.set(componentType, view);
+ return clone;
+ }
+ /**
+ * Overrides the directives from the component {@link ViewMetadata}.
+ *
+ * @param {Type} component
+ * @param {Type} from
+ * @param {Type} to
+ *
+ * @return {TestComponentBuilder}
+ */
+ overrideDirective(componentType, from, to) {
+ var clone = this._clone();
+ var overridesForComponent = clone._directiveOverrides.get(componentType);
+ if (!isPresent(overridesForComponent)) {
+ clone._directiveOverrides.set(componentType, new Map());
+ overridesForComponent = clone._directiveOverrides.get(componentType);
+ }
+ overridesForComponent.set(from, to);
+ return clone;
+ }
+ /**
+ * Overrides one or more injectables configured via `providers` metadata property of a directive
+ * or
+ * component.
+ * Very useful when certain providers need to be mocked out.
+ *
+ * The providers specified via this method are appended to the existing `providers` causing the
+ * duplicated providers to
+ * be overridden.
+ *
+ * @param {Type} component
+ * @param {any[]} providers
+ *
+ * @return {TestComponentBuilder}
+ */
+ overrideProviders(type, providers) {
+ var clone = this._clone();
+ clone._bindingsOverrides.set(type, providers);
+ return clone;
+ }
+ /**
+ * @deprecated
+ */
+ overrideBindings(type, providers) {
+ return this.overrideProviders(type, providers);
+ }
+ /**
+ * Overrides one or more injectables configured via `providers` metadata property of a directive
+ * or
+ * component.
+ * Very useful when certain providers need to be mocked out.
+ *
+ * The providers specified via this method are appended to the existing `providers` causing the
+ * duplicated providers to
+ * be overridden.
+ *
+ * @param {Type} component
+ * @param {any[]} providers
+ *
+ * @return {TestComponentBuilder}
+ */
+ overrideViewProviders(type, providers) {
+ var clone = this._clone();
+ clone._viewBindingsOverrides.set(type, providers);
+ return clone;
+ }
+ /**
+ * @deprecated
+ */
+ overrideViewBindings(type, providers) {
+ return this.overrideViewProviders(type, providers);
+ }
+ /**
+ * Builds and returns a ComponentFixture.
+ *
+ * @return {Promise}
+ */
+ createAsync(rootComponentType) {
+ var mockDirectiveResolver = this._injector.get(DirectiveResolver);
+ var mockViewResolver = this._injector.get(ViewResolver);
+ this._viewOverrides.forEach((view, type) => mockViewResolver.setView(type, view));
+ this._templateOverrides.forEach((template, type) => mockViewResolver.setInlineTemplate(type, template));
+ this._directiveOverrides.forEach((overrides, component) => {
+ overrides.forEach((to, from) => { mockViewResolver.overrideViewDirective(component, from, to); });
+ });
+ this._bindingsOverrides.forEach((bindings, type) => mockDirectiveResolver.setBindingsOverride(type, bindings));
+ this._viewBindingsOverrides.forEach((bindings, type) => mockDirectiveResolver.setViewBindingsOverride(type, bindings));
+ var rootElId = `root${_nextRootElementId++}`;
+ var rootEl = el(``);
+ var doc = this._injector.get(DOCUMENT);
+ // TODO(juliemr): can/should this be optional?
+ var oldRoots = DOM.querySelectorAll(doc, '[id^=root]');
+ for (var i = 0; i < oldRoots.length; i++) {
+ DOM.remove(oldRoots[i]);
+ }
+ DOM.appendChild(doc.body, rootEl);
+ var promise = this._injector.get(DynamicComponentLoader)
+ .loadAsRoot(rootComponentType, `#${rootElId}`, this._injector);
+ return promise.then((componentRef) => { return new ComponentFixture(componentRef); });
+ }
+ createFakeAsync(rootComponentType) {
+ var result;
+ var error;
+ PromiseWrapper.then(this.createAsync(rootComponentType), (_result) => { result = _result; }, (_error) => { error = _error; });
+ tick();
+ if (isPresent(error)) {
+ throw error;
+ }
+ return result;
+ }
+};
+TestComponentBuilder = TestComponentBuilder_1 = __decorate([
+ Injectable(),
+ __metadata('design:paramtypes', [Injector])
+], TestComponentBuilder);
diff --git a/pool/shard011/JavaScript/0071382_index.js b/pool/shard011/JavaScript/0071382_index.js
new file mode 100644
index 0000000000000000000000000000000000000000..7a76b869a28d0f2a17903c1399b7c08edea9fcd1
--- /dev/null
+++ b/pool/shard011/JavaScript/0071382_index.js
@@ -0,0 +1,132 @@
+/*jshint strict: false*/
+
+'use strict';
+
+var gutil = require('gulp-util');
+var log = require('./log.js');
+var path = require('path');
+var rsync = require('./rsync.js');
+var through = require('through2');
+
+var PluginError = gutil.PluginError;
+
+module.exports = function(options) {
+ if (typeof options !== 'object') {
+ this.emit(
+ 'error',
+ new PluginError('gulp-rsync', 'options must be an object')
+ );
+ }
+
+ if (typeof options.destination !== 'string') {
+ throw new PluginError(
+ 'gulp-rsync',
+ 'destination must be a string to a desired path'
+ );
+ }
+
+ var sources = [];
+
+ var cwd = options.root ? path.resolve(options.root) : process.cwd();
+
+ return through.obj(function(file, enc, cb) {
+ if (file.isStream()) {
+ this.emit(
+ 'error',
+ new PluginError('gulp-rsync', 'Streams are not supported!')
+ );
+ }
+
+ if (path.relative(cwd, file.path).indexOf('..') === 0) {
+ this.emit(
+ 'error',
+ new PluginError('gulp-rsync', 'Source contains paths outside of root')
+ );
+ }
+
+ sources.push(file);
+ cb(null, file);
+ }, function(cb) {
+ sources = sources.filter(function(source) {
+ return !source.isNull() ||
+ options.emptyDirectories ||
+ (source.path === cwd && options.recursive);
+ });
+
+ if (sources.length === 0) {
+ cb();
+ return;
+ }
+
+ var shell = options.shell;
+ if (options.port) {
+ shell = 'ssh -p ' + options.port;
+ }
+
+ var destination = options.destination;
+ if (options.hostname) {
+ destination = options.hostname + ':' + destination;
+ if (options.username) {
+ destination = options.username + '@' + destination;
+ }
+ } else {
+ destination = path.relative(cwd, path.resolve(process.cwd(), destination));
+ }
+
+ var config = {
+ options: {
+ 'R': options.relative !== false,
+ 'c': options.incremental,
+ 'd': options.emptyDirectories,
+ 'e': shell,
+ 'r': options.recursive,
+ 't': options.times,
+ 'u': options.update,
+ 'v': !options.silent,
+ 'z': options.compress,
+ 'exclude': options.exclude,
+ 'include': options.include,
+ 'progress': options.progress
+ },
+ source: sources.map(function(source) {
+ return path.relative(cwd, source.path) || '.';
+ }),
+ destination: destination,
+ cwd: cwd
+ };
+
+ if (options.clean) {
+ if (!options.recursive) {
+ this.emit(
+ 'error',
+ new PluginError('gulp-rsync', 'clean requires recursive option')
+ );
+ }
+ config.options['delete'] = true;
+ }
+
+ if (!options.silent) {
+ var handler = function(data) {
+ data.toString().split('\r').forEach(function(chunk) {
+ chunk.split('\n').forEach(function(line, j, lines) {
+ log('gulp-rsync:', line, (j < lines.length - 1 ? '\n' : ''));
+ });
+ });
+ };
+ config.stdoutHandler = handler;
+ config.stderrHandler = handler;
+
+ gutil.log('gulp-rsync:', 'Starting rsync to ' + destination + '...');
+ }
+
+ rsync(config).execute(function(error, command) {
+ if (error) {
+ this.emit('error', new PluginError('gulp-rsync', error.stack));
+ }
+ if (!options.silent) {
+ gutil.log('gulp-rsync:', 'Completed rsync.');
+ }
+ cb();
+ });
+ });
+};
diff --git a/pool/shard011/JavaScript/0071389_compare.js b/pool/shard011/JavaScript/0071389_compare.js
new file mode 100644
index 0000000000000000000000000000000000000000..bd132166bc698b06c15b2ec5d1bd26b7ef9c595c
--- /dev/null
+++ b/pool/shard011/JavaScript/0071389_compare.js
@@ -0,0 +1,54 @@
+"use strict";
+
+var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
+
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
+
+import { first, path } from "../utils";
+import { Change as defaultOptions } from "./defaultOptionsForComputation";
+
+export default function () {
+ var options = defaultOptions;
+
+ function calculator(data) {
+ var _options = options,
+ basePath = _options.basePath,
+ mainKeys = _options.mainKeys,
+ compareKeys = _options.compareKeys;
+
+ var base = path(basePath);
+
+ var f = first(data);
+ var b = base(f);
+ var compareData = data.map(function (d) {
+ // eslint-disable-next-line prefer-const
+ var result = {};
+
+ mainKeys.forEach(function (key) {
+ if (_typeof(d[key]) === "object") {
+ result[key] = {};
+ Object.keys(d[key]).forEach(function (subkey) {
+ result[key][subkey] = (d[key][subkey] - b) / b;
+ });
+ } else {
+ result[key] = (d[key] - b) / b;
+ }
+ });
+
+ compareKeys.forEach(function (key) {
+ result[key] = (d[key] - f[key]) / f[key];
+ });
+ return result;
+ });
+ // console.log(compareData[20]);
+ return compareData;
+ }
+ calculator.options = function (x) {
+ if (!arguments.length) {
+ return options;
+ }
+ options = _extends({}, defaultOptions, x);
+ return calculator;
+ };
+ return calculator;
+}
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071394_Underage_people.js b/pool/shard011/JavaScript/0071394_Underage_people.js
new file mode 100644
index 0000000000000000000000000000000000000000..f500dc43a9101925f2b1a83dc5e821b5ef36d188
--- /dev/null
+++ b/pool/shard011/JavaScript/0071394_Underage_people.js
@@ -0,0 +1,96 @@
+// Problem 3. Underage people
+//
+// * Write a function that prints all underaged persons of an array of person
+// * Use **Array#filter** and **Array#forEach**
+// * Use **only array methods** and no regular loops (for, while)
+
+
+function printAllUnderagedPersons() {
+
+ var allUnderagedPersons,
+ people = getArrayOfPersons(10, 13, 35);
+
+ jsConsole.writeLine('Array with 10 persons : ');
+ jsConsole.writeLine('');
+
+ printArrayOfPersons(people);
+ jsConsole.writeLine('');
+
+ allUnderagedPersons = getAllUnderagedPersons(people);
+
+ jsConsole.writeLine('Array of all underaged persons : ');
+ printArrayOfPersons(allUnderagedPersons);
+
+ jsConsole.writeLine('-----------------------------------------------------------------------------');
+}
+
+function getAllUnderagedPersons(people) {
+
+ function isUnderaged(item) {
+ return item.age < 18;
+ }
+
+ return people.filter(isUnderaged);
+}
+
+function printArrayOfPersons(people) {
+
+ people.forEach(function (person) {
+ jsConsole.writeLine(person.toString());
+ });
+}
+
+function getArrayOfPersons(number, fromAge, toAge) {
+
+ var i,
+ firstName,
+ lastName,
+ age,
+ arrayOfPersons = [],
+ femaleFirstNames = ['Anna', 'Iliana', 'Petja', 'Elica', 'Elena', 'Gergana', 'Rosica', 'Vesela'],
+ femaleLastNames = ['Ivanova', 'Ilieva', 'Dimitrova', 'Kostova', 'Petrova', 'Koleva', 'Taneva'],
+ maleFirstNames = ['Doncho', 'Nikolay', 'Ivaylo', 'Pavel', 'Sergej', 'Blagovest', 'Georgi', 'Vladimir', 'Stefan'],
+ maleLastNames = ['Minkov', 'Kostov', 'Kenov', 'Krasev', 'Sendov', 'Petrov', 'Iliev', 'Markov', 'Cvetkov'];
+
+ for (i = 0; i < number; i++) {
+
+ if (getRandomInt(0, 1)) {
+
+ // female
+
+ firstName = femaleFirstNames[getRandomInt(0, femaleFirstNames.length - 1)];
+ lastName = femaleLastNames[getRandomInt(0, femaleLastNames.length - 1)];
+ age = getRandomInt(fromAge, toAge);
+
+ arrayOfPersons.push(new Person(firstName, lastName, age, true));
+
+ } else {
+
+ // male
+
+ firstName = maleFirstNames[getRandomInt(0, maleFirstNames.length - 1)];
+ lastName = maleLastNames[getRandomInt(0, maleLastNames.length - 1)];
+ age = getRandomInt(fromAge, toAge);
+
+ arrayOfPersons.push(new Person(firstName, lastName, age, false));
+ }
+ }
+
+ return arrayOfPersons;
+}
+
+function Person(firstname, lastname, age, gender) {
+
+ this.firstname = firstname;
+ this.lastname = lastname;
+ this.age = age;
+ this.gender = gender;
+ this.toString = function () {
+ return 'Name: ' + this.firstname + ' ' + this.lastname + ', age: ' + this.age + ', gender: ' + (this.gender ? 'female' : 'male');
+ }
+}
+
+// Returns a random integer between min (inclusive) and max (inclusive)
+function getRandomInt(min, max) {
+ return Math.floor(Math.random() * (max - min + 1)) + min;
+}
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071399_es6.js b/pool/shard011/JavaScript/0071399_es6.js
new file mode 100644
index 0000000000000000000000000000000000000000..ba3748f10ba847acde8374d9ec55238d089930b3
--- /dev/null
+++ b/pool/shard011/JavaScript/0071399_es6.js
@@ -0,0 +1,209 @@
+/**
+ * @license
+ * Copyright The Closure Library Authors.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/**
+ * @fileoverview Shims between goog.iter.Iterator and ES6 iterator.
+ */
+
+goog.module('goog.iter.es6');
+goog.module.declareLegacyNamespace();
+
+const GoogIterable = goog.require('goog.iter.Iterable');
+const GoogIterator = goog.require('goog.iter.Iterator');
+const StopIteration = goog.require('goog.iter.StopIteration');
+
+
+/**
+ * Common interface extending both `goog.iter.Iterable` and ES6 `Iterable`,
+ * and providing `toGoog()` and `toEs6()` methods to get either kind
+ * of iterator. `ShimIterable.of()` is the primary entry point for
+ * this library. If it is given an iterable that is *not* also an
+ * iterator, then it will inherit any reusability from its argument
+ * (i.e. `ShimIterable.of(mySet)` will be reusable, since mySet makes
+ * a fresh Iterator every time, whereas `ShimIterable.of(myIterator)`
+ * will be one-shot).
+ *
+ * `ShimGoogIterator` and `ShimEs6Iterator` extend `ShimIterable` and
+ * also implement one or the other iterator API. Since they extend
+ * `ShimIterable`, it is easy to convert back and forth between the two
+ * APIs. Any such conversion will expose a view to the same underlying
+ * iterator, so elements pulled via one API will not be available from
+ * the other.
+ *
+ * @interface
+ * @extends {Iterable}
+ * @template VALUE
+ */
+class ShimIterable {
+ /** @return {!GoogIterator} */
+ __iterator__() {}
+
+ /** @return {!ShimGoogIterator} */
+ toGoog() {}
+
+ /** @return {!ShimEs6Iterator} */
+ toEs6() {}
+
+ /**
+ * @param {!Iterable|!Iterator|
+ * !GoogIterator|!GoogIterable} iter
+ * @return {!ShimIterable}
+ * @template VALUE
+ */
+ static of(iter) {
+ if (iter instanceof ShimIterableImpl || iter instanceof ShimGoogIterator ||
+ iter instanceof ShimEs6Iterator) {
+ return iter;
+ } else if (typeof iter.next == 'function') {
+ return new ShimIterableImpl(
+ () => wrapGoog(/** @type {!Iterator|!GoogIterator} */ (iter)));
+ } else if (typeof iter[Symbol.iterator] == 'function') {
+ return new ShimIterableImpl(() => iter[Symbol.iterator]());
+ } else if (typeof iter.__iterator__ == 'function') {
+ return new ShimIterableImpl(
+ () => wrapGoog(
+ /** @type {{__iterator__:function(this:?, boolean=)}} */ (iter)
+ .__iterator__()));
+ }
+ throw new Error('Not an iterator or iterable.');
+ }
+}
+
+
+/**
+ * @param {!GoogIterator|!Iterator} iter
+ * @return {!Iterator}
+ * @template VALUE
+ */
+const wrapGoog = (iter) => {
+ if (!(iter instanceof GoogIterator)) return iter;
+ let done = false;
+ return /** @type {?} */ ({
+ next() {
+ let value;
+ while (!done) {
+ try {
+ value = iter.next();
+ break;
+ } catch (err) {
+ if (err !== StopIteration) throw err;
+ done = true;
+ }
+ }
+ return {value, done};
+ },
+ });
+};
+
+
+/**
+ * Concrete (private) implementation of a non-iterator iterable. This is
+ * separate from the iterator versions since it supports iterables that
+ * are not "one-shot".
+ * @implements {ShimIterable}
+ * @template VALUE
+ */
+class ShimIterableImpl {
+ /** @param {function(): !Iterator} func */
+ constructor(func) {
+ /** @const @private */
+ this.func_ = func;
+ }
+
+ /** @override */
+ __iterator__() {
+ return new ShimGoogIterator(this.func_());
+ }
+
+ /** @override */
+ toGoog() {
+ return new ShimGoogIterator(this.func_());
+ }
+
+ /** @override */
+ [Symbol.iterator]() {
+ return new ShimEs6Iterator(this.func_());
+ }
+
+ /** @override */
+ toEs6() {
+ return new ShimEs6Iterator(this.func_());
+ }
+}
+
+
+/**
+ * Concrete `goog.iter.Iterator` subclass that also implements `ShimIterable`.
+ * @extends {GoogIterator}
+ * @implements {ShimIterable}
+ * @template VALUE
+ */
+class ShimGoogIterator extends GoogIterator {
+ /** @param {!Iterator} iter */
+ constructor(iter) {
+ super();
+ this.iter_ = iter;
+ }
+
+ /** @override */
+ nextValueOrThrow() {
+ const result = this.iter_.next();
+ if (result.done) throw StopIteration;
+ return result.value;
+ }
+ /**
+ * TODO(user): Please do not remove - this will be cleaned up
+ * centrally.
+ * @override @see {!goog.iter.Iterator}
+ */
+ next() {
+ return ShimGoogIterator.prototype.nextValueOrThrow.call(this);
+ }
+
+
+ /** @override */
+ toGoog() {
+ return this;
+ }
+
+ /** @override */
+ [Symbol.iterator]() {
+ return new ShimEs6Iterator(this.iter_);
+ }
+
+ /** @override */
+ toEs6() {
+ return new ShimEs6Iterator(this.iter_);
+ }
+}
+
+
+/**
+ * Concrete ES6 `Iterator` that also implements `ShimIterable`.
+ * @implements {IteratorIterable}
+ * @extends {ShimIterableImpl}
+ * @template VALUE
+ */
+class ShimEs6Iterator extends ShimIterableImpl {
+ /** @param {!Iterator} iter */
+ constructor(iter) {
+ super(() => iter);
+ /** @const @private */
+ this.iter_ = iter;
+ }
+
+ /** @override */
+ next() {
+ return this.iter_.next();
+ }
+}
+
+
+exports = {
+ ShimIterable,
+ ShimEs6Iterator,
+ ShimGoogIterator,
+};
diff --git a/pool/shard011/JavaScript/0071401_addresses.js b/pool/shard011/JavaScript/0071401_addresses.js
new file mode 100644
index 0000000000000000000000000000000000000000..15f31157989e448f29af959ab49b0ad1b622af37
--- /dev/null
+++ b/pool/shard011/JavaScript/0071401_addresses.js
@@ -0,0 +1,157 @@
+'use strict';
+
+// Library for working with clipboard
+const Clipboard = require('clipboard');
+// Tracks addresses
+var addresses = [];
+// Tracks addresses fitting a search string
+var searchedAddresses = [];
+
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Address Page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Make wallet address html element
+function makeAddress(address, number) {
+ // Make and store a jquery element for the address
+ var element = $(`
+
+ `);
+ element.attr('id', address);
+ element.find('.listnum').text(number);
+ element.find('.address').append(address);
+
+ // Make clicking this address show relevant transactions
+ element.find('.address').click(function(event) {
+ updateTransactionCriteria({
+ address: event.target.id,
+ });
+ });
+
+ // Make copy-to-clipboard button clickable
+ element.find('.copy-address').click(function() {
+ Clipboard.writeText(this.parentNode.id);
+ notify('Copied address to clipboard', 'copied');
+ });
+
+ // Append and show the address element
+ $('#address-list').append(element);
+}
+
+// Fill address page with search results or addresses
+function updateAddressPage() {
+ // TODO: Merge itemsPerPage into Transaction's filter criteria and make an overall
+ // settings object, perhaps just as a member of the `wallet` object
+ var itemsPerPage = 25;
+ $('#address-list').empty();
+
+ // Determine if search or normal page
+ var array = $('#search-bar').val() ? searchedAddresses : addresses;
+ var maxPage = array.length === 0 ? 1 : Math.ceil(array.length / itemsPerPage);
+ $('#address-page').attr({
+ min: 1,
+ max: maxPage,
+ });
+ $('#address-page').next().text('/' + maxPage);
+
+ // Make elements for this page
+ var n = (($('#address-page').val() - 1) * itemsPerPage);
+ array.slice(n, n + itemsPerPage).forEach(function(addr, index) {
+ // If searching, the array will contain objects instead of strings
+ var number = addr.number || n + index + 1;
+ var address = addr.address || addr;
+ makeAddress(address, number);
+ });
+}
+
+// Retrieves address list from siad
+function getAddresses() {
+ Siad.apiCall({
+ url: '/wallet/addresses',
+ type: 'GET',
+ }, function(result) {
+ addresses = result.addresses;
+ updateAddressPage();
+ });
+}
+
+// Update addresses on page navigation
+$('#address-page').on('input', updateAddressPage);
+
+// Refresh button
+$('#view-all-addresses').click(function() {
+ $('#search-bar').val('');
+ getAddresses();
+});
+
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Search ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Filter address list by search string
+function filterAdresses(searchstr) {
+ // Filter
+ searchedAddresses = addresses.map(address => ({address: address}));
+ searchedAddresses = addresses.filter(function(addressObject) {
+ return (addressObject.address.includes(searchstr));
+ });
+}
+
+// Show addresses based on search bar string
+function performSearch() {
+ var searchString = $('#search-bar').val();
+
+ // Don't search an empty string
+ if (searchString.length !== 0) {
+ filterAdresses(searchString);
+ }
+
+ // Reset page number and update
+ $('#address-page').val(1);
+ updateAddressPage();
+}
+
+// Start search when typing in Search field
+$('#search-bar').on('input', function() {
+ tooltip('Searching...', this);
+ performSearch();
+});
+
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New Address ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Find location of address in addresses array
+function locationOf(element, array, start, end) {
+ start = start || 0;
+ end = end || array.length;
+ var pivot = parseInt(start + (end - start) / 2, 10);
+ if (array[pivot] === element) {
+ return pivot;
+ } else if (end - start <= 1) {
+ return array[pivot] > element ? pivot - 1 : pivot;
+ } else if (array[pivot] < element) {
+ return locationOf(element, array, pivot, end);
+ } else {
+ return locationOf(element, array, start, pivot);
+ }
+}
+
+// Insert address into the sorted array
+function addAddress(address) {
+ addresses.splice(locationOf(address, addresses) + 1, 0, address);
+}
+
+// Address creation
+$('#create-address').click(function() {
+ tooltip('Creating...', this);
+ Siad.apiCall({
+ url: '/wallet/address',
+ }, function(result) {
+ notify('New address created', 'created');
+ addAddress(result.address);
+
+ // Display only the created address
+ $('#search-bar').val(result.address);
+ performSearch();
+ });
+});
diff --git a/pool/shard011/JavaScript/0071402_index.js b/pool/shard011/JavaScript/0071402_index.js
new file mode 100644
index 0000000000000000000000000000000000000000..c2f50bd460a1c9b3caed4b5cae2004b81d825fb1
--- /dev/null
+++ b/pool/shard011/JavaScript/0071402_index.js
@@ -0,0 +1,201 @@
+import path from 'path';
+import express from 'express';
+
+let swaggerConfigs;
+
+/**
+ * Main Entry Code
+ * Parse express routers and mount swagger api explorer
+ * on express app.
+ *
+ * @param app {Object} Express instance
+ * @param options {Object} Root api path
+ */
+module.exports = (app, options) => {
+ const {
+ rootPath = '/api',
+ explorerPath = '/explorer'
+ } = options;
+
+ const rootApiRouter = getRootApiRouter(app, rootPath);
+
+ const apiRouters = rootApiRouter.handle.stack
+ .filter(router => !_isMiddleware(router))
+ .map(router => getApiRouters(router));
+
+ swaggerConfigs = getSwaggerConfigs(rootApiRouter, apiRouters);
+
+ app.get(explorerPath, renderExplorer);
+ app.get(`${explorerPath}/config`, configsHandler);
+
+ app.use('/explorer', express.static(path.join(__dirname, '../page')));
+}
+
+/**
+ * Find root api router
+ *
+ * @param app {Object} Express instance
+ * @param apiPath {String} Root api path
+ * @returns rootRouter {Object} Express router layer
+ */
+function getRootApiRouter(app, apiPath) {
+ return app._router.stack.find(
+ stack => stack.regexp.test(apiPath) && stack.name === 'router'
+ );
+}
+
+/**
+ * Recursion function for search all end point router handler
+ *
+ * @param apiRouter
+ * @returns {Array}
+ */
+function getApiRouters(apiRouter) {
+ let result = [];
+ const parentRouter = apiRouter;
+
+ // prevent middleware function to search child route
+ if (!_isEndPointHandler(parentRouter)) {
+ const stacks = parentRouter.handle.stack;
+
+ for (const stack of stacks) {
+ let childRouters = getApiRouters(stack);
+
+ childRouters = childRouters.map(childRouter => ({
+ ...childRouter,
+ path: _getPath(parentRouter.regexp) + childRouter.path
+ }));
+
+ result = [...result, ...childRouters];
+ }
+ } else {
+ result.push(getHandlerInfo(parentRouter));
+ }
+
+ return result;
+}
+
+/**
+ * Return end point router handler info
+ *
+ * @param router
+ * @returns {{path, method, name, handle: Function}}
+ */
+function getHandlerInfo(router) {
+ const [handler = {}] = router.route.stack;
+ return {
+ path: router.route.path,
+ method: handler.method,
+ name: handler.name,
+ handle: handler.handle
+ };
+}
+
+/**
+ * Remove regexp prefix and postfix
+ * Input regex: /^\\/pathName\\/?(?=\\/|$)/i
+ * Output string: /pathName
+ *
+ * @param regexp
+ * @returns {string}
+ * @private
+ */
+function _getPath(regexp) {
+ return regexp.toString()
+ // remove /path regexp prefix
+ .replace(/^\/\^\\/, '')
+ // remove /path regexp postfix
+ .replace(/\\\/\?\(\?=\\\/\|\$\)\/i$/, '');
+}
+
+/**
+ * Don't have route prototype and the name is not 'router'
+ * Also don't have stack => middle ware
+ *
+ * @param router
+ * @returns {boolean}
+ * @private
+ */
+function _isMiddleware(router) {
+ return !_isEndPointHandler(router) && !router.handle.stack;
+}
+
+/**
+ * Check is end point router handler
+ *
+ * @param router
+ * @returns {boolean|*}
+ * @private
+ */
+function _isEndPointHandler(router) {
+ return router.name !== 'router' && router.route;
+}
+
+/**
+ * Mount api explorer page
+ *
+ * @param req
+ * @param res
+ * @param next
+ */
+function renderExplorer(req, res, next) {
+ res.sendFile(path.join(__dirname, '../page/index.html'));
+}
+
+function configsHandler(req, res, next) {
+ res.json(swaggerConfigs);
+}
+
+function getSwaggerConfigs(mainApiRouter, apiRouters) {
+ const basePath = _getPath(mainApiRouter.regexp);
+ const tags = generateTags(apiRouters);
+ const paths = generatePaths(apiRouters);
+
+ return {
+ basePath,
+ tags,
+ paths
+ }
+}
+
+function generatePaths(apiRouters) {
+ const routes = {};
+
+ for (const apiRouter of apiRouters) {
+ for (const route of apiRouter) {
+ const tagName = apiRouter[0].path.split('/')[1];
+
+ const parameters = getRouteParameters(route);
+
+ routes[route.path] = {
+ ...routes[route.path],
+ [route.method]: {
+ tags: [tagName],
+ summary: route.name,
+ parameters
+ }
+ }
+ }
+ }
+
+ return routes;
+}
+
+function getRouteParameters(route) {
+ return [{
+ in: "body",
+ name: "body",
+ description: "Pet object that needs to be added to the store",
+ required: true,
+ schema: {}
+ }]
+}
+
+function generateTags(apiRouters) {
+ return apiRouters.map(([firstRouter]) => {
+ return {
+ name: firstRouter.path.split('/')[1],
+ description: ''
+ }
+ });
+}
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071405_chart.js b/pool/shard011/JavaScript/0071405_chart.js
new file mode 100644
index 0000000000000000000000000000000000000000..782c5edfdf6b8904b9e6dd46f5e5504f82546c2b
--- /dev/null
+++ b/pool/shard011/JavaScript/0071405_chart.js
@@ -0,0 +1,217 @@
+var d3 = require('d3');
+
+var data = [
+ ["1980-01-01",0],
+ ["1981-01-01",50],
+ ["1982-01-01",100],
+ ["1983-01-01",200],
+ ["1984-01-01",600],
+ ["1985-01-01",1000],
+ ["1986-01-01",1300],
+ ["1987-01-01",2000],
+ ["1988-01-01",2600],
+ ["1989-01-01",3700],
+ ["1990-01-01",4200],
+ ["1991-01-01",5000],
+ ["1992-01-01",5700],
+ ["1993-01-01",6200],
+ ["1994-01-01",6400],
+ ["1995-01-01",6500],
+ ["1996-01-01",6600],
+ ["1997-01-01",6600],
+ ["1998-01-01",7000],
+ ["1999-01-01",7200],
+ ["2000-01-01",7600],
+ ["2001-01-01",7900],
+ ["2002-01-01",8100],
+ ["2003-01-01",8300],
+ ["2004-01-01",8400],
+ ["2005-01-01",8700],
+ ["2006-01-01",8900],
+ ["2007-01-01",9000],
+ ["2008-01-01",9100],
+ ["2009-01-01",9200],
+ ["2010-01-01",9300],
+ ["2011-01-01",9400],
+ ["2012-01-01",9450],
+ ["2012-07-01",9450],
+ ["2013-08-01",9500],
+ ["2014-01-01",9510],
+ ["2015-01-01",9490],
+ ["2016-01-01",9500],
+ ["2017-01-01",9506],
+ ["2018-01-01",9500],
+ ["2019-01-01",9554],
+ ["2020-01-01",9500],
+ ["2021-01-01",9522],
+ ["2022-01-01",9500],
+ ["2023-01-01",9510],
+ ["2024-01-01",9520],
+ ["2025-01-01",9500],
+ ["2026-01-01",9400],
+ ["2027-01-01",9500],
+ ["2028-01-01",9500]
+];
+
+console.log(data[34]);
+console.log(data[49]);
+console.log(data.length, 49-34);
+
+module.exports = function(emitter){
+ //viz
+ var dataH0 = [];
+ var r;
+ for (var i=0; i+' + (1000 + Math.round(49*(0+1)))+ ' ±' + (30 + Math.round(1.2*(0+1))) + '
Prevented cases in the next 15 years');
+
+
+ //update
+
+ emitter.on('update', function(input, target){
+
+ if(input>0.0){
+
+ for (var i=0; i<16; i++){
+ dataH1[i] = {
+ date: dataH0[34+i].date,
+ lower: dataH0[34+i].lower - (input/100)*i*10 - (input/100)*i*i*20,
+ mean: dataH0[34+i].mean - (input/100)*i*10 - (input/100)*i*i*20,
+ upper: dataH0[34+i].upper- (input/100)*i*10 - (input/100)*i*i*20
+ };
+ }
+
+ } else {
+
+ for (var i=0; i<16; i++){
+ dataH1[i] = {
+ date: dataH0[34+i].date,
+ lower: dataH0[34+i].lower,
+ mean: dataH0[34+i].mean,
+ upper: dataH0[34+i].upper
+ };
+ }
+ }
+
+ d3.select('.tangled').html('+' + (1000 + Math.round(49*(input+1)))+ ' ±' + (30 + Math.round(1.2*(input+1))) + '
Prevented cases in the next 15 years');
+
+ updateH1.g.datum(dataH1)
+
+ updateH1.area.transition().attr("d", area);
+ for(var p in lines){
+ updateH1[p].transition().attr("d", lines[p]);
+ }
+
+ });
+}
diff --git a/pool/shard011/JavaScript/0071407_add-friend.js b/pool/shard011/JavaScript/0071407_add-friend.js
new file mode 100644
index 0000000000000000000000000000000000000000..675c0d71f8487c5a918f2f8d6de2237cb852df58
--- /dev/null
+++ b/pool/shard011/JavaScript/0071407_add-friend.js
@@ -0,0 +1,32 @@
+'use strict';
+
+const { BasePageObject } = require('@faltest/page-objects');
+
+class AddFriend extends BasePageObject {
+ constructor(host, ...args) {
+ super(...args);
+
+ this.host = host;
+ }
+
+ get addFriendButton() {
+ // element click intercepted: Element ... is not clickable at point (274, 76). Other element would receive the click: ...
+ // return this._create('[href="/add-friend"]');
+ return {
+ click: async () => {
+ await this._browser.execute(() => {
+ // eslint-disable-next-line no-undef
+ document.querySelector('[href="/add-friend"]').click();
+ });
+ },
+ };
+ }
+
+ async addFriend(user) {
+ await this.addFriendButton.click();
+
+ await this._browser.url(`${this.host}/invite?name=${user.name}&publicKey=${user.publicKey}`);
+ }
+}
+
+module.exports = AddFriend;
diff --git a/pool/shard011/JavaScript/0071409_config.js b/pool/shard011/JavaScript/0071409_config.js
new file mode 100644
index 0000000000000000000000000000000000000000..c036015790c256402630b309e7eeeb89183acd10
--- /dev/null
+++ b/pool/shard011/JavaScript/0071409_config.js
@@ -0,0 +1,34 @@
+var fs = require('fs'),
+ redis = require('redis'),
+ pg = require('pg'),
+ _ = require('lodash'),
+ stripJsonComments = require('strip-json-comments');
+
+var config = {};
+
+var buffer = fs.readFileSync('./config/config.json');
+// Modified JSON format that allows comments.
+var configLines = '{\n' + buffer.toString() + '\n}';
+config = JSON.parse(stripJsonComments(configLines));
+
+// Configure Databases
+config.postgres = new pg.Client('tcp://' + config.postgres);
+config.postgres.connect();
+config.redis = _.extend(redis.createClient(config.redis.port, config.redis.host), config.redis);
+if (config.redis.password) {
+ config.redis.auth(config.redis.password, function (error) {
+ if (error) {
+ console.error('Redis auth failed:', error);
+ }
+ });
+}
+
+var p = process.argv.indexOf('-p');
+if (p !== -1) {
+ config.port = process.argv[p + 1];
+} else {
+ config.port = config.websocket.port;
+}
+
+module.exports = config;
+
diff --git a/pool/shard011/JavaScript/0071414_MultiRowField.test.js b/pool/shard011/JavaScript/0071414_MultiRowField.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..fa4b1a4125f8fe749df0ccc9cc1c5ef3314550a7
--- /dev/null
+++ b/pool/shard011/JavaScript/0071414_MultiRowField.test.js
@@ -0,0 +1,85 @@
+/* eslint-env jest */
+import React from 'react'
+import { createStore } from 'redux'
+import { mount } from 'enzyme'
+
+import { renderFakeForm, wrap } from '../../../utils/createTestForm'
+import MultiRowField from '../../../components/MultiRowField/MultiRowField'
+
+const initialValues = {
+ 'mock-name': [
+ {
+ name: 'me'
+ },
+ {
+ name: 'you'
+ }
+ ]
+}
+
+const store = createStore(() => ({
+ form: {
+ mockForm: {
+ values: initialValues
+ }
+ }
+}))
+
+describe('MultiRowField component', () => {
+ const requiredProps = {
+ name: 'mock-name'
+ }
+
+ it('renders correctly', () => {
+ const tree = wrap(store)(initialValues)(
+
+ ).toJSON()
+
+ expect(tree).toMatchSnapshot()
+ })
+
+ it('renders all what was passed as a props', () => {
+ const notRequiredProps = {
+ hint: 'mock-hint',
+ title: 'mock-title',
+ placeholder: 'mock-placeholder'
+ }
+
+ const tree = wrap(store)(initialValues)(
+
+ ).toJSON()
+
+ expect(tree).toMatchSnapshot()
+ })
+
+ it('calls `push` method when Control `Add` was clicked', () => {
+ const tree = wrap(store)(initialValues)(
+
+ ).toJSON()
+
+ expect(tree.children[0].children[0].children[1].props.onClick().type).toBe('@@redux-form/ARRAY_PUSH')
+ })
+
+ it('calls `remove` method when Control `Remove` was clicked', () => {
+ const wrapper = mount(
+ renderFakeForm(store)(initialValues)(
+
+ )
+ )
+ const [firstControl, ...removeControls] = wrapper.find('.j-control') // eslint-disable-line
+
+ // first Control for adding, all others for removing
+ removeControls.forEach(el =>
+ expect(el.props.onClick().type).toBe('@@redux-form/ARRAY_REMOVE')
+ )
+ })
+})
diff --git a/pool/shard011/JavaScript/0071420_differenceBy.js b/pool/shard011/JavaScript/0071420_differenceBy.js
new file mode 100644
index 0000000000000000000000000000000000000000..9af817d6ae8d8a0ac050f36e65fd60980f94f485
--- /dev/null
+++ b/pool/shard011/JavaScript/0071420_differenceBy.js
@@ -0,0 +1,42 @@
+import baseDifference from './_baseDifference.js';
+import baseFlatten from './_baseFlatten.js';
+import baseIteratee from './_baseIteratee.js';
+import isArrayLikeObject from './isArrayLikeObject.js';
+import last from './last.js';
+import rest from './rest.js';
+
+/**
+ * This method is like `_.difference` except that it accepts `iteratee` which
+ * is invoked for each element of `array` and `values` to generate the criterion
+ * by which they're compared. Result values are chosen from the first array.
+ * The iteratee is invoked with one argument: (value).
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @category Array
+ * @param {Array} array The array to inspect.
+ * @param {...Array} [values] The values to exclude.
+ * @param {Array|Function|Object|string} [iteratee=_.identity]
+ * The iteratee invoked per element.
+ * @returns {Array} Returns the new array of filtered values.
+ * @example
+ *
+ * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
+ * // => [1.2]
+ *
+ * // The `_.property` iteratee shorthand.
+ * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
+ * // => [{ 'x': 2 }]
+ */
+var differenceBy = rest(function(array, values) {
+ var iteratee = last(values);
+ if (isArrayLikeObject(iteratee)) {
+ iteratee = undefined;
+ }
+ return isArrayLikeObject(array)
+ ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee))
+ : [];
+});
+
+export default differenceBy;
diff --git a/pool/shard011/JavaScript/0071422_rejectIndexed.js b/pool/shard011/JavaScript/0071422_rejectIndexed.js
new file mode 100644
index 0000000000000000000000000000000000000000..21744c7a653177b1db97445ebae27798883199f6
--- /dev/null
+++ b/pool/shard011/JavaScript/0071422_rejectIndexed.js
@@ -0,0 +1,39 @@
+var assert = require('assert');
+
+var R = require('..');
+
+
+describe('rejectIndexed', function() {
+ var even = function(x) {return x % 2 === 0;};
+ var everyOther = function(val, idx) {return idx % 2 === 0;};
+ var lastTwo = function(val, idx, list) {return list.length - idx < 3;};
+
+ it('works just like a normal reject', function() {
+ assert.deepEqual(R.rejectIndexed(even, [1, 2, 3, 4, 5]), [1, 3, 5]);
+ });
+
+ it('passes the index as a second parameter to the predicate', function() {
+ assert.deepEqual(R.rejectIndexed(everyOther, [8, 6, 7, 5, 3, 0, 9]), [6, 5, 0]);
+ });
+
+ it('passes the entire list as a third parameter to the predicate', function() {
+ assert.deepEqual(R.rejectIndexed(lastTwo, [8, 6, 7, 5, 3, 0, 9]), [8, 6, 7, 5, 3]);
+ });
+
+ it('returns an empty array if no element matches', function() {
+ assert.deepEqual(R.rejectIndexed(function(x) { return x < 100; }, [1, 9, 99]), []);
+ });
+
+ it('returns an empty array if asked to filter an empty array', function() {
+ assert.deepEqual(R.rejectIndexed(function(x) { return x > 100; }, []), []);
+ });
+
+ it('is automatically curried', function() {
+ var everyOtherPosition = R.rejectIndexed(everyOther);
+ assert.deepEqual(everyOtherPosition([8, 6, 7, 5, 3, 0, 9]), [6, 5, 0]);
+ });
+
+ it('throws on zero arguments', function() {
+ assert.throws(R.rejectIndexed, TypeError);
+ });
+});
diff --git a/pool/shard011/JavaScript/0071424_library.js b/pool/shard011/JavaScript/0071424_library.js
new file mode 100644
index 0000000000000000000000000000000000000000..cb447a115ab18c432bc02f73d04b3091f2955f7d
--- /dev/null
+++ b/pool/shard011/JavaScript/0071424_library.js
@@ -0,0 +1,74 @@
+(function () {
+ "use strict";
+
+ /* ---------------------------------------------
+ * require dependencies
+ * ---------------------------------------------*/
+ var async = require.main.require('async'),
+ nbbHelpers = require.main.require('./src/controllers/helpers'),
+ news = require('./src/news'),
+ chat = require('./src/chat'),
+ categories = require('./src/categories'),
+ data = {
+ title: 'Home',
+ breadcrumbs: nbbHelpers.buildBreadcrumbs([{}]),
+ chat: {}
+ };
+
+ /* ---------------------------------------------
+ * declare routes
+ * ---------------------------------------------*/
+ var render = {
+ admin: function (req, res, next) {
+ res.render('admin/plugins/start.tpl', data);
+ },
+ page: function (req, res, next) {
+ async.parallel({
+ // FIXME: temporarily disable chat in favor to a picture
+ // chat: async.apply(chat.getChat, req, res),
+ news: async.apply(news.getNews, req, res),
+ categories: async.apply(categories.getCategories, req, res)
+ }, function (err, results) {
+ if (err) return console.error('Block news error: ', err);
+ data.chat = results.chat;
+ data.news = results.news;
+ data.categories = results.categories;
+ res.render('start', data);
+ });
+ }
+ };
+
+ var Plugin = {
+ init: function (params, callback) {
+ /* ---------------------------------------------
+ * setup routes
+ * ---------------------------------------------*/
+ params.router.get('/',
+ params.middleware.buildHeader,
+ render.page);
+
+ params.router.get('/api',
+ render.page);
+
+ params.router.get('/plugins/start',
+ params.middleware.admin.buildHeader,
+ render.admin);
+
+ params.router.get('/api/plugins/start',
+ params.middleware.admin.buildHeader,
+ render.admin);
+ callback(null);
+ },
+ admin: function (header, callback) {
+ header.plugins.push({
+ route: '/plugins/start',
+ icon: 'fa-paint-brush',
+ name: 'Startpage'
+ });
+
+ callback(null, header);
+ }
+ };
+
+ module.exports = Plugin;
+})();
diff --git a/pool/shard011/JavaScript/0071426_astGenerator.js b/pool/shard011/JavaScript/0071426_astGenerator.js
new file mode 100644
index 0000000000000000000000000000000000000000..c2290db34f36e9acc07cddfaf26a89541913eab8
--- /dev/null
+++ b/pool/shard011/JavaScript/0071426_astGenerator.js
@@ -0,0 +1,93 @@
+'use strict';
+const fs = require('fs');
+const acorn = require('acorn-jsx/inject')(require('acorn'));
+const esquery = require('../esquery/esquery');
+
+/**
+ * Takes in directory name and generates an AST based on the File.
+ * If it is a React Component an object is returned with the corresponding key/value pair
+ * ComponentName: AST
+ * @param {directory} file directory
+ * @returns {Object} Object with Component name and AST
+ */
+
+function astGenerator(directory) {
+ // using directory of component to turn into string for acorn
+ const stringed = fs.readFileSync(directory, { encoding: 'utf-8' });
+ const result = {};
+ let name;
+ let splicing;
+ let found;
+ let sfc;
+ const sfcNames = [];
+
+ // ast generation
+ const ast = acorn.parse(stringed, {
+ sourceType: 'module',
+ plugins: { jsx: true },
+ });
+
+ function nameFinder(node) {
+ if ((node.superClass.type === 'MemberExpression' &&
+ node.superClass.object.name === 'React' &&
+ node.superClass.property.name === 'Component')
+ || (node.superClass.type === 'Identifier' &&
+ node.superClass.name === 'Component')) return node.id.name;
+ throw new Error(`Unable to find component name at specified directory: ${directory}`);
+ }
+
+ ast.body.forEach((node, i) => {
+ if (node.type === 'ClassDeclaration' && node.superClass) {
+ name = nameFinder(node);
+ found = true;
+ } else if (node.type === 'ExportDefaultDeclaration') {
+ if (node.declaration.type === 'ClassDeclaration' &&
+ node.declaration.superClass) {
+ name = nameFinder(node.declaration);
+ found = true;
+ } else if (node.declaration.name || node.declaration.id.name) {
+ sfc = node.declaration.name || node.declaration.id.name;
+ }
+ } else if (node.type === 'VariableDeclaration' && node.declarations[0].init) {
+ if (node.declarations[0].init.callee &&
+ node.declarations[0].init.callee.object &&
+ node.declarations[0].init.callee.object.name === 'React' &&
+ node.declarations[0].init.callee.property.name === 'createClass') {
+ name = node.declarations[0].id.name;
+ found = true;
+ } else if (node.declarations[0].init.type === 'FunctionExpression' ||
+ node.declarations[0].init.type === 'ArrowFunctionExpression') {
+ if (esquery(node, 'JSXElement').length < 0) {
+ sfcNames.push(node.declarations[0].id.name);
+ }
+ }
+ } else if (node.type === 'ExpressionStatement') {
+ if (node.expression.callee) {
+ if ((node.expression.callee.type === 'MemberExpression' &&
+ node.expression.callee.object.name === 'ReactDOM' &&
+ node.expression.callee.property.name === 'render') ||
+ (node.expression.callee.type === 'Identifier' &&
+ node.expression.callee.name === 'render')) {
+ name = node.expression.arguments[0].openingElement.name.name;
+ result.ENTRY = name;
+ splicing = i;
+ }
+ } else if (node.expression.left && node.expression.left.object.name === 'module') {
+ sfc = node.expression.right.name;
+ }
+ } else if (node.type === 'FunctionDeclaration') {
+ if (esquery(node, 'JSXElement').length > 0) {
+ sfcNames.push(node.id.name);
+ }
+ }
+ });
+
+
+ if (splicing) ast.body.splice(splicing, 1);
+ if (found) result[name] = ast;
+ if (sfc && sfcNames.indexOf(sfc) !== -1) result[sfc] = ast;
+ return result;
+}
+
+
+module.exports = astGenerator;
diff --git a/pool/shard011/JavaScript/0071429_ghostmode.forms.toggles.js b/pool/shard011/JavaScript/0071429_ghostmode.forms.toggles.js
new file mode 100644
index 0000000000000000000000000000000000000000..77729e69b72d176fe633b282ab62cf3af33a33e1
--- /dev/null
+++ b/pool/shard011/JavaScript/0071429_ghostmode.forms.toggles.js
@@ -0,0 +1,95 @@
+"use strict";
+
+/**
+ * This is the plugin for syncing clicks between browsers
+ * @type {string}
+ */
+var EVENT_NAME = "input:toggles";
+var OPT_PATH = "ghostMode.forms.toggles";
+exports.canEmitEvents = true;
+
+/**
+ * @param {BrowserSync} bs
+ * @param eventManager
+ */
+exports.init = function (bs, eventManager) {
+ var browserEvent = exports.browserEvent(bs);
+ exports.addEvents(eventManager, browserEvent);
+ bs.socket.on(EVENT_NAME, exports.socketEvent(bs, eventManager));
+};
+
+/**
+ * @param eventManager
+ * @param event
+ */
+exports.addEvents = function (eventManager, event) {
+
+ var elems = document.getElementsByTagName("select");
+ var inputs = document.getElementsByTagName("input");
+
+ addEvents(elems);
+ addEvents(inputs);
+
+ function addEvents(domElems) {
+ for (var i = 0, n = domElems.length; i < n; i += 1) {
+ eventManager.addEvent(domElems[i], "change", event);
+ }
+ }
+};
+
+/**
+ * @param {BrowserSync} bs
+ * @returns {Function}
+ */
+exports.browserEvent = function (bs) {
+
+ return function (event) {
+
+ if (exports.canEmitEvents) {
+ var elem = event.target || event.srcElement;
+ var data;
+ if (elem.type === "radio" || elem.type === "checkbox" || elem.tagName === "SELECT") {
+ data = bs.utils.getElementData(elem);
+ data.type = elem.type;
+ data.value = elem.value;
+ data.checked = elem.checked;
+ bs.socket.emit(EVENT_NAME, data);
+ }
+ } else {
+ exports.canEmitEvents = true;
+ }
+
+ };
+};
+
+/**
+ * @param {BrowserSync} bs
+ * @returns {Function}
+ */
+exports.socketEvent = function (bs) {
+
+ return function (data) {
+
+ if (!bs.canSync(data, OPT_PATH)) {
+ return false;
+ }
+
+ exports.canEmitEvents = false;
+
+ var elem = bs.utils.getSingleElement(data.tagName, data.index);
+
+ if (elem) {
+ if (data.type === "radio") {
+ elem.checked = true;
+ }
+ if (data.type === "checkbox") {
+ elem.checked = data.checked;
+ }
+ if (data.tagName === "SELECT") {
+ elem.value = data.value;
+ }
+ return elem;
+ }
+ return false;
+ };
+};
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071430_saleAgentBot.js b/pool/shard011/JavaScript/0071430_saleAgentBot.js
new file mode 100644
index 0000000000000000000000000000000000000000..601714b68d11340bb004b1cf85d8424248b02c1e
--- /dev/null
+++ b/pool/shard011/JavaScript/0071430_saleAgentBot.js
@@ -0,0 +1,202 @@
+import React from 'react';
+import { Modal, Toast , Carousel, WhiteSpace, WingBlank, Button } from 'antd-mobile';
+//import { Generic } from 'react-simple-chatbot';
+import PropTypes from 'prop-types';
+import {propertys} from 'userModelView';
+import {ListOfMatchOldSalePropertys} from '../listOfMatch/listOfMatchOldSalePropertys';
+import { SingleSaleUserMatchViewWrapper } from "../singlePropertyView/singleSaleUserMatchView";
+import {observer } from "mobx-react";
+import {Generic} from "react-simple-chatbot";
+
+
+const prompt = Modal.prompt;
+
+@observer
+export default class SaleAgentBot extends React.Component {
+ constructor( props ) {
+ super( props )
+ this.state = {
+ data: ['', '', ''],
+ initialHeight: 450,
+ value: null,
+ trigger: false
+ };
+ this.triggetNext = this.triggetNext.bind(this);
+ this.onSharePhone = this.onSharePhone.bind(this);
+ this.onCall = this.onCall.bind(this);
+ this.display = this.display.bind(this);
+ }
+
+
+ componentDidMount() {
+ // simulate img loading
+ setTimeout(() => {
+ this.setState({
+ data: ['AiyWuByWklrrUDlFignR', 'TekJlZRVCjLFexlOCuWn', 'IJOtIlfsYdTyaDTRVrLI'],
+ });
+ }, 100);
+ }
+
+ triggetNext() {
+ this.setState({ trigger: true }, () => {
+ this.props.triggerNextStep( { value: 'building', label : 'matching' });
+ });
+ }
+
+ onSharePhone() {
+ return
+ }
+
+ onCall(phone) {
+////
+ //window.location.href = "tel://" + status.contactPhone;
+ window.location.href = "tel://" + phone;
+ console.log( `onCall(${phone});`);
+ // }
+ }
+
+ display( propertys, filter, inDirectCall ) {
+ const list = propertys;
+
+// const p = this.props.property;
+// const f = this.props.filter;
+ //const status = p.getStatus(f.fbid).get();
+
+ // const status = property.getStatus(filter.fbid).get();
+ // const fStatus = filter.getStatus(property.fbid).get();
+
+ // Catched empty list, don't do anything!
+ if (list.size === 0) {
+ return null;
+ }
+
+ //const timeEnter = this.props.timeEnter;
+ // Try to show most uptoday item only
+ var element = [];
+ //
+ //
+
+ var count = 0;
+ list.forEach((property, keyID) => {
+ //let status = inDirectCall.get( keyID);
+// let status = property.getStatus(filter.fbid).get();
+ const fStatus = filter.getStatus(property.fbid).get();
+ const status = property.getStatus(filter.fbid).get();
+ // let status = this.props.inDirectCall.get(keyID);
+ // console.log( 'this.props.store.router.params.keyID',this.props.store.router.params.keyID )
+ // let showPhone = false;
+ // if (status) {
+ // console.log("call ", status.isShowPhone);
+ // showPhone = status.isShowPhone;
+ // }
+ // if ( status === undefined ) {
+ // status = new Status( this., 0, false)
+ // }
+
+ // debugger
+ // element.push(
+ //
+ // );
+
+ if ( count == 0 ) {
+ element.push(
+
+ );
+ } else
+ {
+
+ element.push(
+
+ );
+
+ }
+ count++;
+ });
+
+ return (element);
+ };
+
+ render() {
+ const hProp = this.state.initialHeight ? { height: this.state.initialHeight } : {};
+ const keyID = this.props.keyID;
+
+ //filter={property} inDirectCall={property.inDirectCall} propertys={property.matchedPropertys}
+
+ // Buy Property ID
+ const property = propertys.propertys.get( keyID );
+// const property = propertys.propertys.get( '-Ktw-IOu3RDyKZybeB-A' );
+ const localpropertys = property.matchedPropertys;
+ const filter = property;
+ const inDirectCall = property.inDirectCall;
+ // Sell Property ID
+ //const property = propertys.propertys.get( '-Kte6f8sOgZ0gsVWwv2k' );
+ // return (
+ //
+ // )
+
+ return (
+ console.log(`slide from ${from} to ${to}`)}
+ afterChange={index => console.log('slide to', index)}
+ >
+ {this.display(localpropertys, filter, inDirectCall)}
+
+
+ );
+ }
+}
+
+SaleAgentBot.propTypes = {
+ steps: PropTypes.object,
+ triggerNextStep: PropTypes.func,
+};
+
+SaleAgentBot.defaultProps = {
+ steps: undefined,
+ triggerNextStep: undefined,
+};
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071431_administratorColumn.js b/pool/shard011/JavaScript/0071431_administratorColumn.js
new file mode 100644
index 0000000000000000000000000000000000000000..381b135fb171fb674d20c89aaa0745b356da0cf4
--- /dev/null
+++ b/pool/shard011/JavaScript/0071431_administratorColumn.js
@@ -0,0 +1,89 @@
+import Wreqr from 'backbone.wreqr';
+import Marionette from 'backbone.marionette';
+import ListGroup from 'ui/listGroup';
+import template from 'templates/admin/setting/administrator/administratorColumn.ejs';
+
+export default Marionette.LayoutView.extend({
+ template,
+
+ behaviors() {
+ return {
+ l20n: {},
+ column: {
+ appendToBody: true,
+ destroyOnClose: true,
+ routeOnClose: this.options.previousRoute
+ }
+ };
+ },
+
+ regions: {
+ list: '.rg_list'
+ },
+
+ ui: {
+ column: '.column'
+ },
+
+ initialize() {
+ this._radio = Wreqr.radio.channel('global');
+ },
+
+ onRender() {
+ const listGroup = new ListGroup({
+ collection: this.collection,
+ labelAttribute: 'displayName',
+ reorderable: false,
+ removeable: true,
+ navigable: false,
+ placeholder: document.l10n.getSync('uiListGroup_placeholder')
+ });
+
+ this.listenTo(listGroup, 'item:remove', this._onRemove);
+
+ this.getRegion('list').show(listGroup);
+ },
+
+ onBeforeOpen() {
+ this._radio.vent.trigger('column:closeAll', [this.cid]);
+ this._radio.vent.trigger('widget:closeAll', [this.cid]);
+ },
+
+ open() {
+ this.triggerMethod('open');
+ return this;
+ },
+
+ close() {
+ this.triggerMethod('close');
+ return this;
+ },
+
+ _onRemove(model, e) {
+ e.preventDefault();
+
+ const removedId = model.get('_id');
+ const removedOsmId = model.get('osmId');
+
+ if (this.options.user.get('_id') === removedId) {
+ return false;
+ }
+
+ if (this.options.user.get('osmId') === removedOsmId) {
+ return false;
+ }
+
+ const owners = this.model
+ .get('owners')
+ .filter(ownerId => ownerId !== removedId);
+ const osmOwners = this.model
+ .get('osmOwners')
+ .filter(osmOwnerId => osmOwnerId !== removedOsmId);
+
+ this.model.set('owners', owners);
+ this.model.set('osmOwners', osmOwners);
+
+ this.collection.remove(this.collection.findWhere({ osmId: removedOsmId }));
+ this.model.save();
+ }
+});
diff --git a/pool/shard011/JavaScript/0071432_anime.test.js b/pool/shard011/JavaScript/0071432_anime.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..a2af45978e201c05631b285fcf46d64daf67a050
--- /dev/null
+++ b/pool/shard011/JavaScript/0071432_anime.test.js
@@ -0,0 +1,46 @@
+var Anime = ModelHelper.get('Anime');
+
+describe('api', function () {
+ describe('anime', function () {
+ before("setGlobalToken", function (done) {
+ AuthHelper.setGlobalUser(done);
+ });
+ it('create Anime', function (done) {
+ RequestHelper.post("api/anime", TestDataHelper.Anime)
+ .end(function (e, res) {
+ expect(e).to.equal(null);
+ expect(res.body).to.have.property('id');
+ done()
+ });
+ });
+ it('getAll Anime', function (done) {
+ RequestModelHelper.getRequestAndModelItems("api/anime", "Anime", function (err, result) {
+ expect(result.requestItems).to.have.length(result.modelItems.length);
+ done();
+ });
+ });
+ it('update Anime', function (done) {
+ ModelHelper.getRandomItem("Anime", function (err, item) {
+ item.id = item._id;
+ item.rating = 5;
+ RequestHelper.updateItem("api/anime", item, function (err, result) {
+ expect(err).to.equal(null);
+ expect(result.rating).to.be.equal(5);
+ done();
+ });
+ });
+ });
+ it('delete Anime', function (done) {
+ RequestModelHelper.getRequestItemsAfterFunction("api/anime", function (result, callback) {
+ ModelHelper.getRandomItem("Anime", function (err, item) {
+ RequestHelper.delItem("api/anime", item._id, function (err) {
+ callback();
+ });
+ });
+ }, function (err, result) {
+ expect(result.afterItems).to.have.length(result.beforeItems.length - 1);
+ done();
+ });
+ });
+ });
+});
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071440_drcommonjsmodule.js b/pool/shard011/JavaScript/0071440_drcommonjsmodule.js
new file mode 100644
index 0000000000000000000000000000000000000000..5c81a559ea2e69f6759b9853f56fd4da1d5964a5
--- /dev/null
+++ b/pool/shard011/JavaScript/0071440_drcommonjsmodule.js
@@ -0,0 +1,133 @@
+// Original version from https://github.com/dmachi/Titanium-CommonJS
+(function(){
+ var modules = {};
+ var paths = [];
+
+ // Add module's bundled lib to the path
+ Titanium.API.getInstalledModules()
+ .forEach(function(mod){
+ if (mod.getName() === 'drcommonjs') {
+ paths.unshift(mod.getPath() + "/lib");
+ }
+ });
+
+ // Add application's ./Resources/CommonJS to the path
+ paths.unshift(Titanium.Filesystem.getResourcesDirectory() + '/CommonJS');
+
+ // Relative paths to search within packages
+ var nestedPaths = ['engines/titanium/lib', 'engines/default/lib', 'lib'];
+
+
+ /**
+ * Find the actual file system path for the given module identifier
+ *
+ * @private
+ * @param {String} id The module to resolve
+ * @param {String} parentId The current module path for relative look up
+ * @return {String} the module path
+ */
+ function resolveId(id, parentId){
+ var parts = id.charAt(0) === '.' ? parentId.split('/') : [];
+
+ // Remove relative look up
+ id = id.replace(/^\.\//, '');
+
+ // Remove parent levels
+ id.replace('/^(\.\.\/)+/', function(m){
+ parts.splice(0, -(m.length/3));
+ return '';
+ });
+
+ parts.push(id);
+
+ Titanium.API.debug('[CommonJS] Resolved to ' + parts.join('/'));
+ return parts.join('/');
+ }
+
+ /**
+ * Creates a new require function with the given root path
+ *
+ * @private
+ * @param {String} parentId
+ * @return {Function}
+ */
+ function makeRequire(parentId) {
+ var require;
+
+ /**
+ * CommonJS compliant require function
+ *
+ * @param {String} id
+ * @return {Object}
+ */
+ require = function(id){
+ Titanium.API.debug('[CommonJS] require(' + id + ') from ' + (parentId || 'root'));
+
+ // Resolve the identifier
+ id = resolveId(id, parentId);
+ // If already loaded just return it
+ if (modules[id]) {
+ return modules[id];
+ }
+
+
+ // Create the exports variable
+ var exports = modules[id] = {};
+
+ // Try all the paths in order
+ var file, found;
+ found = paths.some(function(path){
+ var parts = id.split('/'),
+ pkg = parts.shift();
+
+ if (path.indexOf('app://') === 0) {
+ path = Titanium.App.appURLToPath(path);
+ }
+
+ if (!parts.length) {
+ file = Titanium.Filesystem.getFile(path + '/' + pkg);
+ if (file.isDirectory()) {
+ // Use the package name as filename (ie: pkg/lib/pkg.js)
+ parts.push(pkg);
+ } else {
+ // Optimization for simple modules, the pkg name is a .js file
+ file = Titanium.Filesystem.getFile(path + '/' + pkg + '.js');
+ if (file.isFile()) {
+ return true;
+ }
+ return;
+ }
+ }
+
+ // Search in nested paths
+ return nestedPaths.some(function(nested) {
+ nested = [path, pkg, nested].concat(parts).join('/') + '.js';
+
+ Titanium.API.debug('[CommonJS] Searching for file: ' + nested);
+ file = Titanium.Filesystem.getFile(nested);
+ if (file.isFile()) {
+ return true
+ }
+ });
+ });
+
+ if (found) {
+ Titanium.API.info('[CommonJS] Loading ' + id + ' from: ' + file.nativePath());
+ var factory = eval("(function(require, exports, module){" + file.read() + "})");
+ factory(makeRequire(id), exports, {id:id});
+ return exports;
+ } else {
+ Titanium.API.error("[CommonJS] Unable to resolve require: " + id);
+ throw new Error('Unable to resolve require for ' + id);
+ }
+ }
+
+ // Bind the paths variable to the require function
+ require.paths = paths;
+
+ return require;
+ }
+
+ // Expose a root require function in the API
+ Titanium.API.set('DrSlump.CommonJS.require', makeRequire(''));
+})();
diff --git a/pool/shard011/JavaScript/0071442_createData.js b/pool/shard011/JavaScript/0071442_createData.js
new file mode 100644
index 0000000000000000000000000000000000000000..c17dd6007f4d615555d24600ada68c3e0da2b935
--- /dev/null
+++ b/pool/shard011/JavaScript/0071442_createData.js
@@ -0,0 +1,34 @@
+var seed = 1.4;
+
+// Controllable random.
+function random() {
+ seed *= 42.7;
+ seed -= Math.floor(seed);
+ return seed * 2 - 1;
+}
+
+export default function createData(count) {
+ let data = [], i, record = {
+ time: new Date('Jan 1 2010').getTime(),
+ close: 600
+ };
+
+ for (i = 0; i < count; i++) {
+ var ohlc = [random() * 25, random() * 25, random() * 25];
+ record = {
+ time: record.time + 3600000,
+ open: record.close,
+ high: record.close + Math.max.apply(Math, ohlc),
+ low: record.close + Math.min.apply(Math, ohlc),
+ close: record.close + ohlc[1]
+ };
+ if (record.open < record.low) {
+ record.low = record.open;
+ } else if (record.open > record.high) {
+ record.high = record.open;
+ }
+ data.push(record);
+ }
+
+ return data;
+}
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071446_test.text_to_speech.v1.js b/pool/shard011/JavaScript/0071446_test.text_to_speech.v1.js
new file mode 100644
index 0000000000000000000000000000000000000000..2347e980914fa055853843fa0a01ac9a27074c7d
--- /dev/null
+++ b/pool/shard011/JavaScript/0071446_test.text_to_speech.v1.js
@@ -0,0 +1,201 @@
+'use strict';
+
+const assert = require('assert');
+const watson = require('../../index');
+const nock = require('nock');
+const qs = require('querystring');
+const omit = require('object.omit');
+
+describe('text_to_speech', function() {
+ const noop = function() {};
+
+ // Test params
+ const service_request = {
+ accept: 'audio/ogg; codecs=opus',
+ voice: 'VoiceEnUsMichael',
+ text: 'Hi test'
+ };
+ const service = {
+ username: 'batman',
+ password: 'bruce-wayne',
+ url: 'http://ibm.com:80',
+ version: 'v1'
+ };
+ const synthesize_path = '/v1/synthesize';
+ const voices_path = '/v1/voices';
+ const synthesize_request = synthesize_path + '?' + qs.stringify(omit(service_request, 'text'));
+
+ const mock_voices = [
+ {
+ name: 'michael',
+ language: 'en',
+ gender: 'male',
+ url: 'url'
+ },
+ {
+ name: 'jenny',
+ language: 'en',
+ gender: 'female',
+ url: 'url2'
+ }
+ ];
+
+ before(function() {
+ nock.disableNetConnect();
+ });
+
+ after(function() {
+ nock.cleanAll();
+ });
+
+ const text_to_speech = watson.text_to_speech(service);
+
+ const missingParameter = function(err) {
+ assert.ok(err instanceof Error && /required parameters/.test(err));
+ };
+
+ describe('synthesize()', function() {
+ beforeEach(function() {
+ nock(service.url).post(synthesize_request, { text: service_request.text }).replyWithFile(200, __dirname + '/../resources/watson-hi.ogg');
+ });
+
+ it('should check for missing text', function() {
+ const params = {
+ voice: service_request.voice,
+ accept: service_request.accept
+ };
+ text_to_speech.synthesize(params, missingParameter);
+ });
+
+ it('should check no parameters provided', function() {
+ text_to_speech.synthesize({}, missingParameter);
+ text_to_speech.synthesize(null, missingParameter);
+ text_to_speech.synthesize(undefined, missingParameter);
+ });
+
+ it('should generate a valid response', function(done) {
+ text_to_speech.synthesize(service_request, function(err, response) {
+ if (err) {
+ done(err);
+ } else {
+ assert.notEqual(response, null);
+ assert.notEqual(response, undefined);
+ assert(response instanceof Buffer);
+ done();
+ }
+ });
+ });
+
+ it('should generate a valid payload', function() {
+ const req = text_to_speech.synthesize(service_request, noop);
+ assert.equal(req.uri.href, service.url + synthesize_request);
+ assert.equal(req.method, 'POST');
+ assert.equal(req.headers['content-type'], 'application/json');
+ });
+
+ it('should support the X-Watson-Learning-Opt-Out option', function() {
+ const params = { 'X-Watson-Learning-Opt-Out': true, text: 'test' };
+ const req = text_to_speech.synthesize(params, noop);
+ assert.equal(req.headers['X-Watson-Learning-Opt-Out'], '1');
+ });
+
+ it('should support the customization_id option', function() {
+ const params = { customization_id: 'foo', text: 'test' };
+ const req = text_to_speech.synthesize(params, noop);
+ assert(req.url);
+ assert(req.url.query);
+ assert.equal(qs.parse(req.url.query).customization_id, 'foo');
+ });
+ });
+
+ describe('voices()', function() {
+ beforeEach(function() {
+ nock(service.url)
+ .post(synthesize_request, { text: service_request.text })
+ .replyWithFile(200, __dirname + '/../resources/watson-hi.ogg')
+ .get(voices_path)
+ .reply(200, mock_voices);
+ });
+
+ it('should generate a valid payload', function(done) {
+ const checkVoices = function(err, res) {
+ assert.equal(JSON.stringify(res), JSON.stringify(mock_voices));
+ done();
+ };
+
+ text_to_speech.voices({}, checkVoices);
+ });
+ });
+
+ describe('voice()', function() {
+ beforeEach(function() {
+ nock(service.url).get('/v1/voices/en-US_MichaelVoice').reply(200, mock_voices[0]);
+ });
+
+ it('should require a voice parameter', function() {
+ text_to_speech.voice({}, missingParameter);
+ text_to_speech.voice(null, missingParameter);
+ text_to_speech.voice(undefined, missingParameter);
+ });
+
+ it('should generate a valid payload', function(done) {
+ const checkVoice = function(err, res) {
+ assert.ifError(err);
+ assert.equal(JSON.stringify(res), JSON.stringify(mock_voices[0]));
+ done();
+ };
+
+ text_to_speech.voice({ voice: 'en-US_MichaelVoice' }, checkVoice);
+ });
+
+ it('should support the customization_id option', function() {
+ const params = { customization_id: 'foo', voice: 'en-US_MichaelVoice' };
+ const req = text_to_speech.voice(params, noop);
+ assert(req.url);
+ assert(req.url.query);
+ assert.equal(qs.parse(req.url.query).customization_id, 'foo');
+ });
+ });
+
+ describe('pronunciation()', function() {
+ const mock_pronunciation = {
+ pronunciation: '.ˈaɪ .ˈi .ˈi .ˈi'
+ };
+
+ beforeEach(function() {
+ nock(service.url).get('/v1/pronunciation?text=IEEE').reply(200, mock_pronunciation);
+ });
+
+ it('should require a text parameter', function() {
+ text_to_speech.pronunciation({}, missingParameter);
+ text_to_speech.pronunciation(null, missingParameter);
+ text_to_speech.pronunciation(undefined, missingParameter);
+ });
+
+ it('should generate a valid payload', function(done) {
+ const checkPronunciation = function(err, res) {
+ assert.ifError(err);
+ assert.equal(JSON.stringify(res), JSON.stringify(mock_pronunciation));
+ done();
+ };
+
+ text_to_speech.pronunciation({ text: 'IEEE' }, checkPronunciation);
+ });
+
+ it('should support the voice option', function() {
+ const params = { text: 'IEEE', voice: 'en-US_MichaelVoice' };
+ const req = text_to_speech.pronunciation(params, noop);
+ assert(req.url);
+ assert(req.url.query);
+ assert.equal(qs.parse(req.url.query).voice, 'en-US_MichaelVoice');
+ });
+
+ it('should support the customization_id option', function() {
+ const params = { text: 'IEEE', customization_id: 'foo' };
+ const req = text_to_speech.pronunciation(params, noop);
+ assert(req.url);
+ assert(req.url.query);
+ assert.equal(qs.parse(req.url.query).customization_id, 'foo');
+ });
+ });
+});
diff --git a/pool/shard011/JavaScript/0071447_workflowDisplay.js b/pool/shard011/JavaScript/0071447_workflowDisplay.js
new file mode 100644
index 0000000000000000000000000000000000000000..0972b6109390469bc64b758231fb22880be7b25c
--- /dev/null
+++ b/pool/shard011/JavaScript/0071447_workflowDisplay.js
@@ -0,0 +1,31 @@
+/**
+ * Created by antoine on 16/04/17.
+ */
+$(function () {
+ var workflows = $('.workflow-dump');
+
+ workflows.each(function (index) {
+ var result = Viz(this.innerText, {format: "png-image-element", scale: 1});
+
+ result.style.maxWidth = '100%';
+ result.style.height = 'auto';
+
+ this.removeChild(this.firstChild);
+ this.appendChild(result);
+ this.style.display = 'flex';
+ });
+
+ $(workflows).attr("data-scale", "2.4");
+
+ var zoomed = false;
+ $(workflows).on('click', function () {
+ if (!zoomed) $(this).children('img').css({'transform': 'scale(' + $(this).attr('data-scale') + ')'});
+ else $(this).children('img').css({'transform': 'scale(1)'});
+
+ zoomed = !zoomed;
+
+ }).on('mousemove', function (e) {
+ if (zoomed)
+ $(this).children('img').css({'transform-origin': ((e.pageX - $(this).offset().left) / $(this).width()) * 100 + '% ' + ((e.pageY - $(this).offset().top) / $(this).height()) * 100 + '%'});
+ })
+});
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071449_controllers.js b/pool/shard011/JavaScript/0071449_controllers.js
new file mode 100644
index 0000000000000000000000000000000000000000..ddf2b0e1d18fda3a9d84166ba8aa0c30f1572422
--- /dev/null
+++ b/pool/shard011/JavaScript/0071449_controllers.js
@@ -0,0 +1,31 @@
+/**
+ * Controllers initialization phase.
+ *
+ * This phase configures a Locomotive application with the required mechanisms
+ * to resolve and instantiate controllers.
+ *
+ * It is recommended that this phase be the first phase in the boot sequence.
+ * Earlier phases in the sequence can register alternative mechanisms, in order
+ * to override this resolution and instantiation process. This is considered
+ * advanced usage, however, and is generally not recommended.
+ *
+ * @param {String|Object} options
+ * @return {Function}
+ * @api public
+ */
+module.exports = function(options) {
+ if ('string' == typeof options) {
+ options = { dirname: options };
+ }
+ options = options || {};
+ var dirname = options.dirname || 'app/controllers';
+
+ return function controllers() {
+ // Register controller resolution and instantiation mechanisms. These
+ // mechanisms allow Locomotive to automatically `require` controllers and
+ // instantiate instances from the exported value.
+ this.controllers.resolve.use(require('../resolvers/node/controller')(dirname));
+ this.controllers.instantiate.use(require('../instantiators/prototype')());
+ this.controllers.instantiate.use(require('../instantiators/constructor')());
+ };
+};
diff --git a/pool/shard011/JavaScript/0071450_menuController.js b/pool/shard011/JavaScript/0071450_menuController.js
new file mode 100644
index 0000000000000000000000000000000000000000..5b13668ebd17bce6ff2d601ed264caeb33bbd43f
--- /dev/null
+++ b/pool/shard011/JavaScript/0071450_menuController.js
@@ -0,0 +1,22 @@
+/*global angular*/
+
+angular.module('app').controller('menuController', function ($scope, $location) {
+ 'use strict';
+
+ $scope.getClass = function (path) {
+ if (path.toLowerCase() === 'admin') {
+ if ($location.path().toLowerCase() === '/admin') {
+ return 'btn-primary';
+ } else {
+ return '';
+ }
+ } else {
+ var parts = $location.path().split('/');
+ if (parts.length === 3 && parts[2].toLowerCase() === path.toLowerCase()) {
+ return 'btn-primary';
+ } else {
+ return '';
+ }
+ }
+ };
+});
diff --git a/pool/shard011/JavaScript/0071451_parser.js b/pool/shard011/JavaScript/0071451_parser.js
new file mode 100644
index 0000000000000000000000000000000000000000..7ed603170e54e66185cc92eb3408ea5f2314653c
--- /dev/null
+++ b/pool/shard011/JavaScript/0071451_parser.js
@@ -0,0 +1,33 @@
+'use strict';
+
+var expect = require('chai').expect;
+var parser = require('../lib/parser');
+
+
+describe("parser.parse()", function() {
+ it("validate is always an array", function() {
+ var parsed = parser.parse({});
+ expect(parsed.validate).to.deep.equal([]);
+ });
+
+ it("setter is always an array", function() {
+ var parsed = parser.parse({});
+ expect(parsed.set).to.deep.equal([]);
+ });
+
+ it("getter is always an array", function(){
+ var parsed = parser.parse({});
+ expect(parsed.get).to.deep.equal([]);
+ });
+
+ it("regex", function() {
+ var parsed = parser.parse({
+ validate: /abc/
+ });
+
+ var validate = parsed.validate[0];
+
+ expect(validate.length).to.equal(1);
+ expect(validate('aabcde')).to.equal(true);
+ });
+});
diff --git a/pool/shard011/JavaScript/0071452_ShellHeadItem-dbg.js b/pool/shard011/JavaScript/0071452_ShellHeadItem-dbg.js
new file mode 100644
index 0000000000000000000000000000000000000000..15bb0b3b2a7aba8e0d26f66c8251a4c5d9995c39
--- /dev/null
+++ b/pool/shard011/JavaScript/0071452_ShellHeadItem-dbg.js
@@ -0,0 +1,197 @@
+/*!
+ * UI development toolkit for HTML5 (OpenUI5)
+ * (c) Copyright 2009-2016 SAP SE or an SAP affiliate company.
+ * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
+ */
+
+// Provides control sap.ui.unified.ShellHeadItem.
+sap.ui.define(['jquery.sap.global', 'sap/ui/core/Element', 'sap/ui/core/IconPool', './library'],
+ function(jQuery, Element, IconPool, library) {
+ "use strict";
+
+
+
+ /**
+ * Constructor for a new ShellHeadItem.
+ *
+ * @param {string} [sId] id for the new control, generated automatically if no id is given
+ * @param {object} [mSettings] initial settings for the new control
+ *
+ * @class
+ * Header Action item of the Shell.
+ * @extends sap.ui.core.Element
+ *
+ * @author SAP SE
+ * @version 1.42.8
+ *
+ * @constructor
+ * @public
+ * @since 1.15.1
+ * @alias sap.ui.unified.ShellHeadItem
+ * @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
+ */
+ var ShellHeadItem = Element.extend("sap.ui.unified.ShellHeadItem", /** @lends sap.ui.unified.ShellHeadItem.prototype */ { metadata : {
+
+ library : "sap.ui.unified",
+ properties : {
+
+ /**
+ * If set to true, a divider is displayed before the item.
+ * @deprecated Since version 1.18.
+ * Dividers are not supported anymore.
+ */
+ startsSection : {type : "boolean", group : "Appearance", defaultValue : false, deprecated: true},
+
+ /**
+ * If set to true, a separator is displayed after the item.
+ * @since 1.22.5
+ */
+ showSeparator : {type : "boolean", group : "Appearance", defaultValue : true},
+
+ /**
+ * Defines the toggle state in case the item represents a toggle button (see also property toggleEnabled).
+ */
+ selected : {type : "boolean", group : "Appearance", defaultValue : false},
+
+ /**
+ * If set to true, the item represents a toggle button. The selected property can the be used to
+ * define the toggle state. Otherwise the item is displayed as action button. In this case the selected property
+ * is ignored.
+ * @since 1.34.3
+ */
+ toggleEnabled : {type : "boolean", group : "Appearance", defaultValue : true},
+
+ /**
+ * If set to true, a theme dependent marker is shown on the item.
+ * @deprecated Since version 1.18.
+ * Markers should not be used anymore.
+ */
+ showMarker : {type : "boolean", group : "Appearance", defaultValue : false, deprecated: true},
+
+ /**
+ * The icon of the item, either defined in the sap.ui.core.IconPool or an URI to a custom image. An icon must be set.
+ */
+ icon : {type : "sap.ui.core.URI", group : "Appearance", defaultValue : null},
+
+ /**
+ * Invisible items are not shown on the UI.
+ * @since 1.18
+ */
+ visible : {type : "boolean", group : "Appearance", defaultValue : true}
+ },
+ associations : {
+ /**
+ * Association to controls / ids which label this control (see WAI-ARIA attribute aria-labelledby).
+ */
+ ariaLabelledBy : {type : "sap.ui.core.Control", multiple : true, singularName : "ariaLabelledBy"}
+ },
+ events : {
+
+ /**
+ * Event is fired when the user presses the item.
+ */
+ press : {}
+ }
+ }});
+
+ ShellHeadItem.prototype.onclick = function(oEvent){
+ this.firePress();
+ // IE always interprets a click on an anker as navigation and thus triggers the
+ // beforeunload-event on the window. Since a ShellHeadItem never has a valid href-attribute,
+ // the default behavior should never be triggered
+ oEvent.preventDefault();
+ };
+
+ ShellHeadItem.prototype.onsapspace = ShellHeadItem.prototype.onclick;
+
+
+ ShellHeadItem.prototype.setStartsSection = function(bStartsSection){
+ bStartsSection = !!bStartsSection;
+ this.setProperty("startsSection", bStartsSection, true);
+ this.$().toggleClass("sapUiUfdShellHeadItmDelim", bStartsSection);
+ return this;
+ };
+
+
+ ShellHeadItem.prototype.setShowSeparator = function(bShowSeparator){
+ bShowSeparator = !!bShowSeparator;
+ this.setProperty("showSeparator", bShowSeparator, true);
+ this.$().toggleClass("sapUiUfdShellHeadItmSep", bShowSeparator);
+ return this;
+ };
+
+ function _updateSelectionStateInDOM() {
+ var $This = this.$(),
+ bToggleEnabled = this.getToggleEnabled(),
+ bSelected = this.getSelected();
+
+ if (!$This.length) {
+ return;
+ }
+
+ if (bToggleEnabled) {
+ $This.toggleClass("sapUiUfdShellHeadItmSel", bSelected);
+ $This.attr("aria-pressed", bSelected);
+ } else {
+ $This.removeClass("sapUiUfdShellHeadItmSel");
+ $This.removeAttr("aria-pressed");
+ }
+ }
+
+ ShellHeadItem.prototype.setToggleEnabled = function(bEnable){
+ this.setProperty("toggleEnabled", !!bEnable, true);
+ _updateSelectionStateInDOM.apply(this);
+ return this;
+ };
+
+
+ ShellHeadItem.prototype.setSelected = function(bSelected){
+ this.setProperty("selected", !!bSelected, true);
+ _updateSelectionStateInDOM.apply(this);
+ return this;
+ };
+
+
+ ShellHeadItem.prototype.setVisible = function(bVisible){
+ this.setProperty("visible", !!bVisible); // Suppress Rerendering handled by Shell
+ return this;
+ };
+
+
+ ShellHeadItem.prototype.setShowMarker = function(bMarker){
+ bMarker = !!bMarker;
+ this.setProperty("showMarker", bMarker, true);
+ this.$().toggleClass("sapUiUfdShellHeadItmMark", bMarker);
+ return this;
+ };
+
+
+ ShellHeadItem.prototype.setIcon = function(sIcon){
+ this.setProperty("icon", sIcon, true);
+ if (this.getDomRef()) {
+ this._refreshIcon();
+ }
+ return this;
+ };
+
+
+ ShellHeadItem.prototype._refreshIcon = function(){
+ var $Ico = jQuery(this.$().children()[0]);
+ var sIco = this.getIcon();
+ if (IconPool.isIconURI(sIco)) {
+ var oIconInfo = IconPool.getIconInfo(sIco);
+ $Ico.html("").css("style", "");
+ if (oIconInfo) {
+ $Ico.text(oIconInfo.content).attr("role", "presentation").attr("aria-label", oIconInfo.text || oIconInfo.name).css("font-family", "'" + oIconInfo.fontFamily + "'");
+ }
+ } else {
+ var $Image = this.$("img-inner");
+ if ($Image.length == 0 || $Image.attr("src") != sIco) {
+ $Ico.css("style", "").attr("aria-label", null).html("
");
+ }
+ }
+ };
+
+ return ShellHeadItem;
+
+}, /* bExport= */ true);
diff --git a/pool/shard011/JavaScript/0071454_gatsby-node.js b/pool/shard011/JavaScript/0071454_gatsby-node.js
new file mode 100644
index 0000000000000000000000000000000000000000..7af036cf77d1eeb1060e95d9063b7f2f13d0fcb9
--- /dev/null
+++ b/pool/shard011/JavaScript/0071454_gatsby-node.js
@@ -0,0 +1,98 @@
+const _ = require('lodash')
+
+// graphql function doesn't throw an error so we have to check to check for the result.errors to throw manually
+const wrapper = promise =>
+ promise.then(result => {
+ if (result.errors) {
+ throw result.errors
+ }
+ return result
+ })
+
+exports.onCreateNode = ({ node, actions }) => {
+ const { createNodeField } = actions
+
+ let slug
+
+ if (node.internal.type === 'Mdx') {
+ if (
+ Object.prototype.hasOwnProperty.call(node, 'frontmatter') &&
+ Object.prototype.hasOwnProperty.call(node.frontmatter, 'slug')
+ ) {
+ slug = `/${_.kebabCase(node.frontmatter.slug)}`
+ }
+ if (
+ Object.prototype.hasOwnProperty.call(node, 'frontmatter') &&
+ Object.prototype.hasOwnProperty.call(node.frontmatter, 'title')
+ ) {
+ slug = `/${_.kebabCase(node.frontmatter.title)}`
+ }
+ createNodeField({ node, name: 'slug', value: slug })
+ }
+}
+
+exports.createPages = async ({ graphql, actions }) => {
+ const { createPage } = actions
+
+ const postTemplate = require.resolve('./src/templates/post.js')
+ const categoryTemplate = require.resolve('./src/templates/category.js')
+
+ const result = await wrapper(
+ graphql(`
+ {
+ allMdx {
+ edges {
+ node {
+ fields {
+ slug
+ }
+ frontmatter {
+ title
+ categories
+ }
+ }
+ }
+ }
+ }
+ `)
+ )
+
+ const posts = result.data.allMdx.edges
+
+ posts.forEach((edge, index) => {
+ const next = index === 0 ? null : posts[index - 1].node
+ const prev = index === posts.length - 1 ? null : posts[index + 1].node
+
+ createPage({
+ path: edge.node.fields.slug,
+ component: postTemplate,
+ context: {
+ slug: edge.node.fields.slug,
+ prev,
+ next,
+ },
+ })
+ })
+
+ const categorySet = new Set()
+
+ _.each(posts, edge => {
+ if (_.get(edge, 'node.frontmatter.categories')) {
+ edge.node.frontmatter.categories.forEach(cat => {
+ categorySet.add(cat)
+ })
+ }
+ })
+
+ const categories = Array.from(categorySet)
+
+ categories.forEach(category => {
+ createPage({
+ path: `/categories/${_.kebabCase(category)}`,
+ component: categoryTemplate,
+ context: {
+ category,
+ },
+ })
+ })
+}
diff --git a/pool/shard011/JavaScript/0071455_jquery.liteuploader.js b/pool/shard011/JavaScript/0071455_jquery.liteuploader.js
new file mode 100644
index 0000000000000000000000000000000000000000..9adcc717365470d33ba972419d191671a7f11298
--- /dev/null
+++ b/pool/shard011/JavaScript/0071455_jquery.liteuploader.js
@@ -0,0 +1,130 @@
+/* liteUploader v1.4.1 | https://github.com/burt202/lite-uploader | Aaron Burtnyk (http://www.burtdev.net) */
+
+$.fn.liteUploader = function (userOptions)
+{
+ "use strict";
+
+ var defaults = {},
+ options = {};
+
+ defaults = {
+ script: null,
+ allowedFileTypes: null,
+ maxSizeInBytes: null,
+ customParams: {},
+ before: function() { return true; },
+ each: function(file, errors) {},
+ progress: function (percentage) {},
+ success: function(response) {},
+ fail: function(jqXHR) {}
+ };
+
+ options = $.extend(defaults, userOptions);
+
+ function findErrors (file, options)
+ {
+ var errorsArray = [];
+
+ if (options.allowedFileTypes && $.inArray(file.type, options.allowedFileTypes.split(',')) === -1)
+ {
+ errorsArray.push({'type': 'type', 'rule': options.allowedFileTypes, 'given': file.type});
+ }
+
+ if (options.maxSizeInBytes && file.size > options.maxSizeInBytes)
+ {
+ errorsArray.push({'type': 'size', 'rule': options.maxSizeInBytes, 'given': file.size});
+ }
+
+ return errorsArray;
+ }
+
+ function validateFiles (files, options)
+ {
+ var errors = false;
+
+ $.each(files, function(i)
+ {
+ var errorsArray = findErrors(files[i], options);
+ if (errorsArray.length > 0) { errors = true; }
+ options.each(files[i], errorsArray);
+ });
+
+ if (errors) { return false; }
+ return true;
+ }
+
+ function collateFormData (obj, customParams, files)
+ {
+ var formData = new FormData();
+
+ if (obj.attr('id')) { formData.append('liteUploader_id', obj.attr('id')); }
+
+ $.each(customParams, function(key, value)
+ {
+ formData.append(key, value);
+ });
+
+ $.each(files, function(i)
+ {
+ formData.append(obj.attr('name') + '[]', files[i]);
+ });
+
+ return formData;
+ }
+
+ function resetInput (obj)
+ {
+ obj.replaceWith(obj.clone(true));
+ }
+
+ function performUpload (obj, options, formData)
+ {
+ $.ajax(
+ {
+ xhr: function()
+ {
+ var xhr = new XMLHttpRequest();
+
+ xhr.upload.addEventListener('progress', function (evt)
+ {
+ if (evt.lengthComputable)
+ {
+ options.progress(Math.floor((evt.loaded / evt.total) * 100));
+ }
+ }, false);
+
+ return xhr;
+ },
+ url: options.script,
+ type: 'POST',
+ data: formData,
+ processData: false,
+ contentType: false
+ })
+ .always(function ()
+ {
+ resetInput(obj);
+ })
+ .done(function(response)
+ {
+ options.success(response);
+ })
+ .fail(function(jqXHR)
+ {
+ options.fail(jqXHR);
+ });
+ }
+
+ this.change(function ()
+ {
+ var obj = $(this);
+
+ if (!obj.attr('name') || !options.script || !options.before() || this.files.length === 0 || !validateFiles(this.files, options))
+ {
+ resetInput(obj);
+ return;
+ }
+
+ performUpload(obj, options, collateFormData(obj, options.customParams, this.files));
+ });
+};
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071456_other_node-or-browser.js b/pool/shard011/JavaScript/0071456_other_node-or-browser.js
new file mode 100644
index 0000000000000000000000000000000000000000..2039807b305033818d39222328efd154212cca69
--- /dev/null
+++ b/pool/shard011/JavaScript/0071456_other_node-or-browser.js
@@ -0,0 +1,18 @@
+var tape = require("tape");
+
+var protobuf = require("..");
+
+var util = protobuf.util;
+
+if (util.isNode)
+ tape.test("under node.js", function(test) {
+ test.ok(util.fs && util.fs.readFile, "the fs module should be available");
+ test.ok(util.Long && util.Long.isLong, "the long module should be available");
+ test.end();
+ });
+else
+ tape.test("in the browser", function(test) {
+ test.ok(util.fs === null, "the fs module should not be available");
+ test.ok(util.Long && util.Long.isLong, "the long module should be available to test cases");
+ test.end();
+ });
diff --git a/pool/shard011/JavaScript/0071460_middleware.js b/pool/shard011/JavaScript/0071460_middleware.js
new file mode 100644
index 0000000000000000000000000000000000000000..d0262d846b8c9190d54bdcc514e7d44023a2ef15
--- /dev/null
+++ b/pool/shard011/JavaScript/0071460_middleware.js
@@ -0,0 +1,24 @@
+var next = require('./next');
+var response = require('./response');
+var request = require ('./request');
+var result = require('./result');
+
+module.exports = function (middleware, state, callback) {
+
+ if (arguments.length === 2) {
+ callback = state;
+ }
+
+ var req, res, nex;
+
+ var end = function () {
+ callback(result(req, res, nex));
+ };
+
+ req = request(state);
+ res = response(state, end);
+ nex = next(end);
+
+ middleware(req, res, nex);
+
+};
diff --git a/pool/shard011/JavaScript/0071462_CarouselIndicators.js b/pool/shard011/JavaScript/0071462_CarouselIndicators.js
new file mode 100644
index 0000000000000000000000000000000000000000..0bca34ef2994b79257c6d1253362152dc841059c
--- /dev/null
+++ b/pool/shard011/JavaScript/0071462_CarouselIndicators.js
@@ -0,0 +1,59 @@
+'use strict';
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+var _react = require('react');
+
+var _react2 = _interopRequireDefault(_react);
+
+var _propTypes = require('prop-types');
+
+var _propTypes2 = _interopRequireDefault(_propTypes);
+
+var _classnames = require('classnames');
+
+var _classnames2 = _interopRequireDefault(_classnames);
+
+var _utils = require('./utils');
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var CarouselIndicators = function CarouselIndicators(props) {
+ var items = props.items,
+ activeIndex = props.activeIndex,
+ cssModule = props.cssModule,
+ onClickHandler = props.onClickHandler,
+ className = props.className;
+
+
+ var listClasses = (0, _utils.mapToCssModules)((0, _classnames2.default)(className, 'carousel-indicators', cssModule));
+ var indicators = items.map(function (item, idx) {
+ var indicatorClasses = (0, _utils.mapToCssModules)((0, _classnames2.default)({ active: activeIndex === idx }), cssModule);
+ return _react2.default.createElement('li', {
+ key: '' + (item.key || item.src) + item.caption + item.altText,
+ onClick: function onClick(e) {
+ e.preventDefault();
+ onClickHandler(idx);
+ },
+ className: indicatorClasses
+ });
+ });
+
+ return _react2.default.createElement(
+ 'ol',
+ { className: listClasses },
+ indicators
+ );
+};
+
+CarouselIndicators.propTypes = {
+ items: _propTypes2.default.array.isRequired,
+ activeIndex: _propTypes2.default.number.isRequired,
+ cssModule: _propTypes2.default.object,
+ onClickHandler: _propTypes2.default.func.isRequired,
+ className: _propTypes2.default.string
+};
+
+exports.default = CarouselIndicators;
\ No newline at end of file
diff --git a/pool/shard011/JavaScript/0071464_NavigationArrow.js b/pool/shard011/JavaScript/0071464_NavigationArrow.js
new file mode 100644
index 0000000000000000000000000000000000000000..d27731b2eb578df138ad14c8188c3e89240a8152
--- /dev/null
+++ b/pool/shard011/JavaScript/0071464_NavigationArrow.js
@@ -0,0 +1,60 @@
+/**
+ * @author Russell Toris - rctoris@wpi.edu
+ */
+
+/**
+ * A navigation arrow is a directed triangle that can be used to display orientation.
+ *
+ * @constructor
+ * @param options - object with following keys:
+ * * size (optional) - the size of the marker
+ * * strokeSize (optional) - the size of the outline
+ * * strokeColor (optional) - the createjs color for the stroke
+ * * fillColor (optional) - the createjs color for the fill
+ * * pulse (optional) - if the marker should "pulse" over time
+ */
+ROS2D.NavigationArrow = function(options) {
+ var that = this;
+ options = options || {};
+ var size = options.size || 10;
+ var strokeSize = options.strokeSize || 3;
+ var strokeColor = options.strokeColor || createjs.Graphics.getRGB(0, 0, 0);
+ var fillColor = options.fillColor || createjs.Graphics.getRGB(255, 0, 0);
+ var pulse = options.pulse;
+
+ // draw the arrow
+ var graphics = new createjs.Graphics();
+ // line width
+ graphics.setStrokeStyle(strokeSize);
+ graphics.moveTo(-size / 2.0, size / 2.0);
+ graphics.beginStroke(strokeColor);
+ graphics.beginFill(fillColor);
+ graphics.lineTo(0, -size);
+ graphics.lineTo(size / 2.0, size / 2.0);
+ graphics.lineTo(-size / 2.0, size / 2.0);
+ graphics.closePath();
+ graphics.endFill();
+ graphics.endStroke();
+
+ // create the shape
+ createjs.Shape.call(this, graphics);
+
+ // check if we are pulsing
+ if (pulse) {
+ // have the model "pulse"
+ var growCount = 0;
+ var growing = true;
+ createjs.Ticker.addEventListener('tick', function() {
+ if (growing) {
+ that.scaleX *= 1.035;
+ that.scaleY *= 1.035;
+ growing = (++growCount < 10);
+ } else {
+ that.scaleX /= 1.035;
+ that.scaleY /= 1.035;
+ growing = (--growCount < 0);
+ }
+ });
+ }
+};
+ROS2D.NavigationArrow.prototype.__proto__ = createjs.Shape.prototype;
diff --git a/pool/shard011/JavaScript/0071465_ViewBox.js b/pool/shard011/JavaScript/0071465_ViewBox.js
new file mode 100644
index 0000000000000000000000000000000000000000..7d532b8850857a2eb4636e81303280da67147672
--- /dev/null
+++ b/pool/shard011/JavaScript/0071465_ViewBox.js
@@ -0,0 +1,178 @@
+// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License.txt in the project root for license information.
+// ViewBox control
+define([
+ '../Core/_Global',
+ '../Core/_Base',
+ '../Core/_BaseUtils',
+ '../Core/_ErrorFromName',
+ '../Core/_Resources',
+ '../Scheduler',
+ '../Utilities/_Control',
+ '../Utilities/_Dispose',
+ '../Utilities/_ElementUtilities',
+ '../Utilities/_Hoverable',
+ 'require-style!less/styles-viewbox'
+ ], function viewboxInit(_Global, _Base, _BaseUtils, _ErrorFromName, _Resources, Scheduler, _Control, _Dispose, _ElementUtilities, _Hoverable) {
+ "use strict";
+
+ _Base.Namespace.define("WinJS.UI", {
+ ///
+ ///
+ /// Scales a single child element to fill the available space without
+ /// resizing it. This control reacts to changes in the size of the container as well as
+ /// changes in size of the child element. For example, a media query may result in
+ /// a change in aspect ratio.
+ ///
+ ///
+ /// View Box
+ ///
+ ///
+ /// ViewBox
]]>
+ ///