<commit_before>/////////////////////
// Project JS      //
/////////////////////
'use strict';

var $ = require('jquery');
var bootbox = require('bootbox');
var Raven = require('raven-js');
var ko = require('knockout');

var $osf = require('js/osfHelpers');

var ctx = window.contextVars;
var NodeActions = {}; // Namespace for NodeActions
require('loaders.css/loaders.min.css');
require('css/add-project-plugin.css');

// TODO: move me to the NodeControl or separate module
NodeActions.beforeForkNode = function(url, done) {
    $.ajax({
        url: url,
        contentType: 'application/json'
    }).done(function(response) {
        bootbox.confirm({
            message: $osf.joinPrompts(response.prompts, ('
Are you sure you want to fork this project?
')),
            callback: function (result) {
                if (result) {
                    done && done();
                }
            },
            buttons:{
                confirm:{
                    label:'Fork'
                }
            }
        });
    }).fail(
        $osf.handleJSONError
    );
};

function afterForkGoto(url) {
  bootbox.confirm({
      message: '
Fork created successfully!
',
      callback: function(result) {
          if(result) {
              window.location = url;
          }
      },
      buttons: {
          confirm: {
              label: 'Go to new fork',
              className: 'btn-success'
          },
          cancel: {
              label: 'Keep working here'
          }
      },
      closeButton: false
  });
}

NodeActions.forkNode = function() {
    NodeActions.beforeForkNode(ctx.node.urls.api + 'fork/before/', function() {
        // Block page
        $osf.block();
        var payload = {
            data: {
                type: 'nodes'
            }
        };
        // Fork node
        var nodeType = ctx.node.isRegistration ? 'registrations' : 'nodes';
        $osf.ajaxJSON(
            'POST',
            $osf.apiV2Url(nodeType + '/' + ctx.node.id + '/forks/'),
            {
                isCors: true,
                data: payload
            }
        ).done(function(response) {
            $osf.unblock();
            afterForkGoto(response.data.links.html);
        }).fail(function(response) {
            $osf.unblock();
            if (response.status === 403) {
                $osf.growl('Sorry:', 'you do not have permission to fork this project');
            } else if (response.status === 504) {
                $osf.growl('Sorry:', 'This is taking longer than normal.
' +
                    'Please check back later to access your new fork and if still unavailable, contact ' + ctx.cosSupportEmail);
            } else {
                $osf.growl('Error:', 'Forking failed');
                Raven.captureMessage('Error occurred during forking');
            }
        });
    });
};

NodeActions.forkPointer = function(nodeId) {
    bootbox.confirm({
        title: 'Fork this project?',
        message: 'Are you sure you want to fork this project?',
        callback: function(result) {
            if(result) {
                // Block page
                $osf.block();

                // Fork pointer
                $osf.postJSON(
                    ctx.node.urls.api + 'pointer/fork/',
                    {nodeId: nodeId}
                ).done(function(response) {
                    $osf.unblock();
                    afterForkGoto(response.data.node.url);
                }).fail(function() {
                    $osf.unblock();
                    $osf.growl('Error','Could not fork link.');
                });
            }
        },
        buttons:{
            confirm:{
                label:'Fork'
            }
        }
    });
};

NodeActions.beforeTemplate = function(url, done) {
    $.ajax({
        url: url,
        contentType: 'application/json'
    }).done(function(response) {
        bootbox.confirm({
            message: $osf.joinPrompts(response.prompts,
                ('
Are you sure you want to create a new project using this project as a template?
' +
                '
Any add-ons configured for this project will not be authenticated in the new project.
')),
                //('Are you sure you want to create a new project using this project as a template? ' +
                //  'Any add-ons configured for this project will not be authenticated in the new project.')),
            callback: function (result) {
                if (result) {
                    done && done();
                }
            },
            buttons:{
                confirm:{
                    label:'Create'
                }
            }
        });
    });
};

NodeActions.redirectForkPage = function(){
    window.location.href = '/project/' + ctx.node.id + '/forks/';
    return true;
};

NodeActions.addonFileRedirect = function(item) {
    window.location.href = item.params.urls.view;
    return false;
};

NodeActions.useAsTemplate = function() {
    NodeActions.beforeTemplate('/project/new/' + ctx.node.id + '/beforeTemplate/', function () {
        $osf.block();

        $osf.postJSON(
            '/api/v1/project/new/' + ctx.node.id + '/',
            {}
        ).done(function(response) {
            window.location = response.url;
        }).fail(function(response) {
            $osf.unblock();
            $osf.handleJSONError(response);
        });
    });
};

NodeActions.reorderChildren = function(idList, elm) {
    $osf.postJSON(
        ctx.node.urls.api + 'reorder_components/',
        {new_list: idList}
    ).fail(function(response) {
        $(elm).sortable('cancel');
        $osf.handleJSONError(response);
    });
};

NodeActions.removePointer = function(pointerId, pointerElm) {
    $.ajax({
        type: 'DELETE',
        url: ctx.node.urls.api + 'pointer/',
        data: JSON.stringify({
            pointerId: pointerId
        }),
        contentType: 'application/json',
        dataType: 'json'
    }).done(function() {
        pointerElm.remove();
    }).fail(
        $osf.handleJSONError
    );
};

// TODO: remove this
$(document).ready(function() {
    var permissionInfoHtml = '
' +
        '
Read
' +
            '

View project content and comment

' +
        '
Read + Write
' +
            '

Read privileges
 ' +
                '
Add and configure components
 ' +
                '
Add and edit content

' +
        '
Administrator

' +
            '
Read and write privileges
' +
            '
Manage contributor
' +
            '
Delete and register project

Public-private settings

' +
        '
';

    $('.permission-info').attr(
        'data-content', permissionInfoHtml
    ).popover({
        trigger: 'hover'
    });

    var bibliographicContribInfoHtml = 'Only bibliographic contributors will be displayed ' +
           'in the Contributors list and in project citations. Non-bibliographic contributors ' +
            'can read and modify the project as normal.';

    $('.visibility-info').attr(
        'data-content', bibliographicContribInfoHtml
    ).popover({
        trigger: 'hover'
    });

    ////////////////////
    // Event Handlers //
    ////////////////////

    $('.remove-pointer').on('click', function() {
        var $this = $(this);
        bootbox.confirm({
            title: 'Remove this link?',
            message: 'Are you sure you want to remove this link? This will not remove the ' +
                'project this link refers to.',
            callback: function(result) {
                if(result) {
                    var pointerId = $this.attr('data-id');
                    var pointerElm = $this.closest('.list-group-item');
                    NodeActions.removePointer(pointerId, pointerElm);
                }
            },
            buttons:{
                    confirm:{
                        label:'Remove',
                        className:'btn-danger'
                    }
            }
        });
    });

    $('#citation-more').on('click', function() {
        var panel = $('#citationStylePanel');
        panel.slideToggle(200, function() {
            if (panel.is(':visible')) {
                $('#citationStyleInput').select2('open');
            }
        });
        return false;
    });

    $('body').on('click', '.tagsinput .tag > span', function(e) {
      if(e){
        window.location = '/search/?q=(tags:"' + $(e.target).text().toString().trim()+ '")';
      }
    });

    // Portlet feature for the dashboard, to be implemented in later versions.
    // $( ".osf-dash-col" ).sortable({
    //   connectWith: ".osf-dash-col",
    //   handle: ".addon-widget-header",
    //   cancel: ".pull-right",
    //   placeholder: "osf-dash-portlet ui-corner-all"
    // });

    // Adds active class to current menu item
    $(function () {
        var path = window.location.pathname;
        $('.project-nav a:not(#commentsLink)').each(function () {
            var href = $(this).attr('href');
            if (path === href ||
               (path.indexOf('files') > -1 && href.indexOf('files') > -1) ||
               (path.indexOf('wiki') > -1 && href.indexOf('wiki') > -1)) {
                $(this).closest('li').addClass('active');
            }
        });

        // Remove Comments link from project nav bar for pages not bound to the comment view model
        var commentsLinkElm = document.getElementById('commentsLink');
        if (commentsLinkElm) {
            if(!ko.dataFor(commentsLinkElm)) {
                commentsLinkElm.parentNode.removeChild(commentsLinkElm);
            }
        }
    });
});

window.NodeActions = NodeActions;
module.exports = NodeActions;
<commit_msg>more clean up<commit_after>/////////////////////
// Project JS      //
/////////////////////
'use strict';

var $ = require('jquery');
var bootbox = require('bootbox');
var Raven = require('raven-js');
var ko = require('knockout');

var $osf = require('js/osfHelpers');

var ctx = window.contextVars;
var NodeActions = {}; // Namespace for NodeActions
require('loaders.css/loaders.min.css');
require('css/add-project-plugin.css');

// TODO: move me to the NodeControl or separate module
NodeActions.beforeForkNode = function(url, done) {
    $.ajax({
        url: url,
        contentType: 'application/json'
    }).done(function(response) {
        bootbox.confirm({
            message: $osf.joinPrompts(response.prompts, ('
Are you sure you want to fork this project?
')),
            callback: function (result) {
                if (result) {
                    done && done();
                }
            },
            buttons:{
                confirm:{
                    label:'Fork'
                }
            }
        });
    }).fail(
        $osf.handleJSONError
    );
};

function afterForkGoto(url) {
  bootbox.confirm({
      message: '
Fork created successfully!
',
      callback: function(result) {
          if(result) {
              window.location = url;
          }
      },
      buttons: {
          confirm: {
              label: 'Go to new fork',
              className: 'btn-success'
          },
          cancel: {
              label: 'Keep working here'
          }
      },
      closeButton: false
  });
}

NodeActions.forkNode = function() {
    NodeActions.beforeForkNode(ctx.node.urls.api + 'fork/before/', function() {
        // Block page
        $osf.block();
        var payload = {
            data: {
                type: 'nodes'
            }
        };
        // Fork node
        var nodeType = ctx.node.isRegistration ? 'registrations' : 'nodes';
        $osf.ajaxJSON(
            'POST',
            $osf.apiV2Url(nodeType + '/' + ctx.node.id + '/forks/'),
            {
                isCors: true,
                data: payload
            }
        ).done(function(response) {
            $osf.unblock();
            afterForkGoto(response.data.links.html);
        }).fail(function(response) {
            $osf.unblock();
            if (response.status === 403) {
                $osf.growl('Sorry:', 'you do not have permission to fork this project');
            } else if (response.status === 504) {
                $osf.growl('Sorry:', 'This is taking longer than normal.
' +
                    'Please check back later to access your new fork and if still unavailable, contact ' + ctx.osfSupportEmail);
            } else {
                $osf.growl('Error:', 'Forking failed');
                Raven.captureMessage('Error occurred during forking');
            }
        });
    });
};

NodeActions.forkPointer = function(nodeId) {
    bootbox.confirm({
        title: 'Fork this project?',
        message: 'Are you sure you want to fork this project?',
        callback: function(result) {
            if(result) {
                // Block page
                $osf.block();

                // Fork pointer
                $osf.postJSON(
                    ctx.node.urls.api + 'pointer/fork/',
                    {nodeId: nodeId}
                ).done(function(response) {
                    $osf.unblock();
                    afterForkGoto(response.data.node.url);
                }).fail(function() {
                    $osf.unblock();
                    $osf.growl('Error','Could not fork link.');
                });
            }
        },
        buttons:{
            confirm:{
                label:'Fork'
            }
        }
    });
};

NodeActions.beforeTemplate = function(url, done) {
    $.ajax({
        url: url,
        contentType: 'application/json'
    }).done(function(response) {
        bootbox.confirm({
            message: $osf.joinPrompts(response.prompts,
                ('
Are you sure you want to create a new project using this project as a template?
' +
                '
Any add-ons configured for this project will not be authenticated in the new project.
')),
                //('Are you sure you want to create a new project using this project as a template? ' +
                //  'Any add-ons configured for this project will not be authenticated in the new project.')),
            callback: function (result) {
                if (result) {
                    done && done();
                }
            },
            buttons:{
                confirm:{
                    label:'Create'
                }
            }
        });
    });
};

NodeActions.redirectForkPage = function(){
    window.location.href = '/project/' + ctx.node.id + '/forks/';
    return true;
};

NodeActions.addonFileRedirect = function(item) {
    window.location.href = item.params.urls.view;
    return false;
};

NodeActions.useAsTemplate = function() {
    NodeActions.beforeTemplate('/project/new/' + ctx.node.id + '/beforeTemplate/', function () {
        $osf.block();

        $osf.postJSON(
            '/api/v1/project/new/' + ctx.node.id + '/',
            {}
        ).done(function(response) {
            window.location = response.url;
        }).fail(function(response) {
            $osf.unblock();
            $osf.handleJSONError(response);
        });
    });
};

NodeActions.reorderChildren = function(idList, elm) {
    $osf.postJSON(
        ctx.node.urls.api + 'reorder_components/',
        {new_list: idList}
    ).fail(function(response) {
        $(elm).sortable('cancel');
        $osf.handleJSONError(response);
    });
};

NodeActions.removePointer = function(pointerId, pointerElm) {
    $.ajax({
        type: 'DELETE',
        url: ctx.node.urls.api + 'pointer/',
        data: JSON.stringify({
            pointerId: pointerId
        }),
        contentType: 'application/json',
        dataType: 'json'
    }).done(function() {
        pointerElm.remove();
    }).fail(
        $osf.handleJSONError
    );
};

// TODO: remove this
$(document).ready(function() {
    var permissionInfoHtml = '
' +
        '
Read
' +
            '

View project content and comment

' +
        '
Read + Write
' +
            '

Read privileges
 ' +
                '
Add and configure components
 ' +
                '
Add and edit content

' +
        '
Administrator

' +
            '
Read and write privileges
' +
            '
Manage contributor
' +
            '
Delete and register project

Public-private settings

' +
        '
';

    $('.permission-info').attr(
        'data-content', permissionInfoHtml
    ).popover({
        trigger: 'hover'
    });

    var bibliographicContribInfoHtml = 'Only bibliographic contributors will be displayed ' +
           'in the Contributors list and in project citations. Non-bibliographic contributors ' +
            'can read and modify the project as normal.';

    $('.visibility-info').attr(
        'data-content', bibliographicContribInfoHtml
    ).popover({
        trigger: 'hover'
    });

    ////////////////////
    // Event Handlers //
    ////////////////////

    $('.remove-pointer').on('click', function() {
        var $this = $(this);
        bootbox.confirm({
            title: 'Remove this link?',
            message: 'Are you sure you want to remove this link? This will not remove the ' +
                'project this link refers to.',
            callback: function(result) {
                if(result) {
                    var pointerId = $this.attr('data-id');
                    var pointerElm = $this.closest('.list-group-item');
                    NodeActions.removePointer(pointerId, pointerElm);
                }
            },
            buttons:{
                    confirm:{
                        label:'Remove',
                        className:'btn-danger'
                    }
            }
        });
    });

    $('#citation-more').on('click', function() {
        var panel = $('#citationStylePanel');
        panel.slideToggle(200, function() {
            if (panel.is(':visible')) {
                $('#citationStyleInput').select2('open');
            }
        });
        return false;
    });

    $('body').on('click', '.tagsinput .tag > span', function(e) {
      if(e){
        window.location = '/search/?q=(tags:"' + $(e.target).text().toString().trim()+ '")';
      }
    });

    // Portlet feature for the dashboard, to be implemented in later versions.
    // $( ".osf-dash-col" ).sortable({
    //   connectWith: ".osf-dash-col",
    //   handle: ".addon-widget-header",
    //   cancel: ".pull-right",
    //   placeholder: "osf-dash-portlet ui-corner-all"
    // });

    // Adds active class to current menu item
    $(function () {
        var path = window.location.pathname;
        $('.project-nav a:not(#commentsLink)').each(function () {
            var href = $(this).attr('href');
            if (path === href ||
               (path.indexOf('files') > -1 && href.indexOf('files') > -1) ||
               (path.indexOf('wiki') > -1 && href.indexOf('wiki') > -1)) {
                $(this).closest('li').addClass('active');
            }
        });

        // Remove Comments link from project nav bar for pages not bound to the comment view model
        var commentsLinkElm = document.getElementById('commentsLink');
        if (commentsLinkElm) {
            if(!ko.dataFor(commentsLinkElm)) {
                commentsLinkElm.parentNode.removeChild(commentsLinkElm);
            }
        }
    });
});

window.NodeActions = NodeActions;
module.exports = NodeActions;
<|endoftext|>


<commit_before>// TODO: Build Config file for the prod/dist
<commit_msg>added prod config file<commit_after>var webpack = require('webpack');
var precss = require('precss');
var autoprefixer = require('autoprefixer');
var path = require('path');
var helpers = require('./helpers');

var ExtractTextPlugin = require('extract-text-webpack-plugin');
var BuildConfigPlugin = require('./build-config');

var ENV = process.env.ENV = process.env.NODE_ENV = 'development';

var metadata = {
  title: helpers.getPkg().name,
  baseUrl: '/',
  host: 'localhost',
  port: 3000,
  ENV: ENV
};
/*
 * Config
 */
module.exports = helpers.validate({
  // static data for index.html
  metadata: metadata,
  // for faster builds use 'eval'
  devtool: 'source-map',
  debug: true,

  // our angular app
  entry: {
    app: './src/boot.ts',
    vendor: './src/vendor.ts'
  },

  // Config for our build files
  output: {
    path: helpers.root('dist'),
    filename: '[name].bundle.js',
    sourceMapFilename: '[name].map'
  },

  resolve: {
    extensions: ['', '.ts', '.js']
  },

  module: {
    preLoaders: [
      {
        test: /\.ts$/,
        loader: 'tslint'
      }
    ],
    loaders: [
      // Support for .ts files.
      {
        test: /\.ts$/,
        loader: 'ts-loader',
        exclude: [/\.(spec|e2e)\.ts$/]
      },
      //Support for *.json files.
      {
        test: /\.json$/,
        loader: 'json-loader'
      },
      // Allows compiling sass into css
      {
        test: /\.scss$/,
        loader: ExtractTextPlugin.extract('style', 'css?sourceMap!postcss!sass')
      },
      //
      {
        test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)(\?.*$|$)/,
        loader: 'url-loader?limit=100000'
      },
      // Support for CSS as raw text
      {
        test: /\.css$/,
        loader: 'raw-loader'
      },
      // support for .html as raw text
      {
        test: /\.html$/,
        loader: 'raw-loader',
        exclude: [helpers.root('src/index.html')]
      }

    ],
    noParse: [path.join(__dirname, 'node_modules', 'angular2', 'bundles')]
  },

  plugins: [
    new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js'),
    new BuildConfigPlugin({
      env: helpers.getEnv(),
      from: './src/assets/configs/[env].json',
      to: './src/config.json'
    }),
    new webpack.BannerPlugin(helpers.getBanner()),
    // Reference: http://webpack.github.io/docs/list-of-plugins.html#noerrorsplugin
    // Only emit files when there are no errors
    new webpack.NoErrorsPlugin(),

    // Reference: http://webpack.github.io/docs/list-of-plugins.html#dedupeplugin
    // Dedupe modules in the output
    new webpack.optimize.DedupePlugin(),

    // Reference: http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
    // Minify all javascript, switch loaders to minimizing mode
    new webpack.optimize.UglifyJsPlugin()
  ],

  postcss: [
    autoprefixer({
      browsers: ['last 2 version']
    })
  ],

  // Other module loader config
  tslint: {
    emitErrors: false,
    failOnHint: false,
    resourcePath: 'src'
  },

  // our Webpack Development Server config
  devServer: {
    port: metadata.port,
    host: metadata.host,
    historyApiFallback: true,
    watchOptions: {aggregateTimeout: 300, poll: 1000}
  },
  // we need this due to problems with es6-shim
  node: {global: 'window', progress: false, crypto: 'empty', module: false, clearImmediate: false, setImmediate: false}
});
<|endoftext|>


<commit_before>
(function(window) {
	"use strict";

	var Fn      = window.Fn;
	var dom     = window.dom;
	var Sparky  = window.Sparky;
	var ga      = window.ga || Fn.noop;
	var rspaces = Fn.rspaces;

	function analyse(category, action, label, value) {
		ga('send', 'event', category, action, label, value);
	}

	function analyseTime(category, action, label, time) {
		// Time should be an integer, in milliseconds
		time = Math.round(time || window.performance.now());
		ga('send', 'timing', category, action, time, label);
	}

	Sparky.fn['analyse-on-click'] = function stickToTop(node, scopes) {
		node.addEventListener('click', function(e) {
			var node     = dom.closest('[data-analyse]', e.target);

			if (!node) {
				console.warn('Sparky: data-fn="analyse-on-click" requires data-analyse="category action label"');
				return;
			}

			var property = dom.attribute('data-analyse', node);
			var labels   = property.split(rspaces);

			analyse.apply(null, labels);
		});
	};

	Sparky.fn['analyse-on-change'] = function stickToTop(node, scopes) {
		node.addEventListener('change', function(e) {
			var node     = e.target;
			var property = dom.attribute('data-analyse', node);

			if (!property) {
				console.warn('Sparky: data-fn="analyse-on-change" requires data-analyse="category action label"');
				return;
			}

			var labels   = property.split(rspaces);

			analyse.apply(null, labels);
		});
	};
})(this);
<commit_msg>Add log<commit_after>
(function(window) {
	"use strict";

	var Fn      = window.Fn;
	var dom     = window.dom;
	var Sparky  = window.Sparky;
	var ga      = window.ga || Fn.noop;
	var rspaces = Fn.rspaces;

	function analyse(category, action, label, value) {
console.log(arguments);
		ga('send', 'event', category, action, label, value);
	}

	function analyseTime(category, action, label, time) {
		// Time should be an integer, in milliseconds
		time = Math.round(time || window.performance.now());
		ga('send', 'timing', category, action, time, label);
	}

	Sparky.fn['analyse-on-click'] = function stickToTop(node, scopes) {
		node.addEventListener('click', function(e) {
			var node     = dom.closest('[data-analyse]', e.target);

			if (!node) {
				console.warn('Sparky: data-fn="analyse-on-click" requires data-analyse="category action label"');
				return;
			}

			var property = dom.attribute('data-analyse', node);
			var labels   = property.split(rspaces);

			analyse.apply(null, labels);
		});
	};

	Sparky.fn['analyse-on-change'] = function stickToTop(node, scopes) {
		node.addEventListener('change', function(e) {
			var node     = e.target;
			var property = dom.attribute('data-analyse', node);

			if (!property) {
				console.warn('Sparky: data-fn="analyse-on-change" requires data-analyse="category action label"');
				return;
			}

			var labels   = property.split(rspaces);

			analyse.apply(null, labels);
		});
	};
})(this);
<|endoftext|>


<commit_before>
var input = "";
var notfunc = "";
var x = 10;

function evaluateThis(){
	input = document.getElementById("screen").innerHTML;
	while(replaceCaret(input))
	{
		//Do nothing.
		//This loops so that every caret is found and replaced.
	}
	var output = eval(input);
	document.getElementById("results").innerHTML = output;
}

function mapper(leftBound, rightBound, stepSize){
	var arrayMap = [];
	var y = 0;

	input = document.getElementById("screen").innerHTML;

	if(input=="")
	{
		return arrayMap;
	}

	notfunc = document.getElementById("screen").innerHTML;

	//Start at left bound, go to right bound in steps of size stepSize.
	for(i=leftBound; i<rightBound+stepSize; i+=stepSize)
	{

		var tuple = {};
		//This line assumes 'x' is used as the variable in the input from the html.
		x = i;

		while(replaceCaret(input))
		{
			//Do nothing.
			//This loops so that every caret is found and replaced.
		}

		y = eval(input);

		tuple.x = i;
		tuple.y = y
		arrayMap.push(tuple);

		input = notfunc;
	}

	return arrayMap;
}

//This function looks for carets, matches them to an x^a expression, and replaces that expression with its numerical value.
function replaceCaret(){
	var caretIndex = input.indexOf("^");
	if(caretIndex == -1)
	{
		//Since we found no caret, we return false.
		return false;
	}
	else
	{
		//startIndex will hold the starting index of the base x in the expression x^a
		//endIndex will hold the ending index of the exponent a in the expression x^a
		var startIndex = 0;
		var endIndex = input.length;

		//leftHand will hold the base x
		//rightHand will hold the exponent a
		//For now, each holds everything to the left or right of the caret in question.
		var leftHand = input.slice(startIndex, caretIndex);
		var rightHand = input.slice(caretIndex+1, endIndex);

/**		alert(leftHand);
		alert(rightHand);
**/
		//leftRemainder will hold whatever is to the left of the base
		//rightRemainder will hold whatever is to the right of the exponent
		var leftRemainder = "";
		var rightRemainder = "";

		//With these conditionals, we check for parentheses, whose operator precedence negates the need to search for a start/end index.
		if(input.charAt(caretIndex-1) == ')')
		{
			startIndex = leftHand.lastIndexOf('(');
		}
		else
		{
			startIndex = findStartIndex(caretIndex);
		}
		if(input.charAt(caretIndex+1) == '(')
		{
			endIndex = input.indexOf(')');
		}
		else
		{
			endIndex = findEndIndex(caretIndex);
		}

		//Here these strings are sliced apart into the base, the exponent, and everything before and after the x^a expression.
		leftRemainder = input.slice(0, startIndex);
		leftHand = input.slice(startIndex, caretIndex);
		rightHand = input.slice(caretIndex+1, endIndex+1);
		rightRemainder = input.slice(endIndex+1, input.length);

		//Here we evaluate the x^a expression.
		powerString = getPowerValue(leftHand, rightHand);

		//We rebuild the input string.
		input = leftRemainder + powerString + rightRemainder;

/**	These alerts are for testing the slicing above.
		alert(leftRemainder);
		alert(leftHand);
		alert(rightHand);
		alert(rightRemainder);
		alert(input);
**/
		//Since we found and replaced a caret, we return true.
		return true;
	}

}

//This function returns the index of the first number character AFTER one of these four operators.
function findStartIndex(caretIndex)
{
	var start = 0;

	for(i=caretIndex-1; i>-1; i--)
	{
		if (input.charAt(i)=='+' || input.charAt(i)=='-' || input.charAt(i)=='*' || input.charAt(i)=='/'|| input.charAt(i)=='(')
		{
			start = i+1;
			return start;
		}
	}

	return start;
}

//This function returns the index of the first number character BEFORE one of these four operators.
function findEndIndex(caretIndex)
{
	var end = input.length;

	for(i=caretIndex+1; i<input.length; i++)
	{
		if (input.charAt(i)=='+' || input.charAt(i)=='-' || input.charAt(i)=='*' || input.charAt(i)=='/'|| input.charAt(i)==')')
		{
			end = i-1;
			return end;
		}
	}

	return end;
}

//This function evaluates the x^a expression.
function getPowerValue(left, right)
{
	var powerValue = Math.pow(eval(left), eval(right));
	var powerString = powerValue.toString();
	return powerString;
}
<commit_msg>Delete Mapper.js<commit_after><|endoftext|>


<commit_before><commit_msg>Updated Buffer.js<commit_after><|endoftext|>


<commit_before>/**
* @license
* Copyright © 2016 Aeneas Kaiser, Andrea Bianco.
* This file is part of rti.js.
* rti.js is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* rti.js is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
* License along with rti.js. If not, see <http://www.gnu.org/licenses/>.
*/

/**
 * Pepresents a WebPTM. Holds rendering parameters, a multiresolution strategy
 * and a geometry on which the PTM will be rendered.
 *
 * @class
 * @param {PTMReference} ptmReference - A PTMReference linking to the WebPTM
 *  data which should be rendered.
 *
 * @property {THREE.Vector3} kRGB - scaling factor color (componentwise).
 * @property {float} kd -  scaling factor diffuse term.
 * @property {float} flatGSpecular - constant specularity.
 * @property {float} ks - scaling factor LRGBG specularity map.
 * @property {float} alpha - exponent specular term.
 * @property {int} gChannel - index for RGB-channel of specularity map.
 * @property {float} scale - scaling factor LRGB coefficients.
 * @property {float} bias - bias LRGB coefficients.
 * @property {float} scaleSpecular - scaling factor LRGBG coefficients.
 * @property {float} biasSpecular - bias LRGBG coefficients.
 * @property {int} orientation - index rotation PTM display vs capturing.
 * @property {THREE.Vector2} mirror - index mirror PTM display vs capturing.
 * @property {int} debugMode - flag debugMode shader.
 *
 */
function PTM(ptmReference) {
  this.kRGB = null;
  this.kd = 0;
  this.flatGSpecular = 0;
  this.ks = 0;
  this.alpha = 0;
  this.gChannel = 0;
  this.scale = [];
  this.bias = [];
  this.scaleSpecular = [];
  this.biasSpecular = [];
  this.orientation = 0;
  this.mirror = null;
  this.debugMode = 0;

  this._ptmType = "";
  this._geometryType = "";
  this._ptmContentWidth = 0;
  this._ptmContentHeight = 0;
  this._numberCoeffs = 0;

  this.renderObject = null;

  this._multiresTree = null;
  this._activeTiles = [];

  this._vShader = null;
  this._fShader = null;

  this.initialized = this._load(ptmReference);
  return this;
} // PTM

PTM.prototype = {
  _load: function(ptmReference) {
   if (typeof(RTI_SHOW_BSPHERES) == "undefined") {
      RTI_SHOW_BSPHERES = false;
    }

    var config;
    if (ptmReference.config) {
      config = ptmReference.config;
      console.log("PTM.load: config embedded in PTMReference");
    } else {
      config = RTIUtils.getPTMConfiguration(ptmReference.configURL);
      console.log("PTM.load: configURL: "+ ptmReference.configURL);
      if (!config)
        return false;
    }

    if (!this._applyConfig(config))
      return false;

    this.mirror = new THREE.Vector2(0, 0);

    if (!this._loadShader(ptmReference.shaderReference))
      return false;

    this._multiresTree = new MultiresTree(config, ptmReference.imgURLPrefixes, this, 7.5); // MAGIC_VALUE

    this.debugMode = 0;
    this.kRGB = new THREE.Vector3( 1, 1, 1 );
    this.kd = 0.4;
    this.ks = 0.0;
    this.alpha = 75;
    this.flatGSpecular = 0;

    if (this._ptmType == "LRGBG_PTM") {
      this.ks = 0.7;
      this.gChannel = 2;
    }

    this.renderObject = new THREE.Object3D();

    return true;
  },

/**
 * Free all resources attached to the PTM.
 */
  dispose: function() {
    this._removeActiveTiles();
    if (this._multiresTree)
    this._multiresTree.dispose();
    this._multiresTree = null;
  },

/**
 * Updates the active tiles of the PTM to account for the current viewport
 * defined by a camera and a screen resolution.
 *
 * @param {THREE.Vector2} screenRes - The current screen resolution
 * @param {THREE.Camera} camera - The current camera defining the viewport.
 */
  updateTiles: function(screenRes, camera) {
    this._removeActiveTiles();
    this._activeTiles = this._multiresTree.getAvailableTiles(screenRes, camera);
    this._addActiveTiles();
  },

/**
 * Updates the rendering paramters of the PTM by passing them to the shader.
 *
 * @param {THREE.Vector3} lDir - The current light direction
 */
  renderUpdate: function(lDir, H, directionalLightCol, ambientLightCol){
    for (var t = 0; t< this._activeTiles.length; t++){
        if (!this._activeTiles[t].loadError && this._activeTiles[t].hasContent) {
        this._activeTiles[t].material.uniforms.debugMode.value = this.debugMode;
        this._activeTiles[t].material.uniforms.kRGB.value = this.kRGB;
        this._activeTiles[t].material.uniforms.kd.value = this.kd;
        this._activeTiles[t].material.uniforms.alpha.value = this.alpha;
        this._activeTiles[t].material.uniforms.flatGSpecular.value = this.flatGSpecular;

        this._activeTiles[t].material.uniforms.orientation.value = this.orientation;
        this._activeTiles[t].material.uniforms.mirror.value = this.mirror;

        this._activeTiles[t].material.uniforms.lDir.value = lDir;
        this._activeTiles[t].material.uniforms.H.value = H;
        this._activeTiles[t].material.uniforms.ambientLightCol.value = ambientLightCol;
        this._activeTiles[t].material.uniforms.directionalLightCol.value = directionalLightCol;

        if (this._ptmType == "LRGBG_PTM") {
          this._activeTiles[t].material.uniforms.ks.value = this.ks;
          this._activeTiles[t].material.uniforms.gChannel.value = this.gChannel;
        }
      }
    }
  },

/**
 * Requests all unloaded tiles necessary for the current viewport defined by a
 * camera and a screen resolution.
 *
 * @param {THREE.Vector2} screenRes - The current screen resolution
 * @param {THREE.Camera} camera - The current camera defining the viewport.
 */
  requestTextures: function(screenRes, camera){
    this._multiresTree.requestTextures(screenRes, camera);
  },

/**
 * Returns a mesh representing the PTM in the scene.
 * The returned mesh should only be used for geometric computations such as
 * picking or visibility checks.
 * The returned mesh is usually not the mesh used for actual rendering.
 * @returns {THREE.Mesh} - a mesh representing the PTM in the scene.
 */
  getMesh: function() {
    return this._multiresTree.getMesh();
  },

/**
 * Loads a different shader.
 *
 * @param {ShaderReference} shaderReference - A ShaderReference linking to the
 * shader which should be loaded.
 */
  loadShader: function(shaderReference) {
    this._removeActiveTiles();
    if (!this._loadShader(shaderReference)) {
      return false;
    } else {
      this._multiresTree.updateShaders(this._vShader, this._fShader);
      this._addActiveTiles();
      return true;
    }
  },

/**
 * Returns the ShaderReference for the currently used shader.
 *
 * @returns {ShaderReference}
 */
 getShaderRef: function() {
    return this._currentShaderRef;
  },

/**
 * Returns the shader source for the currently used vertex shader.
 *
 * @returns {string}
 */
 getVShader: function() {
    return this._vShader;
  },

/**
 * Returns the shader source for the currently used fragment shader.
 *
 * @returns {string}
 */
 getFShader: function() {
    return this._fShader;
  },

/**
 * Returns the PTM type.
 *
 * @returns {string}
 */
  getPTMType: function() {
    return this._ptmType;
  },

  /**
 * Returns the PTM type.
 *
 * @returns {string}
 */
  getGeometryType: function() {
    return this._geometryType;
  },

  getCenterPosition: function() {
    return this._multiresTree.getCenterPosition();
  },

  _addActiveTiles: function() {
    for (var t = 0; t<this._activeTiles.length; t++){
      this.renderObject.add(this._activeTiles[t].renderObject);
      if (RTI_SHOW_BSPHERES)
        this.renderObject.add(this._activeTiles[t].bSphereMesh); // debug
    }
  },

  _removeActiveTiles: function() {
    for (var t = 0; t<this._activeTiles.length; t++) {
       this.renderObject.remove(this._activeTiles[t].renderObject);
      if (RTI_SHOW_BSPHERES)
         this.renderObject.remove(this._activeTiles[t].bSphereMesh);
    }
  },

  _loadShader: function(shaderReference) {
    if (shaderReference.supportedGeometries.indexOf(this._geometryType) > -1) {
      var vShaderRequest = RTIUtils.sendSyncRequest(shaderReference.vShaderURL);
      if (vShaderRequest.status >= 400) {
        return RTIError("PTM._loadShader: Unable to load shader from " + shaderReference.vShaderURL);
      }
      this._vShader = vShaderRequest.responseText;

      var fShaderRequest = RTIUtils.sendSyncRequest(shaderReference.fShaderURL);
      if (fShaderRequest.status >= 400) {
        return RTIError("PTM._loadShader: Unable to load shader from " + shaderReference.fShaderURL);
      }
      this._fShader = fShaderRequest.responseText;

      if (this._fShader.indexOf("// !# include utils") > -1) {
        var utilsShaderReq = RTIUtils.sendSyncRequest(shaderReference.utilsShaderURL);
        if (utilsShaderReq.status >= 400) {
          return RTIError("PTM._loadShader: Unable to load shader from " + shaderReference.utilsShaderURL);
        }
        var utilsShader = utilsShaderReq.responseText;
        this._fShader = this._fShader.replace("// !# include utils", utilsShader);
      }

      this._currentShaderRef = shaderReference;
      return true;
    } else
      return RTIError("PTM._loadShader: Requested shader does not support geometry type of current PTM");
  },

  _applyConfig: function(config) {
        var ptmConfig = config.PTM;
        var geometryConfig = config.Geometry;

        this._ptmType = ptmConfig.type;
        if (!(this._ptmType == "LRGBG_PTM" || this._ptmType == "LRGB_PTM")) {
          return RTIError("PTM._applyConfig: unsupported ptm type: " + this._ptmType);
        }

        this._geometryType = geometryConfig.type;

        this._ptmContentWidth = ptmConfig.contentSize.w;
        this._ptmContentHeight = ptmConfig.contentSize.h;

        if (this._ptmType == "LRGBG_PTM")
        this._numberCoeffs = 9;
        else if (this._ptmType == "LRGB_PTM")
        this._numberCoeffs = 6;

        this.scale = ptmConfig.scale.slice(0, 6);
        this.bias = ptmConfig.bias.slice(0, 6);

        if (this._ptmType == "LRGBG_PTM") {
          this.scaleSpecular = ptmConfig.scale.slice(6,9);
          this.biasSpecular = ptmConfig.bias.slice(6,9);
        }

        this.orientation = ptmConfig.orientation;
        return true;
  }
}; // PTM prototype
<commit_msg>[ADD] add bias16 flag to PTMConfiguration<commit_after>/**
* @license
* Copyright © 2016 Aeneas Kaiser, Andrea Bianco.
* This file is part of rti.js.
* rti.js is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* rti.js is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public
* License along with rti.js. If not, see <http://www.gnu.org/licenses/>.
*/

/**
 * Pepresents a WebPTM. Holds rendering parameters, a multiresolution strategy
 * and a geometry on which the PTM will be rendered.
 *
 * @class
 * @param {PTMReference} ptmReference - A PTMReference linking to the WebPTM
 *  data which should be rendered.
 *
 * @property {THREE.Vector3} kRGB - scaling factor color (componentwise).
 * @property {float} kd -  scaling factor diffuse term.
 * @property {float} flatGSpecular - constant specularity.
 * @property {float} ks - scaling factor LRGBG specularity map.
 * @property {float} alpha - exponent specular term.
 * @property {int} gChannel - index for RGB-channel of specularity map.
 * @property {float} scale - scaling factor LRGB coefficients.
 * @property {float} bias - bias LRGB coefficients.
 * @property {float} scaleSpecular - scaling factor LRGBG coefficients.
 * @property {float} biasSpecular - bias LRGBG coefficients.
 * @property {int} orientation - index rotation PTM display vs capturing.
 * @property {THREE.Vector2} mirror - index mirror PTM display vs capturing.
 * @property {int} debugMode - flag debugMode shader.
 *
 */
function PTM(ptmReference) {
  this.kRGB = null;
  this.kd = 0;
  this.flatGSpecular = 0;
  this.ks = 0;
  this.alpha = 0;
  this.gChannel = 0;
  this.scale = [];
  this.bias = [];
  this.scaleSpecular = [];
  this.biasSpecular = [];
  this.orientation = 0;
  this.mirror = null;
  this.debugMode = 0;

  this._ptmType = "";
  this._geometryType = "";
  this._ptmContentWidth = 0;
  this._ptmContentHeight = 0;
  this._numberCoeffs = 0;

  this.renderObject = null;

  this._multiresTree = null;
  this._activeTiles = [];

  this._vShader = null;
  this._fShader = null;

  this.initialized = this._load(ptmReference);
  return this;
} // PTM

PTM.prototype = {
  _load: function(ptmReference) {
   if (typeof(RTI_SHOW_BSPHERES) == "undefined") {
      RTI_SHOW_BSPHERES = false;
    }

    var config;
    if (ptmReference.config) {
      config = ptmReference.config;
      console.log("PTM.load: config embedded in PTMReference");
    } else {
      config = RTIUtils.getPTMConfiguration(ptmReference.configURL);
      console.log("PTM.load: configURL: "+ ptmReference.configURL);
      if (!config)
        return false;
    }

    if (!this._applyConfig(config))
      return false;

    this.mirror = new THREE.Vector2(0, 0);

    if (!this._loadShader(ptmReference.shaderReference))
      return false;

    this._multiresTree = new MultiresTree(config, ptmReference.imgURLPrefixes, this, 7.5); // MAGIC_VALUE

    this.debugMode = 0;
    this.kRGB = new THREE.Vector3( 1, 1, 1 );
    this.kd = 0.4;
    this.ks = 0.0;
    this.alpha = 75;
    this.flatGSpecular = 0;

    if (this._ptmType == "LRGBG_PTM") {
      this.ks = 0.7;
      this.gChannel = 2;
    }

    this.renderObject = new THREE.Object3D();

    return true;
  },

/**
 * Free all resources attached to the PTM.
 */
  dispose: function() {
    this._removeActiveTiles();
    if (this._multiresTree)
    this._multiresTree.dispose();
    this._multiresTree = null;
  },

/**
 * Updates the active tiles of the PTM to account for the current viewport
 * defined by a camera and a screen resolution.
 *
 * @param {THREE.Vector2} screenRes - The current screen resolution
 * @param {THREE.Camera} camera - The current camera defining the viewport.
 */
  updateTiles: function(screenRes, camera) {
    this._removeActiveTiles();
    this._activeTiles = this._multiresTree.getAvailableTiles(screenRes, camera);
    this._addActiveTiles();
  },

/**
 * Updates the rendering paramters of the PTM by passing them to the shader.
 *
 * @param {THREE.Vector3} lDir - The current light direction
 */
  renderUpdate: function(lDir, H, directionalLightCol, ambientLightCol){
    for (var t = 0; t< this._activeTiles.length; t++){
        if (!this._activeTiles[t].loadError && this._activeTiles[t].hasContent) {
        this._activeTiles[t].material.uniforms.debugMode.value = this.debugMode;
        this._activeTiles[t].material.uniforms.kRGB.value = this.kRGB;
        this._activeTiles[t].material.uniforms.kd.value = this.kd;
        this._activeTiles[t].material.uniforms.alpha.value = this.alpha;
        this._activeTiles[t].material.uniforms.flatGSpecular.value = this.flatGSpecular;

        this._activeTiles[t].material.uniforms.orientation.value = this.orientation;
        this._activeTiles[t].material.uniforms.mirror.value = this.mirror;

        this._activeTiles[t].material.uniforms.lDir.value = lDir;
        this._activeTiles[t].material.uniforms.H.value = H;
        this._activeTiles[t].material.uniforms.ambientLightCol.value = ambientLightCol;
        this._activeTiles[t].material.uniforms.directionalLightCol.value = directionalLightCol;

        if (this._ptmType == "LRGBG_PTM") {
          this._activeTiles[t].material.uniforms.ks.value = this.ks;
          this._activeTiles[t].material.uniforms.gChannel.value = this.gChannel;
        }
      }
    }
  },

/**
 * Requests all unloaded tiles necessary for the current viewport defined by a
 * camera and a screen resolution.
 *
 * @param {THREE.Vector2} screenRes - The current screen resolution
 * @param {THREE.Camera} camera - The current camera defining the viewport.
 */
  requestTextures: function(screenRes, camera){
    this._multiresTree.requestTextures(screenRes, camera);
  },

/**
 * Returns a mesh representing the PTM in the scene.
 * The returned mesh should only be used for geometric computations such as
 * picking or visibility checks.
 * The returned mesh is usually not the mesh used for actual rendering.
 * @returns {THREE.Mesh} - a mesh representing the PTM in the scene.
 */
  getMesh: function() {
    return this._multiresTree.getMesh();
  },

/**
 * Loads a different shader.
 *
 * @param {ShaderReference} shaderReference - A ShaderReference linking to the
 * shader which should be loaded.
 */
  loadShader: function(shaderReference) {
    this._removeActiveTiles();
    if (!this._loadShader(shaderReference)) {
      return false;
    } else {
      this._multiresTree.updateShaders(this._vShader, this._fShader);
      this._addActiveTiles();
      return true;
    }
  },

/**
 * Returns the ShaderReference for the currently used shader.
 *
 * @returns {ShaderReference}
 */
 getShaderRef: function() {
    return this._currentShaderRef;
  },

/**
 * Returns the shader source for the currently used vertex shader.
 *
 * @returns {string}
 */
 getVShader: function() {
    return this._vShader;
  },

/**
 * Returns the shader source for the currently used fragment shader.
 *
 * @returns {string}
 */
 getFShader: function() {
    return this._fShader;
  },

/**
 * Returns the PTM type.
 *
 * @returns {string}
 */
  getPTMType: function() {
    return this._ptmType;
  },

  /**
 * Returns the PTM type.
 *
 * @returns {string}
 */
  getGeometryType: function() {
    return this._geometryType;
  },

  getCenterPosition: function() {
    return this._multiresTree.getCenterPosition();
  },

  _addActiveTiles: function() {
    for (var t = 0; t<this._activeTiles.length; t++){
      this.renderObject.add(this._activeTiles[t].renderObject);
      if (RTI_SHOW_BSPHERES)
        this.renderObject.add(this._activeTiles[t].bSphereMesh); // debug
    }
  },

  _removeActiveTiles: function() {
    for (var t = 0; t<this._activeTiles.length; t++) {
       this.renderObject.remove(this._activeTiles[t].renderObject);
      if (RTI_SHOW_BSPHERES)
         this.renderObject.remove(this._activeTiles[t].bSphereMesh);
    }
  },

  _loadShader: function(shaderReference) {
    if (shaderReference.supportedGeometries.indexOf(this._geometryType) > -1) {
      var vShaderRequest = RTIUtils.sendSyncRequest(shaderReference.vShaderURL);
      if (vShaderRequest.status >= 400) {
        return RTIError("PTM._loadShader: Unable to load shader from " + shaderReference.vShaderURL);
      }
      this._vShader = vShaderRequest.responseText;

      var fShaderRequest = RTIUtils.sendSyncRequest(shaderReference.fShaderURL);
      if (fShaderRequest.status >= 400) {
        return RTIError("PTM._loadShader: Unable to load shader from " + shaderReference.fShaderURL);
      }
      this._fShader = fShaderRequest.responseText;

      if (this._fShader.indexOf("// !# include utils") > -1) {
        var utilsShaderReq = RTIUtils.sendSyncRequest(shaderReference.utilsShaderURL);
        if (utilsShaderReq.status >= 400) {
          return RTIError("PTM._loadShader: Unable to load shader from " + shaderReference.utilsShaderURL);
        }
        var utilsShader = utilsShaderReq.responseText;
        this._fShader = this._fShader.replace("// !# include utils", utilsShader);
      }

      this._currentShaderRef = shaderReference;
      return true;
    } else
      return RTIError("PTM._loadShader: Requested shader does not support geometry type of current PTM");
  },

  _applyConfig: function(config) {
        var ptmConfig = config.PTM;
        var geometryConfig = config.Geometry;

        this._ptmType = ptmConfig.type;
        if (!(this._ptmType == "LRGBG_PTM" || this._ptmType == "LRGB_PTM")) {
          return RTIError("PTM._applyConfig: unsupported ptm type: " + this._ptmType);
        }

        this._geometryType = geometryConfig.type;

        this._ptmContentWidth = ptmConfig.contentSize.w;
        this._ptmContentHeight = ptmConfig.contentSize.h;

        if (this._ptmType == "LRGBG_PTM")
        this._numberCoeffs = 9;
        else if (this._ptmType == "LRGB_PTM")
        this._numberCoeffs = 6;

        this.scale = ptmConfig.scale.slice(0, 6);
        this.bias = ptmConfig.bias.slice(0, 6);

        if (this._ptmType == "LRGBG_PTM") {
          this.scaleSpecular = ptmConfig.scale.slice(6,9);
          this.biasSpecular = ptmConfig.bias.slice(6,9);
        }

        if (ptmConfig.bias16) {
          for (var b = 0; b < this.bias.length; b++) {
            this.bias[b] = this.bias[b]/256;
          }
        }

        this.orientation = ptmConfig.orientation;
        return true;
  }
}; // PTM prototype
<|endoftext|>


<commit_before>//This is the title for your window tab, and your Radar
document.title = "WotifGroup's Technology Radar (December 2014)";

//This is the concentic circles that want on your radar
var radar_arcs = [
                   {'r':100,'name':'Adopt'}
                  ,{'r':200,'name':'Trial'}
                  ,{'r':300,'name':'Assess'}
                  ,{'r':400,'name':'Hold'}
                 // ,{'r':500,'name':'Possible Extra if you want it'}
                 ];

//This is your raw data
//
// Key
//
// movement:
//   t = moved
//   c = stayed put
//
// blipSize:
//  intValue; This is optional, if you omit this property, then your blip will be size 70.
//            This give you the ability to be able to indicate information by blip size too
//
// url:
// StringValue : This is optional, If you add it then your blips will be clickable to some URL
//
// pc: polar coordinates
//     r = distance away from origin ("radial coordinate")
//     - Each level is 100 points away from origin
//     t = angle of the point from origin ("angular coordinate")
//     - 0 degrees is due east
//
// Coarse-grained quadrants
// - Techniques: elements of a software development process, such as experience design; and ways of structuring software, such micro-services.
// - Tools: components, such as databases, software development tools, such as versions control systems; or more generic categories of tools, such as the notion of polyglot persistance.
// - Platforms: things that we build software on top of: mobile technologies like Android, virtual platforms like the JVM, or generic kinds of platforms like hybrid clouds
// - Programming Languages and Frameworks
//
// Rings:
// - Adopt: blips you should be using now; proven and mature for use
// - Trial: blips ready for use, but not as completely proven as those in the adopt ring; use on a trial basis, to decide whether they should be part of your toolkit
// - Assess: things that you should look at closely, but not necessarily trial yet - unless you think they would be a particularly good fit for you
// - Hold: things that are getting attention in the industry, but not ready for use; sometimes they are not mature enough yet, sometimes they are irredeemably flawed
//      Note: there's no "avoid" ring, but throw things in the hold ring that people shouldn't use.

var h = 1600;
var w = 1200;

var radar_data = [
    { "quadrant": "Techniques",
        "left" : 45,
        "top" : 18,
        "color" : "#8FA227",
        "items" : [
            {"name":"Clean Code", "pc":{"r":130,"t":110},"movement":"c"},
            {"name":"Build Pipelines", "pc":{"r":180,"t":100},"movement":"c"},
            {"name":"Sacrificial Architecture", "pc":{"r":80,"t":100},"movement":"c"},
            {"name":"Data Informed Decion Making", "pc":{"r":130,"t":110},"movement":"c"},
            {"name":"Coding architects", "pc":{"r":90,"t":170},"movement":"c"},
            {"name":"Code Reviews", "pc":{"r":110,"t":110},"movement":"c"},
            {"name":"Polygot Programming", "pc":{"r":180,"t":170},"movement":"c"},
            {"name":"Evolutionary architecture", "pc":{"r":120,"t":95},"movement":"c"},
            {"name":"SaaS for non-core systems", "pc":{"r":270,"t":170},"movement":"c"},
            {"name":"Incremental data warehousing", "pc":{"r":250,"t":165},"movement":"c"},
            {"name":"Property based testing", "pc":{"r":130,"t":165},"movement":"c"},
            {"name":"Pair Programming", "pc":{"r":230,"t":170},"movement":"c"},
            {"name":"iOS Accessibility", "pc":{"r":170,"t":110},"movement":"c"},
            {"name":"iOS Adaptivity", "pc":{"r":180,"t":105},"movement":"c"},
            {"name":"Wide and Thin Front-Ends", "pc":{"r":130,"t":160},"movement":"c"},
            {"name":"Edge Services", "pc":{"r":130,"t":160},"movement":"c"},
            {"name":"Single Page App", "pc":{"r":350,"t":95},"movement":"c", "url":"http://www.google.com"},
            {"name":"Zookeeper for App Config", "pc":{"r":130,"t":130},"movement":"c"},
            {"name":"Events for messages - CQRS", "pc":{"r":225,"t":120},"movement":"c"},
            {"name":"Measure Pipeline disruptions", "pc":{"r":280,"t":110},"movement":"c"},
            {"name":"Isolated dev envs", "pc":{"r":180,"t":125},"movement":"c"},
            {"name":"Valuable, cheap tests", "pc":{"r":130,"t":150},"movement":"c"},
            {"name":"Sensible defaults", "pc":{"r":80,"t":150},"movement":"c"},
            {"name":"Continuous Experimentation", "pc":{"r":230,"t":110},"movement":"c"},
            { name: 'Reduce iRules dependence ^', pc: { r: 280, t: 133 }, movement: 'c' },
            { name: 'internal load balancing off F5^', pc: { r: 180, t: 133 }, movement: 'c' },
            { name: 'Git flow / Pull Requests ^', pc: { r: 230, t: 133 }, movement: 'c' }

        ]
    },
    { "quadrant": "Tools",
        "left": w-200+30,
        "top" : 18,
        "color" : "#587486",
        "items" : [

{ name: 'Docker',
    pc: { r: 170, t: 19 },
    movement: 't' },
  { name: 'Xamarin',
    pc: { r: 280, t: 51 },
    movement: 'c' },
  { name: 'Android Annotations',
    pc: { r: 280, t: 25 },
    movement: 'c' },
  { name: 'bind',
    pc: { r: 150, t: 69 },
    movement: 'c' },
  { name: 'Appium',
    pc: { r: 110, t: 70 },
    movement: 'c',
    domain: 'mobile, front-end' },
  { name: 'GenyMotion',
    pc: { r: 310, t: 31 },
    movement: 'c' },
 { name: 'Android Studio',
    pc: { r: 180, t: 66 },
    movement: 'c',
    domain: 'mobile, dev' },
  { name: 'Responsive Android',
    pc: { r: 150, t: 14 },
    movement: 'c' },
  { name: 'AutoLayout - iOS',
    pc: { r: 180, t: 55 },
    movement: 'c',
    domain: '' },
  { name: 'Kiwi - iOS unit test',
    pc: { r: 120, t: 14 },
    movement: 'c',
    domain: '' },
  { name: 'BEM',
    pc: { r: 160, t: 60 },
    movement: 'c',
    domain: 'front-end' },
  { name: 'Crashlytics',
    pc: { r: 180, t: 5 },
    movement: 'c',
    domain: 'mobile' },
  { name: 'Kafka',
    pc: { r: 12, t: 25 },
    movement: 'c',
    domain: 'back-end' },
  { name: 'ELK',
    pc: { r: 30, t: 72 },
    movement: 'c',
    domain: 'back-end' },
  { name: 'Consul',
    pc: { r: 170, t: 29 },
    movement: 't' },
  { name: 'Ansible',
    pc: { r: 280, t: 74 },
    movement: 'c' },
  { name: 'mongoDB',
    pc: { r: 330, t: 5 },
    movement: 'c' },
  { name: 'Liquibase',
    pc: { r: 80, t: 76 },
    movement: 'c' },
  { name: 'haproxy',
    pc: { r: 80, t: 46 },
    movement: 'c' },
  { name: 'Git',
    pc: { r: 130, t: 73 },
    movement: 'c' },
  { name: 'Subversion',
    pc: { r: 30, t: 18 },
    movement: 'c' },
  { name: 'Hip Chat',
    pc: { r: 280, t: 78 },
    movement: 'c' },
  { name: 'Trello',
    pc: { r: 260, t: 75 },
    movement: 'c' },
  { name: 'Charles HTTP Proxy',
    pc: { r: 260, t: 48 },
    movement: 'c' },
  { name: 'Swagger Code-Gen',
    pc: { r: 180, t: 82 },
    movement: 'c' },
  { name: 'PowerMock ^',
    pc: { r: 180, t: 46 },
    movement: 'c' },
  { name: 'Mockito',
    pc: { r: 170, t: 84 },
    movement: 'c',
    domain: 'back-end' },
  { name: 'JDBI ^',
    pc: { r: 80, t: 56 },
    movement: 'c' },
  { name: 'Hibernate ^',
    pc: { r: 380, t: 56 },
    movement: 'c' },
  { name: 'Json Web Tokens (JWT)',
    pc: { r: 180, t: 77 },
    movement: 'c' },
  { name: 'Lemming',
    pc: { r: 160, t: 82 },
    movement: 'c' },
  { name: 'AppManager ^',
    pc: { r: 360, t: 82 },
    movement: 'c' },
  { name: 'Hystrix',
    pc: { r: 150, t: 36 },
    movement: 'c' }
   ]
    },
    { "quadrant": "Platforms",
        "left" :45,
         "top" : (h/2 + 18),
        "color" : "#DC6F1D",
        "items" : [
            {"name":"App containers", "pc":{"r":250,"t":260},"movement":"c"},
            {"name":"Openstack", "pc":{"r":190,"t":190},"movement":"c"},
            {"name":"RHEL 7", "pc":{"r":170,"t":215},"movement":"c"},
            {"name":"RHEL 5", "pc":{"r":370,"t":195},"movement":"c"},
            {"name":"Google Cloud Data Flow", "pc":{"r":275,"t":260},"movement":"t"},
            {"name":"MS SqlServer", "pc":{"r":390,"t":190},"movement":"c"},
            { name: 'Postgres as NoSQL',
              pc: { r: 220, t: 255 },
              movement: 'c' },
            {"name":"AWS", "pc":{"r":90,"t":250},"movement":"c"},
            {"name":"Azure", "pc":{"r":290,"t":265},"movement":"c"},
            { name: 'Mesos',
              pc: { r: 260, t: 265 },
              movement: 't' },
            { name: 'Marathon',
              pc: { r: 240, t: 268 },
              movement: 't' },
            { name: 'Kubernetes',
              pc: { r: 270, t: 236 },
              movement: 't' },
            { name: 'BigIP v11',
              pc: { r: 50, t: 257 },
              movement: 'c' },
            {"name":"Google App Engine", "pc":{"r":290,"t":255},"movement":"c"},
            {"name":"Google as corporate platform", "pc":{"r":290,"t":200},"movement":"c"},
            {"name":"Java EE - the Bad Parts", "pc":{"r":390,"t":245},"movement":"c"},
            {"name":"OpenId Connect", "pc":{"r":130,"t":260},"movement":"t"},
            {"name":"Location based services", "pc":{"r":130,"t":230},"movement":"c"},
            {"name":"JVM as platform", "pc":{"r":90,"t":265},"movement":"c"},
            {"name":"Ruby On Rails", "pc":{"r":390,"t":215},"movement":"c"},
            {"name":"Everest", "pc":{"r":390,"t":185},"movement":"c"},
            {"name":"Magnolia CMS", "pc":{"r":390,"t":235},"movement":"c"},
            {"name":"Wotif-Standards mvn modules ^", "pc":{"r":270,"t":215},"movement":"c"},
            {"name":"Google Play - (alpha/beta builds)", "pc":{"r":30,"t":225},"movement":"c"}
        ]
    },
    { "quadrant": "Languages & Frameworks",
        "color" : "#B70062",
        "left"  : (w-200+30),
        "top" :   (h/2 + 18),
        "items" : [
            {"name":"Java 8", "pc":{"r":130,"t":355},"movement":"c"},
            {"name":"Java 6 and earlier", "pc":{"r":390,"t":350},"movement":"c"},
            {"name":"Swift", "pc":{"r":280,"t":300},"movement":"c"},
            {"name":"Scala - the good parts ^", "pc":{"r":290,"t":320},"movement":"c"},
            {"name":"Serverside Javascript", "pc":{"r":220,"t":275},"movement":"c"},
            {"name":"Coffeescript", "pc":{"r":270,"t":282},"movement":"c"},
            {"name":"Functional Reactive Programming", "pc":{"r":285,"t":330},"movement":"c"},
            {"name":"Clojure", "pc":{"r":280,"t":310},"movement":"c"},
            {"name":"Groovy ^", "pc":{"r":190,"t":280},"movement":"c"},
            {"name":"Web Objects", "pc":{"r":390,"t":290},"movement":"c"},
            {"name":"ASP Classic", "pc":{"r":375,"t":330},"movement":"c"},
            { name: 'CDI', pc: { r: 160, t: 290 },  movement: 'c' },
            { name: 'Jersey', pc: { r: 160, t: 310 },  movement: 'c' },
            { name: 'Spring', pc: { r: 160, t: 330 },  movement: 'c' },
            { name: 'Guice', pc: { r: 160, t: 278 },  movement: 'c' },
            { name: 'Mustache/Handlebars template',
              pc: { r: 50, t: 298 },
              movement: 'c',
              domain: 'template' },
            { name: 'RxJava',
              pc: { r: 150, t: 298 },
              movement: 'c',
              domain: 'template' },
            { name: 'RxJs',
              pc: { r: 250, t: 338 },
              movement: 'c',
              domain: 'template' },
            { name: 'Web Components', pc: { r: 260, t: 330 },  movement: 'c' }

        ]
    }
];
<commit_msg>add AWS<commit_after>//This is the title for your window tab, and your Radar
document.title = "WotifGroup's Technology Radar (December 2014)";

//This is the concentic circles that want on your radar
var radar_arcs = [
                   {'r':100,'name':'Adopt'}
                  ,{'r':200,'name':'Trial'}
                  ,{'r':300,'name':'Assess'}
                  ,{'r':400,'name':'Hold'}
                 // ,{'r':500,'name':'Possible Extra if you want it'}
                 ];

//This is your raw data
//
// Key
//
// movement:
//   t = moved
//   c = stayed put
//
// blipSize:
//  intValue; This is optional, if you omit this property, then your blip will be size 70.
//            This give you the ability to be able to indicate information by blip size too
//
// url:
// StringValue : This is optional, If you add it then your blips will be clickable to some URL
//
// pc: polar coordinates
//     r = distance away from origin ("radial coordinate")
//     - Each level is 100 points away from origin
//     t = angle of the point from origin ("angular coordinate")
//     - 0 degrees is due east
//
// Coarse-grained quadrants
// - Techniques: elements of a software development process, such as experience design; and ways of structuring software, such micro-services.
// - Tools: components, such as databases, software development tools, such as versions control systems; or more generic categories of tools, such as the notion of polyglot persistance.
// - Platforms: things that we build software on top of: mobile technologies like Android, virtual platforms like the JVM, or generic kinds of platforms like hybrid clouds
// - Programming Languages and Frameworks
//
// Rings:
// - Adopt: blips you should be using now; proven and mature for use
// - Trial: blips ready for use, but not as completely proven as those in the adopt ring; use on a trial basis, to decide whether they should be part of your toolkit
// - Assess: things that you should look at closely, but not necessarily trial yet - unless you think they would be a particularly good fit for you
// - Hold: things that are getting attention in the industry, but not ready for use; sometimes they are not mature enough yet, sometimes they are irredeemably flawed
//      Note: there's no "avoid" ring, but throw things in the hold ring that people shouldn't use.

var h = 1600;
var w = 1200;

var radar_data = [
    { "quadrant": "Techniques",
        "left" : 45,
        "top" : 18,
        "color" : "#8FA227",
        "items" : [
            {"name":"Clean Code", "pc":{"r":130,"t":110},"movement":"c"},
            {"name":"Build Pipelines", "pc":{"r":180,"t":100},"movement":"c"},
            {"name":"Sacrificial Architecture", "pc":{"r":80,"t":100},"movement":"c"},
            {"name":"Data Informed Decion Making", "pc":{"r":130,"t":110},"movement":"c"},
            {"name":"Coding architects", "pc":{"r":90,"t":170},"movement":"c"},
            {"name":"Code Reviews", "pc":{"r":110,"t":110},"movement":"c"},
            {"name":"Polygot Programming", "pc":{"r":180,"t":170},"movement":"c"},
            {"name":"Evolutionary architecture", "pc":{"r":120,"t":95},"movement":"c"},
            {"name":"SaaS for non-core systems", "pc":{"r":270,"t":170},"movement":"c"},
            {"name":"Incremental data warehousing", "pc":{"r":250,"t":165},"movement":"c"},
            {"name":"Property based testing", "pc":{"r":130,"t":165},"movement":"c"},
            {"name":"Pair Programming", "pc":{"r":230,"t":170},"movement":"c"},
            {"name":"iOS Accessibility", "pc":{"r":170,"t":110},"movement":"c"},
            {"name":"iOS Adaptivity", "pc":{"r":180,"t":105},"movement":"c"},
            {"name":"Wide and Thin Front-Ends", "pc":{"r":130,"t":160},"movement":"c"},
            {"name":"Edge Services", "pc":{"r":130,"t":160},"movement":"c"},
            {"name":"Single Page App", "pc":{"r":350,"t":95},"movement":"c", "url":"http://www.google.com"},
            {"name":"Zookeeper for App Config", "pc":{"r":130,"t":130},"movement":"c"},
            {"name":"Events for messages - CQRS", "pc":{"r":225,"t":120},"movement":"c"},
            {"name":"Measure Pipeline disruptions", "pc":{"r":280,"t":110},"movement":"c"},
            {"name":"Isolated dev envs", "pc":{"r":180,"t":125},"movement":"c"},
            {"name":"Valuable, cheap tests", "pc":{"r":130,"t":150},"movement":"c"},
            {"name":"Sensible defaults", "pc":{"r":80,"t":150},"movement":"c"},
            {"name":"Continuous Experimentation", "pc":{"r":230,"t":110},"movement":"c"},
            { name: 'Reduce iRules dependence ^', pc: { r: 280, t: 133 }, movement: 'c' },
            { name: 'internal load balancing off F5^', pc: { r: 180, t: 133 }, movement: 'c' },
            { name: 'Git flow / Pull Requests ^', pc: { r: 230, t: 133 }, movement: 'c' }

        ]
    },
    { "quadrant": "Tools",
        "left": w-200+30,
        "top" : 18,
        "color" : "#587486",
        "items" : [

{ name: 'Docker',
    pc: { r: 170, t: 19 },
    movement: 't' },
  { name: 'Xamarin',
    pc: { r: 280, t: 51 },
    movement: 'c' },
  { name: 'Android Annotations',
    pc: { r: 280, t: 25 },
    movement: 'c' },
  { name: 'bind',
    pc: { r: 150, t: 69 },
    movement: 'c' },
  { name: 'Appium',
    pc: { r: 110, t: 70 },
    movement: 'c',
    domain: 'mobile, front-end' },
  { name: 'GenyMotion',
    pc: { r: 310, t: 31 },
    movement: 'c' },
 { name: 'Android Studio',
    pc: { r: 180, t: 66 },
    movement: 'c',
    domain: 'mobile, dev' },
  { name: 'Responsive Android',
    pc: { r: 150, t: 14 },
    movement: 'c' },
  { name: 'AutoLayout - iOS',
    pc: { r: 180, t: 55 },
    movement: 'c',
    domain: '' },
  { name: 'Kiwi - iOS unit test',
    pc: { r: 120, t: 14 },
    movement: 'c',
    domain: '' },
  { name: 'BEM',
    pc: { r: 160, t: 60 },
    movement: 'c',
    domain: 'front-end' },
  { name: 'Crashlytics',
    pc: { r: 180, t: 5 },
    movement: 'c',
    domain: 'mobile' },
  { name: 'Kafka',
    pc: { r: 12, t: 25 },
    movement: 'c',
    domain: 'back-end' },
  { name: 'ELK',
    pc: { r: 30, t: 72 },
    movement: 'c',
    domain: 'back-end' },
  { name: 'Consul',
    pc: { r: 170, t: 29 },
    movement: 't' },
  { name: 'Ansible',
    pc: { r: 280, t: 74 },
    movement: 'c' },
  { name: 'mongoDB',
    pc: { r: 330, t: 5 },
    movement: 'c' },
  { name: 'Liquibase',
    pc: { r: 80, t: 76 },
    movement: 'c' },
  { name: 'haproxy',
    pc: { r: 80, t: 46 },
    movement: 'c' },
  { name: 'Git',
    pc: { r: 130, t: 73 },
    movement: 'c' },
  { name: 'Subversion',
    pc: { r: 30, t: 18 },
    movement: 'c' },
  { name: 'Hip Chat',
    pc: { r: 280, t: 78 },
    movement: 'c' },
  { name: 'Trello',
    pc: { r: 260, t: 75 },
    movement: 'c' },
  { name: 'Charles HTTP Proxy',
    pc: { r: 260, t: 48 },
    movement: 'c' },
  { name: 'Swagger Code-Gen',
    pc: { r: 180, t: 82 },
    movement: 'c' },
  { name: 'PowerMock ^',
    pc: { r: 180, t: 46 },
    movement: 'c' },
  { name: 'Mockito',
    pc: { r: 170, t: 84 },
    movement: 'c',
    domain: 'back-end' },
  { name: 'JDBI ^',
    pc: { r: 80, t: 56 },
    movement: 'c' },
  { name: 'Hibernate ^',
    pc: { r: 380, t: 56 },
    movement: 'c' },
  { name: 'Json Web Tokens (JWT)',
    pc: { r: 180, t: 77 },
    movement: 'c' },
  { name: 'Lemming',
    pc: { r: 160, t: 82 },
    movement: 'c' },
  { name: 'AppManager ^',
    pc: { r: 360, t: 82 },
    movement: 'c' },
  { name: 'Hystrix',
    pc: { r: 150, t: 36 },
    movement: 'c' }
   ]
    },
    { "quadrant": "Platforms",
        "left" :45,
         "top" : (h/2 + 18),
        "color" : "#DC6F1D",
        "items" : [
            {"name":"App containers", "pc":{"r":250,"t":260},"movement":"c"},
            {"name":"Openstack", "pc":{"r":190,"t":190},"movement":"c"},
            {"name":"RHEL 7", "pc":{"r":170,"t":215},"movement":"c"},
            {"name":"RHEL 5", "pc":{"r":370,"t":195},"movement":"c"},
            {"name":"Google Cloud Data Flow", "pc":{"r":275,"t":260},"movement":"t"},
            {"name":"MS SqlServer", "pc":{"r":390,"t":190},"movement":"c"},
            { name: 'Postgres as NoSQL',
              pc: { r: 220, t: 255 },
              movement: 'c' },
            {"name":"AWS", "pc":{"r":90,"t":250},"movement":"c"},
            {"name":"AWS 2014 Innovations", "pc":{"r":270,"t":195},"movement":"c"},
            {"name":"Azure", "pc":{"r":290,"t":265},"movement":"c"},
            { name: 'Mesos',
              pc: { r: 260, t: 265 },
              movement: 't' },
            { name: 'Marathon',
              pc: { r: 240, t: 268 },
              movement: 't' },
            { name: 'Kubernetes',
              pc: { r: 270, t: 236 },
              movement: 't' },
            { name: 'BigIP v11',
              pc: { r: 50, t: 257 },
              movement: 'c' },
            {"name":"Google App Engine", "pc":{"r":290,"t":255},"movement":"c"},
            {"name":"Google as corporate platform", "pc":{"r":290,"t":200},"movement":"c"},
            {"name":"Java EE - the Bad Parts", "pc":{"r":390,"t":245},"movement":"c"},
            {"name":"OpenId Connect", "pc":{"r":130,"t":260},"movement":"t"},
            {"name":"Location based services", "pc":{"r":130,"t":230},"movement":"c"},
            {"name":"JVM as platform", "pc":{"r":90,"t":265},"movement":"c"},
            {"name":"Ruby On Rails", "pc":{"r":390,"t":215},"movement":"c"},
            {"name":"Everest", "pc":{"r":390,"t":185},"movement":"c"},
            {"name":"Magnolia CMS", "pc":{"r":390,"t":235},"movement":"c"},
            {"name":"Wotif-Standards mvn modules ^", "pc":{"r":270,"t":215},"movement":"c"},
            {"name":"Google Play - (alpha/beta builds)", "pc":{"r":30,"t":225},"movement":"c"}
        ]
    },
    { "quadrant": "Languages & Frameworks",
        "color" : "#B70062",
        "left"  : (w-200+30),
        "top" :   (h/2 + 18),
        "items" : [
            {"name":"Java 8", "pc":{"r":130,"t":355},"movement":"c"},
            {"name":"Java 6 and earlier", "pc":{"r":390,"t":350},"movement":"c"},
            {"name":"Swift", "pc":{"r":280,"t":300},"movement":"c"},
            {"name":"Scala - the good parts ^", "pc":{"r":290,"t":320},"movement":"c"},
            {"name":"Serverside Javascript", "pc":{"r":220,"t":275},"movement":"c"},
            {"name":"Coffeescript", "pc":{"r":270,"t":282},"movement":"c"},
            {"name":"Functional Reactive Programming", "pc":{"r":285,"t":330},"movement":"c"},
            {"name":"Clojure", "pc":{"r":280,"t":310},"movement":"c"},
            {"name":"Groovy ^", "pc":{"r":190,"t":280},"movement":"c"},
            {"name":"Web Objects", "pc":{"r":390,"t":290},"movement":"c"},
            {"name":"ASP Classic", "pc":{"r":375,"t":330},"movement":"c"},
            { name: 'CDI', pc: { r: 160, t: 290 },  movement: 'c' },
            { name: 'Jersey', pc: { r: 160, t: 310 },  movement: 'c' },
            { name: 'Spring', pc: { r: 160, t: 330 },  movement: 'c' },
            { name: 'Guice', pc: { r: 160, t: 278 },  movement: 'c' },
            { name: 'Mustache/Handlebars template',
              pc: { r: 50, t: 298 },
              movement: 'c',
              domain: 'template' },
            { name: 'RxJava',
              pc: { r: 150, t: 298 },
              movement: 'c',
              domain: 'template' },
            { name: 'RxJs',
              pc: { r: 250, t: 338 },
              movement: 'c',
              domain: 'template' },
            { name: 'Web Components', pc: { r: 260, t: 330 },  movement: 'c' }

        ]
    }
];
<|endoftext|>


<commit_before>'use strict';

var Mongoose = require('mongoose');
var Schema   = Mongoose.Schema;
var async    = require('async');
var memoizee = require('memoizee');

module.exports = function (N, collectionName) {

  var cache = {
    topic_count      : { type: Number, 'default': 0 }
  , post_count       : { type: Number, 'default': 0 }

  , last_post        : Schema.ObjectId
  , last_topic       : Schema.ObjectId
  , last_topic_hid   : Number
  , last_topic_title : String
  , last_user        : Schema.ObjectId
  , last_ts          : Date
  };

  var Section = new Schema({
    title           : { type: String, required: true }
  , description     : String
  , display_order   : Number

    // user-friendly id (autoincremented)
  , hid              : { type: Number, min: 1, index: true }

    // Sections tree paths/cache
  , parent          : Schema.ObjectId

    // Visible moderator list.
  , moderators    : [Schema.ObjectId]

    // Options
  , is_category     : { type: Boolean, 'default': false } // subsection or category
  , is_enabled      : { type: Boolean, 'default': true }  // hiden inactive
  , is_writeble     : { type: Boolean, 'default': true} // read-only archive
  , is_searcheable  : { type: Boolean, 'default': true }
  , is_voteable     : { type: Boolean, 'default': true }
  , is_counted      : { type: Boolean, 'default': true }  // inc user's counter, when posted here
  , is_excludable   : { type: Boolean, 'default': true}

    // Topic prefixes
  , is_prefix_required  : { type: Boolean, 'default': false }
  , prefix_groups   : [Schema.ObjectId] // allowed groups of prefixes

    // Cache
  , cache           : cache
  , cache_hb        : cache

    // Setting storage. Only `section_usergroup` settings store should access this.
  , settings        : { type: Schema.Types.Mixed, 'default': {} }
  },
  {
    versionKey : false
  });

  // Indexes
  ////////////////////////////////////////////////////////////////////////////////

  // build section tree structure in `getSectionsTree` (see below)
  Section.index({
    display_order: 1
  , _id: -1
  });

  // Hooks
  ////////////////////////////////////////////////////////////////////////////////

  // Compute `parent_list` and `level` fields before save.
  //
  Section.pre('save', function (next) {
    var self = this;

    // Record modified state of `parent` field for post hook.
    // Always assume true for unsaved models.
    self.__isParentModified__ = self.isModified('parent') || self.isNew;

    next();
  });

  // Set 'hid' for the new section.
  // This hook should always be the last one to avoid counter increment on error
  Section.pre('save', function (callback) {
    if (!this.isNew) {
      callback();
      return;
    }

    var self = this;
    N.models.core.Increment.next('section', function(err, value) {
      if (err) {
        callback(err);
        return;
      }

      self.hid = value;
      callback();
    });
  });

  // Update all inherited settings (permissions) for subsections.
  //
  Section.post('save', function (section) {

    // Nothing to do if parent is not changed.
    if (!section.__isParentModified__) {
      return;
    }

    async.series([

      function (next) {
        var SectionUsergroupStore = N.settings.getStore('section_usergroup');

        if (!SectionUsergroupStore) {
          N.logger.error('Settings store `section_usergroup` is not registered.');
          next();
          return;
        }

        SectionUsergroupStore.updateInherited(section._id, function (err) {
          if (err) {
            N.logger.error('%s', err);
          }
          next();
        });
      }
    , function (next) {
        var SectionModeratorStore = N.settings.getStore('section_moderator');

        if (!SectionModeratorStore) {
          N.logger.error('Settings store `section_moderator` is not registered.');
          next();
          return;
        }

        SectionModeratorStore.updateInherited(section._id, function (err) {
          if (err) {
            N.logger.error('%s', err);
          }
          next();
        });
      }
    ]);
  });

  // Hide hellbanned info for regular users for security reasons.
  // This method works with raw object.
  //
  // options:
  //
  // - `keep_data` - when true, use cache_hb instead of cache. Default - false.
  Section.statics.sanitize = function sanitize(section, options) {
    options = options || {};

    // Use hellbanned last topic/post info for hellbanned current user or administrators
    if (section.cache_hb) {
      if (options.keep_data) {
        section.cache = section.cache_hb;
      }
      delete section.cache_hb;
    }
  };

  N.wire.on("init:models", function emit_init_Section(__, callback) {
    N.wire.emit("init:models." + collectionName, Section, callback);
  });

  N.wire.on("init:models." + collectionName, function init_model_Section(schema) {
    N.models[collectionName] = Mongoose.model(collectionName, schema);
  });

  // Get sections tree, returns hash table with sections with next structure:
  // _id:
  //   - `_id` - section `_id`
  //   - `parent` - link to parent section object
  //   - children[ { _id, parent, children[...] } ]
  var getSectionsTree = memoizee(

    function(callback) {

      var result = {};

      N.models.forum.Section.find()
        .setOptions({ lean: true })
        .sort('display_order')
        .select('_id parent')
        .setOptions({ lean: true })
        .exec(function (err, sections) {

        if (err) {
          callback(err);
          return;
        }

        // create hash of trees for each section
        sections.forEach(function(section) {

          // check if section was already added by child. If not found, create it
          result[section._id] = result[section._id] || { _id: section._id, children: [] };

          // if section has parent, try to find it and push section to its children.
          // If parent not found, create it.
          if (section.parent) {
            // find parent in hash table
            if (result[section.parent]) {
              result[section.parent].children.push(result[section._id]);
            } else {
              // no parent in hash table, create and add it
              result[section.parent] = { _id: section.parent, children: [result[section._id]] };
            }
            // set link from section to parent
            result[section._id].parent = result[section.parent];
          }
        });

        // root is a special fake `section` that contains array of the root-level sections
        result['root'] = { children: [] };
        // fill root chirden
        sections.forEach(function(section) {
          if (!section.parent) {
            result['root'].children.push(result[section._id]);
          }
        });

        callback(err, result);
      });
    },
    {
      async: true,
      maxAge:     60000, // cache TTL = 60 seconds
      primitive:  true   // params keys are calculated as toString, ok for our case
    }
  );

  // Returns list of parent sections for given section `_id`
  //
  Section.statics.getParentList = function(sectionID, callback) {

    getSectionsTree(function(err, sections) {

      if (err) {
        callback(err);
        return;
      }

      var parentList = [];
      var current = sections[sectionID].parent;

      while (current) {
        parentList.unshift(current._id);
        current = current.parent;
      }

      callback(null, parentList);
    });
  };

  // Returns list of child sections, including subsections until the given deepness.
  // Also, sets `level` property for found sections
  // Can be called as
  // getChildren(callback),
  // getChildren(deepness, callback),
  // getChildren((section, deepness, callback)
  //
  // - [ {_id, level} ]
  //
  Section.statics.getChildren = function(sectionID, deepness, callback) {

    // shift parameters
    if (deepness === undefined) {
      // single parameter is callback
      callback = sectionID;
      deepness = -1;
      sectionID = null;
    } else if (callback === null) {
      // two parameters are deepness and callback
      callback = deepness;
      deepness = sectionID;
      sectionID = null;
    }

    var children = [];

    function fillChildren(section, curDeepness, maxDeepness) {

      if (maxDeepness >= 0 && curDeepness >= maxDeepness) {
        return;
      }

      section.children.forEach(function (childSection) {
        children.push({ _id: childSection._id, level: curDeepness });
        fillChildren(childSection, curDeepness + 1, maxDeepness);
      });
    }

    getSectionsTree(function(err, sections) {
      if (err) {
        callback(err);
        return;
      }

      var storedSection = sections[sectionID || 'root'];
      fillChildren(storedSection, 0, deepness);
      callback(null, children);
    });
  };

};
<commit_msg>comments update<commit_after>'use strict';

var Mongoose = require('mongoose');
var Schema   = Mongoose.Schema;
var async    = require('async');
var memoizee = require('memoizee');

module.exports = function (N, collectionName) {

  var cache = {
    topic_count      : { type: Number, 'default': 0 }
  , post_count       : { type: Number, 'default': 0 }

  , last_post        : Schema.ObjectId
  , last_topic       : Schema.ObjectId
  , last_topic_hid   : Number
  , last_topic_title : String
  , last_user        : Schema.ObjectId
  , last_ts          : Date
  };

  var Section = new Schema({
    title           : { type: String, required: true }
  , description     : String
  , display_order   : Number

    // user-friendly id (autoincremented)
  , hid              : { type: Number, min: 1, index: true }

    // Sections tree paths/cache
  , parent          : Schema.ObjectId

    // Visible moderator list.
  , moderators    : [Schema.ObjectId]

    // Options
  , is_category     : { type: Boolean, 'default': false } // subsection or category
  , is_enabled      : { type: Boolean, 'default': true }  // hiden inactive
  , is_writeble     : { type: Boolean, 'default': true} // read-only archive
  , is_searcheable  : { type: Boolean, 'default': true }
  , is_voteable     : { type: Boolean, 'default': true }
  , is_counted      : { type: Boolean, 'default': true }  // inc user's counter, when posted here
  , is_excludable   : { type: Boolean, 'default': true}

    // Topic prefixes
  , is_prefix_required  : { type: Boolean, 'default': false }
  , prefix_groups   : [Schema.ObjectId] // allowed groups of prefixes

    // Cache
  , cache           : cache
  , cache_hb        : cache

    // Setting storage. Only `section_usergroup` settings store should access this.
  , settings        : { type: Schema.Types.Mixed, 'default': {} }
  },
  {
    versionKey : false
  });

  // Indexes
  ////////////////////////////////////////////////////////////////////////////////

  // build section tree structure in `getSectionsTree` (see below)
  Section.index({
    display_order: 1
  , _id: -1
  });

  // Hooks
  ////////////////////////////////////////////////////////////////////////////////

  // Compute `parent_list` and `level` fields before save.
  //
  Section.pre('save', function (next) {
    var self = this;

    // Record modified state of `parent` field for post hook.
    // Always assume true for unsaved models.
    self.__isParentModified__ = self.isModified('parent') || self.isNew;

    next();
  });

  // Set 'hid' for the new section.
  // This hook should always be the last one to avoid counter increment on error
  Section.pre('save', function (callback) {
    if (!this.isNew) {
      callback();
      return;
    }

    var self = this;
    N.models.core.Increment.next('section', function(err, value) {
      if (err) {
        callback(err);
        return;
      }

      self.hid = value;
      callback();
    });
  });

  // Update all inherited settings (permissions) for subsections.
  //
  Section.post('save', function (section) {

    // Nothing to do if parent is not changed.
    if (!section.__isParentModified__) {
      return;
    }

    async.series([

      function (next) {
        var SectionUsergroupStore = N.settings.getStore('section_usergroup');

        if (!SectionUsergroupStore) {
          N.logger.error('Settings store `section_usergroup` is not registered.');
          next();
          return;
        }

        SectionUsergroupStore.updateInherited(section._id, function (err) {
          if (err) {
            N.logger.error('%s', err);
          }
          next();
        });
      }
    , function (next) {
        var SectionModeratorStore = N.settings.getStore('section_moderator');

        if (!SectionModeratorStore) {
          N.logger.error('Settings store `section_moderator` is not registered.');
          next();
          return;
        }

        SectionModeratorStore.updateInherited(section._id, function (err) {
          if (err) {
            N.logger.error('%s', err);
          }
          next();
        });
      }
    ]);
  });

  // Hide hellbanned info for regular users for security reasons.
  // This method works with raw object.
  //
  // options:
  //
  // - `keep_data` - when true, use cache_hb instead of cache. Default - false.
  //
  Section.statics.sanitize = function sanitize(section, options) {
    options = options || {};

    // Use hellbanned last topic/post info for hellbanned current user or administrators
    if (section.cache_hb) {
      if (options.keep_data) {
        section.cache = section.cache_hb;
      }
      delete section.cache_hb;
    }
  };

  N.wire.on("init:models", function emit_init_Section(__, callback) {
    N.wire.emit("init:models." + collectionName, Section, callback);
  });

  N.wire.on("init:models." + collectionName, function init_model_Section(schema) {
    N.models[collectionName] = Mongoose.model(collectionName, schema);
  });

  // Get sections tree, returns hash of nested trees for sections. Structure:
  //
  // _id:
  //   - _id - section `_id`
  //   - parent - link to parent section object
  //   - children[ { _id, parent, children[...] } ]
  //
  var getSectionsTree = memoizee(

    function(callback) {

      var result = {};

      N.models.forum.Section.find()
        .setOptions({ lean: true })
        .sort('display_order')
        .select('_id parent')
        .setOptions({ lean: true })
        .exec(function (err, sections) {

        if (err) {
          callback(err);
          return;
        }

        // create hash of trees for each section
        sections.forEach(function(section) {

          // check if section was already added by child. If not found, create it
          result[section._id] = result[section._id] || { _id: section._id, children: [] };

          // if section has parent, try to find it and push section to its children.
          // If parent not found, create it.
          if (section.parent) {
            // find parent in hash table
            if (result[section.parent]) {
              result[section.parent].children.push(result[section._id]);
            } else {
              // no parent in hash table, create and add it
              result[section.parent] = { _id: section.parent, children: [result[section._id]] };
            }
            // set link from section to parent
            result[section._id].parent = result[section.parent];
          }
        });

        // root is a special fake `section` that contains array of the root-level sections
        result['root'] = { children: [] };
        // fill root chirden
        sections.forEach(function(section) {
          if (!section.parent) {
            result['root'].children.push(result[section._id]);
          }
        });

        callback(err, result);
      });
    },
    {
      async: true,
      maxAge:     60000, // cache TTL = 60 seconds
      primitive:  true   // params keys are calculated as toString, ok for our case
    }
  );

  // Returns list of parent _id-s for given section `_id`
  //
  Section.statics.getParentList = function(sectionID, callback) {

    getSectionsTree(function(err, sections) {

      if (err) {
        callback(err);
        return;
      }

      var parentList = [];
      var current = sections[sectionID].parent;

      while (current) {
        parentList.unshift(current._id);
        current = current.parent;
      }

      callback(null, parentList);
    });
  };

  // Returns list of child sections, including subsections until the given deepness.
  // Also, sets `level` property for found sections
  //
  // - getChildren((section, deepness, callback)
  // - getChildren(deepness, callback) - for root (on index page)
  // - getChildren(callback) - for all
  //
  // result:
  //
  // - [ {_id, level} ]
  //
  Section.statics.getChildren = function(sectionID, deepness, callback) {

    // shift parameters
    if (deepness === undefined) {
      // single parameter is callback
      callback = sectionID;
      deepness = -1;
      sectionID = null;
    } else if (callback === null) {
      // two parameters are deepness and callback
      callback = deepness;
      deepness = sectionID;
      sectionID = null;
    }

    var children = [];

    function fillChildren(section, curDeepness, maxDeepness) {

      if (maxDeepness >= 0 && curDeepness >= maxDeepness) {
        return;
      }

      section.children.forEach(function (childSection) {
        children.push({ _id: childSection._id, level: curDeepness });
        fillChildren(childSection, curDeepness + 1, maxDeepness);
      });
    }

    getSectionsTree(function(err, sections) {
      if (err) {
        callback(err);
        return;
      }

      var storedSection = sections[sectionID || 'root'];
      fillChildren(storedSection, 0, deepness);
      callback(null, children);
    });
  };

};
<|endoftext|>


<commit_before>module.exports = {
    output: {
        library: 'Scrollbar',
        libraryTarget: 'umd'
    },
    externals: {
        react: {
            root: 'React',
            commonjs: 'react',
            commonjs2: 'react',
            amd: 'react'
        },
        'smooth-scrollbar': {
            root: 'Scrollbar',
            commonjs: 'smooth-scrollbar',
            commonjs2: 'smooth-scrollbar',
            amd: 'smooth-scrollbar'
        }
    },
    module: {
        preLoaders: [{
            test: /\.jsx?$/,
            exclude: /(node_modules|bower_components)/,
            loader: 'eslint-loader'
        }],
        loaders: [{
            test: /\.jsx?$/,
            exclude: /(node_modules|bower_components)/,
            loader: 'babel-loader',
            query: {
                presets: ['es2015', 'stage-0', 'react'],
                plugins: [
                    'add-module-exports',
                ]
            }
        }]
    }
};
<commit_msg>fix(webpack): mark "prop-types" package as externel<commit_after>module.exports = {
    output: {
        library: 'Scrollbar',
        libraryTarget: 'umd'
    },
    externals: {
        react: {
            root: 'React',
            commonjs: 'react',
            commonjs2: 'react',
            amd: 'react'
        },
        'prop-types': {
            root: 'PropTypes',
            commonjs: 'prop-types',
            commonjs2: 'prop-types',
            amd: 'prop-types'
        },
        'smooth-scrollbar': {
            root: 'Scrollbar',
            commonjs: 'smooth-scrollbar',
            commonjs2: 'smooth-scrollbar',
            amd: 'smooth-scrollbar'
        }
    },
    module: {
        preLoaders: [{
            test: /\.jsx?$/,
            exclude: /(node_modules|bower_components)/,
            loader: 'eslint-loader'
        }],
        loaders: [{
            test: /\.jsx?$/,
            exclude: /(node_modules|bower_components)/,
            loader: 'babel-loader',
            query: {
                presets: ['es2015', 'stage-0', 'react'],
                plugins: [
                    'add-module-exports',
                ]
            }
        }]
    }
};
<|endoftext|>


<commit_before>roleAllocator = {

    spawnNecessary: function() {
	    var store = {
	        'generalist': 4,
	    };

	    for(role in store) {
	        var count = store[role];
	        var creeps = _.filter(Game.creeps, (creep) => creep.memory.role == role);
	        if(creeps.length < count) {
		        var newName = Game.spawns['Spawn1'].createCreep([WORK,CARRY,MOVE], undefined, {role: role});
		        console.log('spawning new ' + role + ': ' + newName);
	        }
	    }
    }
}

module.exports = roleAllocator;
<commit_msg>upgrading workers<commit_after>roleAllocator = {

    spawnNecessary: function() {
	    var store = {
	        'generalist': 4,
	    };

	    for(role in store) {
	        var count = store[role];
	        var creeps = _.filter(Game.creeps, (creep) => creep.memory.role == role);
	        if(creeps.length < count) {
		        var newName = Game.spawns['Spawn1'].createCreep([WORK,WORK,CARRY,CARRY,MOVE,MOVE], undefined, {role: role});
		        console.log('spawning new ' + role + ': ' + newName);
	        }
	    }
    }
}

module.exports = roleAllocator;
<|endoftext|>


<commit_before>var mongoose     = require('mongoose');
var Schema       = mongoose.Schema;

var ObjectId = mongoose.Schema.Types.ObjectId;
var Location = require('./location_model');
var Organisation = require("./organisation_model");

var InvoiceSchema   = new Schema({
	invoice_id: { type: String, index: true },
	invoice_number: String,
	organisation_id: { type: ObjectId, index: true, ref: "Organisation" },
	location: { type: ObjectId, index: true, ref: "Location" },
	date: Date,
	due_date: Date,
	sent: Boolean,
	status: String,
	sub_total: Number,
	total: Number,
	discount: Number,
	tax: Number,
	date_created: { type: Date, default: Date.now },
	line_items: [ mongoose.Schema.Types.Mixed ],
	paypal_id: { type: String, index: true },
	_owner_id: ObjectId
});

InvoiceSchema.set("_perms", {
	admin: "crud",
	owner: "cr",
	user: ""
});

module.exports = mongoose.model('Invoice', InvoiceSchema);<commit_msg>Paid fields<commit_after>var mongoose     = require('mongoose');
var Schema       = mongoose.Schema;

var ObjectId = mongoose.Schema.Types.ObjectId;
var Location = require('./location_model');
var Organisation = require("./organisation_model");

var InvoiceSchema   = new Schema({
	invoice_id: { type: String, index: true },
	invoice_number: String,
	organisation_id: { type: ObjectId, index: true, ref: "Organisation" },
	location: { type: ObjectId, index: true, ref: "Location" },
	date: Date,
	due_date: Date,
	sent: Boolean,
	status: String,
	sub_total: Number,
	total: Number,
	discount: Number,
	tax: Number,
	date_created: { type: Date, default: Date.now },
	line_items: [ mongoose.Schema.Types.Mixed ],
	amount_due: Number,
	amount_paid: Number,
	date_paid: Date,
	paypal_id: { type: String, index: true },
	_owner_id: ObjectId
});

InvoiceSchema.set("_perms", {
	admin: "crud",
	owner: "cr",
	user: ""
});

module.exports = mongoose.model('Invoice', InvoiceSchema);<|endoftext|>