diff --git a/pool/shard007/JavaScript/0047834_Adjustor.js b/pool/shard007/JavaScript/0047834_Adjustor.js new file mode 100644 index 0000000000000000000000000000000000000000..516b5060e7c8258bccee18e4d055bf957f4c4958 --- /dev/null +++ b/pool/shard007/JavaScript/0047834_Adjustor.js @@ -0,0 +1,115 @@ +var Adjustor = {}; + +Adjustor.UP = 38; +Adjustor.DOWN = 40; + +Adjustor.nudge = function (input, event, format){ + + // when replacing the nudged value, tells us where to start and + // how far to go (like substr(repl.start, repl.length)) + var repl = { start: 0, length: 0 }; + + // record the original position of the cursor + var cursor = input.selectionStart; + + // determine which direction we're nudging + var direction = event.keyCode; + if (direction != Adjustor.UP && direction != Adjustor.DOWN){ + return; + } + + // since we'll sometimes prevent the cursor from moving, we + // should always prevent the cursor from moving + event.preventDefault(); + + function parse(){ + var value = input.value, + p = cursor, + start; + + function isNumeric(value){ + return !isNaN(parseInt(value)); + } + + while (start == undefined){ + + var left = isNumeric(value[p - 1]), + right = isNumeric(value[p]); + + // if there's no digit left or right, bail + if (!left && !right){ + return; + } + + // if there's no digit left but a digit right, we've found our start + else if (!left && right){ + start = p; + } + + // if there's a digit left, regardless of a digit right, move left + else if (left){ + p--; + } + } + + var parsed = parseInt(value.substr(start)); + + // record the start and the length to replace this value later + repl.start = start; + repl.length = parsed.toString().length; + + return parsed; + } + + /** + * Replaces the currently matched substring with another value, based on + * the start and length found by parse() (i.e., call that first). Returns + * the new string. + * + * @param string + * @return string + */ + function replace(value){ + var min = 0, max; + + // determine the maximum value for this...value + if (format == Color.RGB){ + max = 255; + } else { + + // if we're looking at hue, then there will be no digits to the + // left of the start position + max = /\d/.test(input.value.substr(0, repl.start)) ? 100 : 359; + } + + value = Math.max(min, Math.min(max, value)); + + var chunks = input.value.split(""); + chunks.splice(repl.start, repl.length, value); + return chunks.join(""); + } + + /** + * Provides the offset to add to the current value, based on whether + * we're nudging up or down (which arrow key) and big or small (whether + * the Option key was being held). + * + * @return int + */ + function adjustment(){ + return (direction == Adjustor.UP ? 1 : -1) * (event.altKey ? 10 : 1); + } + + var parsed = parse(); + + if (parsed == undefined){ + return; + } + + input.value = replace(parsed + adjustment()); + + // put the cursor in the right spot + input.selectionStart = input.selectionEnd = cursor; + + return input.value; +}; diff --git a/pool/shard007/JavaScript/0047836_checkbox.js b/pool/shard007/JavaScript/0047836_checkbox.js new file mode 100644 index 0000000000000000000000000000000000000000..2b764f9bce7cebace9ef52c283a6d801f6bdcdd6 --- /dev/null +++ b/pool/shard007/JavaScript/0047836_checkbox.js @@ -0,0 +1,36 @@ +'use strict'; + +angular.module('angularify.semantic.checkbox', []) +.directive('checkbox', function() { + return { + restrict: 'E', + replace: true, + transclude: true, + scope: { + checked: '&?', + disabled: '&?', + ngModel: '=ngModel' + }, + controller: function() { + var vm = this; + + // TODO: assert this is usefull ? + // if(angular.isUndefined(vm.ngModel)) { vm.ngModel = !!vm.ngModel; } + + if(angular.isFunction(vm.checked)) { vm.ngModel = !!vm.checked(); } + + vm.toggle = function() { + if(angular.isFunction(vm.disabled) && vm.disabled()) return; + vm.ngModel = !vm.ngModel; + } + }, + controllerAs: 'vm', + bindToController: true, + require: 'ngModel', + template: '
, because it just gets in the way. + from_box.parentNode.removeChild(ps[i]); + } else if (ps[i].className.indexOf("help") !== -1) { + // Move help text up to the top so it isn't below the select + // boxes or wrapped off on the side to the right of the add + // button: + from_box.parentNode.insertBefore(ps[i], from_box.parentNode.firstChild); + } + } + + //
Sets up event delegation on a container element. The delegated event + * will use a supplied selector or filtering function to test if the event + * references at least one node that should trigger the subscription + * callback.
+ * + *Selector string filters will trigger the callback if the event originated + * from a node that matches it or is contained in a node that matches it. + * Function filters are called for each Node up the parent axis to the + * subscribing container node, and receive at each level the Node and the event + * object. The function should return true (or a truthy value) if that Node + * should trigger the subscription callback. Note, it is possible for filters + * to match multiple Nodes for a single event. In this case, the delegate + * callback will be executed for each matching Node.
+ * + *For each matching Node, the callback will be executed with its 'this'
+ * object set to the Node matched by the filter (unless a specific context was
+ * provided during subscription), and the provided event's
+ * currentTarget will also be set to the matching Node. The
+ * containing Node from which the subscription was originally made can be
+ * referenced as e.container.
+ *
+ * @method delegate
+ * @param type {String} the event type to delegate
+ * @param fn {Function} the callback function to execute. This function
+ * will be provided the event object for the delegated event.
+ * @param el {String|node} the element that is the delegation container
+ * @param filter {string|Function} a selector that must match the target of the
+ * event or a function to test target and its parents for a match
+ * @param context optional argument that specifies what 'this' refers to.
+ * @param args* 0..n additional arguments to pass on to the callback function.
+ * These arguments will be added after the event object.
+ * @return {EventHandle} the detach handle
+ * @static
+ * @for Event
+ */
+function delegate(type, fn, el, filter) {
+ var args = toArray(arguments, 0, true),
+ query = isString(el) ? el : null,
+ typeBits, synth, container, categories, cat, i, len, handles, handle;
+
+ // Support Y.delegate({ click: fnA, key: fnB }, el, filter, ...);
+ // and Y.delegate(['click', 'key'], fn, el, filter, ...);
+ if (isObject(type)) {
+ handles = [];
+
+ if (isArray(type)) {
+ for (i = 0, len = type.length; i < len; ++i) {
+ args[0] = type[i];
+ handles.push(Y.delegate.apply(Y, args));
+ }
+ } else {
+ // Y.delegate({'click', fn}, el, filter) =>
+ // Y.delegate('click', fn, el, filter)
+ args.unshift(null); // one arg becomes two; need to make space
+
+ for (i in type) {
+ if (type.hasOwnProperty(i)) {
+ args[0] = i;
+ args[1] = type[i];
+ handles.push(Y.delegate.apply(Y, args));
+ }
+ }
+ }
+
+ return new Y.EventHandle(handles);
+ }
+
+ typeBits = type.split(/\|/);
+
+ if (typeBits.length > 1) {
+ cat = typeBits.shift();
+ args[0] = type = typeBits.shift();
+ }
+
+ synth = Y.Node.DOM_EVENTS[type];
+
+ if (isObject(synth) && synth.delegate) {
+ handle = synth.delegate.apply(synth, arguments);
+ }
+
+ if (!handle) {
+ if (!type || !fn || !el || !filter) {
+ return;
+ }
+
+ container = (query) ? Y.Selector.query(query, null, true) : el;
+
+ if (!container && isString(el)) {
+ handle = Y.on('available', function () {
+ Y.mix(handle, Y.delegate.apply(Y, args), true);
+ }, el);
+ }
+
+ if (!handle && container) {
+ args.splice(2, 2, container); // remove the filter
+
+ handle = Y.Event._attach(args, { facade: false });
+ handle.sub.filter = filter;
+ handle.sub._notify = delegate.notifySub;
+ }
+ }
+
+ if (handle && cat) {
+ categories = detachCategories[cat] || (detachCategories[cat] = {});
+ categories = categories[type] || (categories[type] = []);
+ categories.push(handle);
+ }
+
+ return handle;
+}
+
+/**
+Overrides the _notify method on the normal DOM subscription to
+inject the filtering logic and only proceed in the case of a match.
+
+This method is hosted as a private property of the `delegate` method
+(e.g. `Y.delegate.notifySub`)
+
+@method notifySub
+@param thisObj {Object} default 'this' object for the callback
+@param args {Array} arguments passed to the event's fire()
+@param ce {CustomEvent} the custom event managing the DOM subscriptions for
+ the subscribed event on the subscribing node.
+@return {Boolean} false if the event was stopped
+@private
+@static
+@since 3.2.0
+**/
+delegate.notifySub = function (thisObj, args, ce) {
+ // Preserve args for other subscribers
+ args = args.slice();
+ if (this.args) {
+ args.push.apply(args, this.args);
+ }
+
+ // Only notify subs if the event occurred on a targeted element
+ var currentTarget = delegate._applyFilter(this.filter, args, ce),
+ //container = e.currentTarget,
+ e, i, len, ret;
+
+ if (currentTarget) {
+ // Support multiple matches up the the container subtree
+ currentTarget = toArray(currentTarget);
+
+ // The second arg is the currentTarget, but we'll be reusing this
+ // facade, replacing the currentTarget for each use, so it doesn't
+ // matter what element we seed it with.
+ e = args[0] = new Y.DOMEventFacade(args[0], ce.el, ce);
+
+ e.container = Y.one(ce.el);
+
+ for (i = 0, len = currentTarget.length; i < len && !e.stopped; ++i) {
+ e.currentTarget = Y.one(currentTarget[i]);
+
+ ret = this.fn.apply(this.context || e.currentTarget, args);
+
+ if (ret === false) { // stop further notifications
+ break;
+ }
+ }
+
+ return ret;
+ }
+};
+
+/**
+Compiles a selector string into a filter function to identify whether
+Nodes along the parent axis of an event's target should trigger event
+notification.
+
+This function is memoized, so previously compiled filter functions are
+returned if the same selector string is provided.
+
+This function may be useful when defining synthetic events for delegate
+handling.
+
+Hosted as a property of the `delegate` method (e.g. `Y.delegate.compileFilter`).
+
+@method compileFilter
+@param selector {String} the selector string to base the filtration on
+@return {Function}
+@since 3.2.0
+@static
+**/
+delegate.compileFilter = Y.cached(function (selector) {
+ return function (target, e) {
+ return selectorTest(target._node, selector,
+ (e.currentTarget === e.target) ? null : e.currentTarget._node);
+ };
+});
+
+/**
+Walks up the parent axis of an event's target, and tests each element
+against a supplied filter function. If any Nodes, including the container,
+satisfy the filter, the delegated callback will be triggered for each.
+
+Hosted as a protected property of the `delegate` method (e.g.
+`Y.delegate._applyFilter`).
+
+@method _applyFilter
+@param filter {Function} boolean function to test for inclusion in event
+ notification
+@param args {Array} the arguments that would be passed to subscribers
+@param ce {CustomEvent} the DOM event wrapper
+@return {Node|Node[]|undefined} The Node or Nodes that satisfy the filter
+@protected
+**/
+delegate._applyFilter = function (filter, args, ce) {
+ var e = args[0],
+ container = ce.el, // facadeless events in IE, have no e.currentTarget
+ target = e.target || e.srcElement,
+ match = [],
+ isContainer = false;
+
+ // Resolve text nodes to their containing element
+ if (target.nodeType === 3) {
+ target = target.parentNode;
+ }
+
+ // passing target as the first arg rather than leaving well enough alone
+ // making 'this' in the filter function refer to the target. This is to
+ // support bound filter functions.
+ args.unshift(target);
+
+ if (isString(filter)) {
+ while (target) {
+ isContainer = (target === container);
+ if (selectorTest(target, filter, (isContainer ? null: container))) {
+ match.push(target);
+ }
+
+ if (isContainer) {
+ break;
+ }
+
+ target = target.parentNode;
+ }
+ } else {
+ // filter functions are implementer code and should receive wrappers
+ args[0] = Y.one(target);
+ args[1] = new Y.DOMEventFacade(e, container, ce);
+
+ while (target) {
+ // filter(target, e, extra args...) - this === target
+ if (filter.apply(args[0], args)) {
+ match.push(target);
+ }
+
+ if (target === container) {
+ break;
+ }
+
+ target = target.parentNode;
+ args[0] = Y.one(target);
+ }
+ args[1] = e; // restore the raw DOM event
+ }
+
+ if (match.length <= 1) {
+ match = match[0]; // single match or undefined
+ }
+
+ // remove the target
+ args.shift();
+
+ return match;
+};
+
+/**
+ * Sets up event delegation on a container element. The delegated event
+ * will use a supplied filter to test if the callback should be executed.
+ * This filter can be either a selector string or a function that returns
+ * a Node to use as the currentTarget for the event.
+ *
+ * The event object for the delegated event is supplied to the callback
+ * function. It is modified slightly in order to support all properties
+ * that may be needed for event delegation. 'currentTarget' is set to
+ * the element that matched the selector string filter or the Node returned
+ * from the filter function. 'container' is set to the element that the
+ * listener is delegated from (this normally would be the 'currentTarget').
+ *
+ * Filter functions will be called with the arguments that would be passed to
+ * the callback function, including the event object as the first parameter.
+ * The function should return false (or a falsey value) if the success criteria
+ * aren't met, and the Node to use as the event's currentTarget and 'this'
+ * object if they are.
+ *
+ * @method delegate
+ * @param type {string} the event type to delegate
+ * @param fn {function} the callback function to execute. This function
+ * will be provided the event object for the delegated event.
+ * @param el {string|node} the element that is the delegation container
+ * @param filter {string|function} a selector that must match the target of the
+ * event or a function that returns a Node or false.
+ * @param context optional argument that specifies what 'this' refers to.
+ * @param args* 0..n additional arguments to pass on to the callback function.
+ * These arguments will be added after the event object.
+ * @return {EventHandle} the detach handle
+ * @for YUI
+ */
+Y.delegate = Y.Event.delegate = delegate;
+
+
+}, '3.5.1' ,{requires:['node-base']});
diff --git a/pool/shard007/JavaScript/0047982_bosh.js b/pool/shard007/JavaScript/0047982_bosh.js
new file mode 100644
index 0000000000000000000000000000000000000000..c17c5e5ac58387e28a5a72305802a247402ed040
--- /dev/null
+++ b/pool/shard007/JavaScript/0047982_bosh.js
@@ -0,0 +1,69 @@
+import { Namespace as NS } from 'xmpp-constants';
+
+
+export default function (JXT) {
+
+ let Utils = JXT.utils;
+
+ JXT.define({
+ name: 'bosh',
+ namespace: NS.BOSH,
+ element: 'body',
+ prefixes: {
+ xmpp: NS.BOSH_XMPP
+ },
+ fields: {
+ accept: Utils.attribute('accept'),
+ ack: Utils.numberAttribute('ack'),
+ authid: Utils.attribute('authid'),
+ charsets: Utils.attribute('charsets'),
+ condition: Utils.attribute('condition'),
+ content: Utils.attribute('content'),
+ from: Utils.jidAttribute('from', true),
+ hold: Utils.numberAttribute('hold'),
+ inactivity: Utils.numberAttribute('inactivity'),
+ key: Utils.attribute('key'),
+ maxpause: Utils.numberAttribute('maxpause'),
+ newKey: Utils.attribute('newkey'),
+ pause: Utils.numberAttribute('pause'),
+ polling: Utils.numberAttribute('polling'),
+ resport: Utils.numberAttribute('report'),
+ requests: Utils.numberAttribute('requests'),
+ rid: Utils.numberAttribute('rid'),
+ sid: Utils.attribute('sid'),
+ stream: Utils.attribute('stream'),
+ time: Utils.attribute('time'),
+ to: Utils.jidAttribute('to', true),
+ type: Utils.attribute('type'),
+ ver: Utils.attribute('ver'),
+ wait: Utils.numberAttribute('wait'),
+ uri: Utils.textSub(NS.BOSH, 'uri'),
+ lang: Utils.langAttribute(),
+ // These three should be using namespaced attributes, but browsers are stupid
+ // when it comes to serializing attributes with namespaces
+ version: Utils.attribute('xmpp:version', '1.0'),
+ restart: Utils.attribute('xmpp:restart'),
+ restartLogic: Utils.boolAttribute('xmpp:restartLogic'),
+ payload: {
+ get: function () {
+
+ let results = [];
+ for (let i = 0, len = this.xml.childNodes.length; i < len; i++) {
+ let obj = JXT.build(this.xml.childNodes[i]);
+ if (obj !== undefined) {
+ results.push(obj);
+ }
+ }
+ return results;
+ },
+ set: function (values) {
+
+ values.forEach((types) => {
+
+ this.xml.appendChild(types.xml);
+ });
+ }
+ }
+ }
+ });
+}
diff --git a/pool/shard007/JavaScript/0047984_ponk_blame.js b/pool/shard007/JavaScript/0047984_ponk_blame.js
new file mode 100644
index 0000000000000000000000000000000000000000..7c7a34223ef80530c0f60f71654358537da9e2d4
--- /dev/null
+++ b/pool/shard007/JavaScript/0047984_ponk_blame.js
@@ -0,0 +1,101 @@
+/*!
+**| PonkBot Media Responsibility
+**@
+*/
+
+// TODO: Account for add command usage
+function responsibility(user, params, { rank, command }) {
+ if(this.meeseeks('seeplaylist')){
+ if(!this.playlist.length){
+ return this.sendMessage('The playlist is empty dumbass.', true);
+ }
+ } else {
+ return this.sendMessage(`The playlist viewing permission is too restricted for this command to function.`, true);
+ }
+
+ const who = (bypass) => {
+ let message;
+ let blame = 'unknown';
+
+ for(const video in this.playlist){
+ console.log('checking video', video)
+ if(this.playlist[video].uid !== this.currUID){ continue }
+ blame = this.playlist[video].queueby; break;
+ }
+
+ if(![this.name, ...this.peers].includes(blame) && !/og|orig/i.test(params)){
+ switch(command){
+ case 'blame': message = `This disgusting piece of shit was queued by ${blame}.`;
+ break;
+ case 'thank': message = `Based ${blame} queued a spicy one.`;
+ break;
+ }
+
+ return this.sendMessage(message, bypass)
+ }
+
+ return this.mediaBlame(this.currMedia, (row) => {
+ switch(true){
+ case ( row && command === 'blame'):
+ message = `This foul adbomination was first unearthed by ${row.user}.`;
+ break;
+ case ( row && command === 'thank'):
+ message = `Based ${row.user} brought us the dankest memes.`;
+ break;
+ case (!row && command === 'blame'):
+ message = 'I bet the dragons did this.';
+ break;
+ case (!row && command === 'thank'):
+ message = 'A mysterious benevolent entity graciously supplied us with this media.';
+ break;
+ }
+ return this.sendMessage(message, bypass);
+ })
+ }
+
+ this.checkCooldown({
+ type: 'queueby', user, modBypass: rank > 2
+ }).then(()=>{
+
+ // Used solely to bypass mute
+ this.checkPermission({
+ user, rank: 2, hybrid: 'mute'
+ }).then(()=>{
+ who(true);
+ },()=>{
+ who(false);
+ });
+
+ },(message)=>{
+ this.sendPrivate(message, user);
+ });
+
+}
+
+module.exports = {
+ meta: {
+ active: true,
+ type: 'gumdrop'
+ },
+ handlers: {
+
+ blame: function(user, params, meta) {
+ responsibility.call(this, user, params, meta);
+ },
+
+ thank: function(user, params, meta) {
+ responsibility.call(this, user, params, meta);
+ },
+
+ },
+ cooldowns: {
+ queueby: {
+ type : 'queueby',
+ name : 'Media Responsibility',
+ personalType : 'since',
+ personalParams : 15 * 1000,
+ sharedType : 'since',
+ sharedParams : 0,
+ }
+ },
+}
diff --git a/pool/shard007/JavaScript/0047985_NavigationItem.js b/pool/shard007/JavaScript/0047985_NavigationItem.js
new file mode 100644
index 0000000000000000000000000000000000000000..964b25cdcb892b9624fe7668a71aea4297091023
--- /dev/null
+++ b/pool/shard007/JavaScript/0047985_NavigationItem.js
@@ -0,0 +1,41 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import { NavLink as RouterNavLink } from 'react-router-dom';
+import { useTranslation } from 'react-i18next';
+import { NavItem, NavLink } from 'reactstrap';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+
+export default function NavigationItem({ external, href, i18nKey, icon }) {
+ const { t } = useTranslation();
+ let navLinkProps = {
+ tag: RouterNavLink,
+ to: href,
+ activeClassName: 'active',
+ };
+
+ if (external) {
+ navLinkProps = {
+ href,
+ };
+ }
+
+ return (
+ strike-through style to the text.
+ *
+ * CKEDITOR.config.coreStyles_strike = {
+ * element: 'span',
+ * attributes: { 'class': 'StrikeThrough' },
+ * overrides: 'strike'
+ * };
+ *
+ * @cfg
+ * @member CKEDITOR.config
+ */
+CKEDITOR.config.coreStyles_strike = { element: 's', overrides: 'strike' };
+
+/**
+ * The style definition that applies the subscript style to the text.
+ *
+ * CKEDITOR.config.coreStyles_subscript = {
+ * element: 'span',
+ * attributes: { 'class': 'Subscript' },
+ * overrides: 'sub'
+ * };
+ *
+ * @cfg
+ * @member CKEDITOR.config
+ */
+CKEDITOR.config.coreStyles_subscript = { element: 'sub' };
+
+/**
+ * The style definition that applies the superscript style to the text.
+ *
+ * CKEDITOR.config.coreStyles_superscript = {
+ * element: 'span',
+ * attributes: { 'class': 'Superscript' },
+ * overrides: 'sup'
+ * };
+ *
+ * @cfg
+ * @member CKEDITOR.config
+ */
+CKEDITOR.config.coreStyles_superscript = { element: 'sup' };
diff --git a/pool/shard007/JavaScript/0047991_events.js b/pool/shard007/JavaScript/0047991_events.js
new file mode 100644
index 0000000000000000000000000000000000000000..0676ab7b5c4021dad8c831644b53c997462a82e3
--- /dev/null
+++ b/pool/shard007/JavaScript/0047991_events.js
@@ -0,0 +1,60 @@
+// Check if any tabs are on a match url.
+function checkIfMatchesExist(callback) {
+ var matches = chrome.runtime.getManifest().content_scripts[0].matches;
+ chrome.tabs.query({url: matches}, function(tabs) {
+ callback(tabs.length > 0);
+ });
+}
+
+chrome.runtime.onInstalled.addListener(function(details) {
+ if (details.reason === 'install') {
+ chrome.storage.sync.set({'longestStreak': 0}, function() {
+ console.log("Initialized longest streak.");
+ });
+ checkIfMatchesExist(function(matchesExist) {
+ if (!matchesExist) {
+ var currentTime = new Date().getTime() / 1000;
+ // If no tabs are on a match url, we can initialize the first visit
+ // time, which is the time of installation.
+ chrome.storage.sync.set({'lastVisit': currentTime, 'activeSession': false}, function() {
+ console.log("Streak started.");
+ });
+ } else {
+ // At least one tab is on a match url. Set activeSession so popup.js can
+ // render the appropriate text. Wait for the onRemoved listener to fire
+ // and set the first visit time.
+ chrome.storage.sync.set({'activeSession': true}, function() {
+ console.log("Please close all tabs with reddit.com to begin.");
+ });
+ }
+ });
+
+ // A friendly alert to notify the user about allowing the extension to run
+ // in incognito.
+ chrome.extension.isAllowedIncognitoAccess(function(isAllowedAccess) {
+ if (isAllowedAccess) {
+ return;
+ }
+ alert('No cheating! Please allow Reddiet to run in incognito.');
+ chrome.tabs.create({
+ url: 'chrome://extensions/?id=' + chrome.runtime.id
+ });
+ });
+ }
+});
+
+chrome.tabs.onRemoved.addListener(function() {
+ checkIfMatchesExist(function(matchesExist) {
+ if (!matchesExist) {
+ chrome.storage.sync.get('activeSession', function(items) {
+ if (items.activeSession) {
+ // An active session just ended so we can record the time of visit now.
+ var currentTime = new Date().getTime() / 1000;
+ chrome.storage.sync.set({'lastVisit': currentTime, 'activeSession': false}, function() {
+ console.log("Active session ended. Visit recorded.");
+ });
+ }
+ });
+ }
+ });
+});
diff --git a/pool/shard007/JavaScript/0047993_isitdown.js b/pool/shard007/JavaScript/0047993_isitdown.js
new file mode 100644
index 0000000000000000000000000000000000000000..0f9a54bba995c6571f744c12a4a30ef50aea537b
--- /dev/null
+++ b/pool/shard007/JavaScript/0047993_isitdown.js
@@ -0,0 +1,31 @@
+"use strict";
+
+var request = require('request');
+var cheerio = require('cheerio');
+
+module.exports = {
+ isitdown: function(callback, url) {
+ if (!url.startsWith("https://"))
+ {
+ url = "https://" + url;
+ }
+
+ var options = {
+ url: url,
+ timeout: 2500
+ }
+
+ //console.log(url)
+ request(options, function(error, response, html) {
+ var resultstring = "";
+ if (error) {
+ resultstring += "Seems to be down!\n" + error;
+ } else {
+ resultstring += "It seems to be up!";
+ resultstring += `\n Status code: [${response.statusCode}](https://httpstatuses.com/${response.statusCode})`;
+ }
+
+ callback(resultstring);
+ });
+ }
+}
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0047994_WebSocket.js b/pool/shard007/JavaScript/0047994_WebSocket.js
new file mode 100644
index 0000000000000000000000000000000000000000..fbb704d762c77bf4266a49010a7f2d3938eaaa66
--- /dev/null
+++ b/pool/shard007/JavaScript/0047994_WebSocket.js
@@ -0,0 +1,181 @@
+/**
+ * @requires javelin-install
+ * @provides javelin-websocket
+ * @javelin
+ */
+
+/**
+ * Wraps a WebSocket.
+ */
+JX.install('WebSocket', {
+
+ construct: function(uri) {
+ this.setURI(uri);
+ this._resetDelay();
+ },
+
+ properties: {
+ URI: null,
+
+ /**
+ * Called when a connection is established or re-established after an
+ * interruption.
+ */
+ openHandler: null,
+
+ /**
+ * Called when a message is received.
+ */
+ messageHandler: null,
+
+ /**
+ * Called when the connection is closed.
+ *
+ * You can return `true` to prevent the socket from reconnecting.
+ */
+ closeHandler: null
+ },
+
+ members: {
+ /**
+ * The underlying WebSocket.
+ */
+ _socket: null,
+
+ /**
+ * Is the socket connected?
+ */
+ _isOpen: false,
+
+ /**
+ * Has the caller asked us to close?
+ *
+ * By default, we reconnect when the connection is interrupted.
+ * This stops us from reconnecting if @{method:close} was called.
+ */
+ _shouldClose: false,
+
+ /**
+ * Number of milliseconds to wait after a connection failure before
+ * attempting to reconnect.
+ */
+ _delayUntilReconnect: null,
+
+
+ /**
+ * Open the connection.
+ */
+ open: function() {
+ if (!window.WebSocket) {
+ return;
+ }
+
+ this._shouldClose = false;
+
+ this._socket = new WebSocket(this.getURI());
+ this._socket.onopen = JX.bind(this, this._onopen);
+ this._socket.onmessage = JX.bind(this, this._onmessage);
+ this._socket.onclose = JX.bind(this, this._onclose);
+ },
+
+
+ /**
+ * Send a message.
+ *
+ * If the connection is not currently open, this method has no effect and
+ * the messages vanishes into the ether.
+ */
+ send: function(message) {
+ if (this._isOpen) {
+ this._socket.send(message);
+ }
+ },
+
+
+ /**
+ * Close the connection.
+ */
+ close: function() {
+ if (!this._isOpen) {
+ return;
+ }
+ this._shouldClose = true;
+ this._socket.close();
+ },
+
+
+ /**
+ * Callback for connection open.
+ */
+ _onopen: function() {
+ this._isOpen = true;
+
+ // Reset the reconnect delay, since we connected successfully.
+ this._resetDelay();
+
+ var handler = this.getOpenHandler();
+ if (handler) {
+ handler();
+ }
+ },
+
+
+ /**
+ * Reset the reconnect delay to its base value.
+ */
+ _resetDelay: function() {
+ this._delayUntilReconnect = 2000;
+ },
+
+
+ /**
+ * Callback for message received.
+ */
+ _onmessage: function(e) {
+ var data = e.data;
+
+ var handler = this.getMessageHandler();
+ if (handler) {
+ handler(data);
+ }
+ },
+
+
+ /**
+ * Callback for connection close.
+ */
+ _onclose: function() {
+ this._isOpen = false;
+
+ var done = false;
+
+ var handler = this.getCloseHandler();
+ if (handler) {
+ done = handler();
+ }
+
+ // If we didn't explicitly see a close() call and the close handler
+ // did not return `true` to stop the reconnect, wait a little while
+ // and try to reconnect.
+ if (!done && !this._shouldClose) {
+ setTimeout(JX.bind(this, this._reconnect), this._delayUntilReconnect);
+ }
+ },
+
+
+ /**
+ * Reconnect an interrupted socket.
+ */
+ _reconnect: function() {
+ // Increase the reconnect delay by a factor of 2. If we fail to open the
+ // connection, the close handler will send us back here. We'll reconnect
+ // more and more slowly until we eventually get a valid connection.
+ this._delayUntilReconnect = this._delayUntilReconnect * 2;
+
+ // Max out at 5 minutes between attempts.
+ this._delayUntilReconnect = Math.min(this._delayUntilReconnect, 300000);
+ this.open();
+ }
+
+ }
+});
diff --git a/pool/shard007/JavaScript/0048001_ide_tree_list_spec.js b/pool/shard007/JavaScript/0048001_ide_tree_list_spec.js
new file mode 100644
index 0000000000000000000000000000000000000000..f63007c7dd2b3735142217a9c376103ee2073bf3
--- /dev/null
+++ b/pool/shard007/JavaScript/0048001_ide_tree_list_spec.js
@@ -0,0 +1,77 @@
+import Vue from 'vue';
+import IdeTreeList from '~/ide/components/ide_tree_list.vue';
+import store from '~/ide/stores';
+import { createComponentWithStore } from '../../helpers/vue_mount_component_helper';
+import { resetStore, file } from '../helpers';
+import { projectData } from '../mock_data';
+
+describe('IDE tree list', () => {
+ const Component = Vue.extend(IdeTreeList);
+ const normalBranchTree = [file('fileName')];
+ const emptyBranchTree = [];
+ let vm;
+
+ const bootstrapWithTree = (tree = normalBranchTree) => {
+ store.state.currentProjectId = 'abcproject';
+ store.state.currentBranchId = 'master';
+ store.state.projects.abcproject = Object.assign({}, projectData);
+ Vue.set(store.state.trees, 'abcproject/master', {
+ tree,
+ loading: false,
+ });
+
+ vm = createComponentWithStore(Component, store, {
+ viewerType: 'edit',
+ });
+ };
+
+ afterEach(() => {
+ vm.$destroy();
+
+ resetStore(vm.$store);
+ });
+
+ describe('normal branch', () => {
+ beforeEach(() => {
+ bootstrapWithTree();
+
+ spyOn(vm, 'updateViewer').and.callThrough();
+
+ vm.$mount();
+ });
+
+ it('updates viewer on mount', () => {
+ expect(vm.updateViewer).toHaveBeenCalledWith('edit');
+ });
+
+ it('renders loading indicator', done => {
+ store.state.trees['abcproject/master'].loading = true;
+
+ vm.$nextTick(() => {
+ expect(vm.$el.querySelector('.multi-file-loading-container')).not.toBeNull();
+ expect(vm.$el.querySelectorAll('.multi-file-loading-container').length).toBe(3);
+
+ done();
+ });
+ });
+
+ it('renders list of files', () => {
+ expect(vm.$el.textContent).toContain('fileName');
+ });
+ });
+
+ describe('empty-branch state', () => {
+ beforeEach(() => {
+ bootstrapWithTree(emptyBranchTree);
+
+ spyOn(vm, 'updateViewer').and.callThrough();
+
+ vm.$mount();
+ });
+
+ it('does not load files if the branch is empty', () => {
+ expect(vm.$el.textContent).not.toContain('fileName');
+ expect(vm.$el.textContent).toContain('No files');
+ });
+ });
+});
diff --git a/pool/shard007/JavaScript/0048002_seer.js b/pool/shard007/JavaScript/0048002_seer.js
new file mode 100644
index 0000000000000000000000000000000000000000..6f21ba167a6a96fc3fa2e4c7f6cca93267fabdcc
--- /dev/null
+++ b/pool/shard007/JavaScript/0048002_seer.js
@@ -0,0 +1,80 @@
+function Seer (dataObj) {
+ let signals = {}
+
+ observeData(dataObj)
+
+ return {
+ data: dataObj,
+ observe,
+ notify
+ }
+
+ function observe (property, signalHandler) {
+ if(!signals[property]) signals[property] = []
+
+ signals[property].push(signalHandler)
+ }
+
+ function notify (signal) {
+ if(!signals[signal] || signals[signal].length < 1) return
+
+ signals[signal].forEach((signalHandler) => signalHandler())
+ }
+
+ function makeReactive (obj, key) {
+ let val = obj[key]
+
+ Object.defineProperty(obj, key, {
+ get () {
+ return val
+ },
+ set (newVal) {
+ val = newVal
+ notify(key)
+ }
+ })
+ }
+
+ function observeData (obj) {
+ for (let key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ makeReactive(obj, key)
+ }
+ }
+ // We can safely parse the DOM looking for bindings after we converted the dataObject.
+ parseDOM(document.body, obj)
+ }
+
+ function syncNode (node, observable, property) {
+ node.textContent = observable[property]
+ // We remove the `Seer.` as it is now available for us in our scope.
+ observe(property, () => node.textContent = observable[property])
+ }
+
+ function parseDOM (node, observable) {
+ const nodes = document.querySelectorAll('[s-text]')
+
+ nodes.forEach((node) => {
+ syncNode(node, observable, node.attributes['s-text'].value)
+ })
+ }
+}
+
+const App = Seer({
+ title: 'Game of Thrones',
+ firstName: 'Jon',
+ lastName: 'Snow',
+ age: 25
+})
+
+function updateText (property, e) {
+ App.data[property] = e.target.value
+}
+
+function resetTitle () {
+ App.data.title = "Game of Thrones"
+}
+
+function updateName (event) {
+ App.data.firstName = event.target.value.split("").reverse().join("")
+}
diff --git a/pool/shard007/JavaScript/0048003_afterUpdate.js b/pool/shard007/JavaScript/0048003_afterUpdate.js
new file mode 100644
index 0000000000000000000000000000000000000000..1f321a2cadf43bd5c7609ef5a6e3dccd5baf12d0
--- /dev/null
+++ b/pool/shard007/JavaScript/0048003_afterUpdate.js
@@ -0,0 +1,86 @@
+describe('getForEntities', function() {
+ beforeEach(function() {
+ Configuration.setSchema(new SimpleSchema({
+ foo: {
+ type: String,
+ },
+ 'nested': {
+ type: Object,
+ },
+ 'nested.foo': {
+ type: String,
+ },
+ }));
+
+ spyOn(Meteor, 'userId').and.returnValue('123');
+ });
+
+ it('emits "afterUpdate" after setDefault', function () {
+ let emittedResult;
+
+ Configuration.once('afterUpdate', ({ userId, _id, modifier, result }) => {
+ emittedResult = result;
+ expect(userId).toEqual('123');
+ expect(_id).toEqual('_default');
+ expect(modifier).toEqual({
+ $set: {
+ config: {
+ foo: 'bar',
+ },
+ },
+ });
+ });
+
+ const result = Configuration.setDefault({
+ foo: 'bar',
+ });
+
+ expect(emittedResult).toEqual(result);
+ });
+
+ it('emits "afterUpdate" after setDefaultForPrefix', function () {
+ let emittedResult;
+
+ Configuration.once('afterUpdate', ({ userId, _id, modifier, result }) => {
+ emittedResult = result;
+ expect(userId).toEqual('123');
+ expect(_id).toEqual('_default');
+ expect(modifier).toEqual({
+ $set: {
+ 'config.nested': {
+ foo: 'bar',
+ },
+ },
+ });
+ });
+
+ const result = Configuration.setDefaultForPrefix('nested', {
+ foo: 'bar',
+ });
+
+ expect(emittedResult).toEqual(result);
+ });
+
+ it('emits "afterUpdate" after setForEntity', function () {
+ let emittedResult;
+
+ Configuration.once('afterUpdate', ({ userId, _id, modifier, result }) => {
+ emittedResult = result;
+ expect(userId).toEqual('123');
+ expect(_id).toEqual('user_1');
+ expect(modifier).toEqual({
+ $set: {
+ 'config.foo': 'bar',
+ entityType: 'user',
+ entityId: '1',
+ },
+ });
+ });
+
+ const result = Configuration.setForEntity('user', '1', {
+ foo: 'bar',
+ });
+
+ expect(emittedResult).toEqual(result);
+ });
+});
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048006_items_grid_view.js b/pool/shard007/JavaScript/0048006_items_grid_view.js
new file mode 100644
index 0000000000000000000000000000000000000000..e670345451ea60003bdf9ed02fea62d005b113be
--- /dev/null
+++ b/pool/shard007/JavaScript/0048006_items_grid_view.js
@@ -0,0 +1,27 @@
+define (['jquery', 'underscore', 'backbone', 'hbs!templates/items_grid'],
+function ( $, _, Backbone, Template) {
+
+return Backbone.View.extend({
+
+ initialize:function (options) {
+ _.extend(this, options);
+ _.bindAll(this, "processData");
+
+ this.model.on("load", this.processData);
+ },
+
+ processData:function () {
+ var items = this.model.get("items");
+ var headers = _.without(_.keys(items[0]), "uri", "id");
+ var rows = _.map(items, function (item) {
+ return { "values":_.map(headers, function (header) {
+ return item[header];
+ })};
+ });
+
+ this.$el.html(Template({ "headers":headers, "rows":rows }));
+ }
+});
+
+// end define
+});
diff --git a/pool/shard007/JavaScript/0048007_regress-5986.js b/pool/shard007/JavaScript/0048007_regress-5986.js
new file mode 100644
index 0000000000000000000000000000000000000000..ca157f80261e46bfdba5a6bb3210440af2728775
--- /dev/null
+++ b/pool/shard007/JavaScript/0048007_regress-5986.js
@@ -0,0 +1,29 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+var array = [1.7, 1.7, 1.7];
+var mutator = {
+ [Symbol.toPrimitive]() {
+ Object.defineProperties(array, {
+ 0: { get() { } },
+ 1: { get() { } },
+ 2: { get() { } },
+ });
+ return 0;
+ }
+};
+
+assertTrue(array.includes(undefined, mutator));
+
+function search(array, searchElement, startIndex) {
+ return array.includes(searchElement, startIndex);
+}
+
+array = [1.7, 1.7, 1.7];
+var not_mutator = { [Symbol.toPrimitive]() { return 0; } };
+assertFalse(search(array, undefined, not_mutator));
+assertFalse(search(array, undefined, not_mutator));
+%OptimizeFunctionOnNextCall(search);
+assertTrue(search(array, undefined, mutator));
diff --git a/pool/shard007/JavaScript/0048009_prolific-site.js b/pool/shard007/JavaScript/0048009_prolific-site.js
new file mode 100644
index 0000000000000000000000000000000000000000..5fc1d14eacfaea4f9d0bdf346f9837aa7b2a426d
--- /dev/null
+++ b/pool/shard007/JavaScript/0048009_prolific-site.js
@@ -0,0 +1,34 @@
+var url = require('url');
+var htmlToJson = require('../lib/htmlToJson');
+var homeUrl = url.parse('http://prolificinteractive.com');
+
+var parseLinks = htmlToJson.createParser(['a[href]', {
+ 'text': function ($a) {
+ return $a.text().trim();
+ },
+ 'href': function ($a) {
+ return url.resolve(homeUrl, $a.attr('href'));
+ },
+ 'headings': function () {
+ return this.get('href').then(function (href) {
+ var parsedUrl = url.parse(href);
+
+ // Only bother Prolific's server for this example
+ if (parsedUrl.protocol === 'http:' && parsedUrl.hostname === homeUrl.hostname) {
+ return parseHeadings.request(href);
+ } else {
+ return null;
+ }
+ });
+ }
+}]);
+
+var parseHeadings = htmlToJson.createParser(['h1,h2,h3,h4,h5,h6', function ($hx) {
+ return $hx.text().trim();
+}]);
+
+parseLinks.request(url.format(homeUrl)).done(function (links) {
+ console.log(links);
+}, function (err) {
+ throw err;
+});
diff --git a/pool/shard007/JavaScript/0048012_propsFilter.filter.js b/pool/shard007/JavaScript/0048012_propsFilter.filter.js
new file mode 100644
index 0000000000000000000000000000000000000000..19c3f6dc10a9e98f7428431cb5ed85f5314831f0
--- /dev/null
+++ b/pool/shard007/JavaScript/0048012_propsFilter.filter.js
@@ -0,0 +1,43 @@
+'use strict';
+
+angular
+ .module('ods-lib')
+ .filter('PropsFilter', PropsFilter);
+
+/**
+ * AngularJS default filter with the following expression:
+ * "person in people | filter: {name: $select.search, age: $select.search}"
+ * performs an AND between 'name: $select.search' and 'age: $select.search'.
+ * We want to perform an OR.
+ */
+function PropsFilter() {
+ return function (items, props) {
+ var out = [];
+
+ if (angular.isArray(items)) {
+ var keys = Object.keys(props);
+
+ items.forEach(function (item) {
+ var itemMatches = false;
+
+ for (var i = 0; i < keys.length; i++) {
+ var prop = keys[i];
+ var text = props[prop].toLowerCase();
+ if (item[prop].toString().toLowerCase().indexOf(text) !== -1) {
+ itemMatches = true;
+ break;
+ }
+ }
+
+ if (itemMatches) {
+ out.push(item);
+ }
+ });
+ } else {
+ // Let the output be the input untouched
+ out = items;
+ }
+
+ return out;
+ };
+}
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048015_add_line.js b/pool/shard007/JavaScript/0048015_add_line.js
new file mode 100644
index 0000000000000000000000000000000000000000..3dc014c7281aa9ee03b84c6eeabb38c0ac17ceed
--- /dev/null
+++ b/pool/shard007/JavaScript/0048015_add_line.js
@@ -0,0 +1,63 @@
+iD.modes.AddLine = function(context) {
+ var mode = {
+ id: 'add-line',
+ button: 'line',
+ title: t('modes.add_line.title'),
+ description: t('modes.add_line.description'),
+ key: '2'
+ };
+
+ var behavior = iD.behavior.AddWay(context)
+ .tail(t('modes.add_line.tail'))
+ .on('start', start)
+ .on('startFromWay', startFromWay)
+ .on('startFromNode', startFromNode);
+
+ function start(loc) {
+ var baseGraph = context.graph(),
+ node = iD.Node({loc: loc}),
+ way = iD.Way();
+
+ context.perform(
+ iD.actions.AddEntity(node),
+ iD.actions.AddEntity(way),
+ iD.actions.AddVertex(way.id, node.id));
+
+ context.enter(iD.modes.DrawLine(context, way.id, baseGraph));
+ }
+
+ function startFromWay(loc, edge) {
+ var baseGraph = context.graph(),
+ node = iD.Node({loc: loc}),
+ way = iD.Way();
+
+ context.perform(
+ iD.actions.AddEntity(node),
+ iD.actions.AddEntity(way),
+ iD.actions.AddVertex(way.id, node.id),
+ iD.actions.AddMidpoint({ loc: loc, edge: edge }, node));
+
+ context.enter(iD.modes.DrawLine(context, way.id, baseGraph));
+ }
+
+ function startFromNode(node) {
+ var baseGraph = context.graph(),
+ way = iD.Way();
+
+ context.perform(
+ iD.actions.AddEntity(way),
+ iD.actions.AddVertex(way.id, node.id));
+
+ context.enter(iD.modes.DrawLine(context, way.id, baseGraph));
+ }
+
+ mode.enter = function() {
+ context.install(behavior);
+ };
+
+ mode.exit = function() {
+ context.uninstall(behavior);
+ };
+
+ return mode;
+};
diff --git a/pool/shard007/JavaScript/0048017_app.js b/pool/shard007/JavaScript/0048017_app.js
new file mode 100644
index 0000000000000000000000000000000000000000..3081c403e372527b8f28393a30d51d76461eba0f
--- /dev/null
+++ b/pool/shard007/JavaScript/0048017_app.js
@@ -0,0 +1,110 @@
+define([
+ "jquery",
+ "base1/cockpit",
+ "base1/angular",
+ "kubernetes/client"
+], function($, cockpit, angular, kubernetes) {
+ 'use strict';
+
+ return angular.module('kubernetes', [
+ 'ngRoute',
+ 'ui.bootstrap',
+ 'kubernetes.dashboard',
+ 'kubernetes.graph',
+ 'kubernetes.details',
+ 'kubernetes.topology',
+ 'kubernetes.listing'
+ ])
+ .config(['$routeProvider', function($routeProvider) {
+ $routeProvider.otherwise({ redirectTo: '/' });
+ }])
+
+ .controller('MainCtrl', [
+ '$scope',
+ '$route',
+ '$routeParams',
+ '$location',
+ 'kubernetesClient',
+ function($scope, $route, $routeParams, $location, client) {
+ $scope.$route = $route;
+ $scope.$location = $location;
+ $scope.$routeParams = $routeParams;
+
+ /* Used to set detect which route is active */
+ $scope.is_active = function is_active(template) {
+ var current = $scope.$route.current;
+ return current && current.loadedTemplateUrl === template;
+ };
+
+ /* Used by child scopes */
+ $scope.client = client;
+
+ /* When set then we hide the application */
+ $scope.curtains = { state: 'silent' };
+
+ var timeout = window.setTimeout(function() {
+ $scope.curtains = { state: 'connecting' };
+ $scope.$digest();
+ timeout = null;
+ }, 1000);
+
+ function handle(promise) {
+ promise
+ .always(function() {
+ window.clearTimeout(timeout);
+ timeout = null;
+ })
+ .done(function() {
+ $scope.curtains = null;
+ $scope.$digest();
+ })
+ .fail(function(ex) {
+ $scope.curtains = { state: 'failed', failure: ex };
+ $scope.$digest();
+ });
+ }
+
+ handle(client.connect());
+
+ $scope.reconnect = function reconnect() {
+ $scope.curtains = { state: 'connecting' };
+ handle(client.connect(true));
+ };
+ }])
+
+ /* Override the default angularjs exception handler */
+ .factory('$exceptionHandler', ['$log', function($log) {
+ return function(exception, cause) {
+
+ /* Displays an oops if we're running in cockpit */
+ cockpit.oops();
+
+ /* And log with the default implementation */
+ $log.error.apply($log, arguments);
+ };
+ }])
+
+ /* The default orderBy filter doesn't work on objects */
+ .filter('orderObjectBy', function() {
+ return function(items, field, reverse) {
+ var i, sorted = [];
+ for (i in items)
+ sorted.push(items[i]);
+ function value(obj, i) { return obj[i]; }
+ sorted.sort(function (a, b) {
+ var ra = field.split('.').reduce(value, a);
+ var rb = field.split('.').reduce(value, b);
+ if (ra === rb)
+ return 0;
+ return (ra > rb ? 1 : -1);
+ });
+ if (reverse)
+ sorted.reverse();
+ return sorted;
+ };
+ })
+
+ .factory('kubernetesClient', function() {
+ return kubernetes.k8client();
+ });
+});
diff --git a/pool/shard007/JavaScript/0048018_automation.js b/pool/shard007/JavaScript/0048018_automation.js
new file mode 100644
index 0000000000000000000000000000000000000000..d0dab310aa81c26448b7b33a2c930df3df044030
--- /dev/null
+++ b/pool/shard007/JavaScript/0048018_automation.js
@@ -0,0 +1,84 @@
+/**!
+ *
+ * Copyright (c) 2015-2016 Cisco Systems, Inc. See LICENSE file.
+ */
+
+'use strict';
+
+var browsers = require('../../../browsers');
+var chai = require('chai');
+var chaiAsPromised = require('chai-as-promised');
+var defaults = require('lodash.defaults');
+var fs = require('fs');
+var landingparty = require('../../integration/lib/landingparty');
+var path = require('path');
+var pkg = require('../../../package');
+var wd = require('wd');
+
+chai.use(chaiAsPromised);
+chai.should();
+chaiAsPromised.transferPromiseness = wd.transferPromiseness;
+
+requireDir(path.join(__dirname, 'wd'));
+
+function requireDir(basePath) {
+ fs
+ .readdirSync(basePath)
+ .forEach(function(filename) {
+ var filePath = path.join(basePath, filename);
+ if (fs.statSync(filePath).isDirectory()) {
+ requireDir(filePath);
+ }
+ else {
+ require(filePath);
+ }
+ });
+}
+
+after(function deleteTestUsers() {
+ this.timeout(20000);
+ return landingparty.beamUp();
+});
+
+var automation = {
+ createBrowser: function(browserDef) {
+ if (!browserDef) {
+ var envBrowsers = browsers[process.env.BROWSER_ENVIRONMENT];
+ if (process.env.BROWSER) {
+ browserDef = envBrowsers[process.env.BROWSER];
+ if (!browserDef) {
+ throw new Error('No browser definition for "' + process.env.BROWSER_ENVIRONMENT + '":"' + process.env.BROWSER + '"');
+ }
+ }
+ else {
+ browserDef = envBrowsers[Object.keys(envBrowsers)[0]];
+ }
+ }
+
+ defaults(browserDef, {
+ build: process.env.BUILD_NUMBER || ('local-' + process.env.USER + '-' + Date.now()),
+ name: pkg.name,
+ public: 'team',
+ tunnelIdentifier: process.env.SC_TUNNEL_IDENTIFIER
+ });
+
+ var browser;
+ switch (process.env.BROWSER_ENVIRONMENT) {
+ case 'local':
+ browser = wd.promiseChainRemote();
+ break;
+ case 'sauce':
+ browser = wd.promiseChainRemote('ondemand.saucelabs.com', 80);
+ break;
+ }
+
+ return browser.init(browserDef)
+ .setImplicitWaitTimeout(10000)
+ .then(function() {
+ return browser;
+ });
+ }
+
+};
+
+module.exports = automation;
diff --git a/pool/shard007/JavaScript/0048021_eventos.server.controller.js b/pool/shard007/JavaScript/0048021_eventos.server.controller.js
new file mode 100644
index 0000000000000000000000000000000000000000..5ac792fc9fe43ef4c53cf5e494a9ba4804086879
--- /dev/null
+++ b/pool/shard007/JavaScript/0048021_eventos.server.controller.js
@@ -0,0 +1,117 @@
+'use strict';
+
+/**
+ * Module dependencies.
+ */
+var mongoose = require('mongoose'),
+ errorHandler = require('./errors.server.controller'),
+ Evento = mongoose.model('Evento'),
+ _ = require('lodash');
+
+/**
+ * Create a Evento
+ */
+exports.create = function(req, res) {
+ var evento = new Evento(req.body);
+ evento.user = req.user;
+
+ evento.save(function(err) {
+ if (err) {
+ return res.status(400).send({
+ message: errorHandler.getErrorMessage(err)
+ });
+ } else {
+ res.jsonp(evento);
+ }
+ });
+};
+
+/**
+ * Show the current Evento
+ */
+exports.read = function(req, res) {
+ res.jsonp(req.evento);
+};
+
+/**
+ * Update a Evento
+ */
+exports.update = function(req, res) {
+ var evento = req.evento ;
+
+ evento = _.extend(evento , req.body);
+
+ evento.save(function(err) {
+ if (err) {
+ return res.status(400).send({
+ message: errorHandler.getErrorMessage(err)
+ });
+ } else {
+ res.jsonp(evento);
+ }
+ });
+};
+
+/**
+ * Delete an Evento
+ */
+exports.delete = function(req, res) {
+ var evento = req.evento ;
+ evento.state=['INACTIVO'];
+ evento.save(function(err) {
+ if (err) {
+ return res.status(400).send({
+ message: errorHandler.getErrorMessage(err)
+ });
+ } else {
+ res.jsonp(evento);
+ }
+ });
+//
+// evento.remove(function(err) {
+// if (err) {
+// return res.status(400).send({
+// message: errorHandler.getErrorMessage(err)
+// });
+// } else {
+// res.jsonp(evento);
+// }
+// });
+};
+
+/**
+ * List of Eventos
+ */
+exports.list = function(req, res) {
+ Evento.find().where('state').in(['ACTIVO']).sort('-created').populate('user', 'displayName').exec(function(err, eventos) {
+ if (err) {
+ return res.status(400).send({
+ message: errorHandler.getErrorMessage(err)
+ });
+ } else {
+ res.jsonp(eventos);
+ }
+ });
+};
+
+/**
+ * Evento middleware
+ */
+exports.eventoByID = function(req, res, next, id) {
+ Evento.findById(id).populate('user', 'displayName').exec(function(err, evento) {
+ if (err) return next(err);
+ if (! evento) return next(new Error('Failed to load Evento ' + id));
+ req.evento = evento ;
+ next();
+ });
+};
+
+/**
+ * Evento authorization middleware
+ */
+exports.hasAuthorization = function(req, res, next) {
+// if (req.evento.user.id !== req.user.id) {
+// return res.status(403).send('User is not authorized');
+// }
+ next();
+};
diff --git a/pool/shard007/JavaScript/0048028_localforage.js b/pool/shard007/JavaScript/0048028_localforage.js
new file mode 100644
index 0000000000000000000000000000000000000000..bccaea54cc7d542c777bad8abf9149e181b8a234
--- /dev/null
+++ b/pool/shard007/JavaScript/0048028_localforage.js
@@ -0,0 +1,93 @@
+import Ember from 'ember';
+import DS from 'ember-data';
+
+export default DS.JSONSerializer.extend({
+
+ serializeHasMany: function(snapshot, json, relationship) {
+ var store = this.container.lookup('service:store');
+ var key = relationship.key,
+ relationshipType = snapshot.type.determineRelationshipType(relationship, store);
+
+ if (relationshipType === 'manyToNone' ||
+ relationshipType === 'manyToMany' ||
+ relationshipType === 'manyToOne') {
+ json[key] = Ember.A(snapshot.hasMany(key)).mapBy('id');
+ // TODO support for polymorphic manyToNone and manyToMany relationships
+ }
+ },
+
+ /**
+ * Extracts whatever was returned from the adapter.
+ *
+ * If the adapter returns relationships in an embedded way, such as follows:
+ *
+ * ```js
+ * {
+ * "id": 1,
+ * "title": "Rails Rambo",
+ *
+ * "_embedded": {
+ * "comment": [{
+ * "id": 1,
+ * "comment_title": "FIRST"
+ * }, {
+ * "id": 2,
+ * "comment_title": "Rails is unagi"
+ * }]
+ * }
+ * }
+ *
+ * this method will create separated JSON for each resource and then push
+ * them individually to the Store.
+ *
+ * In the end, only the main resource will remain, containing the ids of its
+ * relationships. Given the relations are already in the Store, we will
+ * return a JSON with the main resource alone. The Store will sort out the
+ * associations by itself.
+ *
+ * @method extractSingle
+ * @private
+ * @param {DS.Store} store the returned store
+ * @param {DS.Model} type the type/model
+ * @param {Object} payload returned JSON
+ */
+ extractSingle: function(store, type, payload) {
+ if (payload && payload._embedded) {
+ for (var relation in payload._embedded) {
+ var relType = type.typeForRelationship(relation, store);
+ var typeName = relType.typeKey,
+ embeddedPayload = payload._embedded[relation];
+
+ if (embeddedPayload) {
+ if (Ember.isArray(embeddedPayload)) {
+ store.pushMany(typeName, embeddedPayload);
+ } else {
+ store.push(typeName, embeddedPayload);
+ }
+ }
+ }
+
+ delete payload._embedded;
+ }
+
+ return this.normalize(type, payload);
+ },
+
+ /**
+ * This is exactly the same as extractSingle, but used in an array.
+ *
+ * @method extractSingle
+ * @private
+ * @param {DS.Store} store the returned store
+ * @param {DS.Model} type the type/model
+ * @param {Array} payload returned JSONs
+ */
+ extractArray: function(store, type, payload) {
+ var serializer = this;
+
+ return payload.map(function(record) {
+ return serializer.extractSingle(store, type, record);
+ });
+ }
+
+});
diff --git a/pool/shard007/JavaScript/0048029_clear.js b/pool/shard007/JavaScript/0048029_clear.js
new file mode 100644
index 0000000000000000000000000000000000000000..4c91fc692ed1b88cbbfeb3eaa3ce738224c2828d
--- /dev/null
+++ b/pool/shard007/JavaScript/0048029_clear.js
@@ -0,0 +1,27 @@
+'use strict'
+
+const cli = require('heroku-cli-util')
+const co = require('co')
+
+function * run (context, heroku) {
+ const bluebird = require('bluebird')
+ yield cli.action(`Removing all domains from ${cli.color.app(context.app)}`, co(function * () {
+ let domains = yield heroku.request({path: `/apps/${context.app}/domains`})
+ domains = domains.filter((d) => d.kind === 'custom')
+ if (domains.length === 0) return
+ yield bluebird.map(
+ domains,
+ (domain) => heroku.request({path: `/apps/${context.app}/domains/${domain.hostname}`, method: 'DELETE'}),
+ {concurrency: 5}
+ )
+ }))
+}
+
+module.exports = {
+ topic: 'domains',
+ command: 'clear',
+ description: 'remove all domains from an app',
+ needsApp: true,
+ needsAuth: true,
+ run: cli.command(co.wrap(run))
+}
diff --git a/pool/shard007/JavaScript/0048030_safe-browsing.js b/pool/shard007/JavaScript/0048030_safe-browsing.js
new file mode 100644
index 0000000000000000000000000000000000000000..6efb81f49820eacd8e344ce955cbf9e144d1ec78
--- /dev/null
+++ b/pool/shard007/JavaScript/0048030_safe-browsing.js
@@ -0,0 +1,54 @@
+/*!
+ * ShortUrl
+ * Copyright(c) 2015 Andrew Shapro
+ * MIT Licensed
+ */
+
+import https from 'https';
+import Promise from 'bluebird';
+import validator from 'validator';
+
+/**
+ * Safe Browsing Client
+ */
+class SafeBrowsingClient {
+ constructor() {
+ const apiKey = process.env.SB_KEY || '';
+ this.sbUrl = `https://sb-ssl.google.com/safebrowsing/api/lookup?client=short-url&key=${apiKey}&appver=1.5.2&pver=3.1&url=`;
+ }
+
+ checkUrl(url) {
+ if (!validator.isURL(url)) {
+ // not a valid url
+ return Promise.resolve(false);
+ }
+
+ const requestUrl = this.sbUrl + url;
+ return new Promise((resolve, reject) => {
+ https.get(requestUrl, (response) => {
+ let result = '';
+
+ response.on('data', (chunk) => {
+ result += chunk;
+ });
+
+ response.on('end', () => {
+ if (response.statusCode === 204) {
+ // safe
+ resolve(true);
+ } else if (response.statusCode === 200) {
+ // not safe
+ resolve(false);
+ } else {
+ // error
+ reject(new Error(result));
+ }
+ });
+ }).on('error', (error) => {
+ reject(new Error(error));
+ });
+ });
+ }
+}
+
+export default SafeBrowsingClient;
diff --git a/pool/shard007/JavaScript/0048033_loadingScreen.test.js b/pool/shard007/JavaScript/0048033_loadingScreen.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..fee1857701e4a4fb4fb053645a1d6d865f85e628
--- /dev/null
+++ b/pool/shard007/JavaScript/0048033_loadingScreen.test.js
@@ -0,0 +1,44 @@
+/* global assert, process, setup, suite, teardown, test */
+var AScene = require('core/scene/a-scene').AScene;
+var helpers = require('../helpers');
+
+helpers.getSkipCISuite()('loadingScreen', function () {
+ suite('setup', function () {
+ setup(function () {
+ AScene.prototype.setupRenderer.restore();
+ });
+
+ test('adds title element', function (done) {
+ var el = this.el = document.createElement('a-scene');
+ document.body.appendChild(el);
+ el.addEventListener('loaded', function () {
+ assert.ok(el.querySelector('.a-loader-title'));
+ done();
+ });
+ });
+
+ test('does not add title element if loadingScreen is disabled', function (done) {
+ var el = this.el = document.createElement('a-scene');
+ el.setAttribute('loading-screen', 'enabled: false');
+ document.body.appendChild(el);
+ el.addEventListener('loaded', function () {
+ assert.notOk(el.querySelector('.a-loader-title'));
+ done();
+ });
+ });
+
+ test('adds title element if enabled is true', function (done) {
+ var el = this.el = document.createElement('a-scene');
+ el.setAttribute('loading-screen', 'enabled: true');
+ document.body.appendChild(el);
+ el.addEventListener('loaded', function () {
+ assert.ok(el.querySelector('.a-loader-title'));
+ done();
+ });
+ });
+
+ teardown(function () {
+ document.body.removeChild(this.el);
+ });
+ });
+});
diff --git a/pool/shard007/JavaScript/0048041_mow.js b/pool/shard007/JavaScript/0048041_mow.js
new file mode 100644
index 0000000000000000000000000000000000000000..b7f07916cd54ee244bd56eca10fa120080740e30
--- /dev/null
+++ b/pool/shard007/JavaScript/0048041_mow.js
@@ -0,0 +1,177 @@
+/**
+ * Generated from the Phaser Sandbox
+ *
+ * http://phaser.io/sandbox/GFbzrkoX
+ *
+ * This source requires Phaser 2.4.4
+ */
+
+var player;
+var grass;
+var cursors;
+var obstacle;
+var startButton;
+
+var game = new Phaser.Game(800, 600, Phaser.AUTO, '',
+ { preload: preload, create: create, update: update, render: render });
+
+function preload() {
+
+ game.add.text(2, 580, 'grass.d33z.com v0.1', { font: "15px Arial", fill: "#19de65" });
+ game.stage.backgroundColor = '#00cc66';
+
+ var mower = ['0000000000',
+ '..0....0..',
+ '0000000000',
+ '.30333303.',
+ '.30333303.',
+ '3303333033',
+ '3303333033',
+ '3303333033',
+ '.30333303.',
+ '.30333303.',
+ '..033330..',
+ '..0....0..',
+ '110....011',
+ '1100000011',
+ '11......11',
+ '11......11',
+ '..........',
+ '..........',
+ '..........',
+ '..........',
+ '..........',
+ '..........',
+ '..........',
+ '..........',
+ '..........',
+ '..........',
+ '..........'];
+ game.create.texture('player', mower, 6, 6);
+
+ var grass = ['.A', 'AA'];
+ game.create.texture('grass', grass, 6, 6);
+
+ var startTexture = ['.000000000000000000000.',
+ '0.....................0',
+ '0.111.111.111.111.111.0',
+ '0.1....1..1.1.1.1..1..0',
+ '0.111..1..111.11...1..0',
+ '0...1..1..1.1.1.1..1..0',
+ '0.111..1..1.1.1.1..1..0',
+ '0.....................0',
+ '.000000000000000000000.'];
+ game.create.texture('startTexture', startTexture, 6, 6);
+}
+
+
+function create()
+{
+
+ // TODO: http://phaser.io/examples/v2/p2-physics/world-boundary
+
+ game.physics.startSystem(Phaser.Physics.P2JS);
+ //game.physics.p2.restitution = 0.9;
+
+ grass = game.add.group();
+ for (var i = 0; i < 100; i++)
+ {
+ var newgrass = grass.create(Math.random() * 800, Math.random() * 600, 'grass');
+ game.physics.p2.enable(newgrass);
+ newgrass.body.kinematic = true;
+ newgrass.body.mass = 0.1;
+ }
+
+ player = game.add.sprite(100, 200, 'player');
+ //player.anchor.setTo(0, 1);
+ game.physics.p2.enable(player);
+ player.body.setCircle(20, 0, -40);
+ player.body.onBeginContact.add(playerHit, this);
+ player.body.mass = 1;
+
+ // TODO: map loader?
+
+ startButton = game.add.button(game.world.centerX - 95, 300, 'startTexture', startClicked, this, 2, 1, 0);
+
+ // get keyboard input
+ cursors = game.input.keyboard.createCursorKeys();
+
+}
+
+function startClicked ()
+{
+ startButton.visible = false;
+}
+
+
+function playerHit (body, bodyB, shapeA, shapeB, equation)
+{
+ if (body != null && body.sprite.key === "grass")
+ body.sprite.kill();
+ // score = 1000 / seconds
+}
+
+
+function update ()
+{
+
+ if (cursors.left.isDown)
+ {
+ player.body.rotateLeft(100);
+ }
+ else if (cursors.right.isDown)
+ {
+ player.body.rotateRight(100);
+ }
+ else
+ {
+ player.body.setZeroRotation();
+ }
+
+ if (cursors.up.isDown)
+ {
+ player.body.thrust(400);
+ }
+ else if (cursors.down.isDown)
+ {
+ player.body.reverse(400);
+ }
+ //else player.body.setZeroVelocity();
+
+ stopSidewaysVelocity(player);
+
+}
+
+
+/**
+ * Negate sideways velocity on an object being acted upon by a Phaser physics engine.
+ * The primary use for this is to simulate vehicle movement by negating "drift" when the vehicle turns.
+ * @param {Phaser.Sprite} sprite The sprite whose sideways velocity you want to negate
+ */
+function stopSidewaysVelocity(sprite) {
+ // Recycle the same object to conserve memory
+ if(!stopSidewaysVelocity.sideways) {
+ stopSidewaysVelocity.sideways = {};
+ }
+
+ var body = sprite.body;
+ var velocity = body.velocity;
+ var rotation = body.rotation + Math.PI / 2;
+ var sideways = stopSidewaysVelocity.sideways;
+
+ sideways.x = Math.cos(rotation);
+ sideways.y = Math.sin(rotation);
+
+ var dot_product = velocity.x * sideways.x + velocity.y * sideways.y;
+
+ velocity.x = sideways.x * dot_product;
+ velocity.y = sideways.y * dot_product;
+}
+
+
+function render () {
+ game.debug.body(player, 32, 32);
+ game.add.text(2, 0, '0,000,000', { font: "24px Arial", fill: "#FFFFFF" });
+ game.add.text(680, 0, '00:00', { font: "15px Arial", fill: "#FFFFFF" });
+
+}
diff --git a/pool/shard007/JavaScript/0048043_roleAdd.js b/pool/shard007/JavaScript/0048043_roleAdd.js
new file mode 100644
index 0000000000000000000000000000000000000000..9534b3d13c5516ddfd1997be971a26b70e34b0bf
--- /dev/null
+++ b/pool/shard007/JavaScript/0048043_roleAdd.js
@@ -0,0 +1,121 @@
+
+
+import React, { Component } from 'react'
+import { Button, Form, Input, /* Modal, */ Select, message } from 'antd'
+import { regExpConfig } from '@reg'
+import Drawer from '@components/draw/draw'
+import {
+ fetchRoleAdd,
+ fetchRoleUpdate,
+} from '@apis/manage'
+
+const FormItem = Form.Item
+const { Option } = Select
+
+
+@Form.create({})
+
+export default class Index extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+ loading: false,
+ }
+ this.handleSubmit = this.handleSubmit.bind(this)
+ }
+
+ componentDidMount() {
+ this.props.form.resetFields()
+ this.props.form.setFieldsValue({
+ roleName: this.props.value.roleName,
+ sort: `${this.props.value.sort}`,
+ tjFlag: this.props.value.tjFlag !== undefined ? String(this.props.value.tjFlag) : '1',
+ })
+ }
+
+ handleSubmit(e) {
+ e.preventDefault();
+ this.props.form.validateFields((errors, values) => {
+ if (errors) {
+ return;
+ }
+ this.setState({ loading: true })
+ if (this.props.type === 'modify') {
+ fetchRoleUpdate({ ...values, id: this.props.modifyId }, (res) => {
+ message.success(res.msg)
+ this.props.handleOk(false)
+ })
+ } else {
+ fetchRoleAdd(values, (res) => {
+ message.success(res.msg)
+ this.props.handleOk(false)
+ })
+ }
+ this.setState({ loading: false })
+ });
+ }
+
+ footer() {
+ const { loading } = this.state
+ return (
+
+ + 支付说明:由于货到付款,顺丰快递要加收5%的服务费用,所以,如果选择货到付款购买我们产品,没有相关优惠。本公司已与支付宝签订战略协议,选择支付宝付款,可享受8折优惠。如需其他支付方式(网银支付/转账汇款/微信支付等)可以我们在线客服,索取转款账号。谢谢! +
+
Create an Account
+ + Already have an account? Log in » + +' + + mw.message( 'largefileserver', file.size, maxSize ).escaped() + '
' ); + $( '#wpUploadFile' ).after( error ); + return false; + } + return true; + } + + + /** + * Initialization + */ + if ( hasFileAPI() ) { + // Update thumbnail when the file selection control is updated. + $( '#wpUploadFile' ).change( function() { + clearPreview(); + if ( this.files && this.files.length ) { + // Note: would need to be updated to handle multiple files. + var file = this.files[0]; + + if ( !checkMaxUploadSize( file ) ) { + return; + } + + if ( fileIsPreviewable( file ) ) { + showPreview( file ); + } + } + } ); + } +} ); + +/** + * Disable all upload source fields except the selected one + */ +jQuery( function ( $ ) { + var rows = $( '.mw-htmlform-field-UploadSourceField' ); + for ( var i = rows.length; i; i-- ) { + var row = rows[i - 1]; + $( 'input[name="wpSourceType"]', row ).change( function () { + var currentRow = row; // Store current row in our own scope + return function () { + $( '.mw-upload-source-error' ).remove(); + if ( this.checked ) { + // Disable all inputs + $( 'input[name!="wpSourceType"]', rows ).attr( 'disabled', true ); + // Re-enable the current one + $( 'input', currentRow ).attr( 'disabled', false ); + } + }; + }() ); + } +} ); + diff --git a/pool/shard007/JavaScript/0048253_EventEndingRow.js b/pool/shard007/JavaScript/0048253_EventEndingRow.js new file mode 100644 index 0000000000000000000000000000000000000000..32407e60f9aa414a80aaac8fc3f25e417634efe9 --- /dev/null +++ b/pool/shard007/JavaScript/0048253_EventEndingRow.js @@ -0,0 +1,107 @@ +import PropTypes from 'prop-types'; +import React from 'react'; +import createReactClass from 'create-react-class'; +import EventRowMixin from './EventRowMixin'; +import { eventLevels } from './utils/eventLevels'; +import message from './utils/messages'; +import range from 'lodash/range'; + +let isSegmentInSlot = (seg, slot) => seg.left <= slot && seg.right >= slot; +let eventsInSlot = (segments, slot) => segments.filter(seg => isSegmentInSlot(seg, slot)).length + +let EventRow = createReactClass({ + + displayName: 'EventRow', + + propTypes: { + segments: PropTypes.array, + slots: PropTypes.number, + messages: PropTypes.object, + onShowMore: PropTypes.func, + }, + + mixins: [ EventRowMixin ], + + render(){ + let { segments, slots: slotCount } = this.props; + let rowSegments = eventLevels(segments).levels[0]; + + let current = 1 + , lastEnd = 1 + , row = []; + + while (current <= slotCount){ + let key = '_lvl_' + current; + + let { event, left, right, span } = rowSegments + .filter(seg => isSegmentInSlot(seg, current))[0] || {} //eslint-disable-line + + if (!event) { + current++ + continue; + } + + let gap = Math.max(0, left - lastEnd); + + if (this.canRenderSlotEvent(left, span)) { + let content = this.renderEvent(event) + + if (gap) + row.push(this.renderSpan(gap, key + '_gap')) + + row.push( + this.renderSpan(span, key, content) + ) + + lastEnd = current = (right + 1); + } + else { + if (gap) + row.push(this.renderSpan(gap, key + '_gap')) + + row.push(this.renderSpan(1, key, this.renderShowMore(segments, current))) + lastEnd = current = current + 1 + } + } + + return ( +Hello world!/)); + assert.ok(md.match(/
now a code block/));
+ assert.ok(md.match(/- list item/));
+ assert.ok(md.match(/
- another one/));
+ });
+
+});
+
diff --git a/pool/shard007/JavaScript/0048267_breadcrumb.controller.js b/pool/shard007/JavaScript/0048267_breadcrumb.controller.js
new file mode 100644
index 0000000000000000000000000000000000000000..a8ad719bd3c246a11e5144baeeba6cf7f2ac5d08
--- /dev/null
+++ b/pool/shard007/JavaScript/0048267_breadcrumb.controller.js
@@ -0,0 +1,43 @@
+'use strict';
+
+angular.module('w3uiFrontendApp')
+
+/**
+ * And of course we define a controller for our route.
+ */
+ .controller('BreadcrumbCtrl', function ($scope, $rootScope) {
+
+ /**
+ * Defines the startpage
+ *
+ * @type {string}
+ */
+ $scope.breadcrumbTitle = 'Home';
+ $scope.breadcrumbIcon = 'home';
+ $scope.breadcrumbSubTitle = 'Dashboard';
+ $scope.breadcrumbStateUrl = 'home';
+
+ /**
+ * Search value watch
+ */
+ $scope.$watch('searchValue', function() {
+ $rootScope.searchValue = this.last;
+ }); // initialize the watch
+
+ /**
+ * Updates the breadcrumb when state is going to change
+ */
+ $rootScope.$on('$stateChangeStart', function(event, next, params, last) {
+ $scope.breadcrumbTitle = next.data.title;
+ $scope.breadcrumbIcon = next.data.icon;
+ $scope.breadcrumbSubTitle = next.data.subtitle;
+
+ if(next.data.parent !== undefined){
+ $scope.breadcrumbStateUrl = last.url;
+ }else{
+ $scope.breadcrumbStateUrl = next.url;
+ }
+ });
+
+
+ });
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048270_sketch.js b/pool/shard007/JavaScript/0048270_sketch.js
new file mode 100644
index 0000000000000000000000000000000000000000..d4bb531b93a727f444b61328197b6c66f029e415
--- /dev/null
+++ b/pool/shard007/JavaScript/0048270_sketch.js
@@ -0,0 +1,186 @@
+const SPACEBAR = 32
+
+
+var loops, maxLoop, width, height, baseSize
+var snakeDrawer, startX, startY, startXSpeed, startYSpeed, baseSpeed
+var foodDrawer, foodSize, eaten
+
+function setup() {
+ started = true
+ paused = false
+ loops = 0
+ maxLoop = 1000
+ width = 300
+ height = 450
+ baseSize = 10
+
+ // Snake
+ startX = 10
+ startY = 10
+ startXSpeed = 1
+ startYSpeed = 0
+ baseSpeed = 10
+
+ snakeDrawer = new SnakeDrawer(new Snake(startX, startY, startXSpeed, startYSpeed, baseSpeed), baseSize)
+ snakeDrawer.restrict(0, width - 1.2*baseSize, 0, height - 1.2*baseSize)
+
+ // Food
+ eaten = 0
+ foodSize = 10
+ foodDrawer = new FoodDrawer(new Food(), foodSize, 0, width - 1.2*baseSize, 0, height - 1.2*baseSize)
+
+ createCanvas(width,height)
+
+
+ container = new Container([snakeDrawer, foodDrawer])
+ container.setup()
+ showMessage('START!')
+}
+
+function draw() {
+ background(25)
+ noFill()
+ stroke(255)
+ strokeWeight(20)
+ color(255)
+ rect(0, 0, width, height)
+ noStroke()
+ frameRate(10)
+ container.draw()
+ checkColisions(container.colisions(baseSize))
+ if (snakeDrawer.crashed()) {
+ pause()
+ showMessage('GAME OVER! FINAL SCORE:', eaten)
+ started = false
+ }
+}
+function checkColisions(colisions) {
+ colisions = container.colisions(baseSize)
+ for(let i = 0; i < colisions.length; i++) {
+ colision = colisions[i]
+ snakeHeadFound = SnakeHead.find(colision.objects)
+ foodFound = Food.find(colision.objects)
+ if(snakeHeadFound) {
+ snakeFound = snakeHeadFound.getParent()
+ if(foodFound) {
+ foodFound.restart(
+ random(baseSize, width - 1.2*baseSize),
+ random(baseSize, height - 1.2*baseSize)
+ )
+ snakeFound.increase()
+ eaten++
+ showMessage('SCORE: ', eaten)
+ break
+ } else {
+ snakeFound.crash()
+ break
+ }
+ }
+ }
+}
+
+function keyPressed() {
+ switch(keyCode) {
+ case LEFT_ARROW:
+ turnLeft(snakeDrawer)
+ break
+ case RIGHT_ARROW:
+ turnRight(snakeDrawer)
+ break
+ case UP_ARROW:
+ turnUp(snakeDrawer)
+ break
+ case DOWN_ARROW:
+ turnDown(snakeDrawer)
+ break
+ case ENTER:
+ restart()
+ break
+ case SPACEBAR:
+ pause()
+ break
+ }
+}
+
+function mousePressed() {
+ if (topScreen(mouseX, mouseY)) {
+ turnUp(snakeDrawer)
+ } else if (bottomScreen(mouseX, mouseY)) {
+ turnDown(snakeDrawer)
+ } else if(leftScreen(mouseX, mouseY)) {
+ turnLeft(snakeDrawer)
+ } else if (rightScreen(mouseX, mouseY)) {
+ turnRight(snakeDrawer)
+ }
+}
+
+function topScreen(x, y) {
+ return y > 0 && y <= height/4
+}
+
+function bottomScreen(x, y) {
+ return y >= 3*height/4 && y <= height
+}
+
+function leftScreen(x, y) {
+ return y > height/4 && y < 3*height/4 && x > 0 && x < width/2
+}
+
+function rightScreen(x, y) {
+ return y > height/4 && y < 3*height/4 && x > width/2 && x < width
+}
+
+function turnLeft(snakeDrawer) {
+ if(snakeDrawer.getXSpeed() === 0)
+ snakeDrawer.dir(-1, 0)
+}
+
+function turnRight(snakeDrawer) {
+ if(snakeDrawer.getXSpeed() === 0)
+ snakeDrawer.dir(1, 0)
+}
+
+function turnUp(snakeDrawer) {
+ if(snakeDrawer.getYSpeed() === 0)
+ snakeDrawer.dir(0, -1)
+}
+
+function turnDown(snakeDrawer) {
+ if(snakeDrawer.getYSpeed() === 0)
+ snakeDrawer.dir(0, 1)
+}
+
+function pause() {
+ if (started) {
+ paused = !paused
+
+ if(paused) {
+ noLoop()
+ showMessage('PAUSED!')
+ } else {
+ loop()
+ showMessage('GO!')
+ }
+ }
+}
+
+function restart () {
+ showMessage('START!')
+ eaten = 0
+ started = true
+ paused = true
+ for(let object of container.objects) {
+ object.restart()
+ }
+ pause()
+}
+
+function showMessage () {
+ let message = ''
+ for (let i = 0; i < arguments.length; i++) {
+ message += arguments[i] + ' '
+ }
+ let span = document.getElementById('msg');
+ span.innerHTML = message
+ console.log(message)
+}
diff --git a/pool/shard007/JavaScript/0048272_test.report.js b/pool/shard007/JavaScript/0048272_test.report.js
new file mode 100644
index 0000000000000000000000000000000000000000..52ed1890632c66671d136d7ba3e5bbcb8921aea7
--- /dev/null
+++ b/pool/shard007/JavaScript/0048272_test.report.js
@@ -0,0 +1,65 @@
+var assert = require('assert');
+var report_class = require('./../src/report.js');
+var report = new report_class.Report();
+
+suite('report.js', function() {
+ suite('format', function() {
+ test('getFormat() return the report format.', function() {
+ assert.equal( 'json', report.getFormat() );
+ });
+
+ test('setFormat("json") set the report format to json.', function() {
+ assert.equal( true, report.setFormat('json') );
+ });
+
+ test('setFormat("txt") set the report format to txt.', function() {
+ assert.equal( true, report.setFormat('txt') );
+ });
+
+ test('setFormat("foo") set the report format to an incorrect format.', function() {
+ assert.equal( false, report.setFormat('foo') );
+ });
+ });
+
+ suite('filepath', function() {
+ test('getFilepath() return the report filepath.', function() {
+ assert.equal( 'report', report.getFilepath() );
+ });
+
+ test('setFilepath("./testreport") set the report filepath.', function() {
+ report.setFilepath('testreport');
+ assert.equal( 'testreport', report.getFilepath() );
+ });
+ });
+
+ // Report test data
+ var testData = {
+ time: Date(),
+ command_options: 'foo',
+ cinema4d_stdout: 'bar',
+ cinema4d_stderr: 'baz',
+ code: '0'
+ };
+
+ suite('write', function() {
+ test('write(testData) write a json report file', function() {
+ report.setFilepath('test/report');
+ report.setFormat('json');
+ assert.equal( 'json', report.write(testData) );
+ });
+
+ test('write(testData, true) write a txt report file silent', function() {
+ report.setFilepath('test/report');
+ report.setFormat('txt');
+ assert.equal( 'txt', report.write(testData, true) );
+ });
+ });
+
+ // suite('read', function() {
+ // test('read("test/report.json") read a report file', function() {
+ // report.read('test/report.json', function(c) {
+ // assert.equal( testData, c );
+ // });
+ // });
+ // });
+});
diff --git a/pool/shard007/JavaScript/0048274_shortcode-button.js b/pool/shard007/JavaScript/0048274_shortcode-button.js
new file mode 100644
index 0000000000000000000000000000000000000000..7304a12275463dabc75508f444608bd4d220dc3a
--- /dev/null
+++ b/pool/shard007/JavaScript/0048274_shortcode-button.js
@@ -0,0 +1,162 @@
+(function($) {
+ if ( typeof bws_shortcode_button != 'undefined' ) {
+ var win;
+
+ tinymce.create( 'tinymce.plugins.BWSButton', {
+ /**
+ * Initializes the plugin, this will be executed after the plugin has been created.
+ * This call is done before the editor instance has finished it's initialization so use the onInit event
+ * of the editor instance to intercept that event.
+ *
+ * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
+ * @param {string} url Absolute URL to where the plugin is located.
+ */
+ init : function( ed, url ) {
+ if ( bws_shortcode_button.wp_version < '3.9' ) {
+ ed.addButton( 'add_bws_shortcode', {
+ title : bws_shortcode_button.title,
+ classes: 'bws_shortcode_button widget btn',
+ image : bws_shortcode_button.icon_url,
+ onclick: function() {
+ /* triggers the thickbox */
+ var width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width;
+ W = W - 80;
+ H = H - 84;
+ tb_show( bws_shortcode_button.title, '#TB_inline?width=' + W + '&height=' + H + '&inlineId=bws_shortcode_popup' );
+
+ var current_object = '#TB_ajaxContent';
+
+ var select_count = $( current_object + ' select#bws_shortcode_select option').length;
+ if ( 1 == select_count ) {
+ $( current_object + ' #bws_shortcode_select_plugin' ).hide();
+ }
+
+ var plugin = $( current_object + ' #bws_shortcode_select option:selected' ).val();
+ $( current_object + ' #bws_shortcode_content > div' ).hide();
+ $( current_object + ' #bws_shortcode_content > #' + plugin ).show();
+
+ if ( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).length > 0 ) {
+ $( current_object + ' #bws_shortcode_display' ).text( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).val() );
+ }
+
+ $( current_object + ' #bws_shortcode_select' ).on( 'change',function() {
+ var plugin = $( current_object + ' #bws_shortcode_select option:selected' ).val();
+ $( current_object + ' #bws_shortcode_content > div' ).hide();
+ $( current_object + ' #bws_shortcode_content > #' + plugin ).show();
+ if ( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).length > 0 ) {
+ $( current_object + ' #bws_shortcode_display' ).text( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).val() );
+ } else {
+ $( current_object + ' #bws_shortcode_display' ).text( '' );
+ }
+ });
+
+ $.each( bws_shortcode_button.function_name, function( index, value ) {
+ eval( value + '();' );
+ });
+ }
+ });
+ } else {
+ ed.addButton( 'add_bws_shortcode', {
+ title : bws_shortcode_button.title,
+ classes: 'bws_shortcode_button widget btn',
+ icon: 'icon bwsicons bwsicons-shortcode',
+ text: bws_shortcode_button.label,
+ onclick: function() {
+
+ win = ed.windowManager.open( {
+ width: 400,
+ height: 400,
+ inline: true,
+ title: bws_shortcode_button.title,
+ body: {
+ id : 'bws-shortcode-content',
+ type: 'container',
+ classes: 'bws-shortcode',
+ html: $( '#bws_shortcode_popup' ).html()
+ },
+ buttons: [{
+ text: 'Insert',
+ classes: 'button-primary primary bws_shortcode_insert',
+ onclick: function( e ) {
+ var shortcode = $( '.mce-container-body #bws_shortcode_display' ).text();
+ if ( '' != shortcode ) {
+ /* insert shortcode to tinymce */
+ ed.insertContent( shortcode );
+ }
+ ed.windowManager.close();
+ },
+ },
+ {
+ text: 'Cancel',
+ onclick: 'close'
+ }],
+
+ });
+ var current_object = '.mce-container-body';
+ var select_count = $( current_object + ' select#bws_shortcode_select option').length;
+ if ( 1 == select_count ) {
+ $( current_object + ' #bws_shortcode_select_plugin' ).hide();
+ }
+
+ var plugin = $( current_object + ' #bws_shortcode_select option:selected' ).val();
+ $( current_object + ' #bws_shortcode_content > div' ).hide();
+ $( current_object + ' #bws_shortcode_content > #' + plugin ).show();
+
+ if ( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).length > 0 ) {
+ $( current_object + ' #bws_shortcode_display' ).text( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).val() );
+ }
+
+ $( current_object + ' #bws_shortcode_select' ).on( 'change',function() {
+ var plugin = $( current_object + ' #bws_shortcode_select option:selected' ).val();
+ $( current_object + ' #bws_shortcode_content > div' ).hide();
+ $( current_object + ' #bws_shortcode_content > #' + plugin ).show();
+ if ( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).length > 0 ) {
+ $( current_object + ' #bws_shortcode_display' ).text( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).val() );
+ } else {
+ $( current_object + ' #bws_shortcode_display' ).text( '' );
+ }
+ });
+
+ $.each( bws_shortcode_button.function_name, function( index, value ) {
+ eval( value + '();' );
+ });
+ }
+ });
+ }
+ },
+
+ /**
+ * Creates control instances based in the incomming name. This method is normally not
+ * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
+ * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
+ * method can be used to create those.
+ *
+ * @param {String} n Name of the control to create.
+ * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
+ * @return {tinymce.ui.Control} New control instance or null if no control was created.
+ */
+ createControl : function(n, cm) {
+ return null;
+ },
+
+ /**
+ * Returns information about the plugin as a name/value array.
+ * The current keys are longname, author, authorurl, infourl and version.
+ *
+ * @return {Object} Name/value array containing information about the plugin.
+ */
+ getInfo : function() {
+ return {
+ longname : 'BWS Shortcode Buttons',
+ author : 'BWS',
+ authorurl : 'https://bestwebsoft.com',
+ infourl : '',
+ version : "0.1"
+ };
+ }
+ });
+
+ /* Register plugin */
+ tinymce.PluginManager.add( 'add_bws_shortcode', tinymce.plugins.BWSButton );
+ }
+})(jQuery);
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048275_PostService.js b/pool/shard007/JavaScript/0048275_PostService.js
new file mode 100644
index 0000000000000000000000000000000000000000..515c8053dd8944d0e4acfe2497a5a690fba96c23
--- /dev/null
+++ b/pool/shard007/JavaScript/0048275_PostService.js
@@ -0,0 +1,34 @@
+var NightFuryPostService = angular.module('PostService',[]);
+
+NightFuryPostService.service('POST',function($q,$http){
+ this.getPostInCategory = function(category_name,posts_per_page){ //if category_name == null => get posts in all page
+ var url = '/wp-json/posts';
+ url += '?&filter[posts_per_page]=' + posts_per_page;
+ if(category_name != null){
+ url += '&filter[category_name]='+ category_name;
+ }
+ var defferer = $q.defer();
+ $http.get(url).success(function(response){
+ defferer.resolve(response);
+ })
+ return defferer.promise;
+ };
+ this.getPostSlug = function(slug){
+ var url = '/wp-json/posts?filter[name]=' + slug;
+ var defferer = $q.defer();
+ $http.get(url).success(function(response){
+ defferer.resolve(response);
+ })
+ return defferer.promise;
+ }
+ this.LoadMorePost = function(category_name,number_post_loaded,posts_per_page){
+ var page_loaded = Math.ceil(number_post_loaded/posts_per_page);
+ page_loaded++;
+ var url = '/wp-json/posts?page=' + page_loaded +'&filter[category_name]=' + category_name + '&filter[posts_per_page]=' + posts_per_page;
+ var defferer = $q.defer();
+ $http.get(url).success(function(response){
+ defferer.resolve(response);
+ })
+ return defferer.promise;
+ }
+});
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048278_forms.js b/pool/shard007/JavaScript/0048278_forms.js
new file mode 100644
index 0000000000000000000000000000000000000000..d4b3c696b91517cc9153fef81cbfeb8f6c9d6656
--- /dev/null
+++ b/pool/shard007/JavaScript/0048278_forms.js
@@ -0,0 +1,83 @@
+beesden.forms = function (d) {
+
+
+ var smoothCheckout = function() {
+
+ var container = d.getElementById('checkoutFlow'),
+ response;
+
+ if (!container) {
+ return;
+ }
+
+ Array.prototype.forEach.call(container.getElementsByTagName('form'), function(el, i) {
+
+ el.addEventListener('submit', function(e) {
+ e.preventDefault();
+
+ beesden.ajax(this.action, function(data) {
+ response = new DOMParser().parseFromString(data.response, 'text/html');
+ container.innerHTML = response.getElementById('checkoutFlow').innerHTML;
+ }, beesden.serialize(this), 'POST');
+ });
+
+ });
+
+ },
+
+ fieldSelect = function() {
+
+ var container,
+ fields,
+ input;
+
+ // Toggles fieldsets with required class
+ function showHide(input) {
+ Array.prototype.forEach.call(d.querySelectorAll('#checkoutFlow fieldset'), function(el, i) {
+ el.style.display = el.className.indexOf(input.value) < 0 ? 'none' : 'block';
+ });
+ }
+ // Loop through the formSelect inputs
+ Array.prototype.forEach.call(d.getElementsByClassName('formSelect'), function(el, i) {
+ // Get the input and assign the event
+ input = el.querySelector('input');
+ if (!input) return;
+ input.addEventListener('change', function() {
+ showHide(this);
+ });
+ // Reorder inputs and toggle the first (should be 'select')
+ if (i < 1) {
+ container = d.createElement('div');
+ el.parentNode.insertBefore(container, el.nextSibling);
+ input.checked = true;
+ showHide(input);
+ }
+ container.appendChild(el);
+ });
+
+ },
+
+ inputTidy = function () {
+
+ Array.prototype.forEach.call(d.getElementsByTagName('input'), function(el, i) {
+
+ if (el.type == 'hidden' || el.type == 'checkbox' || el.type == 'radio') {
+ return;
+ }
+
+ el.addEventListener('blur', function() {
+ this.value = this.value.trim();
+ });
+ });
+
+ }
+
+ return {
+ init: function() {
+ // smoothCheckout();
+ fieldSelect();
+ inputTidy();
+ }
+ };
+
+}(document);
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048279_beancount.js b/pool/shard007/JavaScript/0048279_beancount.js
new file mode 100644
index 0000000000000000000000000000000000000000..82d4420ba71361b77dab50cef5a9b246ccaf81c0
--- /dev/null
+++ b/pool/shard007/JavaScript/0048279_beancount.js
@@ -0,0 +1,20 @@
+var it = require('../tools/it.js');
+
+
+function countBs(text) {
+ return countsChar(text, 'B');
+}
+
+function countsChar(text, char) {
+ var counter = 0;
+ for (var position = 0; position < text.length; position++) {
+ if (text[position] == char) {
+ counter++;
+ }
+ }
+ return counter;
+}
+
+
+it('Counts 2 B in Abracadabra', countBs('ABRACADABRA') == 2);
+it('Counts 5 A in Abracadabra', countsChar('ABRACADABRA', 'A') == 5);
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048280_tdz.js b/pool/shard007/JavaScript/0048280_tdz.js
new file mode 100644
index 0000000000000000000000000000000000000000..e9ec166e1629b46b81e641411ee2b1ba5069280e
--- /dev/null
+++ b/pool/shard007/JavaScript/0048280_tdz.js
@@ -0,0 +1,100 @@
+import * as t from "babel-types";
+
+function getTDZStatus(refPath, bindingPath) {
+ const executionStatus = bindingPath._guessExecutionStatusRelativeTo(refPath);
+
+ if (executionStatus === "before") {
+ return "inside";
+ } else if (executionStatus === "after") {
+ return "outside";
+ } else {
+ return "maybe";
+ }
+}
+
+function buildTDZAssert(node, file) {
+ return t.callExpression(file.addHelper("temporalRef"), [
+ node,
+ t.stringLiteral(node.name),
+ file.addHelper("temporalUndefined"),
+ ]);
+}
+
+function isReference(node, scope, state) {
+ const declared = state.letReferences[node.name];
+ if (!declared) return false;
+
+ // declared node is different in this scope
+ return scope.getBindingIdentifier(node.name) === declared;
+}
+
+export const visitor = {
+ ReferencedIdentifier(path, state) {
+ if (!this.file.opts.tdz) return;
+
+ const { node, parent, scope } = path;
+
+ if (path.parentPath.isFor({ left: node })) return;
+ if (!isReference(node, scope, state)) return;
+
+ const bindingPath = scope.getBinding(node.name).path;
+
+ const status = getTDZStatus(path, bindingPath);
+ if (status === "inside") return;
+
+ if (status === "maybe") {
+ const assert = buildTDZAssert(node, state.file);
+
+ // add tdzThis to parent variable declarator so it's exploded
+ bindingPath.parent._tdzThis = true;
+
+ path.skip();
+
+ if (path.parentPath.isUpdateExpression()) {
+ if (parent._ignoreBlockScopingTDZ) return;
+ path.parentPath.replaceWith(t.sequenceExpression([assert, parent]));
+ } else {
+ path.replaceWith(assert);
+ }
+ } else if (status === "outside") {
+ path.replaceWith(
+ t.throwStatement(
+ t.inherits(
+ t.newExpression(t.identifier("ReferenceError"), [
+ t.stringLiteral(
+ `${node.name} is not defined - temporal dead zone`,
+ ),
+ ]),
+ node,
+ ),
+ ),
+ );
+ }
+ },
+
+ AssignmentExpression: {
+ exit(path, state) {
+ if (!this.file.opts.tdz) return;
+
+ const { node } = path;
+ if (node._ignoreBlockScopingTDZ) return;
+
+ const nodes = [];
+ const ids = path.getBindingIdentifiers();
+
+ for (const name in ids) {
+ const id = ids[name];
+
+ if (isReference(id, path.scope, state)) {
+ nodes.push(buildTDZAssert(id, state.file));
+ }
+ }
+
+ if (nodes.length) {
+ node._ignoreBlockScopingTDZ = true;
+ nodes.push(node);
+ path.replaceWithMultiple(nodes.map(t.expressionStatement));
+ }
+ },
+ },
+};
diff --git a/pool/shard007/JavaScript/0048281_view.js b/pool/shard007/JavaScript/0048281_view.js
new file mode 100644
index 0000000000000000000000000000000000000000..cb2527ca47b0d27bf6b3c462f4627c18d0d707d5
--- /dev/null
+++ b/pool/shard007/JavaScript/0048281_view.js
@@ -0,0 +1,399 @@
+/*globals Handlebars */
+
+/**
+@module ember
+@submodule ember-handlebars
+*/
+
+import Ember from "ember-metal/core"; // Ember.warn, Ember.assert
+// var emberWarn = Ember.warn, emberAssert = Ember.assert;
+
+import EmberObject from "ember-runtime/system/object";
+import { get } from "ember-metal/property_get";
+import { set } from "ember-metal/property_set";
+import { IS_BINDING } from "ember-metal/mixin";
+import jQuery from "ember-views/system/jquery";
+import View from "ember-views/views/view";
+import { isGlobalPath } from "ember-metal/binding";
+import {
+ normalizePath,
+ handlebarsGet
+} from "ember-handlebars/ext";
+import EmberString from "ember-runtime/system/string";
+
+
+var LOWERCASE_A_Z = /^[a-z]/,
+ VIEW_PREFIX = /^view\./;
+
+function makeBindings(thisContext, options) {
+ var hash = options.hash,
+ hashType = options.hashTypes;
+
+ for (var prop in hash) {
+ if (hashType[prop] === 'ID') {
+
+ var value = hash[prop];
+
+ if (IS_BINDING.test(prop)) {
+ Ember.warn("You're attempting to render a view by passing " + prop + "=" + value + " to a view helper, but this syntax is ambiguous. You should either surround " + value + " in quotes or remove `Binding` from " + prop + ".");
+ } else {
+ hash[prop + 'Binding'] = value;
+ hashType[prop + 'Binding'] = 'STRING';
+ delete hash[prop];
+ delete hashType[prop];
+ }
+ }
+ }
+
+ if (hash.hasOwnProperty('idBinding')) {
+ // id can't be bound, so just perform one-time lookup.
+ hash.id = handlebarsGet(thisContext, hash.idBinding, options);
+ hashType.id = 'STRING';
+ delete hash.idBinding;
+ delete hashType.idBinding;
+ }
+}
+
+export var ViewHelper = EmberObject.create({
+
+ propertiesFromHTMLOptions: function(options) {
+ var hash = options.hash, data = options.data;
+ var extensions = {},
+ classes = hash['class'],
+ dup = false;
+
+ if (hash.id) {
+ extensions.elementId = hash.id;
+ dup = true;
+ }
+
+ if (hash.tag) {
+ extensions.tagName = hash.tag;
+ dup = true;
+ }
+
+ if (classes) {
+ classes = classes.split(' ');
+ extensions.classNames = classes;
+ dup = true;
+ }
+
+ if (hash.classBinding) {
+ extensions.classNameBindings = hash.classBinding.split(' ');
+ dup = true;
+ }
+
+ if (hash.classNameBindings) {
+ if (extensions.classNameBindings === undefined) extensions.classNameBindings = [];
+ extensions.classNameBindings = extensions.classNameBindings.concat(hash.classNameBindings.split(' '));
+ dup = true;
+ }
+
+ if (hash.attributeBindings) {
+ Ember.assert("Setting 'attributeBindings' via Handlebars is not allowed. Please subclass Ember.View and set it there instead.");
+ extensions.attributeBindings = null;
+ dup = true;
+ }
+
+ if (dup) {
+ hash = jQuery.extend({}, hash);
+ delete hash.id;
+ delete hash.tag;
+ delete hash['class'];
+ delete hash.classBinding;
+ }
+
+ // Set the proper context for all bindings passed to the helper. This applies to regular attribute bindings
+ // as well as class name bindings. If the bindings are local, make them relative to the current context
+ // instead of the view.
+ var path;
+
+ // Evaluate the context of regular attribute bindings:
+ for (var prop in hash) {
+ if (!hash.hasOwnProperty(prop)) { continue; }
+
+ // Test if the property ends in "Binding"
+ if (IS_BINDING.test(prop) && typeof hash[prop] === 'string') {
+ path = this.contextualizeBindingPath(hash[prop], data);
+ if (path) { hash[prop] = path; }
+ }
+ }
+
+ // Evaluate the context of class name bindings:
+ if (extensions.classNameBindings) {
+ for (var b in extensions.classNameBindings) {
+ var full = extensions.classNameBindings[b];
+ if (typeof full === 'string') {
+ // Contextualize the path of classNameBinding so this:
+ //
+ // classNameBinding="isGreen:green"
+ //
+ // is converted to this:
+ //
+ // classNameBinding="_parentView.context.isGreen:green"
+ var parsedPath = View._parsePropertyPath(full);
+ path = this.contextualizeBindingPath(parsedPath.path, data);
+ if (path) { extensions.classNameBindings[b] = path + parsedPath.classNames; }
+ }
+ }
+ }
+
+ return jQuery.extend(hash, extensions);
+ },
+
+ // Transform bindings from the current context to a context that can be evaluated within the view.
+ // Returns null if the path shouldn't be changed.
+ //
+ // TODO: consider the addition of a prefix that would allow this method to return `path`.
+ contextualizeBindingPath: function(path, data) {
+ var normalized = normalizePath(null, path, data);
+ if (normalized.isKeyword) {
+ return 'templateData.keywords.' + path;
+ } else if (isGlobalPath(path)) {
+ return null;
+ } else if (path === 'this' || path === '') {
+ return '_parentView.context';
+ } else {
+ return '_parentView.context.' + path;
+ }
+ },
+
+ helper: function(thisContext, path, options) {
+ var data = options.data,
+ fn = options.fn,
+ newView;
+
+ makeBindings(thisContext, options);
+
+ if ('string' === typeof path) {
+ var lookup;
+ // TODO: this is a lame conditional, this should likely change
+ // but something along these lines will likely need to be added
+ // as deprecation warnings
+ //
+ if (options.types[0] === 'STRING' && LOWERCASE_A_Z.test(path) && !VIEW_PREFIX.test(path)) {
+ lookup = path;
+ } else {
+ newView = handlebarsGet(thisContext, path, options);
+ if (typeof newView === 'string') {
+ lookup = newView;
+ }
+ }
+
+ if (lookup) {
+ Ember.assert("View requires a container", !!data.view.container);
+ newView = data.view.container.lookupFactory('view:' + lookup);
+ }
+
+ Ember.assert("Unable to find view at path '" + path + "'", !!newView);
+ } else {
+ newView = path;
+ }
+
+ Ember.assert(EmberString.fmt('You must pass a view to the #view helper, not %@ (%@)', [path, newView]), View.detect(newView) || View.detectInstance(newView));
+
+ var viewOptions = this.propertiesFromHTMLOptions(options, thisContext);
+ var currentView = data.view;
+ viewOptions.templateData = data;
+ var newViewProto = newView.proto ? newView.proto() : newView;
+
+ if (fn) {
+ Ember.assert("You cannot provide a template block if you also specified a templateName", !get(viewOptions, 'templateName') && !get(newViewProto, 'templateName'));
+ viewOptions.template = fn;
+ }
+
+ // We only want to override the `_context` computed property if there is
+ // no specified controller. See View#_context for more information.
+ if (!newViewProto.controller && !newViewProto.controllerBinding && !viewOptions.controller && !viewOptions.controllerBinding) {
+ viewOptions._context = thisContext;
+ }
+
+ // for instrumentation
+ if (options.helperName) {
+ viewOptions.helperName = options.helperName;
+ }
+
+ currentView.appendChild(newView, viewOptions);
+ }
+});
+
+/**
+ `{{view}}` inserts a new instance of an `Ember.View` into a template passing its
+ options to the `Ember.View`'s `create` method and using the supplied block as
+ the view's own template.
+
+ An empty `` and the following template:
+
+ ```handlebars
+ A span:
+ {{#view tagName="span"}}
+ hello.
+ {{/view}}
+ ```
+
+ Will result in HTML structure:
+
+ ```html
+
+
+
+
+ A span:
+
+ Hello.
+
+
+
+ ```
+
+ ### `parentView` setting
+
+ The `parentView` property of the new `Ember.View` instance created through
+ `{{view}}` will be set to the `Ember.View` instance of the template where
+ `{{view}}` was called.
+
+ ```javascript
+ aView = Ember.View.create({
+ template: Ember.Handlebars.compile("{{#view}} my parent: {{parentView.elementId}} {{/view}}")
+ });
+
+ aView.appendTo('body');
+ ```
+
+ Will result in HTML structure:
+
+ ```html
+
+
+ my parent: ember1
+
+
+ ```
+
+ ### Setting CSS id and class attributes
+
+ The HTML `id` attribute can be set on the `{{view}}`'s resulting element with
+ the `id` option. This option will _not_ be passed to `Ember.View.create`.
+
+ ```handlebars
+ {{#view tagName="span" id="a-custom-id"}}
+ hello.
+ {{/view}}
+ ```
+
+ Results in the following HTML structure:
+
+ ```html
+
+
+ hello.
+
+
+ ```
+
+ The HTML `class` attribute can be set on the `{{view}}`'s resulting element
+ with the `class` or `classNameBindings` options. The `class` option will
+ directly set the CSS `class` attribute and will not be passed to
+ `Ember.View.create`. `classNameBindings` will be passed to `create` and use
+ `Ember.View`'s class name binding functionality:
+
+ ```handlebars
+ {{#view tagName="span" class="a-custom-class"}}
+ hello.
+ {{/view}}
+ ```
+
+ Results in the following HTML structure:
+
+ ```html
+
+
+ hello.
+
+
+ ```
+
+ ### Supplying a different view class
+
+ `{{view}}` can take an optional first argument before its supplied options to
+ specify a path to a custom view class.
+
+ ```handlebars
+ {{#view "MyApp.CustomView"}}
+ hello.
+ {{/view}}
+ ```
+
+ The first argument can also be a relative path accessible from the current
+ context.
+
+ ```javascript
+ MyApp = Ember.Application.create({});
+ MyApp.OuterView = Ember.View.extend({
+ innerViewClass: Ember.View.extend({
+ classNames: ['a-custom-view-class-as-property']
+ }),
+ template: Ember.Handlebars.compile('{{#view "view.innerViewClass"}} hi {{/view}}')
+ });
+
+ MyApp.OuterView.create().appendTo('body');
+ ```
+
+ Will result in the following HTML:
+
+ ```html
+
+
+ hi
+
+
+ ```
+
+ ### Blockless use
+
+ If you supply a custom `Ember.View` subclass that specifies its own template
+ or provide a `templateName` option to `{{view}}` it can be used without
+ supplying a block. Attempts to use both a `templateName` option and supply a
+ block will throw an error.
+
+ ```handlebars
+ {{view "MyApp.ViewWithATemplateDefined"}}
+ ```
+
+ ### `viewName` property
+
+ You can supply a `viewName` option to `{{view}}`. The `Ember.View` instance
+ will be referenced as a property of its parent view by this name.
+
+ ```javascript
+ aView = Ember.View.create({
+ template: Ember.Handlebars.compile('{{#view viewName="aChildByName"}} hi {{/view}}')
+ });
+
+ aView.appendTo('body');
+ aView.get('aChildByName') // the instance of Ember.View created by {{view}} helper
+ ```
+
+ @method view
+ @for Ember.Handlebars.helpers
+ @param {String} path
+ @param {Hash} options
+ @return {String} HTML string
+*/
+export function viewHelper(path, options) {
+ Ember.assert("The view helper only takes a single argument", arguments.length <= 2);
+
+ // If no path is provided, treat path param as options
+ // and get an instance of the registered `view:default`
+ if (path && path.data && path.data.isRenderData) {
+ options = path;
+ Ember.assert('{{view}} helper requires parent view to have a container but none was found. This usually happens when you are manually-managing views.', !!options.data.view.container);
+ path = options.data.view.container.lookupFactory('view:default');
+ }
+
+ options.helperName = options.helperName || 'view';
+
+ return ViewHelper.helper(this, path, options);
+}
diff --git a/pool/shard007/JavaScript/0048282_basic.js b/pool/shard007/JavaScript/0048282_basic.js
new file mode 100644
index 0000000000000000000000000000000000000000..b6f3859fd3048f6627eec99c8b83f807e809b85a
--- /dev/null
+++ b/pool/shard007/JavaScript/0048282_basic.js
@@ -0,0 +1,83 @@
+var debug = {};
+
+var map = L.map('map').setView([-5, 27.4], 5); // africa
+
+L.tileLayer('http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
+ maxZoom: 18,
+ id: 'examples.map-i86knfo3'
+}).addTo(map);
+
+
+var mvtSource = new L.TileLayer.MVTSource({
+ url: "http://spatialserver.spatialdev.com/services/vector-tiles/GAUL_FSP/{z}/{x}/{y}.pbf",
+ debug: true,
+ clickableLayers: ["GAUL0"],
+ getIDForLayerFeature: function(feature) {
+ return feature.properties.id;
+ },
+
+ /**
+ * The filter function gets called when iterating though each vector tile feature (vtf). You have access
+ * to every property associated with a given feature (the feature, and the layer). You can also filter
+ * based of the context (each tile that the feature is drawn onto).
+ *
+ * Returning false skips over the feature and it is not drawn.
+ *
+ * @param feature
+ * @returns {boolean}
+ */
+ filter: function(feature, context) {
+ if (feature.layer.name === 'GAUL0') {
+ return true;
+ }
+ return false;
+ },
+
+ style: function (feature) {
+ var style = {};
+
+ var type = feature.type;
+ switch (type) {
+ case 1: //'Point'
+ style.color = 'rgba(49,79,79,1)';
+ style.radius = 5;
+ style.selected = {
+ color: 'rgba(255,255,0,0.5)',
+ radius: 6
+ };
+ break;
+ case 2: //'LineString'
+ style.color = 'rgba(161,217,155,0.8)';
+ style.size = 3;
+ style.selected = {
+ color: 'rgba(255,25,0,0.5)',
+ size: 4
+ };
+ break;
+ case 3: //'Polygon'
+ style.color = fillColor;
+ style.outline = {
+ color: strokeColor,
+ size: 1
+ };
+ style.selected = {
+ color: 'rgba(255,140,0,0.3)',
+ outline: {
+ color: 'rgba(255,140,0,1)',
+ size: 2
+ }
+ };
+ break;
+ }
+ return style;
+ }
+
+});
+debug.mvtSource = mvtSource;
+
+//Globals that we can change later.
+var fillColor = 'rgba(149,139,255,0.4)';
+var strokeColor = 'rgb(20,20,20)';
+
+//Add layer
+map.addLayer(mvtSource);
diff --git a/pool/shard007/JavaScript/0048284_nrs.console.js b/pool/shard007/JavaScript/0048284_nrs.console.js
new file mode 100644
index 0000000000000000000000000000000000000000..28910ed1e899f2629023dd99ce0ee6afd680d6cc
--- /dev/null
+++ b/pool/shard007/JavaScript/0048284_nrs.console.js
@@ -0,0 +1,83 @@
+var NRS = (function(NRS, $, undefined) {
+ NRS.showConsole = function() {
+ NRS.console = window.open("", "console", "width=750,height=400,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes");
+ $(NRS.console.document.head).html("
控制台 ");
+ $(NRS.console.document.body).html("控制台开启,记录开始...clear");
+ }
+
+ NRS.addToConsole = function(url, type, data, response, error) {
+ if (!NRS.console) {
+ return;
+ }
+
+ if (!NRS.console.document || !NRS.console.document.body) {
+ NRS.console = null;
+ return;
+ }
+
+ url = url.replace(/&random=[\.\d]+/, "", url);
+
+ NRS.addToConsoleBody(url + " (" + type + ") " + new Date().toString(), "url");
+
+ if (data) {
+ if (typeof data == "string") {
+ var d = NRS.queryStringToObject(data);
+ NRS.addToConsoleBody(JSON.stringify(d, null, "\t"), "post");
+ } else {
+ NRS.addToConsoleBody(JSON.stringify(data, null, "\t"), "post");
+ }
+ }
+
+ if (error) {
+ NRS.addToConsoleBody(response, "error");
+ } else {
+ NRS.addToConsoleBody(JSON.stringify(response, null, "\t"), (response.errorCode ? "error" : ""));
+ }
+ }
+
+ NRS.addToConsoleBody = function(text, type) {
+ var color = "";
+
+ switch (type) {
+ case "url":
+ color = "#29FD2F";
+ break;
+ case "post":
+ color = "lightgray";
+ break;
+ case "error":
+ color = "red";
+ break;
+ }
+
+ $(NRS.console.document.body).find("#console").append("" + text.escapeHTML() + "
");
+ }
+
+ NRS.queryStringToObject = function(qs) {
+ qs = qs.split("&");
+
+ if (!qs) {
+ return {};
+ }
+
+ var obj = {};
+
+ for (var i = 0; i < qs.length; ++i) {
+ var p = qs[i].split('=');
+
+ if (p.length != 2) {
+ continue;
+ }
+
+ obj[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
+ }
+
+ if ("secretPhrase" in obj) {
+ obj.secretPhrase = "***";
+ }
+
+ return obj;
+ }
+
+ return NRS;
+}(NRS || {}, jQuery));
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048285_seed_table.js b/pool/shard007/JavaScript/0048285_seed_table.js
new file mode 100644
index 0000000000000000000000000000000000000000..03c699f6ec27671937ff2953c6ef48e555606fc1
--- /dev/null
+++ b/pool/shard007/JavaScript/0048285_seed_table.js
@@ -0,0 +1,43 @@
+ $(document).ready(function() {
+ var ajax_url = SEED_LIST_JSON_URL;
+ if ($.fn.dataTable.isDataTable('.seed-dt')) {
+ dt = $('.seed-dt').DataTable();
+ }
+ else {
+ dt = $('.seed-dt').dataTable({
+ "lengthChange": false,
+ "pageLength": 25,
+ "sPaginationType": oPaginationType,
+ "autoWidth": false,
+ "language": oLanguages,
+ // currently, not supporting order by click column since the seed table columns are different
+ //it's hard to make one rule for all table
+ "ordering": false,
+ //define the ajax url for the datatable
+ "serverSide": true,
+ "ajax": {
+ "url": ajax_url
+ }
+ });
+ }
+ // add search input for the seed datatable based on the datatable api and feature
+ dt.each(function(){
+ var datatable = $(this);
+ // SEARCH - Turn this into in-line form control
+ var search_input = datatable.closest('.dataTables_wrapper').find('div[id$=_filter] input');
+ search_input.addClass('form-control');
+ // LENGTH - Inline-Form control
+ var length_sel = datatable.closest('.dataTables_wrapper').find('div[id$=_length] select');
+ length_sel.addClass('form-control');
+ });
+
+ //reload api url for active tab
+ $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
+ var status = $(e.target).attr('id');
+ ajax_url = SEED_LIST_JSON_URL.replace ('active', status);
+ // reload url request for 'active' or 'deleted' tab
+ dt.ajax.url(ajax_url).load();
+ });
+
+
+ });
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048286_directives.js b/pool/shard007/JavaScript/0048286_directives.js
new file mode 100644
index 0000000000000000000000000000000000000000..49e86939022386feb61fabde9cf7eaa5bc284cd6
--- /dev/null
+++ b/pool/shard007/JavaScript/0048286_directives.js
@@ -0,0 +1,78 @@
+import { describe, it } from 'mocha';
+import { expect } from 'chai';
+import { parse, Kind } from 'graphql';
+
+import generateSchema from '../../generate/schema';
+import { generateResolversAst } from '../../generate/resolvers';
+import { generateModelAst } from '../../generate/model';
+
+describe('directives', () => {
+ describe('@enum', () => {
+ const input = parse(`type Test {
+ status: TestStatus @enum
+ }`);
+
+ it('leaves the typename unchanged in the schema', () => {
+ const schema = generateSchema(input);
+
+ function checkStatusField(type) {
+ const statusField = type.fields.find(f => f.name.value === 'status');
+ expect(statusField.type.name.value).to.equal('TestStatus');
+ }
+
+ const testType = schema.definitions[0];
+ checkStatusField(testType);
+
+ const createInputType = schema.definitions.find(defn =>
+ defn.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION
+ && defn.name.value === 'CreateTestInput');
+ checkStatusField(createInputType);
+
+ const updateInputType = schema.definitions.find(defn =>
+ defn.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION
+ && defn.name.value === 'UpdateTestInput');
+ checkStatusField(updateInputType);
+ });
+
+ it('does not generate a resolver', () => {
+ const ast = generateResolversAst(input);
+ let keys = [];
+ // less offensive, otherwise, we have to change it after each
+ // change in the templates
+ ast.program.body.forEach(body => {
+ if (body.declarations &&
+ body.declarations.length > 0) {
+
+ body.declarations.forEach(declaration => {
+ if (declaration.init &&
+ declaration.init.properties &&
+ declaration.init.properties.length > 0){
+
+ const Test = declaration.init.properties.find(p => p.key.name === 'Test');
+ if (Test && Test.value && Test.value.properties && Test.value.properties.length > 0) {
+ keys = keys.concat(Test.value.properties.map(p => p.key.name));
+ }
+ }
+ });
+ }
+ });
+ expect(keys).to.not.include('status');
+ });
+
+ it('does not generate a model function', () => {
+ const ast = generateModelAst(input);
+ let keys = [];
+ // less offensive, otherwise, we have to change it after each
+ // change in the templates
+ ast.program.body.forEach(body =>{
+ if (body.declaration &&
+ body.declaration.body &&
+ body.declaration.body.body &&
+ body.declaration.body.body.length > 0) {
+ keys = keys.concat(body.declaration.body.body.map(p => p.key.name));
+ }
+ });
+ expect(keys).to.not.include('status');
+ });
+ });
+});
diff --git a/pool/shard007/JavaScript/0048290_error_routes.js b/pool/shard007/JavaScript/0048290_error_routes.js
new file mode 100644
index 0000000000000000000000000000000000000000..b5570fe65497f2fa55e1001daf4e7020e9a5debf
--- /dev/null
+++ b/pool/shard007/JavaScript/0048290_error_routes.js
@@ -0,0 +1,27 @@
+var router = require('express').Router();
+
+// Error Handlers
+// 404
+router.use(function (req, res, next) {
+ res.status(404);
+ res.json({ success: false, err: '404 - Not found.' });
+});
+
+// 403 (Csurf token tampered)
+router.use(function (err, req, res, next) {
+ if (err.code !== 'EBADCSRFTOKEN') {
+ return next(err);
+ }
+
+ res.status(403);
+ res.json({ success: false, err: '403 - Session has expired.' });
+});
+
+// 500
+router.use(function (err, req, res, next) {
+ console.error(err.stack);
+ res.status(500);
+ res.json({ success: false, err: '500 - Internal server error.' });
+});
+
+module.exports = router;
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048294_lbHttpsOnly.js b/pool/shard007/JavaScript/0048294_lbHttpsOnly.js
new file mode 100644
index 0000000000000000000000000000000000000000..3bc5ad9674fa2b70306b34cc1eae5b30d816480a
--- /dev/null
+++ b/pool/shard007/JavaScript/0048294_lbHttpsOnly.js
@@ -0,0 +1,91 @@
+const async = require('async');
+const helpers = require('../../../helpers/azure');
+
+module.exports = {
+ title: 'LB HTTPS Only',
+ category: 'Load Balancer',
+ description: 'Ensures load balancers are configured to only accept connections on HTTPS ports',
+ more_info: 'For maximum security, load balancers can be configured to only accept HTTPS connections. Standard HTTP connections will be blocked. This should only be done if the client application is configured to query HTTPS directly and not rely on a redirect from HTTP.',
+ link: 'https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-overview',
+ recommended_action: 'Ensure that each load balancer only accepts connections on port 443.',
+ apis: ['loadBalancers:listAll'],
+ compliance: {
+ hipaa: 'HIPAA requires all data to be transmitted over secure channels. ' +
+ 'App Service HTTPS redirection should be used to ensure site visitors ' +
+ 'are always connecting over a secure channel.',
+ },
+
+ run: function(cache, settings, callback) {
+ const results = [];
+ const source = {};
+ const locations = helpers.locations(settings.govcloud);
+
+ async.each(locations.loadBalancers, function(location, rcb) {
+
+ const loadBalancers = helpers.addSource(cache, source,
+ ['loadBalancers', 'listAll', location]);
+
+ if (!loadBalancers) return rcb();
+
+ if (loadBalancers.err || !loadBalancers.data) {
+ helpers.addResult(results, 3,
+ 'Unable to query Load Balancers: ' + helpers.addError(loadBalancers), location);
+ return rcb();
+ }
+
+ if (!loadBalancers.data.length) {
+ helpers.addResult(results, 0, 'No existing Load Balancers found', location);
+ return rcb();
+ }
+
+ loadBalancers.data.forEach(loadBalancer => {
+ var notHTTPSRules = 0;
+ var isHTTPS = false;
+
+ if (loadBalancer.inboundNatRules &&
+ loadBalancer.inboundNatRules.length > 0) {
+ loadBalancer.inboundNatRules.forEach(inboundRule => {
+ if (inboundRule.properties &&
+ inboundRule.properties.frontendPort &&
+ inboundRule.properties.frontendPort == 443) {
+ isHTTPS = true;
+ } else {
+ notHTTPSRules++;
+ }
+ });
+ }
+
+ if (loadBalancer.loadBalancingRules &&
+ loadBalancer.loadBalancingRules.length > 0) {
+ loadBalancer.loadBalancingRules.forEach(loadBalancingRule => {
+ if (loadBalancingRule.properties &&
+ loadBalancingRule.properties.frontendPort &&
+ loadBalancingRule.properties.frontendPort == 443) {
+ isHTTPS = true;
+ } else {
+ notHTTPSRules++;
+ }
+ });
+ }
+
+ if (notHTTPSRules && isHTTPS) {
+ helpers.addResult(results, 2,
+ 'HTTPS is configured but other ports are open', location, loadBalancer.id);
+ } else if (notHTTPSRules && !isHTTPS) {
+ helpers.addResult(results, 2,
+ 'HTTPS is not configured and other ports are open', location, loadBalancer.id);
+ } else if (isHTTPS) {
+ helpers.addResult(results, 0,
+ 'Only HTTPS is configured', location, loadBalancer.id);
+ } else {
+ helpers.addResult(results, 0,
+ 'No inbound rules found', location, loadBalancer.id);
+ }
+ });
+ rcb();
+ }, function() {
+ // Global checking goes here
+ callback(null, results, source);
+ });
+ }
+};
diff --git a/pool/shard007/JavaScript/0048295_demo.js b/pool/shard007/JavaScript/0048295_demo.js
new file mode 100644
index 0000000000000000000000000000000000000000..11cc42fb971c35d1b241e1c65b1f164d41cbfa13
--- /dev/null
+++ b/pool/shard007/JavaScript/0048295_demo.js
@@ -0,0 +1,23 @@
+var person = mobx.observable({
+ firstName: 'Matt',
+ lastName: 'Ruby',
+ age: 0,
+ get fullName () {
+ // Note how this computed value is cached.
+ // We only hit this function 3 times.
+ console.log('hit fullName');
+ return this.firstName + ' ' + this.lastName;
+ }
+});
+
+mobx.autorun(function auto_fullNameAge () {
+ console.log('autorun: ' + person.fullName + ' ' + person.age);
+});
+
+// this will print Matt Ruby NN 10 times
+_.times(10, function () {
+ person.age = _.random(40);
+});
+
+person.firstName = 'Mike';
+person.firstName = 'Lissy';
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048300_managerTeamIndex.js b/pool/shard007/JavaScript/0048300_managerTeamIndex.js
new file mode 100644
index 0000000000000000000000000000000000000000..f1382ab9eb624fbd3165d8d2227eb702b82b7e61
--- /dev/null
+++ b/pool/shard007/JavaScript/0048300_managerTeamIndex.js
@@ -0,0 +1,231 @@
+/*
+ * This file is part of the Claroline Connect package.
+ *
+ * (c) Claroline Consortium
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+(function () {
+ 'use strict';
+
+ var teamId = $('#team-datas').data('team-id');
+ var maxUsers = $('#team-datas').data('max-users');
+ var nbUsers = $('#team-datas').data('nb-users');
+ var workspaceId = $('#team-datas').data('workspace-id');
+ var currentManagerId = $('#team-datas').data('team-manager-id');
+
+ $('#edit-params-btn').on('click', function () {
+ window.Claroline.Modal.displayForm(
+ Routing.generate(
+ 'claro_team_edit_form',
+ {'team': teamId}
+ ),
+ refreshPage,
+ function() {}
+ );
+ });
+
+ $('#register-users-btn').on('click', function () {
+
+ $.ajax({
+ url: Routing.generate(
+ 'claro_team_registration_unregistered_users_list',
+ {'team': teamId}
+ ),
+ type: 'GET',
+ success: function (datas) {
+ $('#view-registration-users-body').html(datas);
+ $('#view-registration-users-box').modal('show');
+ }
+ });
+ });
+
+ $('#view-registration-users-body').on('click', 'a', function (event) {
+ event.preventDefault();
+ event.stopPropagation();
+ var url = $(this).attr('href');
+
+ $.ajax({
+ url: url,
+ type: 'GET',
+ async: false,
+ success: function (result) {
+ $('#view-registration-users-body').html(result);
+ }
+ });
+ });
+
+ $('#view-registration-users-body').on('click', '#search-user-btn', function () {
+ var search = $('#search-user-input').val();
+
+ $.ajax({
+ url: Routing.generate(
+ 'claro_team_registration_unregistered_users_list',
+ {
+ 'team': teamId,
+ 'search': search
+ }
+ ),
+ type: 'GET',
+ async: false,
+ success: function (result) {
+ $('#view-registration-users-body').html(result);
+ }
+ });
+ });
+
+ $('#view-registration-users-box').on('click', '.register-btn', function () {
+ var userId = $(this).data('user-id');
+ var firstName = $(this).data('user-first-name');
+ var lastName = $(this).data('user-last-name');
+ var username = $(this).data('user-username');
+
+ $.ajax({
+ url: Routing.generate(
+ 'claro_team_manager_register_user',
+ {
+ 'team': teamId,
+ 'user': userId
+ }
+ ),
+ type: 'POST',
+ success: function () {
+ nbUsers++;
+ $('#registration-row-user-' + userId).remove();
+ var userRow = '' +
+ '' + firstName + ' ' +
+ '' + lastName + ' ' +
+ '' + username + ' ' +
+ '' +
+ '' +
+ Translator.trans('unregister', {}, 'team') +
+ '' +
+ ' ' +
+ ' ';
+ $('#users-list-table').append(userRow);
+
+ if ($('#users-list').hasClass('hidden')) {
+ $('#no-user-alert').addClass('hidden');
+ $('#users-list').removeClass('hidden');
+ }
+
+ if (maxUsers !== '' && nbUsers >= parseInt(maxUsers)) {
+ $('.register-btn').addClass('disabled');
+ }
+ }
+ });
+ });
+
+ $('#users-list-table').on('click', '.unregister-btn', function () {
+ var userId = $(this).data('user-id');
+ var firstName = $(this).data('user-first-name');
+ var lastName = $(this).data('user-last-name');
+ var username = $(this).data('user-username');
+
+ window.Claroline.Modal.confirmRequest(
+ Routing.generate(
+ 'claro_team_manager_unregister_user',
+ {
+ 'team': teamId,
+ 'user': userId
+ }
+ ),
+ removeUserRow,
+ userId,
+ Translator.trans('unregister_user_from_team_confirm_message', {}, 'team'),
+ firstName + ' ' + lastName + ' (' + username + ')'
+ );
+ });
+
+ $('#select-team-manager-btn').on('click', function () {
+ var userPicker = new UserPicker();
+ var params = {
+ picker_name: 'team-manager-picker',
+ picker_title: Translator.trans('team_manager_selection', {}, 'team'),
+ forced_workspaces: [workspaceId]
+ };
+
+ if (currentManagerId !== -1) {
+ params['selected_users'] = [currentManagerId];
+ }
+ userPicker.configure(params, registerManager);
+ userPicker.open();
+ });
+
+ $('body').on('click', '#remove-team-manager-btn', function () {
+ window.Claroline.Modal.confirmRequest(
+ Routing.generate(
+ 'claro_team_manager_unregister_manager',
+ {'team': teamId}
+ ),
+ emptyTeamManagerBox,
+ null,
+ Translator.trans('remove_team_manager_confirm_message', {}, 'team'),
+ Translator.trans('remove_team_manager', {}, 'team')
+ );
+ currentManagerId = -1;
+ });
+
+ var registerManager = function (userId) {
+
+ if (userId !== null) {
+ currentManagerId = userId;
+
+ $.ajax({
+ url: Routing.generate(
+ 'claro_user_infos_request',
+ {'user': userId}
+ ),
+ type: 'GET',
+ success: function (datas) {
+ var firstName = datas['firstName'];
+ var lastName = datas['lastName'];
+
+ $.ajax({
+ url: Routing.generate(
+ 'claro_team_manager_register_manager',
+ {'team': teamId, 'user': userId}
+ ),
+ type: 'POST',
+ async: false,
+ success: function () {
+ var managerBox = firstName + ' ' + lastName + ' ' +
+ '' +
+ '' +
+ '' +
+ '';
+ $('#team-manager-box').html(managerBox);
+ }
+ });
+ }
+ });
+ }
+ };
+
+ var refreshPage = function () {
+ window.tinymce.claroline.disableBeforeUnload = true;
+ window.location.reload();
+ };
+
+ var removeUserRow = function (event, userId) {
+ nbUsers--;
+ $('#row-user-' + userId).remove();
+ };
+
+ var emptyTeamManagerBox = function () {
+ var noneMsg = '[' + Translator.trans('none', {}, 'platform') + ']';
+ $('#team-manager-box').html(noneMsg);
+ };
+})();
diff --git a/pool/shard007/JavaScript/0048302_authentication.js b/pool/shard007/JavaScript/0048302_authentication.js
new file mode 100644
index 0000000000000000000000000000000000000000..0f121adf4ddf3d879942e92cc7b176a3c3678ff6
--- /dev/null
+++ b/pool/shard007/JavaScript/0048302_authentication.js
@@ -0,0 +1,221 @@
+'use strict';
+
+angular.module('issueTrackerSystem.users.authentication', [])
+ .factory('authentication', [
+ '$rootScope',
+ '$http',
+ '$q',
+ '$location',
+ 'BASE_URL',
+ 'toastr',
+ function($rootScope, $http, $q, $location, BASE_URL, toastr) {
+
+ var currentUser = undefined;
+ var userProfile = undefined;
+
+ function loginUser(userData) {
+ var deferred = $q.defer();
+ userData.grant_type = 'password';
+ //console.log(userData); //Ok
+ var request = {
+ method: 'POST',
+ url: BASE_URL + 'api/Token',
+ data: 'Username=' + userData.username
+ + '&Password=' + userData.password
+ + '&grant_type=' + userData.grant_type,
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded'
+ }
+ };
+ $http(request)
+ .then(function (responce) {
+ preserveUserData(responce.data);
+ requestUserProfile()
+ .then(function () {
+ toastr.info('Success', 'Login successful.');
+ location.reload();
+ deferred.resolve(responce.data);
+ });
+ });
+ return deferred.promise;
+ }
+
+ function registerUser(userData) {
+ var deferred = $q.defer();
+ //console.log(user);
+ var request = {
+ method: 'POST',
+ url: BASE_URL + 'api/Account//Register',
+ data: userData
+ };
+ $http(request).then(function (user) {
+ var userData = {
+ username: user.config.data.email,
+ password: user.config.data.password
+ };
+ toastr.info('User ' + userData.username + ' Register Successful.');
+ loginUser(userData);
+ });//тук нямаме error функция, защото ще имаме глобален error handling
+
+ return deferred.promise;
+ }
+
+ function logout() {
+ delete sessionStorage['currentUser'];
+ delete sessionStorage['userProfile'];
+ $http.defaults.headers.common.Authorization = undefined;
+ toastr.info('Logout!', 'User successfully logout.');
+ removeUserProfile();
+ location.reload();
+ }
+
+ function isAuthenticated(){
+ return !!sessionStorage['currentUser'];
+ }
+
+ function isAnonymous(){
+ return (sessionStorage['currentUser'] == undefined);
+ }
+
+ function isLoggedIn(){
+ return sessionStorage['currentUser'] != undefined;
+ }
+
+ function refreshSessionStorage(){
+ //Проверявам ако имам currentUser в sessionStorage да го get-на
+ //след това правя втора заявка за да взема профила на текущия user
+ if(isAuthenticated()){
+ $http.defaults.headers.common.Authorization = 'Bearer ' + sessionStorage['currentUser'];
+ requestUserProfile();
+ }
+ }
+
+ function preserveUserData(data){
+ var accessToken = data.access_token;
+ //console.log(accessToken);
+ $http.defaults.headers.common.Authorization = 'Bearer ' + accessToken;
+ sessionStorage['currentUser'] = JSON.stringify(data);
+ }
+
+ function getCurrentUser() {
+ var differed = $q.defer();
+ if(currentUser){
+ return $q.when(currentUser);
+ } else {
+ return differed.promise;
+ }
+ }
+
+ function getCurrentUser111() {
+ var userObject = sessionStorage['currentUser'];
+ if (userObject) {
+ return JSON.parse(sessionStorage['currentUser']);
+ }
+ }
+
+ function removeUserProfile() {
+ currentUser = undefined;
+ userProfile = undefined;
+ }
+
+ function requestUserProfile() {
+ //Този deffer връща профила на user-a
+ var userProfileDeffered = $q.defer();
+ var request = {
+ method: 'GET',
+ url: BASE_URL + 'Users/me',
+ headers: {
+ Authorization: 'Bearer ' + JSON.parse(sessionStorage['currentUser']).access_token}
+ };
+ $http(request).then(function (responce) {
+ currentUser = responce.data;
+ userProfileDeffered.resolve();
+ userProfile = currentUser;
+ sessionStorage['userProfile'] = JSON.stringify(currentUser);
+ //console.log(userProfile.isAdmin);
+
+ });
+ return userProfileDeffered.promise;
+ }
+
+ function isNormalUser(){
+ return (currentUser!= undefined) && (userProfile.isAdmin);
+ }
+
+ function isAdmin(){
+ return JSON.parse(sessionStorage['userProfile']).isAdmin;
+ }
+
+ function changePassword(userData){
+ var request = {
+ method: 'POST',
+ url: BASE_URL + 'api/Account/changePassword',
+ data: userData,
+ headers: {Authorization: 'Bearer ' + JSON.parse(sessionStorage['currentUser']).access_token}
+ };
+ $http(request)
+ .then(function () {
+ toastr.info('Password changed successfully.');
+ $location.path('dashboard')
+ })
+ }
+
+ function getAllUsers(){
+ var users = $q.defer();
+ var request = {
+ method: 'GET',
+ url: BASE_URL + 'users/',
+ headers: {Authorization: 'Bearer ' + JSON.parse(sessionStorage['currentUser']).access_token}
+ };
+ $http(request)
+ .then(function(responce){
+ users.resolve(responce.data);
+ $rootScope.Users = responce.data;
+ //console.log(responce);
+ });
+ return users.promise;
+ }
+
+ function makeAdmin (userId){
+
+ //userId = userId || 'cbe9c46d-9150-42d9-a641-3c504b3043e9';
+ var request = {
+ method: 'PUT',
+ url: BASE_URL + 'users/makeadmin',
+ data: 'userId=' + userId,
+ headers: {
+ Authorization: 'Bearer ' + JSON.parse(sessionStorage['currentUser']).access_token,
+ 'Content-type': 'application/x-www-form-urlencoded'
+ }
+ };
+ console.log(request);
+ $http(request).then(function () {
+ toastr.info('User:' + currentUser.userName + 'changed to admin.')
+ }, function (error) {
+ toastr.error('Current user is admin.')
+ });
+ }
+
+ function getUserProfile(){
+ return JSON.parse(sessionStorage['userProfile']);
+ }
+
+ return {
+ loginUser: loginUser,
+ registerUser: registerUser,
+ logout: logout,
+ isAuthenticated: isAuthenticated,
+ isAnonymous: isAnonymous,
+ isLoggedIn: isLoggedIn,
+ refreshSessionStorage:refreshSessionStorage,
+ getCurrentUser: getCurrentUser,
+ removeUserProfile: removeUserProfile,
+ requestUserProfile: requestUserProfile,
+ isNormalUser: isNormalUser,
+ isAdmin: isAdmin,
+ changePassword: changePassword,
+ getAllUsers: getAllUsers,
+ makeAdmin: makeAdmin,
+ getUserProfile: getUserProfile
+ }
+ }]);
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048310_detail.js b/pool/shard007/JavaScript/0048310_detail.js
new file mode 100644
index 0000000000000000000000000000000000000000..898320eadcc2ec5f28445a8dcbdc072532b7844c
--- /dev/null
+++ b/pool/shard007/JavaScript/0048310_detail.js
@@ -0,0 +1,100 @@
+/*global define*/
+'use strict';
+
+/**
+ * The main controller for the app. The controller:
+ * - retrieves and persist the model via the todoStorage service
+ * - exposes the model to the template and provides event handlers
+ */
+
+define([
+ 'app'
+], function (app) {
+
+ return app.controller('ApplicationDetail', [
+ '$scope',
+ '$location',
+ '$http',
+ '$log',
+ '$q',
+ 'Restangular',
+ '$state',
+ '$stateParams',
+ 'Application',
+ function Controller($scope, $location, $http, $log, $q, Restangular, $state, $stateParams, Application) {
+
+ $log.info('te');
+
+ $scope.checked = [];
+
+ var id = $stateParams.applicationId;
+ $scope.application = Restangular.one('application', id).get().$object;
+ $scope.groups = Restangular.one('application', id).all('group').getList().$object;
+ $scope.versions = Restangular.one('application', id).all('version').getList().$object;
+ $scope.deploymentStrategies = Restangular.one('application', id).all('deployment_strategy').getList().$object;
+
+ console.log($scope.application);
+ console.log($scope.groups);
+
+ $scope.isDeleteGroupEnabled = false;
+ $scope.$watch('groups', function(newGroups, oldGroups) {
+
+ var hasCheckedItems = false;
+ for (var i = 0; i < newGroups.length; i++) {
+ if (newGroups[i].checked) hasCheckedItems = true;
+ }
+ $scope.isDeleteGroupEnabled = hasCheckedItems;
+
+ }, true);
+
+ $scope.deleteGroups = function () {
+
+ var pendingRemoval = [];
+ var removalPromises = [];
+ var i = $scope.groups.length;
+ while (i--) {
+ var group = $scope.groups[i];
+ if (group.checked) {
+ pendingRemoval.push(group);
+ removalPromises.push(group.remove());
+ }
+ };
+
+ $q.all(removalPromises).then(function() {
+ for (var key in pendingRemoval) {
+ $scope.groups.splice($scope.groups.indexOf(pendingRemoval[key]), 1);
+ }
+ }, function (reason) {
+ console.log('error occured: ' + reason);
+ }, function (progress) {
+ console.log('progress:' + progress);
+ });
+
+ };
+
+ $scope.rowClick = function (row) {
+
+ switch (row.route) {
+ case 'group':
+ $state.go('core.application.detail.group.detail.index', { groupId: row.id });
+ break;
+ case 'version':
+ $state.go('core.application.detail.version.detail', { versionId: row.id });
+ break;
+ case 'deployment_strategy':
+ $state.go('core.application.detail.deploymentStrategy.detail', { deploymentStrategyId: row.id });
+ break;
+ default:
+ throw new Exception('Unknown route');
+
+ }
+
+ console.log(row);
+
+ //$state.go('core.application.detail.index', { id: application.id });
+ };
+
+ }
+ ]);
+
+});
diff --git a/pool/shard007/JavaScript/0048319_elm.js b/pool/shard007/JavaScript/0048319_elm.js
new file mode 100644
index 0000000000000000000000000000000000000000..7a0b5e125ce9e4f7bdf83da7eadca5481c9b920a
--- /dev/null
+++ b/pool/shard007/JavaScript/0048319_elm.js
@@ -0,0 +1,9 @@
+ace.define("ace/snippets/elm",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="",t.scope="elm"});
+ (function() {
+ ace.require(["ace/snippets/elm"], function(m) {
+ if (typeof module == "object" && typeof exports == "object" && module) {
+ module.exports = m;
+ }
+ });
+ })();
+
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048320_controllers.js b/pool/shard007/JavaScript/0048320_controllers.js
new file mode 100644
index 0000000000000000000000000000000000000000..10d519490288f478300c70d6e70500e3cd3796a2
--- /dev/null
+++ b/pool/shard007/JavaScript/0048320_controllers.js
@@ -0,0 +1,52 @@
+/*
+ * Spreed WebRTC.
+ * Copyright (C) 2013-2014 struktur AG
+ *
+ * This file is part of Spreed WebRTC.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+"use strict";
+define([
+ 'underscore',
+
+ 'controllers/mediastreamcontroller',
+ 'controllers/statusmessagecontroller',
+ 'controllers/chatroomcontroller',
+ 'controllers/usersettingscontroller',
+ 'controllers/contactsmanagercontroller',
+ 'controllers/contactsmanagereditcontroller'], function(_, MediastreamController, StatusmessageController, ChatroomController, UsersettingsController, ContactsmanagerController, ContactsmanagereditController) {
+
+ var controllers = {
+ MediastreamController: MediastreamController,
+ StatusmessageController: StatusmessageController,
+ ChatroomController: ChatroomController,
+ UsersettingsController: UsersettingsController,
+ ContactsmanagerController: ContactsmanagerController,
+ ContactsmanagereditController: ContactsmanagereditController
+ };
+
+ var initialize = function(angModule) {
+ _.each(controllers, function(controller, name) {
+ angModule.controller(name, controller);
+ })
+ }
+
+ return {
+ initialize: initialize
+ };
+
+});
diff --git a/pool/shard007/JavaScript/0048321_test.js b/pool/shard007/JavaScript/0048321_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..da167bd7a4cb6a48733bb4f1e9976aa9a72d09d1
--- /dev/null
+++ b/pool/shard007/JavaScript/0048321_test.js
@@ -0,0 +1,15 @@
+var test = require('tape');
+var isFunction = require('./is-function');
+
+
+test('amp-is-function', function (t) {
+ t.ok(!isFunction(undefined), 'undefined vars are not functions');
+ t.ok(!isFunction([1, 2, 3]), 'arrays are not functions');
+ t.ok(!isFunction('moe'), 'strings are not functions');
+ if (typeof document !== 'undefined') {
+ t.ok(!isFunction(document.createElement('div')), 'elements are not functions');
+ }
+ t.ok(isFunction(isFunction), 'but functions are');
+ t.ok(isFunction(function(){}), 'even anonymous ones');
+ t.end();
+});
diff --git a/pool/shard007/JavaScript/0048324_20161020_224328_user.isSuspended.migrate.js b/pool/shard007/JavaScript/0048324_20161020_224328_user.isSuspended.migrate.js
new file mode 100644
index 0000000000000000000000000000000000000000..7afdf80a3359a57d2eaed633d9ea8b3b6b4524b1
--- /dev/null
+++ b/pool/shard007/JavaScript/0048324_20161020_224328_user.isSuspended.migrate.js
@@ -0,0 +1,11 @@
+exports.up = function(models) {
+ // write your migrate
+ return models.users.find({isSuspended:{$exists:false}}).then(function(users) {
+ var promises = []
+ users.forEach(function(user) {
+ user.isSuspended = !!user.isSuspended
+ promises.push(user.save())
+ })
+ return Promise.all(promises)
+ })
+}
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048327_addComments.js b/pool/shard007/JavaScript/0048327_addComments.js
new file mode 100644
index 0000000000000000000000000000000000000000..26c456fc3011b8a2d6adae0e32e2a6e366a7b530
--- /dev/null
+++ b/pool/shard007/JavaScript/0048327_addComments.js
@@ -0,0 +1,23 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = addComments;
+
+function addComments(node, type, comments) {
+ if (!comments || !node) return node;
+ const key = `${type}Comments`;
+
+ if (node[key]) {
+ if (type === "leading") {
+ node[key] = comments.concat(node[key]);
+ } else {
+ node[key].push(...comments);
+ }
+ } else {
+ node[key] = comments;
+ }
+
+ return node;
+}
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048330_adduri.js b/pool/shard007/JavaScript/0048330_adduri.js
new file mode 100644
index 0000000000000000000000000000000000000000..a799b84a3097ea1eeebf3b315293513a550ee454
--- /dev/null
+++ b/pool/shard007/JavaScript/0048330_adduri.js
@@ -0,0 +1,22 @@
+
+
+
+var fs = require('fs');
+
+
+var u = fs.readFileSync('sensitive/bom.data.json');
+
+var data = JSON.parse(u);
+
+
+fs.writeFileSync('sensitive/bom.data.u.json', JSON.stringify(data,undefined,2));
+
+data.forEach(function(rec) {
+ if(rec.appId && rec.releaseId) {
+ rec.uri = `https://fioriappslibrary.hana.ondemand.com/sap/fix/externalViewer/#/detail/Apps('${rec.appId}')/${rec.releaseId}`;
+ } else {
+ delete rec.uri;
+ }
+});
+
+fs.writeFileSync('sensitive/bom.data.uri0.json', JSON.stringify(data,undefined,2));
diff --git a/pool/shard007/JavaScript/0048332_errors.js b/pool/shard007/JavaScript/0048332_errors.js
new file mode 100644
index 0000000000000000000000000000000000000000..b099274a2b23a09bd2b3cfaaf7d34d2c699a9f94
--- /dev/null
+++ b/pool/shard007/JavaScript/0048332_errors.js
@@ -0,0 +1,26 @@
+import React from 'react';
+
+import { shallow } from 'enzyme';
+
+import { ErrorList, Error } from 'widgets/errors';
+
+test('Error render', () => {
+ let error = shallow( );
+ expect(error.text()).toBe('FOO: BAR');
+ let li = error.find('li.error');
+ expect(li.length).toBe(1);
+});
+
+test('ErrorList render', () => {
+ let errors = shallow( );
+ expect(errors.text()).toBe('');
+ expect(errors.find('ul').length).toBe(0);
+ errors = shallow(
+ ,
+ );
+ let ul = errors.find('ul.errors');
+ expect(ul.length).toBe(1);
+ let lis = ul.find(Error);
+ expect(lis.length).toBe(2);
+ expect(errors.text()).toBe(' ');
+});
diff --git a/pool/shard007/JavaScript/0048333_Body.js b/pool/shard007/JavaScript/0048333_Body.js
new file mode 100644
index 0000000000000000000000000000000000000000..55684867b2db9f5351ebd5c8d086f159291b2bb9
--- /dev/null
+++ b/pool/shard007/JavaScript/0048333_Body.js
@@ -0,0 +1,61 @@
+/** @jsx React.DOM */
+
+'use strict';
+
+var React = require('react');
+var ReactCanvas = require('react-canvas');
+var Group = ReactCanvas.Group;
+var tweenState = require('react-tween-state');
+var Image = ReactCanvas.Image;
+var Body = React.createClass({
+ mixins: [tweenState.Mixin],
+ getInitialState: function () {
+ this.w = 1070*this.props.widthRatio;
+ this.h = 917*this.props.heightRatio;
+ return {
+ bodyTop:this.props.height/2-this.h
+ };
+ },
+ componentWillMount: function() {
+ console.log('body componentWillMount');
+ },
+ componentDidUpdate:function(){
+ console.log('body update',this.props.scrollTop,this.firstTime);
+ if (this.props.scrollTop == 0 && this.firstTime == true) {
+ var self = this;
+ this.firstTime = false;
+ console.log('This is Body call tweenState');
+ this.tweenState('bodyTop', {
+ easing: tweenState.easingTypes.easeInOutQuad,
+ duration: 2000,
+ delay: 50,
+ endValue: this.props.height / 2 - this.h / 4
+ });
+ }
+ },
+ componentDidMount: function() {
+ this.firstTime = true;
+ },
+ render: function() {
+ console.log('this is body rendering');
+ var imageStyle = this.getImageStyle();
+ return (
+
+ );
+ },
+
+ // Styles
+ // ======
+
+ getImageStyle: function () {
+ return {
+ top: this.getTweeningValue('bodyTop'),
+ left: this.props.width/2-this.w/2,
+ width: this.w,
+ height: this.h,
+ zIndex: 3,
+ };
+ }
+});
+
+module.exports = Body;
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048334_TermNode.js b/pool/shard007/JavaScript/0048334_TermNode.js
new file mode 100644
index 0000000000000000000000000000000000000000..dfd1d49ca474ba4e1a580a461aa11e1228aeeb01
--- /dev/null
+++ b/pool/shard007/JavaScript/0048334_TermNode.js
@@ -0,0 +1,168 @@
+// Copyright 2018-2021, University of Colorado Boulder
+
+/**
+ * Abstract base type for displaying a term.
+ *
+ * @author Chris Malley (PixelZoom, Inc.)
+ */
+
+import Dimension2 from '../../../../dot/js/Dimension2.js';
+import merge from '../../../../phet-core/js/merge.js';
+import { Circle } from '../../../../scenery/js/imports.js';
+import { Node } from '../../../../scenery/js/imports.js';
+import equalityExplorer from '../../equalityExplorer.js';
+import CombineTermsDragListener from './CombineTermsDragListener.js';
+import HaloNode from './HaloNode.js';
+import SeparateTermsDragListener from './SeparateTermsDragListener.js';
+
+// constants
+const DEFAULT_SHADOW_OFFSET = new Dimension2( 4, 4 );
+
+class TermNode extends Node {
+
+ /**
+ * @param {TermCreator} termCreator
+ * @param {Term} term
+ * @param {Node} contentNode
+ * @param {Node} shadowNode
+ * @param {Object} [options]
+ * @abstract
+ */
+ constructor( termCreator, term, contentNode, shadowNode, options ) {
+
+ options = merge( {
+ shadowOffset: DEFAULT_SHADOW_OFFSET,
+
+ // Node options
+ cursor: 'pointer'
+ }, options );
+
+ contentNode.centerX = 0;
+ contentNode.centerY = 0;
+ shadowNode.right = contentNode.right + options.shadowOffset.width;
+ shadowNode.bottom = contentNode.bottom + options.shadowOffset.height;
+
+ // halo around the content
+ const haloRadius = Math.max( contentNode.width, contentNode.height );
+ const haloNode = new HaloNode( haloRadius, {
+ center: contentNode.center,
+ visible: false
+ } );
+
+ assert && assert( !options.children, 'TermNode sets children' );
+ options.children = [ haloNode, shadowNode, contentNode ];
+
+ // Red dot at the origin
+ if ( phet.chipper.queryParameters.dev ) {
+ options.children.push( new Circle( 2, { fill: 'red' } ) );
+ }
+
+ super( options );
+
+ // @public (read-only)
+ this.term = term;
+
+ // @public (read-only)
+ this.contentNodeSize = new Dimension2( contentNode.width, contentNode.height );
+
+ // Move to position
+ const positionObserver = position => {
+ this.center = position;
+ };
+ term.positionProperty.link( positionObserver ); // unlink required in dispose
+
+ // Pickable (interactivity)
+ const pickableListener = pickable => {
+ this.pickable = pickable;
+ };
+ term.pickableProperty.link( pickableListener ); // unlink required in dispose
+
+ // Whether the term is on a plate determines its rendering order
+ const onPlateListener = onPlate => {
+ if ( onPlate ) {
+ this.moveToBack();
+ }
+ else {
+ this.moveToFront();
+ }
+ };
+ term.onPlateProperty.link( onPlateListener ); // unlink required in dispose
+
+ // Show/hide shadow
+ const shadowVisibleListener = shadowVisible => {
+ shadowNode.visible = shadowVisible;
+ };
+ term.shadowVisibleProperty.link( shadowVisibleListener ); // unlink required in dispose
+
+ // Show/hide halo
+ const haloVisibleListener = haloVisible => {
+ haloNode.visible = haloVisible;
+ };
+ term.haloVisibleProperty.link( haloVisibleListener ); // unlink required in dispose
+
+ const dragListenerOptions = {
+ haloRadius: haloRadius
+ };
+
+ // @private dispose required
+ if ( termCreator.combineLikeTermsEnabled ) {
+ this.termDragListener = new CombineTermsDragListener( this, term, termCreator, dragListenerOptions );
+ }
+ else {
+ this.termDragListener = new SeparateTermsDragListener( this, term, termCreator, dragListenerOptions );
+ }
+ this.addInputListener( this.termDragListener ); // removeListener required in dispose
+
+ // @private
+ this.disposeTermNode = () => {
+
+ if ( term.positionProperty.hasListener( positionObserver ) ) {
+ term.positionProperty.unlink( positionObserver );
+ }
+
+ if ( term.pickableProperty.hasListener( pickableListener ) ) {
+ term.pickableProperty.unlink( pickableListener );
+ }
+
+ if ( term.onPlateProperty.hasListener( onPlateListener ) ) {
+ term.onPlateProperty.unlink( onPlateListener );
+ }
+
+ if ( term.shadowVisibleProperty.hasListener( shadowVisibleListener ) ) {
+ term.haloVisibleProperty.unlink( shadowVisibleListener );
+ }
+
+ if ( term.shadowVisibleProperty.hasListener( haloVisibleListener ) ) {
+ term.haloVisibleProperty.unlink( haloVisibleListener );
+ }
+
+ this.removeInputListener( this.termDragListener );
+ this.termDragListener.dispose();
+ };
+ }
+
+ /**
+ * @public
+ * @override
+ */
+ dispose() {
+ this.disposeTermNode();
+ super.dispose();
+ }
+
+ /**
+ * Starts a drag cycle.
+ * The user drags a new term out of a toolbox below the scale by clicking on a TermCreatorNode.
+ * That action causes TermCreatorNode to instantiate a TermNode. This function allows
+ * TermCreatorNode to forward the startDrag event to the TermNode that it created.
+ * @param {SceneryEvent} event
+ * @public
+ */
+ startDrag( event ) {
+ this.termDragListener.press( event );
+ }
+}
+
+equalityExplorer.register( 'TermNode', TermNode );
+
+export default TermNode;
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048336_nosy.js b/pool/shard007/JavaScript/0048336_nosy.js
new file mode 100644
index 0000000000000000000000000000000000000000..a916085ce32d789beeb5808522be687784d2be1d
--- /dev/null
+++ b/pool/shard007/JavaScript/0048336_nosy.js
@@ -0,0 +1,44 @@
+var EventEmitter = require('events').EventEmitter,
+ util = require('util'),
+ FeedSub = require('feedsub'),
+ _ = require('underscore');
+
+var Nosy = module.exports = function(feeds, options) {
+ this.readers = [];
+ var self = this,
+ genFeedSub = function(feed) {
+ var reader = new FeedSub(feeds[i].url, options);
+ reader.on('item', function(item) {
+ self.emit('item', _.extend(item, {
+ category: feed.category,
+ publisher: feed.publisher
+ }));
+ });
+ reader.on('items', function(items) {
+ self.emit('items', items);
+ });
+ reader.on('error', function(err) {
+ self.emit('error', err);
+ });
+ return reader;
+ };
+
+ for (var i in feeds) {
+ var reader = genFeedSub(feeds[i]);
+ this.readers.push(reader);
+ }
+}
+
+util.inherits(Nosy, EventEmitter);
+
+Nosy.prototype.start = function() {
+ for (var i in this.readers) {
+ this.readers[i].start();
+ }
+}
+
+Nosy.prototype.stop = function() {
+ for (var i in this.readers) {
+ this.readers[i].stop();
+ }
+}
diff --git a/pool/shard007/JavaScript/0048338_xhr.js b/pool/shard007/JavaScript/0048338_xhr.js
new file mode 100644
index 0000000000000000000000000000000000000000..36239ea9ec82716d5e7982ad9f3f04c3a724bd49
--- /dev/null
+++ b/pool/shard007/JavaScript/0048338_xhr.js
@@ -0,0 +1,316 @@
+define([
+ '../errors/RequestError',
+ './watch',
+ './handlers',
+ './util',
+ '../has'/*=====,
+ '../request',
+ '../_base/declare' =====*/
+], function(RequestError, watch, handlers, util, has/*=====, request, declare =====*/){
+ has.add('native-xhr', function(){
+ // if true, the environment has a native XHR implementation
+ return typeof XMLHttpRequest !== 'undefined';
+ });
+ has.add('dojo-force-activex-xhr', function(){
+ return has('activex') && !document.addEventListener && window.location.protocol === 'file:';
+ });
+
+ has.add('native-xhr2', function(){
+ if(!has('native-xhr')){ return; }
+ var x = new XMLHttpRequest();
+ return typeof x['addEventListener'] !== 'undefined' &&
+ (typeof opera === 'undefined' || typeof x['upload'] !== 'undefined');
+ });
+
+ has.add('native-formdata', function(){
+ // if true, the environment has a native FormData implementation
+ return typeof FormData !== 'undefined';
+ });
+
+ function handleResponse(response, error){
+ var _xhr = response.xhr;
+ response.status = response.xhr.status;
+ response.text = _xhr.responseText;
+
+ if(response.options.handleAs === 'xml'){
+ response.data = _xhr.responseXML;
+ }
+
+ if(!error){
+ try{
+ handlers(response);
+ }catch(e){
+ error = e;
+ }
+ }
+
+ if(error){
+ this.reject(error);
+ }else if(util.checkStatus(_xhr.status)){
+ this.resolve(response);
+ }else{
+ error = new RequestError('Unable to load ' + response.url + ' status: ' + _xhr.status, response);
+
+ this.reject(error);
+ }
+ }
+
+ var isValid, isReady, addListeners, cancel;
+ if(has('native-xhr2')){
+ // Any platform with XHR2 will only use the watch mechanism for timeout.
+
+ isValid = function(response){
+ // summary:
+ // Check to see if the request should be taken out of the watch queue
+ return !this.isFulfilled();
+ };
+ cancel = function(dfd, response){
+ // summary:
+ // Canceler for deferred
+ response.xhr.abort();
+ };
+ addListeners = function(_xhr, dfd, response){
+ // summary:
+ // Adds event listeners to the XMLHttpRequest object
+ function onLoad(evt){
+ dfd.handleResponse(response);
+ }
+ function onError(evt){
+ var _xhr = evt.target;
+ var error = new RequestError('Unable to load ' + response.url + ' status: ' + _xhr.status, response);
+ dfd.handleResponse(response, error);
+ }
+
+ function onProgress(evt){
+ if(evt.lengthComputable){
+ response.loaded = evt.loaded;
+ response.total = evt.total;
+ dfd.progress(response);
+ }
+ }
+
+ _xhr.addEventListener('load', onLoad, false);
+ _xhr.addEventListener('error', onError, false);
+ _xhr.addEventListener('progress', onProgress, false);
+
+ return function(){
+ _xhr.removeEventListener('load', onLoad, false);
+ _xhr.removeEventListener('error', onError, false);
+ _xhr.removeEventListener('progress', onProgress, false);
+ _xhr = null;
+ };
+ };
+ }else{
+ isValid = function(response){
+ return response.xhr.readyState; //boolean
+ };
+ isReady = function(response){
+ return 4 === response.xhr.readyState; //boolean
+ };
+ cancel = function(dfd, response){
+ // summary:
+ // canceller function for util.deferred call.
+ var xhr = response.xhr;
+ var _at = typeof xhr.abort;
+ if(_at === 'function' || _at === 'object' || _at === 'unknown'){
+ xhr.abort();
+ }
+ };
+ }
+
+ function getHeader(headerName){
+ return this.xhr.getResponseHeader(headerName);
+ }
+
+ var undefined,
+ defaultOptions = {
+ data: null,
+ query: null,
+ sync: false,
+ method: 'GET'
+ };
+ function xhr(url, options, returnDeferred){
+ var response = util.parseArgs(
+ url,
+ util.deepCreate(defaultOptions, options),
+ has('native-formdata') && options && options.data && options.data instanceof FormData
+ );
+ url = response.url;
+ options = response.options;
+
+ var remover,
+ last = function(){
+ remover && remover();
+ };
+
+ //Make the Deferred object for this xhr request.
+ var dfd = util.deferred(
+ response,
+ cancel,
+ isValid,
+ isReady,
+ handleResponse,
+ last
+ );
+ var _xhr = response.xhr = xhr._create();
+
+ if(!_xhr){
+ // If XHR factory somehow returns nothings,
+ // cancel the deferred.
+ dfd.cancel(new RequestError('XHR was not created'));
+ return returnDeferred ? dfd : dfd.promise;
+ }
+
+ response.getHeader = getHeader;
+
+ if(addListeners){
+ remover = addListeners(_xhr, dfd, response);
+ }
+
+ var data = options.data,
+ async = !options.sync,
+ method = options.method;
+
+ try{
+ // IE6 won't let you call apply() on the native function.
+ _xhr.open(method, url, async, options.user || undefined, options.password || undefined);
+
+ if(options.withCredentials){
+ _xhr.withCredentials = options.withCredentials;
+ }
+
+ var headers = options.headers,
+ contentType = 'application/x-www-form-urlencoded';
+ if(headers){
+ for(var hdr in headers){
+ if(hdr.toLowerCase() === 'content-type'){
+ contentType = headers[hdr];
+ }else if(headers[hdr]){
+ //Only add header if it has a value. This allows for instance, skipping
+ //insertion of X-Requested-With by specifying empty value.
+ _xhr.setRequestHeader(hdr, headers[hdr]);
+ }
+ }
+ }
+
+ if(contentType && contentType !== false){
+ _xhr.setRequestHeader('Content-Type', contentType);
+ }
+ if(!headers || !('X-Requested-With' in headers)){
+ _xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+ }
+
+ if(util.notify){
+ util.notify.emit('send', response, dfd.promise.cancel);
+ }
+ _xhr.send(data);
+ }catch(e){
+ dfd.reject(e);
+ }
+
+ watch(dfd);
+ _xhr = null;
+
+ return returnDeferred ? dfd : dfd.promise;
+ }
+
+ /*=====
+ xhr = function(url, options){
+ // summary:
+ // Sends a request using XMLHttpRequest with the given URL and options.
+ // url: String
+ // URL to request
+ // options: dojo/request/xhr.__Options?
+ // Options for the request.
+ // returns: dojo/request.__Promise
+ };
+ xhr.__BaseOptions = declare(request.__BaseOptions, {
+ // sync: Boolean?
+ // Whether to make a synchronous request or not. Default
+ // is `false` (asynchronous).
+ // data: String|Object|FormData?
+ // Data to transfer. This is ignored for GET and DELETE
+ // requests.
+ // headers: Object?
+ // Headers to use for the request.
+ // user: String?
+ // Username to use during the request.
+ // password: String?
+ // Password to use during the request.
+ // withCredentials: Boolean?
+ // For cross-site requests, whether to send credentials
+ // or not.
+ });
+ xhr.__MethodOptions = declare(null, {
+ // method: String?
+ // The HTTP method to use to make the request. Must be
+ // uppercase. Default is `"GET"`.
+ });
+ xhr.__Options = declare([xhr.__BaseOptions, xhr.__MethodOptions]);
+
+ xhr.get = function(url, options){
+ // summary:
+ // Send an HTTP GET request using XMLHttpRequest with the given URL and options.
+ // url: String
+ // URL to request
+ // options: dojo/request/xhr.__BaseOptions?
+ // Options for the request.
+ // returns: dojo/request.__Promise
+ };
+ xhr.post = function(url, options){
+ // summary:
+ // Send an HTTP POST request using XMLHttpRequest with the given URL and options.
+ // url: String
+ // URL to request
+ // options: dojo/request/xhr.__BaseOptions?
+ // Options for the request.
+ // returns: dojo/request.__Promise
+ };
+ xhr.put = function(url, options){
+ // summary:
+ // Send an HTTP PUT request using XMLHttpRequest with the given URL and options.
+ // url: String
+ // URL to request
+ // options: dojo/request/xhr.__BaseOptions?
+ // Options for the request.
+ // returns: dojo/request.__Promise
+ };
+ xhr.del = function(url, options){
+ // summary:
+ // Send an HTTP DELETE request using XMLHttpRequest with the given URL and options.
+ // url: String
+ // URL to request
+ // options: dojo/request/xhr.__BaseOptions?
+ // Options for the request.
+ // returns: dojo/request.__Promise
+ };
+ =====*/
+ xhr._create = function(){
+ // summary:
+ // does the work of portably generating a new XMLHTTPRequest object.
+ throw new Error('XMLHTTP not available');
+ };
+ if(has('native-xhr') && !has('dojo-force-activex-xhr')){
+ xhr._create = function(){
+ return new XMLHttpRequest();
+ };
+ }else if(has('activex')){
+ try{
+ new ActiveXObject('Msxml2.XMLHTTP');
+ xhr._create = function(){
+ return new ActiveXObject('Msxml2.XMLHTTP');
+ };
+ }catch(e){
+ try{
+ new ActiveXObject('Microsoft.XMLHTTP');
+ xhr._create = function(){
+ return new ActiveXObject('Microsoft.XMLHTTP');
+ };
+ }catch(e){}
+ }
+ }
+
+ util.addCommonMethods(xhr);
+
+ return xhr;
+});
diff --git a/pool/shard007/JavaScript/0048341_console.js b/pool/shard007/JavaScript/0048341_console.js
new file mode 100644
index 0000000000000000000000000000000000000000..2e0d241825c3d5400653d40073c7a167629a108f
--- /dev/null
+++ b/pool/shard007/JavaScript/0048341_console.js
@@ -0,0 +1,30 @@
+var couchapp = require('couchapp'),
+ path = require('path'),
+ fs = require('fs'),
+ ddoc;
+
+ddoc = {
+ _id: '_design/console', views: {}, lists: {}, shows: {}, sp_config : {}
+};
+
+module.exports = ddoc;
+
+ddoc.views.byType = {
+ map: function(doc) {
+ if (doc.type) emit([doc.type, doc.state])
+ },
+ reduce: '_count'
+}
+
+ddoc.views.apps = {
+ map: function(doc) {
+ if(doc.type == 'app') {
+ emit(doc.name);
+ }
+ }
+}
+
+
+// ddoc.validate_doc_update = function (newDoc, oldDoc, userCtx) {}
+
+couchapp.loadAttachments(ddoc, path.join(__dirname, "console"));
diff --git a/pool/shard007/JavaScript/0048342_game-logs-import.socket.js b/pool/shard007/JavaScript/0048342_game-logs-import.socket.js
new file mode 100644
index 0000000000000000000000000000000000000000..c642a9977181a241748a2ad1757c399bf3c10d35
--- /dev/null
+++ b/pool/shard007/JavaScript/0048342_game-logs-import.socket.js
@@ -0,0 +1,24 @@
+/**
+ * Broadcast updates to client when the model changes
+ */
+
+'use strict';
+
+var GameLogsImport = require('./game-logs-import.model');
+
+exports.register = function(socket) {
+ GameLogsImport.schema.post('save', function (doc) {
+ onSave(socket, doc);
+ });
+ GameLogsImport.schema.post('remove', function (doc) {
+ onRemove(socket, doc);
+ });
+}
+
+function onSave(socket, doc, cb) {
+ socket.emit('game-logs-import:save', doc);
+}
+
+function onRemove(socket, doc, cb) {
+ socket.emit('game-logs-import:remove', doc);
+}
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048344_create-session.js b/pool/shard007/JavaScript/0048344_create-session.js
new file mode 100644
index 0000000000000000000000000000000000000000..d5120955568d8cab139af3b594a31c7880c3fcdc
--- /dev/null
+++ b/pool/shard007/JavaScript/0048344_create-session.js
@@ -0,0 +1,27 @@
+const Session = require('../../lib/session');
+const generateUniqueId = require('../../lib/utils/generate-unique-id');
+
+function createSession () {
+ const opts = {
+ allowMultipleWindows: !!global.process.env.allowMultipleWindows
+ };
+
+ if (opts.allowMultipleWindows)
+ opts.windowId = generateUniqueId();
+
+ const session = new Session(['test/playground/upload-storage'], opts);
+
+ session.getIframePayloadScript = async () => '';
+ session.getPayloadScript = async () => '';
+ session.getAuthCredentials = () => ({});
+ session.handleFileDownload = () => void 0;
+ session.handleAttachment = () => void 0;
+ session.handlePageError = (ctx, err) => {
+ console.error(ctx.req.url);
+ console.error(err);
+ };
+
+ return session;
+}
+
+module.exports = createSession;
diff --git a/pool/shard007/JavaScript/0048348_raw_destroy.js b/pool/shard007/JavaScript/0048348_raw_destroy.js
new file mode 100644
index 0000000000000000000000000000000000000000..2bf23daa0095f155a86c535d83abe421dcd8e0d1
--- /dev/null
+++ b/pool/shard007/JavaScript/0048348_raw_destroy.js
@@ -0,0 +1,46 @@
+var test = require('tap').test;
+var bouncy = require('../');
+var net = require('net');
+var EventEmitter = require('events').EventEmitter;
+
+test('destroy the socket during piping', function (t) {
+ t.plan(2);
+
+ var p0 = Math.floor(Math.random() * (Math.pow(2,16) - 1e4) + 1e4);
+ var p1 = Math.floor(Math.random() * (Math.pow(2,16) - 1e4) + 1e4);
+
+ var s0 = bouncy(function (req, bounce) {
+ t.equal(req.headers.host, 'lulzy');
+
+ var c = net.createConnection(p1, function () {
+ bounce(c);
+ });
+ });
+
+ s0.listen(p0, function () {
+ var c = net.createConnection(p0, function () {
+ c.write('POST /lul HTTP/1.1\r\n');
+ c.write('Host: lulzy\r\n');
+ c.write('Foo: bar\r\n');
+ c.write('Content-Length: 7\r\n');
+ c.write('\r\n');
+
+ setTimeout(function () {
+ t.throws(function () {
+ c.write('a=3&b=4');
+ });
+ c.end();
+ s0.close();
+ s1.close();
+ t.end();
+ }, 50);
+ });
+ });
+
+ var s1 = net.createServer(function (c) {
+ setTimeout(function () {
+ c.destroy();
+ }, 20);
+ });
+ s1.listen(p1);
+});
diff --git a/pool/shard007/JavaScript/0048351_LoadingUI.js b/pool/shard007/JavaScript/0048351_LoadingUI.js
new file mode 100644
index 0000000000000000000000000000000000000000..7611d2403ad4cfb77456e550a1f818bb74cd48f6
--- /dev/null
+++ b/pool/shard007/JavaScript/0048351_LoadingUI.js
@@ -0,0 +1,50 @@
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2014-2015, Egret Technology Inc.
+// All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// * Neither the name of the Egret nor the
+// names of its contributors may be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+// IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
+// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+//////////////////////////////////////////////////////////////////////////////////////
+var LoadingUI = (function (_super) {
+ __extends(LoadingUI, _super);
+ function LoadingUI() {
+ _super.call(this);
+ this.createView();
+ }
+ var __egretProto__ = LoadingUI.prototype;
+ __egretProto__.createView = function () {
+ this.textField = new egret.TextField();
+ this.addChild(this.textField);
+ this.textField.y = 300;
+ this.textField.width = 480;
+ this.textField.height = 100;
+ this.textField.textAlign = "center";
+ };
+ __egretProto__.setProgress = function (current, total) {
+ //显示进度
+ this.textField.text = "Loading..." + current + "/" + total;
+ };
+ return LoadingUI;
+})(egret.Sprite);
+LoadingUI.prototype.__class__ = "LoadingUI";
diff --git a/pool/shard007/JavaScript/0048353_route.js b/pool/shard007/JavaScript/0048353_route.js
new file mode 100644
index 0000000000000000000000000000000000000000..1b8afec5e103472be04ee2efe97866f0ea0f0adc
--- /dev/null
+++ b/pool/shard007/JavaScript/0048353_route.js
@@ -0,0 +1,85 @@
+import { inject as service } from '@ember/service';
+import EmberObject, { set, get } from '@ember/object';
+import { isEmpty } from '@ember/utils';
+import { t } from 'hospitalrun/macro';
+import AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';
+import ChargeRoute from 'hospitalrun/mixins/charge-route';
+import PatientListRoute from 'hospitalrun/mixins/patient-list-route';
+import PatientVisit from 'hospitalrun/mixins/patient-visits';
+import DS from 'ember-data';
+
+export default AbstractEditRoute.extend(ChargeRoute, PatientListRoute, PatientVisit, {
+ customForms: service(),
+ editTitle: t('visits.titles.editVisit'),
+ modelName: 'visit',
+ newTitle: t('visits.titles.newVisit'),
+ pricingCategory: 'Ward',
+ photos: null,
+
+ model(params) {
+ let idParam = get(this, 'idParam');
+ if (!isEmpty(idParam) && params[idParam] === 'checkin') {
+ return this.getNewData().then((newData) => {
+ newData.checkIn = true;
+ let newVisit = get(this, 'store').createRecord('visit', newData);
+ return newVisit;
+ });
+ } else {
+ return this._super(params);
+ }
+ },
+
+ getNewData() {
+ let newVisitData = {
+ startDate: new Date(),
+ visitType: 'Admission',
+ customForms: EmberObject.create()
+ };
+ let customForms = this.get('customForms');
+ return customForms.setDefaultCustomForms(['visit'], newVisitData);
+ },
+
+ getScreenTitle(model) {
+ if (model.get('checkIn')) {
+ return this.get('intl').t('visits.titles.patientCheckIn');
+ } else {
+ return this._super(model);
+ }
+ },
+
+ setupController(controller, model) {
+ let promise = this.store.query('report', {
+ options: {
+ key: get(model, 'id')
+ },
+ mapReduce: 'report_by_visit'
+ }).then((reports) => {
+ set(controller, 'noReport', isEmpty(reports));
+ return isEmpty(reports) ? '' : get(reports, 'firstObject');
+ });
+ set(controller, 'report', DS.PromiseObject.create({ promise }));
+ this._super(controller, model);
+ this.store.query('photo', {
+ options: {
+ key: get(model, 'id')
+ },
+ mapReduce: 'photo_by_visit'
+ }).then(function(photos) {
+ let visitPhotos = [];
+ visitPhotos.addObjects(photos);
+ model.set('photos', visitPhotos);
+ });
+ },
+
+ actions: {
+ updateNote() {
+ this.controller.send('update', true);
+ },
+ deletePatientNote(model) {
+ this.controller.send('deletePatientNote', model);
+ },
+ deletePhoto(model) {
+ this.controller.send('deletePhoto', model);
+ }
+ }
+});
diff --git a/pool/shard007/JavaScript/0048356_js.js b/pool/shard007/JavaScript/0048356_js.js
new file mode 100644
index 0000000000000000000000000000000000000000..f30499296a4dd1445fec366a6f17d35726f27992
--- /dev/null
+++ b/pool/shard007/JavaScript/0048356_js.js
@@ -0,0 +1,112 @@
+/* global document */
+
+class GeoMap {
+ constructor () {
+ this.ele = {
+ mapBox: document.querySelector('.map'),
+
+ refreshBtn: document.querySelector('.map-refresh'),
+ axisAX: document.querySelector('.axis-ax'),
+ axisAY: document.querySelector('.axis-ay'),
+
+ axisBX: document.querySelector('.axis-bx'),
+ axisBY: document.querySelector('.axis-by'),
+
+ pointA: document.querySelector('.point--a'),
+ pointB: document.querySelector('.point--b')
+ };
+
+ this.latLng = {};
+ this.mapZoom = 17;
+ this.mapSize = 600;
+ this.key = 'AIzaSyCjDnDGv67nvhzBsLRYAwTbiF1HrZBQDUM';
+ }
+
+ getGeoFallback () {
+ console.log(111111);
+
+ let _lat = window.prompt('Can\'t find geo-location automatically, please fill with latitude(lat)', '25.0327429');
+ let _lng = window.prompt('Can\'t find geo-location automatically, please fill with longitude(lng)', '121.5668311');
+
+ this.latLng.lat = parseFloat(_lat) || 25.0327429;
+ this.latLng.lng = parseFloat(_lng) || 121.5668311;
+
+ return this.latLng;
+ }
+
+ getGeo () {
+ let self = this;
+ return new Promise(function (resolve, reject) {
+ if ('geolocation' in navigator) {
+ navigator.geolocation.getCurrentPosition((position) => {
+ resolve({
+ lat: position.coords.latitude,
+ lng: position.coords.longitude
+ });
+ }, () => {
+ resolve(self.getGeoFallback());
+ });
+ } else {
+ resolve(this.getGeoFallback());
+ }
+ });
+ }
+
+ getGmapImgSrc (latLng = this.latLng, zoom = this.mapZoom, size = this.mapSize) {
+ return `https://maps.googleapis.com/maps/api/staticmap?center=${latLng.lat},${latLng.lng}&zoom=${zoom}&size=${size}x${size}&markers=${latLng.lat},${latLng.lng}&key=${this.key}`;
+ }
+
+ setEleBgi (ele, bgiSrc) {
+ ele.style.backgroundImage = `url('${bgiSrc}')`;
+ }
+
+ updateBgi () {
+ this.getGeo()
+ .then((latLng) => {
+ this.setEleBgi(this.ele.mapBox, this.getGmapImgSrc(latLng));
+ });
+ }
+
+ bindMoveEvent () {
+ let eventMapping = [
+ {
+ axis: 'axisAX',
+ target: 'pointA'
+ },
+ {
+ axis: 'axisAY',
+ target: 'pointA'
+ },
+ {
+ axis: 'axisBX',
+ target: 'pointB'
+ },
+ {
+ axis: 'axisBY',
+ target: 'pointB'
+ }
+ ];
+
+ eventMapping.forEach((i) => {
+ let dir = (i.axis.slice(-1) === 'Y' ? 'top' : 'left');
+
+ this.ele[i.axis].addEventListener('input', (e) => {
+ this.ele[i.target].style[dir] = `${e.target.value}%`;
+ });
+ });
+ }
+
+ bindUpdate () {
+ this.ele.refreshBtn.addEventListener('click', (e) => {
+ this.updateBgi();
+ });
+ }
+
+ init () {
+ this.updateBgi();
+ this.bindMoveEvent();
+ this.bindUpdate();
+ }
+}
+
+new GeoMap().init();
diff --git a/pool/shard007/JavaScript/0048362_app.js b/pool/shard007/JavaScript/0048362_app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cf72fff944407ea9b76ff6943eef702cbca651af
--- /dev/null
+++ b/pool/shard007/JavaScript/0048362_app.js
@@ -0,0 +1,76 @@
+var app = angular.module('app', [
+ 'ngRoute',
+ 'app.filters',
+ 'app.services',
+ 'app.directives',
+ 'app.controllers',
+ 'ui.bootstrap',
+ 'chart.js',
+ 'angular-loading-bar',
+ 'ngAnimate'
+ // 'isteven-multi-select'
+]);
+
+(function(){
+ 'use strict';
+
+ $.ajax({
+ async: false,
+ dataType: 'json',
+ url: '/menu_list',
+ success: function(d){
+ window.menuList = d;
+ }
+ });
+
+ var asyncjs = function (js) {
+ return ["$q", "$route", "$rootScope", function ($q, $route, $rootScope) {
+ var deferred = $q.defer();
+ var dependencies = js;
+
+
+ $script(dependencies, function () {
+ $rootScope.$apply(function () {
+ deferred.resolve();
+ });
+ });
+ return deferred.promise;
+ }];
+ };
+
+ var setRoute = function($routeProvider, list){
+ for (var i = 0, l = list.length; i < l; i++){
+ if ('leaf' === list[i].node_type && '' !== list[i].uri){
+ $routeProvider.when('/' + list[i].node_id, {
+ templateUrl: list[i].uri,
+ controller: 'MyCtrl',
+ resolve: {
+ load: asyncjs(list[i].require_js)
+ }
+ });
+ } else {
+ setRoute($routeProvider, list[i].sub_nodes);
+ }
+ }
+ $routeProvider.otherwise({
+ redirectTo: '/' + menuList[0].sub_nodes[0].sub_nodes[0].node_id
+ });
+ return true;
+ };
+
+
+
+
+
+ app.config(function($controllerProvider, $compileProvider, $filterProvider, $provide, $routeProvider) {
+ app.register = {
+ controller: $controllerProvider.register,
+ directive: $compileProvider.directive,
+ filter: $filterProvider.register,
+ factory: $provide.factory,
+ service: $provide.service
+ };
+
+ setRoute($routeProvider, window.menuList);
+ });
+})();
diff --git a/pool/shard007/JavaScript/0048364_filter.js b/pool/shard007/JavaScript/0048364_filter.js
new file mode 100644
index 0000000000000000000000000000000000000000..6e042585a7ac9017d6cddae6da6bb8c99479356e
--- /dev/null
+++ b/pool/shard007/JavaScript/0048364_filter.js
@@ -0,0 +1,186 @@
+import Animate from '../mixin/animate';
+import {$$, $, append, assign, css, data, each, hasClass, includes, isUndefined, matches, parseOptions, toggleClass, toNodes, trigger} from 'uikit-util';
+
+export default {
+
+ mixins: [Animate],
+
+ args: 'target',
+
+ props: {
+ target: Boolean,
+ selActive: Boolean
+ },
+
+ data: {
+ target: null,
+ selActive: false,
+ attrItem: 'uk-filter-control',
+ cls: 'uk-active',
+ animation: 250
+ },
+
+ computed: {
+
+ toggles({attrItem}, $el) {
+ return $$(`[${this.attrItem}],[data-${this.attrItem}]`, $el);
+ },
+
+ target({target}, $el) {
+ return $(target, $el);
+ }
+
+ },
+
+ events: [
+
+ {
+
+ name: 'click',
+
+ delegate() {
+ return `[${this.attrItem}],[data-${this.attrItem}]`;
+ },
+
+ handler(e) {
+
+ e.preventDefault();
+ this.apply(e.current);
+
+ }
+
+ }
+
+ ],
+
+ connected() {
+
+ if (this.selActive === false) {
+ return;
+ }
+
+ const actives = $$(this.selActive, this.$el);
+ this.toggles.forEach(el => toggleClass(el, this.cls, includes(actives, el)));
+ },
+
+ update(data) {
+
+ const {toggles, children} = data;
+ if (isEqualList(toggles, this.toggles, false) && isEqualList(children, this.target.children, false)) {
+ return;
+ }
+
+ data.toggles = this.toggles;
+ data.children = this.target.children;
+
+ this.setState(this.getState(), false);
+
+ },
+
+ methods: {
+
+ apply(el) {
+ this.setState(mergeState(el, this.attrItem, this.getState()));
+ },
+
+ getState() {
+ return this.toggles
+ .filter(item => hasClass(item, this.cls))
+ .reduce((state, el) => mergeState(el, this.attrItem, state), {filter: {'': ''}, sort: []});
+ },
+
+ setState(state, animate = true) {
+
+ state = assign({filter: {'': ''}, sort: []}, state);
+
+ trigger(this.$el, 'beforeFilter', [this, state]);
+
+ const children = toNodes(this.target.children);
+
+ this.toggles.forEach(el => toggleClass(el, this.cls, matchFilter(el, this.attrItem, state)));
+
+ const apply = () => {
+
+ const selector = getSelector(state);
+
+ children.forEach(el => css(el, 'display', selector && !matches(el, selector) ? 'none' : ''));
+
+ const [sort, order] = state.sort;
+
+ if (sort) {
+ const sorted = sortItems(children, sort, order);
+ if (!isEqualList(sorted, children)) {
+ sorted.forEach(el => append(this.target, el));
+ }
+ }
+
+ };
+
+ if (animate) {
+ this.animate(apply).then(() => trigger(this.$el, 'afterFilter', [this]));
+ } else {
+ apply();
+ trigger(this.$el, 'afterFilter', [this]);
+ }
+
+ }
+
+ }
+
+};
+
+function getFilter(el, attr) {
+ return parseOptions(data(el, attr), ['filter']);
+}
+
+function mergeState(el, attr, state) {
+
+ toNodes(el).forEach(el => {
+ const filterBy = getFilter(el, attr);
+ const {filter, group, sort, order = 'asc'} = filterBy;
+
+ if (filter || isUndefined(sort)) {
+
+ if (group) {
+ delete state.filter[''];
+ state.filter[group] = filter;
+ } else {
+ state.filter = {'': filter};
+ }
+
+ }
+
+ if (!isUndefined(sort)) {
+ state.sort = [sort, order];
+ }
+ });
+
+ return state;
+}
+
+function matchFilter(el, attr, {filter: stateFilter, sort: [stateSort, stateOrder]}) {
+ const {filter, group = '', sort, order = 'asc'} = getFilter(el, attr);
+ return Boolean(
+ (filter || isUndefined(sort)) && group in stateFilter && (filter === stateFilter[group] || isUndefined(filter) && !stateFilter[group])
+ || stateSort && sort && stateSort === sort && stateOrder === order
+ );
+}
+
+function isEqualList(listA, listB, strict = true) {
+
+ listA = toNodes(listA);
+ listB = toNodes(listB);
+
+ return listA.length === listB.length
+ && listA.every((el, i) => strict ? el === listB[i] : ~listB.indexOf(el));
+}
+
+function getSelector({filter}) {
+ let selector = '';
+ each(filter, value => selector += value || '');
+ return selector;
+}
+
+function sortItems(nodes, sort, order) {
+ return toNodes(nodes).sort((a, b) => data(a, sort).localeCompare(data(b, sort), undefined, {numeric: true}) * (order === 'asc' || -1));
+}
diff --git a/pool/shard007/JavaScript/0048365_home.js b/pool/shard007/JavaScript/0048365_home.js
new file mode 100644
index 0000000000000000000000000000000000000000..2d670d416a9e54ae08c629b555cbab7724194ac1
--- /dev/null
+++ b/pool/shard007/JavaScript/0048365_home.js
@@ -0,0 +1,26 @@
+define([
+ 'jquery',
+ 'underscore',
+ 'backbone',
+ '../../template/page/home.html',
+ '../../template/section/home.html'
+], function ($, _, Backbone, HomePageTemplate, HomeSectionTemplate) {
+ var body = $('body'),
+ homeView = Backbone.View.extend({
+ tagName : 'section',
+ className : 'homeView',
+ template : {
+ page : _.template(HomePageTemplate),
+ section: _.template(HomeSectionTemplate)
+ },
+ initialize: function () {
+ this.render();
+ },
+ render : function () {
+ body.removeClass().addClass('home');
+ this.$el.html(this.template.page);
+ return this;
+ }
+ });
+ return homeView;
+});
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048366_ss3Gallery.js b/pool/shard007/JavaScript/0048366_ss3Gallery.js
new file mode 100644
index 0000000000000000000000000000000000000000..f96afd0706ad49e43faac94461cc99f3a11684b8
--- /dev/null
+++ b/pool/shard007/JavaScript/0048366_ss3Gallery.js
@@ -0,0 +1,32 @@
+jQuery(window).load(function(){
+
+
+ jQuery('.galleryItemLink').click(function (event) {
+ event.preventDefault();
+
+ var ImageURL = jQuery(this).attr('href');
+ var ImageWidth = jQuery(this).attr('rel');
+
+
+ jQuery('#GalleryPopup').css('marginLeft',-parseInt(ImageWidth/2));
+ jQuery('#GalleryPopup').css('width',ImageWidth);
+ jQuery('#GalleryPopup #GalleryLoadArea').html('
');
+ jQuery('#GalleryPopup').fadeIn('medium');
+ jQuery('#GalleryPageShade').fadeIn('medium');
+
+
+ });
+
+ jQuery('#GalleryPageShade').click(Close_Popup);
+ jQuery('.PopupClose').click(Close_Popup);
+
+});
+
+
+function Close_Popup() {
+
+ jQuery('#GalleryPopup').fadeOut('medium');
+ jQuery('#GalleryPageShade').fadeOut('medium');
+
+}
+
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048367_panning_envelope.js b/pool/shard007/JavaScript/0048367_panning_envelope.js
new file mode 100644
index 0000000000000000000000000000000000000000..6b70d235732552a8fba20150123856649f0d5d05
--- /dev/null
+++ b/pool/shard007/JavaScript/0048367_panning_envelope.js
@@ -0,0 +1,34 @@
+import { state } from '../../state';
+import { song } from '../../utils/songmanager';
+
+import EnvelopeWidget from './envelope_widget';
+
+export default class PanningEnvelope extends EnvelopeWidget {
+ constructor(target) {
+ super(target);
+
+ this.setInstrument(state.cursor.get('instrument'));
+ }
+
+ createEnvelope() {
+ if (this.instrument) {
+ this.instrument.env_pan = {
+ points: [0, 32, 2, 32],
+ type: 2,
+ sustain: 0,
+ loopstart: 0,
+ loopend: 0,
+ };
+ }
+ this.envelope = this.instrument.env_pan;
+
+ song.updateInstrument(this.instrumentIndex, this.instrument);
+
+ super.createEnvelope();
+ }
+
+ setInstrument(instrument) {
+ super.setInstrument(instrument);
+ this.envelope = this.instrument.env_pan;
+ }
+}
diff --git a/pool/shard007/JavaScript/0048368_hex-length.js b/pool/shard007/JavaScript/0048368_hex-length.js
new file mode 100644
index 0000000000000000000000000000000000000000..621774a28e07ae91002f87b68c01b6b72851b825
--- /dev/null
+++ b/pool/shard007/JavaScript/0048368_hex-length.js
@@ -0,0 +1,46 @@
+'use strict';
+
+var helpers = require('../helpers');
+var lengths = {
+ short: 3,
+ long: 6
+};
+
+module.exports = {
+ 'name': 'hex-length',
+ 'defaults': {
+ 'style': 'short'
+ },
+ 'detect': function (ast, parser) {
+ var result = [];
+
+ ast.traverseByType('color', function (value) {
+ if (parser.options.style === 'short') {
+ if (value.content.length !== lengths.short) {
+ if (value.content.substr(0, 3) === value.content.substr(3, 5)) {
+ result = helpers.addUnique(result, {
+ 'ruleId': parser.rule.name,
+ 'line': value.start.line,
+ 'column': value.start.column,
+ 'message': 'hex values should use the shorthand format - 3 characters where possible',
+ 'severity': parser.severity
+ });
+ }
+ }
+ }
+ else if (parser.options.style === 'long') {
+ if (value.content.length !== lengths.long) {
+ result = helpers.addUnique(result, {
+ 'ruleId': parser.rule.name,
+ 'line': value.start.line,
+ 'column': value.start.column,
+ 'message': 'hex values should use the long-form format - 6 characters',
+ 'severity': parser.severity
+ });
+ }
+ }
+ });
+
+ return result;
+ }
+};
diff --git a/pool/shard007/JavaScript/0048371_VersiyonRouter.js b/pool/shard007/JavaScript/0048371_VersiyonRouter.js
new file mode 100644
index 0000000000000000000000000000000000000000..6e598986cc34e0b8550a83d257f207db9b891d9b
--- /dev/null
+++ b/pool/shard007/JavaScript/0048371_VersiyonRouter.js
@@ -0,0 +1,84 @@
+var express = require('express');
+var VersionModeli = require('../Modeller/VersionModel');
+
+function CRUD(){
+ var router = express.Router();
+ router.post('/listele', function(req, res) {
+ var firmaKodu = req.body.firmaKodu;
+ console.log('firmaKodu : ' + firmaKodu);
+ VersionModeli.find({firmaKodu : firmaKodu}, function(dbHatasi, listelenen) {
+ if(dbHatasi) {
+ res.header('Access-Control-Allow-Origin', "*"); // TODO - Make this more secure!!
+ res.header('Access-Control-Allow-Methods', 'GET,PUT,POST');
+ res.header('Access-Control-Allow-Headers', 'Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept');
+ res.send({state : false, data : dbHatasi});
+ return;
+ }
+ else{
+ res.header('Access-Control-Allow-Origin', "*"); // TODO - Make this more secure!!
+ res.header('Access-Control-Allow-Methods', 'GET,PUT,POST');
+ res.header('Access-Control-Allow-Headers', 'Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept');
+ res.send({state : true, data : listelenen});
+ }
+ });
+ });
+
+ router.post('/ara', function(req, res) {
+ VersionModeli.find(req.body, function(dbHatasi, listelenen) {
+ if(dbHatasi) {
+ res.send({state : false, data : dbHatasi});
+ return;
+ }
+ else{
+ res.send({state : true, data : listelenen});
+ }
+ });
+ });
+
+ router.post('/sil', function(req, res) {
+ VersionModeli.remove({ _id : req.body._id }, function(dbHatasi, listelenen) {
+ if(dbHatasi) {
+ res.send({state : false, data : dbHatasi});
+ return;
+ }
+ else{
+ res.send({state : true, data : listelenen});
+ }
+ });
+ });
+
+ router.post('/ekle', function(req, res){
+ var modelObject = new VersionModeli(req.body);
+ modelObject.save(function(dbHatasi, eklenen) {
+ if(dbHatasi) {
+ res.send({state : false, data : dbHatasi});
+ return;
+ }
+ else {
+ res.send({state : true, data : eklenen});
+ }
+ });
+ });
+
+ router.post('/guncelle', function(req, res) {
+ VersionModeli.findOne({firmaKodu : req.session.kullanici.firmaKodu}, function(dbVersionHatasi, bulunan){
+ if(dbVersionHatasi){
+ console.log(dbVersionHatasi);
+ res.send({state : false, data : dbVersionHatasi});
+ return;
+ }
+ var version = parseFloat(bulunan.mobilVersion);
+ bulunan.mobilVersion = ++version;
+ bulunan.save(function(dbHatasiKayit, kaydedilen){
+ if(dbHatasiKayit){
+ res.send({state : false, data : dbHatasiKayit});
+ return;
+ }
+ res.send({state : true, data : kaydedilen});
+ });
+ });
+ });
+
+ return router;
+}
+module.exports = CRUD;
diff --git a/pool/shard007/JavaScript/0048372_HslColorPicker.js b/pool/shard007/JavaScript/0048372_HslColorPicker.js
new file mode 100644
index 0000000000000000000000000000000000000000..441df5173ee9558b0b323d5397766fb143e9856f
--- /dev/null
+++ b/pool/shard007/JavaScript/0048372_HslColorPicker.js
@@ -0,0 +1,139 @@
+/*
+ Copyright (c) 2004-2006, The Dojo Foundation
+ All Rights Reserved.
+
+ Licensed under the Academic Free License version 2.1 or above OR the
+ modified BSD license. For more information on Dojo licensing, see:
+
+ http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.widget.svg.HslColorPicker");
+
+dojo.require("dojo.widget.HtmlWidget");
+dojo.require("dojo.widget.HslColorPicker");
+dojo.require("dojo.math");
+dojo.require("dojo.svg");
+dojo.require("dojo.graphics.color");
+dojo.require("dojo.graphics.color.hsl");
+
+dojo.widget.svg.HslColorPicker=function(){
+ dojo.widget.HslColorPicker.call(this);
+ dojo.widget.HtmlWidget.call(this);
+ dojo.debug("warning: the HslColorPicker is not a finished widget, and is not yet ready for general use");
+ this.hue = "0";
+ this.saturation = "0";
+ this.light = "0";
+ this.storedColor = "#0054aa";
+ var _this = this;
+ this.filterObject = {
+ }
+};
+dojo.inherits(dojo.widget.svg.HslColorPicker, dojo.widget.HtmlWidget);
+dojo.lang.extend(dojo.widget.svg.HslColorPicker, {
+ // widget props
+ templatePath: dojo.uri.dojoUri("src/widget/templates/HslColorPicker.svg"),
+ fillInTemplate: function() {
+ this.height = "131px";
+ this.svgDoc = this.hueNode.ownerDocument;
+ this.leftGradientColorNode = this.hueNode.ownerDocument.getElementById("leftGradientColor");
+ this.rightGradientColorNode = this.hueNode.ownerDocument.getElementById("rightGradientColor");
+ this.hueNode.setAttributeNS(dojo.dom.xmlns.xlink, "href", dojo.uri.dojoUri("src/widget/templates/images/hue.png"));
+ var hsl = dojo.graphics.color.hex2hsl(this.storedColor);
+ this.hue = hsl[0];
+ this.saturation = hsl[1];
+ this.light = hsl[2];
+ this.setSaturationStopColors();
+ //this.setHueSlider();
+ //this.setSaturationLightSlider();
+ },
+ setSaturationStopColors: function() {
+ //this.leftGradientStopColor = "rgb(" + dojo.graphics.color.hsl2rgb(this.hue, 20, 50).join(", ") + ")";
+ //this.rightGradientStopColor = "rgb(" + dojo.graphics.color.hsl2rgb(this.hue, 100, 50).join(", ") + ")";
+ //this.leftGradientStopColor = dojo.graphics.color.hsl2hex(this.hue, 20, 50);
+ //this.rightGradientStopColor = dojo.graphics.color.hsl2hex(this.hue, 100, 50);
+ this.leftGradientStopColor = dojo.graphics.color.rgb2hex(this.hsl2rgb(this.hue, 0, 50));
+ this.rightGradientStopColor = dojo.graphics.color.rgb2hex(this.hsl2rgb(this.hue, 100, 50));
+ this.leftGradientColorNode.setAttributeNS(null,'stop-color',this.leftGradientStopColor);
+ this.rightGradientColorNode.setAttributeNS(null,'stop-color',this.rightGradientStopColor);
+ },
+ setHue: function(hue) {
+ this.hue = hue;
+ },
+ setHueSlider: function() {
+ // FIXME: need to add some padding around the picker so you can see the slider at the top and bottom of the picker)
+ this.hueSliderNode.setAttribute("y", parseInt((this.hue/360) * parseInt(this.height) - 2) + "px" );
+ },
+ setSaturationLight: function(saturation, light) {
+ this.saturation = saturation;
+ this.light = light;
+ },
+ setSaturationLightSlider: function() {
+ // TODO
+ },
+ onHueClick: function(evt) {
+ // get the position that was clicked on the element
+ // FIXME: handle document scrolling, offset
+ var yPosition = parseInt(evt.clientY) - parseInt(evt.target.getAttribute("y"));
+ this.setHue( 360 - parseInt(yPosition*(360/parseInt(this.height))) );
+ this.setSaturationStopColors();
+ this.setStoredColor(dojo.graphics.color.hsl2hex(this.hue, this.saturation, this.light));
+ },
+ onHueDrag: function(evt) {
+ // TODO
+ },
+ onSaturationLightClick: function(evt) {
+ // get the position that was clicked on the element
+ // FIXME: handle document scrolling, offset
+ var xPosition = parseInt(evt.clientX) - parseInt(evt.target.getAttribute("y"));
+ var yPosition = parseInt(evt.clientY) - parseInt(evt.target.getAttribute("y"));
+ saturation = parseInt(parseInt(xPosition)*(101/106));
+ light = parseInt(parseInt(yPosition)*(101/106));
+ this.setSaturationLight(saturation, light);
+ this.setStoredColor(dojo.graphics.color.hsl2hex(this.hue, this.saturation, this.light));
+ },
+ onSaturationLightDrag: function(evt) {
+ // TODO
+ },
+ getStoredColor: function() {
+ return this.storedColor;
+ },
+ setStoredColor: function(rgbHexColor) {
+ this.storedColor = rgbHexColor;
+ dojo.event.topic.publish("/" + this.widgetId + "/setStoredColor", this.filterObject);
+ },
+ hsl2rgb: function(hue, saturation, light)
+ {
+ // hsl2rgb in dojo.graphics.color did not behave hte way I expected, so
+ // I'm using some old code I wrote until I figure out what the issue is
+ // first, check to see if saturation = 0
+ function rgb(q1,q2,hue) {
+ if (hue>360) hue=hue-360;
+ if (hue<0) hue=hue+360;
+ if (hue<60) return (q1+(q2-q1)*hue/60);
+ else if (hue<180) return(q2);
+ else if (hue<240) return(q1+(q2-q1)*(240-hue)/60);
+ else return(q1);
+ }
+ this.rgb = rgb
+
+ if (saturation==0) {
+ return [Math.round(light*255/100), Math.round(light*255/100), Math.round(light*255/100)];
+ } else {
+ light = light/100;
+ saturation = saturation/100;
+ // check to see if light > 0.5
+ if ((light)<0.5) {
+ var temp2 = (light)*(1.0+saturation)
+ } else {
+ var temp2 = (light+saturation-(light*saturation))
+ }
+ temp1 = 2.0*light - temp2;
+ var rgbcolor = [];
+ rgbcolor[0] = Math.round(rgb(temp1,temp2,parseInt(hue)+120)*255);
+ rgbcolor[1] = Math.round(rgb(temp1,temp2,hue)*255);
+ rgbcolor[2] = Math.round(rgb(temp1,temp2,parseInt(hue)-120)*255);
+ return rgbcolor;
+ }
+ }
+});
diff --git a/pool/shard007/JavaScript/0048376_client.js b/pool/shard007/JavaScript/0048376_client.js
new file mode 100644
index 0000000000000000000000000000000000000000..b6dbfc08f358f9b465504d90d13e88ea91243677
--- /dev/null
+++ b/pool/shard007/JavaScript/0048376_client.js
@@ -0,0 +1,88 @@
+/*
+ * decaffeinate suggestions:
+ * DS102: Remove unnecessary code created because of implicit returns
+ * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
+ */
+import { Blaze } from 'meteor/blaze';
+import { Meteor } from 'meteor/meteor';
+import { Template } from 'meteor/templating';
+import { Tracker } from 'meteor/tracker';
+import { UserPresence } from 'meteor/konecty:user-presence';
+import { BrowserDetect } from 'meteor/awatson1978:browser-detection';
+
+import { getVoismartSetting } from '../../voismart-settings';
+
+const _installExtension = function(browser) {
+ let extensionAlert = $('.extension-alert');
+ if (!extensionAlert.length) {
+ const main = $('#rocket-chat')[0];
+ if (!main) {
+ console.error('voismart-ngpresence: cannot get main component');
+ }
+ Blaze.renderWithData(Template.extensionAlert, { browser }, main);
+ extensionAlert = $('.extension-alert');
+ if (!extensionAlert.length) {
+ // just give up
+ console.error('voismart-ngpresence: cannot get alert component');
+ }
+ }
+
+ return extensionAlert.removeClass('hidden');
+};
+
+let _extensionAlertInstalled = false;
+Meteor.startup(() => Tracker.autorun(() => {
+ const user = Meteor.user();
+ if (!user) {
+ return;
+ }
+
+ const presenceEnabled = getVoismartSetting(user, 'OrchestraIntegration_PresenceEnabled');
+
+ if (!presenceEnabled) {
+ return;
+ }
+
+ const isElectron = navigator.userAgent.toLowerCase().indexOf('electron') > -1;
+ const { browser } = BrowserDetect;
+ const supportedBrosers = ['Chrome', 'Firefox'];
+ window.__VoismartPresenceExtensionInstalled = false;
+
+ if (supportedBrosers.includes(browser) && !Meteor.isCordova && !isElectron && user) {
+ if (_extensionAlertInstalled) {
+ return;
+ }
+ const f = () => _installExtension(browser);
+ let _extensionPopupTimer = Meteor.setTimeout(f, 90 * 1000);
+ _extensionAlertInstalled = true;
+ return window.addEventListener('message', function(event) {
+ if ((event.source !== window) || (event.data.name !== 'rocketchat_presence')) {
+ return;
+ }
+
+ if (event.data.type === 'idlestatus') {
+ const { state } = event.data;
+ if (state === 'idle') {
+ return UserPresence.setAway();
+ }
+ if (state === 'active') {
+ return UserPresence.setOnline();
+ }
+ if (state === 'locked') {
+ return UserPresence.setAway();
+ }
+ } else if (event.data.type === 'extension_enabled') {
+ // disable UserPresence and use extension
+ if (!window.__VoismartPresenceExtensionInstalled) {
+ window.__VoismartPresenceExtensionInstalled = true;
+ if (_extensionPopupTimer) {
+ Meteor.clearTimeout(_extensionPopupTimer);
+ _extensionPopupTimer = undefined;
+ }
+ UserPresence.stopTimer();
+ UserPresence.startTimer = function() { };
+ }
+ }
+ });
+ }
+}));
diff --git a/pool/shard007/JavaScript/0048385_uploads.client.controller.js b/pool/shard007/JavaScript/0048385_uploads.client.controller.js
new file mode 100644
index 0000000000000000000000000000000000000000..891ac053a022c0b331f2bf85ffb59bfa5f37b1d4
--- /dev/null
+++ b/pool/shard007/JavaScript/0048385_uploads.client.controller.js
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2015 Thalassemia Interpreter Software
+ *
+ * This file is part of the Thalassemia Interpreter Software project.
+ *
+ * Unauthorized copying of this file, via any medium is strictly prohibited
+ *
+ * Thalassemia Interpreter Software project can not be copied and/or distributed without the express
+ * permission of National Science and Technology Development Agency,111 Thailand Science Park (TSP),
+ * Phahonyothin Road, Khlong Nueng, Khlong Luang, Pathum Thani 12120, Thailand
+ */
+'use strict';
+//inject angular file upload directives and services.
+
+
+var uploadMod = angular.module('uploads').controller('UploadController', ['$http','$scope', '$stateParams', '$location', 'Authentication', 'Uploads', '$upload', 'SweetAlert','Typings','UploadsService',
+ function($http,$scope, $stateParams, $location, Authentication, Upload, $upload, sweet,typing,uploadservice) {
+ $scope.authentication = Authentication;
+
+ $scope.dropzoneConfig = {
+ parallelUploads: 3,
+ maxFileSize: 30
+ };
+ //$scope.title = 'test title';
+ //$scope.note = 'test note';
+ $scope.model = {};
+ $scope.selectedFile = [];
+ $scope.uploadProgress = 0;
+ $scope.isCollapsed = true;
+ $scope.systemchoice = [{
+ id: 'LPLC,HPLC',
+ label: 'LPLC,HPLC',
+ subItem: { name: 'LPLC,HPLC' }
+ }, {
+ id: 'CE',
+ label: 'CE',
+ subItem: { name: 'CE' }
+ }];
+ $scope.system=$scope.systemchoice[0];
+
+ $scope.uploadFile = function() {
+ var file = $scope.selectedFile[0];
+ $scope.upload = $upload.upload({
+ url: '/batchupload',
+ method: 'POST',
+ fields: {
+ title: $scope.title,
+ note: $scope.note,
+ device:$scope.system.id,
+ filedir: 'hbtyping'
+ },
+ file: file
+ }).progress(function(evt) {
+ $scope.uploadProgress = parseInt(100.0 * evt.loaded / evt.total, 10);
+ }).success(function(data) {
+ $scope.title = '';
+ $scope.note = '';
+ $scope.uploadProgress = 0;
+
+ sweet.swal({
+ title: 'Success',
+ text: 'อัพโหลดไฟล์สำเร็จ',
+ type: 'success'
+ }, function(isConfirm) {
+
+ angular.forEach(
+ angular.element('input[name=\'uploadfile\']'),
+ function(inputElem) {
+ angular.element(inputElem).val(null);
+ });
+ $scope.find();
+
+ });
+ $scope.isCollapsed = true;
+
+ });
+ };
+
+ $scope.onFileSelect = function($files) {
+ $scope.uploadProgress = 0;
+ $scope.selectedFile = $files;
+ };
+
+ $scope.find = function() {
+
+ $scope.rowCollection = Upload.query();
+ $scope.itemsByPage=10;
+
+ };
+ $scope.uploadResults = function() {
+ typing.getResults($stateParams.uploadid).success(function(data){
+ $scope.rowCollection =data.typings;
+ $scope.alltypings=data.count;
+ });
+
+ $scope.itemsByPage=100;
+ };
+
+ $scope.displayedCollection = [].concat($scope.rowCollection);
+ $scope.reinterprete=function(uploadid){
+ $http({
+ url: 'reinterprete/'+uploadid,
+ method: 'GET'
+ }).success(function(data){
+ if(data==='Success')sweet.swal('Success', 'All data has been successfully reinterpreted.', 'success');
+ console.log(data);
+ });
+ };
+ $scope.confirmRemove=function(upload){
+ sweet.swal({
+ title: "Are you sure?",
+ text: "This will remove the uploaded file and the conresponded typing profiles!",
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ confirmButtonText: "Yes, delete it!",
+ closeOnConfirm: true},
+ function(){
+ $scope.remove(upload);
+ });
+ }
+ $scope.remove = function(upload) {
+ if ( upload ) {
+ upload.$remove(function(){
+ for (var i in $scope.typings) {
+ if ($scope.typings [i] === upload) {
+
+ $scope.typings.splice(i, 1);
+ }
+ }
+ $scope.find();
+ $location.path('uploads');
+
+ });
+
+
+
+ } else {
+ $scope.upload.$remove(function() {
+ $location.path('uploads');
+ });
+ }
+ };
+
+ }
+]);
+
+uploadMod.directive('progressBar', [
+ function() {
+ return {
+ link: function($scope, el, attrs) {
+ $scope.$watch(attrs.progressBar, function(newValue) {
+ el.css('width', newValue.toString() + '%');
+ });
+ }
+ };
+ }
+]);
diff --git a/pool/shard007/JavaScript/0048386_comment.js b/pool/shard007/JavaScript/0048386_comment.js
new file mode 100644
index 0000000000000000000000000000000000000000..c29665e5ff80c6bcd3c477cbdafb549a1757454a
--- /dev/null
+++ b/pool/shard007/JavaScript/0048386_comment.js
@@ -0,0 +1,255 @@
+/**
+ * @license
+ * Visual Blocks Editor
+ *
+ * Copyright 2011 Google Inc.
+ * https://blockly.googlecode.com/
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @fileoverview Object representing a code comment.
+ * @author fraser@google.com (Neil Fraser)
+ */
+'use strict';
+
+goog.provide('Blockly.Comment');
+
+goog.require('Blockly.Bubble');
+goog.require('Blockly.Icon');
+goog.require('goog.userAgent');
+
+
+/**
+ * Class for a comment.
+ * @param {!Blockly.Block} block The block associated with this comment.
+ * @extends {Blockly.Icon}
+ * @constructor
+ */
+Blockly.Comment = function(block) {
+ Blockly.Comment.superClass_.constructor.call(this, block);
+ this.createIcon_();
+};
+goog.inherits(Blockly.Comment, Blockly.Icon);
+
+
+/**
+ * Comment text (if bubble is not visible).
+ * @private
+ */
+Blockly.Comment.prototype.text_ = '';
+
+/**
+ * Width of bubble.
+ * @private
+ */
+Blockly.Comment.prototype.width_ = 160;
+
+/**
+ * Height of bubble.
+ * @private
+ */
+Blockly.Comment.prototype.height_ = 80;
+
+/**
+ * Create the icon on the block.
+ * @private
+ */
+Blockly.Comment.prototype.createIcon_ = function() {
+ Blockly.Icon.prototype.createIcon_.call(this);
+ /* Here's the markup that will be generated:
+
+ ?
+ */
+ var iconShield = Blockly.createSvgElement('circle',
+ {'class': 'blocklyIconShield',
+ 'r': Blockly.Icon.RADIUS,
+ 'cx': Blockly.Icon.RADIUS,
+ 'cy': Blockly.Icon.RADIUS}, this.iconGroup_);
+ this.iconMark_ = Blockly.createSvgElement('text',
+ {'class': 'blocklyIconMark',
+ 'x': Blockly.Icon.RADIUS,
+ 'y': 2 * Blockly.Icon.RADIUS - 3}, this.iconGroup_);
+ this.iconMark_.appendChild(document.createTextNode('?'));
+};
+
+/**
+ * Create the editor for the comment's bubble.
+ * @return {!Element} The top-level node of the editor.
+ * @private
+ */
+Blockly.Comment.prototype.createEditor_ = function() {
+ /* Create the editor. Here's the markup that will be generated:
+
+
+
+
+
+ */
+ this.foreignObject_ = Blockly.createSvgElement('foreignObject',
+ {'x': Blockly.Bubble.BORDER_WIDTH, 'y': Blockly.Bubble.BORDER_WIDTH},
+ null);
+ this.foreignBody_ = document.createElementNS(Blockly.HTML_NS, 'body');
+ this.foreignBody_.setAttribute('xmlns', Blockly.HTML_NS);
+ this.foreignBody_.className = 'blocklyMinimalBody';
+ this.textarea_ = document.createElementNS(Blockly.HTML_NS, 'textarea');
+ this.textarea_.className = 'blocklyCommentTextarea';
+ this.textarea_.setAttribute('dir', Blockly.RTL ? 'RTL' : 'LTR');
+ this.foreignBody_.appendChild(this.textarea_);
+ this.foreignObject_.appendChild(this.foreignBody_);
+ Blockly.bindEvent_(this.textarea_, 'mouseup', this, this.textareaFocus_);
+ return this.foreignObject_;
+};
+
+/**
+ * Add or remove editability of the comment.
+ * @override
+ */
+Blockly.Comment.prototype.updateEditable = function() {
+ if (this.isVisible()) {
+ // Toggling visibility will force a rerendering.
+ this.setVisible(false);
+ this.setVisible(true);
+ }
+ // Allow the icon to update.
+ Blockly.Icon.prototype.updateEditable.call(this);
+};
+
+/**
+ * Callback function triggered when the bubble has resized.
+ * Resize the text area accordingly.
+ * @private
+ */
+Blockly.Comment.prototype.resizeBubble_ = function() {
+ var size = this.bubble_.getBubbleSize();
+ var doubleBorderWidth = 2 * Blockly.Bubble.BORDER_WIDTH;
+ this.foreignObject_.setAttribute('width', size.width - doubleBorderWidth);
+ this.foreignObject_.setAttribute('height', size.height - doubleBorderWidth);
+ this.foreignBody_.style.height = (size.height - doubleBorderWidth) + 'px';
+ this.textarea_.style.width = (size.width - doubleBorderWidth) + 'px';
+ this.textarea_.style.height = (size.height - doubleBorderWidth) + 'px';
+};
+
+/**
+ * Show or hide the comment bubble.
+ * @param {boolean} visible True if the bubble should be visible.
+ */
+Blockly.Comment.prototype.setVisible = function(visible) {
+ if (visible == this.isVisible()) {
+ // No change.
+ return;
+ }
+ if ((!this.block_.isEditable() && !this.textarea_) || goog.userAgent.IE) {
+ // Steal the code from warnings to make an uneditable text bubble.
+ // MSIE does not support foreignobject; textareas are impossible.
+ // http://msdn.microsoft.com/en-us/library/hh834675%28v=vs.85%29.aspx
+ // Always treat comments in IE as uneditable.
+ Blockly.Warning.prototype.setVisible.call(this, visible);
+ return;
+ }
+ // Save the bubble stats before the visibility switch.
+ var text = this.getText();
+ var size = this.getBubbleSize();
+ if (visible) {
+ // Create the bubble.
+ this.bubble_ = new Blockly.Bubble(
+ /** @type {!Blockly.Workspace} */ (this.block_.workspace),
+ this.createEditor_(), this.block_.svg_.svgPath_,
+ this.iconX_, this.iconY_,
+ this.width_, this.height_);
+ this.bubble_.registerResizeEvent(this, this.resizeBubble_);
+ this.updateColour();
+ this.text_ = null;
+ } else {
+ // Dispose of the bubble.
+ this.bubble_.dispose();
+ this.bubble_ = null;
+ this.textarea_ = null;
+ this.foreignObject_ = null;
+ }
+ // Restore the bubble stats after the visibility switch.
+ this.setText(text);
+ this.setBubbleSize(size.width, size.height);
+};
+
+/**
+ * Bring the comment to the top of the stack when clicked on.
+ * @param {!Event} e Mouse up event.
+ * @private
+ */
+Blockly.Comment.prototype.textareaFocus_ = function(e) {
+ // Ideally this would be hooked to the focus event for the comment.
+ // However doing so in Firefox swallows the cursor for unknown reasons.
+ // So this is hooked to mouseup instead. No big deal.
+ this.bubble_.promote_();
+ // Since the act of moving this node within the DOM causes a loss of focus,
+ // we need to reapply the focus.
+ this.textarea_.focus();
+};
+
+/**
+ * Get the dimensions of this comment's bubble.
+ * @return {!Object} Object with width and height properties.
+ */
+Blockly.Comment.prototype.getBubbleSize = function() {
+ if (this.isVisible()) {
+ return this.bubble_.getBubbleSize();
+ } else {
+ return {width: this.width_, height: this.height_};
+ }
+};
+
+/**
+ * Size this comment's bubble.
+ * @param {number} width Width of the bubble.
+ * @param {number} height Height of the bubble.
+ */
+Blockly.Comment.prototype.setBubbleSize = function(width, height) {
+ if (this.textarea_) {
+ this.bubble_.setBubbleSize(width, height);
+ } else {
+ this.width_ = width;
+ this.height_ = height;
+ }
+};
+
+/**
+ * Returns this comment's text.
+ * @return {string} Comment text.
+ */
+Blockly.Comment.prototype.getText = function() {
+ return this.textarea_ ? this.textarea_.value : this.text_;
+};
+
+/**
+ * Set this comment's text.
+ * @param {string} text Comment text.
+ */
+Blockly.Comment.prototype.setText = function(text) {
+ if (this.textarea_) {
+ this.textarea_.value = text;
+ } else {
+ this.text_ = text;
+ }
+};
+
+/**
+ * Dispose of this comment.
+ */
+Blockly.Comment.prototype.dispose = function() {
+ this.block_.comment = null;
+ Blockly.Icon.prototype.dispose.call(this);
+};
diff --git a/pool/shard007/JavaScript/0048391_index.js b/pool/shard007/JavaScript/0048391_index.js
new file mode 100644
index 0000000000000000000000000000000000000000..cd4d816bb359bfb95d47d119050b89357edbbf3a
--- /dev/null
+++ b/pool/shard007/JavaScript/0048391_index.js
@@ -0,0 +1,75 @@
+import React from 'react';
+import {
+ BrowserRouter as Router,
+ Route,
+ Link,
+ Prompt
+} from 'react-router-dom';
+
+const PreventingTransitionsExample = () => (
+
+
+
+ - Form
+ - One
+ - Two
+
+
+ One
} />
+ Two
} />
+
+
+);
+
+class Form extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ isBlocking: false
+ };
+ }
+ render() {
+ const { isBlocking } = this.state;
+
+ return (
+
+ );
+ }
+}
+
+export default PreventingTransitionsExample;
diff --git a/pool/shard007/JavaScript/0048392_Viewport.Camera.js b/pool/shard007/JavaScript/0048392_Viewport.Camera.js
new file mode 100644
index 0000000000000000000000000000000000000000..f7b77663d4c0b6f79bae9cef9b98e5a797dcb334
--- /dev/null
+++ b/pool/shard007/JavaScript/0048392_Viewport.Camera.js
@@ -0,0 +1,52 @@
+/**
+ * @author mrdoob / http://mrdoob.com/
+ */
+
+import { UISelect } from './libs/ui.js';
+
+var ViewportCamera = function ( editor ) {
+
+ var signals = editor.signals;
+
+ //
+
+ var cameraSelect = new UISelect();
+ cameraSelect.setPosition( 'absolute' );
+ cameraSelect.setRight( '10px' );
+ cameraSelect.setTop( '10px' );
+ cameraSelect.onChange( function () {
+
+ editor.setViewportCamera( this.getValue() );
+
+ } );
+
+ signals.cameraAdded.add( update );
+ signals.cameraRemoved.add( update );
+
+ update();
+
+ //
+
+ function update() {
+
+ var options = {};
+
+ var cameras = editor.cameras;
+
+ for ( var key in cameras ) {
+
+ var camera = cameras[ key ];
+ options[ camera.uuid ] = camera.name;
+
+ }
+
+ cameraSelect.setOptions( options );
+ cameraSelect.setValue( editor.viewportCamera.uuid );
+
+ }
+
+ return cameraSelect;
+
+};
+
+export { ViewportCamera };
diff --git a/pool/shard007/JavaScript/0048395_ledger.js b/pool/shard007/JavaScript/0048395_ledger.js
new file mode 100644
index 0000000000000000000000000000000000000000..9a97660c2c45c46447eaf032125b3992587c8102
--- /dev/null
+++ b/pool/shard007/JavaScript/0048395_ledger.js
@@ -0,0 +1,44 @@
+'use strict'
+
+const Wantlist = require('../types/wantlist')
+
+class Ledger {
+ constructor (peerId) {
+ this.partner = peerId
+ this.wantlist = new Wantlist()
+
+ this.exchangeCount = 0
+ this.sentToPeer = new Map()
+
+ this.accounting = {
+ bytesSent: 0,
+ bytesRecv: 0
+ }
+ }
+
+ sentBytes (n) {
+ this.exchangeCount++
+ this.lastExchange = (new Date()).getTime()
+ this.accounting.bytesSent += n
+ }
+
+ receivedBytes (n) {
+ this.exchangeCount++
+ this.lastExchange = (new Date()).getTime()
+ this.accounting.bytesRecv += n
+ }
+
+ wants (cid, priority) {
+ this.wantlist.add(cid, priority)
+ }
+
+ cancelWant (cid) {
+ this.wantlist.remove(cid)
+ }
+
+ wantlistContains (cid) {
+ return this.wantlist.contains(cid)
+ }
+}
+
+module.exports = Ledger
diff --git a/pool/shard007/JavaScript/0048396_uspt.js b/pool/shard007/JavaScript/0048396_uspt.js
new file mode 100644
index 0000000000000000000000000000000000000000..5aa4d75d8d02c7486405be62e8a10a1b332c8445
--- /dev/null
+++ b/pool/shard007/JavaScript/0048396_uspt.js
@@ -0,0 +1,225 @@
+/* main server of uspt:
+ * starting the listening server,
+ * binding socket.io to listen to websocket connections from the single-page client */
+
+var express = require('express');
+var crypto = require('crypto');
+var mysql = require('mysql');
+var https = require('https');
+var http = require('http');
+var fs = require('fs');
+
+var app = express();
+var server = http.createServer(app);
+var io = require('socket.io')(server);
+
+var db = require('./db/db.js');
+var SurveyData = require('./dataObjects/surveyData');
+
+/* configure logging */
+var log4js = require('log4js');
+log4js.configure({
+ appenders: [
+ { type: 'console' },
+ { type: 'file', filename: 'uspt.log'}
+ ]
+});
+var logger = log4js.getLogger();
+db.setLogger(logger);
+
+/* building db connection */
+//creating connection pool
+var pool = mysql.createPool({
+ host : 'localhost',
+ user : 'root',
+ password : 'root',
+ database : 'uspt'
+});
+
+pool.getConnection(function(err, connection){
+ //try to establish one connection to see whether db can be reached
+ if (err){
+ logger.error('error connecting to db: ' + err.toString());
+ throw err;
+ }
+
+ logger.info('connected to db');
+ connection.release();
+});
+
+var port = 80;
+if(process.argv.length > 2){
+ //assuming that argument on index 2 is a specified port
+ port = process.argv[2];
+}
+
+server.listen(port, function(err){
+ logger.info('http server listening on port ' + port + '!');
+});
+
+//TODO: also support https -> options!
+//https.createServer(options, app).listen(443);
+
+//TODO: handle case where study is cancelled midway by leaving socket (exit window, reload...)
+// -> to do so, its probably needed to save undone entries to db (completed 0 --> 1)
+// --> or yet better, save to db only after completion?
+
+//TODO: make data objects, e.g. for user, surveyData etc.
+//TODO: split socket code in multiple files, one for each 'channel'
+//TODO: after split of code in multiple files, also make http endpoints?
+//(to detach from sockets, e.g. when used in plugins or moodle)
+
+//TODO: validate input - also client side? html/js "validator"?
+//TODO: error codes for client
+
+//TODO: if using auth-tokens for survey start, how to configure auth-tokens?
+//maybe through an admin interface?
+
+//TODO: date for survey data + participation data? might be used to link survey to participant...
+
+app.get('/', function(req, res){
+ logger.info('request served on /');
+ fs.createReadStream('uspt.html').pipe(res);
+});
+
+app.get('/info', function(req, res){
+ logger.info('request served on /info');
+ res.send('universal students personality testing - research project - aau klagenfurt');
+});
+
+io.on('connection', function(socket){
+ logger.info('user connected');
+
+ var user = {};
+
+ socket.on('auth', function(data){
+ //support auth-token to begin survey
+ logger.info('auth data received: ' + JSON.stringify(data));
+
+ //TODO: check in db for open surveys / corresponding auth_keys
+ //TODO: survey_key could be set (queried from db) with auth_key
+
+ if(data.auth_key.length > 0){
+ socket.emit('auth-success');
+ } else{
+ socket.emit('auth-fail');
+ }
+ });
+
+ socket.on('login', function(data){
+ //get login data from json
+ logger.info('login data received: ' + JSON.stringify(data));
+
+ user.sex = data.sex;
+ user.age = data.birthday;
+ user.institution = data.institution;
+ user.survey_key = data.survey_key;
+ user.date = Date.now();
+
+ var hash = crypto.createHash('sha512');
+ hash.update(data.fname + data.lname + data.sex + data.birthday + data.p_info_select + data.p_info);
+ var hash_hex = hash.digest('hex');
+
+ user.hash = hash_hex;
+ logger.info('new user: ' + JSON.stringify(user));
+
+ //create user in db, if not exists
+ pool.getConnection(function(err, connection){
+ if(err){
+ logger.error('error getting connection from pool: ' + err.toString());
+ socket.emit('err', {'error' : 403});
+ return;
+ }
+
+ var n_user = {}
+ n_user.first_name = data.fname;
+ n_user.last_name = data.lname;
+ n_user.sex = data.sex;
+ n_user.birthday = data.birthday;
+
+ db.createUser(connection, n_user, function(err, result){
+ if(err){
+ //check if err contains known db error code
+ if(err.error){
+ logger.error('error posting to db: ' + JSON.stringify(err));
+ socket.emit('err', err);
+ } else{
+ //else send unspecified db error
+ logger.error('error posting to db: ' + err.toString());
+ socket.emit('err', {'error' : 400});
+ }
+ } else{
+ user.id = result.student_id;
+ socket.emit('login-success', {hash: hash_hex});
+ }
+ });
+ connection.release();
+ });
+ });
+
+ //TODO: make it possible to unlock specific survey keys (-> admin portal?)
+ //e.g. table open_surveys
+ socket.on('survey', function(data){
+ //get survey data from json
+ logger.info('survey data received: ' + JSON.stringify(data));
+
+ user.answer = data.f1 + ',' + data.f2;
+ logger.info('updated user: ' + JSON.stringify(user));
+
+ pool.getConnection(function(err, connection){
+ if(err){
+ logger.error('error getting connection from pool: ' + err.toString());
+ socket.emit('err', {'error' : 403});
+ return;
+ }
+
+ var success = false;
+ var s_user = {};
+ s_user.student_id = user.id;
+ s_user.survey_key = user.survey_key;
+ //s_user.date = user.date; //TODO: if same date is saved, survey-data could be linked to survey-participant?!
+
+ db.writeSurveyParticipation(connection, s_user, function(err, result){
+ if(err){
+ //check if err contains known db error code
+ if(err.error){
+ logger.error('error posting to db: ' + JSON.stringify(err));
+ socket.emit('err', err);
+ } else{
+ //else send unspecified db error
+ logger.error('error posting to db: ' + err.toString());
+ socket.emit('err', {'error' : 400});
+ }
+ } else{
+ //write survey data
+
+ //answer is now csv, to support different test structures
+ //TODO: change age to birthday? (invariant to time)
+ var surveyData = new SurveyData(user.hash, user.survey_key, user.answer, user.sex, user.age, user.institution);
+ logger.info("survey data: " + JSON.stringify(surveyData));
+
+ db.writeSurvey(connection, surveyData, function(err, result){
+ if(err){
+ //check if err contains known db error code
+ if(err.error){
+ logger.error('error posting to db: ' + JSON.stringify(err));
+ socket.emit('err', err);
+ } else{
+ //else send unspecified db error
+ logger.error('error posting to db: ' + err.toString());
+ socket.emit('err', {'error' : 400});
+ }
+ } else{
+ socket.emit('survey-success');
+ }
+ });
+ }
+ });
+ connection.release();
+ });
+ });
+
+ socket.on('disconnect', function(){
+ logger.info('user disconnected');
+ });
+});
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048405_sketch.js b/pool/shard007/JavaScript/0048405_sketch.js
new file mode 100644
index 0000000000000000000000000000000000000000..7372f9d26e789ab95fa4d3d0bd8ad4eaad88ade0
--- /dev/null
+++ b/pool/shard007/JavaScript/0048405_sketch.js
@@ -0,0 +1,77 @@
+// The Nature of Code
+// Daniel Shiffman
+// http://natureofcode.com
+
+// Forces (Gravity and Fluid Resistence) with Vectors
+
+// Demonstration of multiple force acting on bodies (Mover class)
+// Bodies experience gravity continuously
+// Bodies experience fluid resistance when in "water"
+
+// Five moving bodies
+var movers = [];
+
+// Liquid
+var liquid;
+
+function setup() {
+ // Must be before createGraphics
+ var text = createP("click mouse to reset");
+
+ createCanvas(640, 360);
+ reset();
+ // Create liquid object
+ liquid = new Liquid(0, height/2, width, height/2, 0.1);
+
+ // Here we call methods of each element to set the position and id, try changing these values.
+ text.position(10, 365);
+
+}
+
+function draw() {
+ background(127);
+
+ // Draw water
+ liquid.display();
+
+ for (var i = 0; i < movers.length; i++) {
+
+ // Is the Mover in the liquid?
+ if (liquid.contains(movers[i])) {
+ // Calculate drag force
+ var dragForce = liquid.calculateDrag(movers[i]);
+ // Apply drag force to Mover
+ movers[i].applyForce(dragForce);
+ }
+
+ // Gravity is scaled by mass here!
+ var gravity = createVector(0, 0.1*movers[i].mass);
+ // Apply gravity
+ movers[i].applyForce(gravity);
+
+ // Update and display
+ movers[i].update();
+ movers[i].display();
+ movers[i].checkEdges();
+ }
+
+}
+
+
+// Not working???
+function mousePressed() {
+ reset();
+}
+
+// Restart all the Mover objects randomly
+function reset() {
+ for (var i = 0; i < 9; i++) {
+ movers[i] = new Mover(random(0.5, 3), 40+i*70, 0);
+ }
+}
+
+
+
+
+
+
diff --git a/pool/shard007/JavaScript/0048406_locus.js b/pool/shard007/JavaScript/0048406_locus.js
new file mode 100644
index 0000000000000000000000000000000000000000..f0579ab3c4542e1dde44c4920d5118f575d2af5e
--- /dev/null
+++ b/pool/shard007/JavaScript/0048406_locus.js
@@ -0,0 +1,44 @@
+(function() {
+ var Locus, _base;
+
+ if (global.locus_variables == null) {
+ global.locus_variables = {};
+ }
+
+ if ((_base = global.locus_variables).modules == null) {
+ _base.modules = {};
+ }
+
+ global.locus_variables.modules.sync_prompt = require.resolve('sync-prompt');
+
+ Locus = (function() {
+ function Locus() {}
+
+ Locus.listen = function() {
+ var e, input, prompt, quit, _results;
+ quit = false;
+ _results = [];
+ while (!quit) {
+ prompt = require(locus_variables.modules.sync_prompt).prompt;
+ input = prompt('> ').trim();
+ try {
+ if (input === 'quit' || input === 'exit') {
+ _results.push(quit = true);
+ } else {
+ _results.push(console.log(eval(input)));
+ }
+ } catch (_error) {
+ e = _error;
+ _results.push(console.log(e));
+ }
+ }
+ return _results;
+ };
+
+ return Locus;
+
+ })();
+
+ global.locus = "(" + (Locus.listen.toString()) + ").call(this)";
+
+}).call(this);
diff --git a/pool/shard007/JavaScript/0048407_Button.js b/pool/shard007/JavaScript/0048407_Button.js
new file mode 100644
index 0000000000000000000000000000000000000000..72cdc1e621b8be23e75cf3c0565da1a8b3396fc5
--- /dev/null
+++ b/pool/shard007/JavaScript/0048407_Button.js
@@ -0,0 +1,32 @@
+import React from 'react';
+
+import style from 'modules/ui/button';
+
+class Button extends React.Component {
+ render() {
+ let defaultProps = {
+ };
+ let styleTypeProps = {
+ 'positive': {
+ className: style.button + " " + style['button--positive']
+ },
+ 'neutral': {
+ className: style.button + " " + style['button--neutral']
+ },
+ 'action': {
+ className: style.button + " " + style['button--action']
+ }
+ };
+ const props = Object.assign({}, defaultProps, styleTypeProps['neutral'], styleTypeProps[this.props.styleType], this.props);
+
+ return (
+
+ );
+ }
+}
+
+export default Button;
diff --git a/pool/shard007/JavaScript/0048409_analytics.js b/pool/shard007/JavaScript/0048409_analytics.js
new file mode 100644
index 0000000000000000000000000000000000000000..e40a078889c2b691132f50f14c2d8f044bdab6e3
--- /dev/null
+++ b/pool/shard007/JavaScript/0048409_analytics.js
@@ -0,0 +1,107 @@
+/**
+ * GA Anomalies Monitor (https://github.com/fraszczakszymon/ga-anomalies-monitor)
+ *
+ * Copyright © 2016 Frąszczak Szymon. All rights reserved.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.md file in the root directory of this source tree.
+ */
+
+/*global module, require*/
+var api = require('api/api'),
+ analytics = require('googleapis').analytics('v3'),
+ config,
+ logger = require('utils/logger'),
+ q = require('q');
+
+function prepareQueryParam(params) {
+ if (!params) {
+ return;
+ }
+ return params.map(function (param) {
+ return 'ga:' + param;
+ })
+ .join(',');
+}
+
+function getProfiles() {
+ var deferred = q.defer();
+ api.authenticate()
+ .then(function (authClient) {
+ analytics.management.profiles.list({
+ 'auth': authClient,
+ 'accountId': '~all',
+ 'webPropertyId': '~all'
+ }, function (err, result) {
+ if (err) {
+ logger.error('getProfiles', {
+ error: err
+ });
+ deferred.reject(err);
+ } else {
+ logger.info('getProfiles', {
+ results: result.items.length
+ });
+ deferred.resolve(result);
+ }
+ });
+ });
+
+ return deferred.promise;
+}
+
+function runQuery(viewIds, metrics, dimensions, filters, extra) {
+ var deferred = q.defer();
+ dimensions = dimensions || [];
+ dimensions = JSON.parse(JSON.stringify(dimensions)); // make a copy
+ dimensions.push('date');
+ dimensions.push('hour');
+ extra = extra || {};
+
+ config = require('../../config/config.json');
+ setTimeout(function () {
+ api.authenticate()
+ .then(function (authClient) {
+ var params = {
+ 'auth': authClient,
+ 'ids': 'ga:' + viewIds,
+ 'metrics': prepareQueryParam(metrics),
+ 'dimensions': prepareQueryParam(dimensions),
+ 'samplingLevel': 'HIGHER_PRECISION',
+ 'startIndex': extra.startIndex || 1,
+ 'max-results': extra.maxResults || 10000,
+ 'start-date': extra.start || config.settings.timeSpan + 'daysAgo',
+ 'end-date': extra.end || 'today'
+ };
+ if (filters) {
+ params.filters = filters;
+ }
+ analytics.data.ga.get(params, function (err, result) {
+ if (err) {
+ logger.error('runQuery', {
+ metrics: metrics,
+ dimensions: dimensions,
+ filters: filters,
+ error: err
+ });
+ deferred.reject(err);
+ } else {
+ logger.info('runQuery', {
+ metrics: metrics,
+ dimensions: dimensions,
+ filters: filters,
+ results: result.rows ? result.rows.length : 0
+ });
+ deferred.resolve(result);
+ }
+ });
+ });
+ }, extra.timeout || 0);
+
+ return deferred.promise;
+}
+
+module.exports = {
+ getProfiles: getProfiles,
+ runQuery: runQuery
+};
diff --git a/pool/shard007/JavaScript/0048412_ref-collector.js b/pool/shard007/JavaScript/0048412_ref-collector.js
new file mode 100644
index 0000000000000000000000000000000000000000..8141dddd9c3be316e4fa05ce454e03fe583e0165
--- /dev/null
+++ b/pool/shard007/JavaScript/0048412_ref-collector.js
@@ -0,0 +1,38 @@
+'use strict';
+var RSVP = require('rsvp');
+
+module.exports = RefCollector;
+function RefCollector(excludes) {
+ if (!(this instanceof RefCollector)) {
+ return new RefCollector(excludes);
+ }
+
+ this.excludes = excludes || [];
+ this.selector = null;
+ this.refAttr = null;
+}
+
+RefCollector.prototype.exclude = function(ref) {
+ return this.excludes.some(function(exclude) {
+ return ref.search(exclude);
+ });
+};
+
+RefCollector.prototype.process = function(ref, refs) {
+ if (!this.exclude(ref)) {
+ refs[ref] = true;
+ }
+};
+
+RefCollector.prototype.collect = function($) {
+ var refs = {};
+
+ return new RSVP.Promise(function(resolve) {
+ $(this.selector).each(function(index, el) {
+ var ref = $(el).attr(this.refAttr);
+ this.process(ref, refs);
+ }.bind(this));
+
+ resolve(Object.keys(refs));
+ }.bind(this));
+};
diff --git a/pool/shard007/JavaScript/0048413_bulk.js b/pool/shard007/JavaScript/0048413_bulk.js
new file mode 100644
index 0000000000000000000000000000000000000000..060fea7f19790b171a9c93157af902d844396a4b
--- /dev/null
+++ b/pool/shard007/JavaScript/0048413_bulk.js
@@ -0,0 +1,131 @@
+var _ = require('lodash');
+
+var OperationResult = function () {
+ this.ok = true;
+ this.nInserted = 0;
+ this.nUpdated = 0;
+ this.nUpserted = 0;
+ this.nModified = 0;
+ this.nRemoved = 0;
+ this._insertedIds = [];
+ this._upsertedIds = [];
+};
+
+OperationResult.prototype.getInsertedIds = function () {
+ return this._insertedIds;
+};
+
+OperationResult.prototype.getLastOp = function () {
+ return null;
+};
+
+OperationResult.prototype.getUpsertedIdAt = function (index) {
+ return _.get(this._upsertedIds, index);
+};
+
+OperationResult.prototype.getUpsertedIds = function () {
+ return this._upsertedIds;
+};
+
+OperationResult.prototype.getWriteConcernError = function () {
+ return null;
+};
+
+OperationResult.prototype.getWriteErrorAt = function () {
+ return null;
+};
+
+OperationResult.prototype.getWriteErrorCount = function () {
+ return 0;
+};
+
+OperationResult.prototype.getWriteErrors = function () {
+ return [];
+};
+
+OperationResult.prototype.hasWriteErrors = function () {
+ return false;
+};
+
+var BulkOperation = function (collection) {
+ this.__collection__ = collection;
+ this._operations = [];
+ this._bulkResult = new OperationResult();
+};
+
+BulkOperation.prototype.execute = function (callback) {
+ var self = this;
+ var promises = [];
+ var len = this._operations.length;
+ for (var i = 0; i < len; i++) {
+ var op = this._operations[i];
+ promises.push(this.__collection__[op.method].apply(this.__collection__, op.args));
+ }
+ Promise.all(promises).then(function (results) {
+ for (var i = 0; i < len; i++) {
+ var _op = self._operations[i];
+ switch (_op.method) {
+ case 'insert':
+ self._bulkResult.nInserted += 1;
+ self._bulkResult._insertedIds.push(results[i]._id);
+ break;
+ case 'update':
+ if (results[i].updatedExisting) {
+ self._bulkResult.nUpdated += results[i].nUpdated;
+ } else {
+ self._bulkResult.nInserted += results[i].nInserted;
+ self._bulkResult._upsertedIds.push(results[i]._id);
+ }
+ break;
+ case 'remove':
+ self._bulkResult.nRemoved += results[i].nRemoved;
+ break;
+ default:
+ break;
+ }
+ }
+ callback(null, self._bulkResult);
+ }).catch(function (err) {
+ callback(err);
+ });
+ if(typeof callback !== 'function') {
+ return new Promise(function (resolve,reject) {
+ callback = function (e, r) { e? reject(e) : resolve(r) };
+ })
+ }
+};
+
+BulkOperation.prototype.find = function (query) {
+ var self = this;
+ return {
+ removeOne: function () {
+ self._operations.push({ method: 'removeOne', args: [query].concat(Array.from(arguments)) });
+ },
+ remove: function () {
+ self._operations.push({ method: 'remove', args: [query].concat(Array.from(arguments)) });
+ },
+ replaceOne: function () {
+ self._operations.push({ method: 'replaceOne', args: [query].concat(Array.from(arguments)) });
+ },
+ updateOne: function () {
+ self._operations.push({ method: 'updateOne', args: [query].concat(Array.from(arguments)) });
+ },
+ update: function () {
+ self._operations.push({ method: 'update', args: [query].concat(Array.from(arguments)) });
+ },
+ };
+};
+
+BulkOperation.prototype.insert = function () {
+ this._operations.push({ method: 'insert', args: Array.from(arguments) });
+};
+
+BulkOperation.prototype.update = function () {
+ this._operations.push({ method: 'update', args: Array.from(arguments) });
+};
+
+BulkOperation.prototype.remove = function () {
+ this._operations.push({ method: 'remove', args: Array.from(arguments) });
+};
+
+module.exports = BulkOperation;
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048415_login.js b/pool/shard007/JavaScript/0048415_login.js
new file mode 100644
index 0000000000000000000000000000000000000000..bb41621b7a3af5b7e6d73ac007030a3b42c93d0f
--- /dev/null
+++ b/pool/shard007/JavaScript/0048415_login.js
@@ -0,0 +1,111 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+/*
+ * Copyright (c) 2014, Joyent, Inc.
+ */
+
+var assert = require('assert');
+var sprintf = require('util').format;
+
+var restify = require('restify');
+
+
+var util = require('./util');
+
+
+
+// --- Globals
+
+var BadRequestError = restify.BadRequestError;
+
+// --- API
+
+module.exports = {
+
+ getSalt: function getSalt(req, res, next) {
+ assert.ok(req.ufds);
+
+ var log = req.log;
+
+ log.debug({login: req.params.uuid}, 'GetSalt: entered');
+
+ assert.ok(req.customer);
+
+ res.send(200, { salt: req.customer._salt });
+
+ return next();
+ },
+
+
+ login: function login(req, res, next) {
+ assert.ok(req.ufds);
+
+ var log = req.log;
+
+ log.debug({params: req.params}, 'Login: entered');
+
+ if (!req.params.login) {
+ return next(new BadRequestError('login is required'));
+ }
+ if (!req.params.digest) {
+ return next(new BadRequestError('digest is required'));
+ }
+
+ assert.ok(req.customer);
+
+ var result = null;
+ if (req.customer.userpassword === req.params.digest) {
+ result = util.translateCustomer(req.customer);
+ if (req.accepts('application/xml')) {
+ result = { customer: result };
+ }
+ }
+
+ log.debug({
+ login: req.params.login,
+ result: result || {}
+ }, 'Login: done');
+
+ res.send(200, result);
+ return next();
+
+
+
+ },
+
+ forgotPassword: function forgotPassword(req, res, next) {
+ assert.ok(req.ufds);
+
+ var log = req.log;
+
+ log.debug({params: req.params}, 'ForgotPassword: entered');
+
+ if (!req.params.email) {
+ return next(new BadRequestError('email is required'));
+ }
+
+ req.ufds.getUserByEmail(req.params.email, function (err, user) {
+ console.dir(err);
+ console.dir(user);
+ if (err) {
+ return next(err);
+ }
+ var customers = [util.translateCustomer(user)];
+ if (req.accepts('application/xml')) {
+ customers = { customers: customers };
+ }
+
+ log.debug({
+ email: req.params.email,
+ customers: customers || {}
+ }, 'ForgotPassword: done');
+ res.send(200, customers);
+ return next();
+ });
+ }
+
+};
diff --git a/pool/shard007/JavaScript/0048423_buildModuleUrl.js b/pool/shard007/JavaScript/0048423_buildModuleUrl.js
new file mode 100644
index 0000000000000000000000000000000000000000..130e6778a6525a0940bd3e9a14ed14a4267a945c
--- /dev/null
+++ b/pool/shard007/JavaScript/0048423_buildModuleUrl.js
@@ -0,0 +1,103 @@
+/*global define*/
+define([
+ '../ThirdParty/Uri',
+ './defined',
+ './DeveloperError',
+ 'require'
+ ], function(
+ Uri,
+ defined,
+ DeveloperError,
+ require) {
+ "use strict";
+ /*global CESIUM_BASE_URL*/
+
+ var cesiumScriptRegex = /((?:.*\/)|^)cesium[\w-]*\.js(?:\W|$)/i;
+ function getBaseUrlFromCesiumScript() {
+ var scripts = document.getElementsByTagName('script');
+ for ( var i = 0, len = scripts.length; i < len; ++i) {
+ var src = scripts[i].getAttribute('src');
+ var result = cesiumScriptRegex.exec(src);
+ if (result !== null) {
+ return result[1];
+ }
+ }
+ return undefined;
+ }
+
+ var baseUrl;
+ function getCesiumBaseUrl() {
+ if (defined(baseUrl)) {
+ return baseUrl;
+ }
+
+ var baseUrlString;
+ if (typeof CESIUM_BASE_URL !== 'undefined') {
+ baseUrlString = CESIUM_BASE_URL;
+ } else {
+ baseUrlString = getBaseUrlFromCesiumScript();
+ }
+
+ if (!defined(baseUrlString)) {
+ throw new DeveloperError('Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.');
+ }
+
+ baseUrl = new Uri(baseUrlString).resolve(new Uri(document.location.href));
+
+ return baseUrl;
+ }
+
+ function buildModuleUrlFromRequireToUrl(moduleID) {
+ //moduleID will be non-relative, so require it relative to this module, in Core.
+ return require.toUrl('../' + moduleID);
+ }
+
+ function buildModuleUrlFromBaseUrl(moduleID) {
+ return new Uri(moduleID).resolve(getCesiumBaseUrl()).toString();
+ }
+
+ var implementation;
+ var a;
+
+ /**
+ * Given a non-relative moduleID, returns an absolute URL to the file represented by that module ID,
+ * using, in order of preference, require.toUrl, the value of a global CESIUM_BASE_URL, or
+ * the base URL of the Cesium.js script.
+ *
+ * @private
+ */
+ var buildModuleUrl = function(moduleID) {
+ if (!defined(implementation)) {
+ //select implementation
+ if (defined(require.toUrl)) {
+ implementation = buildModuleUrlFromRequireToUrl;
+ } else {
+ implementation = buildModuleUrlFromBaseUrl;
+ }
+ }
+
+ if (!defined(a)) {
+ a = document.createElement('a');
+ }
+
+ var url = implementation(moduleID);
+
+ a.href = url;
+ a.href = a.href; // IE only absolutizes href on get, not set
+
+ return a.href;
+ };
+
+ // exposed for testing
+ buildModuleUrl._cesiumScriptRegex = cesiumScriptRegex;
+
+ /**
+ * Sets the base URL for resolving modules.
+ * @param {String} value The new base URL.
+ */
+ buildModuleUrl.setBaseUrl = function(value) {
+ baseUrl = new Uri(value).resolve(new Uri(document.location.href));
+ };
+
+ return buildModuleUrl;
+});
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048425_objectDirCtrl.js b/pool/shard007/JavaScript/0048425_objectDirCtrl.js
new file mode 100644
index 0000000000000000000000000000000000000000..54b3cb0ed512872e221f20e30db7541ee9611947
--- /dev/null
+++ b/pool/shard007/JavaScript/0048425_objectDirCtrl.js
@@ -0,0 +1,44 @@
+(function () {
+ "use strict";
+
+ // ReSharper disable once UndeclaredGlobalVariableUsing
+ angular
+ .module("umbraco")
+ .controller("ujetObjectDirCtrl", ujetObjectDirCtrl);
+
+ ujetObjectDirCtrl.$inject = ["$scope"];
+
+ function ujetObjectDirCtrl($scope) {
+ var vm = {
+ canSelect: $scope.canSelect,
+ canEdit: $scope.canEdit,
+ canDelete: $scope.canDelete,
+ selectObject: selectObject,
+ editObject: editObject,
+ deleteObject: deleteObject
+ };
+
+ $scope.vm = vm;
+
+ function selectObject() {
+ $scope.$emit("selectObject", vm.object);
+ };
+
+ function editObject() {
+ $scope.$emit("editObject", vm.object);
+ };
+
+ function deleteObject() {
+ $scope.$emit("deleteObject", vm.object);
+ };
+
+ $scope.$watch("model", function (newValue) {
+ if (_.isNull(newValue) ||
+ _.isUndefined(newValue)) {
+ return;
+ }
+
+ vm.object = newValue;
+ });
+ };
+})();
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048426_Intro.js b/pool/shard007/JavaScript/0048426_Intro.js
new file mode 100644
index 0000000000000000000000000000000000000000..3003e92bd150f296412c550b1c16d830ce777f96
--- /dev/null
+++ b/pool/shard007/JavaScript/0048426_Intro.js
@@ -0,0 +1,60 @@
+define(function(require, exports, module) {
+
+ var Womb = require( 'app/Womb' );
+
+ var Ring = require( 'app/scenes/html5_webGL/Ring' );
+ var Text = require( 'app/scenes/html5_webGL/Text' );
+ var Image = require( 'app/scenes/html5_webGL/Image' );
+ var Fan = require( 'app/scenes/html5_webGL/Fan' );
+ var Random = require( 'app/scenes/html5_webGL/Random' );
+
+ function Intro( womb, params ){
+
+ this.womb = womb;
+
+ this.womb.loader.addToLoadBar();
+
+ this.scenes = [];
+
+ this.voicePulser = new Ring( womb , {
+ numOf: 10,
+ //img: null,
+ geo: new THREE.CubeGeometry( 450 , 5 , 450 , 10 , 10 , 10 )
+ });
+ this.voicePulser.scene.rotation.x = Math.PI / 2;
+ this.voicePulser.scene.position.z = -100;
+
+ this.womb.loader.loadBarAdd();
+
+ //this.world.update = this.update.bind( this );
+
+ }
+
+
+ Intro.prototype.triggerEvent = function( e ){
+
+ this.events[e].bind( this )();
+
+ }
+
+
+ Intro.prototype.nextEvent = function(){
+
+ this.triggerEvent( this.currentEvent );
+ this.currentEvent ++;
+
+ }
+
+
+ Intro.prototype.enter = function(){
+
+
+ }
+
+ Intro.prototype.exit = function(){
+
+ }
+
+ module.exports = Intro;
+
+});
diff --git a/pool/shard007/JavaScript/0048428_server.js b/pool/shard007/JavaScript/0048428_server.js
new file mode 100644
index 0000000000000000000000000000000000000000..88c5f71924ef9bca47ad91824690f0c9407ffdc8
--- /dev/null
+++ b/pool/shard007/JavaScript/0048428_server.js
@@ -0,0 +1,98 @@
+"use strict";
+
+const http = require('http');
+const app = require('express')();
+const bodyParser = require('body-parser');
+const util = require('util');
+const NginxController = require('./NginxController');
+const ifconfigSecureListenHosts = require('./ifconfigSecureListenHosts');
+
+const CONTROL_PORT = 1081;
+
+const nginx = new NginxController(__dirname);
+
+function validateEndpoint(endpoint, res) {
+ if (!endpoint.match(/[0-9a-z\.\-_]{4,}/)) {
+ res.status(400).end('endpoint is suspicious: ' + endpoint + "\n");
+ return false;
+ }
+ return true;
+}
+
+function proxyCreateHandler(endpoint, url, res) {
+ res.set('Content-type', 'text/plain');
+
+ if (!validateEndpoint(endpoint, res))
+ return;
+
+ nginx.generateProxyConfig(endpoint, url);
+ nginx.reloadNginx();
+
+ const msg = util.format('proxy %s -> %s\n', endpoint, url);
+ res.status(201).end(msg);
+}
+
+
+app.use(bodyParser.json());
+
+
+app.delete('/proxy/:endpoint', (req, res) => {
+
+ const endpoint = req.params.endpoint;
+ if (!validateEndpoint(endpoint, res))
+ return;
+
+ nginx.deleteProxyConfig(endpoint);
+ nginx.reloadNginx();
+
+ res.end('delete');
+});
+
+app.put('/proxy/:endpoint/to-port/:port', (req, res) => {
+ const port = Number.parseInt(req.params.port, 10);
+
+ if (!(port > 1 && port < 65535 )) {
+ res.status(400).end('bad port specified\n');
+ return;
+ }
+
+ const url = 'http://' + (req.ip.indexOf(':') > -1 ? '[' + req.ip + ']' : req.ip) + ':' + port;
+
+ proxyCreateHandler(req.params.endpoint, url, res);
+
+});
+
+app.put('/proxy/:endpoint/to-http-url/:url', (req, res) => {
+ const rawUrl = req.params.url;
+
+ // 1.1.1.1:1
+
+ if (!rawUrl.match(/^[\d\.:]{9,}/)) {
+ res.status(400).end("url should contain numeric ip4 address, possible semicolon (encoded as %3a) and port\n");
+ return;
+ }
+
+ const url = 'http://' + rawUrl;
+
+ proxyCreateHandler(req.params.endpoint, url, res);
+});
+
+
+ifconfigSecureListenHosts((hosts) => {
+
+ hosts.map((host) => {
+
+ http.createServer(app).listen(CONTROL_PORT, host);
+ console.log("%s: control REST API listening on %s:%d", new Date(), host, CONTROL_PORT);
+
+ });
+
+ nginx.run();
+
+});
+
+
+process.on('SIGTERM', function () {
+ nginx.stop();
+ process.exit(0);
+});
diff --git a/pool/shard007/JavaScript/0048434_syncPaging.spec.js b/pool/shard007/JavaScript/0048434_syncPaging.spec.js
new file mode 100644
index 0000000000000000000000000000000000000000..757b241548540b8ff774e32fcaaa7fa6881c43d2
--- /dev/null
+++ b/pool/shard007/JavaScript/0048434_syncPaging.spec.js
@@ -0,0 +1,53 @@
+const PagedArray= require("../bin/PagedArray");
+
+const testArr=[1,2,3];
+const dummyRun =function(data,val){
+ return data;
+}
+var obj;
+const dummyPageArray=function(){
+ if(!obj)
+ obj=new PagedArray.default(testArr,{size:2,run:dummyRun});
+ return obj;
+}
+
+
+describe("paging-create", function () {
+ it("should create a empty array ready to be loaded", function () {
+ //var product = calculator.multiply(2, 3);
+
+ var arr=dummyPageArray();
+ expect(arr.length).toBe(0);
+ });
+});
+
+describe("paging-load", function () {
+ it("should show an array of two positions", function () {
+ //var product = calculator.multiply(2, 3);
+
+ var arr=dummyPageArray();
+ arr.load();
+ expect(arr.length).toBe(2);
+ });
+});
+
+describe("paging-next", function () {
+ it("should show an array of one position", function () {
+ //var product = calculator.multiply(2, 3);
+
+ var arr=dummyPageArray();
+ arr.next();
+ expect(arr.length).toBe(1);
+ });
+});
+
+describe("paging-previous", function () {
+ it("should show an array of two positions", function () {
+ //var product = calculator.multiply(2, 3);
+
+ var arr=dummyPageArray();
+
+ arr.previous();
+ expect(arr.length).toBe(2);
+ });
+});
diff --git a/pool/shard007/JavaScript/0048439_index.js b/pool/shard007/JavaScript/0048439_index.js
new file mode 100644
index 0000000000000000000000000000000000000000..150d7f7ec14ec33fa124837d485cc541a6969276
--- /dev/null
+++ b/pool/shard007/JavaScript/0048439_index.js
@@ -0,0 +1,79 @@
+import gutil from 'gulp-util';
+import {Plugin} from 'gulp-tools';
+import {PatternStream} from './pattern_stream';
+import File from 'vinyl';
+import path from 'path';
+
+class GulpPlugin extends Plugin {
+
+ constructor() {
+ super('gulp-magic-template');
+ this.patterns = null;
+ }
+
+ configure(options) {
+ this.options = options ? options : {};
+
+ // The set of patterns we expect to find
+ this.option('patterns');
+
+ // The set of globals we expect to find
+ this.option('globals', null, (v) => { return true; });
+
+ // The handler to invoke with the set of loaded pattern files
+ // The input is { key: token, key: token, ... }
+ // where token: { path: 'foo/source2.html', value: '...', uid: 'foo/source2', id: 'html' }
+ this.option('action');
+
+ // The handler to invoke to generate the output path for complete files
+ // The input is { key: token, key: token, ... }
+ // where token: { path: 'foo/source2.html', value: '...', uid: 'foo/source2', id: 'html' }
+ this.option('path');
+
+ // This handler is invoked with debug information at the end of the process
+ // Use this if things seem to be going strange.
+ this.option('debug', null, (v) => { return true; });
+ }
+
+ handle_string(file, value, callback, fstream) {
+
+ /// Create a new pattern config, if none exists
+ if (this.patterns == null) {
+ this.patterns = new PatternStream();
+ this.patterns.instance(this.options.patterns);
+ if (this.options.globals) {
+ this.patterns.global(this.options.globals);
+ }
+ }
+
+ // Process a value
+ var results = this.patterns.handle(file.path, value);
+ var failed = null;
+ if (results) {
+ for (var i = 0; i < results.length; ++i) {
+ try {
+ var output = this.options.action(results[i].tokens);
+ var path = this.options.path(results[i].tokens);
+ var fp = new File({ path: path, cwd: file.cwd, base: file.base, contents: new Buffer(output) });
+ fstream.push(fp);
+ }
+ catch(err) {
+ failed = new gutil.PluginError(this.name, err, {fileName: file.path});
+ }
+ }
+ }
+ callback(failed);
+ }
+
+ /** Emit debug information on close */
+ handle_close(fstream, callback) {
+ if (this.options.debug) {
+ this.options.debug(this.patterns.debug());
+ }
+ callback();
+ }
+}
+
+export default function handler(opts) {
+ return new GulpPlugin().handler()(opts);
+}
diff --git a/pool/shard007/JavaScript/0048442_gulpfile.js b/pool/shard007/JavaScript/0048442_gulpfile.js
new file mode 100644
index 0000000000000000000000000000000000000000..a85368952ad7a7d4b2a587b3a508c6c7ba0cea95
--- /dev/null
+++ b/pool/shard007/JavaScript/0048442_gulpfile.js
@@ -0,0 +1,50 @@
+'use strict';
+
+var gulp = require('gulp');
+var browserify = require('browserify');
+var source = require('vinyl-source-stream');
+var streamify = require('gulp-streamify');
+var size = require('gulp-size');
+var uglify = require('gulp-uglify');
+var rename = require('gulp-rename');
+var watch = require('gulp-watch');
+var eslint = require('gulp-eslint');
+var del = require('del');
+
+var config = {
+ namespace: 'braintree',
+ src: {
+ js: {
+ all: './src/**/*.js',
+ main: './index.js',
+ output: 'card-validator.js',
+ min: 'card-validator.min.js'
+ }
+ },
+ dist: 'dist'
+};
+
+gulp.task('lint', function () {
+ gulp.src([config.src.js.all])
+ .pipe(eslint())
+ .pipe(eslint.format());
+});
+
+gulp.task('js', ['lint'], function () {
+ return browserify({standalone: 'cardValidator'})
+ .add(config.src.js.main)
+ .bundle()
+ .pipe(source(config.src.js.output))
+ .pipe(streamify(size()))
+ .pipe(gulp.dest(config.dist))
+ .pipe(streamify(uglify()))
+ .pipe(streamify(size()))
+ .pipe(rename(config.src.js.min))
+ .pipe(gulp.dest(config.dist));
+});
+
+gulp.task('clean', function (done) {
+ del([ config.dist ], done);
+});
+
+gulp.task('build', ['clean', 'js']);
diff --git a/pool/shard007/JavaScript/0048444_batchconsumerbatchmodifier.js b/pool/shard007/JavaScript/0048444_batchconsumerbatchmodifier.js
new file mode 100644
index 0000000000000000000000000000000000000000..a72524cacef18709f41dac77b2b35a696737a292
--- /dev/null
+++ b/pool/shard007/JavaScript/0048444_batchconsumerbatchmodifier.js
@@ -0,0 +1,93 @@
+/**
+ * @file batchconsumerbatchmodifier.js
+ * @brief Batch consumer - batch modifier step
+ * @author Frédéric SCHERMA (INRA UMR1095)
+ * @date 2017-12-19
+ * @copyright Copyright (c) 2017 INRA/CIRAD
+ * @license MIT (see LICENSE file)
+ * @details
+ */
+
+let ActionStepFormat = require('./actionstepformat');
+let Marionette = require('backbone.marionette');
+
+let Format = function() {
+ ActionStepFormat.call(this);
+
+ this.name = "batchconsumer_batchmodifier";
+ this.group = "standard";
+ this.description = _t("Take a list of batch in input and some descriptors to be defined on those batches, the output list is the list of the batches.");
+
+ this.acceptFormat = ['batch_id'];
+ this.dataFormat = ['batch_id'];
+};
+
+_.extend(Format.prototype, ActionStepFormat.prototype, {
+ defaultFormat: function() {
+ return {};
+ }
+});
+
+
+Format.ActionStepProcessView = ActionStepFormat.ActionStepProcessView.extend({
+ className: 'action-step-process',
+ template: require('../templates/actionstep/process/batchconsumerbatchmodifier.html'),
+
+ initialize: function(options) {
+ options || (options = {readonly: true});
+
+ this.listenTo(this.model, 'change', this.render, this);
+ },
+
+ onRender: function() {
+ if (this.getOption('readonly')) {
+
+ } else {
+
+ }
+ },
+
+ onBeforeDestroy: function() {
+ if (!this.getOption('readonly')) {
+ }
+ },
+
+ exportInput: function() {
+
+ },
+
+ importData: function() {
+
+ },
+
+ inputsType: function() {
+ return 'none';
+ },
+
+ inputsData: function() {
+ return null;
+ }
+});
+
+Format.ActionStepReadView = ActionStepFormat.ActionStepReadView.extend({
+});
+
+Format.ActionStepFormatDetailsView = ActionStepFormat.ActionStepFormatDetailsView.extend({
+ className: 'action-step-format-details',
+ template: require('../templates/actionstep/type/batchconsumerbatchmodifier.html'),
+
+ initialize: function() {
+ this.listenTo(this.model, 'change', this.render, this);
+ },
+
+ onRender: function() {
+ let format = this.model.get('format');
+ },
+
+ storeData: function() {
+ return {
+ }
+ }
+});
+
+module.exports = Format;
diff --git a/pool/shard007/JavaScript/0048445_Skills.js b/pool/shard007/JavaScript/0048445_Skills.js
new file mode 100644
index 0000000000000000000000000000000000000000..135d42c06367435d096af95d4b9686b77a4067d0
--- /dev/null
+++ b/pool/shard007/JavaScript/0048445_Skills.js
@@ -0,0 +1,134 @@
+/**
+ * Skills Controller By Nicholas Dickey, Copyright (c) 2013, Hudson Wilde Labs
+ */
+Ext.define('QwiketMVC.controller.Skills', {
+ extend: 'Ext.app.Controller',
+ stores: ['Skill'],
+ models: ['Skill'],
+ views: ['positions.SkillsPanel'],
+ refs: [{
+ ref: 'SkillsPanel',
+ selector: 'skills'
+ },
+ {
+ ref:'SkillForm',
+ selector: '#edit_skill'
+ }
+ ],
+
+ init: function() {
+ //alert(positionid);
+ //store=this.getSkillStore();
+ //store.proxy.extraParams.positionid=positionid;
+ this.control({
+ 'skills button[action=new_skill]': {
+ click: this.newSkill
+ },
+ 'skills button[action=save_skill]': {
+ click: this.saveSkill
+ }
+ ,
+ 'skills button[action=cancel_skill]': {
+ click: this.cancelSkill
+ }
+ ,
+ 'skills dataview': {
+ itemdblclick: this.editSkill
+ },
+ 'skills dataview': {
+ itemclick: this.editSkill
+ }
+ });
+ },
+ newSkill: function(grid, record) {
+ var panel = Ext.create('QwiketMVC.view.positions.SkillForm').show();
+ /* if(record){
+ panel.down('form').loadRecord(record);
+ }*/
+
+ },
+ loadPositionsList: function(){
+
+ store=this.getPositionStore();
+ var status_selector=this.getStatusSelectorCombo().getValue();
+ if(status_selector==null)
+ status_selector=0;
+ store.proxy.extraParams.status_selector=status_selector;
+ store.load();
+ },
+ editPosition: function(grid, record) {
+ var dom = Ext.query('div#account_summary');
+ var div=dom[0];
+ div.innerHTML='';
+
+ var panel=this.getPositionsPanel();
+ panel.layout.setActiveItem(1);
+ var form=this.getPositionForm();
+ if(record){
+ panel.down('form').loadRecord(record);
+ var status=record.get('status');
+ var position_status=this.getPositionStatus();
+ var status_text='Pending';
+ if(status==1)
+ status_text='Active';
+ else if (status==2)
+ status_text='Closed';
+ form.setTitle("Edit Position: "+record.get('code'));
+ position_status.setValue(status_text);
+ }
+ },
+ newPosition: function(button) {
+ var dom = Ext.query('div#account_summary');
+ var div=dom[0];
+ div.innerHTML='';
+
+ var panel=this.getPositionsPanel();
+ panel.layout.setActiveItem(1);
+ var form=this.getPositionForm();
+ form.setTitle("New Position");
+ form.getForm().reset();
+ var elem=Ext.get("content").el.child("ul")
+ var v=elem.child("li:last");
+ v.update(")
");
+ elem.insertHtml("beforeEnd","- Edit
",false);
+ },
+ cancelPosition: function(button) {
+ var dom = Ext.query('div#account_summary');
+ var div=dom[0];
+ div.innerHTML='';
+
+ var panel=this.getPositionsPanel();
+ panel.layout.setActiveItem(0);
+ var elem=Ext.get("content").el.child("ul")
+ var v=elem.child("li:last");
+ v.update(")
");
+ elem.insertHtml("beforeEnd","- Overview
",false);
+ },
+ savePosition: function(button) {
+ var dom = Ext.query('div#account_summary');
+ var div=dom[0];
+ div.innerHTML='';
+
+ var form = button.up('form'),
+ record = form.getRecord(),
+ values = form.getValues(),
+ store=this.getPositionStore();
+
+ var novo = false;
+ if (values.account_id > 0){
+ record.set(values);
+ } else{
+ record = Ext.create('QwiketMVC.model.Position');
+ record.set(values);
+ store.add(record);
+ novo = true;
+ }
+ store.sync();
+ var panel=this.getPositionsPanel();
+ panel.layout.setActiveItem(0);
+
+ if (novo){
+ store.load();
+ }
+ }
+});
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048447_remove-ownership-of-blog.js b/pool/shard007/JavaScript/0048447_remove-ownership-of-blog.js
new file mode 100644
index 0000000000000000000000000000000000000000..44eb2a720366470246ce194a072f84439dd9ec8c
--- /dev/null
+++ b/pool/shard007/JavaScript/0048447_remove-ownership-of-blog.js
@@ -0,0 +1,31 @@
+var userID = process.argv[2];
+var blogID = process.argv[3];
+
+if (!userID) throw new Error("Please pass userID as first argument");
+if (!blogID) throw new Error("Please pass blogID as second argument");
+
+var User = require("user");
+
+User.getById(userID, function(err, user) {
+
+ if (err || !user) throw err || new Error("No user with userID " + userID);
+
+ if (user.blogs.indexOf(blogID) === -1)
+ throw new Error("User " + userID + " does not have blog " + blogID);
+
+ var before = user.blogs.slice();
+
+ user.blogs = user.blogs.filter(function(otherBlogID) {
+ return otherBlogID !== blogID;
+ });
+
+ console.log('BEFORE', before, 'AFTER', user.blogs);
+
+ User.set(userID, { blogs: user.blogs }, function(err) {
+ if (err) throw err;
+
+ console.log('Warning! This will not affect the user\'s subscription settings to make sure to adjust their bill');
+ console.log("Done!");
+ process.exit();
+ });
+});
diff --git a/pool/shard007/JavaScript/0048448_jquery.flyingobjects.js b/pool/shard007/JavaScript/0048448_jquery.flyingobjects.js
new file mode 100644
index 0000000000000000000000000000000000000000..ff0254470f62d069a251794393dcc4aa009db65d
--- /dev/null
+++ b/pool/shard007/JavaScript/0048448_jquery.flyingobjects.js
@@ -0,0 +1,132 @@
+/* flyingObjects jQuery Plugin
+written by: Nolan R Campbell
+NuvuScripts@gmail.com
+http://flyingobjects.nrcstudios.info
+http://be.net/nrcstudios
+http://codecanyon.net/user/NuvuScripts
+*/
+
+(function($){
+
+ //set options prior to each functions
+ $.fn.flyingobjects = function( options ) {
+ // defaults
+ options = $.extend({
+
+ images: ["",""], //array of images
+ totalobjects: 30, //total number of images added to the target container
+ easing: "swing", //image animation easing
+ speed: 1100, //speed of animation the lower the number the faster the animation
+ zindex: 2, //set the z-index of the images
+ addclass: "", //add a class to the images for DOM manipulation or styling
+ initialize: "mouseover" // trigger to start the animation set to "load" or "mouseover"
+
+ }, options);
+
+
+
+
+
+
+// Generate Random Speed
+fObjects.prototype.speed = function(evt) {
+ this.duration = (randomInt(10) + 5) * options.speed;
+
+ return this;
+};
+
+
+
+
+function randomInt(max) {
+// Generate a random integer
+ return Math.floor(Math.random() * max);
+}
+
+
+ function fObjects() {
+
+ this.images = options.images;
+
+// Randomly Pick a fObjects Model
+ this.image = this.images[randomInt(this.images.length)];
+ this.file = this.image;
+
+// Create a fObjects DOM
+ this.element = document.createElement('img');
+
+ this.speed().newPoint().display().newPoint().fly();
+};
+
+
+ return this.each(function() {
+
+ var $this = $(this);
+
+ //extend settings as options
+ var o = $.metadata ? $.extend({}, options, $this.metadata()) : options;
+
+
+ fObjects.prototype.display = function() {
+ $(this.element)
+ .addClass(options.addclass)
+ .attr('src', this.file)
+ .css('position', 'absolute')
+ .css('z-index', options.zindex)
+ .css('top', this.pointY)
+ .css('left', this.pointX);
+ $this.append(this.element);
+
+
+ return this;
+};
+
+
+
+
+// Animate fObjects Movements
+fObjects.prototype.fly = function() {
+ var self = this;
+ $(this.element).animate({
+ "top": this.pointY,
+ "left": this.pointX
+ },this.duration, options.easing, function(){
+ //if options initialize "mouseover" else "load" bind events
+ if(options.initialize == "mouseover"){$(this).mousemove(function(){ self.speed().newPoint().fly();});}else if(options.initialize == "load"){
+ self.speed().newPoint().fly();
+ }
+
+ });
+};
+// Generate a Random Position
+fObjects.prototype.newPoint = function() {
+ this.pointX = randomInt($this.width());
+ this.pointY = randomInt($this.height());
+
+ return this;
+};
+
+
+
+// Display the fObjects
+
+ //loop total number of objects and create new objects
+$(function(){
+ var total = o.totalobjects;
+ var fobjects = [];
+
+ for (var i = 0; i < total; i++){
+ fobjects[i] = new fObjects();
+ }
+});
+
+
+
+
+
+
+ }); //end each function
+
+ };
+
+})( jQuery );
diff --git a/pool/shard007/JavaScript/0048452_compressor.js b/pool/shard007/JavaScript/0048452_compressor.js
new file mode 100644
index 0000000000000000000000000000000000000000..e24764cc4ab88839573a038dc7c683ef7981182c
--- /dev/null
+++ b/pool/shard007/JavaScript/0048452_compressor.js
@@ -0,0 +1,75 @@
+/*
+* Compressor for Metro UI CSS
+* Require:
+* node.js
+* node-minify (https://github.com/srod/node-minify)
+* */
+
+var compressor = require('node-minify');
+var project_root = '/Projects/Metro-UI-CSS/',
+ module_path = project_root+'docs/js/metro/',
+ css_path = project_root+'docs/css/',
+ js_compile_path = project_root+'min/',
+ css_compile_path = project_root+'min/';
+
+var modules = [
+ module_path+'metro-core.js',
+ module_path+'metro-locale.js',
+ module_path+'metro-touch-handler.js',
+ module_path+'metro-accordion.js',
+ module_path+'metro-button-set.js',
+ module_path+'metro-date-format.js',
+ module_path+'metro-calendar.js',
+ module_path+'metro-datepicker.js',
+ module_path+'metro-carousel.js',
+ module_path+'metro-countdown.js',
+ module_path+'metro-dropdown.js',
+ module_path+'metro-input-control.js',
+ module_path+'metro-live-tile.js',
+ module_path+'metro-drag-tile.js',
+ module_path+'metro-progressbar.js',
+ module_path+'metro-rating.js',
+ module_path+'metro-slider.js',
+ module_path+'metro-tab-control.js',
+ module_path+'metro-table.js',
+ module_path+'metro-times.js',
+ module_path+'metro-dialog.js',
+ module_path+'metro-notify.js',
+ module_path+'metro-listview.js',
+ module_path+'metro-treeview.js',
+ module_path+'metro-fluentmenu.js',
+ module_path+'metro-hint.js',
+ module_path+'metro-streamer.js',
+ module_path+'metro-scroll.js',
+ module_path+'metro-stepper.js',
+ module_path+'metro-initiator.js'
+
+];
+
+new compressor.minify({
+ type: 'gcc',
+ language: 'ECMASCRIPT5',
+ fileIn: modules,
+ fileOut: js_compile_path+'metro.min.js',
+ callback: function(err, min){
+ if (err) console.log(err); else console.log("js compiled");
+ }
+});
+
+new compressor.minify({
+ type: 'yui-css',
+ fileIn: css_path+'metro-bootstrap.css',
+ fileOut: css_compile_path+'metro-bootstrap.min.css',
+ callback: function(err, min){
+ if (err) console.log(err); else console.log("main css compiled");
+ }
+});
+
+new compressor.minify({
+ type: 'yui-css',
+ fileIn: css_path+'metro-bootstrap-responsive.css',
+ fileOut: css_compile_path+'metro-responsive.min.css',
+ callback: function(err, min){
+ if (err) console.log(err); else console.log("responsive css compiled");
+ }
+});
diff --git a/pool/shard007/JavaScript/0048454_node_event_emitter_runner.js b/pool/shard007/JavaScript/0048454_node_event_emitter_runner.js
new file mode 100644
index 0000000000000000000000000000000000000000..6a81326579f297067389da6aea380668fde01ab9
--- /dev/null
+++ b/pool/shard007/JavaScript/0048454_node_event_emitter_runner.js
@@ -0,0 +1,30 @@
+// A custom execjs runner that expects the source to return an instance of EventEmitter
+// http://nodejs.org/api/events.html#events_class_events_eventemitter
+// Works in node only
+(function(program, execJS) { execJS(program) })(function(callback) { #{source}
+}, function(program) {
+ var output, print = function(string) {
+ process.stdout.write('' + string);
+ };
+ var callback = function(result){
+ if (typeof result == 'undefined' && result !== null) {
+ print('["ok"]');
+ } else {
+ try {
+ print('["ok", ' + JSON.stringify(result) + ']');
+ } catch (err) {
+ print('["err"]');
+ }
+ }
+ };
+ var returnError = function(err) {
+ print(JSON.stringify(['err', '' + err]));
+ };
+
+ // data and end -> success, error -> error
+ try {
+ program().on('data', callback).on('end', callback).on('error', returnError);
+ } catch (err) {
+ returnError(err);
+ }
+});
diff --git a/pool/shard007/JavaScript/0048456_individual.js b/pool/shard007/JavaScript/0048456_individual.js
new file mode 100644
index 0000000000000000000000000000000000000000..616a1bf1375736176efff96e9d5aaa6a2208e651
--- /dev/null
+++ b/pool/shard007/JavaScript/0048456_individual.js
@@ -0,0 +1,35 @@
+import 'babel/polyfill';
+import Individual from '../../core/individual';
+import { sum } from '../../utils';
+
+
+export default class MagicSquareIndividual extends Individual {
+ deconstruct(alleles) {
+ return alleles.reduce((merged, allele) => merged.concat(allele), []);
+ }
+
+ reconstruct(alleles) {
+ var output = [];
+ for (let i = 0, l = Math.sqrt(alleles.length); i < l; i++) {
+ output.push(alleles.slice(i * l, i * l + l));
+ }
+ return output;
+ }
+
+ fitness() {
+ var sums = [0, 0];
+ for (let i = 0, l = this._alleles.length; i < l; i++) {
+ sums.push(sum(...this._alleles[i]));
+ sums.push(sum(...this._alleles.map(row => row[i])));
+ sums[0] += this._alleles[i][i];
+ sums[1] += this._alleles[i][l - i - 1];
+ }
+ var counts = sums.reduce((counts, sum) => {
+ counts[sum] = counts.hasOwnProperty(sum) ? counts[sum] + 1 : 1;
+ return counts;
+ }, {});
+ var highest = Object.keys(counts).map(count => counts[count])
+ .reduce((highest, count) => count > highest ? count : highest, 0);
+ return sums.length - highest;
+ }
+}
diff --git a/pool/shard007/JavaScript/0048457_base-dse-authenticator.js b/pool/shard007/JavaScript/0048457_base-dse-authenticator.js
new file mode 100644
index 0000000000000000000000000000000000000000..bddc6493eb6bdb2d35546aa79933c60841be28b5
--- /dev/null
+++ b/pool/shard007/JavaScript/0048457_base-dse-authenticator.js
@@ -0,0 +1,76 @@
+/*
+ * Copyright DataStax, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+const util = require('util');
+const { Authenticator } = require('./provider');
+
+const dseAuthenticatorName = 'com.datastax.bdp.cassandra.auth.DseAuthenticator';
+
+/**
+ * Base class for Authenticator implementations that want to make use of
+ * the authentication scheme negotiation in the DseAuthenticator
+ * @param {String} authenticatorName
+ * @extends Authenticator
+ * @constructor
+ * @ignore
+ */
+function BaseDseAuthenticator(authenticatorName) {
+ this.authenticatorName = authenticatorName;
+}
+
+util.inherits(BaseDseAuthenticator, Authenticator);
+
+/**
+ * Return a Buffer containing the required SASL mechanism.
+ * @abstract
+ * @returns {Buffer}
+ */
+BaseDseAuthenticator.prototype.getMechanism = function () {
+ throw new Error('Not implemented');
+};
+
+/**
+ * Return a byte array containing the expected successful server challenge.
+ * @abstract
+ * @returns {Buffer}
+ */
+BaseDseAuthenticator.prototype.getInitialServerChallenge = function () {
+ throw new Error('Not implemented');
+};
+
+/**
+ * @param {Function} callback
+ * @override
+ */
+BaseDseAuthenticator.prototype.initialResponse = function (callback) {
+ if (!this._isDseAuthenticator()) {
+ //fallback
+ return this.evaluateChallenge(this.getInitialServerChallenge(), callback);
+ }
+ //send the mechanism as a first auth message
+ callback(null, this.getMechanism());
+};
+
+/**
+ * Determines if the name of the authenticator matches DSE 5+
+ * @protected
+ * @ignore
+ */
+BaseDseAuthenticator.prototype._isDseAuthenticator = function () {
+ return this.authenticatorName === dseAuthenticatorName;
+};
+
+module.exports = BaseDseAuthenticator;
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048458_waiters-test.js b/pool/shard007/JavaScript/0048458_waiters-test.js
new file mode 100644
index 0000000000000000000000000000000000000000..34fbb0ddceb90c4193c19d6bd26d98bc0e204928
--- /dev/null
+++ b/pool/shard007/JavaScript/0048458_waiters-test.js
@@ -0,0 +1,145 @@
+import { registerWaiter, unregisterWaiter, checkWaiters } from '../../lib/test/waiters';
+import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
+
+class Waiters {
+ constructor() {
+ this._waiters = [];
+ }
+
+ add() {
+ this._waiters.push([...arguments]);
+ }
+
+ register() {
+ this.forEach((...args) => {
+ registerWaiter(...args);
+ });
+ }
+
+ unregister() {
+ this.forEach((...args) => {
+ unregisterWaiter(...args);
+ });
+ }
+
+ forEach(callback) {
+ for (let i = 0; i < this._waiters.length; i++) {
+ let args = this._waiters[i];
+
+ callback(...args);
+ }
+ }
+
+ check() {
+ this.register();
+ let result = checkWaiters();
+ this.unregister();
+
+ return result;
+ }
+}
+
+moduleFor(
+ 'ember-testing: waiters',
+ class extends AbstractTestCase {
+ constructor() {
+ super();
+ this.waiters = new Waiters();
+ }
+
+ teardown() {
+ this.waiters.unregister();
+ }
+
+ ['@test registering a waiter'](assert) {
+ assert.expect(2);
+
+ let obj = { foo: true };
+
+ this.waiters.add(obj, function () {
+ assert.ok(this.foo, 'has proper `this` context');
+ return true;
+ });
+
+ this.waiters.add(function () {
+ assert.ok(true, 'is called');
+ return true;
+ });
+
+ this.waiters.check();
+ }
+
+ ['@test unregistering a waiter'](assert) {
+ assert.expect(2);
+
+ let obj = { foo: true };
+
+ this.waiters.add(obj, function () {
+ assert.ok(true, 'precond - waiter with context is registered');
+ return true;
+ });
+
+ this.waiters.add(function () {
+ assert.ok(true, 'precond - waiter without context is registered');
+ return true;
+ });
+
+ this.waiters.check();
+ this.waiters.unregister();
+
+ checkWaiters();
+ }
+
+ ['@test checkWaiters returns false if all waiters return true'](assert) {
+ assert.expect(3);
+
+ this.waiters.add(function () {
+ assert.ok(true, 'precond - waiter is registered');
+
+ return true;
+ });
+
+ this.waiters.add(function () {
+ assert.ok(true, 'precond - waiter is registered');
+
+ return true;
+ });
+
+ assert.notOk(this.waiters.check(), 'checkWaiters returns true if all waiters return true');
+ }
+
+ ['@test checkWaiters returns true if any waiters return false'](assert) {
+ assert.expect(3);
+
+ this.waiters.add(function () {
+ assert.ok(true, 'precond - waiter is registered');
+
+ return true;
+ });
+
+ this.waiters.add(function () {
+ assert.ok(true, 'precond - waiter is registered');
+
+ return false;
+ });
+
+ assert.ok(this.waiters.check(), 'checkWaiters returns false if any waiters return false');
+ }
+
+ ['@test checkWaiters short circuits after first falsey waiter'](assert) {
+ assert.expect(2);
+
+ this.waiters.add(function () {
+ assert.ok(true, 'precond - waiter is registered');
+
+ return false;
+ });
+
+ this.waiters.add(function () {
+ assert.notOk(true, 'waiter should not be called');
+ });
+
+ assert.ok(this.waiters.check(), 'checkWaiters returns false if any waiters return false');
+ }
+ }
+);
diff --git a/pool/shard007/JavaScript/0048461_createBrowserHistory.js b/pool/shard007/JavaScript/0048461_createBrowserHistory.js
new file mode 100644
index 0000000000000000000000000000000000000000..2a95e8198b431ea474dd8dde6ad792e38c5cdb60
--- /dev/null
+++ b/pool/shard007/JavaScript/0048461_createBrowserHistory.js
@@ -0,0 +1,139 @@
+'use strict';
+
+exports.__esModule = true;
+
+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; };
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+var _invariant = require('invariant');
+
+var _invariant2 = _interopRequireDefault(_invariant);
+
+var _Actions = require('./Actions');
+
+var _ExecutionEnvironment = require('./ExecutionEnvironment');
+
+var _DOMUtils = require('./DOMUtils');
+
+var _DOMStateStorage = require('./DOMStateStorage');
+
+var _createDOMHistory = require('./createDOMHistory');
+
+var _createDOMHistory2 = _interopRequireDefault(_createDOMHistory);
+
+var _createLocation = require('./createLocation');
+
+var _createLocation2 = _interopRequireDefault(_createLocation);
+
+/**
+ * Creates and returns a history object that uses HTML5's history API
+ * (pushState, replaceState, and the popstate event) to manage history.
+ * This is the recommended method of managing history in browsers because
+ * it provides the cleanest URLs.
+ *
+ * Note: In browsers that do not support the HTML5 history API full
+ * page reloads will be used to preserve URLs.
+ */
+function createBrowserHistory(options) {
+ _invariant2['default'](_ExecutionEnvironment.canUseDOM, 'Browser history needs a DOM');
+
+ var isSupported = _DOMUtils.supportsHistory();
+
+ function getCurrentLocation(historyState) {
+ historyState = historyState || window.history.state || {};
+
+ var path = _DOMUtils.getWindowPath();
+ var _historyState = historyState;
+ var key = _historyState.key;
+
+ var state = undefined;
+ if (key) {
+ state = _DOMStateStorage.readState(key);
+ } else {
+ state = null;
+ key = history.createKey();
+
+ if (isSupported) window.history.replaceState(_extends({}, historyState, { key: key }), null, path);
+ }
+
+ return _createLocation2['default'](path, state, undefined, key);
+ }
+
+ function startPopStateListener(_ref) {
+ var transitionTo = _ref.transitionTo;
+
+ function popStateListener(event) {
+ if (event.state === undefined) return; // Ignore extraneous popstate events in WebKit.
+
+ transitionTo(getCurrentLocation(event.state));
+ }
+
+ _DOMUtils.addEventListener(window, 'popstate', popStateListener);
+
+ return function () {
+ _DOMUtils.removeEventListener(window, 'popstate', popStateListener);
+ };
+ }
+
+ function finishTransition(location) {
+ var basename = location.basename;
+ var pathname = location.pathname;
+ var search = location.search;
+ var state = location.state;
+ var action = location.action;
+ var key = location.key;
+
+ if (action === _Actions.POP) return; // Nothing to do.
+
+ _DOMStateStorage.saveState(key, state);
+
+ var path = (basename || '') + pathname + search;
+ var historyState = {
+ key: key
+ };
+
+ if (action === _Actions.PUSH) {
+ if (isSupported) {
+ window.history.pushState(historyState, null, path);
+ } else {
+ window.location.href = path; // Use page reload to preserve the URL.
+ }
+ } else {
+ // REPLACE
+ if (isSupported) {
+ window.history.replaceState(historyState, null, path);
+ } else {
+ window.location.replace(path); // Use page reload to preserve the URL.
+ }
+ }
+ }
+
+ var history = _createDOMHistory2['default'](_extends({}, options, {
+ getCurrentLocation: getCurrentLocation,
+ finishTransition: finishTransition,
+ saveState: _DOMStateStorage.saveState
+ }));
+
+ var listenerCount = 0,
+ stopPopStateListener = undefined;
+
+ function listen(listener) {
+ if (++listenerCount === 1) stopPopStateListener = startPopStateListener(history);
+
+ var unlisten = history.listen(listener);
+
+ return function () {
+ unlisten();
+
+ if (--listenerCount === 0) stopPopStateListener();
+ };
+ }
+
+ return _extends({}, history, {
+ listen: listen
+ });
+}
+
+exports['default'] = createBrowserHistory;
+module.exports = exports['default'];
\ No newline at end of file
diff --git a/pool/shard007/JavaScript/0048463_app.js b/pool/shard007/JavaScript/0048463_app.js
new file mode 100644
index 0000000000000000000000000000000000000000..af3872416133131f4484329369f46162317d6ecc
--- /dev/null
+++ b/pool/shard007/JavaScript/0048463_app.js
@@ -0,0 +1,166 @@
+var express = require('express')
+ , app = express()
+ , fs = require('fs')
+ ,http = require('http')
+ , path = require('path')
+ , server = require("http").createServer(app)
+ , io = require('socket.io').listen(server)
+ , arDrone = require('ar-drone')
+ , arDroneConstants = require('ar-drone/lib/constants')
+ ;
+
+// Fetch configuration
+try {
+ var config = require('./config');
+} catch (err) {
+ console.log("Missing or corrupted config file. Have a look at config.js.example if you need an example.");
+ process.exit(-1);
+}
+
+
+// Override the drone ip using an environment variable,
+// using the same convention as node-ar-drone
+var drone_ip = process.env.DEFAULT_DRONE_IP || '192.168.1.1';
+
+// Keep track of plugins js and css to load them in the view
+var scripts = []
+ , styles = []
+ ;
+
+app.configure(function () {
+ app.set('port', process.env.PORT || 3000);
+ app.set('views', process.cwd() + '/views');
+ app.set('view engine', 'ejs', { pretty: true });
+ app.use(express.favicon());
+ app.use(express.logger('dev'));
+ app.use(app.router);
+ app.use(express.static(path.join(process.cwd(), 'public')));
+ app.use("/components", express.static(path.join(process.cwd(), 'bower_components')));
+});
+
+app.configure('development', function () {
+ app.use(express.errorHandler());
+ app.locals.pretty = true;
+});
+
+app.get('/', function (req, res) {
+ res.render('index', {
+ title: 'Nodecopter'
+ ,scripts: scripts
+ ,styles: styles
+ ,options: {
+ keyboard: config.keyboard
+ }
+ });
+});
+
+function navdata_option_mask(c) {
+ return 1 << c;
+}
+
+// From the SDK.
+var navdata_options = (
+ navdata_option_mask(arDroneConstants.options.DEMO)
+ | navdata_option_mask(arDroneConstants.options.VISION_DETECT)
+ | navdata_option_mask(arDroneConstants.options.MAGNETO)
+ | navdata_option_mask(arDroneConstants.options.WIFI)
+);
+
+// Connect and configure the drone
+var client = new arDrone.createClient({timeout:4000});
+client.config('general:navdata_demo', 'TRUE');
+client.config('video:video_channel', '0');
+client.config('general:navdata_options', navdata_options);
+
+// Add a handler on navdata updates
+var latestNavData;
+client.on('navdata', function (d) {
+ latestNavData = d;
+});
+
+// Signal landed and flying events.
+client.on('landing', function () {
+ console.log('LANDING');
+ io.sockets.emit('landing');
+});
+client.on('landed', function () {
+ console.log('LANDED');
+ io.sockets.emit('landed');
+});
+client.on('takeoff', function() {
+ console.log('TAKEOFF');
+ io.sockets.emit('takeoff');
+});
+client.on('hovering', function() {
+ console.log('HOVERING');
+ io.sockets.emit('hovering');
+});
+client.on('flying', function() {
+ console.log('FLYING');
+ io.sockets.emit('flying');
+});
+
+// Process new websocket connection
+io.set('log level', 1);
+io.sockets.on('connection', function (socket) {
+ socket.emit('event', { message: 'Welcome to cockpit :-)' });
+});
+
+// Schedule a time to push navdata updates
+var pushNavData = function() {
+ io.sockets.emit('navdata', latestNavData);
+};
+var navTimer = setInterval(pushNavData, 100);
+
+// Prepare dependency map for plugins
+var deps = {
+ server: server
+ , app: app
+ , io: io
+ , client: client
+ , config: config
+};
+
+
+// Load the plugins
+var dir = path.join(process.cwd(), 'plugins');
+function getFilter(ext) {
+ return function(filename) {
+ return filename.match(new RegExp('\\.' + ext + '$', 'i'));
+ };
+}
+
+config.plugins.forEach(function (plugin) {
+ console.log("Loading " + plugin + " plugin.");
+
+ // Load the backend code
+ require(path.join(dir, plugin))(plugin, deps);
+
+ // Add the public assets to a static route
+ if (fs.existsSync(assets = path.join(dir, plugin, 'public'))) {
+ app.use("/plugin/" + plugin, express.static(assets));
+ }
+
+ // Add the js to the view
+ if (fs.existsSync(js = path.join(assets, 'js'))) {
+ fs.readdirSync(js).filter(getFilter('js')).forEach(function(script) {
+ scripts.push("/plugin/" + plugin + "/js/" + script);
+ });
+ }
+
+ // Add the css to the view
+ if (fs.existsSync(css = path.join(assets, 'css'))) {
+ fs.readdirSync(css).filter(getFilter('css')).forEach(function(style) {
+ styles.push("/plugin/" + plugin + "/css/" + style);
+ });
+ }
+});
+
+// Start the web server
+server.listen(app.get('port'), function() {
+ console.log('AR. Drone WebFlight is listening on port ' + app.get('port'));
+});
+
+if (window.location.href.indexOf('localhost') < 0) {
+ window.location = 'http://localhost:' + app.get('port');
+}
diff --git a/pool/shard007/JavaScript/0048465_app.js b/pool/shard007/JavaScript/0048465_app.js
new file mode 100644
index 0000000000000000000000000000000000000000..2f62689af484ece05368b6e78faeee9912716163
--- /dev/null
+++ b/pool/shard007/JavaScript/0048465_app.js
@@ -0,0 +1,36 @@
+
+/**
+ * Module dependencies.
+ */
+
+var express = require('express');
+var routes = require('./routes');
+var user = require('./routes/user');
+var http = require('http');
+var path = require('path');
+
+var app = express();
+
+// all environments
+app.set('port', process.env.PORT || 3000);
+app.set('views', path.join(__dirname, 'views'));
+app.set('view engine', 'jade');
+app.use(express.favicon());
+app.use(express.logger('dev'));
+app.use(express.json());
+app.use(express.urlencoded());
+app.use(express.methodOverride());
+app.use(app.router);
+app.use(express.static(path.join(__dirname, 'public')));
+
+// development only
+if ('development' == app.get('env')) {
+ app.use(express.errorHandler());
+}
+
+app.get('/', routes.index);
+app.get('/oauth2callback', routes.oauthcallback);
+
+http.createServer(app).listen(app.get('port'), function(){
+ console.log('Express server listening on port ' + app.get('port'));
+});
diff --git a/pool/shard007/JavaScript/0048469_extendDisplayName.js b/pool/shard007/JavaScript/0048469_extendDisplayName.js
new file mode 100644
index 0000000000000000000000000000000000000000..bf510443db99e8751b58d2cebb230347ec66541d
--- /dev/null
+++ b/pool/shard007/JavaScript/0048469_extendDisplayName.js
@@ -0,0 +1,22 @@
+import { setDisplayName, getDisplayName, wrapDisplayName } from 'recompose';
+
+export default nameOrOptions => (Component) => {
+ const options = typeof nameOrOptions !== 'object' ? { name: nameOrOptions } : nameOrOptions;
+ const { name, operation = 'wrap' } = options;
+
+ let newDisplayName;
+ switch (operation) {
+ case 'wrap': {
+ newDisplayName = wrapDisplayName(Component, name);
+ break;
+ }
+ case 'replace': {
+ newDisplayName = name;
+ break;
+ }
+ default: {
+ newDisplayName = getDisplayName(Component);
+ }
+ }
+ return setDisplayName(newDisplayName)(Component);
+};
diff --git a/pool/shard007/JavaScript/0048470_15.4.4.20-9-c-ii-23.js b/pool/shard007/JavaScript/0048470_15.4.4.20-9-c-ii-23.js
new file mode 100644
index 0000000000000000000000000000000000000000..5f670b467e0102c4130667c9be3abf52ed1d6f55
--- /dev/null
+++ b/pool/shard007/JavaScript/0048470_15.4.4.20-9-c-ii-23.js
@@ -0,0 +1,24 @@
+/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch15/15.4/15.4.4/15.4.4.20/15.4.4.20-9-c-ii-23.js
+ * @description Array.prototype.filter - callbackfn called with correct parameters (this object O is correct)
+ */
+
+
+function testcase() {
+
+ var obj = { 0: 11, length: 2 };
+
+ function callbackfn(val, idx, o) {
+ return obj === o;
+ }
+
+ var newArr = Array.prototype.filter.call(obj, callbackfn);
+
+ return newArr.length === 1 && newArr[0] === 11;
+ }
+runTestCase(testcase);
diff --git a/pool/shard007/JavaScript/0048472_controller.js b/pool/shard007/JavaScript/0048472_controller.js
new file mode 100644
index 0000000000000000000000000000000000000000..27d624af64937d08d24361671f80308e51adde9d
--- /dev/null
+++ b/pool/shard007/JavaScript/0048472_controller.js
@@ -0,0 +1,259 @@
+/**
+ * Created by Steven on 2/20/2016.
+ */
+angular.module('TimeCapsule')
+ .controller('landingController', function ($scope, $location) {
+ $scope.scrollDown = function () {
+ $('html, body').animate({
+ scrollTop: $("#about").offset().top
+ }, 1000);
+ };
+
+ $scope.launchLogin = function () {
+ $('#login-modal')
+ .modal('show').modal('refresh')//re-centers
+ //.modal('attach events', '#login-modal .remove', 'hide')
+ .modal({
+ closable: false,
+ onDeny: function () {
+ return true;
+ },
+ onApprove: function () {
+ //$scope.loginConfirm;
+ return true;
+ }
+
+ });
+ $('#login-modal .form .message').hide();
+
+ $('#login-modal .ui.form')
+ .form({
+ fields: {
+ email: {
+ identifier: 'email',
+ rules: [
+ {
+ type: 'empty',
+ prompt: 'Please enter your e-mail'
+ },
+ {
+ type: 'email',
+ prompt: 'Please enter a valid e-mail'
+ }
+ ]
+ },
+ password: {
+ identifier: 'password',
+ rules: [
+ {
+ type: 'empty',
+ prompt: 'Please enter your password'
+ },
+ {
+ type: 'length[6]',
+ prompt: 'Your password must be at least 6 characters'
+ }
+ ]
+ }
+ }
+ });
+ };
+
+ $scope.loginConfirm = function () {
+ if (!$('#login-modal .ui.form').form('validate form')) {
+ $('#login-modal .form .message').show();
+ return false;
+ }
+ $location.path('/dashboard/');
+ //$scope.redirectFunction();
+ //$location.redirect('/dashboard/');
+ //Redirect
+ return true;
+ };
+
+
+
+ })
+ .controller('loginController', function ($scope, $location) {
+ $scope.redirectFunction = function () {
+ if (!$('#login-modal .ui.form').form('validate form')) {
+ $('#login-modal .form .message').show();
+ return false;
+ } else {
+ $('#login-modal')
+ .modal('hide');
+ //console.log("I was hit");
+ $location.path('/dashboard/');
+ return true;
+ }
+ }
+ })
+ .controller('dashboardController', function ($scope, $location, CityService) {
+ $scope.emptyfunc = function () {
+ };
+ $scope.redirectFunction = function (location) {
+ console.log(location);
+ $location.url(location + "/Chicago");
+ };
+ $scope.launchUpload = function(){
+ $location.path('/upload');
+ };
+
+
+ $scope.launchLogin = function () {
+ $('#city-modal')
+ .modal('show').modal('refresh')//re-centers
+ //.modal('attach events', '#login-modal .remove', 'hide')
+ .modal({
+ closable: false,
+ onDeny: function () {
+ return true;
+ },
+ onApprove: function () {
+ //$scope.loginConfirm;
+ return true;
+ }
+
+ });
+ $('#city-modal .form .message').hide();
+
+ $('#city-modal .ui.form')
+ .form({
+ fields: {
+ magicsuggest: {
+ identifier: 'input',
+ rules: [
+ {
+ type: 'empty',
+ prompt: 'Please select a city'
+ }
+ ]
+ }
+ }
+ });
+ };
+
+ $scope.exploreRandom = function(){
+ CityService.getCitesWithData(function(data){
+ $location.path('/capsule/' + data[(Math.floor((Math.random() * data.length)))]);
+ });
+ };
+
+ })
+ .controller('capsuleController', function ($scope, PhotoService, $routeParams, $location) {
+ //$scope.cityName = "Chicago";
+ //$scope.contact = Contact.get({id: parseInt($routeParams.id, 10)});
+ $scope.cityName = $routeParams.location ? $routeParams.location : "Chicago";
+
+ $scope.cityImages = [{
+ "Id": -1,
+ "Title": "Chicago Auto Show",
+ "Description": "The Chicago Auto Show is not only the nation's largest car show, it is also the longest running. The first show was held in the Chicago Coliseum in 1901. It received relatively little attention in the local press. Within a few short years, the show grew into a major tourist attraction. These photos are from the 1909 show.",
+ "Path": "../images/Chicago/12716328_10152896329597465_1232418463979988700_o.jpg",
+ "Location": "",
+ "OwnerId": "",
+ "DateUploaded": "",
+ "Year": 1909,
+ "Month": -1
+ }];
+
+ $('.special.cards .image').dimmer({
+ on: 'hover'
+ });
+
+ $scope.jumpToDash = function(){
+ $location.path('/dashboard');
+ };
+
+ PhotoService.queryImagesForCity($scope.cityName, function (data) {
+ $scope.cityImages = data;
+ });
+ //$scope.masonryStart = function(){
+ // console.log("hit mem");
+ $scope.$grid = $('.grid').masonry({
+ itemSelector: '.grid-item',
+ percentPosition: true,
+ //columnWidth: '.grid-sizer'
+ });
+
+ })
+ .controller('inputController', function ($scope, $location, CityService) {
+ $scope.array = [];
+ CityService.getCitesWithData(function (data) {
+ $scope.array = data;
+ msInit();
+ });
+ var msInit = function () {
+ $scope.mgsug = $('#magicsuggest').magicSuggest({
+ data: $scope.array,
+ maxSelection: 1,
+ allowFreeEntries: false//disallow free entries
+
+ //
+ });
+ };
+
+ $scope.travel = function () {
+ //console.log($scope.mgsug.getValue());
+ var location = $scope.mgsug.getValue()[0];
+ $('#city-modal')
+ .modal('hide');
+
+ //$location.path('/capsule')
+ $location.url('/capsule/' + location);
+ };//add string to path var
+ })
+ .controller('imageUploadController', ['$scope', 'Upload', '$timeout','CityService', '$location', function ($scope, Upload, $timeout, CityService, $location) {
+ $scope.phase={
+ upload:true,
+ crop:false,
+ submit:false
+ };
+
+ $scope.array =[];
+
+ CityService.getCitesWithData(function (data) {
+ $scope.array = data;
+ msInit();
+ });
+ var msInit = function () {
+ $scope.mgsug = $('#magicSuggestOpen').magicSuggest({
+ data: $scope.array,
+ maxSelection: 1,
+ allowFreeEntries: true//allow free entries and new cities
+ });
+ };
+
+ $scope.imgData = {
+ title: "",
+ // City: "",
+ month:"",
+ year:"",
+ description:"",
+ ownerId:1,
+ path:" ",
+
+ };
+
+ $scope.upload = function (dataUrl) {
+ $scope.imgData.city = $scope.mgsug.getValue()[0];
+ $scope.imgData.file = Upload.dataUrltoBlob(dataUrl);
+ console.log($scope.imgData);
+ $location.path('/dashboard');
+ //Upload.upload({
+ // url: '',
+ // data: $scope.imgData,
+ //}).then(function (response) {
+ // $timeout(function () {
+ // $scope.result = response.data;
+ // });
+ //}, function (response) {
+ // // if (response.status > 0) $scope.errorMsg = response.status
+ // // + ': ' + response.data;
+ // $location.path('/dashboard');
+ //}, function (evt) {
+ // //$scope.progress = parseInt(100.0 * evt.loaded / evt.total);
+ // $location.path('/dashboard');
+ //});
+ }
+ }]);
diff --git a/pool/shard007/JavaScript/0048473_phone_part.js b/pool/shard007/JavaScript/0048473_phone_part.js
new file mode 100644
index 0000000000000000000000000000000000000000..25570c013ae226f38c1a43d040f2ec801cd655c3
--- /dev/null
+++ b/pool/shard007/JavaScript/0048473_phone_part.js
@@ -0,0 +1,105 @@
+var Location = "Omsk";
+var Vibe_Hourly = 1;
+var Vibe_BT = 1;
+
+var Location_key = 1;
+var Vibe_Hourly_key = 2;
+var Vibe_BT_key = 3;
+
+function HTTPGET(url) {
+ var req = new XMLHttpRequest();
+ req.open("GET", url, false);
+ req.send(null);
+ return req.responseText;
+}
+
+function ReadSettings(){
+ Location = localStorage.getItem(Location_key);
+ if (!Location)
+ Location = "London";
+
+ Vibe_Hourly = localStorage.getItem(Vibe_Hourly_key);
+ if (!Vibe_Hourly)
+ Vibe_Hourly = 1;
+
+ Vibe_BT = localStorage.getItem(Vibe_BT_key);
+ if (!Vibe_BT)
+ Vibe_BT = 1;
+}
+
+function GetWeather(){
+ var response = HTTPGET("http://api.openweathermap.org/data/2.5/weather?q=" + Location);
+ var json = JSON.parse(response);
+ var temperature = (json.main.temp - 273.15) ;
+ var conditions = json.weather[0].main;
+
+ /*Just adding "+" sign for good temperature*/
+ var sign = "";
+ if (temperature > 0)
+ sign = "+";
+
+ temperature = temperature.toFixed(0);
+
+ /*Sending All data to Pebble*/
+ var CurrentWeather = sign + temperature ;
+ console.log("Weahter updated!" + CurrentWeather);
+
+ var Num_Condition = 0;
+
+ console.log(conditions);
+
+ if (conditions == "Rain")
+ Num_Condition = 1;
+ if (conditions == "Snow")
+ Num_Condition = 2;
+ if (conditions == "Thunderstorm")
+ Num_Condition = 3;
+ if (conditions == "Clear")
+ Num_Condition = 4;
+
+ Pebble.sendAppMessage( {"WEATHER_TEMPERATURE" : CurrentWeather, "WEATHER_CONDITIONS" : Num_Condition} );
+}
+
+function SendSettings(){
+ Pebble.sendAppMessage({
+ 'SETTINGS_HOURLY_VIBE': parseInt(Vibe_Hourly),
+ 'SETTINGS_BT_VIBE': parseInt(Vibe_BT)
+ });
+}
+
+Pebble.addEventListener("showConfiguration",
+ function(e) {
+ Pebble.openURL("http://grakovne.org/pebble/vic4884/AppConfig.php?Location=" + Location + "&Hourly_Vibe=" + Vibe_Hourly + "&BT_Vibe=" + Vibe_BT);
+ }
+);
+
+Pebble.addEventListener("ready",
+ function(e) {
+ console.log("Connection established!");
+ ReadSettings();
+ SendSettings();
+ GetWeather();
+ }
+);
+
+Pebble.addEventListener("webviewclosed",
+ function(e) {
+ var configuration = JSON.parse(decodeURIComponent(e.response));
+
+ localStorage.setItem(Location_key, configuration.Location);
+ localStorage.setItem(Vibe_Hourly_key, configuration.Hourly_Vibe);
+ localStorage.setItem(Vibe_BT_key, configuration.BT_Vibe);
+
+ ReadSettings();
+ SendSettings();
+ GetWeather();
+
+ }
+);
+
+Pebble.addEventListener("appmessage",
+ function(e) {
+ GetWeather();
+ }
+);
+
diff --git a/pool/shard007/JavaScript/0048475_classes-trans.js b/pool/shard007/JavaScript/0048475_classes-trans.js
new file mode 100644
index 0000000000000000000000000000000000000000..bf3efe51ae5d4407e9897609afe6c45323c63408
--- /dev/null
+++ b/pool/shard007/JavaScript/0048475_classes-trans.js
@@ -0,0 +1,72 @@
+'use strict';
+
+angular.module('trng.transformers').factory('ClassesTransformer', [
+ function() {
+ function studentDtoToEntity(dto) {
+ var entity = _.cloneDeep(dto);
+
+ entity.id = dto._id;
+ entity = _.omit(entity, '_id');
+
+ entity.user.id = dto.user._id;
+ entity.user = _.omit(entity.user, '_id');
+
+ return entity;
+ }
+
+ function studentEntityToDto(entity) {
+ var dto = _.cloneDeep(entity);
+
+ dto._id = entity.id;
+ dto = _.omit(dto, 'id');
+
+ dto.user._id = entity.user.id;
+ dto.user = _.omit(dto.user, 'id');
+
+ return dto;
+ }
+
+ var service = {
+ dtoToEntity: function(dto) {
+ var entity = _.cloneDeep(dto);
+
+ entity.id = dto._id;
+ entity = _.omit(entity, '_id');
+
+ entity.students = _.map(dto.students, function(studentDto) {
+ return studentDtoToEntity(studentDto);
+ });
+
+ _.forEach(entity.bpPublishDetailsList, function(publishDetails) {
+ if (publishDetails.autoStop !== -1) {
+ publishDetails.autoStop = publishDetails.autoStop;
+ }
+ });
+
+ return entity;
+ },
+
+ entityToDto: function(entity) {
+ var dto = _.cloneDeep(entity);
+
+ dto._id = entity.id;
+ dto = _.omit(dto, 'id');
+
+ dto.students = _.map(entity.students, function(studentEntity) {
+ return studentEntityToDto(studentEntity);
+ });
+
+ _.forEach(dto.bpPublishDetailsList, function(publishDetails) {
+ delete publishDetails.bpName;
+ if (publishDetails.autoStop !== -1) {
+ publishDetails.autoStop = publishDetails.autoStop;
+ }
+ });
+
+ return dto;
+ }
+ };
+
+ return service;
+ }
+]);
diff --git a/pool/shard007/JavaScript/0048480_editor.js b/pool/shard007/JavaScript/0048480_editor.js
new file mode 100644
index 0000000000000000000000000000000000000000..622f2859c1a7e57c538f0447346c2a77d77e1a96
--- /dev/null
+++ b/pool/shard007/JavaScript/0048480_editor.js
@@ -0,0 +1,27 @@
+var app=angular.module('Ruenoor');
+
+function robotControl($scope, $routeParams, Restangular) {
+
+ $scope.aceLoaded = function (_editor) {
+ $scope.editor = _editor;
+ _editor.setReadOnly(false);
+ Restangular.one("program", $routeParams.id).get().then(function (program) {
+ $scope.program = program;
+ $scope.editor.getSession().setValue($scope.program.code);
+ });
+ };
+
+ $scope.aceChanged = function (e) {
+ //
+ };
+
+ $scope.saveFile = function () {
+ console.log($scope.editor.getSession().getValue());
+ $scope.program.code = $scope.editor.getSession().getValue();
+ $scope.program.save();
+ alert("Program file saved");
+ }
+
+}
+
+app.controller("RobotControl", ['$scope', '$routeParams', 'Restangular', robotControl]);
diff --git a/pool/shard007/JavaScript/0048481_translate.js b/pool/shard007/JavaScript/0048481_translate.js
new file mode 100644
index 0000000000000000000000000000000000000000..103e739187f7c017c1f59e77a383cbe73d91b590
--- /dev/null
+++ b/pool/shard007/JavaScript/0048481_translate.js
@@ -0,0 +1,233 @@
+var at = require('basisjs-tools-ast').css;
+var at_js = require('basisjs-tools-ast').js;
+var html_at = require('basisjs-tools-ast').html;
+
+module.exports = function(flow){
+ var fconsole = flow.console;
+ var themeUrlsMap = false;
+ var customFilenames = true; //flow.options.sameFilenames || (flow.tmpl.hasIsolated && !flow.tmpl.isolationReproducible);
+
+ fconsole.start('Process packages');
+ flow.css.packages = flow.css.packages.filter(function(file){
+ var outputContent = at.translate(file.ast);
+ var isEmpty = !outputContent.length;
+
+ if (isEmpty && !file.themeUrlsMap)
+ {
+ fconsole.log('[!] ' + file.relOutputFilename + ' is empty - reject');
+
+ // 'cut' token from html
+ if (file.htmlNode)
+ {
+ file.htmlFile.unlink(file, file.htmlNode);
+ html_at.removeToken(file.htmlNode, true);
+ }
+ }
+ else
+ {
+ fconsole.log('[OK] ' + file.relOutputFilename);
+
+ file.outputContent = outputContent;
+
+ if (!flow.options.singleFile)
+ {
+ if (customFilenames)
+ {
+ file.htmlRef = file.proposedOutputFilename + '?' + file.digest;
+ file.outputFilename = file.proposedOutputFilename;
+ }
+ else
+ {
+ file.htmlRef = flow.outputResourceDir + file.digest + '.css';
+ file.outputFilename = file.htmlRef;
+ }
+ }
+ else
+ {
+ if (flow.js.rootNSFile.basis)
+ {
+ // temp solution
+ // TODO: make it better
+ var ast = flow.js.rootNSFile.basis.ast[1][1][1][1][3];
+ ast.splice(ast.length - 1, 0, at_js.parse(
+ 'basis.require("./' + file.jsRef + '").startUse();'
+ )[1][0]);
+ }
+ else
+ {
+ flow.exit('Can\'t inject css into result bundle. --single-file w/o basis.js is not supported for now.');
+ }
+ }
+
+ if (file.themeUrlsMap)
+ {
+ themeUrlsMap = file.themeUrlsMap;
+ file.themeUrlsMap[file.themeName] = file.htmlRef || file.outputFilename;
+ fconsole.log(' [+] add to theme map: ' + file.themeName + ' -> ' + file.themeUrlsMap[file.themeName]);
+ }
+
+ if (file.htmlNode)
+ {
+ if (file.inline && file.htmlId)
+ {
+ // replace content for