Pendigard commited on
Commit
c4dfeaa
·
verified ·
1 Parent(s): 597ee18

Upload folder using huggingface_hub (part 64)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. pool/shard005/JavaScript/0032510_demo-wizard.js +98 -0
  2. pool/shard005/JavaScript/0032515_gulpfile.js +119 -0
  3. pool/shard005/JavaScript/0032517_catalogActions.js +28 -0
  4. pool/shard005/JavaScript/0032519_index.js +39 -0
  5. pool/shard005/JavaScript/0032528_rq-angular-napp-menu.js +83 -0
  6. pool/shard005/JavaScript/0032529_poseestimation_normal.js +79 -0
  7. pool/shard005/JavaScript/0032530_ruleFileList.js +289 -0
  8. pool/shard005/JavaScript/0032531_index.ui.js +36 -0
  9. pool/shard005/JavaScript/0032532_main.js +114 -0
  10. pool/shard005/JavaScript/0032534_index.js +84 -0
  11. pool/shard005/JavaScript/0032535_index.js +28 -0
  12. pool/shard005/JavaScript/0032537_child-router.test.js +37 -0
  13. pool/shard005/JavaScript/0032538_collapser.user.js +97 -0
  14. pool/shard005/JavaScript/0032543_map_flatten_and_wrap_filters.js +14 -0
  15. pool/shard005/JavaScript/0032547_train-tracking-service.js +43 -0
  16. pool/shard005/JavaScript/0032548_work.js +16 -0
  17. pool/shard005/JavaScript/0032551_ui_tab_panel_library.js +255 -0
  18. pool/shard005/JavaScript/0032554_Data.js +110 -0
  19. pool/shard005/JavaScript/0032557_withdrawaltransfer.js +134 -0
  20. pool/shard005/JavaScript/0032563_test-browser-creation.js +72 -0
  21. pool/shard005/JavaScript/0032567_ajaxLog.js +39 -0
  22. pool/shard005/JavaScript/0032569_Entry.js +262 -0
  23. pool/shard005/JavaScript/0032570_IceFailedHandling.js +124 -0
  24. pool/shard005/JavaScript/0032576_printer.js +26 -0
  25. pool/shard005/JavaScript/0032577_logger.js +42 -0
  26. pool/shard005/JavaScript/0032580_Screen4.js +100 -0
  27. pool/shard005/JavaScript/0032584_test.js +48 -0
  28. pool/shard005/JavaScript/0032585_test.js +210 -0
  29. pool/shard005/JavaScript/0032587_main.js +36 -0
  30. pool/shard005/JavaScript/0032589_auth-form-header.js +63 -0
  31. pool/shard005/JavaScript/0032590_notecard.controller.js +321 -0
  32. pool/shard005/JavaScript/0032596_counter.js +36 -0
  33. pool/shard005/JavaScript/0032600_usuarios.js +83 -0
  34. pool/shard005/JavaScript/0032601_prototype.js +78 -0
  35. pool/shard005/JavaScript/0032602_utils.js +156 -0
  36. pool/shard005/JavaScript/0032603_ipvFuture.js +25 -0
  37. pool/shard005/JavaScript/0032604_assignments.controller.js +25 -0
  38. pool/shard005/JavaScript/0032606_RendererOptions.js +16 -0
  39. pool/shard005/JavaScript/0032609_sidenav.js +424 -0
  40. pool/shard005/JavaScript/0032610_plotter.js +74 -0
  41. pool/shard005/JavaScript/0032611_slushfile.js +115 -0
  42. pool/shard005/JavaScript/0032612_lazyLoader.js +29 -0
  43. pool/shard005/JavaScript/0032613_ddxapi.js +65 -0
  44. pool/shard005/JavaScript/0032615_gulpfile.js +49 -0
  45. pool/shard005/JavaScript/0032618_StickyOnScrollUpHeader.js +64 -0
  46. pool/shard005/JavaScript/0032619_custom_radio.js +21 -0
  47. pool/shard005/JavaScript/0032620_widget-htmlparser.js +222 -0
  48. pool/shard005/JavaScript/0032623_test.js +66 -0
  49. pool/shard005/JavaScript/0032624_DistanceOpacityMaterial.js +158 -0
  50. pool/shard005/JavaScript/0032626_normalize-pk-value.js +163 -0
