Skip to content

Commit

Permalink
Merge pull request #126 from mitodl/feature/gs/install_bower
Browse files Browse the repository at this point in the history
Installed bower with URI.js, require.js, underscore, jquery

[#101927040]
  • Loading branch information
pdpinch committed Sep 3, 2015
2 parents 8d91d58 + 9894c1a commit 54e4bd1
Show file tree
Hide file tree
Showing 184 changed files with 38,688 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "edx_sga/static/js/bower/"
}
16 changes: 16 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "edx-sga",
"version": "0.0.0",
"homepage": "https://github.com/mitodl/edx-sga",
"authors": [
"ODL Engineering <[email protected]>"
],
"license": "AGPLv3",
"dependencies": {
"jquery": "~2.1.4",
"URIjs": "~1.16.0",
"requirejs": "~2.1.20",
"underscore": "~1.8.3",
"sinon": "~1.16.1"
}
}
26 changes: 26 additions & 0 deletions edx_sga/static/js/bower/URIjs/.bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "URIjs",
"version": "1.16.0",
"main": "src/URI.js",
"ignore": [
".*",
"*.css",
"/*.js",
"/*.html",
"/*.json",
"utils",
"test",
"prettify"
],
"license": "MIT",
"homepage": "https://github.com/medialize/URI.js",
"_release": "1.16.0",
"_resolution": {
"type": "version",
"tag": "v1.16.0",
"commit": "5e5fd20f502861ea1ee7e644615fcd0a45d28098"
},
"_source": "git://github.com/medialize/URI.js.git",
"_target": "~1.16.0",
"_originalSource": "URIjs"
}
21 changes: 21 additions & 0 deletions edx_sga/static/js/bower/URIjs/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2011 Rodney Rehm

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
539 changes: 539 additions & 0 deletions edx_sga/static/js/bower/URIjs/README.md

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions edx_sga/static/js/bower/URIjs/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "URIjs",
"version": "1.16.0",
"main": "src/URI.js",
"ignore": [
".*",
"*.css",
"/*.js",
"/*.html",
"/*.json",
"utils",
"test",
"prettify"
],
"license": "MIT"
}
19 changes: 19 additions & 0 deletions edx_sga/static/js/bower/URIjs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Contributing to URI.js #

URI.js Project License: MIT License

* You will only Submit Contributions where You have authored 100% of the content.
* You will only Submit Contributions to which You have the necessary rights. This means that if You are employed You have received the necessary permissions from Your employer to make the Contributions.
* Whatever content You Contribute will be provided under the project License.

---

Thanks for your help!

Pull Requests go into the branch **master**. The *gh-pages* branch is a presentation of the *master* branch at the last given release.

Whenever you change code, make sure you run the test suite before sending a pull request. Please add tests for any features you add to the code base. We're using [QUnit](http://qunitjs.com/) for testing.

We're looking forward to splitting URI.js in several files, each dealing with a specific domain, to make the 1800 lines of code more bearable to work with. This will lead to using [Grunt](http://gruntjs.com/) to build a distributable version (and the removal of `build.html`). We're not sure when we'll get to this. If you want to pitch in, just holler!


188 changes: 188 additions & 0 deletions edx_sga/static/js/bower/URIjs/src/IPv6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
/*!
* URI.js - Mutating URLs
* IPv6 Support
*
* Version: 1.16.0
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
* GPL v3 http://opensource.org/licenses/GPL-3.0
*
*/

(function (root, factory) {
'use strict';
// https://github.com/umdjs/umd/blob/master/returnExports.js
if (typeof exports === 'object') {
// Node
module.exports = factory();
} else if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(factory);
} else {
// Browser globals (root is window)
root.IPv6 = factory(root);
}
}(this, function (root) {
'use strict';

/*
var _in = "fe80:0000:0000:0000:0204:61ff:fe9d:f156";
var _out = IPv6.best(_in);
var _expected = "fe80::204:61ff:fe9d:f156";
console.log(_in, _out, _expected, _out === _expected);
*/

// save current IPv6 variable, if any
var _IPv6 = root && root.IPv6;

function bestPresentation(address) {
// based on:
// Javascript to test an IPv6 address for proper format, and to
// present the "best text representation" according to IETF Draft RFC at
// http://tools.ietf.org/html/draft-ietf-6man-text-addr-representation-04
// 8 Feb 2010 Rich Brown, Dartware, LLC
// Please feel free to use this code as long as you provide a link to
// http://www.intermapper.com
// http://intermapper.com/support/tools/IPV6-Validator.aspx
// http://download.dartware.com/thirdparty/ipv6validator.js

var _address = address.toLowerCase();
var segments = _address.split(':');
var length = segments.length;
var total = 8;

// trim colons (:: or ::a:b:c… or …a:b:c::)
if (segments[0] === '' && segments[1] === '' && segments[2] === '') {
// must have been ::
// remove first two items
segments.shift();
segments.shift();
} else if (segments[0] === '' && segments[1] === '') {
// must have been ::xxxx
// remove the first item
segments.shift();
} else if (segments[length - 1] === '' && segments[length - 2] === '') {
// must have been xxxx::
segments.pop();
}

length = segments.length;

// adjust total segments for IPv4 trailer
if (segments[length - 1].indexOf('.') !== -1) {
// found a "." which means IPv4
total = 7;
}

// fill empty segments them with "0000"
var pos;
for (pos = 0; pos < length; pos++) {
if (segments[pos] === '') {
break;
}
}

if (pos < total) {
segments.splice(pos, 1, '0000');
while (segments.length < total) {
segments.splice(pos, 0, '0000');
}

length = segments.length;
}

// strip leading zeros
var _segments;
for (var i = 0; i < total; i++) {
_segments = segments[i].split('');
for (var j = 0; j < 3 ; j++) {
if (_segments[0] === '0' && _segments.length > 1) {
_segments.splice(0,1);
} else {
break;
}
}

segments[i] = _segments.join('');
}

// find longest sequence of zeroes and coalesce them into one segment
var best = -1;
var _best = 0;
var _current = 0;
var current = -1;
var inzeroes = false;
// i; already declared

for (i = 0; i < total; i++) {
if (inzeroes) {
if (segments[i] === '0') {
_current += 1;
} else {
inzeroes = false;
if (_current > _best) {
best = current;
_best = _current;
}
}
} else {
if (segments[i] === '0') {
inzeroes = true;
current = i;
_current = 1;
}
}
}

if (_current > _best) {
best = current;
_best = _current;
}

if (_best > 1) {
segments.splice(best, _best, '');
}

length = segments.length;

// assemble remaining segments
var result = '';
if (segments[0] === '') {
result = ':';
}

for (i = 0; i < length; i++) {
result += segments[i];
if (i === length - 1) {
break;
}

result += ':';
}

if (segments[length - 1] === '') {
result += ':';
}

return result;
}

function noConflict() {
/*jshint validthis: true */
if (root.IPv6 === this) {
root.IPv6 = _IPv6;
}

return this;
}

return {
best: bestPresentation,
noConflict: noConflict
};
}));
Loading

0 comments on commit 54e4bd1

Please sign in to comment.