diff --git a/pool/shard000/JavaScript/0003799_worker-testharness.js b/pool/shard000/JavaScript/0003799_worker-testharness.js
new file mode 100644
index 0000000000000000000000000000000000000000..fdf5868e33e2fe35344818ec3f1a2e068b90996d
--- /dev/null
+++ b/pool/shard000/JavaScript/0003799_worker-testharness.js
@@ -0,0 +1,49 @@
+/*
+ * worker-test-harness should be considered a temporary polyfill around
+ * testharness.js for supporting Service Worker based tests. It should not be
+ * necessary once the test harness is able to drive worker based tests natively.
+ * See https://github.com/w3c/testharness.js/pull/82 for status of effort to
+ * update upstream testharness.js. Once the upstreaming is complete, tests that
+ * reference worker-test-harness should be updated to directly import
+ * testharness.js.
+ */
+
+importScripts('/resources/testharness.js');
+
+(function() {
+ var next_cache_index = 1;
+
+ // Returns a promise that resolves to a newly created Cache object. The
+ // returned Cache will be destroyed when |test| completes.
+ function create_temporary_cache(test) {
+ var uniquifier = String(++next_cache_index);
+ var cache_name = self.location.pathname + '/' + uniquifier;
+
+ test.add_cleanup(function() {
+ self.caches.delete(cache_name);
+ });
+
+ return self.caches.delete(cache_name)
+ .then(function() {
+ return self.caches.open(cache_name);
+ });
+ }
+
+ self.create_temporary_cache = create_temporary_cache;
+})();
+
+// Runs |test_function| with a temporary unique Cache passed in as the only
+// argument. The function is run as a part of Promise chain owned by
+// promise_test(). As such, it is expected to behave in a manner identical (with
+// the exception of the argument) to a function passed into promise_test().
+//
+// E.g.:
+// cache_test(function(cache) {
+// // Do something with |cache|, which is a Cache object.
+// }, "Some Cache test");
+function cache_test(test_function, description) {
+ promise_test(function(test) {
+ return create_temporary_cache(test)
+ .then(test_function);
+ }, description);
+}
diff --git a/pool/shard000/JavaScript/0003801_update.js b/pool/shard000/JavaScript/0003801_update.js
new file mode 100644
index 0000000000000000000000000000000000000000..734434ab4d5c3af84b5a27cd6a274eae8f016cbf
--- /dev/null
+++ b/pool/shard000/JavaScript/0003801_update.js
@@ -0,0 +1,69 @@
+'use strict';
+
+module.exports = function (wikifs, fixture, promise, test, isBinary) {
+ var updates = isBinary ? fixture.binaryFiles : fixture.textFiles;
+ var p = promise.then(function () {
+ return wikifs.createFile(
+ updates[0].path, updates[0].content, updates[0].commit_message,
+ updates[0].user_defined, isBinary
+ );
+ }).then(wikifs.readFile).catch(function (err) {
+ console.error(err); test.ok(false);
+ });
+
+ // update wikifs and assert it's attributes in sequence.
+ updates.forEach(function (update, index) {
+ // updates[0] was used to create a file
+ if (index === 0) {
+ return;
+ }
+
+ p = p.then(function (file) {
+ return wikifs.updateFile(
+ file.id, update.content, file.version,
+ update.commit_message
+ );
+ }).then(function (id) {
+ return wikifs.readFile(id).then(function (file) {
+ test.deepEqual(
+ file.content,
+ update.content
+ );
+ test.deepEqual(file.commit_message, update.commit_message);
+ // when created, version already 1.
+ test.equal(file.version, index + 1);
+ return file;
+ });
+ }).catch(function (err) { console.error(err); test.ok(false); });
+ });
+
+ // read old version and compare it
+ updates.forEach(function (update, index) {
+ p = p.then(function () {
+ return wikifs.readFile(updates[0].path, index + 1);
+ }).then(function (file) {
+ test.deepEqual(file.content, update.content);
+ test.deepEqual(file.commit_message, update.commit_message);
+ test.equal(file.version, index + 1);
+ }).catch(function (err) {
+ console.error(err); test.ok(false); });
+ });
+
+ // read history data.
+ p = p.then(function () {
+ return wikifs.readFileHistory(updates[0].path).then(function (history) {
+ history.forEach(function (commit, index) {
+ if (index === 0) {
+ return;
+ }
+ test.deepEqual(
+ commit.commit_message,
+ updates[index].commit_message
+ );
+ test.equal(commit.size, updates[index].content.length);
+ });
+ }).catch(function (err) { console.error(err); test.ok(false); });
+ });
+ p.then(function () { test.done(); wikifs.disconnect(); });
+};
+
diff --git a/pool/shard000/JavaScript/0003802_update-feed-widget.js b/pool/shard000/JavaScript/0003802_update-feed-widget.js
new file mode 100644
index 0000000000000000000000000000000000000000..b4d6bcd5e8d80a98068a3dcb82a7aae9ded7c548
--- /dev/null
+++ b/pool/shard000/JavaScript/0003802_update-feed-widget.js
@@ -0,0 +1,98 @@
+import { Template } from 'meteor/templating';
+import { Tracker } from 'meteor/tracker';
+import SimpleSchema from 'simpl-schema';
+import { moment } from 'meteor/momentjs:moment';
+import { _ } from 'meteor/erasaur:meteor-lodash';
+import { Roles } from 'meteor/alanning:roles';
+import { Feeds } from '../../../api/feed/FeedCollection';
+import { updateMethod } from '../../../api/base/BaseCollection.methods';
+import { Semesters } from '../../../api/semester/SemesterCollection.js';
+import { Courses } from '../../../api/course/CourseCollection.js';
+import { Opportunities } from '../../../api/opportunity/OpportunityCollection.js';
+import * as FormUtils from '../form-fields/form-field-utilities.js';
+import { ROLE } from '../../../api/role/Role';
+
+const updateSchema = new SimpleSchema({
+ description: { type: String, optional: true },
+ picture: { type: String, optional: true },
+ users: { type: Array }, 'users.$': String,
+ opportunity: { type: String, optional: true },
+ course: { type: String, optional: true },
+ semester: { type: String, optional: true },
+ retired: Boolean,
+}, { tracker: Tracker });
+
+Template.Update_Feed_Widget.onCreated(function onCreated() {
+ FormUtils.setupFormWidget(this, updateSchema);
+});
+
+Template.Update_Feed_Widget.helpers({
+ semesters() {
+ return Semesters.findNonRetired({}, { sort: { semesterNumber: 1 } });
+ },
+ feedTypes() {
+ return [
+ Feeds.NEW_COURSE,
+ Feeds.NEW_OPPORTUNITY,
+ Feeds.VERIFIED_OPPORTUNITY,
+ Feeds.NEW_COURSE_REVIEW,
+ Feeds.NEW_OPPORTUNITY_REVIEW,
+ Feeds.NEW_USER,
+ Feeds.NEW_LEVEL,
+ ];
+ },
+ timestamp() {
+ const feed = Feeds.findDoc(Template.currentData().updateID.get());
+ return moment(feed.timestamp).format();
+ },
+ feed() {
+ return Feeds.findDoc(Template.currentData().updateID.get());
+ },
+ opportunities() {
+ return Opportunities.find({}, { sort: { name: 1 } });
+ },
+ courses() {
+ return Courses.findNonRetired({}, { sort: { number: 1 } });
+ },
+ users() {
+ const students = Roles.getUsersInRole([ROLE.STUDENT]).fetch();
+ const sorted = _.sortBy(students, 'lastName');
+ return sorted;
+ },
+ falseValueRetired() {
+ const plan = Feeds.findDoc(Template.currentData()
+ .updateID
+ .get());
+ return !plan.retired;
+ },
+ trueValueRetired() {
+ const plan = Feeds.findDoc(Template.currentData()
+ .updateID
+ .get());
+ return plan.retired;
+ },
+});
+
+Template.Update_Feed_Widget.events({
+ submit(event, instance) {
+ event.preventDefault();
+ const updateData = FormUtils.getSchemaDataFromEvent(updateSchema, event);
+ instance.context.reset();
+ updateSchema.clean(updateData, { mutate: true });
+ updateData.retired = updateData.retired === 'true';
+ instance.context.validate(updateData);
+ if (instance.context.isValid()) {
+ updateData.id = instance.data.updateID.get();
+ updateMethod.call({ collectionName: Feeds.getCollectionName(), updateData }, (error) => {
+ if (error) {
+ FormUtils.indicateError(instance, error);
+ } else {
+ FormUtils.indicateSuccess(instance, event);
+ }
+ });
+ } else {
+ FormUtils.indicateError(instance);
+ }
+ },
+ 'click .jsCancel': FormUtils.processCancelButtonClick,
+});
diff --git a/pool/shard000/JavaScript/0003805_budget.js b/pool/shard000/JavaScript/0003805_budget.js
new file mode 100644
index 0000000000000000000000000000000000000000..45895a7d37fe70d4c169aa10ad32baa653fb76fb
--- /dev/null
+++ b/pool/shard000/JavaScript/0003805_budget.js
@@ -0,0 +1,23 @@
+var Mystique = require('mystique');
+
+var BudgetTransformer = Mystique.Transformer.extend({
+ resourceName: 'budget',
+ mapOut: function(budget) {
+ return {
+ id: budget.id,
+ name: budget.name,
+ startDate: budget.startDate,
+ remaining: budget.remaining,
+ };
+ },
+
+ mapIn(req) {
+ return {
+ name: req.body.budget.name,
+ startDate: req.body.budget.startDate,
+ remaining: req.body.budget.remaining,
+ };
+ },
+});
+
+Mystique.registerTransformer('Budget', BudgetTransformer);
diff --git a/pool/shard000/JavaScript/0003806_seed.js b/pool/shard000/JavaScript/0003806_seed.js
new file mode 100644
index 0000000000000000000000000000000000000000..0741510b53f6de5e226349a76379267692d11d83
--- /dev/null
+++ b/pool/shard000/JavaScript/0003806_seed.js
@@ -0,0 +1,30 @@
+var mongoose = require('mongoose'),
+ Course = require('./../models/course.js'),
+ User = require('./../models/user.js');
+
+exports.init = function(connectionString, cb) {
+ mongoose.connect(connectionString);
+ var user = new User({_id: '11e42af15f9b16241a4a80f8', name : "chibolo pulpin"});
+ user.save(function(err) {
+ if (err) return cb(err);
+ var fm = '{"isEditable":false,"decimals":2,"label":null,"bounds":{"upper":20,"lower":0},"trunk":0,"deleteMin":0,"children":[{"isEditable":true,"decimals":2,"label":null,"bounds":{"upper":20,"lower":0},"trunk":0,"deleteMin":0,"children":[]},{"isEditable":true,"decimals":2,"label":null,"bounds":{"upper":20,"lower":0},"trunk":0,"deleteMin":0,"children":[]}]}';
+ var coursesNames = ['Fisica 1','Calculo 1','Quimica 1','Teología','Mate basicas'];
+ var userId = user._id;
+ for (var i = 0; i < coursesNames.length; i++) {
+
+ //console.log("formula",fm);
+ Course.create({name: coursesNames[i],
+ formula: '{"isEditable":false,"decimals":2,"label":null,"bounds":{"upper":20,"lower":0},"trunk":0,"deleteMin":0,"children":[{"isEditable":true,"decimals":2,"label":null,"bounds":{"upper":20,"lower":0},"trunk":0,"deleteMin":0,"children":[]},{"isEditable":true,"decimals":2,"label":null,"bounds":{"upper":20,"lower":0},"trunk":0,"deleteMin":0,"children":[]}]}',
+ userId: userId},
+ function(err, course) {
+ if (err) return cb(err);
+ Course.share({
+ courseId: course._id,
+ userId: '11e42af15f9b16241a4a80f8'
+ }, function(err) {
+ if (err) return cb(err);
+ })
+ });
+ }
+ });
+}
\ No newline at end of file
diff --git a/pool/shard000/JavaScript/0003808_app-services.js b/pool/shard000/JavaScript/0003808_app-services.js
new file mode 100644
index 0000000000000000000000000000000000000000..9ba6ca3fc339238abe8075fdea2079b007eeaf33
--- /dev/null
+++ b/pool/shard000/JavaScript/0003808_app-services.js
@@ -0,0 +1,98 @@
+(function (window, angular, console) {
+
+ 'use strict';
+
+ /* Services */
+
+
+ // Demonstrate how to register services
+ // In this case it is a simple value service.
+ angular.module('myApp.services', []).value('version', '0.1').factory('admin', ['$rootScope',
+ function ($rootScope) {
+ return {
+ allowed: function (menu) {
+ if ($rootScope.user.roles.indexOf('_admin') === -1 && $rootScope.user.roles.indexOf('sys') === -1 && menu === "delete") {
+ return false;
+ }
+ return true;
+ }
+ };
+ }
+ ]).factory('auth', ['$q', '$http', 'md5', '$rootScope',
+ function ($q, $http, md5, $rootScope) {
+ $rootScope.profile = null;
+ var avatar = function (user, $route) {
+ $rootScope.profile = {
+ user: user,
+ hash: md5.createHash(user.name)
+ };
+ checkOrganization();
+ $http.jsonp("http://www.gravatar.com/" + $rootScope.profile.hash + ".json?callback=JSON_CALLBACK").
+ success(function (data, status, headers, config) {
+ if (data.entry && data.entry.length > 0 && data.entry[0].name && data.entry[0].name.formatted) {
+ $rootScope.profile.gravatar = data.entry[0].name.formatted;
+ }
+ }).
+ error(function (data, status, headers, config) {
+ $rootScope.profile.gravatar = "";
+ });
+ };
+ var checkOrganization = function () {
+ $rootScope.admin = $rootScope.profile.user.roles.indexOf('_admin') !== -1 || $rootScope.profile.user.roles.indexOf('sys') !== -1;
+ if ($rootScope.organizationId) {
+ for (var i = 0; i < $rootScope.profile.user.organizations.length; i++) {
+ var organization = $rootScope.profile.user.organizations[i];
+ if (organization.id === $rootScope.organizationId) {
+ $rootScope.organization = organization;
+ $rootScope.admin =
+ $rootScope.profile.user.roles.indexOf('_admin') !== -1 || $rootScope.profile.user.roles.indexOf('sys') !== -1 || $rootScope.profile.user.roles.indexOf('admin_' + organization.id) !== -1;
+ break;
+ }
+ }
+ }
+ };
+ return {
+ getUser: function () {
+ var deferred = $q.defer();
+ if ($rootScope.profile) {
+ checkOrganization();
+ return true;
+ } else {
+ $http.get("/api/session").
+ success(function (data, status, headers, config) {
+ console.log(data);
+ avatar(data.user);
+ deferred.resolve();
+ }).
+ error(function (data, status, headers, config) {
+ deferred.reject();
+ });
+ }
+ return deferred.promise;
+ },
+ setUser: function (data) {
+ avatar(data);
+ },
+ authorize: function () {
+ var deferred = $q.defer();
+ /**if ($rootScope.profile) {
+ checkOrganization();
+ window.setTimeout(function () {
+ deferred.resolve();
+ }, 0);
+ } else {*/
+ $http.get("/api/session").
+ success(function (data, status, headers, config) {
+ console.log(data);
+ avatar(data.user);
+ deferred.resolve();
+ }).
+ error(function (data, status, headers, config) {
+ deferred.reject();
+ });
+ //}
+ return deferred.promise;
+ }
+ };
+ }]);
+})(this, this.angular, this.console);
\ No newline at end of file
diff --git a/pool/shard000/JavaScript/0003810_post_image_view.js b/pool/shard000/JavaScript/0003810_post_image_view.js
new file mode 100644
index 0000000000000000000000000000000000000000..de59e1416530c7a0063955c8488eacdc7d4585ea
--- /dev/null
+++ b/pool/shard000/JavaScript/0003810_post_image_view.js
@@ -0,0 +1,118 @@
+var args = arguments[0] || {};
+
+
+var photoData;
+
+var setImageEvent = "setImage";
+
+function showCamera() {
+
+ Titanium.Media.showCamera({
+ success : function(event) {
+ Ti.API.debug("picture was taken");
+ //imageView.image = event.media;
+ photoData = event.media;
+ $.photo.image = event.media;
+ $.trigger(setImageEvent,{photo : photoData});
+ },
+ cancel : function() {
+
+ },
+ error : function(error) {
+ var a = Titanium.UI.createAlertDialog({
+ title : 'Camera'
+ });
+ if (error.code == Titanium.Media.NO_CAMERA) {
+ //a.setMessage('No camera');
+ //a.show();
+ showGallery();
+ } else {
+ a.setMessage('Unexpected error: ' + error.code);
+ a.show();
+ }
+ },
+ //overlay : overlay,
+ saveToPhotoGallery:false,
+ mediaTypes : Ti.Media.MEDIA_TYPE_PHOTO,
+ allowEditing : true
+ });
+}
+
+function showGallery(){
+ Titanium.Media.openPhotoGallery({
+ success : function(event) {
+ photoData = event.media;
+ $.photo.image = event.media;
+ $.trigger(setImageEvent,{photo : photoData});
+ }
+ });
+}
+
+function postData(data) {
+ if (Ti.Platform.name === 'iPhone OS'){
+ style = Ti.UI.iPhone.ActivityIndicatorStyle.PLAIN;
+ }
+ else {
+ style = Ti.UI.ActivityIndicatorStyle.PLAIN;
+ }
+ var activityIndicator = Ti.UI.createActivityIndicator({
+ color: 'white',
+ font: {fontFamily:'Helvetica Neue', fontSize:26, fontWeight:'bold'},
+ message: 'Uploading...',
+ indicatorDiameter : "50dp",
+ style:style,
+ height:Ti.UI.SIZE,
+ width:Ti.UI.SIZE
+ });
+ var currentWindow = Alloy.Globals.naviCon.getCurrentWindow();
+ var coverWindow = Ti.UI.createWindow({
+ backgroundColor: '#555555',
+ fullscreen : true,
+ opacity : 0.6
+ });
+ var indicatorWindow = Ti.UI.createWindow({
+ fullscreen: true
+ });
+ indicatorWindow.add(activityIndicator);
+ indicatorWindow.addEventListener("open",function(){
+ activityIndicator.show();
+ });
+ coverWindow.open();
+ indicatorWindow.open();
+
+ Alloy.Globals.api.postManager.post(photoData,data,function(result){
+ indicatorWindow.close();
+ coverWindow.close();
+ activityIndicator.hide();
+
+ if(result){
+ Alloy.Globals.lastPost = result;
+ Alloy.Globals.post = result;
+ var dialog = Titanium.UI.createAlertDialog({
+ title : "投稿完了",
+ message : '投稿ありがとうございます。'
+ });
+ Alloy.Globals.naviCon.home();
+ dialog.show();
+ }else{
+ var dialog = Titanium.UI.createAlertDialog({
+ title : "投稿失敗",
+ message : '投稿に失敗しました。ネットワークを確認して、再度投稿してください'
+ });
+ dialog.show();
+
+ }
+
+ });
+
+
+}
+
+exports.showCamera = showCamera;
+exports.showGallery = showGallery;
+exports.postData = postData;
+
+/*
+$.post_image_view.addEventListener("open",function(){
+ showCamera();
+});*/
diff --git a/pool/shard000/JavaScript/0003812_index.js b/pool/shard000/JavaScript/0003812_index.js
new file mode 100644
index 0000000000000000000000000000000000000000..a44da98be8d2f61e650040aa6176af73c8cbbc77
--- /dev/null
+++ b/pool/shard000/JavaScript/0003812_index.js
@@ -0,0 +1,21 @@
+function createReducer (initialState, handlers) {
+ return function (state, action) {
+ if (state === undefined) {
+ state = initialState
+ }
+ if (action === undefined) {
+ action = {}
+ }
+
+ if ('type' in action) {
+ return handlers[action.type]
+ ? handlers[action.type](state, action)
+ : state
+ }
+
+ return state
+ }
+}
+
+module.exports = createReducer
+
diff --git a/pool/shard000/JavaScript/0003813_lazy-box.js b/pool/shard000/JavaScript/0003813_lazy-box.js
new file mode 100644
index 0000000000000000000000000000000000000000..b76af35c81e1427367da037d1fc43a3ee62083da
--- /dev/null
+++ b/pool/shard000/JavaScript/0003813_lazy-box.js
@@ -0,0 +1,124 @@
+
+function safeAutorun(f){
+ return Tracker.nonreactive(function(){
+ return Tracker.autorun(f);
+ });
+}
+
+
+LazyBox = function (func, equals) {
+ var self = this;
+
+ // state tracking
+ self.stopped = false;
+
+ self.func = func;
+ self.equals = equals;
+
+ self.curResult = null;
+
+ self.dep = new Tracker.Dependency;
+
+ // Don't initialise a computation until required.
+ self.resultComputation = null;
+
+ // bind functions so they're only created once
+ self._computation = self._computation.bind(self);
+ self._onInvalidate = self._onInvalidate.bind(self);
+ self._pauseAfterFlush = self._pauseAfterFlush.bind(self);
+};
+
+LazyBox.prototype._computation = function (c) {
+ var self = this;
+ var func = self.func;
+
+ var newResult = func();
+
+ if (! c.firstRun) {
+ var equals = self.equals;
+ var oldResult = self.curResult;
+
+ if (equals ? equals(newResult, oldResult) :
+ newResult === oldResult) {
+ // same as last time
+ return;
+ }
+ }
+
+ self.curResult = newResult;
+ self.dep.changed();
+};
+
+LazyBox.prototype._onInvalidate = function(){
+ var self = this;
+ if (self.stopped){
+ return;
+ }
+ // when it's invalidated, Tracker will flush to recompute
+ Tracker.afterFlush(self._pauseAfterFlush);
+};
+
+LazyBox.prototype._pauseAfterFlush = function(){
+ var self = this;
+ if (self.stopped || self.resultComputation == null){
+ return;
+ }
+ if (!self.dep.hasDependents()){
+ // pause
+ self.resultComputation.stop();
+ self.resultComputation = null;
+ }
+};
+
+LazyBox.prototype.depend = function(){
+ var self = this;
+ if (!Tracker.active){
+ // TODO: Warn users calling LazyBox.get without a current computation. Will cause a lot of stop/starting.
+ if (!self.dep.hasDependents()){
+ self.resultComputation.stop();
+ self.resultComputation = null;
+ }
+ return;
+ }
+ if (self.dep.depend()) {
+ Tracker.currentComputation.onInvalidate(self._onInvalidate);
+ }
+};
+
+LazyBox.prototype.stop = function () {
+ var self = this;
+ if (self.stopped){
+ return;
+ }
+ if (self.resultComputation != null) {
+ self.resultComputation.stop();
+ self.resultComputation = null;
+ }
+ self.func = null;
+ self.equals = null;
+ self.curResult = null;
+ self.dep = null;
+ self._computation = null;
+ self._onInvalidate = null;
+ self._pauseAfterFlush = null;
+ self.stopped = true;
+};
+
+LazyBox.prototype.get = function () {
+ var self = this;
+ if (self.stopped){
+ throw new Error('LazyBox#get() called after stopped.');
+ }
+ // Check if the computation is running
+ if (self.resultComputation == null){
+ // restart as necessary
+ self.resultComputation = safeAutorun(self._computation);
+ } else if (self.resultComputation.invalidated) {
+ // or recompute if invalidated
+ self.resultComputation._recompute();
+ }
+
+ self.depend();
+
+ return self.curResult;
+};
diff --git a/pool/shard000/JavaScript/0003817_jquery.metadata.js b/pool/shard000/JavaScript/0003817_jquery.metadata.js
new file mode 100644
index 0000000000000000000000000000000000000000..e361d960bf7821ec092662be3b7bdd39c0ddc003
--- /dev/null
+++ b/pool/shard000/JavaScript/0003817_jquery.metadata.js
@@ -0,0 +1,122 @@
+/*
+ * Metadata - jQuery plugin for parsing metadata from elements
+ *
+ * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Revision: $Id: jquery.metadata.js,v 1.1 2009-09-02 20:58:49 hexbinary Exp $
+ *
+ */
+
+/**
+ * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
+ * in the JSON will become a property of the element itself.
+ *
+ * There are three supported types of metadata storage:
+ *
+ * attr: Inside an attribute. The name parameter indicates *which* attribute.
+ *
+ * class: Inside the class attribute, wrapped in curly braces: { }
+ *
+ * elem: Inside a child element (e.g. a script tag). The
+ * name parameter indicates *which* element.
+ *
+ * The metadata for an element is loaded the first time the element is accessed via jQuery.
+ *
+ * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
+ * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
+ *
+ * @name $.metadata.setType
+ *
+ * @example
This is a p
+ * @before $.metadata.setType("class")
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
+ * @desc Reads metadata from the class attribute
+ *
+ * @example This is a p
+ * @before $.metadata.setType("attr", "data")
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
+ * @desc Reads metadata from a "data" attribute
+ *
+ * @example This is a p
+ * @before $.metadata.setType("elem", "script")
+ * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
+ * @desc Reads metadata from a nested script element
+ *
+ * @param String type The encoding type
+ * @param String name The name of the attribute to be used to get metadata (optional)
+ * @cat Plugins/Metadata
+ * @descr Sets the type of encoding to be used when loading metadata for the first time
+ * @type undefined
+ * @see metadata()
+ */
+
+(function($) {
+
+$.extend({
+ metadata : {
+ defaults : {
+ type: 'class',
+ name: 'metadata',
+ cre: /({.*})/,
+ single: 'metadata'
+ },
+ setType: function( type, name ){
+ this.defaults.type = type;
+ this.defaults.name = name;
+ },
+ get: function( elem, opts ){
+ var settings = $.extend({},this.defaults,opts);
+ // check for empty string in single property
+ if ( !settings.single.length ) settings.single = 'metadata';
+
+ var data = $.data(elem, settings.single);
+ // returned cached data if it already exists
+ if ( data ) return data;
+
+ data = "{}";
+
+ if ( settings.type == "class" ) {
+ var m = settings.cre.exec( elem.className );
+ if ( m )
+ data = m[1];
+ } else if ( settings.type == "elem" ) {
+ if( !elem.getElementsByTagName )
+ return undefined;
+ var e = elem.getElementsByTagName(settings.name);
+ if ( e.length )
+ data = $.trim(e[0].innerHTML);
+ } else if ( elem.getAttribute != undefined ) {
+ var attr = elem.getAttribute( settings.name );
+ if ( attr )
+ data = attr;
+ }
+
+ if ( data.indexOf( '{' ) <0 )
+ data = "{" + data + "}";
+
+ data = eval("(" + data + ")");
+
+ $.data( elem, settings.single, data );
+ return data;
+ }
+ }
+});
+
+/**
+ * Returns the metadata object for the first member of the jQuery object.
+ *
+ * @name metadata
+ * @descr Returns element's metadata object
+ * @param Object opts An object contianing settings to override the defaults
+ * @type jQuery
+ * @cat Plugins/Metadata
+ */
+$.fn.metadata = function( opts ){
+ return $.metadata.get( this[0], opts );
+};
+
+})(jQuery);
\ No newline at end of file
diff --git a/pool/shard000/JavaScript/0003819_crawl.js b/pool/shard000/JavaScript/0003819_crawl.js
new file mode 100644
index 0000000000000000000000000000000000000000..057254165133033f2e1ed11b0d7d62db577f39fb
--- /dev/null
+++ b/pool/shard000/JavaScript/0003819_crawl.js
@@ -0,0 +1,77 @@
+/**
+ * Copyright 2015 IBM Corp. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+const TwitterCrawler = require('../lib/twitter-crawler');
+const fs = require('fs');
+const log = require('winston');
+const Promise = require('bluebird');
+
+const getEnvCredentials = () =>
+ process.env.TWITTER_CREDENTIALS ? JSON.parse(process.env.TWITTER_CREDENTIALS) : [];
+
+const credentials = [
+ {
+ consumer_key : "",
+ consumer_secret : "",
+ access_token_key : "",
+ access_token_secret : "",
+ enabled : false
+ }
+ ].concat(getEnvCredentials());
+
+
+const bind = (object, method) => object[method].bind(object);
+
+function saveOutput(obj, filename) {
+ fs.writeFile(`${__dirname}/output/${filename}`, JSON.stringify(obj, null, ' '));
+}
+
+
+const crawler = new TwitterCrawler(credentials);
+const crawlList = [
+ 'ladygaga',
+ '19397785',
+ 'KingJames'
+];
+
+
+module.exports = Promise.all(crawlList.map((twitterHandle) => {
+ // Get user
+ log.info(`Obtaining user with id ${twitterHandle}...`);
+ return crawler.getUser(twitterHandle)
+ .then((user) => {
+ log.info(
+ `Obtained info for user ${user.name} (${user.id}). ` +
+ `Storing in output/${twitterHandle}_user.json`
+ );
+
+ saveOutput(user, `${twitterHandle}_user.json`);
+
+ // Crawl tweets
+ log.info('Obtaining tweets...');
+ return crawler.getTweets(twitterHandle, { min_tweets: 50, limit : 300 })
+ .then((tweets) => {
+ log.info(
+ `Obtained ${tweets.length} tweets for user ${user.name} (${user.id}). ` +
+ `Storing in output/${twitterHandle}_tweets.json`
+ );
+
+ saveOutput(tweets, `${twitterHandle}_tweets.json`);
+ log.info('Crawling finished.');
+ });
+ })
+ .catch(bind(log, 'error'));
+}));
diff --git a/pool/shard000/JavaScript/0003821_platform_viewports.js b/pool/shard000/JavaScript/0003821_platform_viewports.js
new file mode 100644
index 0000000000000000000000000000000000000000..f6590810c97fe29d85d463bcc28dda2b3a266336
--- /dev/null
+++ b/pool/shard000/JavaScript/0003821_platform_viewports.js
@@ -0,0 +1,112 @@
+import { Mongo } from 'meteor/mongo';
+import { SimpleSchema } from 'meteor/aldeed:simple-schema';
+import { Auth } from '../auth.js';
+import { ChangeTracker } from '../change_tracker/change_tracker.js';
+import { SchemaHelpers } from '../schema_helpers.js';
+
+/**
+ * ============================================================================
+ * PlatformViewports
+ * ============================================================================
+ */
+export const PlatformViewport = new SimpleSchema({
+ // Link to the project to which this test belongs
+ projectId : {
+ type : String,
+ denyUpdate: true
+ },
+ // Link to the project version to which this test belongs
+ projectVersionId: {
+ type : String,
+ denyUpdate: true
+ },
+ // Link to the platform configuration record
+ platformId : {
+ type : String,
+ denyUpdate: true
+ },
+ title : {
+ type: String,
+ },
+ width : {
+ type : Number,
+ defaultValue: 1024
+ },
+ height : {
+ type : Number,
+ defaultValue: 768
+ },
+ aspectRatio : {
+ type : Number,
+ decimal: true,
+ optional: true
+ },
+ // Mark the default viewport for a platform
+ default: {
+ type: Boolean,
+ defaultValue: false
+ },
+ // Standard tracking fields
+ dateCreated : {
+ type : Date,
+ autoValue : SchemaHelpers.autoValueDateCreated,
+ denyUpdate: true
+ },
+ createdBy : {
+ type : String,
+ autoValue : SchemaHelpers.autoValueCreatedBy,
+ denyUpdate: true
+ },
+ dateModified : {
+ type : Date,
+ autoValue: SchemaHelpers.autoValueDateModified
+ },
+ modifiedBy : {
+ type : String,
+ autoValue: SchemaHelpers.autoValueModifiedBy
+ }
+});
+
+export const PlatformViewports = new Mongo.Collection("platform_viewports");
+PlatformViewports.attachSchema(PlatformViewport);
+PlatformViewports.deny(Auth.ruleSets.deny.ifNotTester);
+PlatformViewports.allow(Auth.ruleSets.allow.ifAuthenticated);
+ChangeTracker.TrackChanges(PlatformViewports, "platform_viewports");
+
+// Listed for changes and update the aspect ratio
+if (Meteor.isServer) {
+ // Maintain the aspect ratio
+ PlatformViewports.before.insert(function (userId, doc) {
+ doc.aspectRatio = doc.width / doc.height;
+ });
+ PlatformViewports.before.update(function (userId, doc, changedFields, modifier) {
+ modifier.$set = modifier.$set || {};
+ if (_.contains(changedFields, 'width') || _.contains(changedFields, 'height')) {
+ let width = modifier.$set.width || doc.width,
+ height = modifier.$set.height || doc.height;
+ console.log("PlatformViewports.before.update setting aspectRatio:", width / height);
+ modifier.$set.aspectRatio = width / height;
+ }
+ });
+
+ // Maintain the default flag
+ PlatformViewports.after.update(function (userId, doc, changedFields, modifier) {
+ // If the default flag is set to true
+ if (_.contains(changedFields, 'default') && doc.default == true) {
+ // Set the other viewports for this platform to default = false
+ PlatformViewports.find({
+ _id: { $ne: doc._id },
+ platformId: doc.platformId,
+ default: true
+ }).forEach((viewport) => {
+ console.log("Setting default from true to false:", viewport);
+ PlatformViewports.update({_id: viewport._id}, {$set: {default: false}});
+ });
+ }
+ });
+}
+
+/**
+ * Helpers
+ */
+PlatformViewports.helpers({});
\ No newline at end of file
diff --git a/pool/shard000/JavaScript/0003822_ace_widget.js b/pool/shard000/JavaScript/0003822_ace_widget.js
new file mode 100644
index 0000000000000000000000000000000000000000..713865e812031c320dea58e710ce7f2525c04289
--- /dev/null
+++ b/pool/shard000/JavaScript/0003822_ace_widget.js
@@ -0,0 +1,245 @@
+$(function(){
+ var EDITOR_DICT = {};
+
+ var set_santa_clara_text_editor = function(jq_object){
+ var ta_id=jq_object.data("ta_id");
+ var name=jq_object.data("ta_name");
+ var santa_clara_text_editor_id=jq_object.attr("id");
+
+ var editor=ace.edit(santa_clara_text_editor_id);
+ var jq_editor_box=jq_object.parent();
+
+ EDITOR_DICT[santa_clara_text_editor_id]=editor;
+
+ editor.setTheme("ace/theme/eclipse");
+ editor.getSession().setMode("ace/mode/plain_text");
+
+ editor.getSession().setUseWrapMode(true);
+ editor.setShowPrintMargin(false);
+
+ editor.on("change",function(event){
+ jq_editor_box.addClass("santa_clara_text_editor_box_modified");
+ });
+
+ editor.commands.addCommand({
+ name: 'Move to cursor to the start of the current line.',
+ bindKey: {win: 'Ctrl-B', mac: 'Command-B'},
+ exec: function(editor) {
+ editor.navigateLineStart();
+ editor.focus();
+ },
+ readOnly: false // false if this command should not apply in readOnly mode
+ });
+
+ editor.commands.addCommand({
+ name: 'Move to cursor to the end of the current line.',
+ bindKey: {win: 'Ctrl-E', mac: 'Command-E'},
+ exec: function(editor) {
+ editor.navigateLineEnd();
+ editor.focus();
+ },
+ readOnly: false // false if this command should not apply in readOnly mode
+ });
+
+ editor.commands.addCommand({
+ name: 'Move to cursor to the end of the current file.',
+ bindKey: {win: 'Ctrl-G', mac: 'Command-G'},
+ exec: function(editor) {
+ editor.gotoLine(editor.getSession().getLength());
+ editor.focus();
+ },
+ readOnly: false // false if this command should not apply in readOnly mode
+ });
+
+ editor.commands.addCommand({
+ name: 'Move to cursor to the start of the current file.',
+ bindKey: {win: 'Ctrl-<', mac: 'Command-<'},
+ exec: function(editor) {
+ editor.gotoLine(0);
+ editor.focus();
+ },
+ readOnly: false // false if this command should not apply in readOnly mode
+ });
+
+ editor.commands.addCommand({
+ name: 'Remove to line end.',
+ bindKey: {win: 'Ctrl-k', mac: 'Command-k'},
+ exec: function(editor) {
+ editor.removeToLineEnd();
+ editor.focus();
+ },
+ readOnly: false // false if this command should not apply in readOnly mode
+ });
+
+ editor.commands.addCommand({
+ name: 'Remove word right.',
+ bindKey: {win: 'Alt-d', mac: 'Alt-d'},
+ exec: function(editor) {
+ editor.removeWordRight();
+ editor.focus();
+ },
+ readOnly: false // false if this command should not apply in readOnly mode
+ });
+
+ var form=jq_object.closest("form");
+ var ta_name=jq_object.data("ta_name");
+ var ta_id=jq_object.data("ta_id");
+
+ form.submit( function(event){
+ var text=editor.getSession().toString();
+ var ta_html="";
+ $(this).append(ta_html);
+ $(this).find('#'+ta_id).hide();
+ return true;
+ });
+ };
+
+ var action_santa_clara_text_editor_button_simple=function(jq_object,event){
+ var tag=jq_object.data("tag");
+ var parent=jq_object.parent();
+ var santa_clara_text_editor_id=parent.data("santa_clara_text_editor_id");
+ var editor=EDITOR_DICT[santa_clara_text_editor_id];
+
+ var range=editor.getSelectionRange();
+
+ editor.clearSelection();
+
+ editor.moveCursorTo(range.end.row,range.end.column,true);
+ editor.insert("[/"+tag+"]");
+
+ editor.moveCursorTo(range.start.row,range.start.column,true);
+ editor.insert("["+tag+"]");
+
+ editor.moveCursorTo(range.end.row,range.end.column+5+2*tag.length,true);
+ editor.focus();
+ };
+
+ var action_santa_clara_text_editor_button_single=function(jq_object,event){
+ var tag=jq_object.data("tag");
+ var parent=jq_object.parent();
+ var santa_clara_text_editor_id=parent.data("santa_clara_text_editor_id");
+ var editor=EDITOR_DICT[santa_clara_text_editor_id];
+ editor.insert("["+tag+"/]");
+ editor.focus();
+ };
+
+ var action_santa_clara_text_editor_button_function=function(jq_object,event){
+ var tag=jq_object.data("tag");
+ var parent=jq_object.parent();
+ var santa_clara_text_editor_id=parent.data("santa_clara_text_editor_id");
+ var editor=EDITOR_DICT[santa_clara_text_editor_id];
+ switch (tag) {
+ case "action_upper":
+ editor.toUpperCase();
+ break;
+ case "action_lower":
+ editor.toLowerCase();
+ break;
+ case "action_bracket":
+ var range=editor.getSelectionRange();
+ editor.clearSelection();
+ editor.moveCursorTo(range.end.row,range.end.column,true);
+ editor.insert("]]");
+ editor.moveCursorTo(range.start.row,range.start.column,true);
+ editor.insert("[[");
+ editor.moveCursorTo(range.end.row,range.end.column+4,true);
+ editor.focus();
+ }
+ };
+
+ /**/
+
+ $(".santa_clara_text_editor").each(function(){
+ set_santa_clara_text_editor($(this));
+ });
+
+ $(".santa_clara_text_editor_button_simple").click(function(event){
+ event.preventDefault();
+ action_santa_clara_text_editor_button_simple($(this),event);
+ });
+
+ $(".santa_clara_text_editor_button_single").click(function(event){
+ event.preventDefault();
+ action_santa_clara_text_editor_button_single($(this),event);
+ });
+
+ $(".santa_clara_text_editor_button_function").click(function(event){
+ event.preventDefault();
+ action_santa_clara_text_editor_button_function($(this),event);
+ });
+
+
+
+ /**/
+
+ var replace_prefix_in_data = function (object,data_key,new_prefix) {
+ var old_val=object.data(data_key);
+ var new_val=old_val.replace('__prefix__',new_prefix);
+ object.data(data_key,new_val);
+ };
+
+ var mutationHandler = function (mutationRecords) {
+ mutationRecords.forEach ( function (mutation) {
+ if (mutation.type!="childList") return;
+ if (mutation.addedNodes.length==0) return;
+
+ $(mutation.addedNodes).each(function(){
+
+ $(this).find(".santa_clara_text_editor_box").each(function(){
+ var box_id=$(this).attr("id");
+ var ta_id_temp=$(this).data("ta_id");
+ var ta_name_temp=$(this).data("ta_name");
+ var ta_id_real=box_id.replace(/^santa_clara_text_editor_box_/,'');
+ var rexp=RegExp('^'+ta_id_temp.replace('__prefix__','(.*)')+'$');
+ var prefix_real=ta_id_real.replace(rexp,'$1');
+ replace_prefix_in_data($(this),"ta_id",prefix_real);
+ replace_prefix_in_data($(this),"ta_name",prefix_real);
+ $(this).find(".santa_clara_text_editor_button_bar").each(function(){
+ replace_prefix_in_data($(this),"santa_clara_text_editor_box_id",prefix_real);
+ replace_prefix_in_data($(this),"santa_clara_text_editor_id",prefix_real);
+ });
+ $(this).find(".santa_clara_text_editor").each(function(){
+ replace_prefix_in_data($(this),"ta_id",prefix_real);
+ replace_prefix_in_data($(this),"ta_name",prefix_real);
+ });
+ });
+
+ $(this).find(".santa_clara_text_editor").each(function(){
+ set_santa_clara_text_editor($(this));
+ });
+
+ $(this).find(".santa_clara_text_editor_button_simple").click(function(event){
+ event.preventDefault();
+ action_santa_clara_text_editor_button_simple($(this),event);
+ });
+
+ $(this).find(".santa_clara_text_editor_button_single").click(function(event){
+ event.preventDefault();
+ action_santa_clara_text_editor_button_single($(this),event);
+ });
+
+ $(this).find(".santa_clara_text_editor_button_function").click(function(event){
+ event.preventDefault();
+ action_santa_clara_text_editor_button_function($(this),event);
+ });
+
+ });
+
+ });
+ };
+
+ var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
+ var myObserver = new MutationObserver (mutationHandler);
+ var obsConfig = { childList: true, characterData: true, attributes: true, subtree: true };
+
+ $("form").each( function () {
+ myObserver.observe (this, obsConfig);
+ });
+
+
+
+});
+
diff --git a/pool/shard000/JavaScript/0003824_bootstrap-typeahead.js b/pool/shard000/JavaScript/0003824_bootstrap-typeahead.js
new file mode 100644
index 0000000000000000000000000000000000000000..8c30c318651ebeb50ea5c3869de51be9e37dc460
--- /dev/null
+++ b/pool/shard000/JavaScript/0003824_bootstrap-typeahead.js
@@ -0,0 +1,44 @@
+define(function(require) {
+ 'use strict';
+
+ var $ = require('jquery');
+ require('bootstrap');
+
+ /**
+ * This customization allows to define own click, render, show functions for Typeahead
+ */
+ var Typeahead;
+ var origTypeahead = $.fn.typeahead.Constructor;
+ var origFnTypeahead = $.fn.typeahead;
+
+ Typeahead = function(element, options) {
+ var opts = $.extend({}, $.fn.typeahead.defaults, options);
+ this.click = opts.click || this.click;
+ this.render = opts.render || this.render;
+ this.show = opts.show || this.show;
+ this.hide = opts.hide || this.hide;
+ this.$holder = $(opts.holder || '');
+ origTypeahead.apply(this, arguments);
+ };
+
+ Typeahead.prototype = origTypeahead.prototype;
+ Typeahead.prototype.constructor = Typeahead;
+
+ $.fn.typeahead = function(option) {
+ return this.each(function() {
+ var $this = $(this);
+ var data = $this.data('typeahead');
+ var options = typeof option === 'object' && option;
+ if (!data) {
+ $this.data('typeahead', (data = new Typeahead(this, options)));
+ }
+ if (typeof option === 'string') {
+ data[option]();
+ }
+ });
+ };
+
+ $.fn.typeahead.defaults = origFnTypeahead.defaults;
+ $.fn.typeahead.Constructor = Typeahead;
+ $.fn.typeahead.noConflict = origFnTypeahead.noConflict;
+});
diff --git a/pool/shard000/JavaScript/0003825_orient.test.js b/pool/shard000/JavaScript/0003825_orient.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..cc481c01fd3a9a5cc336f4aa93597b7b7f568b2d
--- /dev/null
+++ b/pool/shard000/JavaScript/0003825_orient.test.js
@@ -0,0 +1,161 @@
+import _ol_geom_flat_orient_ from '../../../../../src/ol/geom/flat/orient.js';
+
+
+describe('ol.geom.flat.orient', function() {
+
+ describe('ol.geom.flat.orient.linearRingIsClockwise()', function() {
+
+ it('identifies clockwise rings', function() {
+ const flatCoordinates = [0, 1, 1, 4, 4, 3, 3, 0];
+ const isClockwise = _ol_geom_flat_orient_.linearRingIsClockwise(
+ flatCoordinates, 0, flatCoordinates.length, 2);
+ expect(isClockwise).to.be(true);
+ });
+
+ it('identifies anti-clockwise rings', function() {
+ const flatCoordinates = [2, 2, 3, 2, 3, 3, 2, 3];
+ const isClockwise = _ol_geom_flat_orient_.linearRingIsClockwise(
+ flatCoordinates, 0, flatCoordinates.length, 2);
+ expect(isClockwise).to.be(false);
+ });
+
+ });
+
+ describe('ol.geom.flat.orient.linearRingsAreOriented()', function() {
+ const oriented = _ol_geom_flat_orient_.linearRingsAreOriented;
+
+ const rightCoords = [
+ -180, -90, 180, -90, 180, 90, -180, 90, -180, -90,
+ -100, -45, -100, 45, 100, 45, 100, -45, -100, -45
+ ];
+
+ const leftCoords = [
+ -180, -90, -180, 90, 180, 90, 180, -90, -180, -90,
+ -100, -45, 100, -45, 100, 45, -100, 45, -100, -45
+ ];
+
+ const ends = [10, 20];
+
+ it('checks for left-hand orientation by default', function() {
+ expect(oriented(rightCoords, 0, ends, 2)).to.be(false);
+ expect(oriented(leftCoords, 0, ends, 2)).to.be(true);
+ });
+
+ it('can check for right-hand orientation', function() {
+ expect(oriented(rightCoords, 0, ends, 2, true)).to.be(true);
+ expect(oriented(leftCoords, 0, ends, 2, true)).to.be(false);
+ });
+
+ });
+
+ describe('ol.geom.flat.orient.linearRingssAreOriented()', function() {
+ const oriented = _ol_geom_flat_orient_.linearRingssAreOriented;
+
+ const rightCoords = [
+ -180, -90, 180, -90, 180, 90, -180, 90, -180, -90,
+ -100, -45, -100, 45, 100, 45, 100, -45, -100, -45,
+ -180, -90, 180, -90, 180, 90, -180, 90, -180, -90,
+ -100, -45, -100, 45, 100, 45, 100, -45, -100, -45
+ ];
+
+ const leftCoords = [
+ -180, -90, -180, 90, 180, 90, 180, -90, -180, -90,
+ -100, -45, 100, -45, 100, 45, -100, 45, -100, -45,
+ -180, -90, -180, 90, 180, 90, 180, -90, -180, -90,
+ -100, -45, 100, -45, 100, 45, -100, 45, -100, -45
+ ];
+
+ const ends = [[10, 20], [30, 40]];
+
+ it('checks for left-hand orientation by default', function() {
+ expect(oriented(rightCoords, 0, ends, 2)).to.be(false);
+ expect(oriented(leftCoords, 0, ends, 2)).to.be(true);
+ });
+
+ it('can check for right-hand orientation', function() {
+ expect(oriented(rightCoords, 0, ends, 2, true)).to.be(true);
+ expect(oriented(leftCoords, 0, ends, 2, true)).to.be(false);
+ });
+
+ });
+
+ describe('ol.geom.flat.orient.orientLinearRings()', function() {
+ const orient = _ol_geom_flat_orient_.orientLinearRings;
+
+ const rightCoords = [
+ -180, -90, 180, -90, 180, 90, -180, 90, -180, -90,
+ -100, -45, -100, 45, 100, 45, 100, -45, -100, -45
+ ];
+
+ const leftCoords = [
+ -180, -90, -180, 90, 180, 90, 180, -90, -180, -90,
+ -100, -45, 100, -45, 100, 45, -100, 45, -100, -45
+ ];
+
+ const ends = [10, 20];
+
+ it('orients using the left-hand rule by default', function() {
+ const rightClone = rightCoords.slice();
+ orient(rightClone, 0, ends, 2);
+ expect(rightClone).to.eql(leftCoords);
+
+ const leftClone = leftCoords.slice();
+ orient(leftClone, 0, ends, 2);
+ expect(leftClone).to.eql(leftCoords);
+ });
+
+ it('can orient using the right-hand rule', function() {
+ const rightClone = rightCoords.slice();
+ orient(rightClone, 0, ends, 2, true);
+ expect(rightClone).to.eql(rightCoords);
+
+ const leftClone = leftCoords.slice();
+ orient(leftClone, 0, ends, 2, true);
+ expect(leftClone).to.eql(rightCoords);
+ });
+
+ });
+
+ describe('ol.geom.flat.orient.orientLinearRingss()', function() {
+ const orient = _ol_geom_flat_orient_.orientLinearRingss;
+
+ const rightCoords = [
+ -180, -90, 180, -90, 180, 90, -180, 90, -180, -90,
+ -100, -45, -100, 45, 100, 45, 100, -45, -100, -45,
+ -180, -90, 180, -90, 180, 90, -180, 90, -180, -90,
+ -100, -45, -100, 45, 100, 45, 100, -45, -100, -45
+ ];
+
+ const leftCoords = [
+ -180, -90, -180, 90, 180, 90, 180, -90, -180, -90,
+ -100, -45, 100, -45, 100, 45, -100, 45, -100, -45,
+ -180, -90, -180, 90, 180, 90, 180, -90, -180, -90,
+ -100, -45, 100, -45, 100, 45, -100, 45, -100, -45
+ ];
+
+ const ends = [[10, 20], [30, 40]];
+
+ it('orients using the left-hand rule by default', function() {
+ const rightClone = rightCoords.slice();
+ orient(rightClone, 0, ends, 2);
+ expect(rightClone).to.eql(leftCoords);
+
+ const leftClone = leftCoords.slice();
+ orient(leftClone, 0, ends, 2);
+ expect(leftClone).to.eql(leftCoords);
+ });
+
+ it('can orient using the right-hand rule', function() {
+ const rightClone = rightCoords.slice();
+ orient(rightClone, 0, ends, 2, true);
+ expect(rightClone).to.eql(rightCoords);
+
+ const leftClone = leftCoords.slice();
+ orient(leftClone, 0, ends, 2, true);
+ expect(leftClone).to.eql(rightCoords);
+ });
+
+ });
+
+
+});
diff --git a/pool/shard000/JavaScript/0003826_watcher.js b/pool/shard000/JavaScript/0003826_watcher.js
new file mode 100644
index 0000000000000000000000000000000000000000..dc307e37a80afcf3cf8271b6e32887a664a54671
--- /dev/null
+++ b/pool/shard000/JavaScript/0003826_watcher.js
@@ -0,0 +1,171 @@
+import { join, relative } from 'path'
+import chalk from 'chalk'
+import { FSWatcher } from 'chokidar'
+import _debug from 'debug'
+import Builder from './builder'
+
+const debug = _debug('api:watch')
+debug.color = 2 // Green
+
+const watchers = []
+
+export default class Watcher {
+ constructor (builder) {
+ /* istanbul ignore if */
+ if (!(builder instanceof Builder)) {
+ throw new TypeError('Usage: new Watcher(builder: Builder)')
+ }
+
+ debug.enabled = true
+
+ this.builder = builder
+ this.router = builder.router
+
+ this.isWatched = false
+
+ // Chokidar instance
+ this.fsWatcher = new FSWatcher({ ignoreInitial: true })
+
+ // Dependents from transformed files
+ this.dependents = {}
+
+ // Extra files to watch from imports
+ this.extraWatches = {}
+ }
+
+ static closeAll () {
+ for (let watcher of watchers) {
+ watcher.close()
+ }
+ }
+
+ close () {
+ this.fsWatcher.close()
+ }
+
+ async watch () {
+ /* istanbul ignore if */
+ if (this.isWatched) {
+ return
+ }
+
+ watchers.push(this)
+ this.isWatched = true
+
+ const listeners = [{
+ event: 'add',
+ verb: 'created',
+ callback: this._add
+ }, {
+ event: 'unlink',
+ verb: 'removed',
+ callback: this._unlink
+ }, {
+ event: 'change',
+ verb: 'modified',
+ callback: this._change
+ }]
+
+ listeners.forEach(({ event, verb, callback }) => {
+ this.fsWatcher.on(event, filename => {
+ debug(chalk`{magenta ${relative(this.router.options.src, filename)}} has been {red ${verb}}.`)
+ callback.call(this, filename)
+ })
+ })
+
+ const exts = this.builder.extensions.join('|')
+ const watchDir = join(this.router.options.entry, `**/*.@(${exts})`)
+ this.fsWatcher.add(watchDir)
+
+ // Update route handle if file is under `entry`, otherwise watching changes of it
+ this.builder.plugin('afterFetch', (filename, exports) => {
+ if (filename.startsWith(this.router.options.entry)) {
+ this.router.set(relative(this.router.options.entry, filename), exports)
+ } else {
+ this._watchFile(filename)
+ }
+ })
+
+ // Save dependent if request is not a module
+ this.builder.plugin('afterTransform', (filename, result) => {
+ result.imports.forEach(value => {
+ /* istanbul ignore else */
+ if (value[0] === '~' || value[0] === '.') {
+ const from = this.router.resolve(value, filename)
+ this.dependents[from] = this.dependents[from] || []
+ this.dependents[from].push(filename)
+ }
+ })
+ })
+
+ // TODO Better dev message
+ debug('Start watching [ \'%s\' ]', relative(this.router.options.src, watchDir))
+ }
+
+ _watchFile (filename) {
+ const exists = this.extraWatches[filename]
+
+ if (!exists) {
+ this.fsWatcher.add(filename)
+ this.extraWatches[filename] = true
+ }
+
+ return this
+ }
+
+ _unwatchFile (filename) {
+ const exists = this.extraWatches[filename]
+
+ /* istanbul ignore else */
+ if (exists) {
+ this.fsWatcher.unwatch(filename)
+ delete this.extraWatches[filename]
+ }
+
+ return this
+ }
+
+ _add (filename) {
+ this.builder.fetch(filename)
+ }
+
+ _unlink (filename) {
+ const refetchList = this._purge(filename)
+
+ if (filename.startsWith(this.router.options.entry)) {
+ this.router.unset(relative(this.router.options.entry, filename))
+ } else {
+ this._unwatchFile(filename)
+ }
+
+ if (refetchList[0] === filename) {
+ refetchList.shift()
+ }
+
+ refetchList.forEach(filename => this.builder.fetch(filename))
+ }
+
+ _change (filename) {
+ this._unlink(filename)
+ this.builder.fetch(filename)
+ }
+
+ _purge (filename, refetchList = []) {
+ const dependents = this.dependents[filename]
+
+ if (dependents !== undefined) {
+ dependents.forEach(dependent => {
+ this._purge(dependent, refetchList)
+ })
+ delete this.dependents[filename]
+ }
+
+ delete this.builder.handles[filename]
+
+ if (filename.startsWith(this.router.options.entry)) {
+ refetchList.push(filename)
+ }
+
+ return refetchList
+ }
+}
diff --git a/pool/shard000/JavaScript/0003827_Config.js b/pool/shard000/JavaScript/0003827_Config.js
new file mode 100644
index 0000000000000000000000000000000000000000..407111b865f49def9a5c37827ae820189fa5fe53
--- /dev/null
+++ b/pool/shard000/JavaScript/0003827_Config.js
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2015, YourNameHere. All rights reserved.
+ *
+ * This source code is licensed under the MIT-style license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+"use strict";
+/* global module,require,__filename */
+
+var loadJson = require('./JsonLoader'),
+ logError = require('./LogError')(__filename);
+
+var validateKeyName = name => {
+ if (['load', 'assign', 'merge'].indexOf(name) > -1) {
+ throw logError('Configuration key "' + name + '" is reserved and can\'t be used as root config key.', new Error('Configuration Reserved Keyword Error'));
+ } else {
+ return true;
+ }
+};
+
+var Config = {
+ load: (jsonFileName, defaultConfig) => {
+ jsonFileName = jsonFileName || 'config.json';
+ defaultConfig = defaultConfig || {};
+ return loadJson(jsonFileName).then(json => {
+ Config.merge(defaultConfig);
+ for (var name in json) {
+ if (json.hasOwnProperty(name)) {
+ if (validateKeyName(name)) {
+ Config[name] = json[name];
+ }
+ }
+ }
+
+ return Config;
+ });
+ },
+ assign: (dest, conf) => {
+ conf = conf || {};
+ dest = dest || {};
+ for (var name in conf) {
+ if (conf.hasOwnProperty(name)) {
+ var val = conf[name];
+ if (val && typeof val === 'object') {
+ dest[name] = Config.assign(dest[name], val);
+ } else {
+ dest[name] = conf[name];
+ }
+ }
+ }
+ return dest;
+ },
+ merge: conf => {
+ conf = conf || {};
+ for (var name in conf) {
+ if (conf.hasOwnProperty(name)) {
+ validateKeyName(name);
+ }
+ }
+ return Config.assign(Config, conf);
+ }
+};
+
+module.exports = Config;
\ No newline at end of file
diff --git a/pool/shard000/JavaScript/0003830_context-menu.js b/pool/shard000/JavaScript/0003830_context-menu.js
new file mode 100644
index 0000000000000000000000000000000000000000..6726bbe128817e2e9c9498690675b5af4fa24d33
--- /dev/null
+++ b/pool/shard000/JavaScript/0003830_context-menu.js
@@ -0,0 +1,33 @@
+const {Menu} = require('electron')
+
+module.exports =
+class ContextMenu {
+ constructor (template, atomWindow) {
+ this.atomWindow = atomWindow
+ this.createClickHandlers(template)
+ const menu = Menu.buildFromTemplate(template)
+ menu.popup(this.atomWindow.browserWindow, {async: true})
+ }
+
+ // It's necessary to build the event handlers in this process, otherwise
+ // closures are dragged across processes and failed to be garbage collected
+ // appropriately.
+ createClickHandlers (template) {
+ template.forEach(item => {
+ if (item.command) {
+ if (!item.commandDetail) item.commandDetail = {}
+ item.commandDetail.contextCommand = true
+ item.commandDetail.atomWindow = this.atomWindow
+ item.click = () => {
+ global.atomApplication.sendCommandToWindow(
+ item.command,
+ this.atomWindow,
+ item.commandDetail
+ )
+ }
+ } else if (item.submenu) {
+ this.createClickHandlers(item.submenu)
+ }
+ })
+ }
+}
diff --git a/pool/shard000/JavaScript/0003831_inject.js b/pool/shard000/JavaScript/0003831_inject.js
new file mode 100644
index 0000000000000000000000000000000000000000..70468a1c988a830896202ba4feca2bdf8111b9b6
--- /dev/null
+++ b/pool/shard000/JavaScript/0003831_inject.js
@@ -0,0 +1,45 @@
+/* globals Inject */
+
+// Inject.rawBody('page-loading', `
+// `
+// );
+// Inject.rawModHtml('moveScriptsToBottom', function(html) {
+// console.log("moveScriptsToBottom callled");
+// // get all scripts
+// var scripts = html.match(/
diff --git a/pool/shard000/JavaScript/0004227_elqImg.js b/pool/shard000/JavaScript/0004227_elqImg.js
new file mode 100644
index 0000000000000000000000000000000000000000..c3800991a7706703d98409238359d5c2da693b22
--- /dev/null
+++ b/pool/shard000/JavaScript/0004227_elqImg.js
@@ -0,0 +1,33 @@
+var trackURL = document.URL;
+if (trackURL.indexOf("?") != -1) {
+ trackURL += "&async=true";
+}
+else {
+ trackURL += "?async=true";
+}
+
+var _elqQ = _elqQ || [];
+
+_elqQ.push(['elqSetSiteId', '1795']);
+
+_elqQ.push(['elqTrackPageView', trackURL]);
+
+
+
+(function () {
+
+ function async_load() {
+
+ var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true;
+
+ s.src = '//img.en25.com/i/elqCfg.min.js';
+
+ var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x);
+
+ }
+
+ if (window.addEventListener) window.addEventListener('DOMContentLoaded', async_load, false);
+
+ else if (window.attachEvent) window.attachEvent('onload', async_load);
+
+})();
diff --git a/pool/shard000/JavaScript/0004230_produto-add.controller.js b/pool/shard000/JavaScript/0004230_produto-add.controller.js
new file mode 100644
index 0000000000000000000000000000000000000000..21224edcac6e7ed21f769d82c4276ccccf3beeae
--- /dev/null
+++ b/pool/shard000/JavaScript/0004230_produto-add.controller.js
@@ -0,0 +1,115 @@
+var produtoAddCtrl = function (crudService, $state) {
+ var vm = this;
+ vm.formData = {};
+ vm.htmlData = {};
+
+ vm.htmlData.title = 'Adicionar novos produtos';
+ vm.htmlData.subtitle = 'Adicionar Novos Produtos';
+ vm.htmlData.submit = 'Adicionar Novos Produtos';
+
+ vm.htmlData.forms = [{
+ name: 'Nome',
+ type: 'text',
+ model: '',
+ isRequired: true
+ },
+ {
+ name: 'Valor',
+ type: 'number',
+ model: '',
+ isRequired: true
+ },
+ {
+ name: 'Descricao',
+ type: 'text',
+ model: '',
+ isRequired: true
+ },
+ {
+ name: 'Peso',
+ type: 'number',
+ model: '',
+ isRequired: true
+ },
+ {
+ name: 'Fabricante',
+ type: 'text',
+ model: '',
+ isRequired: true
+ },
+ {
+ name: 'Tamanho',
+ type: 'text',
+ model: '',
+ isRequired: true
+ },
+ {
+ name: 'Quantidade',
+ type: 'number',
+ model: '',
+ isRequired: true
+ },
+ {
+ name: 'Tipo',
+ type: 'text',
+ model: '',
+ isRequired: true
+ },
+ {
+ name: 'Genero',
+ type: 'number',
+ model: '',
+ isRequired: true
+ },
+ {
+ name: 'Imagem',
+ type: 'text',
+ model: '',
+ isRequired: true
+ }]
+
+ vm.fillForm = function(){
+
+ vm.formData.nome = "Novo";
+ vm.formData.valor = 999;
+ vm.formData.descricao = "Tenis de couro com muito gliter,";
+ vm.formData.peso = 999;
+ vm.formData.fabricante = "Chineis";
+ vm.formData.tamanho = 1;
+ vm.formData.quantidade = 99;
+ vm.formData.tipo = "Corrida"
+ vm.formData.genero = 1
+ vm.formData.imagem = 'http://static1.netshoes.net/Produtos/chuteira-adidas-ace-164-fxg-campo/78/D13-3047-178/D13-3047-178_detalhe1.jpg?resize=254:*'
+
+ vm.htmlData.forms.forEach(function(curr, index, arr){
+ curr.model = vm.formData[curr.name.toLowerCase()];
+ });
+
+ }
+
+ vm.resetForm = function(){
+ vm.htmlData.forms.forEach(function(curr, index, arr){
+ curr.model = '';
+ });
+ };
+
+ vm.submitForm = function(){
+
+ vm.htmlData.forms.forEach(function(curr, index, arr){
+ vm.formData[curr.name.toLowerCase()] = curr.model;
+ });
+ console.log(vm.formData);
+ crudService.post('produto', vm.formData)
+ .then(function(){
+ console.log('Success!');
+ $state.go('produto.table');
+ }, function(err){
+ console.log('err', err);
+ });
+ };
+
+}
+
+angular
+ .module('app')
+ .controller('produtoAddCtrl', produtoAddCtrl);
diff --git a/pool/shard000/JavaScript/0004231_lb-services.js b/pool/shard000/JavaScript/0004231_lb-services.js
new file mode 100644
index 0000000000000000000000000000000000000000..e93f980dc0993f18ae5e169f57585e30b5906153
--- /dev/null
+++ b/pool/shard000/JavaScript/0004231_lb-services.js
@@ -0,0 +1,1166 @@
+// CommonJS package manager support
+if (typeof module !== 'undefined' && typeof exports !== 'undefined' &&
+ module.exports === exports) {
+ // Export the *name* of this Angular module
+ // Sample usage:
+ //
+ // import lbServices from './lb-services';
+ // angular.module('app', [lbServices]);
+ //
+ module.exports = "lbServices";
+}
+
+(function(window, angular, undefined) {
+ 'use strict';
+
+ var urlBase = "/api";
+ var authHeader = 'authorization';
+
+ function getHost(url) {
+ var m = url.match(/^(?:https?:)?\/\/([^\/]+)/);
+ return m ? m[1] : null;
+ }
+
+ var urlBaseHost = getHost(urlBase) || location.host;
+
+/**
+ * @ngdoc overview
+ * @name lbServices
+ * @module
+ * @description
+ *
+ * The `lbServices` module provides services for interacting with
+ * the models exposed by the LoopBack server via the REST API.
+ *
+ */
+ var module = angular.module("lbServices", ['ngResource']);
+
+/**
+ * @ngdoc object
+ * @name lbServices.Coinmarketcap
+ * @header lbServices.Coinmarketcap
+ * @object
+ *
+ * @description
+ *
+ * A $resource object for interacting with the `Coinmarketcap` model.
+ *
+ * **Details**
+ *
+ * Coin Marketcap Service
+ *
+ * ## Example
+ *
+ * See
+ * {@link http://docs.angularjs.org/api/ngResource.$resource#example $resource}
+ * for an example of using this object.
+ *
+ */
+ module.factory(
+ "Coinmarketcap",
+ [
+ 'LoopBackResource', 'LoopBackAuth', '$injector', '$q',
+ function(LoopBackResource, LoopBackAuth, $injector, $q) {
+ var R = LoopBackResource(
+ urlBase + "/Coinmarketcaps/:id",
+ { 'id': '@id' },
+ {
+
+ /**
+ * @ngdoc method
+ * @name lbServices.Coinmarketcap#getTicker
+ * @methodOf lbServices.Coinmarketcap
+ *
+ * @description
+ *
+ * Get Ticker
+ *
+ * @param {Object=} parameters Request parameters.
+ *
+ * - `id` – `{number=}` - Market id
+ *
+ * - `limit` – `{number=}` - Market limit
+ *
+ * - `start` – `{number=}` - Market start
+ *
+ * - `convert` – `{string=}` - Market convert
+ *
+ * @param {function(Array.