pool/shard005/JavaScript/0032510_demo-wizard.js ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // FORM DEMO - Account Form
2
+ // ------------------------------------------------------------------------------------------------ * -->
3
+ $(document).ready(function ($) {
4
+
5
+ $(function (wizardForm) {
6
+ // navbar, numbering, progressbar, submit button well-nice
7
+ wizardForm('#demoWizard').bootstrapWizard({
8
+ nextSelector: '.wizard-action .next',
9
+ previousSelector: '.wizard-action .previous',
10
+ firstSelector: '.wizard-action .first',
11
+ lastSelector: '.wizard-action .last',
12
+ onTabShow: function (tab, navigation, index) {
13
+
14
+ var $total = navigation.find('li').length;
15
+ var $current = index + 1;
16
+ var $percent = ($current / $total) * 100;
17
+ var $wizard = $('#demoWizard');
18
+
19
+ $wizard.find('.bar').css({
20
+ width: $percent + '%'
21
+ });
22
+
23
+ $wizard.find('.number-page').text($current + ' of ' + $total);
24
+
25
+ // If it's the last tab then hide the last button and show the finish instead
26
+ if ($current >= $total) {
27
+ $wizard.find('.wizard-action .next').hide();
28
+ $wizard.find('.wizard-action .finish').show();
29
+ $wizard.find('.wizard-action .finish').removeClass('disabled');
30
+ $wizard.find('.wizard-action .print').show();
31
+ $wizard.find('.wizard-action .print').removeClass('disabled');
32
+ $wizard.find('.wizard-action .cancel').show();
33
+ $wizard.find('.wizard-action .cancel').removeClass('disabled');
34
+ } else {
35
+ $wizard.find('.wizard-action .next').show();
36
+ $wizard.find('.wizard-action .finish').hide();
37
+ $wizard.find('.wizard-action .print').hide();
38
+ $wizard.find('.wizard-action .cancel').hide();
39
+ }
40
+
41
+ }
42
+
43
+ });
44
+ wizardForm('#demoWizard .finish').click(function () {
45
+ alert('Finished!, Starting over!');
46
+ $('#demoWizard').find("a[href*='tab1e']").trigger('click');
47
+ });
48
+
49
+ wizardForm('#wzNewAddressState').select2();
50
+ });
51
+
52
+ $(function (wizardForm) {
53
+ // navbar, numbering, progressbar, submit button well-nice
54
+ wizardForm('#demoWizard2').bootstrapWizard({
55
+ nextSelector: '.wizard-action .next',
56
+ previousSelector: '.wizard-action .previous',
57
+ firstSelector: '.wizard-action .first',
58
+ lastSelector: '.wizard-action .last',
59
+ onTabShow: function (tab, navigation, index) {
60
+
61
+ var $total = navigation.find('li').length;
62
+ var $current = index + 1;
63
+ var $percent = ($current / $total) * 100;
64
+ var $wizard = $('#demoWizard2');
65
+
66
+ $wizard.find('.bar').css({
67
+ width: $percent + '%'
68
+ });
69
+
70
+ $wizard.find('.number-page').text($current + ' of ' + $total);
71
+
72
+ // If it's the last tab then hide the last button and show the finish instead
73
+ if ($current >= $total) {
74
+ $wizard.find('.wizard-action .next').hide();
75
+ $wizard.find('.wizard-action .finish').show();
76
+ $wizard.find('.wizard-action .finish').removeClass('disabled');
77
+ $wizard.find('.wizard-action .print').show();
78
+ $wizard.find('.wizard-action .print').removeClass('disabled');
79
+ $wizard.find('.wizard-action .cancel').show();
80
+ $wizard.find('.wizard-action .cancel').removeClass('disabled');
81
+ } else {
82
+ $wizard.find('.wizard-action .next').show();
83
+ $wizard.find('.wizard-action .finish').hide();
84
+ $wizard.find('.wizard-action .print').hide();
85
+ $wizard.find('.wizard-action .cancel').hide();
86
+ }
87
+
88
+ }
89
+
90
+ });
91
+ wizardForm('#demoWizard2 .finish').click(function () {
92
+ alert('Finished!, Starting over!');
93
+ $('#demoWizard2').find("a[href*='tab1e']").trigger('click');
94
+ });
95
+
96
+ wizardForm('#wzNewAddressState2').select2();
97
+ });
98
+ });
pool/shard005/JavaScript/0032515_gulpfile.js ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ gulpfile.js
3
+ ===========
4
+ Rather than manage one giant configuration file responsible
5
+ for creating multiple tasks, each task has been broken out into
6
+ its own file in gulp/tasks. Any file in that folder gets automatically
7
+ required by the loop in ./gulp/index.js (required below).
8
+
9
+ To add a new task, simply add a new task file to gulp/tasks.
10
+ */
11
+ // require('./gulp');
12
+
13
+
14
+ var path = require('path');
15
+ var gulp = require('gulp');
16
+ var gutil = require('gulp-util');
17
+ var express = require('express');
18
+ var clean = require('gulp-clean');
19
+ var tiny_lr = require('tiny-lr');
20
+ var webpack = require("webpack");
21
+ var webpackConfig = require("./webpack.config.js");
22
+ var WebpackDevServer = require("webpack-dev-server");
23
+
24
+ // == COMPASS TASK =============
25
+ require('./gulp/tasks/compass');
26
+
27
+ // == COPY TASK =============
28
+ require('./gulp/tasks/copy');
29
+
30
+ // == IMAGES TASK =============
31
+ require('./gulp/tasks/images');
32
+
33
+ // == BUILD TASK =============
34
+ require('./gulp/tasks/build');
35
+
36
+ // == DEFAULT TASK =============
37
+ require('./gulp/tasks/default');
38
+
39
+ gulp.task('clean', function() {
40
+ return gulp.src('build', {
41
+ read: false
42
+ }).pipe(clean());
43
+ });
44
+
45
+ gulp.task('webpack', function(callback) {
46
+ execWebpack(webpackConfig);
47
+ return callback();
48
+ });
49
+
50
+ gulp.task("dev", ['build'], function(callback) {
51
+ gulp.watch(['./src/**/*'], function(evt) {
52
+ gutil.log("Files changed, re-building..");
53
+ return gulp.run('build');
54
+ });
55
+
56
+ // modify some webpack config options
57
+ var myConfig = Object.create(webpackConfig);
58
+ myConfig.devtool = "sourcemap";
59
+ myConfig.debug = true;
60
+
61
+ myConfig = webpackConfig;
62
+
63
+ // Start a webpack-dev-server
64
+ new WebpackDevServer(webpack(myConfig), {
65
+ publicPath: "/" + myConfig.output.publicPath,
66
+ stats: {
67
+ colors: true
68
+ }
69
+ })
70
+ .listen(4000, "localhost", function(err) {
71
+ if(err) throw new gutil.PluginError("webpack-dev-server", err);
72
+ gutil.log("[webpack-dev-server]", "http://localhost:4000/webpack-dev-server/index.html");
73
+ });
74
+ });
75
+
76
+ // gulp.task('dev', ['build'], function() {
77
+ // var servers;
78
+ // servers = createServers(4000, 35729);
79
+ // gulp.watch(['./src/**/*'], function(evt) {
80
+ // return gulp.run('build');
81
+ // });
82
+ // return gulp.watch(['./build/**/*'], function(evt) {
83
+ // gutil.log(gutil.colors.cyan(evt.path), 'changed');
84
+ // return servers.lr.changed({
85
+ // body: {
86
+ // files: [evt.path]
87
+ // }
88
+ // });
89
+ // });
90
+ // });
91
+
92
+ // var createServers = function(port, lrport) {
93
+ // var app, lr;
94
+ // lr = tiny_lr();
95
+ // lr.listen(lrport, function() {
96
+ // return gutil.log("LiveReload listening on", lrport);
97
+ // });
98
+ // app = express();
99
+ // app.use(express["static"](path.resolve("./build")));
100
+ // app.listen(port, function() {
101
+ // return gutil.log("HTTP server listening on", port);
102
+ // });
103
+ // return {
104
+ // lr: lr,
105
+ // app: app
106
+ // };
107
+ // };
108
+
109
+ var execWebpack = function(config) {
110
+ return webpack(config, function(err, stats) {
111
+ if (err) {
112
+ throw new gutil.PluginError("execWebpack", err);
113
+ }
114
+ return gutil.log("[execWebpack]", stats.toString({
115
+ colors: true
116
+ }));
117
+ });
118
+ };
119
+
pool/shard005/JavaScript/0032517_catalogActions.js ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import {collection, element} from './actions';
3
+ import {createAction} from 'redux-actions';
4
+ import {request} from '../services';
5
+
6
+ export const getCategories = createAction(
7
+ 'GET_CATEGORIES',
8
+ (...args) => request('GET', 'categories', null, collection(...args)));
9
+
10
+ export const getCategory = createAction(
11
+ 'GET_CATEGORY',
12
+ (id, ...args) => request('GET', 'categories', id, element(...args)));
13
+
14
+ export const getProducts = createAction(
15
+ 'GET_PRODUCTS',
16
+ (...args) => request('GET', 'products', null, collection(...args)));
17
+
18
+ export const getProduct = createAction(
19
+ 'GET_PRODUCT',
20
+ (id, ...args) => request('GET', 'products', id, element(...args)));
21
+
22
+ export const getOrders = createAction(
23
+ 'GET_ORDERS',
24
+ (...args) => request('GET', 'orders', null, collection(...args)));
25
+
26
+ export const getOrder = createAction(
27
+ 'GET_ORDER',
28
+ (id, ...args) => request('GET', 'orders', id, element(...args)));
pool/shard005/JavaScript/0032519_index.js ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ $.index.open();
2
+
3
+ $.index.addEventListener('focus', function(e){
4
+ library.fetch();
5
+ });
6
+
7
+ $.add.addEventListener('click', function(e){
8
+ var newUser = Alloy.createModel('user', {
9
+ name: $.userName.value,
10
+ age: $.userAge.value,
11
+ email: $.userEmail.value,
12
+ });
13
+
14
+ /* validate */
15
+ if(newUser.isValid()){
16
+ newUser.save();
17
+ alert('success');
18
+ $.userName.setValue('');
19
+ $.userAge.setValue('');
20
+ $.userEmail.setValue('');
21
+ } else{
22
+ alert(newUser.errorMsg.join("\n"));
23
+ }
24
+ });
25
+
26
+ /* これ重要 */
27
+ function transFormFunction(model){
28
+ var transform = model.toJSON();
29
+ return transform;
30
+ }
31
+
32
+ function doClick(e){
33
+ Ti.API.debug(e);
34
+ alert('name: ' + e.row.title);
35
+ }
36
+
37
+ /* これ重要 */
38
+ var library = Alloy.Collections.user;
39
+ library.fetch();
pool/shard005/JavaScript/0032528_rq-angular-napp-menu.js ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Module
3
+ *
4
+ * Description
5
+ */
6
+ define(["angular"], function(angular) {
7
+ 'use strict';
8
+
9
+ return angular.module('napp.menu', [])
10
+ .directive('menu', ["$location",
11
+ function(location) {
12
+ return {
13
+ restrict: "AE",
14
+ transclude: true,
15
+ replace: true,
16
+ scope: {
17
+ title: "@"
18
+ },
19
+ controller: function($scope) {
20
+ $scope.items = [];
21
+
22
+ this.addItem = function(match, element) {
23
+ $scope.items.push({"element": element, "match": match});
24
+
25
+ var reg = new RegExp(match);
26
+
27
+ if (reg.test(location.path())) {
28
+ angular.element(element).addClass("active");
29
+ }
30
+ };
31
+
32
+ $scope.$on("$routeChangeStart", function() {
33
+ var route = location.path();
34
+
35
+ for (var item in $scope.items) {
36
+ item = $scope.items[item];
37
+ var reg = new RegExp(item.match);
38
+ if (reg.test(route)) {
39
+ angular.element(item.element).addClass("active");
40
+ } else {
41
+ angular.element(item.element).removeClass("active");
42
+ }
43
+ }
44
+ });
45
+ },
46
+ templateUrl: "/app/lib/napp-menu/partials/menu.html",
47
+ };
48
+ }
49
+ ])
50
+ .directive("menuItemParent", function() {
51
+ return {
52
+ require: "^menu",
53
+ restrict: "AE",
54
+ replace: true,
55
+ transclude: true,
56
+ scope: {
57
+ match: "@",
58
+ title: "@"
59
+ },
60
+ link: function(scope, element, attrs, menuCtrl) {
61
+ menuCtrl.addItem(scope.match, element);
62
+ },
63
+ templateUrl: "/app/lib/napp-menu/partials/menu-item-parent.html"
64
+ };
65
+ })
66
+ .directive('menuItem', function() {
67
+ return {
68
+ require: "^menu",
69
+ restrict: 'AE',
70
+ replace: true,
71
+ transclude: true,
72
+ scope: {
73
+ match: "@",
74
+ route: "@",
75
+ title: "@"
76
+ },
77
+ link: function(scope, element, attrs, menuCtrl) {
78
+ menuCtrl.addItem(scope.match, element);
79
+ },
80
+ templateUrl: "/app/lib/napp-menu/partials/menu-item.html",
81
+ }
82
+ });
83
+ });
pool/shard005/JavaScript/0032529_poseestimation_normal.js ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ QUnit.module("PoseEstimation Profile Normal Test", {
2
+ before: function () {
3
+ init();
4
+ }
5
+ });
6
+
7
+
8
+ /**
9
+ * PoseEstimationプロファイルの正常系テストを行うクラス。
10
+ * @class
11
+ */
12
+ let PoseEstimationProfileNormalTest = {};
13
+
14
+ /**
15
+ * 姿勢推定を取得するテストを行う。
16
+ * <h3>【HTTP通信】</h3>
17
+ * <p id="test">
18
+ * Method: GET<br/>
19
+ * Path: /poseEstimation/onPoseEstimation?serviceId=xxxx&accessToken=xxx<br/>
20
+ * </p>
21
+ * <h3>【期待する動作】</h3>
22
+ * <p id="expected">
23
+ * ・resultに0が返ってくること。<br/>
24
+ * ・poseの値が返ってくること。<br/>
25
+ * </p>
26
+ */
27
+ PoseEstimationProfileNormalTest.poseNormalTest = function (assert) {
28
+ let done = assert.async();
29
+ sdk.get({
30
+ profile: 'poseEstimation',
31
+ attribute: 'onPoseEstimation',
32
+ params: {
33
+ serviceId: getCurrentServiceId()
34
+ }
35
+ }).then(json => {
36
+ assert.ok(true, "result=" + json.result);
37
+ assert.ok(json.pose != undefined, "pose=" + json.pose);
38
+ done();
39
+ }).catch(e => {
40
+ assert.ok(checkErrorCode(e.errorCode),
41
+ 'errorCode=' + e.errorCode + ' errorMessage=' + e.errorMessage);
42
+ done();
43
+ });
44
+ }
45
+ QUnit.test("pose", PoseEstimationProfileNormalTest.poseNormalTest);
46
+
47
+ /**
48
+ * PoseEstimationプロファイルのheartrateの登録と解除を行うテストを行う。
49
+ * <h3>【HTTP通信】</h3>
50
+ * <p id="test">
51
+ * Method: PUT<br/>
52
+ * Path: /poseEstimation/onPoseEstimation?serviceId=xxxx&accessToken=xxx<br/>
53
+ * </p>
54
+ * <h3>【期待する動作】</h3>
55
+ * <p id="expected">
56
+ * ・resultに0が返ってくること。<br/>
57
+ * ・イベント通知が送られてくること。<br/>
58
+ * </p>
59
+ */
60
+ PoseEstimationProfileNormalTest.poseEventNormalTest001 = function (assert) {
61
+ let params = {
62
+ profile: 'poseEstimation',
63
+ attribute: 'onPoseEstimation',
64
+ params: {
65
+ serviceId: getCurrentServiceId()
66
+ }
67
+ };
68
+ openWebsocket(params, assert, 10000, message => {
69
+ let json = JSON.parse(message);
70
+ if (json.profile === "poseEstimation"
71
+ && json.attribute === "onPoseEstimation") {
72
+ assert.ok(true, message);
73
+ assert.ok(json.pose != undefined, "pose=" + json.pose);
74
+ return true;
75
+ }
76
+ return false;
77
+ });
78
+ }
79
+ QUnit.test("poseEventNormalTest001", PoseEstimationProfileNormalTest.poseEventNormalTest001);
pool/shard005/JavaScript/0032530_ruleFileList.js ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * HABmin - the openHAB admin interface
3
+ *
4
+ * openHAB, the open Home Automation Bus.
5
+ * Copyright (C) 2010-2013, openHAB.org <admin@openhab.org>
6
+ *
7
+ * See the contributors.txt file in the distribution for a
8
+ * full listing of individual contributors.
9
+ *
10
+ * This program is free software; you can redistribute it and/or modify
11
+ * it under the terms of the GNU General Public License as
12
+ * published by the Free Software Foundation; either version 3 of the
13
+ * License, or (at your option) any later version.
14
+ *
15
+ * This program is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ * GNU General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU General Public License
21
+ * along with this program; if not, see <http://www.gnu.org/licenses>.
22
+ *
23
+ * Additional permission under GNU GPL version 3 section 7
24
+ *
25
+ * If you modify this Program, or any covered work, by linking or
26
+ * combining it with Eclipse (or a modified version of that library),
27
+ * containing parts covered by the terms of the Eclipse Public License
28
+ * (EPL), the licensors of this Program grant you additional permission
29
+ * to convey the resulting work.
30
+ */
31
+
32
+ /**
33
+ * OpenHAB Admin Console HABmin
34
+ *
35
+ * @author Chris Jackson
36
+ */
37
+
38
+
39
+ Ext.define('openHAB.automation.ruleFileList', {
40
+ extend: 'Ext.panel.Panel',
41
+ layout: 'fit',
42
+ icon: 'images/document-copy.png',
43
+
44
+ initComponent: function () {
45
+ this.title = language.rule_FileListTitle;
46
+
47
+ // Define the Rule Template Store
48
+ Ext.define('RuleModelModel', {
49
+ extend: 'Ext.data.Model',
50
+ fields: [
51
+ {name: 'model'},
52
+ {name: 'rule'}
53
+ ]
54
+ });
55
+
56
+ var ruleModelStore = Ext.create('Ext.data.ArrayStore', {
57
+ model: 'RuleModelModel'
58
+ });
59
+
60
+ var toolbar = Ext.create('Ext.toolbar.Toolbar', {
61
+ items: [
62
+ {
63
+ icon: 'images/plus-button.png',
64
+ itemId: 'add',
65
+ text: language.add,
66
+ cls: 'x-btn-icon',
67
+ disabled: false,
68
+ tooltip: language.rule_FileListAddTip,
69
+ handler: function () {
70
+ Ext.define('RuleModelsModel', {
71
+ extend: 'Ext.data.Model',
72
+ fields: [
73
+ {name: 'name'},
74
+ {name: 'icon'},
75
+ {name: 'iconCls'}
76
+ ]
77
+ });
78
+
79
+ // Generate a list of all existing models
80
+ // User can type their own, but this gives them options.
81
+ var models = [];
82
+ var ocnt = 0;
83
+ for (var cnt = 0; cnt < ruleModelStore.getCount(); cnt++) {
84
+ var found = false;
85
+ var name = ruleModelStore.getAt(cnt).get("model");
86
+ for (var mcnt = 0; mcnt < models.length; mcnt++) {
87
+ if (models[mcnt].name == name) {
88
+ found = true;
89
+ break;
90
+ }
91
+ }
92
+ if (found === false) {
93
+ models[ocnt] = {};
94
+ models[ocnt].name = name;
95
+ ocnt++;
96
+ }
97
+ }
98
+
99
+ var form = Ext.widget('form', {
100
+ layout: {
101
+ type: 'vbox',
102
+ align: 'stretch'
103
+ },
104
+ border: false,
105
+ bodyPadding: 10,
106
+ fieldDefaults: {
107
+ labelAlign: 'top',
108
+ labelWidth: 100,
109
+ labelStyle: 'font-weight:bold'
110
+ },
111
+ defaults: {
112
+ margins: '0 0 10 0'
113
+ },
114
+ items: [
115
+ {
116
+ margin: '0 0 0 0',
117
+ xtype: 'combobox',
118
+ fieldLabel: 'Model name:',
119
+ itemId: 'model',
120
+ name: 'model',
121
+ store: {model: 'RuleModelsModel', data: models},
122
+ allowBlank: false,
123
+ valueField: 'name',
124
+ displayField: 'name',
125
+ queryMode: 'local',
126
+ forceSelection: false,
127
+ editable: true,
128
+ typeAhead: true
129
+ }
130
+ ],
131
+ buttons: [
132
+ {
133
+ text: language.cancel,
134
+ handler: function () {
135
+ this.up('window').destroy();
136
+ }
137
+ },
138
+ {
139
+ text: language.rule_FileListCreateButton,
140
+ handler: function () {
141
+ if (this.up('form').getForm().isValid()) {
142
+ // Read the model name
143
+ var model = form.getForm().findField('model').getSubmitValue();
144
+
145
+ var newProperties = null;
146
+
147
+ // Create a new ruleEditor
148
+ var newProperties = Ext.create('openHAB.automation.ruleEditor', {
149
+ modelName: model
150
+ });
151
+
152
+ if (newProperties != null)
153
+ Ext.getCmp('automationPropertyContainer').setNewProperty(newProperties);
154
+
155
+ this.up('window').destroy();
156
+ }
157
+ }
158
+ }
159
+ ]
160
+ });
161
+
162
+ var createWin = Ext.widget('window', {
163
+ title: language.rule_FileListCreateButton,
164
+ closeAction: 'destroy',
165
+ width: 225,
166
+ resizable: false,
167
+ draggable: false,
168
+ modal: true,
169
+ layout: {
170
+ type: 'vbox',
171
+ align: 'stretch'
172
+ },
173
+ items: [form]
174
+ });
175
+
176
+ createWin.show();
177
+ }
178
+ },
179
+ {
180
+ xtype: 'tbfill'
181
+ },
182
+ {
183
+ icon: 'images/arrow-circle-315.png',
184
+ itemId: 'refresh',
185
+ cls: 'x-btn-icon',
186
+ disabled: false,
187
+ tooltip: language.refresh,
188
+ handler: function () {
189
+ loadModelList();
190
+ }
191
+ }
192
+ ]
193
+ });
194
+
195
+ var ruleList = Ext.create('Ext.grid.Panel', {
196
+ store: ruleModelStore,
197
+ header: false,
198
+ split: true,
199
+ tbar: toolbar,
200
+ collapsible: false,
201
+ multiSelect: false,
202
+ columns: [
203
+ {
204
+ text: language.rule_FileListModel,
205
+ flex: 1,
206
+ dataIndex: 'model'
207
+ /*,
208
+ renderer:function (value, metadata, record) {
209
+ var icon = "";
210
+ var ref = itemConfigStore.findExact("name", value);
211
+ if (ref != -1) {
212
+ if (itemConfigStore.getAt(ref).get('icon') != "")
213
+ icon = '<img src="../images/' + itemConfigStore.getAt(ref).get('icon') + '.png" align="left" height="16">';
214
+ }
215
+
216
+ return '<div>' + icon + '</div><div style="margin-left:20px">' + value + '</div>';
217
+ }*/
218
+ },
219
+ {
220
+ text: language.rule_FileListRule,
221
+ flex: 3,
222
+ dataIndex: 'rule'
223
+ }
224
+ ],
225
+ listeners: {
226
+ itemclick: function (grid, record) {
227
+ if (record == null)
228
+ return;
229
+
230
+ // Create a new ruleEditor
231
+ var newProperties = Ext.create('openHAB.automation.ruleEditor', {
232
+ modelName: record.get('model'),
233
+ ruleName: record.get('rule')
234
+ });
235
+
236
+ if (newProperties != null)
237
+ Ext.getCmp('automationPropertyContainer').setNewProperty(newProperties);
238
+
239
+ // Update the toolbar
240
+ // toolbar.getComponent('delete').enable();
241
+ }
242
+ }
243
+ });
244
+
245
+ this.items = ruleList;
246
+
247
+ this.callParent();
248
+
249
+ loadModelList();
250
+
251
+ function loadModelList() {
252
+ // Clear the existing data
253
+ ruleModelStore.loadData([], false);
254
+
255
+ // Load the rule list from openHAB
256
+ Ext.Ajax.request({
257
+ url: HABminBaseURL + "/config/rules/model/list",
258
+ headers: {'Accept': 'application/json'},
259
+ method: 'GET',
260
+ success: function (response, opts) {
261
+ var json = Ext.decode(response.responseText);
262
+ // If there's no config for this sitemap, records will be null
263
+ if (json == null)
264
+ return;
265
+
266
+ var models = [].concat(json.rule);
267
+ for (var cnt = 0; cnt < models.length; cnt++) {
268
+ if (models[cnt].rules == null) {
269
+ var element = {};
270
+ element.model = models[cnt].model;
271
+
272
+ ruleModelStore.add(element);
273
+ continue;
274
+ }
275
+ var rules = [].concat(models[cnt].rules);
276
+ for (var elcnt = 0; elcnt < rules.length; elcnt++) {
277
+ var element = {};
278
+ element.model = models[cnt].model;
279
+ element.rule = rules[elcnt].name;
280
+
281
+ ruleModelStore.add(element);
282
+ }
283
+ }
284
+ }
285
+ });
286
+ }
287
+ }
288
+ })
289
+ ;
pool/shard005/JavaScript/0032531_index.ui.js ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //related to pullAnimation.ui
2
+ var image=ui("do_ImageView_3");
3
+ var scroll=ui("do_ScrollView_1");
4
+ var nf=sm("do_Notification");
5
+ var list=ui("do_ListView_1");
6
+ var page=sm("do_Page");
7
+ var app=sm("do_App");
8
+ var close = ui("close1");
9
+ var do_Label_3=ui("do_Label_3");
10
+
11
+ close.on("touch", function() {
12
+ app.closePage();
13
+ })
14
+ page.on("back", function() {
15
+ app.closePage();
16
+ });
17
+
18
+ do_Label_3.show("slide_l2r", 3000);
19
+
20
+ var animator = mm("do_Animator");
21
+ var animatorB = mm("do_Animator");
22
+
23
+ //顶部背景显示动画
24
+ animator.append(5000, props, "EaseOut");
25
+ var props = {bgColor:"0080FFFF"}
26
+ animatorB.append(5000, propsB, "EaseOut");
27
+ var propsB = {bgColor:"#ffFFFF00"}
28
+ scroll.on("scroll", function(datas) {
29
+ //根据返回的值,改变图片的高
30
+ deviceone.print(JSON.stringify(datas));
31
+ image.height = 500 -+ datas;
32
+ image.redraw();
33
+
34
+ });
35
+
36
+
pool/shard005/JavaScript/0032532_main.js ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var obj_geditor=document.getElementById("geditor");
2
+ var obj_tools=document.getElementById("tools");
3
+ var obj_geditor_co=document.getElementById("geditor").contentWindow;
4
+ //³õʼ»¯£¬±à¼­Æ÷
5
+ //¼ì²âÓû§°´¼ü£¬´Ó¶øÌí¼Ó±êÇ©
6
+ var p_ok=0;
7
+ window.onkeyup=function(event){
8
+ var e = event || window.event || arguments.callee.caller.arguments[0];
9
+ if(obj_geditor.textContent!=""){
10
+ if(p_ok==0){
11
+ for(var i=0;i<=100;i++){
12
+ if(e && e.keyCode==i){
13
+ //alert(s.textContent);
14
+ obj_geditor.innerHTML="<p>"+obj_geditor.textContent+"</p>";
15
+ p_ok=1;
16
+ }
17
+
18
+ }
19
+ }
20
+ }else{
21
+ p_ok=0;
22
+ }
23
+ };
24
+
25
+
26
+ /**¹«¹²µ÷Ó÷½·¨**/
27
+ //½«Îı¾ÄÚÈÝÑ¡ÖУ¬²¢½øÐÐÏàÓ¦²Ù×÷
28
+ var s;
29
+ function funcSelectText(mode,attr,value){ //modeÖ¸ÔªËØ±êÇ©;attrÖ¸Ëù´´½¨ÔªËصÄÊôÐÔ;valueÖ¸ÊôÐÔÖµ
30
+ var txt="";
31
+ if(document.selection){
32
+ sel=document.selection.createRange().text;
33
+ }else{
34
+ sel=document.getSelection();
35
+ }
36
+ txt=sel.getRangeAt(0).extractContents().textContent;
37
+ range=sel.getRangeAt(0);
38
+ if(txt.length>0){
39
+ s=range;
40
+ range.deleteContents();
41
+ var obj_txt=document.createElement(mode);
42
+ if(attr==""||value==""){
43
+ obj_txt.innerHTML=txt;
44
+ range.insertNode(obj_txt);
45
+ }else{
46
+ obj_txt.setAttribute(attr,value);
47
+ obj_txt.innerHTML=txt;
48
+ range.insertNode(obj_txt);
49
+ }
50
+ }
51
+ // alert(range);
52
+ /*if(txt!=null || txt!=""){
53
+ obj_geditor.innerHTML=obj_geditor.textContent.replace(txt,"121312");
54
+ } Ìæ»»Îı¾*/
55
+
56
+ }
57
+ /**var container = container || document;
58
+ container.onmouseup = function(){
59
+ funcSelectText();
60
+ } °´ÏÂÊó±êµ÷ÓÃÑ¡ÖÐÎı¾,²âÊÔʱºòÓõÄ**/
61
+
62
+ //option±êÇ©µÄÑ¡Ôñº¯Êý·½·¨£¨¹«¹²·½·¨,¿Éµ÷Óã©
63
+ /**function opsel(id,mode,attr,val){
64
+ var oindex;
65
+ var id=id;
66
+ var mode=mode;
67
+ var attr=attr;
68
+ var obj=document.getElementById(id);
69
+ value=obj.options[obj_font_size.options.selectedIndex].text;
70
+ obj_geditor.onfocus=funcSelectText(mode,attr,val+value);
71
+ }
72
+ **/
73
+ //(×¢ÒâÕâ¸ö·½·¨Ö»ÄÜÔÚselectÏÂʹÓã¡)µ÷ÓÃѡȡoptionµÄ·½·¨º¯Êý£¬¿ÉÖ±½Óµ÷ÓÃʹÓã¡idÖ¸£ºÒªµ÷Ó÷½·¨µÄÔªËØidÖµ£»modeÖ¸±êÇ©,±ÈÈç:span£»attrÖ¸ÊôÐÔÃû³Æ,È磺style£»valÖ¸ÊôÐÔÖµµÄÒ»²¿·Ö,È磺font-size:,×¢ÒâðºÅ±ØÐë¼ÓÉÏvalue¾ÍÊÇÑ¡ÖеÄÖµÁË
74
+ function fs(id,mode,attr,val,ty){
75
+ var val=val;
76
+ var id=id;
77
+ var obj=document.getElementById(id);
78
+ value=obj.options[obj.options.selectedIndex].text;
79
+ if(ty=="" || ty==null){ //tyÖ¸µÄÊÇÇл»valueºÍmode,ÒÔÊÊÓ¦¿ª·¢½×¶Î
80
+ funcSelectText(mode,attr,val+value);}else{
81
+ funcSelectText(value,attr,mode); //´ËʱvalueºÍmode½øÐÐÁËÇл»
82
+ }
83
+ }
84
+
85
+ //ÏÔÊ¾ÔªËØ
86
+ function show(){
87
+ alert(obj_geditor.innerHTML);
88
+ }
89
+
90
+
91
+ /**µ÷Óòå¼þ¹Ø¼ü¹¦ÄÜ**/
92
+
93
+ var js_src=new Array("tools/font/font_size.js","tools/font/font_type.js"); //×¢²á²å¼þµØÖ·
94
+
95
+ function diaoyong(src1){ //µ÷Óòå¼þ
96
+ var src=src1;
97
+ new_js=document.createElement("script");
98
+ new_js.setAttribute("type","text/javascript");
99
+ new_js.setAttribute("src",src);
100
+ document.body.appendChild(new_js);
101
+ }
102
+
103
+
104
+ function js_ok(){
105
+ for(var i=0;i<=js_src.length;i++){
106
+ //alert(js_src[i]);
107
+ diaoyong(js_src[i]);
108
+ }
109
+ }
110
+
111
+ js_ok();
112
+ //alert("ssssss");
113
+
114
+
pool/shard005/JavaScript/0032534_index.js ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*jslint node: true, forin: true, jslint white: true, newcap: true*/
2
+ /*
3
+ * wrappify
4
+ * author : Takeshi Iwana
5
+ * https://github.com/iwatakeshi
6
+ * license : MIT
7
+ * Code heavily borrowed from Adam Draper
8
+ * https://github.com/adamwdraper
9
+ */
10
+
11
+ (function() {
12
+ 'use strict';
13
+
14
+ var wrappify,
15
+ hasModule = (typeof module !== 'undefined' && module.exports);
16
+
17
+ function Wrappify(core) {
18
+ 'use strict';
19
+ this.core = core;
20
+ }
21
+
22
+ Wrappify.prototype.express = function() {
23
+ return this.core.ship.bind(this.core);
24
+ };
25
+
26
+ Wrappify.prototype.hapi = function() {
27
+ var core = this.core;
28
+ var plugin = {
29
+ register: function hapi(plugin, options, next) {
30
+ plugin.ext('onPreHandler', function(request, reply) {
31
+ core.ship.bind(core)(request);
32
+ reply.continue();
33
+ });
34
+ plugin.ext('onPreResponse', function(request, reply) {
35
+ core.ship.bind(core)(request);
36
+ reply.continue();
37
+ });
38
+ return next();
39
+ }
40
+ }
41
+ plugin.register.attributes = {
42
+ name: 'Wrappify',
43
+ version: '0.0.1'
44
+ }
45
+ return plugin;
46
+ };
47
+
48
+ Wrappify.prototype.koa = function() {
49
+ var core = this.core;
50
+ return function (self, next) {
51
+ core.ship.bind(core)(self);
52
+ return next();
53
+ }
54
+ };
55
+
56
+
57
+ wrappify = function(core) {
58
+ return new Wrappify(core);
59
+ };
60
+
61
+ /************************************
62
+ Exposing wrappify
63
+ ************************************/
64
+
65
+ // CommonJS module is defined
66
+ if (hasModule) {
67
+ module.exports = wrappify;
68
+ }
69
+
70
+ /*global ender:false */
71
+ if (typeof ender === 'undefined') {
72
+ // here, `this` means `window` in the browser, or `global` on the server
73
+ // add `wrappify` as a global object via a string identifier,
74
+ // for Closure Compiler 'advanced' mode
75
+ this.wrappify = wrappify;
76
+ }
77
+
78
+ /*global define:false */
79
+ if (typeof define === 'function' && define.amd) {
80
+ define([], function() {
81
+ return wrappify;
82
+ });
83
+ }
84
+ }).call(this);
pool/shard005/JavaScript/0032535_index.js ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const lastSaid = {};
2
+ const replaceRegex = /^s\/(.*?)\/(.*?)(?:(?:\/g)|(?:\/))?$/;
3
+
4
+ function replaceAll(find, replace, str) {
5
+ return str.replace(new RegExp(find, 'g'), replace);
6
+ }
7
+
8
+ module.exports.msg = function (text, from, reply, raw) {
9
+ match = replaceRegex.exec(text);
10
+ if (match) {
11
+ // Replace the last thing the person said, if anything
12
+ if (lastSaid[from] != undefined) {
13
+ let personLastSaid = lastSaid[from],
14
+ find = match[1],
15
+ replace = match[2];
16
+ const fixed = replaceAll(find, replace, personLastSaid);
17
+
18
+ if (fixed != personLastSaid) {
19
+ const response = `<${from}> ${fixed}`;
20
+
21
+ reply(response);
22
+ }
23
+ }
24
+ } else {
25
+ // The proper way to do this would be with scrollback module but w/e
26
+ lastSaid[from] = text;
27
+ }
28
+ };
pool/shard005/JavaScript/0032537_child-router.test.js ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { ChildRouter } from '../../src/child-router';
2
+ var RouterStub = (function () {
3
+ function RouterStub() {
4
+ }
5
+ RouterStub.prototype.configure = function (handler) {
6
+ handler(this);
7
+ };
8
+ RouterStub.prototype.map = function (routes) {
9
+ this.routes = routes;
10
+ };
11
+ return RouterStub;
12
+ }());
13
+ describe('the Child Router module', function () {
14
+ var sut;
15
+ var mockedRouter;
16
+ beforeEach(function () {
17
+ mockedRouter = new RouterStub();
18
+ sut = new ChildRouter();
19
+ sut.configureRouter(mockedRouter, mockedRouter);
20
+ });
21
+ it('contains a router property', function () {
22
+ expect(sut.router).toBeDefined();
23
+ });
24
+ it('configures the heading', function () {
25
+ expect(sut.heading).toEqual('Child Router');
26
+ });
27
+ it('should have a welcome route', function () {
28
+ expect(sut.router.routes).toContainEqual({ route: ['', 'welcome'], name: 'welcome', moduleId: './welcome', nav: true, title: 'Welcome' });
29
+ });
30
+ it('should have a users route', function () {
31
+ expect(sut.router.routes).toContainEqual({ route: 'users', name: 'users', moduleId: './users', nav: true, title: 'Github Users' });
32
+ });
33
+ it('should have a child router route', function () {
34
+ expect(sut.router.routes).toContainEqual({ route: 'child-router', name: 'child-router', moduleId: './child-router', nav: true, title: 'Child Router' });
35
+ });
36
+ });
37
+ //# sourceMappingURL=child-router.test.js.map
pool/shard005/JavaScript/0032538_collapser.user.js ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import UI from './ui';
2
+ import Settings from './settings';
3
+
4
+ const idPrefix = 'collapser';
5
+ const userSettings = new Settings('collapser.');
6
+ const dataToggle = 'data-toggle';
7
+
8
+ var buffers; // All networks
9
+ var colEnabled, colTogActive, colTogInactive, colTogConvo, colTogArchive;
10
+ var toggleApply = false;
11
+
12
+ function hide () {
13
+ var header = $(this);
14
+ var restore = header.data('restore');
15
+
16
+ if (restore == null || toggleApply == true) {
17
+ toggleApply = false;
18
+ restore = header.nextAll();
19
+
20
+ var classes = [colTogActive, colTogInactive, colTogConvo, colTogArchive]
21
+ .filter(i => i.prop('checked'))
22
+ .map(i => i.attr(dataToggle))
23
+ .join(', ');
24
+
25
+ restore = restore.filter(classes);
26
+ header.data('restore', restore);
27
+ }
28
+
29
+ restore.filter('.archiveToggle').toggleClass('show');
30
+ restore.not('.archiveToggle').toggleClass('hide');
31
+ }
32
+
33
+ function toggleActivation (toggle) {
34
+ buffers[toggle == true ? 'on' : 'off']('dblclick', hide);
35
+ }
36
+
37
+ UI.pageReady(function () {
38
+
39
+ var style = '$includeStyle$';
40
+ style = UI.embedStyle(style);
41
+
42
+ const hashName = 'collapser';
43
+ var menu = UI.buildMenuTemplate('collapser-menu', hashName, 'Collapser');
44
+ menu = $(menu);
45
+ menu = UI.addMenu(menu);
46
+
47
+ var container = '$includeContainer$';
48
+ container = $(container);
49
+ container = UI.addContainer(container);
50
+
51
+ window.location.hash === '#?/settings=' + hashName && SESSIONVIEW.showSettings(hashName);
52
+ buffers = $('h2.buffer');
53
+
54
+ // Init container props
55
+ const snEnabled = 'enabled';
56
+ colEnabled = container.find(`#${idPrefix}-enabled-check`);
57
+ colEnabled
58
+ .change(() => { userSettings.set(snEnabled, colEnabled[0].checked); toggleActivation(colEnabled[0].checked); })
59
+ .prop('checked', JSON.parse(userSettings.get(snEnabled, true)));
60
+
61
+
62
+ function blink1 (next) { buffers.css({ outline: '4px solid blue' }); next(); }
63
+ function blink2 (next) { buffers.css({ outline: '' }); next(); }
64
+ var colShowNetworks = container.find(`#${idPrefix}-show-networks`)
65
+ .click(() => { buffers.clearQueue(); for (var i = 0; i < 2; i++) buffers.queue(blink1).delay(600).queue(blink2).delay(600); });
66
+
67
+ const snActive = 'toggle.active';
68
+ colTogActive = container.find(`#${idPrefix}-collapse-active`);
69
+ colTogActive
70
+ .attr(dataToggle, '.channels')
71
+ .change(() => { userSettings.set(snActive, colTogActive[0].checked); toggleApply = true; })
72
+ .prop('checked', JSON.parse(userSettings.get(snActive, true)));
73
+
74
+ const snInactive = 'toggle.inactive';
75
+ colTogInactive = container.find(`#${idPrefix}-collapse-inactive`);
76
+ colTogInactive
77
+ .attr(dataToggle, '.inactiveChannels')
78
+ .change(() => { userSettings.set(snInactive, colTogInactive[0].checked); toggleApply = true; })
79
+ .prop('checked', JSON.parse(userSettings.get(snInactive, true)));
80
+
81
+ const snConvo = 'toggle.convo';
82
+ colTogConvo = container.find(`#${idPrefix}-collapse-convo`);
83
+ colTogConvo
84
+ .attr(dataToggle, '.conversations')
85
+ .change(() => { userSettings.set(snConvo, colTogConvo[0].checked); toggleApply = true; })
86
+ .prop('checked', JSON.parse(userSettings.get(snConvo, true)));
87
+
88
+ const snArchive = 'toggle.archive';
89
+ colTogArchive = container.find(`#${idPrefix}-collapse-archive`);
90
+ colTogArchive
91
+ .attr(dataToggle, '.archiveToggle')
92
+ .change(() => { userSettings.set(snArchive, colTogArchive[0].checked); toggleApply = true; })
93
+ .prop('checked', JSON.parse(userSettings.get(snArchive, true)));
94
+
95
+ // Start
96
+ JSON.parse(userSettings.get('enabled', true)) && toggleActivation(true);
97
+ });
pool/shard005/JavaScript/0032543_map_flatten_and_wrap_filters.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import _ from 'lodash';
2
+ import FilterBarLibMapAndFlattenFiltersProvider from 'ui/filter_bar/lib/map_and_flatten_filters';
3
+ export default function mapFlattenAndWrapFilters(Private) {
4
+ const mapAndFlattenFilters = Private(FilterBarLibMapAndFlattenFiltersProvider);
5
+ return function (filters) {
6
+ return mapAndFlattenFilters(filters).then(function (filters) {
7
+ return _.map(filters, function (filter) {
8
+ filter.meta = filter.meta || {};
9
+ filter.meta.apply = true;
10
+ return filter;
11
+ });
12
+ });
13
+ };
14
+ }
pool/shard005/JavaScript/0032547_train-tracking-service.js ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ /**
4
+ * @ngdoc service
5
+ * @name traffic.trainTrackingService
6
+ * @description
7
+ * # trainTrackingService
8
+ * Service in the traffic.
9
+ */
10
+ angular.module('traffic')
11
+ .service('trainTrackingService', function() {
12
+ var stompClient = null;
13
+ var subscription;
14
+
15
+ /* function getHistory(trainNumber) {
16
+ var url = 'http://rata.digitraffic.fi/api/v1/train-tracking/' + trainNumber + '?departure_date=2016-01-26';
17
+ return $http.get(url);
18
+ }
19
+ */
20
+ //TODO: refactor as generic pub/sub stomp service & extend
21
+ var trainTrackingService = {
22
+ track: function(trainNumber, callback) {
23
+ var socket = new SockJS('http://rata.digitraffic.fi/api/v1/websockets/train-tracking');
24
+ stompClient = Stomp.over(socket);
25
+ stompClient.connect({}, function(frame) {
26
+ console.log('frame', frame);
27
+ subscription = stompClient.subscribe('/' + trainNumber, function(message) {
28
+ callback(angular.fromJson(message.body)[0]);
29
+ });
30
+ });
31
+ },
32
+ stop: function() {
33
+ if (subscription) {
34
+ subscription.unsubscribe();
35
+ }
36
+ if (stompClient) {
37
+ stompClient.disconnect();
38
+ }
39
+ }
40
+ };
41
+
42
+ return trainTrackingService;
43
+ });
pool/shard005/JavaScript/0032548_work.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //alert(localStorage["user"]);
2
+ var storage = {};
3
+
4
+ function loginform(){
5
+ if(storage.user && storage.pass){
6
+ if($("#loginForm").length>0&&$("p.error").length==0){
7
+ $("#loginForm #nme").val(storage.user);
8
+ $("#loginForm #pwd").val(storage.pass);
9
+ $("#loginForm [type=submit]").click();
10
+ }
11
+ }
12
+ }
13
+ chrome.runtime.sendMessage({greeting: "hello"}, function(response) {
14
+ storage = response.storage;
15
+ loginform();
16
+ });
pool/shard005/JavaScript/0032551_ui_tab_panel_library.js ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * @Author: Vaninadh
3
+ * @Date: 2016-03-30 19:51:31
4
+ * @Last Modified by: Vaninadh
5
+ * @Last Modified time: 2016-04-27 11:31:12
6
+ */
7
+
8
+ define(function(require) {
9
+ var defineComponent = require("flight/lib/component");
10
+ var uiCellMixinDraggable = require("KCEPROD/ui/sider_panel/cell/ui_cell_mixin_draggable");
11
+ var util = require("KCEPROD/util/util");
12
+
13
+ var Mustache = require("mustache");
14
+ var ns = window.kc.ns;
15
+
16
+ return defineComponent(uiCellMixinDraggable, uiTabPanelLibrary);
17
+
18
+ function uiTabPanelLibrary() {
19
+ this.attributes({
20
+ loadonce: false,
21
+ picAddBtnSelector: "#library-add-pic",
22
+ picUploadFileSelector: ".pic-upload-file",
23
+ picBtnDivSelector: ".pic-btn-div",
24
+ libraryTabSelector: "#tab-library",
25
+ libraryPicBoxSelector: "#library-pic-box",
26
+ pageid: 0,
27
+ cellLibrarySelector: ".library-cell",
28
+ cellImageSelector: ".cell-image",
29
+ itemOpDeleteSelector: ".icon-shanchu",
30
+ itemDraggable: ".item-draggable",
31
+ picDialog: "",
32
+ pic_dialog_url: "#pic_dialog_url",
33
+ picPreview: "#picPreview",
34
+ picAddClose: "#picAddClose",
35
+ picSaveBtn: "#picSaveBtn"
36
+
37
+ });
38
+
39
+ this.renderTab = function(e, data) {
40
+ if (!this.attr.loadonce) {
41
+ console.log("render uiTabPanelLibrary is ok!");
42
+
43
+ var that = this;
44
+ $('body').append(this.getDialog());
45
+
46
+ this.attr.picDialog = $("#uiPicAdd").dialog({
47
+ closeOnEscape:false,
48
+ create: function(event) {
49
+ $(event.target).dialog("widget").css({ "position": "fixed" });
50
+ },
51
+ resizable: false,
52
+ height: 400,
53
+ width: 680,
54
+ modal: true,
55
+ title: 'i am dialog',
56
+ position: { my: "top", at: "bottom", of: $('#artOpPanel') },
57
+ dialogClass: '',
58
+ autoOpen: false,
59
+ buttons: {
60
+
61
+ }
62
+ });
63
+
64
+ this.renderPicListScroll();
65
+ this.addBoxListener();
66
+ }
67
+ this.attr.loadonce = true;
68
+ }
69
+
70
+ this.addBoxListener = function() {
71
+ var that = this;
72
+
73
+ $(this.attr.loveBoxSelector).scroll(function() {
74
+ var $this = $(this);
75
+ var height = this.scrollHeight - $this.height() - 50; // Get the height of the div
76
+ var scroll = $this.scrollTop(); // Get the vertical scroll position
77
+
78
+ var isScrolledToEnd = (scroll >= height);
79
+
80
+ if (isScrolledToEnd) {
81
+ that.renderPicListScroll();
82
+ }
83
+ });
84
+
85
+ this.on(this.attr.libraryTabSelector, 'click', {
86
+ itemOpDeleteSelector: this.itemOpDelete,
87
+ picAddBtnSelector: this.picAddDialog
88
+ });
89
+
90
+ this.on(this.attr.picBtnDivSelector, 'change', {
91
+ picUploadFileSelector: this.picUpload
92
+ });
93
+
94
+ this.on(this.attr.picAddClose, 'click', this.closePicAddDialog);
95
+
96
+ this.on(this.attr.pic_dialog_url, 'change', this.onImgUrlChange);
97
+ this.on(this.attr.picSaveBtn, 'click', this.picSave);
98
+ }
99
+
100
+ this.renderPicListScroll = function() {
101
+ this.trigger(ns.e.data.dataPicList, {
102
+ pageid: this.attr.pageid,
103
+ triggerEvent:ns.e.tab.uiPicList
104
+ });
105
+ this.attr.pageid++;
106
+ }
107
+ this.clearPicListInBox = function() {
108
+ this.attr.pageid = 0;
109
+ $(this.attr.libraryPicBoxSelector).html('');
110
+ }
111
+
112
+ this.itemOpDelete = function(e, data) {
113
+ var lid = $(data.el).parent().data('id');
114
+ this.trigger(ns.e.data.dataPicDelete, {
115
+ lid: lid,
116
+ el: data.el,
117
+ triggerEvent:ns.e.tab.uiPicDelete
118
+ });
119
+ };
120
+ this.picSave = function (){
121
+ var url = $("#pic_dialog_url").val();
122
+ this.picAdd(null, {
123
+ url: url
124
+ });
125
+
126
+ this.closePicAddDialog();
127
+ }
128
+
129
+ this.picAdd = function(e, data) {
130
+ this.trigger(ns.e.data.dataPicAdd, {
131
+ url: data.url,
132
+ triggerEvent:ns.e.tab.uiPicRefresh
133
+ });
134
+ }
135
+
136
+ this.picUpload = function(e, data) {
137
+ var file = $(data.el)[0].files[0];
138
+ var that = this;
139
+ var ic = ns.c.img;
140
+ util.uploadfile(file, {
141
+ success: function(blkRet) {
142
+ that.picAdd(null, {
143
+ url: ic.url + blkRet.key + "?" + ic.api_type + ic.suf + ic.mode + ic.suf + "w" + ic.suf + ic.pic_list_img.w
144
+ });
145
+ },
146
+ error: function() {
147
+
148
+ }
149
+ });
150
+ }
151
+
152
+ this.onImgUrlChange = function () {
153
+ var url = $("#pic_dialog_url").val();
154
+ $(this.attr.picPreview).attr("src",url);
155
+ }
156
+
157
+ this.picAddDialog = function() {
158
+ util.displayGrayBg();
159
+ this.attr.picDialog.dialog("open");
160
+ }
161
+
162
+ this.closePicAddDialog = function() {
163
+ this.attr.picDialog.dialog("close");
164
+ util.hideGrayBg();
165
+ }
166
+
167
+ //callback when server send json data to client
168
+ this.renderPicList = function(e, data) {
169
+ $(this.attr.libraryPicBoxSelector).append(Mustache.render(this.getTmpl(), data.json));
170
+ this.activeDraggable($(this.attr.itemDraggable));
171
+ }
172
+
173
+ this.renderPicDelete = function(e, data) {
174
+ $(data.el).parent().parent().remove();
175
+ }
176
+
177
+ this.renderPicRefresh = function(e, data) {
178
+ if (this.attr.loadonce) {
179
+ /*var json = {
180
+ objs: {
181
+ id: data.json.lid,
182
+ url: data.url
183
+ }
184
+ };
185
+ $(this.attr.libraryPicBoxSelector).append(Mustache.render(this.getTmpl(), json));*/
186
+ this.clearPicListInBox();
187
+ this.renderPicListScroll();
188
+ }
189
+ }
190
+
191
+ this.getDialog = function() {
192
+ return [
193
+ // '<div id="uiPicAdd">',
194
+ // '<div>',
195
+ // '<label style="display:inline-block;">图片链接地址:</label>',
196
+ // '<input type="text" id="pic_dialog_url" style="display:inline-block;width:300px;"/>',
197
+ // '</div>',
198
+ // '</div>',
199
+ '<div id="uiPicAdd" class="popContent9 displayT">\
200
+ <img id="picAddClose" src="images/p3_7.png" class="popClose" />\
201
+ <div class="pd20 displayTC">\
202
+ <div class="font16 colorBlack">图片</div>\
203
+ <div class="bgWhite1 pt20 pb20">\
204
+ <input id="pic_dialog_url" class="input1 width6 bgGray1 pd10 borderR5" type="text" placeholder="输入链接">\
205
+ </div>\
206
+ <div class="textC pt10">\
207
+ <a id="picSaveBtn" class="displayI bgYellow font16 colorWhite pt5 pb5 pl30 pr30">保存</a>\
208
+ </div>\
209
+ </div>\
210
+ <div class="bgGray3 pd20 displayTC borderTR5 borderBR5">\
211
+ <div class="displayI font14 colorGray border1 pt5 pb5 pl10 pr10">预览</div>\
212
+ <img id="picPreview" src="" class="displayB width6 mt20" />\
213
+ </div>\
214
+ </div>'
215
+ ].join('\n');
216
+ }
217
+
218
+ this.getTmpl = function() {
219
+ return [
220
+ '{{#objs}}',
221
+ '<div class="cell-image item-draggable" style="position:relative" targettype="image" src="{{url}}">',
222
+ '<div class="item-op-center" data-id="{{id}}">',
223
+ '<i class="iconfont icon-shanchu"/>',
224
+ '</div>',
225
+ '<div class="library-cell">',
226
+ '<img src="{{url}}"/>',
227
+ '</div>',
228
+ '</div>',
229
+ '{{/objs}}',
230
+ ].join('\n');
231
+ }
232
+
233
+ this.doDirectInsert = function (e, data){
234
+ var lastIdx = util.getLastCanvasItemIndex();
235
+
236
+ var styleObj = {};
237
+ styleObj['src']= e.currentTarget.attributes['src'].value;
238
+ this.trigger(ns.e.createNode, {
239
+ itemtype: 'image',
240
+ para : styleObj,
241
+ el:$(".canvas > [kctype='container']")[0],
242
+ preel: lastIdx,
243
+ });
244
+ }
245
+
246
+ this.after("initialize", function() {
247
+ console.log("uiTabPanelLibrary is ok!");
248
+ this.on(document, ns.e.tab.uiTabLibrary, this.renderTab);
249
+ this.on(document, ns.e.tab.uiPicList, this.renderPicList);
250
+ this.on(document, ns.e.tab.uiPicDelete, this.renderPicDelete);
251
+ this.on(document, ns.e.tab.uiPicRefresh, this.renderPicRefresh);
252
+ this.on('click', {cellImageSelector: this.doDirectInsert});
253
+ });
254
+ }
255
+ });
pool/shard005/JavaScript/0032554_Data.js ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function Data(){
2
+
3
+ //this.config = JSON.parse(Titanium.App.Properties.getString("config"));
4
+ }
5
+
6
+ Data.prototype.getGasolineras = function(coordenadas) {
7
+ var config = JSON.parse(Titanium.App.Properties.getString("config"));
8
+ var xhr = Titanium.Network.createHTTPClient({
9
+ enableKeepAlive:false
10
+ });
11
+ if(Ti.Network.online){
12
+ xhr.timeout = 15000;
13
+ xhr.onload = function()
14
+ {
15
+ Ti.API.info('XHR "onload" ['+this.status+']: '+this.responseText+'');
16
+ Titanium.API.info('loaded');
17
+ //Si nos responde correctamente con el JSON
18
+ if (this.status == 200)
19
+ {
20
+ var gasolineras = JSON.parse(this.responseText);
21
+ if (gasolineras.error == "Ninguna gasolinera cercana")
22
+ {
23
+ //hideIndicator();
24
+ Titanium.API.info('Ninguna gasolinera cercana');
25
+ var alertDialog = Titanium.UI.createAlertDialog({
26
+ title: 'Aviso',
27
+ message: 'Ninguna gasolinera cercana a tu posición',
28
+ buttonNames: ['Reintentar','Ajustes']
29
+ });
30
+ //Mostramos alerta del error y volvemos a pedir las gasolineras si clicka el boton
31
+ alertDialog.show();
32
+ alertDialog.addEventListener('click', function(e){
33
+ //Si ha pulsado reintentar
34
+ if (e.index==0)
35
+ {
36
+ //showIndicator();
37
+ Ti.App.fireEvent('location.refresh');
38
+ }
39
+ else{
40
+ Ti.App.fireEvent('gas.notfound');
41
+ }
42
+ });
43
+ }
44
+ else
45
+ {
46
+ var gasolinerasArray = new Array();
47
+
48
+ for (var c=0;c<gasolineras.length;c++)
49
+ {
50
+ gasolinerasArray[c] = {
51
+ 'id': gasolineras[c].id_gasolinera,
52
+ 'lat':gasolineras[c].lat,
53
+ 'lng':gasolineras[c].lng,
54
+ 'provincia': gasolineras[c].provincia,
55
+ 'localidad': gasolineras[c].localidad,
56
+ 'distancia': gasolineras[c].distance,
57
+ 'precio': gasolineras[c]['p'+JSON.parse(Titanium.App.Properties.getString("config")).tipoName],
58
+ 'fecha':gasolineras[c]['f'+JSON.parse(Titanium.App.Properties.getString("config")).tipoName],
59
+ 'direccion':gasolineras[c].direccion,
60
+ 'rotulo': gasolineras[c].rotulo,
61
+ 'horario': gasolineras[c].horario
62
+ };
63
+ try{
64
+ gasolinerasArray[c].precio = gasolinerasArray[c].precio.replace('.',',');
65
+ }
66
+ catch (e){
67
+ gasolinerasArray[c].precio = "-,--";
68
+ }
69
+ }
70
+ Titanium.App.Properties.setString("gasolinerasList", JSON.stringify(gasolinerasArray) );
71
+ Ti.App.fireEvent('gasolineras.updated');
72
+ }
73
+ }
74
+
75
+ }
76
+ xhr.onerror = function()
77
+ {
78
+ Titanium.API.info('error');
79
+ Ti.API.info('XHR "onload" ['+this.status+']: '+this.responseText+'');
80
+ var alertDialog = Titanium.UI.createAlertDialog({
81
+ title: 'Error',
82
+ message: 'No se ha podido establecer la conexion, comprueba tu conexión',
83
+ buttonNames: ['Reintentar']
84
+ });
85
+ //Mostramos alerta del error y volvemos a pedir las gasolineras si clicka el boton
86
+ alertDialog.show();
87
+ alertDialog.addEventListener('click', function(e){
88
+ Ti.App.fireEvent('location.refresh');
89
+ });
90
+ }
91
+
92
+ Ti.API.info("http://localhost:10088/Repostaje/api/gasolineras/lat/"+coordenadas.lat+"/lng/"+coordenadas.lng+"/radio/"+config.radio+"/limit/"+config.limit+"/carburante/"+config.tipoName);
93
+ //xhr.open("GET","http://localhost:10088/Repostaje/api/gasolineras/lat/"+42.538059+"/lng/"+-2.556020+"/radio/"+radio+"/limit/"+limit);
94
+ xhr.open("GET","http://repostaje.gesdinet.org/api/gasolineras/lat/"+coordenadas.lat+"/lng/"+coordenadas.lng+"/radio/"+config.radio+"/limit/"+config.limit+"/carburante/"+config.tipoName);
95
+ xhr.send();
96
+ }
97
+ else {
98
+ //hideIndicator();
99
+ var alertDialog = Titanium.UI.createAlertDialog({
100
+ title: 'Problemas',
101
+ message: 'No tienes conexión a Internet.',
102
+ buttonNames: ['Ok']
103
+ });
104
+ alertDialog.show();
105
+ Ti.App.fireEvent('change.settings');
106
+ }
107
+
108
+ };
109
+
110
+ module.exports = Data;
pool/shard005/JavaScript/0032557_withdrawaltransfer.js ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var constants = require("../helpers/constants.js");
2
+
3
+ var private = {}, self = null,
4
+ library = null, modules = null;
5
+
6
+ function WithdrawalTransfer(cb, _library) {
7
+ self = this;
8
+ library = _library;
9
+ cb(null, self);
10
+ }
11
+
12
+ WithdrawalTransfer.prototype.create = function (data, trs) {
13
+ trs.recipientId = null;
14
+ trs.amount = data.amount;
15
+ return trs;
16
+ }
17
+
18
+ WithdrawalTransfer.prototype.calculateFee = function (trs) {
19
+ return 0.1 * constants.fixedPoint;
20
+ }
21
+
22
+ WithdrawalTransfer.prototype.verify = function (trs, sender, cb, scope) {
23
+ if (trs.recipientId) {
24
+ return cb("Invalid recipient");
25
+ }
26
+
27
+ if (trs.amount <= 0) {
28
+ return cb("Invalid transaction amount");
29
+ }
30
+
31
+ cb(null, trs);
32
+ }
33
+
34
+ WithdrawalTransfer.prototype.getBytes = function (trs) {
35
+ return null;
36
+ }
37
+
38
+ WithdrawalTransfer.prototype.apply = function (trs, sender, cb, scope) {
39
+ modules.blockchain.accounts.mergeAccountAndGet({
40
+ address: sender.address,
41
+ balance: {"LISK": -(trs.amount + trs.fee)}
42
+ }, cb, scope);
43
+ }
44
+
45
+ WithdrawalTransfer.prototype.undo = function (trs, sender, cb, scope) {
46
+ modules.blockchain.accounts.undoMerging({
47
+ address: sender.address,
48
+ balance: {"LISK": -(trs.amount + trs.fee)}
49
+ }, cb, scope);
50
+ }
51
+
52
+ WithdrawalTransfer.prototype.applyUnconfirmed = function (trs, sender, cb, scope) {
53
+ var sum = trs.amount + trs.fee;
54
+
55
+ if (sender.u_balance["LISK"] < sum) {
56
+ return cb("Account does not have enough LISK");
57
+ }
58
+
59
+ modules.blockchain.accounts.mergeAccountAndGet({
60
+ address: sender.address,
61
+ u_balance: {"LISK": -(trs.amount + trs.fee)}
62
+ }, cb, scope);
63
+ }
64
+
65
+ WithdrawalTransfer.prototype.undoUnconfirmed = function (trs, sender, cb, scope) {
66
+ modules.blockchain.accounts.undoMerging({
67
+ address: sender.address,
68
+ u_balance: {"LISK": -(trs.amount + trs.fee)}
69
+ }, cb, scope);
70
+ }
71
+
72
+ WithdrawalTransfer.prototype.ready = function (trs, sender, cb, scope) {
73
+ setImmediate(cb);
74
+ }
75
+
76
+ WithdrawalTransfer.prototype.normalize = function (asset, cb) {
77
+ setImmediate(cb);
78
+ }
79
+
80
+ WithdrawalTransfer.prototype.save = function (trs, cb) {
81
+ setImmediate(cb);
82
+ }
83
+
84
+ WithdrawalTransfer.prototype.dbRead = function (row) {
85
+ return null;
86
+ }
87
+
88
+ WithdrawalTransfer.prototype.onBind = function (_modules) {
89
+ modules = _modules;
90
+
91
+ modules.logic.transaction.attachAssetType(2, self);
92
+ }
93
+
94
+ WithdrawalTransfer.prototype.withdrawal = function (cb, query) {
95
+ library.validator.validate(query, {
96
+ type: "object",
97
+ properties: {
98
+ secret: {
99
+ type: "string",
100
+ minLength: 1,
101
+ maxLength: 100
102
+ },
103
+ amount: {
104
+ type: "integer",
105
+ minimum: 1
106
+ }
107
+ },
108
+ }, function (err) {
109
+ if (err) {
110
+ return cb(err[0].message);
111
+ }
112
+
113
+ var keypair = modules.api.crypto.keypair(query.secret);
114
+
115
+ var account = modules.blockchain.accounts.getAccount({
116
+ publicKey: keypair.publicKey.toString("hex")
117
+ }, function (err, account) {
118
+ try {
119
+ var transaction = library.modules.logic.transaction.create({
120
+ type: 2,
121
+ amount: query.amount,
122
+ sender: account,
123
+ keypair: keypair
124
+ });
125
+ } catch (e) {
126
+ return setImmediate(cb, e.toString(0));
127
+ }
128
+
129
+ modules.blockchain.transactions.processUnconfirmedTransaction(transaction, cb);
130
+ });
131
+ })
132
+ }
133
+
134
+ module.exports = WithdrawalTransfer;
pool/shard005/JavaScript/0032563_test-browser-creation.js ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*global describe, beforeEach, it*/
2
+ 'use strict';
3
+
4
+ var path = require('path');
5
+ var fs = require('fs');
6
+ var yeoman = require('yeoman-generator');
7
+ var helpers = yeoman.test;
8
+ var assert = yeoman.assert;
9
+
10
+ var expectedFiles = ['.bowerrc', 'bower.json', 'index.html'];
11
+ var unexpectedFiles = ['package.json'];
12
+
13
+
14
+ describe('test browser generator', function () {
15
+
16
+ // -----------------------------------------------------------------------------
17
+ // Test behavior when there are not pre-existing js files.
18
+ // -----------------------------------------------------------------------------
19
+ it('creates expected files when no .js files exist', function (done) {
20
+ helpers.run(path.join(__dirname, '../app'))
21
+ .inDir(path.join(__dirname, './temp'))
22
+ .withOptions({
23
+ 'skip-install': true
24
+ })
25
+ .withPrompt({
26
+ 'environment': 'browser',
27
+ 'algorithm': 'algorithm'
28
+ })
29
+ .on('end', function () {
30
+ var expected = expectedFiles.concat([
31
+ 'spec/algorithm.js',
32
+ 'algorithm.js'
33
+ ]);
34
+ assert.file(expected);
35
+ assert.fileContent('algorithm.js', /var algorithm = function ()/);
36
+ assert.fileContent('bower.json', /chai/);
37
+ assert.noFileContent('./spec/algorithm.js', /require/);
38
+ done();
39
+ });
40
+ });
41
+
42
+ it('leaves existing files intact when they exist', function (done) {
43
+ helpers.run(path.join(__dirname, '../app'))
44
+ .inDir(path.join(__dirname, './temp'))
45
+ .withOptions({
46
+ 'skip-install': true
47
+ })
48
+ .withPrompt({
49
+ 'environment': 'browser',
50
+ 'file': 'myAlgo.js'
51
+ })
52
+ .on('ready', function (generator) {
53
+ var js = "var myAlgo = function () { return { method: function () {} }; };";
54
+ fs.writeFileSync(path.join(__dirname, './temp/myAlgo.js'), js);
55
+ })
56
+ .on('end', function () {
57
+ var expected = expectedFiles.concat([
58
+ 'spec/myAlgo.js',
59
+ 'myAlgo.js'
60
+ ]);
61
+ assert.file(expected);
62
+ assert.fileContent('myAlgo.js', /myAlgo/);
63
+ assert.noFileContent('./spec/myAlgo.js', /require/);
64
+ assert.fileContent('bower.json', /chai/);
65
+ // doesn't work as expected; figure out a better way to do this.
66
+ // eval(fs.readFileSync(path.join(__dirname, './temp/myAlgo.js'), 'utf8'));
67
+ // assert.implement(myAlgo(), ['method']);
68
+ done();
69
+ });
70
+ });
71
+
72
+ });
pool/shard005/JavaScript/0032567_ajaxLog.js ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ *
3
+ * @authors Leonard LEPADATU (lepadatu.leonard-ext@groupehn.com)
4
+ * @date 2015-05-08 14:24:24
5
+ * @version $Id$
6
+ */
7
+
8
+ function ajaxLog(data) {
9
+
10
+ if (window.XMLHttpRequest) { // Mozilla, Safari, ...
11
+
12
+ httpRequest = new XMLHttpRequest();
13
+
14
+ } else if (window.ActiveXObject) { // IE
15
+
16
+ try {
17
+ httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
18
+ }
19
+ catch (e) {
20
+
21
+ try {
22
+ httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
23
+ }
24
+ catch (e) {}
25
+
26
+ }
27
+
28
+ }
29
+
30
+ if (!httpRequest) {
31
+ console.log('Cannot create an XMLHTTP instance');
32
+ return false;
33
+ }
34
+
35
+ httpRequest.onreadystatechange = console.log("ready for log...");
36
+ httpRequest.open('POST', "../log/log.php");
37
+ httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
38
+ httpRequest.send('adblock=' + encodeURIComponent(data));
39
+ }
pool/shard005/JavaScript/0032569_Entry.js ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ *
3
+ * Licensed to the Apache Software Foundation (ASF) under one
4
+ * or more contributor license agreements. See the NOTICE file
5
+ * distributed with this work for additional information
6
+ * regarding copyright ownership. The ASF licenses this file
7
+ * to you under the Apache License, Version 2.0 (the
8
+ * "License"); you may not use this file except in compliance
9
+ * with the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing,
14
+ * software distributed under the License is distributed on an
15
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ * KIND, either express or implied. See the License for the
17
+ * specific language governing permissions and limitations
18
+ * under the License.
19
+ *
20
+ */
21
+
22
+ var argscheck = require('cordova/argscheck'),
23
+ exec = require('cordova/exec'),
24
+ FileError = require('./FileError'),
25
+ Metadata = require('./Metadata');
26
+
27
+ /**
28
+ * Represents a file or directory on the local file system.
29
+ *
30
+ * @param isFile
31
+ * {boolean} true if Entry is a file (readonly)
32
+ * @param isDirectory
33
+ * {boolean} true if Entry is a directory (readonly)
34
+ * @param name
35
+ * {DOMString} name of the file or directory, excluding the path
36
+ * leading to it (readonly)
37
+ * @param fullPath
38
+ * {DOMString} the absolute full path to the file or directory
39
+ * (readonly)
40
+ * @param fileSystem
41
+ * {FileSystem} the filesystem on which this entry resides
42
+ * (readonly)
43
+ * @param nativeURL
44
+ * {DOMString} an alternate URL which can be used by native
45
+ * webview controls, for example media players.
46
+ * (optional, readonly)
47
+ */
48
+ function Entry(isFile, isDirectory, name, fullPath, fileSystem, nativeURL) {
49
+ this.isFile = !!isFile;
50
+ this.isDirectory = !!isDirectory;
51
+ this.name = name || '';
52
+ this.fullPath = fullPath || '';
53
+ this.filesystem = fileSystem || null;
54
+ this.nativeURL = nativeURL || null;
55
+ }
56
+
57
+ /**
58
+ * Look up the metadata of the entry.
59
+ *
60
+ * @param successCallback
61
+ * {Function} is called with a Metadata object
62
+ * @param errorCallback
63
+ * {Function} is called with a FileError
64
+ */
65
+ Entry.prototype.getMetadata = function(successCallback, errorCallback) {
66
+ argscheck.checkArgs('FF', 'Entry.getMetadata', arguments);
67
+ var success = successCallback && function(entryMetadata) {
68
+ var metadata = new Metadata({
69
+ size: entryMetadata.size,
70
+ modificationTime: entryMetadata.lastModifiedDate
71
+ });
72
+ successCallback(metadata);
73
+ };
74
+ var fail = errorCallback && function(code) {
75
+ errorCallback(new FileError(code));
76
+ };
77
+ exec(success, fail, "File", "getFileMetadata", [this.toInternalURL()]);
78
+ };
79
+
80
+ /**
81
+ * Set the metadata of the entry.
82
+ *
83
+ * @param successCallback
84
+ * {Function} is called with a Metadata object
85
+ * @param errorCallback
86
+ * {Function} is called with a FileError
87
+ * @param metadataObject
88
+ * {Object} keys and values to set
89
+ */
90
+ Entry.prototype.setMetadata = function(successCallback, errorCallback, metadataObject) {
91
+ argscheck.checkArgs('FFO', 'Entry.setMetadata', arguments);
92
+ exec(successCallback, errorCallback, "File", "setMetadata", [this.toInternalURL(), metadataObject]);
93
+ };
94
+
95
+ /**
96
+ * Move a file or directory to a new location.
97
+ *
98
+ * @param parent
99
+ * {DirectoryEntry} the directory to which to move this entry
100
+ * @param newName
101
+ * {DOMString} new name of the entry, defaults to the current name
102
+ * @param successCallback
103
+ * {Function} called with the new DirectoryEntry object
104
+ * @param errorCallback
105
+ * {Function} called with a FileError
106
+ */
107
+ Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallback) {
108
+ argscheck.checkArgs('oSFF', 'Entry.moveTo', arguments);
109
+ var fail = errorCallback && function(code) {
110
+ errorCallback(new FileError(code));
111
+ };
112
+ var srcURL = this.toInternalURL(),
113
+ // entry name
114
+ name = newName || this.name,
115
+ success = function(entry) {
116
+ if (entry) {
117
+ if (successCallback) {
118
+ // create appropriate Entry object
119
+ var newFSName = entry.filesystemName || (entry.filesystem && entry.filesystem.name);
120
+ var fs = newFSName ? new FileSystem(newFSName, { name: "", fullPath: "/" }) : new FileSystem(parent.filesystem.name, { name: "", fullPath: "/" });
121
+ var result = (entry.isDirectory) ? new (require('./DirectoryEntry'))(entry.name, entry.fullPath, fs, entry.nativeURL) : new (require('cordova-plugin-file.FileEntry'))(entry.name, entry.fullPath, fs, entry.nativeURL);
122
+ successCallback(result);
123
+ }
124
+ }
125
+ else {
126
+ // no Entry object returned
127
+ if (fail) {
128
+ fail(FileError.NOT_FOUND_ERR);
129
+ }
130
+ }
131
+ };
132
+
133
+ // copy
134
+ exec(success, fail, "File", "moveTo", [srcURL, parent.toInternalURL(), name]);
135
+ };
136
+
137
+ /**
138
+ * Copy a directory to a different location.
139
+ *
140
+ * @param parent
141
+ * {DirectoryEntry} the directory to which to copy the entry
142
+ * @param newName
143
+ * {DOMString} new name of the entry, defaults to the current name
144
+ * @param successCallback
145
+ * {Function} called with the new Entry object
146
+ * @param errorCallback
147
+ * {Function} called with a FileError
148
+ */
149
+ Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallback) {
150
+ argscheck.checkArgs('oSFF', 'Entry.copyTo', arguments);
151
+ var fail = errorCallback && function(code) {
152
+ errorCallback(new FileError(code));
153
+ };
154
+ var srcURL = this.toInternalURL(),
155
+ // entry name
156
+ name = newName || this.name,
157
+ // success callback
158
+ success = function(entry) {
159
+ if (entry) {
160
+ if (successCallback) {
161
+ // create appropriate Entry object
162
+ var newFSName = entry.filesystemName || (entry.filesystem && entry.filesystem.name);
163
+ var fs = newFSName ? new FileSystem(newFSName, { name: "", fullPath: "/" }) : new FileSystem(parent.filesystem.name, { name: "", fullPath: "/" });
164
+ var result = (entry.isDirectory) ? new (require('./DirectoryEntry'))(entry.name, entry.fullPath, fs, entry.nativeURL) : new (require('cordova-plugin-file.FileEntry'))(entry.name, entry.fullPath, fs, entry.nativeURL);
165
+ successCallback(result);
166
+ }
167
+ }
168
+ else {
169
+ // no Entry object returned
170
+ if (fail) {
171
+ fail(FileError.NOT_FOUND_ERR);
172
+ }
173
+ }
174
+ };
175
+
176
+ // copy
177
+ exec(success, fail, "File", "copyTo", [srcURL, parent.toInternalURL(), name]);
178
+ };
179
+
180
+ /**
181
+ * Return a URL that can be passed across the bridge to identify this entry.
182
+ */
183
+ Entry.prototype.toInternalURL = function() {
184
+ if (this.filesystem && this.filesystem.__format__) {
185
+ return this.filesystem.__format__(this.fullPath, this.nativeURL);
186
+ }
187
+ };
188
+
189
+ /**
190
+ * Return a URL that can be used to identify this entry.
191
+ * Use a URL that can be used to as the src attribute of a <video> or
192
+ * <audio> tag. If that is not possible, construct a cdvfile:// URL.
193
+ */
194
+ Entry.prototype.toURL = function() {
195
+ if (this.nativeURL) {
196
+ return this.nativeURL;
197
+ }
198
+ // fullPath attribute may contain the full URL in the case that
199
+ // toInternalURL fails.
200
+ return this.toInternalURL() || "file://localhost" + this.fullPath;
201
+ };
202
+
203
+ /**
204
+ * Backwards-compatibility: In v1.0.0 - 1.0.2, .toURL would only return a
205
+ * cdvfile:// URL, and this method was necessary to obtain URLs usable by the
206
+ * webview.
207
+ * See CB-6051, CB-6106, CB-6117, CB-6152, CB-6199, CB-6201, CB-6243, CB-6249,
208
+ * and CB-6300.
209
+ */
210
+ Entry.prototype.toNativeURL = function() {
211
+ console.log("DEPRECATED: Update your code to use 'toURL'");
212
+ return this.toURL();
213
+ };
214
+
215
+ /**
216
+ * Returns a URI that can be used to identify this entry.
217
+ *
218
+ * @param {DOMString} mimeType for a FileEntry, the mime type to be used to interpret the file, when loaded through this URI.
219
+ * @return uri
220
+ */
221
+ Entry.prototype.toURI = function(mimeType) {
222
+ console.log("DEPRECATED: Update your code to use 'toURL'");
223
+ return this.toURL();
224
+ };
225
+
226
+ /**
227
+ * Remove a file or directory. It is an error to attempt to delete a
228
+ * directory that is not empty. It is an error to attempt to delete a
229
+ * root directory of a file system.
230
+ *
231
+ * @param successCallback {Function} called with no parameters
232
+ * @param errorCallback {Function} called with a FileError
233
+ */
234
+ Entry.prototype.remove = function(successCallback, errorCallback) {
235
+ argscheck.checkArgs('FF', 'Entry.remove', arguments);
236
+ var fail = errorCallback && function(code) {
237
+ errorCallback(new FileError(code));
238
+ };
239
+ exec(successCallback, fail, "File", "remove", [this.toInternalURL()]);
240
+ };
241
+
242
+ /**
243
+ * Look up the parent DirectoryEntry of this entry.
244
+ *
245
+ * @param successCallback {Function} called with the parent DirectoryEntry object
246
+ * @param errorCallback {Function} called with a FileError
247
+ */
248
+ Entry.prototype.getParent = function(successCallback, errorCallback) {
249
+ argscheck.checkArgs('FF', 'Entry.getParent', arguments);
250
+ var fs = this.filesystem;
251
+ var win = successCallback && function(result) {
252
+ var DirectoryEntry = require('./DirectoryEntry');
253
+ var entry = new DirectoryEntry(result.name, result.fullPath, fs, result.nativeURL);
254
+ successCallback(entry);
255
+ };
256
+ var fail = errorCallback && function(code) {
257
+ errorCallback(new FileError(code));
258
+ };
259
+ exec(win, fail, "File", "getParent", [this.toInternalURL()]);
260
+ };
261
+
262
+ module.exports = Entry;
pool/shard005/JavaScript/0032570_IceFailedHandling.js ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { getLogger } from '@jitsi/logger';
2
+
3
+ import * as JitsiConferenceErrors from '../../JitsiConferenceErrors';
4
+ import * as JitsiConferenceEvents from '../../JitsiConferenceEvents';
5
+
6
+ const logger = getLogger(__filename);
7
+
8
+ /**
9
+ * This class deals with shenanigans around JVB media session's ICE failed status handling.
10
+ *
11
+ * If ICE restarts are NOT explicitly enabled by the {@code enableIceRestart} config option, then the conference will
12
+ * delay emitting the {@JitsiConferenceErrors.ICE_FAILED} event by 15 seconds. If the network info module reports
13
+ * the internet offline status then the time will start counting after the internet comes back online.
14
+ *
15
+ * If ICE restart are enabled, then a delayed ICE failed notification to Jicofo will be sent, only if the ICE connection
16
+ * does not recover soon after or before the XMPP connection is restored (if it was ever broken). If ICE fails while
17
+ * the XMPP connection is not broken then the notifications will be sent after 2 seconds delay.
18
+ */
19
+ export default class IceFailedHandling {
20
+ /**
21
+ * Creates new {@code DelayedIceFailed} task.
22
+ * @param {JitsiConference} conference
23
+ */
24
+ constructor(conference) {
25
+ this._conference = conference;
26
+ }
27
+
28
+ /**
29
+ * After making sure there's no way for the ICE connection to recover this method either sends ICE failed
30
+ * notification to Jicofo or emits the ice failed conference event.
31
+ * @private
32
+ * @returns {void}
33
+ */
34
+ _actOnIceFailed() {
35
+ if (!this._conference.room) {
36
+ return;
37
+ }
38
+
39
+ const { enableForcedReload, enableIceRestart } = this._conference.options.config;
40
+ const explicitlyDisabled = typeof enableIceRestart !== 'undefined' && !enableIceRestart;
41
+ const supportsRestartByTerminate = this._conference.room.supportsRestartByTerminate();
42
+ const useTerminateForRestart = supportsRestartByTerminate && !enableIceRestart;
43
+
44
+ logger.info('ICE failed,'
45
+ + ` enableForcedReload: ${enableForcedReload},`
46
+ + ` enableIceRestart: ${enableIceRestart},`
47
+ + ` supports restart by terminate: ${supportsRestartByTerminate}`);
48
+
49
+ if (explicitlyDisabled || (!enableIceRestart && !supportsRestartByTerminate) || enableForcedReload) {
50
+ logger.info('ICE failed, but ICE restarts are disabled');
51
+ const reason = enableForcedReload
52
+ ? JitsiConferenceErrors.CONFERENCE_RESTARTED
53
+ : JitsiConferenceErrors.ICE_FAILED;
54
+
55
+ this._conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, reason);
56
+
57
+ return;
58
+ }
59
+
60
+ const jvbConnection = this._conference.jvbJingleSession;
61
+ const jvbConnIceState = jvbConnection && jvbConnection.getIceConnectionState();
62
+
63
+ if (!jvbConnection) {
64
+ logger.warn('Not sending ICE failed - no JVB connection');
65
+ } else if (jvbConnIceState === 'connected') {
66
+ logger.info('ICE connection restored - not sending ICE failed');
67
+ } else {
68
+ logger.info('Sending ICE failed - the connection did not recover, '
69
+ + `ICE state: ${jvbConnIceState}, `
70
+ + `use 'session-terminate': ${useTerminateForRestart}`);
71
+ if (useTerminateForRestart) {
72
+ this._conference.jvbJingleSession.terminate(
73
+ () => {
74
+ logger.info('session-terminate for ice restart - done');
75
+ },
76
+ error => {
77
+ logger.error(`session-terminate for ice restart - error: ${error.message}`);
78
+ }, {
79
+ reason: 'connectivity-error',
80
+ reasonDescription: 'ICE FAILED',
81
+ requestRestart: true,
82
+ sendSessionTerminate: true
83
+ });
84
+ } else {
85
+ this._conference.jvbJingleSession.sendIceFailedNotification();
86
+ }
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Starts the task.
92
+ */
93
+ start() {
94
+ // Using xmpp.ping allows to handle both XMPP being disconnected and internet offline cases. The ping function
95
+ // uses sendIQ2 method which is resilient to XMPP connection disconnected state and will patiently wait until it
96
+ // gets reconnected.
97
+ // This also handles the case about waiting for the internet to come back online, because ping
98
+ // will only succeed when the internet is online and then there's a chance for the ICE to recover from FAILED to
99
+ // CONNECTED which is the extra 2 second timeout after ping.
100
+ // The 65 second timeout is given on purpose as there's no chance for XMPP to recover after 65 seconds of no
101
+ // communication with the server. Such resume attempt will result in unrecoverable conference failed event due
102
+ // to 'item-not-found' error returned by the server.
103
+ this._conference.xmpp.ping(65000).then(
104
+ () => {
105
+ if (!this._canceled) {
106
+ this._iceFailedTimeout = window.setTimeout(() => {
107
+ this._iceFailedTimeout = undefined;
108
+ this._actOnIceFailed();
109
+ }, 2000);
110
+ }
111
+ },
112
+ error => {
113
+ logger.error('PING error/timeout - not sending ICE failed', error);
114
+ });
115
+ }
116
+
117
+ /**
118
+ * Cancels the task.
119
+ */
120
+ cancel() {
121
+ this._canceled = true;
122
+ window.clearTimeout(this._iceFailedTimeout);
123
+ }
124
+ }
pool/shard005/JavaScript/0032576_printer.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var BrotherPrinter = function () {}
2
+ BrotherPrinter.prototype = {
3
+ findNetworkPrinters: function (callback, scope) {
4
+ var callbackFn = function () {
5
+ var args = typeof arguments[0] == 'boolean' ? arguments : arguments[0]
6
+ callback.apply(scope || window, args)
7
+ }
8
+ cordova.exec(callbackFn, null, 'BrotherPrinter', 'findNetworkPrinters', [])
9
+ },
10
+ printViaSDK: function (data, callback) {
11
+ if (!data || !data.length) {
12
+ console.log('No data passed in. Expects a bitmap.')
13
+ return
14
+ }
15
+ cordova.exec(callback, function(err){console.log('error: '+err)}, 'BrotherPrinter', 'printViaSDK', [data])
16
+ },
17
+ sendUSBConfig: function (data, callback) {
18
+ if (!data || !data.length) {
19
+ console.log('No data passed in. Expects print payload string.')
20
+ return
21
+ }
22
+ cordova.exec(callback, function(err){console.log('error: '+err)}, 'BrotherPrinter', 'sendUSBConfig', [data])
23
+ }
24
+ }
25
+ var plugin = new BrotherPrinter()
26
+ module.exports = plugin
pool/shard005/JavaScript/0032577_logger.js ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import config from './config';
2
+ import Utils from './utils';
3
+
4
+ export default class Logger {
5
+
6
+ /**
7
+ * Logs the current instruction and state of registers
8
+ * @param cpu
9
+ * @param fn
10
+ * @param paramLength
11
+ * @param param
12
+ */
13
+ static state(cpu, fn, paramLength, param){
14
+ if (config.DEBUG) {
15
+ console.info(`[${Utils.hex4(cpu.pc() - paramLength - 1)}] ${Utils.str20(fn.name + ' ' + Utils.hexStr(param))} 0b${cpu.Z()}${cpu.N()}${cpu.H()}${cpu.C()} a:${Utils.hex2(cpu.a())} bc:${Utils.hex4(cpu.bc())} de:${Utils.hex4(cpu.de())} hl:${Utils.hex4(cpu.hl())} sp:${Utils.hex4(cpu.sp())} pc:${Utils.hex4(cpu.pc())} if:${Utils.hex2(cpu.If())} ie:${Utils.hex2(cpu.ie())} ly:${Utils.hex2(cpu.mmu.ly())} lcdc:${Utils.hex2(cpu.lcdc())} stat:${Utils.hex2(cpu.stat())}`);
16
+ }
17
+ }
18
+
19
+ static beforeCrash(cpu, instructionFn, paramLength, param){
20
+ config.DEBUG = true;
21
+ Logger.state(cpu, instructionFn, paramLength, param);
22
+ config.DEBUG = false;
23
+ }
24
+
25
+ static warn(msg){
26
+ if (!config.TEST) {
27
+ console.warn(`${msg}`);
28
+ }
29
+ }
30
+
31
+ static info(msg){
32
+ if (config.DEBUG && !config.TEST) {
33
+ console.info(`${msg}`);
34
+ }
35
+ }
36
+
37
+ static error(msg){
38
+ if (!config.TEST) {
39
+ console.error(`${msg}`);
40
+ }
41
+ }
42
+ }
pool/shard005/JavaScript/0032580_Screen4.js ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, { Component, PropTypes } from 'react';
2
+ import {
3
+ View,
4
+ StyleSheet,
5
+ TouchableOpacity,
6
+ Text,
7
+ Dimensions,
8
+ } from 'react-native';
9
+ import { NavigationActions } from 'react-navigation';
10
+
11
+ const styles = StyleSheet.create({
12
+ container: {
13
+ flex: 1,
14
+ flexDirection: 'column',
15
+ justifyContent: 'center',
16
+ alignItems: 'center',
17
+ backgroundColor: 'lightgreen',
18
+ },
19
+ text: {
20
+ fontWeight: '100',
21
+ fontSize: 40,
22
+ textAlign: 'center',
23
+ paddingVertical: 100,
24
+ },
25
+ button: {
26
+ justifyContent: 'center',
27
+ alignItems: 'center',
28
+ width: Dimensions.get('window').width,
29
+ height: 50,
30
+ marginVertical: 5,
31
+ backgroundColor: 'grey',
32
+ },
33
+ buttonText: {
34
+ fontWeight: '100',
35
+ fontSize: 20,
36
+ textAlign: 'center',
37
+ color: 'white',
38
+ },
39
+ });
40
+
41
+
42
+ class Screen4 extends Component {
43
+
44
+ back() {
45
+ // this.props.dispatch in the main function that literally activates/runs the action you give it
46
+ // In this case we are going back one page
47
+ this.props.navigation.dispatch(NavigationActions.back());
48
+ }
49
+
50
+ // This navigates back to the initial page
51
+ top() {
52
+ // Same dispatch function from before
53
+ this.props.navigation.dispatch(
54
+ // in this case were running the action "reset"
55
+ NavigationActions.reset({
56
+ // this is the index of the page we want to go to
57
+ // it can be anything but in this case we want to go to the start
58
+ index: 0,
59
+ // this is what action we want to do
60
+ // we are navigating to the first page but we have to do this
61
+ // inside the reset function or else it would add the page to the
62
+ // navigator stack instead of going back to the first one
63
+ // idk what else you can do in here but ik this works
64
+ actions: [
65
+ // routeName has to be the ReferenceName of the page you are going to
66
+ NavigationActions.navigate({ routeName: 'Home' }),
67
+ ],
68
+ }),
69
+ );
70
+ }
71
+
72
+ render() {
73
+ const { params } = this.props.navigation.state;
74
+ return (
75
+ <View style={styles.container}>
76
+ <Text>{params.teamName}</Text>
77
+ <Text style={styles.text}>This is Screen 4</Text>
78
+ <TouchableOpacity style={styles.button} onPress={() => this.back()}>
79
+ <Text style={styles.buttonText}>Go Back</Text>
80
+ </TouchableOpacity>
81
+ <TouchableOpacity style={styles.button} onPress={() => this.top()}>
82
+ <Text style={styles.buttonText}>Go Home</Text>
83
+ </TouchableOpacity>
84
+ </View>
85
+ );
86
+ }
87
+ }
88
+
89
+ // This is the title that appears on the top
90
+ // it has to be the same name as your class
91
+ // {CLASSNAME}.navigationOptions = {}
92
+ Screen4.navigationOptions = {
93
+ title: 'Screen 4',
94
+ };
95
+
96
+ Screen4.propTypes = {
97
+ navigation: PropTypes.object.isRequired,
98
+ };
99
+
100
+ export default Screen4;
pool/shard005/JavaScript/0032584_test.js ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ var argv = require('yargs').argv;
4
+ var gulp = require('gulp');
5
+ var karma = require('karma').server;
6
+ var mkdirp = require('mkdirp');
7
+ var path = require('path');
8
+ var runSequence = require('run-sequence');
9
+
10
+ var rootDir = path.join(__dirname, '..');
11
+
12
+ var distFolder = path.join(rootDir, 'dist');
13
+ var editorDistFolder = path.join(distFolder, 'alloy-editor');
14
+
15
+ var coreSrcFiles = require('../test/core/_src.js');
16
+ var pluginsSrcFiles = require('../test/plugins/_src.js');
17
+
18
+ gulp.task('copy-files', function() {
19
+ var files = coreSrcFiles.concat(pluginsSrcFiles);
20
+
21
+ return gulp.src(files, {cwd: 'src', base: 'src'})
22
+ .pipe(gulp.dest(path.join(editorDistFolder, 'test')));
23
+ });
24
+
25
+ gulp.task('create-output-dir', function(callback) {
26
+ mkdirp(editorDistFolder, callback);
27
+ });
28
+
29
+ gulp.task('prepare-files', function(done) {
30
+ runSequence(
31
+ 'clean-dist', 'create-output-dir', [
32
+ 'copy-ckeditor', 'copy-files'
33
+ ], done);
34
+ });
35
+
36
+ gulp.task('test:core', ['prepare-files'], function (done) {
37
+ karma.start({
38
+ configFile: path.join(__dirname, '../test/core/karma.js'),
39
+ singleRun: (argv.debug || argv.d) ? false : true
40
+ }, done);
41
+ });
42
+
43
+ gulp.task('test:plugins', ['prepare-files'], function (done) {
44
+ karma.start({
45
+ configFile: path.join(__dirname, '../test/plugins/karma.js'),
46
+ singleRun: (argv.debug || argv.d) ? false : true
47
+ }, done);
48
+ });
pool/shard005/JavaScript/0032585_test.js ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var test = require('tape'),
2
+ point = require('turf-helpers').point,
3
+ multipoint = require('turf-helpers').multiPoint,
4
+ linestring = require('turf-helpers').lineString,
5
+ multilinestring = require('turf-helpers').multiLineString,
6
+ polygon = require('turf-helpers').polygon,
7
+ multipolygon = require('turf-helpers').multiPolygon,
8
+ featurecollection = require('turf-helpers').featureCollection;
9
+
10
+ var combine = require('./')
11
+
12
+ test('combine -- points', function(t) {
13
+ // MultiPoint
14
+ var pt1 = point([50, 51])
15
+ var pt2 = point([100, 101])
16
+
17
+ var multiPt = combine(featurecollection([pt1, pt2]))
18
+
19
+ t.ok(multiPt, 'should combine two Points into a MultiPoint')
20
+ t.deepEqual(multiPt.features[0].geometry.coordinates, [[50, 51], [100, 101]])
21
+ t.end();
22
+ });
23
+
24
+ test('combine -- mixed multipoint & point', function(t) {
25
+ // MultiPoint
26
+ var pt1 = point([50, 51])
27
+ var pt2 = multipoint([[100, 101], [101, 102]])
28
+
29
+ var multiPt = combine(featurecollection([pt1, pt2]))
30
+
31
+ t.ok(multiPt, 'should combine Points + MultiPoint into a MultiPoint')
32
+ t.deepEqual(multiPt.features[0].geometry.coordinates, [[50, 51], [100, 101], [101, 102]])
33
+ t.end();
34
+ });
35
+
36
+ test('combine -- linestrings', function(t) {
37
+ // MultiLineString
38
+ var l1 = linestring([
39
+ [102.0,
40
+ -10.0],
41
+ [130.0,
42
+ 4.0]])
43
+ var l2 = linestring([
44
+ [40.0,
45
+ -20.0],
46
+ [150.0,
47
+ 18.0]])
48
+
49
+ var multiLine = combine(featurecollection([l1, l2]))
50
+
51
+ t.ok(multiLine, 'should combine two LineStrings into a MultiLineString')
52
+ t.equal(multiLine.features[0].geometry.type, 'MultiLineString')
53
+ t.deepEqual(multiLine.features[0].geometry.coordinates, [[[102, -10], [130, 4]], [[40, -20], [150, 18]]])
54
+ t.end();
55
+ });
56
+
57
+ test('combine -- mixed multilinestring & linestring', function(t) {
58
+ // MultiLineString
59
+ var l1 = linestring([
60
+ [102.0, -10.0],
61
+ [130.0, 4.0]
62
+ ]);
63
+ var l2 = multilinestring([
64
+ [
65
+ [40.0, -20.0],
66
+ [150.0, 18.0]
67
+ ],
68
+ [
69
+ [50, -10],
70
+ [160, 28]
71
+ ]
72
+ ]);
73
+
74
+ var multiLine = combine(featurecollection([l1, l2]))
75
+
76
+ t.ok(multiLine, 'should combine LineString + MultiLineString into a MultiLineString')
77
+ t.equal(multiLine.features[0].geometry.type, 'MultiLineString')
78
+ t.deepEqual(multiLine.features[0].geometry.coordinates, [[[102, -10], [130, 4]], [[40, -20], [150, 18]], [[50, -10], [160, 28]]])
79
+ t.end();
80
+ });
81
+
82
+ test('combine -- polygons', function(t) {
83
+ // MultiPolygon
84
+ var p1 = polygon( [
85
+ [
86
+ [20.0,0.0],
87
+ [101.0,0.0],
88
+ [101.0,1.0],
89
+ [100.0,1.0],
90
+ [100.0,0.0],
91
+ [20.0,0.0]
92
+ ]
93
+ ])
94
+ var p2 = polygon([
95
+ [
96
+ [30.0,0.0],
97
+ [102.0,0.0],
98
+ [103.0,1.0],
99
+ [30.0,0.0]
100
+ ]
101
+ ])
102
+ var multiPoly = combine(featurecollection([p1, p2]))
103
+
104
+ t.ok(multiPoly, 'should combine two Polygons into a MultiPolygon')
105
+ t.equal(multiPoly.features[0].geometry.type, 'MultiPolygon')
106
+ t.deepEqual(multiPoly.features[0].geometry.coordinates,
107
+ [[[[20,0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0],[20,0]]],
108
+ [[[30.0,0.0],[102.0,0.0],[103.0,1.0],[30.0,0.0]]]])
109
+
110
+ t.end()
111
+ });
112
+
113
+ test('combine -- polygons', function(t) {
114
+ // MultiPolygon
115
+ var p1 = polygon( [
116
+ [
117
+ [20.0,0.0],
118
+ [101.0,0.0],
119
+ [101.0,1.0],
120
+ [100.0,1.0],
121
+ [100.0,0.0],
122
+ [20.0,0.0]
123
+ ]
124
+ ]);
125
+ var p2 = multipolygon([
126
+ [[
127
+ [30.0,0.0],
128
+ [102.0,0.0],
129
+ [103.0,1.0],
130
+ [30.0,0.0]
131
+ ]],
132
+ [
133
+ [
134
+ [20.0,5.0],
135
+ [92.0,5.0],
136
+ [93.0,6.0],
137
+ [20.0,5.0]
138
+ ],
139
+ [
140
+ [25, 5],
141
+ [30, 5],
142
+ [30, 5.5],
143
+ [25, 5]
144
+ ]
145
+ ]
146
+ ]);
147
+ var multiPoly = combine(featurecollection([p1, p2]))
148
+
149
+ t.ok(multiPoly, 'should combine two Polygon + MultiPolygon into a MultiPolygon')
150
+ t.equal(multiPoly.features[0].geometry.type, 'MultiPolygon')
151
+ t.deepEqual(multiPoly.features[0].geometry.coordinates,
152
+ [[[[20,0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0],[20,0]]],
153
+ [[[30.0,0.0],[102.0,0.0],[103.0,1.0],[30.0,0.0]]],
154
+ [[[20.0,5.0],[92.0,5.0],[93.0,6.0],[20.0,5.0]],
155
+ [[25, 5],[30, 5],[30, 5.5],[25, 5]]]
156
+ ])
157
+
158
+ t.end()
159
+ });
160
+
161
+ test('combine -- heterogenous', function(t) {
162
+ // MultiPolygon
163
+ var p1 = polygon( [
164
+ [
165
+ [20.0,0.0],
166
+ [101.0,0.0],
167
+ [101.0,1.0],
168
+ [100.0,1.0],
169
+ [100.0,0.0],
170
+ [20.0,0.0]
171
+ ]
172
+ ]);
173
+ var p2 = multipolygon([
174
+ [[
175
+ [30.0,0.0],
176
+ [102.0,0.0],
177
+ [103.0,1.0],
178
+ [30.0,0.0]
179
+ ]],
180
+ [
181
+ [
182
+ [20.0,5.0],
183
+ [92.0,5.0],
184
+ [93.0,6.0],
185
+ [20.0,5.0]
186
+ ],
187
+ [
188
+ [25, 5],
189
+ [30, 5],
190
+ [30, 5.5],
191
+ [25, 5]
192
+ ]
193
+ ]
194
+ ]);
195
+ var pt1 = point([50, 51])
196
+ var multiPoly = combine(featurecollection([p1, p2, pt1]))
197
+
198
+ t.ok(multiPoly, 'should combine two Polygon + MultiPolygon into a MultiPolygon')
199
+ t.equal(multiPoly.features[0].geometry.type, 'MultiPoint')
200
+
201
+ t.equal(multiPoly.features[1].geometry.type, 'MultiPolygon')
202
+ t.deepEqual(multiPoly.features[1].geometry.coordinates,
203
+ [[[[20,0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0],[20,0]]],
204
+ [[[30.0,0.0],[102.0,0.0],[103.0,1.0],[30.0,0.0]]],
205
+ [[[20.0,5.0],[92.0,5.0],[93.0,6.0],[20.0,5.0]],
206
+ [[25, 5],[30, 5],[30, 5.5],[25, 5]]]
207
+ ])
208
+
209
+ t.end()
210
+ });
pool/shard005/JavaScript/0032587_main.js ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function fib() {
2
+ var now = 0;
3
+ var one = 0;
4
+ var two = 0;
5
+ var count = 0;
6
+ function nacci() {
7
+ if (count == 0){
8
+ now = one + two;
9
+ } else if (count == 1) {
10
+ one++;
11
+ now = one + two;
12
+ } else if (count == 2) {
13
+ now = one + two;
14
+ two = now;
15
+ } else {
16
+ one = two;
17
+ two = now;
18
+ now = one + two;
19
+ }
20
+ console.log(now);
21
+ count++;
22
+ }
23
+ return nacci
24
+ }
25
+ var fibCounter = fib();
26
+ fibCounter();
27
+ fibCounter();
28
+ fibCounter();
29
+ fibCounter();
30
+ fibCounter();
31
+ fibCounter();
32
+ fibCounter();
33
+ fibCounter();
34
+ fibCounter();
35
+ fibCounter();
36
+ fibCounter();
pool/shard005/JavaScript/0032589_auth-form-header.js ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * @jest-environment jsdom
3
+ */
4
+
5
+ import { shallow } from 'enzyme';
6
+ import FormattedHeader from 'calypso/components/formatted-header';
7
+ import { AuthFormHeader } from '../auth-form-header';
8
+ import wooDnaConfig from '../woo-dna-config';
9
+
10
+ const CLIENT_ID = 98765;
11
+ const SITE_SLUG = 'an.example.site';
12
+ const DEFAULT_PROPS = {
13
+ authQuery: {
14
+ authApproved: false,
15
+ blogname: 'Example Blog',
16
+ clientId: CLIENT_ID,
17
+ from: 'banner-44-slide-1-dashboard',
18
+ homeUrl: `http://${ SITE_SLUG }`,
19
+ jpVersion: '5.4',
20
+ nonce: 'fooBarNonce',
21
+ redirectAfterAuth: `http://${ SITE_SLUG }/wp-admin/admin.php?page=jetpack`,
22
+ redirectUri: `http://${ SITE_SLUG }/wp-admin/admin.php?page=jetpack&action=authorize&_wpnonce=fooBarNonce&redirect=http%3A%2F%2F${ SITE_SLUG }%2Fwp-admin%2Fadmin.php%3Fpage%3Djetpack`,
23
+ scope: 'administrator:fooBarBaz',
24
+ secret: 'fooBarSecret',
25
+ site: `http://${ SITE_SLUG }`,
26
+ siteIcon: '',
27
+ siteUrl: `http://${ SITE_SLUG }`,
28
+ state: '1',
29
+ userEmail: `email@${ SITE_SLUG }`,
30
+ },
31
+ translate: ( string ) => string,
32
+ };
33
+
34
+ describe( 'AuthFormHeader', () => {
35
+ test( 'renders as expected', () => {
36
+ const wrapper = shallow( <AuthFormHeader { ...DEFAULT_PROPS } /> );
37
+
38
+ expect( wrapper ).toMatchSnapshot();
39
+ } );
40
+
41
+ test( 'should render WC Payments specific sub header copy', () => {
42
+ const authQuery = {
43
+ ...DEFAULT_PROPS.authQuery,
44
+ from: 'woocommerce-payments',
45
+ woodna_service_name: 'WooCommerce Payments',
46
+ };
47
+ const props = {
48
+ ...DEFAULT_PROPS,
49
+ authQuery,
50
+ wooDnaConfig: wooDnaConfig( authQuery ),
51
+ };
52
+
53
+ // Notice we have \xa0. This is needed when we compare translated text.
54
+ // Please refer to https://stackoverflow.com/questions/54242039/intl-numberformat-space-character-does-not-match
55
+ const expectedText =
56
+ 'Approve your connection. Your account will enable you to start using the features and benefits offered by WooCommerce\xa0Payments';
57
+ const wrapper = shallow( <AuthFormHeader { ...props } /> )
58
+ .find( FormattedHeader )
59
+ .render();
60
+
61
+ expect( wrapper.find( '.formatted-header__subtitle' ).text() ).toEqual( expectedText );
62
+ } );
63
+ } );
pool/shard005/JavaScript/0032590_notecard.controller.js ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _btMongodb = require('bt-mongodb');
8
+
9
+ var _btMongodb2 = _interopRequireDefault(_btMongodb);
10
+
11
+ var _activity = require('./activity.controller');
12
+
13
+ var _activity2 = _interopRequireDefault(_activity);
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+
17
+ var CONTACT_ADMIN = 'there was an error, please contact an admin';
18
+ var BODY_EMPTY = 'The body was empty';
19
+ var NO_OBJECT_ID = 'There was no id in the request';
20
+ var NOT_EXISTED_BEFORE = 'Couldn\'t match id to an actual object';
21
+ var NOT_OWNER = 'you are not the owner of that object';
22
+
23
+ /**
24
+ * @api {get} notecard GET owned Notecards
25
+ * @apiName GetAllNotecards
26
+ * @apiGroup notecard
27
+ * @apiDescription Collects all the notecards of which the authorizated profile
28
+ * has access to and returns them in a json response.
29
+ *
30
+ * @apiHeader {String} Authorization Bearer JWT Token
31
+ * @apiPermission AuthToken
32
+ *
33
+ * @apiSuccessExample {json} Response 200
34
+ * Content-Type: application/json
35
+ * [
36
+ * {
37
+ * "_id": "593eaebcf8ac692c4c13b2c1",
38
+ * "title": "Lorem Ipsum",
39
+ * "task": "Dolor Sit",
40
+ * "answer": "Ahmet",
41
+ * "owner": "593eaa0bcf7f5000011c24c4",
42
+ * "lastchange": "2017-06-12T15:58:37.406Z",
43
+ * "__v": 0
44
+ * },...
45
+ * ]
46
+ */
47
+ function getAllAction(req, res) {
48
+ _btMongodb2.default.notecard.findByOwner(req.auth0.id, function (err, map) {
49
+ if (err) {
50
+ res.send(CONTACT_ADMIN);
51
+ } else {
52
+ res.send(map);
53
+ }
54
+ });
55
+ }
56
+
57
+ /**
58
+ * @api {get} notecard/:id GET specific Notecard
59
+ * @apiName GetSpecificNotecards
60
+ * @apiGroup notecard
61
+ * @apiDescription Returns the Notecard with the given id.
62
+ *
63
+ * @apiHeader {String} Authorization Bearer JWT Token
64
+ * @apiParam {Number} id id of the notecard
65
+ * @apiPermission AuthToken
66
+ *
67
+ * @apiSuccessExample {json} Response 200
68
+ * Content-Type: application/json
69
+ * {
70
+ * "_id": "593eaebcf8ac692c4c13b2c1",
71
+ * "title": "Lorem Ipsum",
72
+ * "task": "Dolor Sit",
73
+ * "answer": "Ahmet",
74
+ * "owner": "593eaa0bcf7f5000011c24c4",
75
+ * "__v": 0
76
+ * }
77
+ */
78
+ function getByIdAction(req, res) {
79
+ if (req.params === null || req.params.id === null) {
80
+ res.send(NO_OBJECT_ID);
81
+ } else {
82
+ _btMongodb2.default.notecard.findById(req.params.id, function (err, card) {
83
+ if (err) {
84
+ res.send(CONTACT_ADMIN);
85
+ } else {
86
+ res.send(card);
87
+ }
88
+ });
89
+ }
90
+ }
91
+
92
+ /**
93
+ * @api {post} notecard POST Notecard
94
+ * @apiName PostNotecard
95
+ * @apiGroup notecard
96
+ * @apiDescription Creates a Notecard of the given json body.
97
+ * Owner and the date of creation will be set automatically.
98
+ * Emits the notecard_new event on the websocket for follower.
99
+ *
100
+ * @apiHeader {String} Authorization Bearer JWT Token
101
+ * @apiHeader {String} Content-Type application/json
102
+ * @apiHeader {String} Content-Type application/json
103
+ * @apiPermission AuthToken
104
+ *
105
+ * @apiSuccessExample {json} Request
106
+ * Content-Type: application/json
107
+ * {
108
+ * "title": "Lorem Ipsum",
109
+ * "task": "Dolor Sit",
110
+ * "answer": "Ahmet"
111
+ * }
112
+ *
113
+ * @apiSuccessExample {json} Response 200
114
+ * Content-Type: application/json
115
+ * {
116
+ * "__v": 0,
117
+ * "title": "Lorem Ipsum",
118
+ * "task": "Dolor Sit",
119
+ * "answer": "Ahmet",
120
+ * "owner": "593eaa0bcf7f5000011c24c4",
121
+ * "lastchange": "2017-06-13T17:08:53.703Z",
122
+ * "_id": "59401c25b5746212889f54f9"
123
+ * }
124
+ */
125
+ function createAction(req, res) {
126
+ if (req.body === null) {
127
+ res.send(BODY_EMPTY);
128
+ } else {
129
+ req.body.owner = req.auth0.id;
130
+ req.body.lastchange = new Date();
131
+ _btMongodb2.default.notecard.createNotecard(req.body, function (err, newCard) {
132
+ if (err) {
133
+ res.send(CONTACT_ADMIN);
134
+ } else {
135
+ res.send(newCard);
136
+ _activity2.default.createActivityForFollower(req.auth0, 'notecard_new');
137
+ }
138
+ });
139
+ }
140
+ }
141
+
142
+ /**
143
+ * @api {post} notecard/set/:id POST Notecard and Append to Set
144
+ * @apiName PostNotecardAppend
145
+ * @apiGroup notecard
146
+ * @apiDescription Creates a Notecard of the given json body.
147
+ * Owner and the date of creation will be set automatically. It will be appended
148
+ * to the Set of the given id.
149
+ * Emits the notecard_new event on the websocket for follower.
150
+ *
151
+ * @apiHeader {String} Authorization Bearer JWT Token
152
+ * @apiHeader {String} Content-Type application/json
153
+ * @apiParam {Number} id id of the Set on which the newly created
154
+ * Notecard will be appended to.
155
+ * @apiPermission AuthToken
156
+ *
157
+ * @apiSuccessExample {json} Request
158
+ * Content-Type: application/json
159
+ * {
160
+ * "title": "Lorem Ipsum",
161
+ * "task": "Dolor Sit",
162
+ * "answer": "Ahmet"
163
+ * }
164
+ *
165
+ * @apiSuccessExample {json} Response 200
166
+ * Content-Type: application/json
167
+ * {
168
+ * "__v": 0,
169
+ * "title": "Lorem Ipsum",
170
+ * "task": "Dolor Sit",
171
+ * "answer": "Ahmet",
172
+ * "owner": "593eaa0bcf7f5000011c24c4",
173
+ * "lastchange": "2017-06-13T17:08:53.703Z",
174
+ * "_id": "59401c25b5746212889f54f9"
175
+ * }
176
+ */
177
+ function createAndAppendAction(req, res) {
178
+ if (req.params === null || req.params.id === null) {
179
+ res.send(NO_OBJECT_ID);
180
+ } else if (req.body === null) {
181
+ res.send(BODY_EMPTY);
182
+ } else {
183
+ _btMongodb2.default.set.findById(req.params.id, function (err, set) {
184
+ if (err) {
185
+ res.send(NOT_EXISTED_BEFORE);
186
+ } else if (set) {
187
+ req.body.owner = req.auth0.id;
188
+ req.body.lastchange = new Date();
189
+ _btMongodb2.default.notecard.createNotecard(req.body, function (err1, newCard) {
190
+ if (err1) {
191
+ res.send(CONTACT_ADMIN);
192
+ } else if (newCard) {
193
+ _btMongodb2.default.set.addNotecards(req.params.id, [newCard.id], function (err2) {
194
+ if (err2) {
195
+ res.send(CONTACT_ADMIN);
196
+ } else {
197
+ res.send(newCard);
198
+ _activity2.default.createActivityForFollower(req.auth0, 'notecard_new');
199
+ }
200
+ });
201
+ }
202
+ });
203
+ }
204
+ });
205
+ }
206
+ }
207
+
208
+ /**
209
+ * @api {put} notecard/:id PUT Notecard
210
+ * @apiName PutNotecard
211
+ * @apiGroup notecard
212
+ * @apiDescription Updates a Notecard with the given json body.
213
+ * Owner and the date of lastchange will be set automatically.
214
+ * Emits the notecard_update event on the websocket for follower.
215
+ *
216
+ * @apiHeader {String} Authorization Bearer JWT Token
217
+ * @apiHeader {String} Content-Type application/json
218
+ * @apiParam {Number} id id of the Notecard which will be updated
219
+ * @apiPermission AuthToken
220
+ *
221
+ * @apiSuccessExample {json} Request
222
+ * Content-Type: application/json
223
+ * {
224
+ * "title": "Lorem Ipsum1",
225
+ * "task": "Dolor Sit2",
226
+ * "answer": "Ahmet3",
227
+ * "owner": "593eaa0bcf7f5000011c24c4"
228
+ * }
229
+ *
230
+ * @apiSuccessExample {json} Response 200
231
+ * Content-Type: application/json
232
+ * {
233
+ * "_id": "59401de1b5746212889f54fa",
234
+ * "title": "Lorem Ipsum1",
235
+ * "task": "Dolor Sit2",
236
+ * "answer": "Ahmet3",
237
+ * "owner": "593eaa0bcf7f5000011c24c4",
238
+ * "lastchange": "2017-06-13T17:47:22.826Z",
239
+ * __v": 0
240
+ * }
241
+ */
242
+ function updateAction(req, res) {
243
+ if (req.body === null) {
244
+ res.send(BODY_EMPTY);
245
+ } else if (req.params === null || req.params.id === null) {
246
+ res.send(NO_OBJECT_ID);
247
+ } else {
248
+ _btMongodb2.default.notecard.findById(req.params.id, function (err, card) {
249
+ if (err) {
250
+ res.send(NOT_EXISTED_BEFORE);
251
+ } else if (card.owner.toString() === req.auth0.id) {
252
+ req.body.lastchange = new Date();
253
+ _btMongodb2.default.notecard.updateNotecard(req.params.id, req.body, function (err1, changedCard) {
254
+ if (err1) {
255
+ res.send(CONTACT_ADMIN);
256
+ } else {
257
+ res.send(changedCard);
258
+ _activity2.default.createActivityForFollower(req.auth0, 'notecard_update');
259
+ }
260
+ });
261
+ } else {
262
+ res.send(NOT_OWNER);
263
+ }
264
+ });
265
+ }
266
+ }
267
+
268
+ /**
269
+ * @api {delete} notecard/:id DELETE Notecard
270
+ * @apiName DeleteNotecard
271
+ * @apiGroup notecard
272
+ * @apiDescription Deletes a Notecard.
273
+ * Emits the notecard_delete event on the websocket for follower.
274
+ *
275
+ * @apiHeader {String} Authorization Bearer JWT Token
276
+ * @apiParam {Number} id id of the Notecard which will be deleted
277
+ * @apiPermission AuthToken
278
+ *
279
+ * @apiSuccessExample {json} Response 200
280
+ * {
281
+ * "_id": "59401de1b5746212889f54fa",
282
+ * "title": "Lorem Ipsum1",
283
+ * "task": "Dolor Sit2",
284
+ * "answer": "Ahmet3",
285
+ * "owner": "593eaa0bcf7f5000011c24c4",
286
+ * "lastchange": "2017-06-13T17:47:22.826Z",
287
+ * "__v": 0
288
+ * }
289
+ */
290
+ function deleteAction(req, res) {
291
+ // TODO alle Referenzen entfernen
292
+ if (req.params === null || req.params.id === null) {
293
+ res.send(NO_OBJECT_ID);
294
+ } else {
295
+ _btMongodb2.default.notecard.findById(req.params.id, function (err, card) {
296
+ if (err) {
297
+ res.send(CONTACT_ADMIN);
298
+ } else if (card && card.owner.toString() === req.auth0.id) {
299
+ _btMongodb2.default.notecard.deleteNotecard(req.params.id, function (err1, result) {
300
+ if (err1) {
301
+ res.send(CONTACT_ADMIN);
302
+ } else {
303
+ res.send(result);
304
+ _activity2.default.createActivityForFollower(req.auth0, 'notecard_delete');
305
+ }
306
+ });
307
+ } else {
308
+ res.send(NOT_OWNER);
309
+ }
310
+ });
311
+ }
312
+ }
313
+
314
+ exports.default = {
315
+ getAllAction: getAllAction,
316
+ getByIdAction: getByIdAction,
317
+ createAction: createAction,
318
+ updateAction: updateAction,
319
+ deleteAction: deleteAction,
320
+ createAndAppendAction: createAndAppendAction
321
+ };
pool/shard005/JavaScript/0032596_counter.js ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var express = require('express');
2
+ var router = express.Router();
3
+
4
+ var Counter = require('../services/counter.service.js');
5
+ var CounterService = new Counter();
6
+
7
+ /* Post Counter Add Hit. */
8
+ router.get('/add/:content_id/:channel_id', function(request, response, next) {
9
+ var content_id = request.params.content_id;
10
+ var channel_id = request.params.channel_id;
11
+
12
+ CounterService.addHit(content_id, channel_id, function(result){
13
+ response.status(result.statusCode);
14
+ response.setHeader("Content-Type", "application/json");
15
+ response.setHeader("Access-Control-Allow-Origin", "*");
16
+ response.setHeader("X-Powered-By", "Okezone.com v1.0" );
17
+ response.write(JSON.stringify(result), null);
18
+ response.end();
19
+ });
20
+ });
21
+
22
+ router.get('/get/:content_id', function(request, response, next) {
23
+ var content_id = request.params.content_id;
24
+
25
+ CounterService.getHit(content_id, function(result){
26
+ response.status(result.statusCode);
27
+ response.setHeader("Content-Type", "application/json");
28
+ response.setHeader("Access-Control-Allow-Origin", "*");
29
+ response.setHeader("X-Powered-By", "Okezone.com v1.0" );
30
+ response.write(JSON.stringify(result), null);
31
+ response.end();
32
+ });
33
+ });
34
+
35
+
36
+ module.exports = router;
pool/shard005/JavaScript/0032600_usuarios.js ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var app = angular.module('app');
2
+
3
+ app.controller('UsuariosController',function($scope,$location,$rootScope,$timeout,userFactory){
4
+
5
+ $scope.usuarios = [];
6
+ $scope.newUsuario = {};
7
+ $scope.search_field_txt = 'Nombre:';
8
+ $scope.search_field = 'nombre';
9
+ $scope.search_data = '';
10
+ $scope.es_admin = false;
11
+ $scope.editMode = false;
12
+
13
+
14
+
15
+ if ($location.path()=='/usuarios/editar'){
16
+ $scope.editMode = true;
17
+ if ($rootScope.editUsuario!==undefined){
18
+ $scope.newUsuario=$rootScope.editUsuario;
19
+ $scope.blank_password=$scope.newUsuario.password;
20
+ $scope.check_password=$scope.newUsuario.password;
21
+ } else {
22
+ $location.path('/');
23
+ }
24
+ }
25
+
26
+ $scope.getAllUsuarios = function(){
27
+ userFactory.getAllUsuarios(function(data){
28
+ $scope.usuarios=data;
29
+ });
30
+ };
31
+
32
+
33
+ $scope.addUsuario = function(){
34
+ if ($scope.es_admin){
35
+ $scope.newUsuario.rol=0;
36
+ } else {
37
+ $scope.newUsuario.rol=1;
38
+ }
39
+ $scope.newUsuario.password = $scope.blank_password;
40
+ userFactory.addUsuario($scope.newUsuario,function(data){
41
+ $scope.newUsuario = {};
42
+ $location.path('/usuarios/listar');
43
+ $rootScope.addNotification($rootScope.notifications.SUCCESS,"Usuario agregado con exito.",5000);
44
+ },function(data){
45
+ $rootScope.addNotification($rootScope.notifications.ERROR,data.error.message,5000);
46
+ });
47
+ };
48
+
49
+ $scope.saveUsuario = function(){
50
+ if ($scope.es_admin){
51
+ $scope.newUsuario.rol=0;
52
+ } else {
53
+ $scope.newUsuario.rol=1;
54
+ }
55
+ if ($scope.blank_password!=$scope.newUsuario.password){
56
+ $scope.newUsuario.password = $scope.blank_password;
57
+ } else {
58
+ $scope.newUsuario.password = null;
59
+ }
60
+ userFactory.saveUsuario($scope.newUsuario,function(data){
61
+ $rootScope.addNotification($rootScope.notifications.SUCCESS,"Usuario guardado con exito.",5000);
62
+ $scope.newUsuario = {};
63
+ },function(data){
64
+ $rootScope.addNotification($rootScope.notifications.ERROR,data.error.message,5000);
65
+ });
66
+ };
67
+
68
+ $scope.deleteUsuario = function(indice){
69
+ userFactory.deleteUsuario($scope.usuarios[indice],function(data){
70
+ $scope.usuarios.splice(indice,1);
71
+ $rootScope.addNotification($rootScope.notifications.SUCCESS,"Usuario eliminado con exito.",5000);
72
+ $scope.newUsuario = {};
73
+ },function(data){
74
+ $rootScope.addNotification($rootScope.notifications.ERROR,data.error.message,5000);
75
+ });
76
+ };
77
+
78
+ $scope.editarUsuario = function(user){
79
+ $rootScope.editUsuario = user;
80
+ $location.path('/usuarios/editar');
81
+ };
82
+
83
+ });
pool/shard005/JavaScript/0032601_prototype.js ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function( $ ) {
2
+ "use strict";
3
+
4
+ $(function() {
5
+
6
+ var months = new Array('jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec');
7
+
8
+ $('#clockface div').click(function (e) {
9
+
10
+ //console.log( e.target );
11
+
12
+ var $slot = $(e.target);
13
+ var classes = $slot.attr('class').split(' ');
14
+
15
+ var $slot1_top = $('.' + classes[2] + '.top-slot');
16
+ var $slot1_bottom = $('.' + classes[2] + '.bottom-slot');
17
+
18
+ var $new_top = $('<div />');
19
+ for (var i = 0; i < classes.length; i++) {
20
+ $new_top.addClass(classes[i]);
21
+ }
22
+ $new_top.removeClass('bottom-slot');
23
+ $new_top.addClass('top-slot');
24
+
25
+ var $new_bottom = $('<div />');
26
+ for (var i = 0; i < classes.length; i++) {
27
+ $new_bottom.addClass(classes[i]);
28
+ }
29
+ $new_bottom.removeClass('top-slot');
30
+ $new_bottom.addClass('bottom-slot');
31
+
32
+ //console.log( $new_top );
33
+ //console.log( $new_bottom );
34
+
35
+ var $current_number = $slot.css('background-image');
36
+ $current_number = $current_number.split('/');
37
+ $current_number = $current_number[$current_number.length - 1];
38
+ $current_number = $current_number.replace(/\..*/, '');
39
+ $current_number = $current_number.split('_');
40
+ //console.log( $current_number );
41
+
42
+ if ( $current_number[0] === 'num' ) {
43
+ $current_number[1]++;
44
+ }
45
+ else if ( $current_number[0] === 'month' ) {
46
+ $current_number[1] = months[months.indexOf($current_number[1]) + 1];
47
+ }
48
+
49
+ //console.log( $current_number );
50
+
51
+ var new_image_url = '../resources/src/images/' + $current_number.join('_') + '.png';
52
+ //console.log( new_image_url );
53
+ $new_top.css('background-image', 'url('+new_image_url+')');
54
+ $new_bottom.css('background-image', 'url('+new_image_url+')');
55
+
56
+ $new_top.css('z-index', 0);
57
+ $new_bottom.css('z-index', 999);
58
+ $new_bottom.css('backgroundPositionY', "-84px");
59
+
60
+ $('#clockface').append( $new_top );
61
+ $('#clockface').append( $new_bottom );
62
+
63
+ $slot1_top.animate({
64
+ backgroundPositionY: "42px"
65
+ }, 75, 'linear', function() {
66
+ $new_bottom.animate({
67
+ backgroundPositionY: "-42px"
68
+ }, 75, 'linear', function() {
69
+ $slot1_top.remove();
70
+ $slot1_bottom.remove();
71
+ });
72
+ });
73
+
74
+ });
75
+
76
+ });
77
+
78
+ }(jQuery));
pool/shard005/JavaScript/0032602_utils.js ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ module.exports = {
3
+ getDelimiter: getDelimiter, // Handle auto delimiter: return explicitely specified delimiter or try auto detect
4
+ rowSplit: rowSplit, //Split a csv row to an array based on delimiter and quote
5
+ isToogleQuote: isToogleQuote //returns if a segmenthas even number of quotes
6
+ }
7
+
8
+ var defaulDelimiters=[",","|","\t",";",":"];
9
+ function getDelimiter(rowStr,param) {
10
+ var checker;
11
+ if (param.delimiter==="auto"){
12
+ checker=defaulDelimiters;
13
+ }else if (param.delimiter instanceof Array){
14
+ checker=param.delimiter;
15
+ }else{
16
+ return param.delimiter;
17
+ }
18
+ var count=0;
19
+ var rtn=",";
20
+ checker.forEach(function(delim){
21
+ var delimCount=rowStr.split(delim).length;
22
+ if (delimCount>count){
23
+ rtn=delim;
24
+ count=delimCount;
25
+ }
26
+ });
27
+ return rtn;
28
+ }
29
+ function isQuoteOpen(str,param){
30
+ var quote=param.quote;
31
+ var escape=param.escape;
32
+ return str[0] === quote && (
33
+ str[1]!==quote ||
34
+ str[1]===escape && (str[2] === quote || str.length ===2));
35
+ }
36
+ function isQuoteClose(str,param){
37
+ var quote=param.quote;
38
+ var count=0;
39
+ var idx=str.length-1;
40
+ var escape=param.escape;
41
+ while (str[idx] === quote || str[idx]===escape){
42
+ idx--;
43
+ count++;
44
+ }
45
+ return count%2!==0;
46
+ }
47
+ function rowSplit(rowStr, param) {
48
+ if (rowStr ===""){
49
+ return [];
50
+ }
51
+ var quote=param.quote;
52
+ var trim=param.trim;
53
+ var escape=param.escape;
54
+ if (param.needCheckDelimiter===true){
55
+ param.delimiter=getDelimiter(rowStr,param);
56
+ param.needCheckDelimiter=false;
57
+ }
58
+ var delimiter=param.delimiter;
59
+ var rowArr = rowStr.split(delimiter);
60
+ if (quote ==="off"){
61
+ return rowArr;
62
+ }
63
+ var row = [];
64
+ var inquote = false;
65
+ var quoteBuff = '';
66
+ for (var i=0;i<rowArr.length;i++){
67
+ var e=rowArr[i];
68
+ if (!inquote && trim){
69
+ e=e.trim();
70
+ }
71
+ var len=e.length;
72
+ if (!inquote){
73
+ if (isQuoteOpen(e,param)){ //quote open
74
+ e=e.substr(1);
75
+ if (isQuoteClose(e,param)){ //quote close
76
+ e=e.substring(0,e.length-1);
77
+ e=_escapeQuote(e,quote,escape);
78
+ row.push(e);
79
+ continue;
80
+ }else{
81
+ inquote=true;
82
+ quoteBuff+=e;
83
+ continue;
84
+ }
85
+ }else{
86
+ row.push(e);
87
+ continue;
88
+ }
89
+ }else{ //previous quote not closed
90
+ if (isQuoteClose(e,param)){ //close double quote
91
+ inquote=false;
92
+ e=e.substr(0,len-1);
93
+ quoteBuff+=delimiter+e;
94
+ quoteBuff=_escapeQuote(quoteBuff,quote,escape);
95
+ if (trim){
96
+ quoteBuff=quoteBuff.trimRight();
97
+ }
98
+ row.push(quoteBuff);
99
+ quoteBuff="";
100
+ }else{
101
+ quoteBuff+=delimiter+e;
102
+ }
103
+ }
104
+
105
+
106
+ // if (isToogleQuote(e, quote)) { //if current col has odd quotes, switch quote status
107
+ // if (inquote) { //if currently in open quote status, close it and output data
108
+ // quoteBuff += delimiter;
109
+ // quoteBuff += twoDoubleQuote(e.substr(0, e.length - 1), quote);
110
+ // row.push(trim ? quoteBuff.trim() : quoteBuff);
111
+ // quoteBuff = '';
112
+ // } else { // currently not in open quote status, open it
113
+ // quoteBuff += twoDoubleQuote(e.substring(1), quote);
114
+ // }
115
+ // inquote = !inquote;
116
+ // } else if (inquote) { // if current col has even quotes, do not switch quote status
117
+ // //if current status is in quote, add to buffer wait to close
118
+ // quoteBuff += delimiter + twoDoubleQuote(e, quote);
119
+ // } else { // if current status is not in quote, out put data
120
+ // if (trim) {
121
+ // e = e.trim();
122
+ // }
123
+ // if (e.indexOf(quote) === 0 && e[e.length - 1] === quote) { //if current col contain full quote segment,remove quote first
124
+ // e = e.substring(1, e.length - 1);
125
+ // }
126
+ // row.push(twoDoubleQuote(e, quote));
127
+ // }
128
+ }
129
+ return row;
130
+ }
131
+
132
+
133
+ var cachedRegExp = {};
134
+
135
+ function isToogleQuote(segment, quote) {
136
+ var key="s|"+quote;
137
+ if ( cachedRegExp[key]=== undefined){
138
+ cachedRegExp[key]=new RegExp(quote, 'g');
139
+ }
140
+ var reg = cachedRegExp[key];
141
+ var match = segment.match(reg);
142
+ return match && match.length % 2 !== 0;
143
+ }
144
+
145
+ function _escapeQuote(segment, quote,escape) {
146
+
147
+ var key="es|"+quote+"|"+escape;
148
+ if (cachedRegExp[key] === undefined){
149
+ if (escape ==="\\"){
150
+ escape="\\\\";
151
+ }
152
+ cachedRegExp[key]=new RegExp(escape+quote,'g');
153
+ }
154
+ var regExp = cachedRegExp[key];
155
+ return segment.replace(regExp, quote);
156
+ }
pool/shard005/JavaScript/0032603_ipvFuture.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var Benchmark = require('benchmark'),
2
+ benchmarks = require('beautify-benchmark'),
3
+ isIP = require('..'),
4
+ suite = new Benchmark.Suite,
5
+ testIp = 'v1.09azAZ-._~!$&\'()*+,;=:';
6
+
7
+ suite.add({
8
+ name: 'isIP#test(ipvFuture)',
9
+ minSamples: 100,
10
+ fn: function () {
11
+ isIP.test(testIp);
12
+ }
13
+ }).add({
14
+ name: 'isIP#future(ipvFuture)',
15
+ minSamples: 100,
16
+ fn: function () {
17
+ isIP.future(testIp);
18
+ }
19
+ }).on('start', function onCycle() {
20
+ process.stdout.write(' Testing IP "' + testIp + '"\n\n')
21
+ }).on('cycle', function onCycle(event) {
22
+ benchmarks.add(event.target);
23
+ }).on('complete', function onComplete() {
24
+ benchmarks.log();
25
+ }).run();
pool/shard005/JavaScript/0032604_assignments.controller.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ angular.module('proj2App')
4
+ .controller('AssignmentsController', function ($scope, $state, Assignments) {
5
+ $scope.assignmentss = [];
6
+ $scope.loadAll = function() {
7
+ Assignments.query(function(result) {
8
+ $scope.assignmentss = result;
9
+ });
10
+ };
11
+ $scope.loadAll();
12
+ $scope.refresh = function () {
13
+ $scope.loadAll();
14
+ $scope.clear();
15
+ };
16
+
17
+ $scope.clear = function () {
18
+ $scope.assignments = {
19
+ cost: null,
20
+ startDate: null,
21
+ endDate: null,
22
+ id: null
23
+ };
24
+ };
25
+ });
pool/shard005/JavaScript/0032606_RendererOptions.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ define(["require", "exports"], function (require, exports) {
2
+ var RendererOptions = (function () {
3
+ function RendererOptions(options) {
4
+ this.view = options.view || document.createElement('canvas');
5
+ this.transparent = options.transparent || false;
6
+ this.autoResize = options.autoResize || false;
7
+ this.antialias = options.antialias || false;
8
+ this.resolution = options.resolution || 1;
9
+ this.clearBeforeRender = options.clearBeforeRender || true;
10
+ this.roundPixels = options.roundPixels || false;
11
+ }
12
+ return RendererOptions;
13
+ })();
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.default = RendererOptions;
16
+ });
pool/shard005/JavaScript/0032609_sidenav.js ADDED
@@ -0,0 +1,424 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Angular Material Design
3
+ * https://github.com/angular/material
4
+ * @license MIT
5
+ * v0.10.0-rc1-master-8285e2d
6
+ */
7
+ (function( window, angular, undefined ){
8
+ "use strict";
9
+
10
+ /**
11
+ * @ngdoc module
12
+ * @name material.components.sidenav
13
+ *
14
+ * @description
15
+ * A Sidenav QP component.
16
+ */
17
+ angular.module('material.components.sidenav', [
18
+ 'material.core',
19
+ 'material.components.backdrop'
20
+ ])
21
+ .factory('$mdSidenav', SidenavService )
22
+ .directive('mdSidenav', SidenavDirective)
23
+ .directive('mdSidenavFocus', SidenavFocusDirective)
24
+ .controller('$mdSidenavController', SidenavController);
25
+
26
+
27
+ /**
28
+ * @private
29
+ * @ngdoc service
30
+ * @name $mdSidenav
31
+ * @module material.components.sidenav
32
+ *
33
+ * @description
34
+ * `$mdSidenav` makes it easy to interact with multiple sidenavs
35
+ * in an app.
36
+ *
37
+ * @usage
38
+ * <hljs lang="js">
39
+ * // Async lookup for sidenav instance; will resolve when the instance is available
40
+ * $mdSidenav(componentId).then(function(instance) {
41
+ * $log.debug( componentId + "is now ready" );
42
+ * });
43
+ * // Async toggle the given sidenav;
44
+ * // when instance is known ready and lazy lookup is not needed.
45
+ * $mdSidenav(componentId)
46
+ * .toggle()
47
+ * .then(function(){
48
+ * $log.debug('toggled');
49
+ * });
50
+ * // Async open the given sidenav
51
+ * $mdSidenav(componentId)
52
+ * .open()
53
+ * .then(function(){
54
+ * $log.debug('opened');
55
+ * });
56
+ * // Async close the given sidenav
57
+ * $mdSidenav(componentId)
58
+ * .close()
59
+ * .then(function(){
60
+ * $log.debug('closed');
61
+ * });
62
+ * // Sync check to see if the specified sidenav is set to be open
63
+ * $mdSidenav(componentId).isOpen();
64
+ * // Sync check to whether given sidenav is locked open
65
+ * // If this is true, the sidenav will be open regardless of close()
66
+ * $mdSidenav(componentId).isLockedOpen();
67
+ * </hljs>
68
+ */
69
+ function SidenavService($mdComponentRegistry, $q) {
70
+ return function(handle) {
71
+
72
+ // Lookup the controller instance for the specified sidNav instance
73
+ var self;
74
+ var errorMsg = "SideNav '" + handle + "' is not available!";
75
+ var instance = $mdComponentRegistry.get(handle);
76
+
77
+ if(!instance) {
78
+ $mdComponentRegistry.notFoundError(handle);
79
+ }
80
+
81
+ return self = {
82
+ // -----------------
83
+ // Sync methods
84
+ // -----------------
85
+ isOpen: function() {
86
+ return instance && instance.isOpen();
87
+ },
88
+ isLockedOpen: function() {
89
+ return instance && instance.isLockedOpen();
90
+ },
91
+ // -----------------
92
+ // Async methods
93
+ // -----------------
94
+ toggle: function() {
95
+ return instance ? instance.toggle() : $q.reject(errorMsg);
96
+ },
97
+ open: function() {
98
+ return instance ? instance.open() : $q.reject(errorMsg);
99
+ },
100
+ close: function() {
101
+ return instance ? instance.close() : $q.reject(errorMsg);
102
+ },
103
+ then : function( callbackFn ) {
104
+ var promise = instance ? $q.when(instance) : waitForInstance();
105
+ return promise.then( callbackFn || angular.noop );
106
+ }
107
+ };
108
+
109
+ /**
110
+ * Deferred lookup of component instance using $component registry
111
+ */
112
+ function waitForInstance() {
113
+ return $mdComponentRegistry
114
+ .when(handle)
115
+ .then(function( it ){
116
+ instance = it;
117
+ return it;
118
+ });
119
+ }
120
+ };
121
+ }
122
+ SidenavService.$inject = ["$mdComponentRegistry", "$q"];
123
+ /**
124
+ * @ngdoc directive
125
+ * @name mdSidenavFocus
126
+ * @module material.components.sidenav
127
+ *
128
+ * @restrict A
129
+ *
130
+ * @description
131
+ * `$mdSidenavFocus` provides a way to specify the focused element when a sidenav opens.
132
+ * This is completely optional, as the sidenav itself is focused by default.
133
+ *
134
+ * @usage
135
+ * <hljs lang="html">
136
+ * <md-sidenav>
137
+ * <form>
138
+ * <md-input-container>
139
+ * <label for="testInput">Label</label>
140
+ * <input id="testInput" type="text" md-sidenav-focus>
141
+ * </md-input-container>
142
+ * </form>
143
+ * </md-sidenav>
144
+ * </hljs>
145
+ **/
146
+ function SidenavFocusDirective() {
147
+ return {
148
+ restrict: 'A',
149
+ require: '^mdSidenav',
150
+ link: function(scope, element, attr, sidenavCtrl) {
151
+ sidenavCtrl.focusElement(element);
152
+ }
153
+ };
154
+ }
155
+ /**
156
+ * @ngdoc directive
157
+ * @name mdSidenav
158
+ * @module material.components.sidenav
159
+ * @restrict E
160
+ *
161
+ * @description
162
+ *
163
+ * A Sidenav component that can be opened and closed programatically.
164
+ *
165
+ * By default, upon opening it will slide out on top of the main content area.
166
+ *
167
+ * For keyboard and screen reader accessibility, focus is sent to the sidenav wrapper by default.
168
+ * It can be overridden with the `md-sidenav-focus` directive on the child element you want focused.
169
+ *
170
+ * @usage
171
+ * <hljs lang="html">
172
+ * <div layout="row" ng-controller="MyController">
173
+ * <md-sidenav md-component-id="left" class="md-sidenav-left">
174
+ * Left Nav!
175
+ * </md-sidenav>
176
+ *
177
+ * <md-content>
178
+ * Center Content
179
+ * <md-button ng-click="openLeftMenu()">
180
+ * Open Left Menu
181
+ * </md-button>
182
+ * </md-content>
183
+ *
184
+ * <md-sidenav md-component-id="right"
185
+ * md-is-locked-open="$mdMedia('min-width: 333px')"
186
+ * class="md-sidenav-right">
187
+ * <form>
188
+ * <md-input-container>
189
+ * <label for="testInput">Test input</label>
190
+ * <input id="testInput" type="text"
191
+ * ng-model="data" md-sidenav-focus>
192
+ * </md-input-container>
193
+ * </form>
194
+ * </md-sidenav>
195
+ * </div>
196
+ * </hljs>
197
+ *
198
+ * <hljs lang="js">
199
+ * var app = angular.module('myApp', ['ngMaterial']);
200
+ * app.controller('MyController', function($scope, $mdSidenav) {
201
+ * $scope.openLeftMenu = function() {
202
+ * $mdSidenav('left').toggle();
203
+ * };
204
+ * });
205
+ * </hljs>
206
+ *
207
+ * @param {expression=} md-is-open A model bound to whether the sidenav is opened.
208
+ * @param {string=} md-component-id componentId to use with $mdSidenav service.
209
+ * @param {expression=} md-is-locked-open When this expression evalutes to true,
210
+ * the sidenav 'locks open': it falls into the content's flow instead
211
+ * of appearing over it. This overrides the `is-open` attribute.
212
+ *
213
+ * The $mdMedia() service is exposed to the is-locked-open attribute, which
214
+ * can be given a media query or one of the `sm`, `gt-sm`, `md`, `gt-md`, `lg` or `gt-lg` presets.
215
+ * Examples:
216
+ *
217
+ * - `<md-sidenav md-is-locked-open="shouldLockOpen"></md-sidenav>`
218
+ * - `<md-sidenav md-is-locked-open="$mdMedia('min-width: 1000px')"></md-sidenav>`
219
+ * - `<md-sidenav md-is-locked-open="$mdMedia('sm')"></md-sidenav>` (locks open on small screens)
220
+ */
221
+ function SidenavDirective($timeout, $animate, $parse, $log, $mdMedia, $mdConstant, $compile, $mdTheming, $q, $document) {
222
+ return {
223
+ restrict: 'E',
224
+ scope: {
225
+ isOpen: '=?mdIsOpen'
226
+ },
227
+ controller: '$mdSidenavController',
228
+ compile: function(element) {
229
+ element.addClass('md-closed');
230
+ element.attr('tabIndex', '-1');
231
+ return postLink;
232
+ }
233
+ };
234
+
235
+ /**
236
+ * Directive Post Link function...
237
+ */
238
+ function postLink(scope, element, attr, sidenavCtrl) {
239
+ var lastParentOverFlow;
240
+ var triggeringElement = null;
241
+ var promise = $q.when(true);
242
+
243
+ var isLockedOpenParsed = $parse(attr.mdIsLockedOpen);
244
+ var isLocked = function() {
245
+ return isLockedOpenParsed(scope.$parent, {
246
+ $media: function(arg) {
247
+ $log.warn("$media is deprecated for is-locked-open. Use $mdMedia instead.");
248
+ return $mdMedia(arg);
249
+ },
250
+ $mdMedia: $mdMedia
251
+ });
252
+ };
253
+ var backdrop = $compile(
254
+ '<md-backdrop class="md-sidenav-backdrop md-opaque ng-enter">'
255
+ )(scope);
256
+
257
+ element.on('$destroy', sidenavCtrl.destroy);
258
+ $mdTheming.inherit(backdrop, element);
259
+
260
+ scope.$watch(isLocked, updateIsLocked);
261
+ scope.$watch('isOpen', updateIsOpen);
262
+
263
+
264
+ // Publish special accessor for the Controller instance
265
+ sidenavCtrl.$toggleOpen = toggleOpen;
266
+ sidenavCtrl.focusElement( sidenavCtrl.focusElement() || element );
267
+
268
+ /**
269
+ * Toggle the DOM classes to indicate `locked`
270
+ * @param isLocked
271
+ */
272
+ function updateIsLocked(isLocked, oldValue) {
273
+ scope.isLockedOpen = isLocked;
274
+ if (isLocked === oldValue) {
275
+ element.toggleClass('md-locked-open', !!isLocked);
276
+ } else {
277
+ $animate[isLocked ? 'addClass' : 'removeClass'](element, 'md-locked-open');
278
+ }
279
+ backdrop.toggleClass('md-locked-open', !!isLocked);
280
+ }
281
+
282
+ /**
283
+ * Toggle the SideNav view and attach/detach listeners
284
+ * @param isOpen
285
+ */
286
+ function updateIsOpen(isOpen) {
287
+ var parent = element.parent();
288
+
289
+ parent[isOpen ? 'on' : 'off']('keydown', onKeyDown);
290
+ backdrop[isOpen ? 'on' : 'off']('click', close);
291
+
292
+ if ( isOpen ) {
293
+ // Capture upon opening..
294
+ triggeringElement = $document[0].activeElement;
295
+ }
296
+ var focusEl = sidenavCtrl.focusElement();
297
+
298
+ disableParentScroll(isOpen);
299
+
300
+ return promise = $q.all([
301
+ isOpen ? $animate.enter(backdrop, parent) : $animate.leave(backdrop),
302
+ $animate[isOpen ? 'removeClass' : 'addClass'](element, 'md-closed')
303
+ ])
304
+ .then(function() {
305
+ // Perform focus when animations are ALL done...
306
+ if (scope.isOpen) {
307
+ focusEl && focusEl.focus();
308
+ }
309
+ });
310
+ }
311
+
312
+ /**
313
+ * Prevent parent scrolling (when the SideNav is open)
314
+ */
315
+ function disableParentScroll(disabled) {
316
+ var parent = element.parent();
317
+ if ( disabled ) {
318
+ lastParentOverFlow = parent.css('overflow');
319
+ parent.css('overflow', 'hidden');
320
+ } else if (angular.isDefined(lastParentOverFlow)) {
321
+ parent.css('overflow', lastParentOverFlow);
322
+ lastParentOverFlow = undefined;
323
+ }
324
+ }
325
+
326
+ /**
327
+ * Toggle the sideNav view and publish a promise to be resolved when
328
+ * the view animation finishes.
329
+ *
330
+ * @param isOpen
331
+ * @returns {*}
332
+ */
333
+ function toggleOpen( isOpen ) {
334
+ if (scope.isOpen == isOpen ) {
335
+
336
+ return $q.when(true);
337
+
338
+ } else {
339
+ var deferred = $q.defer();
340
+
341
+ // Toggle value to force an async `updateIsOpen()` to run
342
+ scope.isOpen = isOpen;
343
+
344
+ $timeout(function() {
345
+
346
+ // When the current `updateIsOpen()` animation finishes
347
+ promise.then(function(result) {
348
+
349
+ if ( !scope.isOpen ) {
350
+ // reset focus to originating element (if available) upon close
351
+ triggeringElement && triggeringElement.focus();
352
+ triggeringElement = null;
353
+ }
354
+
355
+ deferred.resolve(result);
356
+ });
357
+
358
+ },0,false);
359
+
360
+ return deferred.promise;
361
+ }
362
+ }
363
+
364
+ /**
365
+ * Auto-close sideNav when the `escape` key is pressed.
366
+ * @param evt
367
+ */
368
+ function onKeyDown(ev) {
369
+ var isEscape = (ev.keyCode === $mdConstant.KEY_CODE.ESCAPE);
370
+ return isEscape ? close(ev) : $q.when(true);
371
+ }
372
+
373
+ /**
374
+ * With backdrop `clicks` or `escape` key-press, immediately
375
+ * apply the CSS close transition... Then notify the controller
376
+ * to close() and perform its own actions.
377
+ */
378
+ function close(ev) {
379
+ ev.preventDefault();
380
+ ev.stopPropagation();
381
+
382
+ return sidenavCtrl.close();
383
+ }
384
+
385
+ }
386
+ }
387
+ SidenavDirective.$inject = ["$timeout", "$animate", "$parse", "$log", "$mdMedia", "$mdConstant", "$compile", "$mdTheming", "$q", "$document"];
388
+
389
+ /*
390
+ * @private
391
+ * @ngdoc controller
392
+ * @name SidenavController
393
+ * @module material.components.sidenav
394
+ *
395
+ */
396
+ function SidenavController($scope, $element, $attrs, $mdComponentRegistry, $q) {
397
+
398
+ var self = this,
399
+ focusElement;
400
+
401
+ // Use Default internal method until overridden by directive postLink
402
+
403
+ // Synchronous getters
404
+ self.isOpen = function() { return !!$scope.isOpen; };
405
+ self.isLockedOpen = function() { return !!$scope.isLockedOpen; };
406
+
407
+ // Async actions
408
+ self.open = function() { return self.$toggleOpen( true ); };
409
+ self.close = function() { return self.$toggleOpen( false ); };
410
+ self.toggle = function() { return self.$toggleOpen( !$scope.isOpen ); };
411
+ self.focusElement = function(el) {
412
+ if ( angular.isDefined(el) ) {
413
+ focusElement = el;
414
+ }
415
+ return focusElement;
416
+ };
417
+
418
+ self.$toggleOpen = function() { return $q.when($scope.isOpen); };
419
+
420
+ self.destroy = $mdComponentRegistry.register(self, $attrs.mdComponentId);
421
+ }
422
+ SidenavController.$inject = ["$scope", "$element", "$attrs", "$mdComponentRegistry", "$q"];
423
+
424
+ })(window, window.angular);
pool/shard005/JavaScript/0032610_plotter.js ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ jQuery(document).ready(function($) {
3
+ var metrics = $.parseJSON($('.storage.storage-profile').html());
4
+ var ticks = [];
5
+ var series = [];
6
+ var values = [];
7
+ var legendItemHeight = 18;
8
+ for (var filename in metrics) {
9
+ series.push({
10
+ label: filename,
11
+ neighborThreshold: 0
12
+ });
13
+ var dataset = [];
14
+ for (var metricName in metrics[filename]) {
15
+ var value = metrics[filename][metricName];
16
+ if (-1 == ticks.indexOf(metricName)) {
17
+ ticks.push(metricName);
18
+ };
19
+ maxHeight = Math.max(maxHeight, value);
20
+ dataset.push([metricName, value]);
21
+ };
22
+ values.push(dataset);
23
+ };
24
+ var barMargin = 0;
25
+ var barWidth = Math.round((800 / ticks.length) / series.length);
26
+ var maxHeight =+ (300 + (series.length * legendItemHeight));
27
+ var scale = ticks.length * values.length;
28
+ var plotter = $('.graph').jqplot('graph', values, {
29
+ width: ((barWidth + (barMargin * 2)) * scale) + 35,
30
+ height: maxHeight,
31
+ seriesColors: ['#002b36', '#586e75', '#839496', '#b58900', '#cb4b16', '#dc322f', '#d33682', '#6c71c4', '#268bd2', '#2aa198', '#859900', '#073642', '#657b83', '#93a1a1'],
32
+ seriesDefaults:{
33
+ renderer: $.jqplot.BarRenderer,
34
+ rendererOptions: {
35
+ //barDirection: 'horizontal',
36
+ shadow: false,
37
+ barWidth: barWidth,
38
+ barMargin: barMargin,
39
+ barPadding: 0
40
+ },
41
+ trendline: {
42
+ show: true
43
+ }
44
+ },
45
+ legend: {
46
+ show: true,
47
+ placement: 'insideGrid',
48
+ location: 'ne'
49
+ },
50
+ series: series,
51
+ grid: {
52
+ background: '#FAFAFA'
53
+ },
54
+ cursor:{
55
+ show: true,
56
+ zoom: true,
57
+ showTooltip: false,
58
+ followMouse: true
59
+ },
60
+ axes: {
61
+ yaxis: {
62
+ padMin: 0
63
+ },
64
+ xaxis: {
65
+ renderer: $.jqplot.CategoryAxisRenderer,
66
+ tickRenderer: $.jqplot.CanvasAxisTickRenderer ,
67
+ tickOptions: {
68
+ angle: -90,
69
+ fontSize: '12pt'
70
+ }
71
+ }
72
+ }
73
+ });
74
+ });
pool/shard005/JavaScript/0032611_slushfile.js ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var gulp = require('gulp'),
2
+ conflict = require('gulp-conflict'),
3
+ install = require('gulp-install'),
4
+ rename = require('gulp-rename'),
5
+ template = require('gulp-template'),
6
+ spawn = require('child_process').spawn,
7
+ inquirer = require('inquirer'),
8
+ path = require('path'),
9
+ _ = require('underscore.string'),
10
+ sfSetup = require('sf-placeholder'),
11
+ data = require('gulp-data'),
12
+ files = [],
13
+ mPageName = '';
14
+
15
+ var jsForceConfig;
16
+ try{ jsForceConfig = require( path.resolve(process.cwd(), 'jsforce.config.js'))}catch(e){}
17
+
18
+ console.log(path.resolve(process.cwd(), 'jsforce.config.js'));
19
+ console.log(typeof jsForceConfig);
20
+
21
+ gulp.task('default', function (done) {
22
+ inquirer.prompt([
23
+ {type: 'input', name: 'name', message: 'What would you like to name your project or VisualForce page?', default: 'base'},
24
+ {type: 'confirm', name: 'salesforce', message: 'Is this a Salesforce project?'},
25
+ /*{ when: function (response) {
26
+ return response.salesforce;
27
+ },
28
+ type: 'input',
29
+ name: 'pageName',
30
+ message: 'Enter your VF page and resource name:(Must match project name for auto-upload)?',
31
+ default: 'mainPage'
32
+ },*/
33
+ { when: function (response) {
34
+ return response.salesforce && typeof jsForceConfig === 'undefined';
35
+ },
36
+ type: 'input',
37
+ name: 'username',
38
+ message: 'Enter your Salesforce username.'
39
+ },
40
+ { when: function (response) {
41
+ return response.salesforce && typeof jsForceConfig === 'undefined';
42
+ },
43
+ type: 'input',
44
+ name: 'password',
45
+ message: 'Enter your Salesforce password.'
46
+ },
47
+ { when: function (response) {
48
+ return response.salesforce && typeof jsForceConfig === 'undefined';
49
+ },
50
+ type: 'input',
51
+ name: 'token',
52
+ message: 'Enter your Salesforce token.'
53
+ }
54
+ ],
55
+ function (answers) {
56
+
57
+
58
+
59
+ /*// set the page name to none if it is a non salesforce project
60
+ if(typeof answers.pageName === 'undefined' && mPageName === '' ){
61
+
62
+ answers.pageName = 'none';
63
+ }
64
+
65
+ mPageName = answers.pageName;*/
66
+
67
+ // build project directory
68
+ answers.slug = _.slugify(answers.name);
69
+ answers.camel = _.camelize(answers.slug);
70
+ path.resolve(process.cwd(), answers.slug);
71
+ files.push(__dirname + '/templates/');
72
+ files.push(__dirname + '/templates/webpack.config.js');
73
+ files.push(__dirname + '/templates/webpack.salesforce.js');
74
+ files.push(__dirname + '/templates/webpack.salesforce.deploy.js');
75
+ files.push(__dirname + '/templates/package.json');
76
+ files.push(__dirname + '/templates/karma.conf.js');
77
+ files.push(__dirname + '/templates/app/index.html');
78
+ files.push(__dirname + '/templates/app/index.js');
79
+ files.push(__dirname + '/templates/app/states/main/*');
80
+ files.push(__dirname + '/templates/app/components/form/*');
81
+ files.push(__dirname + '/templates/app/components/navBar/*');
82
+ files.push(__dirname + '/templates/app/components/simpleTest/*');
83
+
84
+ answers.pageName = answers.name;
85
+
86
+ // create visualforce page and placeholder
87
+ if(answers.salesforce !== false){
88
+ console.log(answers.username);
89
+ console.log(answers.password);
90
+ console.log(answers.token);
91
+ console.log(answers.pageName);
92
+ }
93
+
94
+ sfSetup.defineUserName((typeof jsForceConfig === 'undefined') ? '' + answers.username + '' : '' + jsForceConfig.username + '' );
95
+ sfSetup.definePassword((typeof jsForceConfig === 'undefined') ? '' + answers.password + '' : '' + jsForceConfig.password + '');
96
+ sfSetup.defineToken((typeof jsForceConfig === 'undefined') ? '' + answers.token + '' : '' + jsForceConfig.token + '');
97
+ if(answers.salesforce !== false){
98
+ sfSetup.setupPageAndResource('' + answers.pageName + '');
99
+ }
100
+
101
+
102
+ return gulp.src(files,{base:__dirname + '/templates' })
103
+ .pipe(data(function (answers) {
104
+ return { pageName: answers.pageName };
105
+ }))
106
+ .pipe(template(answers))
107
+ .pipe(rename(function (file) { if (file.basename[0] === '_') { file.basename = '.' + file.basename.slice(1); }}))
108
+ .pipe(conflict(path.join(process.cwd(), answers.name)))
109
+ .pipe(gulp.dest(path.join(process.cwd(), answers.name)))
110
+ .pipe(install())
111
+ .on('finish', function () {
112
+ done();
113
+ });
114
+ });
115
+ });
pool/shard005/JavaScript/0032612_lazyLoader.js ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // getComponent is a function that returns a promise for a component
2
+ // It will not be called until the first mount
3
+ import React from 'react'
4
+
5
+ function asyncComponent(getComponent) {
6
+ return class AsyncComponent extends React.Component {
7
+ static Component = null;
8
+ state = { Component: AsyncComponent.Component };
9
+
10
+ componentWillMount() {
11
+ if (!this.state.Component) {
12
+ getComponent().then(Component => {
13
+ AsyncComponent.Component = Component
14
+ this.setState({ Component })
15
+ })
16
+ }
17
+ }
18
+ render() {
19
+ const { Component } = this.state
20
+ if (Component) {
21
+ return <Component {...this.props} />
22
+ }
23
+ return null
24
+ }
25
+ }
26
+ }
27
+
28
+
29
+ export default asyncComponent
pool/shard005/JavaScript/0032613_ddxapi.js ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ DDXApi = {
2
+ _timerId: null,
3
+ _notify: false,
4
+ startPoll: function() {
5
+
6
+ if (DDXApi._timerId === null) {
7
+
8
+ DDXApi._timerId = Meteor.setInterval(DDXApi.runPoll, 300000);
9
+ }
10
+ },
11
+ stopPoll : function() {
12
+ Meteor.clearInterval(DDXApi._timerId);
13
+ DDXApi._timerId = null;
14
+ },
15
+ runPoll : function() {
16
+ DDXApi._notify = true;
17
+ DDXApi.refreshActivityLog();
18
+ },
19
+ refreshActivityLog: function () {
20
+ Meteor.call('refreshActivityLog', function (error, logData) {
21
+ if (logData && logData.items) {
22
+
23
+ for (var i = logData.items.length, c = 0; c < i; ++c) {
24
+
25
+ var count = Log.find({
26
+ id: logData.items[c].id
27
+ }).count();
28
+
29
+ if (count === 0) {
30
+
31
+ Log.insert(
32
+ {
33
+ id: logData.items[c].id,
34
+ created: logData.items[c].created,
35
+ type: logData.items[c].type,
36
+ data: logData.items[c].data,
37
+ target_type: logData.items[c].target_type,
38
+ target_id: logData.items[c].target_id,
39
+ target_parent: logData.items[c].target_parent,
40
+ target_parent_role: logData.items[c].target_role,
41
+ originator_id: logData.items[c].originator_id,
42
+ originator_role: logData.items[c].originator_role
43
+ }
44
+ );
45
+ }
46
+ }
47
+ }
48
+ });
49
+
50
+ },
51
+ spawnNotification: function(title, body) {
52
+
53
+ var notification = window.Notification || window.mozNotification || window.webkitNotification;
54
+
55
+ if (DDXApi._notify && 'undefined' !== typeof notification && notification.permission === 'granted') {
56
+ new Notification(
57
+ title,
58
+ {
59
+ body: body,
60
+ icon: Meteor.absoluteUrl('icon.png')
61
+ }
62
+ );
63
+ }
64
+ }
65
+ };
pool/shard005/JavaScript/0032615_gulpfile.js ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ var chalk = require('chalk');
4
+
5
+ console.log(chalk.green('\n---Gulp In Action---\n'));
6
+
7
+ var gulp = require('gulp');
8
+ var jshint = require('gulp-jshint');
9
+ var concat = require('gulp-concat');
10
+ var rename = require('gulp-rename');
11
+ var uglify = require('gulp-uglify');
12
+ var minify = require('gulp-minify');
13
+ var less = require('gulp-less');
14
+
15
+ gulp.task('less', function () {
16
+ gulp.src('../webapp*//**//*.less')
17
+ .pipe(less())
18
+ .pipe(gulp.dest('webapp'));
19
+ });
20
+
21
+ // TODO Order of scripts needs to be maintained
22
+
23
+ gulp.task('minify_common', function(){
24
+ return gulp.src('../webapp/scripts/common/**/*.js')
25
+ .pipe(concat('common.js'))
26
+ .pipe(gulp.dest('../webapp/scripts/common'))
27
+ .pipe(rename('common.min.js'))
28
+ .pipe(uglify())
29
+ .pipe(gulp.dest('../webapp/scripts/common/'));
30
+ });
31
+
32
+ gulp.task('minify_lib', function(){
33
+ return gulp.src('../webapp/scripts/lib/**/*.js')
34
+ .pipe(concat('lib.js'))
35
+ .pipe(gulp.dest('../webapp/scripts/lib'))
36
+ .pipe(rename('lib.min.js'))
37
+ .pipe(uglify())
38
+ .pipe(gulp.dest('../webapp/scripts/lib/'));
39
+ });
40
+
41
+ gulp.task('lint', function() {
42
+ return gulp.src('webapp*//**//*.js')
43
+ .pipe(jshint())
44
+ .pipe(jshint.reporter('default'));
45
+ });
46
+
47
+ gulp.task('default', ['minify_common', 'minify_lib'], function() {
48
+ console.log(chalk.green('\n---The Gulp Task has run.---\n'));
49
+ });
pool/shard005/JavaScript/0032618_StickyOnScrollUpHeader.js ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React from 'react';
2
+ import Header from './Header.js';
3
+ import {throttle} from '../utils/Throttle.js';
4
+
5
+ const SCROLL_HEADER_THROTTLE_TIME = 20;
6
+
7
+ /**
8
+ * Header which is not sticky while scroll down but sticks
9
+ * to the top when you are scrolling up
10
+ *
11
+ * It's meant to wrap the header element.
12
+ *
13
+ * Note: It introduces a extra div but planning to remove that
14
+ */
15
+ export default class StickyOnScrollUpHeader extends React.Component {
16
+
17
+ constructor(props) {
18
+ super(props);
19
+ this.state = {};
20
+ this.handleScroll = throttle(this.handleScroll.bind(this), SCROLL_HEADER_THROTTLE_TIME);
21
+ this.setHeader = this.setHeader.bind(this);
22
+ }
23
+
24
+ setHeader(header) {
25
+ this.header = header;
26
+ }
27
+
28
+ handleScroll() {
29
+ const headerHeight = this.header.clientHeight;
30
+ const currentScrollTop = window.pageYOffset || 0;
31
+ const direction = (currentScrollTop - this.state.scrollTop) > 0 ? 'DOWN': 'UP';
32
+ const isHeaderVisible = headerHeight > currentScrollTop;
33
+ this.setState({
34
+ direction: direction,
35
+ scrollTop: currentScrollTop,
36
+ isHeaderVisible: isHeaderVisible,
37
+ headerHeight: headerHeight
38
+ })
39
+ }
40
+
41
+ componentDidMount() {
42
+ window.addEventListener('scroll', this.handleScroll);
43
+ // Fire it once for initial setup
44
+ this.handleScroll();
45
+ }
46
+
47
+ componentWillUnmount() {
48
+ window.removeEventListener('scroll', this.handleScroll);
49
+ }
50
+
51
+ render() {
52
+ const {direction, isHeaderVisible, headerHeight} = this.state;
53
+ const isStickyClass = direction === 'UP' ? 'sticky-header' : '';
54
+ // Header should be moved up when it's not visible, so that it can be animated
55
+ const style = {
56
+ transform: `translateY(-${isHeaderVisible || direction === 'UP' ? '0': headerHeight}px)`
57
+ };
58
+ return (
59
+ <div ref={this.setHeader} style={style} className={`sticky-scrollup-header ${isStickyClass}`}>
60
+ <Header {...this.props}/>
61
+ </div>
62
+ );
63
+ }
64
+ }
pool/shard005/JavaScript/0032619_custom_radio.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ $vic(document).on('click', '#vic-mode-toggler .vic-mode', function(event) {
2
+
3
+ var mode = $vic(this).data('mode');
4
+ $vic('body').attr('role', mode);
5
+ var route = Routing.generate('victoire_core_switchMode', {'mode': mode, '_locale': locale});
6
+ $vic('#vic-mode-toggler .vic-mode').removeClass('vic-active');
7
+ $vic(this).addClass('vic-active');
8
+
9
+ loading(true);
10
+ $vic.ajax(
11
+ {
12
+ url: route,
13
+ context: document.body,
14
+ type: "GET",
15
+ error: function(jsonResponse) {
16
+ error('Woups. La panne !');
17
+ }
18
+ }
19
+ );
20
+ loading(false);
21
+ });
pool/shard005/JavaScript/0032620_widget-htmlparser.js ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ YUI 3.17.1 (build 0eb5a52)
3
+ Copyright 2014 Yahoo! Inc. All rights reserved.
4
+ Licensed under the BSD License.
5
+ http://yuilibrary.com/license/
6
+ */
7
+
8
+ YUI.add('widget-htmlparser', function (Y, NAME) {
9
+
10
+ /**
11
+ * Adds HTML Parser support to the base Widget class
12
+ *
13
+ * @module widget
14
+ * @submodule widget-htmlparser
15
+ * @for Widget
16
+ */
17
+
18
+ var Widget = Y.Widget,
19
+ Node = Y.Node,
20
+ Lang = Y.Lang,
21
+
22
+ SRC_NODE = "srcNode",
23
+ CONTENT_BOX = "contentBox";
24
+
25
+ /**
26
+ * Object hash, defining how attribute values are to be parsed from
27
+ * markup contained in the widget's content box. e.g.:
28
+ * <pre>
29
+ * {
30
+ * // Set single Node references using selector syntax
31
+ * // (selector is run through node.one)
32
+ * titleNode: "span.yui-title",
33
+ * // Set NodeList references using selector syntax
34
+ * // (array indicates selector is to be run through node.all)
35
+ * listNodes: ["li.yui-item"],
36
+ * // Set other attribute types, using a parse function.
37
+ * // Context is set to the widget instance.
38
+ * label: function(contentBox) {
39
+ * return contentBox.one("span.title").get("innerHTML");
40
+ * }
41
+ * }
42
+ * </pre>
43
+ *
44
+ * @property HTML_PARSER
45
+ * @type Object
46
+ * @static
47
+ */
48
+ Widget.HTML_PARSER = {};
49
+
50
+ /**
51
+ * The build configuration for the Widget class.
52
+ * <p>
53
+ * Defines the static fields which need to be aggregated,
54
+ * when this class is used as the main class passed to
55
+ * the <a href="Base.html#method_build">Base.build</a> method.
56
+ * </p>
57
+ * @property _buildCfg
58
+ * @type Object
59
+ * @static
60
+ * @final
61
+ * @private
62
+ */
63
+ Widget._buildCfg = {
64
+ aggregates : ["HTML_PARSER"]
65
+ };
66
+
67
+ /**
68
+ * The DOM node to parse for configuration values, passed to the Widget's HTML_PARSER definition
69
+ *
70
+ * @attribute srcNode
71
+ * @type String | Node
72
+ * @writeOnce
73
+ */
74
+ Widget.ATTRS[SRC_NODE] = {
75
+ value: null,
76
+ setter: Node.one,
77
+ getter: "_getSrcNode",
78
+ writeOnce: true
79
+ };
80
+
81
+ Y.mix(Widget.prototype, {
82
+
83
+ /**
84
+ * @method _getSrcNode
85
+ * @protected
86
+ * @return {Node} The Node to apply HTML_PARSER to
87
+ */
88
+ _getSrcNode : function(val) {
89
+ return val || this.get(CONTENT_BOX);
90
+ },
91
+
92
+ /**
93
+ * Implement the BaseCore _preAddAttrs method hook, to add
94
+ * the srcNode and related attributes, so that HTML_PARSER
95
+ * (which relies on `this.get("srcNode")`) can merge in it's
96
+ * results before the rest of the attributes are added.
97
+ *
98
+ * @method _preAddAttrs
99
+ * @protected
100
+ *
101
+ * @param attrs {Object} The full hash of statically defined ATTRS
102
+ * attributes being added for this instance
103
+ *
104
+ * @param userVals {Object} The hash of user values passed to
105
+ * the constructor
106
+ *
107
+ * @param lazy {boolean} Whether or not to add the attributes lazily
108
+ */
109
+ _preAddAttrs : function(attrs, userVals, lazy) {
110
+
111
+ var preAttrs = {
112
+ id : attrs.id,
113
+ boundingBox : attrs.boundingBox,
114
+ contentBox : attrs.contentBox,
115
+ srcNode : attrs.srcNode
116
+ };
117
+
118
+ this.addAttrs(preAttrs, userVals, lazy);
119
+
120
+ delete attrs.boundingBox;
121
+ delete attrs.contentBox;
122
+ delete attrs.srcNode;
123
+ delete attrs.id;
124
+
125
+ if (this._applyParser) {
126
+ this._applyParser(userVals);
127
+ }
128
+ },
129
+
130
+ /**
131
+ * @method _applyParsedConfig
132
+ * @protected
133
+ * @return {Object} The merged configuration literal
134
+ */
135
+ _applyParsedConfig : function(node, cfg, parsedCfg) {
136
+ return (parsedCfg) ? Y.mix(cfg, parsedCfg, false) : cfg;
137
+ },
138
+
139
+ /**
140
+ * Utility method used to apply the <code>HTML_PARSER</code> configuration for the
141
+ * instance, to retrieve config data values.
142
+ *
143
+ * @method _applyParser
144
+ * @protected
145
+ * @param config {Object} User configuration object (will be populated with values from Node)
146
+ */
147
+ _applyParser : function(config) {
148
+
149
+ var widget = this,
150
+ srcNode = this._getNodeToParse(),
151
+ schema = widget._getHtmlParser(),
152
+ parsedConfig,
153
+ val;
154
+
155
+ if (schema && srcNode) {
156
+ Y.Object.each(schema, function(v, k, o) {
157
+ val = null;
158
+
159
+ if (Lang.isFunction(v)) {
160
+ val = v.call(widget, srcNode);
161
+ } else {
162
+ if (Lang.isArray(v)) {
163
+ val = srcNode.all(v[0]);
164
+ if (val.isEmpty()) {
165
+ val = null;
166
+ }
167
+ } else {
168
+ val = srcNode.one(v);
169
+ }
170
+ }
171
+
172
+ if (val !== null && val !== undefined) {
173
+ parsedConfig = parsedConfig || {};
174
+ parsedConfig[k] = val;
175
+ }
176
+ });
177
+ }
178
+ config = widget._applyParsedConfig(srcNode, config, parsedConfig);
179
+ },
180
+
181
+ /**
182
+ * Determines whether we have a node reference which we should try and parse.
183
+ *
184
+ * The current implementation does not parse nodes generated from CONTENT_TEMPLATE,
185
+ * only explicitly set srcNode, or contentBox attributes.
186
+ *
187
+ * @method _getNodeToParse
188
+ * @return {Node} The node reference to apply HTML_PARSER to.
189
+ * @private
190
+ */
191
+ _getNodeToParse : function() {
192
+ var srcNode = this.get("srcNode");
193
+ return (!this._cbFromTemplate) ? srcNode : null;
194
+ },
195
+
196
+ /**
197
+ * Gets the HTML_PARSER definition for this instance, by merging HTML_PARSER
198
+ * definitions across the class hierarchy.
199
+ *
200
+ * @private
201
+ * @method _getHtmlParser
202
+ * @return {Object} HTML_PARSER definition for this instance
203
+ */
204
+ _getHtmlParser : function() {
205
+ // Removed caching for kweight. This is a private method
206
+ // and only called once so don't need to cache HTML_PARSER
207
+ var classes = this._getClasses(),
208
+ parser = {},
209
+ i, p;
210
+
211
+ for (i = classes.length - 1; i >= 0; i--) {
212
+ p = classes[i].HTML_PARSER;
213
+ if (p) {
214
+ Y.mix(parser, p, true);
215
+ }
216
+ }
217
+ return parser;
218
+ }
219
+ });
220
+
221
+
222
+ }, '3.17.1', {"requires": ["widget-base"]});
pool/shard005/JavaScript/0032623_test.js ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * JBoss, Home of Professional Open Source
3
+ * Copyright 2012, Red Hat, Inc., and individual contributors
4
+ * by the @authors tag. See the copyright.txt in the distribution for a
5
+ * full listing of individual contributors.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /*
18
+ Unit tests that cover basic functionality of app.js.
19
+ */
20
+
21
+ module('Member Row Construction');
22
+
23
+ test('Build 2 Member Rows', function() {
24
+ expect(1);
25
+
26
+ var members = [{"email": "jane.doe@company.com", "id": 1, "name": "Jane Doe", "phoneNumber": "12312312311"},{"email": "john.doe@company.com", "id": 0, "name": "John Doe", "phoneNumber": "2125551212"}];
27
+
28
+ var html = buildMemberRows(members);
29
+
30
+ ok($(html).length == 2, 'Number of rows built: ' + length);
31
+ });
32
+
33
+ test('Build 0 member Rows', function() {
34
+ expect(1);
35
+
36
+ var members = [];
37
+
38
+ var html = buildMemberRows(members);
39
+
40
+ ok($(html).length == 0, 'Created no rows for empty members');
41
+ });
42
+
43
+ module('Member Restful Calls');
44
+
45
+ asyncTest('Request current member list', function() {
46
+ expect(1);
47
+
48
+ $.ajax({
49
+ // replace this with externally available IP - should be propagated by Arquillian
50
+ url: "http://" + window.location.host + "/arquillian-browsers-scenario/rest/members",
51
+ dataType: "jsonp",
52
+ jsonp: "jsonpcallback",
53
+ success: function(data) {
54
+ ok($(data).length, "Initial member returned");
55
+ start();
56
+ }
57
+ });
58
+ });
59
+
60
+ test('Register a new member', function() {
61
+ ok(1==1,"TODO");
62
+ });
63
+
64
+ test('Register a member with a duplicate email', function() {
65
+ ok(1==1,"TODO");
66
+ });
pool/shard005/JavaScript/0032624_DistanceOpacityMaterial.js ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * A Material which sets opacity according to the distance to the camera.
3
+ * Close parts will be transparent, so you could watch inside a building, while the walls in the back are still opaque.
4
+ *
5
+ * @namespace GIScene
6
+ * @class DistanceOpacityMaterial
7
+ * @constructor
8
+ * @param {Number} near distance from where opacity begins
9
+ * @param {Number} far distance from where opacity will be 1.0
10
+ *
11
+ */
12
+
13
+ GIScene.DistanceOpacityMaterial = function(near,far) {
14
+ var near = near || 15.0;
15
+ var far = far || 30.0;
16
+
17
+ var parameters = {
18
+ transparent:true,
19
+ lights: true,
20
+ side:2,
21
+ uniforms: THREE.UniformsUtils.merge( [
22
+
23
+ THREE.UniformsLib[ "common" ],
24
+ THREE.UniformsLib[ "fog" ],
25
+ THREE.UniformsLib[ "lights" ],
26
+ THREE.UniformsLib[ "shadowmap" ],
27
+
28
+ {
29
+ "ambient" : { type: "c", value: new THREE.Color( 0xaaaaaa ) },
30
+ "emissive" : { type: "c", value: new THREE.Color( 0x000000 ) },
31
+ "wrapRGB" : { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) },
32
+
33
+ "mNear": { type: "f", value: near },
34
+ "mFar" : { type: "f", value: far }
35
+ }
36
+
37
+ ] ),
38
+
39
+ vertexShader: [
40
+
41
+ "#define LAMBERT",
42
+
43
+ "varying vec3 vLightFront;",
44
+
45
+ "#ifdef DOUBLE_SIDED",
46
+
47
+ "varying vec3 vLightBack;",
48
+
49
+ "#endif",
50
+
51
+ THREE.ShaderChunk[ "map_pars_vertex" ],
52
+ THREE.ShaderChunk[ "lightmap_pars_vertex" ],
53
+ THREE.ShaderChunk[ "envmap_pars_vertex" ],
54
+ THREE.ShaderChunk[ "lights_lambert_pars_vertex" ],
55
+ THREE.ShaderChunk[ "color_pars_vertex" ],
56
+ THREE.ShaderChunk[ "morphtarget_pars_vertex" ],
57
+ THREE.ShaderChunk[ "skinning_pars_vertex" ],
58
+ THREE.ShaderChunk[ "shadowmap_pars_vertex" ],
59
+
60
+ "void main() {",
61
+
62
+ THREE.ShaderChunk[ "map_vertex" ],
63
+ THREE.ShaderChunk[ "lightmap_vertex" ],
64
+ THREE.ShaderChunk[ "color_vertex" ],
65
+
66
+ THREE.ShaderChunk[ "morphnormal_vertex" ],
67
+ THREE.ShaderChunk[ "skinbase_vertex" ],
68
+ THREE.ShaderChunk[ "skinnormal_vertex" ],
69
+ THREE.ShaderChunk[ "defaultnormal_vertex" ],
70
+
71
+ THREE.ShaderChunk[ "morphtarget_vertex" ],
72
+ THREE.ShaderChunk[ "skinning_vertex" ],
73
+ THREE.ShaderChunk[ "default_vertex" ],
74
+
75
+ THREE.ShaderChunk[ "worldpos_vertex" ],
76
+ THREE.ShaderChunk[ "envmap_vertex" ],
77
+ THREE.ShaderChunk[ "lights_lambert_vertex" ],
78
+ THREE.ShaderChunk[ "shadowmap_vertex" ],
79
+
80
+ "}"
81
+
82
+ ].join("\n"),
83
+
84
+ fragmentShader: [
85
+ //mca
86
+ "uniform float mNear;",
87
+ "uniform float mFar;",
88
+
89
+
90
+ "uniform float opacity;",
91
+
92
+ "varying vec3 vLightFront;",
93
+
94
+ "#ifdef DOUBLE_SIDED",
95
+
96
+ "varying vec3 vLightBack;",
97
+
98
+ "#endif",
99
+
100
+ THREE.ShaderChunk[ "color_pars_fragment" ],
101
+ THREE.ShaderChunk[ "map_pars_fragment" ],
102
+ THREE.ShaderChunk[ "lightmap_pars_fragment" ],
103
+ THREE.ShaderChunk[ "envmap_pars_fragment" ],
104
+ THREE.ShaderChunk[ "fog_pars_fragment" ],
105
+ THREE.ShaderChunk[ "shadowmap_pars_fragment" ],
106
+ THREE.ShaderChunk[ "specularmap_pars_fragment" ],
107
+
108
+ "void main() {",
109
+
110
+
111
+
112
+
113
+ "gl_FragColor = vec4( vec3 ( 1.0 ), opacity );",
114
+
115
+ THREE.ShaderChunk[ "map_fragment" ],
116
+ THREE.ShaderChunk[ "alphatest_fragment" ],
117
+ THREE.ShaderChunk[ "specularmap_fragment" ],
118
+
119
+ "#ifdef DOUBLE_SIDED",
120
+
121
+ //"float isFront = float( gl_FrontFacing );",
122
+ //"gl_FragColor.xyz *= isFront * vLightFront + ( 1.0 - isFront ) * vLightBack;",
123
+
124
+ "if ( gl_FrontFacing )",
125
+ "gl_FragColor.xyz *= vLightFront;",
126
+ "else",
127
+ "gl_FragColor.xyz *= vLightBack;",
128
+
129
+ "#else",
130
+
131
+ "gl_FragColor.xyz *= vLightFront;",
132
+
133
+ "#endif",
134
+
135
+ THREE.ShaderChunk[ "lightmap_fragment" ],
136
+ THREE.ShaderChunk[ "color_fragment" ],
137
+ THREE.ShaderChunk[ "envmap_fragment" ],
138
+ THREE.ShaderChunk[ "shadowmap_fragment" ],
139
+
140
+ THREE.ShaderChunk[ "linear_to_gamma_fragment" ],
141
+
142
+ THREE.ShaderChunk[ "fog_fragment" ],
143
+
144
+ //mca
145
+ "float depth_ = gl_FragCoord.z / gl_FragCoord.w;",
146
+ "float distOpacity = smoothstep( mNear, mFar, depth_ );",
147
+ "gl_FragColor = vec4( gl_FragColor.rgb, distOpacity );",
148
+ "if (distOpacity < 0.01) discard;", //depthBuffer will not be written
149
+ "}"
150
+
151
+ ].join("\n")
152
+
153
+ };
154
+
155
+ THREE.ShaderMaterial.call(this, parameters);
156
+ };
157
+
158
+ GIScene.DistanceOpacityMaterial.prototype = Object.create( THREE.ShaderMaterial.prototype );
pool/shard005/JavaScript/0032626_normalize-pk-value.js ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Module dependencies
3
+ */
4
+
5
+ var util = require('util');
6
+ var _ = require('@sailshq/lodash');
7
+ var flaverr = require('flaverr');
8
+ var isSafeNaturalNumber = require('./is-safe-natural-number');
9
+
10
+
11
+ /**
12
+ * normalizePkValue()
13
+ *
14
+ * Validate and normalize the provided pk value.
15
+ *
16
+ * > This ensures the provided pk value is a string or a number.
17
+ * > • If a string, it also validates that it is not the empty string ("").
18
+ * > • If a number, it also validates that it is a base-10, non-zero, positive integer
19
+ * > that is not larger than the maximum safe integer representable by JavaScript.
20
+ * > Also, if we are expecting numbers, numeric strings are tolerated, so long as they
21
+ * > can be parsed as valid numeric pk values.
22
+ *
23
+ * ------------------------------------------------------------------------------------------
24
+ * @param {String|Number} pkValue
25
+ * @param {String} expectedPkType [either "number" or "string"]
26
+ * ------------------------------------------------------------------------------------------
27
+ * @returns {String|Number}
28
+ * A valid primary key value, guaranteed to match the specified `expectedPkType`.
29
+ * ------------------------------------------------------------------------------------------
30
+ * @throws {Error} if invalid
31
+ * @property {String} code (=== "E_INVALID_PK_VALUE")
32
+ * ------------------------------------------------------------------------------------------
33
+ * @throws {Error} If anything unexpected happens, e.g. bad usage, or a failed assertion.
34
+ * ------------------------------------------------------------------------------------------
35
+ */
36
+
37
+ module.exports = function normalizePkValue (pkValue, expectedPkType){
38
+
39
+ // Check usage
40
+ if (expectedPkType !== 'string' && expectedPkType !== 'number') {
41
+ throw new Error('Consistency violation: The internal normalizePkValue() utility must always be called with a valid second argument ("string" or "number"). But instead, got: '+util.inspect(expectedPkType, {depth:5})+'');
42
+ }
43
+
44
+
45
+ // If explicitly expecting strings...
46
+ if (expectedPkType === 'string') {
47
+ if (!_.isString(pkValue)) {
48
+ // > Note that we DO NOT tolerate non-strings being passed in, even though it
49
+ // > would be possible to cast them into strings automatically. While this would
50
+ // > be useful for key/value adapters like Redis, or in SQL databases when using
51
+ // > a string primary key, it can lead to bugs when querying against a database
52
+ // > like MongoDB that uses special hex or uuid strings.
53
+ throw flaverr('E_INVALID_PK_VALUE', new Error('Instead of a string (the expected pk type), the provided value is: '+util.inspect(pkValue,{depth:5})+''));
54
+ }//-•
55
+
56
+ // Empty string ("") is never a valid primary key value.
57
+ if (pkValue === '') {
58
+ throw flaverr('E_INVALID_PK_VALUE', new Error('Cannot use empty string ('+util.inspect(pkValue,{depth:5})+') as a primary key value.'));
59
+ }//-•
60
+
61
+ }//‡
62
+ // Else if explicitly expecting numbers...
63
+ else if (expectedPkType === 'number') {
64
+ if (!_.isNumber(pkValue)) {
65
+
66
+ // If this is not even a _string_ either, then reject it.
67
+ // (Note that we handle this case separately in order to support a more helpful error message.)
68
+ if (!_.isString(pkValue)) {
69
+ throw flaverr('E_INVALID_PK_VALUE', new Error(
70
+ 'Instead of a number (the expected pk type), got: '+util.inspect(pkValue,{depth:5})+''
71
+ ));
72
+ }//-•
73
+
74
+
75
+
76
+ // Tolerate strings that _look_ like base-10, non-zero, positive integers;
77
+ // and that wouldn't be too big to be a safe JavaScript number.
78
+ // (Cast them into numbers automatically.)
79
+
80
+ var GOT_STRING_FOR_NUMERIC_PK_SUFFIX =
81
+ 'To resolve this error, pass in a valid base-10, non-zero, positive integer instead. '+
82
+ '(Or if you must use strings, then change the relevant model\'s pk attribute from '+
83
+ '`type: \'number\'` to `type: \'string\'`.)';
84
+
85
+ var canPrblyCoerceIntoValidNumber = _.isString(pkValue) && pkValue.match(/^[0-9]+$/);
86
+ if (!canPrblyCoerceIntoValidNumber) {
87
+ throw flaverr('E_INVALID_PK_VALUE', new Error(
88
+ 'Instead of a number, the provided value (`'+util.inspect(pkValue,{depth:5})+'`) is a string, '+
89
+ 'and it cannot be coerced into a valid primary key value automatically (contains characters other '+
90
+ 'than numerals 0-9). '+
91
+ GOT_STRING_FOR_NUMERIC_PK_SUFFIX
92
+ ));
93
+ }//-•
94
+
95
+ var coercedNumber = +pkValue;
96
+ if (coercedNumber > (Number.MAX_SAFE_INTEGER||9007199254740991)) {
97
+ throw flaverr('E_INVALID_PK_VALUE', new Error(
98
+ 'Instead of a valid number, the provided value (`'+util.inspect(pkValue,{depth:5})+'`) is '+
99
+ 'a string that looks like a number. But it cannot be coerced automatically because, despite '+
100
+ 'its "numbery" appearance, it\'s just too big! '+
101
+ GOT_STRING_FOR_NUMERIC_PK_SUFFIX
102
+ ));
103
+ }//-•
104
+
105
+ pkValue = coercedNumber;
106
+
107
+ }//>-• </ if !_.isNumber(pkValue) >
108
+
109
+
110
+ //-•
111
+ // IWMIH, then we know that `pkValue` is now a number.
112
+ // (But it might be something like `NaN` or `Infinity`!)
113
+ //
114
+ // `pkValue` should be provided as a safe, positive, non-zero, finite integer.
115
+ //
116
+ // > We do a few explicit checks below for better error messages, and then finally
117
+ // > do one last check as a catchall, at the very end.
118
+
119
+ // NaN is never valid as a primary key value.
120
+ if (_.isNaN(pkValue)) {
121
+ throw flaverr('E_INVALID_PK_VALUE', new Error('Cannot use `NaN` as a primary key value.'));
122
+ }//-•
123
+
124
+ // Zero is never a valid primary key value.
125
+ if (pkValue === 0) {
126
+ throw flaverr('E_INVALID_PK_VALUE', new Error('Cannot use zero ('+util.inspect(pkValue,{depth:5})+') as a primary key value.'));
127
+ }//-•
128
+
129
+ // A negative number is never a valid primary key value.
130
+ if (pkValue < 0) {
131
+ throw flaverr('E_INVALID_PK_VALUE', new Error('Cannot use a negative number ('+util.inspect(pkValue,{depth:5})+') as a primary key value.'));
132
+ }//-•
133
+
134
+ // A floating point number is never a valid primary key value.
135
+ if (Math.floor(pkValue) !== pkValue) {
136
+ throw flaverr('E_INVALID_PK_VALUE', new Error('Cannot use a floating point number ('+util.inspect(pkValue,{depth:5})+') as a primary key value.'));
137
+ }//-•
138
+
139
+ // Neither Infinity nor -Infinity are ever valid as primary key values.
140
+ if (Infinity === pkValue || -Infinity === pkValue) {
141
+ throw flaverr('E_INVALID_PK_VALUE', new Error('Cannot use `Infinity` or `-Infinity` (`'+util.inspect(pkValue,{depth:5})+'`) as a primary key value.'));
142
+ }//-•
143
+
144
+ // Numbers greater than the maximum safe JavaScript integer are never valid as a primary key value.
145
+ // > Note that we check for `Infinity` above FIRST, before we do this comparison. That's just so that
146
+ // > we can display a tastier error message.
147
+ if (pkValue > (Number.MAX_SAFE_INTEGER||9007199254740991)) {
148
+ throw flaverr('E_INVALID_PK_VALUE', new Error('Cannot use the provided value (`'+util.inspect(pkValue,{depth:5})+'`), because it is too large to safely fit into a JavaScript integer (i.e. `> Number.MAX_SAFE_INTEGER`)'));
149
+ }//-•
150
+
151
+ // Now do one last check as a catch-all, w/ a generic error msg.
152
+ if (!isSafeNaturalNumber(pkValue)) {
153
+ throw flaverr('E_INVALID_PK_VALUE', new Error('Cannot use the provided value (`'+util.inspect(pkValue,{depth:5})+'`) as a primary key value -- it is not a "safe", natural number (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger).'));
154
+ }
155
+
156
+ } else { throw new Error('Consistency violation: Should not be possible to make it here in the code! If you are seeing this error, there\'s a bug in Waterline!'); }
157
+ //>-•
158
+
159
+ // Return the normalized pk value.
160
+ return pkValue;
161
+
162
+ };
163
+