twigg-app 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/assets/javascripts/_bootstrap.js +7 -0
- data/assets/javascripts/_jquery.js +19 -0
- data/assets/javascripts/_tables.js +3 -0
- data/assets/javascripts/_views.js +10 -0
- data/assets/javascripts/application.js +9 -0
- data/{public/application.js → assets/javascripts/views/_commit_set_bar_chart.js} +32 -34
- data/assets/javascripts/views/_russia.js +61 -0
- data/assets/javascripts/views/_tags.js +56 -0
- data/assets/javascripts/views/_tags_word_cloud.js +51 -0
- data/assets/stylesheets/_bootstrap_overrides.scss +15 -0
- data/assets/stylesheets/_footer.scss +28 -0
- data/assets/stylesheets/_global.scss +14 -0
- data/assets/stylesheets/_tables.scss +20 -0
- data/assets/stylesheets/application.scss +10 -0
- data/assets/stylesheets/d3/_bar_chart.scss +25 -0
- data/assets/stylesheets/d3/_bubble_chart.scss +22 -0
- data/lib/twigg-app/app/routes.rb +4 -0
- data/lib/twigg-app/app/server.rb +78 -21
- data/lib/twigg-app/app/version.rb +1 -1
- data/public/vendor/bootstrap/Gruntfile.js +32 -10
- data/public/vendor/bootstrap/README.md +2 -0
- data/public/vendor/bootstrap/_config.yml +5 -10
- data/public/vendor/bootstrap/_includes/footer.html +2 -1
- data/public/vendor/bootstrap/_includes/nav-components.html +33 -31
- data/public/vendor/bootstrap/_includes/nav-css.html +32 -22
- data/public/vendor/bootstrap/_includes/nav-getting-started.html +17 -1
- data/public/vendor/bootstrap/_includes/nav-javascript.html +1 -1
- data/public/vendor/bootstrap/_includes/nav-main.html +1 -1
- data/public/vendor/bootstrap/_includes/social-buttons.html +1 -1
- data/public/vendor/bootstrap/_layouts/default.html +18 -14
- data/public/vendor/bootstrap/_layouts/home.html +9 -6
- data/public/vendor/bootstrap/assets/css/docs.css +584 -396
- data/public/vendor/bootstrap/assets/ico/apple-touch-icon-114-precomposed.png +0 -0
- data/public/vendor/bootstrap/assets/ico/apple-touch-icon-144-precomposed.png +0 -0
- data/public/vendor/bootstrap/assets/ico/apple-touch-icon-57-precomposed.png +0 -0
- data/public/vendor/bootstrap/assets/ico/apple-touch-icon-72-precomposed.png +0 -0
- data/public/vendor/bootstrap/assets/ico/favicon.png +0 -0
- data/public/vendor/bootstrap/assets/js/application.js +2 -1
- data/public/vendor/bootstrap/assets/js/customizer.js +160 -45
- data/public/vendor/bootstrap/assets/js/filesaver.js +169 -0
- data/public/vendor/bootstrap/assets/js/jquery.js +6 -5
- data/public/vendor/bootstrap/assets/js/raw-files.js +3 -0
- data/public/vendor/bootstrap/bower.json +1 -1
- data/public/vendor/bootstrap/components.html +787 -364
- data/public/vendor/bootstrap/composer.json +1 -1
- data/public/vendor/bootstrap/css.html +413 -248
- data/public/vendor/bootstrap/customize.html +413 -447
- data/public/vendor/bootstrap/dist/css/bootstrap-theme.css +384 -0
- data/public/vendor/bootstrap/dist/css/bootstrap-theme.min.css +1 -0
- data/public/vendor/bootstrap/dist/css/bootstrap.css +3033 -1807
- data/public/vendor/bootstrap/dist/css/bootstrap.min.css +1 -1
- data/public/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.svg +228 -0
- data/public/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/vendor/bootstrap/dist/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/vendor/bootstrap/dist/js/bootstrap.js +18 -12
- data/public/vendor/bootstrap/dist/js/bootstrap.min.js +1 -1
- data/public/vendor/bootstrap/examples/carousel/carousel.css +128 -0
- data/public/vendor/bootstrap/examples/carousel/index.html +201 -0
- data/public/vendor/bootstrap/examples/grid/grid.css +28 -0
- data/public/vendor/bootstrap/examples/grid/index.html +119 -0
- data/public/vendor/bootstrap/examples/jumbotron/index.html +111 -0
- data/public/vendor/bootstrap/examples/jumbotron/jumbotron.css +5 -0
- data/public/vendor/bootstrap/examples/jumbotron-narrow/index.html +78 -0
- data/public/vendor/bootstrap/examples/jumbotron-narrow/jumbotron-narrow.css +79 -0
- data/public/vendor/bootstrap/examples/justified-nav/index.html +79 -0
- data/public/vendor/bootstrap/examples/justified-nav/justified-nav.css +88 -0
- data/public/vendor/bootstrap/examples/navbar/index.html +83 -0
- data/public/vendor/bootstrap/examples/navbar/navbar.css +7 -0
- data/public/vendor/bootstrap/examples/navbar-fixed-top/index.html +86 -0
- data/public/vendor/bootstrap/examples/navbar-fixed-top/navbar-fixed-top.css +4 -0
- data/public/vendor/bootstrap/examples/navbar-static-top/index.html +87 -0
- data/public/vendor/bootstrap/examples/navbar-static-top/navbar-static-top.css +7 -0
- data/public/vendor/bootstrap/examples/non-responsive/index.html +96 -0
- data/public/vendor/bootstrap/examples/non-responsive/non-responsive.css +117 -0
- data/public/vendor/bootstrap/examples/offcanvas/index.html +127 -0
- data/public/vendor/bootstrap/examples/offcanvas/offcanvas.css +48 -0
- data/public/vendor/bootstrap/examples/offcanvas/offcanvas.js +5 -0
- data/public/vendor/bootstrap/examples/screenshots/carousel.jpg +0 -0
- data/public/vendor/bootstrap/examples/screenshots/grid.jpg +0 -0
- data/public/vendor/bootstrap/examples/screenshots/jumbotron-narrow.jpg +0 -0
- data/public/vendor/bootstrap/examples/screenshots/jumbotron.jpg +0 -0
- data/public/vendor/bootstrap/examples/screenshots/justified-nav.jpg +0 -0
- data/public/vendor/bootstrap/examples/screenshots/navbar-fixed.jpg +0 -0
- data/public/vendor/bootstrap/examples/screenshots/navbar-static.jpg +0 -0
- data/public/vendor/bootstrap/examples/screenshots/navbar.jpg +0 -0
- data/public/vendor/bootstrap/examples/screenshots/non-responsive.jpg +0 -0
- data/public/vendor/bootstrap/examples/screenshots/offcanvas.jpg +0 -0
- data/public/vendor/bootstrap/examples/screenshots/sign-in.jpg +0 -0
- data/public/vendor/bootstrap/examples/screenshots/starter-template.jpg +0 -0
- data/public/vendor/bootstrap/examples/screenshots/sticky-footer-navbar.jpg +0 -0
- data/public/vendor/bootstrap/examples/screenshots/sticky-footer.jpg +0 -0
- data/public/vendor/bootstrap/examples/screenshots/theme.jpg +0 -0
- data/public/vendor/bootstrap/examples/signin/index.html +46 -0
- data/public/vendor/bootstrap/examples/signin/signin.css +40 -0
- data/public/vendor/bootstrap/examples/starter-template/index.html +63 -0
- data/public/vendor/bootstrap/examples/starter-template/starter-template.css +7 -0
- data/public/vendor/bootstrap/examples/sticky-footer/index.html +51 -0
- data/public/vendor/bootstrap/examples/sticky-footer/sticky-footer.css +39 -0
- data/public/vendor/bootstrap/examples/sticky-footer-navbar/index.html +86 -0
- data/public/vendor/bootstrap/examples/sticky-footer-navbar/sticky-footer-navbar.css +46 -0
- data/public/vendor/bootstrap/examples/theme/index.html +387 -0
- data/public/vendor/bootstrap/examples/theme/theme.css +14 -0
- data/public/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/vendor/bootstrap/fonts/glyphicons-halflings-regular.svg +228 -0
- data/public/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/vendor/bootstrap/getting-started.html +513 -22
- data/public/vendor/bootstrap/index.html +3 -4
- data/public/vendor/bootstrap/javascript.html +123 -115
- data/public/vendor/bootstrap/js/dropdown.js +3 -3
- data/public/vendor/bootstrap/js/modal.js +5 -3
- data/public/vendor/bootstrap/js/tests/unit/modal.js +19 -0
- data/public/vendor/bootstrap/js/tests/vendor/jquery.js +6 -5
- data/public/vendor/bootstrap/js/tooltip.js +9 -5
- data/public/vendor/bootstrap/js/transition.js +1 -1
- data/public/vendor/bootstrap/less/alerts.less +7 -11
- data/public/vendor/bootstrap/less/bootstrap.less +17 -21
- data/public/vendor/bootstrap/less/button-groups.less +14 -10
- data/public/vendor/bootstrap/less/buttons.less +3 -2
- data/public/vendor/bootstrap/less/carousel.less +6 -1
- data/public/vendor/bootstrap/less/dropdowns.less +22 -5
- data/public/vendor/bootstrap/less/forms.less +36 -15
- data/public/vendor/bootstrap/less/glyphicons.less +232 -0
- data/public/vendor/bootstrap/less/grid.less +9 -3
- data/public/vendor/bootstrap/less/input-groups.less +1 -1
- data/public/vendor/bootstrap/less/jumbotron.less +16 -5
- data/public/vendor/bootstrap/less/labels.less +9 -5
- data/public/vendor/bootstrap/less/mixins.less +73 -43
- data/public/vendor/bootstrap/less/modals.less +8 -0
- data/public/vendor/bootstrap/less/navbar.less +251 -189
- data/public/vendor/bootstrap/less/navs.less +13 -12
- data/public/vendor/bootstrap/less/pager.less +1 -1
- data/public/vendor/bootstrap/less/pagination.less +20 -9
- data/public/vendor/bootstrap/less/panels.less +28 -8
- data/public/vendor/bootstrap/less/progress-bars.less +6 -10
- data/public/vendor/bootstrap/less/responsive-utilities.less +120 -49
- data/public/vendor/bootstrap/less/scaffolding.less +37 -18
- data/public/vendor/bootstrap/less/tables.less +84 -59
- data/public/vendor/bootstrap/less/theme.less +232 -0
- data/public/vendor/bootstrap/less/thumbnails.less +8 -19
- data/public/vendor/bootstrap/less/type.less +2 -2
- data/public/vendor/bootstrap/less/variables.less +63 -50
- data/public/vendor/bootstrap/package.json +2 -1
- data/public/vendor/components-backbone/LICENSE +22 -0
- data/public/vendor/components-backbone/README.md +10 -0
- data/public/vendor/components-backbone/backbone-min.js +4 -0
- data/public/vendor/components-backbone/backbone.js +1571 -0
- data/public/vendor/components-backbone/bower.json +17 -0
- data/public/vendor/components-backbone/component.json +21 -0
- data/public/vendor/components-backbone/composer.json +37 -0
- data/public/vendor/components-backbone/package.json +24 -0
- data/public/vendor/d3.layout.cloud.js +401 -0
- data/public/vendor/replacejs/CHANGELOG.md +4 -0
- data/public/vendor/replacejs/replace.js +21 -2
- data/public/vendor/underscore/CNAME +1 -0
- data/public/vendor/underscore/CONTRIBUTING.md +9 -0
- data/public/vendor/underscore/LICENSE +22 -0
- data/public/vendor/underscore/README.md +19 -0
- data/public/vendor/underscore/Rakefile +10 -0
- data/public/vendor/underscore/docs/docco.css +192 -0
- data/public/vendor/underscore/docs/favicon.ico +0 -0
- data/public/vendor/underscore/docs/images/background.png +0 -0
- data/public/vendor/underscore/docs/images/underscore.png +0 -0
- data/public/vendor/underscore/docs/underscore.html +823 -0
- data/public/vendor/underscore/favicon.ico +0 -0
- data/public/vendor/underscore/index.html +2467 -0
- data/public/vendor/underscore/index.js +1 -0
- data/public/vendor/underscore/package.json +16 -0
- data/public/vendor/underscore/test/arrays.js +200 -0
- data/public/vendor/underscore/test/chaining.js +59 -0
- data/public/vendor/underscore/test/collections.js +453 -0
- data/public/vendor/underscore/test/functions.js +265 -0
- data/public/vendor/underscore/test/index.html +44 -0
- data/public/vendor/underscore/test/objects.js +570 -0
- data/public/vendor/underscore/test/speed.js +75 -0
- data/public/vendor/underscore/test/utility.js +266 -0
- data/public/vendor/underscore/test/vendor/jquery.js +9404 -0
- data/public/vendor/underscore/test/vendor/jslitmus.js +670 -0
- data/public/vendor/underscore/test/vendor/qunit.css +235 -0
- data/public/vendor/underscore/test/vendor/qunit.js +1977 -0
- data/public/vendor/underscore/test/vendor/runner.js +98 -0
- data/public/vendor/underscore/underscore-min.js +1 -0
- data/public/vendor/underscore/underscore.js +1226 -0
- data/views/dashboard.haml +1 -1
- data/views/layout.haml +8 -4
- metadata +132 -25
- data/public/vendor/bootstrap/_layouts/customize.html +0 -52
- data/public/vendor/bootstrap/assets/js/jquery.bbq.min.js +0 -1287
- data/public/vendor/bootstrap-glyphicons/CHANGELOG.md +0 -3
- data/public/vendor/bootstrap-glyphicons/CNAME +0 -1
- data/public/vendor/bootstrap-glyphicons/CONTRIBUTING.md +0 -54
- data/public/vendor/bootstrap-glyphicons/LICENSE +0 -19
- data/public/vendor/bootstrap-glyphicons/README.md +0 -61
- data/public/vendor/bootstrap-glyphicons/_config.yml +0 -12
- data/public/vendor/bootstrap-glyphicons/composer.json +0 -9
- data/public/vendor/bootstrap-glyphicons/css/bootstrap-glyphicons.css +0 -2
- data/public/vendor/bootstrap-glyphicons/css/bootstrap.css +0 -9
- data/public/vendor/bootstrap-glyphicons/css/docs.css +0 -160
- data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.eot +0 -0
- data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.otf +0 -0
- data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.svg +0 -175
- data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.ttf +0 -0
- data/public/vendor/bootstrap-glyphicons/fonts/glyphiconshalflings-regular.woff +0 -0
- data/public/vendor/bootstrap-glyphicons/index.html +0 -255
- data/public/vendor/bootstrap-glyphicons/less/bootstrap-glyphicons.less +0 -201
- data/public/vendor/bootstrap-glyphicons/package.json +0 -18
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "backbone",
|
|
3
|
+
"description": "Give your JS App some Backbone with Models, Views, Collections, and Events.",
|
|
4
|
+
"homepage": "http://backbonejs.org/",
|
|
5
|
+
"keywords": ["model", "view", "controller", "router", "server", "client", "browser"],
|
|
6
|
+
"author": "Jeremy Ashkenas <jeremy@documentcloud.org>",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git://github.com/components/backbone.git"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"jquery": "~2.0.3",
|
|
13
|
+
"underscore": "~1.4.4"
|
|
14
|
+
},
|
|
15
|
+
"version": "1.0.0",
|
|
16
|
+
"main": "backbone.js"
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "backbone",
|
|
3
|
+
"repo": "components/backbone",
|
|
4
|
+
"description": "Give your JS App some Backbone with Models, Views, Collections, and Events.",
|
|
5
|
+
"homepage": "http://backbonejs.org/",
|
|
6
|
+
"keywords": ["model", "view", "controller", "router", "server", "client", "browser"],
|
|
7
|
+
"author": "Jeremy Ashkenas <jeremy@documentcloud.org>",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git://github.com/components/backbone.git"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"components/jquery": "2.0.3",
|
|
14
|
+
"components/underscore": "1.4.4"
|
|
15
|
+
},
|
|
16
|
+
"version": "1.0.0",
|
|
17
|
+
"main": "backbone.js",
|
|
18
|
+
"scripts": [
|
|
19
|
+
"backbone.js"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "components/backbone",
|
|
3
|
+
"description": "Give your JS App some Backbone with Models, Views, Collections, and Events.",
|
|
4
|
+
"keywords": ["model", "view", "controller", "router", "server", "client", "browser"],
|
|
5
|
+
"type": "component",
|
|
6
|
+
"homepage": "http://backbonejs.org",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"support": {
|
|
9
|
+
"issues": "https://github.com/documentcloud/backbone/issues",
|
|
10
|
+
"source": "https://github.com/documentcloud/backbone"
|
|
11
|
+
},
|
|
12
|
+
"authors": [
|
|
13
|
+
{
|
|
14
|
+
"name": "Jeremy Ashkenas",
|
|
15
|
+
"email": "jeremy@documentcloud.org"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"require": {
|
|
19
|
+
"components/underscore": ">=1.4.3"
|
|
20
|
+
},
|
|
21
|
+
"extra": {
|
|
22
|
+
"component": {
|
|
23
|
+
"scripts": [
|
|
24
|
+
"backbone.js"
|
|
25
|
+
],
|
|
26
|
+
"files": [
|
|
27
|
+
"backbone-min.js"
|
|
28
|
+
],
|
|
29
|
+
"shim": {
|
|
30
|
+
"deps": [
|
|
31
|
+
"underscore"
|
|
32
|
+
],
|
|
33
|
+
"exports": "Backbone"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "components-backbone",
|
|
3
|
+
"description": "Give your JS App some Backbone with Models, Views, Collections, and Events. Shim repository.",
|
|
4
|
+
"homepage": "http://backbonejs.org",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"model",
|
|
7
|
+
"view",
|
|
8
|
+
"controller",
|
|
9
|
+
"router",
|
|
10
|
+
"server",
|
|
11
|
+
"client",
|
|
12
|
+
"browser"
|
|
13
|
+
],
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"underscore": ">=1.4.3"
|
|
16
|
+
},
|
|
17
|
+
"author": "Jeremy Ashkenas <jeremy@documentcloud.org>",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git://github.com/components/backbone.git"
|
|
21
|
+
},
|
|
22
|
+
"main": "backbone.js",
|
|
23
|
+
"version": "1.0.0"
|
|
24
|
+
}
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
// Word cloud layout by Jason Davies, http://www.jasondavies.com/word-cloud/
|
|
2
|
+
// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf
|
|
3
|
+
(function(exports) {
|
|
4
|
+
function cloud() {
|
|
5
|
+
var size = [256, 256],
|
|
6
|
+
text = cloudText,
|
|
7
|
+
font = cloudFont,
|
|
8
|
+
fontSize = cloudFontSize,
|
|
9
|
+
fontStyle = cloudFontNormal,
|
|
10
|
+
fontWeight = cloudFontNormal,
|
|
11
|
+
rotate = cloudRotate,
|
|
12
|
+
padding = cloudPadding,
|
|
13
|
+
spiral = archimedeanSpiral,
|
|
14
|
+
words = [],
|
|
15
|
+
timeInterval = Infinity,
|
|
16
|
+
event = d3.dispatch("word", "end"),
|
|
17
|
+
timer = null,
|
|
18
|
+
cloud = {};
|
|
19
|
+
|
|
20
|
+
cloud.start = function() {
|
|
21
|
+
var board = zeroArray((size[0] >> 5) * size[1]),
|
|
22
|
+
bounds = null,
|
|
23
|
+
n = words.length,
|
|
24
|
+
i = -1,
|
|
25
|
+
tags = [],
|
|
26
|
+
data = words.map(function(d, i) {
|
|
27
|
+
d.text = text.call(this, d, i);
|
|
28
|
+
d.font = font.call(this, d, i);
|
|
29
|
+
d.style = fontStyle.call(this, d, i);
|
|
30
|
+
d.weight = fontWeight.call(this, d, i);
|
|
31
|
+
d.rotate = rotate.call(this, d, i);
|
|
32
|
+
d.size = ~~fontSize.call(this, d, i);
|
|
33
|
+
d.padding = padding.call(this, d, i);
|
|
34
|
+
return d;
|
|
35
|
+
}).sort(function(a, b) { return b.size - a.size; });
|
|
36
|
+
|
|
37
|
+
if (timer) clearInterval(timer);
|
|
38
|
+
timer = setInterval(step, 0);
|
|
39
|
+
step();
|
|
40
|
+
|
|
41
|
+
return cloud;
|
|
42
|
+
|
|
43
|
+
function step() {
|
|
44
|
+
var start = +new Date,
|
|
45
|
+
d;
|
|
46
|
+
while (+new Date - start < timeInterval && ++i < n && timer) {
|
|
47
|
+
d = data[i];
|
|
48
|
+
d.x = (size[0] * (Math.random() + .5)) >> 1;
|
|
49
|
+
d.y = (size[1] * (Math.random() + .5)) >> 1;
|
|
50
|
+
cloudSprite(d, data, i);
|
|
51
|
+
if (d.hasText && place(board, d, bounds)) {
|
|
52
|
+
tags.push(d);
|
|
53
|
+
event.word(d);
|
|
54
|
+
if (bounds) cloudBounds(bounds, d);
|
|
55
|
+
else bounds = [{x: d.x + d.x0, y: d.y + d.y0}, {x: d.x + d.x1, y: d.y + d.y1}];
|
|
56
|
+
// Temporary hack
|
|
57
|
+
d.x -= size[0] >> 1;
|
|
58
|
+
d.y -= size[1] >> 1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (i >= n) {
|
|
62
|
+
cloud.stop();
|
|
63
|
+
event.end(tags, bounds);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
cloud.stop = function() {
|
|
69
|
+
if (timer) {
|
|
70
|
+
clearInterval(timer);
|
|
71
|
+
timer = null;
|
|
72
|
+
}
|
|
73
|
+
return cloud;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
cloud.timeInterval = function(x) {
|
|
77
|
+
if (!arguments.length) return timeInterval;
|
|
78
|
+
timeInterval = x == null ? Infinity : x;
|
|
79
|
+
return cloud;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
function place(board, tag, bounds) {
|
|
83
|
+
var perimeter = [{x: 0, y: 0}, {x: size[0], y: size[1]}],
|
|
84
|
+
startX = tag.x,
|
|
85
|
+
startY = tag.y,
|
|
86
|
+
maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]),
|
|
87
|
+
s = spiral(size),
|
|
88
|
+
dt = Math.random() < .5 ? 1 : -1,
|
|
89
|
+
t = -dt,
|
|
90
|
+
dxdy,
|
|
91
|
+
dx,
|
|
92
|
+
dy;
|
|
93
|
+
|
|
94
|
+
while (dxdy = s(t += dt)) {
|
|
95
|
+
dx = ~~dxdy[0];
|
|
96
|
+
dy = ~~dxdy[1];
|
|
97
|
+
|
|
98
|
+
if (Math.min(dx, dy) > maxDelta) break;
|
|
99
|
+
|
|
100
|
+
tag.x = startX + dx;
|
|
101
|
+
tag.y = startY + dy;
|
|
102
|
+
|
|
103
|
+
if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 ||
|
|
104
|
+
tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue;
|
|
105
|
+
// TODO only check for collisions within current bounds.
|
|
106
|
+
if (!bounds || !cloudCollide(tag, board, size[0])) {
|
|
107
|
+
if (!bounds || collideRects(tag, bounds)) {
|
|
108
|
+
var sprite = tag.sprite,
|
|
109
|
+
w = tag.width >> 5,
|
|
110
|
+
sw = size[0] >> 5,
|
|
111
|
+
lx = tag.x - (w << 4),
|
|
112
|
+
sx = lx & 0x7f,
|
|
113
|
+
msx = 32 - sx,
|
|
114
|
+
h = tag.y1 - tag.y0,
|
|
115
|
+
x = (tag.y + tag.y0) * sw + (lx >> 5),
|
|
116
|
+
last;
|
|
117
|
+
for (var j = 0; j < h; j++) {
|
|
118
|
+
last = 0;
|
|
119
|
+
for (var i = 0; i <= w; i++) {
|
|
120
|
+
board[x + i] |= (last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0);
|
|
121
|
+
}
|
|
122
|
+
x += sw;
|
|
123
|
+
}
|
|
124
|
+
delete tag.sprite;
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
cloud.words = function(x) {
|
|
133
|
+
if (!arguments.length) return words;
|
|
134
|
+
words = x;
|
|
135
|
+
return cloud;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
cloud.size = function(x) {
|
|
139
|
+
if (!arguments.length) return size;
|
|
140
|
+
size = [+x[0], +x[1]];
|
|
141
|
+
return cloud;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
cloud.font = function(x) {
|
|
145
|
+
if (!arguments.length) return font;
|
|
146
|
+
font = d3.functor(x);
|
|
147
|
+
return cloud;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
cloud.fontStyle = function(x) {
|
|
151
|
+
if (!arguments.length) return fontStyle;
|
|
152
|
+
fontStyle = d3.functor(x);
|
|
153
|
+
return cloud;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
cloud.fontWeight = function(x) {
|
|
157
|
+
if (!arguments.length) return fontWeight;
|
|
158
|
+
fontWeight = d3.functor(x);
|
|
159
|
+
return cloud;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
cloud.rotate = function(x) {
|
|
163
|
+
if (!arguments.length) return rotate;
|
|
164
|
+
rotate = d3.functor(x);
|
|
165
|
+
return cloud;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
cloud.text = function(x) {
|
|
169
|
+
if (!arguments.length) return text;
|
|
170
|
+
text = d3.functor(x);
|
|
171
|
+
return cloud;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
cloud.spiral = function(x) {
|
|
175
|
+
if (!arguments.length) return spiral;
|
|
176
|
+
spiral = spirals[x + ""] || x;
|
|
177
|
+
return cloud;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
cloud.fontSize = function(x) {
|
|
181
|
+
if (!arguments.length) return fontSize;
|
|
182
|
+
fontSize = d3.functor(x);
|
|
183
|
+
return cloud;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
cloud.padding = function(x) {
|
|
187
|
+
if (!arguments.length) return padding;
|
|
188
|
+
padding = d3.functor(x);
|
|
189
|
+
return cloud;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
return d3.rebind(cloud, event, "on");
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function cloudText(d) {
|
|
196
|
+
return d.text;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function cloudFont() {
|
|
200
|
+
return "serif";
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function cloudFontNormal() {
|
|
204
|
+
return "normal";
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function cloudFontSize(d) {
|
|
208
|
+
return Math.sqrt(d.value);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function cloudRotate() {
|
|
212
|
+
return (~~(Math.random() * 6) - 3) * 30;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function cloudPadding() {
|
|
216
|
+
return 1;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Fetches a monochrome sprite bitmap for the specified text.
|
|
220
|
+
// Load in batches for speed.
|
|
221
|
+
function cloudSprite(d, data, di) {
|
|
222
|
+
if (d.sprite) return;
|
|
223
|
+
c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio);
|
|
224
|
+
var x = 0,
|
|
225
|
+
y = 0,
|
|
226
|
+
maxh = 0,
|
|
227
|
+
n = data.length;
|
|
228
|
+
--di;
|
|
229
|
+
while (++di < n) {
|
|
230
|
+
d = data[di];
|
|
231
|
+
c.save();
|
|
232
|
+
c.font = d.style + " " + d.weight + " " + ~~((d.size + 1) / ratio) + "px " + d.font;
|
|
233
|
+
var w = c.measureText(d.text + "m").width * ratio,
|
|
234
|
+
h = d.size << 1;
|
|
235
|
+
if (d.rotate) {
|
|
236
|
+
var sr = Math.sin(d.rotate * cloudRadians),
|
|
237
|
+
cr = Math.cos(d.rotate * cloudRadians),
|
|
238
|
+
wcr = w * cr,
|
|
239
|
+
wsr = w * sr,
|
|
240
|
+
hcr = h * cr,
|
|
241
|
+
hsr = h * sr;
|
|
242
|
+
w = (Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f) >> 5 << 5;
|
|
243
|
+
h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr));
|
|
244
|
+
} else {
|
|
245
|
+
w = (w + 0x1f) >> 5 << 5;
|
|
246
|
+
}
|
|
247
|
+
if (h > maxh) maxh = h;
|
|
248
|
+
if (x + w >= (cw << 5)) {
|
|
249
|
+
x = 0;
|
|
250
|
+
y += maxh;
|
|
251
|
+
maxh = 0;
|
|
252
|
+
}
|
|
253
|
+
if (y + h >= ch) break;
|
|
254
|
+
c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio);
|
|
255
|
+
if (d.rotate) c.rotate(d.rotate * cloudRadians);
|
|
256
|
+
c.fillText(d.text, 0, 0);
|
|
257
|
+
if (d.padding) c.lineWidth = 2 * d.padding, c.strokeText(d.text, 0, 0);
|
|
258
|
+
c.restore();
|
|
259
|
+
d.width = w;
|
|
260
|
+
d.height = h;
|
|
261
|
+
d.xoff = x;
|
|
262
|
+
d.yoff = y;
|
|
263
|
+
d.x1 = w >> 1;
|
|
264
|
+
d.y1 = h >> 1;
|
|
265
|
+
d.x0 = -d.x1;
|
|
266
|
+
d.y0 = -d.y1;
|
|
267
|
+
d.hasText = true;
|
|
268
|
+
x += w;
|
|
269
|
+
}
|
|
270
|
+
var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data,
|
|
271
|
+
sprite = [];
|
|
272
|
+
while (--di >= 0) {
|
|
273
|
+
d = data[di];
|
|
274
|
+
if (!d.hasText) continue;
|
|
275
|
+
var w = d.width,
|
|
276
|
+
w32 = w >> 5,
|
|
277
|
+
h = d.y1 - d.y0;
|
|
278
|
+
// Zero the buffer
|
|
279
|
+
for (var i = 0; i < h * w32; i++) sprite[i] = 0;
|
|
280
|
+
x = d.xoff;
|
|
281
|
+
if (x == null) return;
|
|
282
|
+
y = d.yoff;
|
|
283
|
+
var seen = 0,
|
|
284
|
+
seenRow = -1;
|
|
285
|
+
for (var j = 0; j < h; j++) {
|
|
286
|
+
for (var i = 0; i < w; i++) {
|
|
287
|
+
var k = w32 * j + (i >> 5),
|
|
288
|
+
m = pixels[((y + j) * (cw << 5) + (x + i)) << 2] ? 1 << (31 - (i % 32)) : 0;
|
|
289
|
+
sprite[k] |= m;
|
|
290
|
+
seen |= m;
|
|
291
|
+
}
|
|
292
|
+
if (seen) seenRow = j;
|
|
293
|
+
else {
|
|
294
|
+
d.y0++;
|
|
295
|
+
h--;
|
|
296
|
+
j--;
|
|
297
|
+
y++;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
d.y1 = d.y0 + seenRow;
|
|
301
|
+
d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// Use mask-based collision detection.
|
|
306
|
+
function cloudCollide(tag, board, sw) {
|
|
307
|
+
sw >>= 5;
|
|
308
|
+
var sprite = tag.sprite,
|
|
309
|
+
w = tag.width >> 5,
|
|
310
|
+
lx = tag.x - (w << 4),
|
|
311
|
+
sx = lx & 0x7f,
|
|
312
|
+
msx = 32 - sx,
|
|
313
|
+
h = tag.y1 - tag.y0,
|
|
314
|
+
x = (tag.y + tag.y0) * sw + (lx >> 5),
|
|
315
|
+
last;
|
|
316
|
+
for (var j = 0; j < h; j++) {
|
|
317
|
+
last = 0;
|
|
318
|
+
for (var i = 0; i <= w; i++) {
|
|
319
|
+
if (((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0))
|
|
320
|
+
& board[x + i]) return true;
|
|
321
|
+
}
|
|
322
|
+
x += sw;
|
|
323
|
+
}
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function cloudBounds(bounds, d) {
|
|
328
|
+
var b0 = bounds[0],
|
|
329
|
+
b1 = bounds[1];
|
|
330
|
+
if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0;
|
|
331
|
+
if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0;
|
|
332
|
+
if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1;
|
|
333
|
+
if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function collideRects(a, b) {
|
|
337
|
+
return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function archimedeanSpiral(size) {
|
|
341
|
+
var e = size[0] / size[1];
|
|
342
|
+
return function(t) {
|
|
343
|
+
return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)];
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function rectangularSpiral(size) {
|
|
348
|
+
var dy = 4,
|
|
349
|
+
dx = dy * size[0] / size[1],
|
|
350
|
+
x = 0,
|
|
351
|
+
y = 0;
|
|
352
|
+
return function(t) {
|
|
353
|
+
var sign = t < 0 ? -1 : 1;
|
|
354
|
+
// See triangular numbers: T_n = n * (n + 1) / 2.
|
|
355
|
+
switch ((Math.sqrt(1 + 4 * sign * t) - sign) & 3) {
|
|
356
|
+
case 0: x += dx; break;
|
|
357
|
+
case 1: y += dy; break;
|
|
358
|
+
case 2: x -= dx; break;
|
|
359
|
+
default: y -= dy; break;
|
|
360
|
+
}
|
|
361
|
+
return [x, y];
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// TODO reuse arrays?
|
|
366
|
+
function zeroArray(n) {
|
|
367
|
+
var a = [],
|
|
368
|
+
i = -1;
|
|
369
|
+
while (++i < n) a[i] = 0;
|
|
370
|
+
return a;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
var cloudRadians = Math.PI / 180,
|
|
374
|
+
cw = 1 << 11 >> 5,
|
|
375
|
+
ch = 1 << 11,
|
|
376
|
+
canvas,
|
|
377
|
+
ratio = 1;
|
|
378
|
+
|
|
379
|
+
if (typeof document !== "undefined") {
|
|
380
|
+
canvas = document.createElement("canvas");
|
|
381
|
+
canvas.width = 1;
|
|
382
|
+
canvas.height = 1;
|
|
383
|
+
ratio = Math.sqrt(canvas.getContext("2d").getImageData(0, 0, 1, 1).data.length >> 2);
|
|
384
|
+
canvas.width = (cw << 5) / ratio;
|
|
385
|
+
canvas.height = ch / ratio;
|
|
386
|
+
} else {
|
|
387
|
+
// node-canvas support
|
|
388
|
+
var Canvas = require("canvas");
|
|
389
|
+
canvas = new Canvas(cw << 5, ch);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
var c = canvas.getContext("2d"),
|
|
393
|
+
spirals = {
|
|
394
|
+
archimedean: archimedeanSpiral,
|
|
395
|
+
rectangular: rectangularSpiral
|
|
396
|
+
};
|
|
397
|
+
c.fillStyle = c.strokeStyle = "red";
|
|
398
|
+
c.textAlign = "center";
|
|
399
|
+
|
|
400
|
+
exports.cloud = cloud;
|
|
401
|
+
})(typeof exports === "undefined" ? d3.layout || (d3.layout = {}) : exports);
|
|
@@ -163,18 +163,37 @@
|
|
|
163
163
|
// plug-in is not available, we degrade gracefully and revert to eager
|
|
164
164
|
// loading.
|
|
165
165
|
//
|
|
166
|
+
// To have the lazy url trigger based on horizontal offset, set the
|
|
167
|
+
// 'lazy-url-horizontal' data attribute to 'true'.
|
|
168
|
+
//
|
|
169
|
+
// To set a custom context set the 'lazy-url-context' data attribute to a CSS
|
|
170
|
+
// selector. A custom context is an element which acts as the relative point
|
|
171
|
+
// from which the offset is considered. This defaults to the window.
|
|
172
|
+
//
|
|
166
173
|
// Note that we support adding yet-more lazy content onto the page after page
|
|
167
174
|
// initialization, but only when using Replace.js.
|
|
168
175
|
$(document).initializeEach('[data-lazy-url]', function() {
|
|
169
176
|
var $this = $(this);
|
|
170
177
|
if (typeof $.fn.waypoint === 'function') {
|
|
171
|
-
|
|
178
|
+
var waypointOptions = {
|
|
172
179
|
offset: '120%',
|
|
173
180
|
triggerOnce: true,
|
|
174
181
|
handler: function() {
|
|
175
182
|
ajaxReplace($this, $this.data('lazy-url'));
|
|
176
183
|
}
|
|
177
|
-
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
if ($this.data('lazyUrlHorizontal')) {
|
|
187
|
+
waypointOptions.horizontal = true;
|
|
188
|
+
waypointOptions.direction = 'right';
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
var dataContext = $this.data('lazyUrlContext');
|
|
192
|
+
if (dataContext) {
|
|
193
|
+
waypointOptions.context = dataContext;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
$this.waypoint(waypointOptions);
|
|
178
197
|
} else {
|
|
179
198
|
ajaxReplace($this, $this.data('lazy-url'));
|
|
180
199
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
underscorejs.org
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
## How to contribute to Underscore.js
|
|
2
|
+
|
|
3
|
+
* Before you open a ticket or send a pull request, [search](https://github.com/documentcloud/underscore/issues) for previous discussions about the same feature or issue. Add to the earlier ticket if you find one.
|
|
4
|
+
|
|
5
|
+
* Before sending a pull request for a feature, be sure to have [tests](http://underscorejs.org/test/).
|
|
6
|
+
|
|
7
|
+
* Use the same coding style as the rest of the [codebase](https://github.com/documentcloud/underscore/blob/master/underscore.js).
|
|
8
|
+
|
|
9
|
+
* In your pull request, do not add documentation or re-build the minified `underscore-min.js` file. We'll do those things before cutting a new release.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2009-2013 Jeremy Ashkenas, DocumentCloud
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
|
4
|
+
obtaining a copy of this software and associated documentation
|
|
5
|
+
files (the "Software"), to deal in the Software without
|
|
6
|
+
restriction, including without limitation the rights to use,
|
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the
|
|
9
|
+
Software is furnished to do so, subject to the following
|
|
10
|
+
conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be
|
|
13
|
+
included in all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
__
|
|
2
|
+
/\ \ __
|
|
3
|
+
__ __ ___ \_\ \ __ _ __ ____ ___ ___ _ __ __ /\_\ ____
|
|
4
|
+
/\ \/\ \ /' _ `\ /'_ \ /'__`\/\ __\/ ,__\ / ___\ / __`\/\ __\/'__`\ \/\ \ /',__\
|
|
5
|
+
\ \ \_\ \/\ \/\ \/\ \ \ \/\ __/\ \ \//\__, `\/\ \__//\ \ \ \ \ \//\ __/ __ \ \ \/\__, `\
|
|
6
|
+
\ \____/\ \_\ \_\ \___,_\ \____\\ \_\\/\____/\ \____\ \____/\ \_\\ \____\/\_\ _\ \ \/\____/
|
|
7
|
+
\/___/ \/_/\/_/\/__,_ /\/____/ \/_/ \/___/ \/____/\/___/ \/_/ \/____/\/_//\ \_\ \/___/
|
|
8
|
+
\ \____/
|
|
9
|
+
\/___/
|
|
10
|
+
|
|
11
|
+
Underscore.js is a utility-belt library for JavaScript that provides
|
|
12
|
+
support for the usual functional suspects (each, map, reduce, filter...)
|
|
13
|
+
without extending any core JavaScript objects.
|
|
14
|
+
|
|
15
|
+
For Docs, License, Tests, and pre-packed downloads, see:
|
|
16
|
+
http://underscorejs.org
|
|
17
|
+
|
|
18
|
+
Many thanks to our contributors:
|
|
19
|
+
https://github.com/documentcloud/underscore/contributors
|