added node modules
This commit is contained in:
parent
87b11fd617
commit
1b0d9bbe9d
21 changed files with 4343 additions and 0 deletions
47
src/static/node_modules/chosen-js/README.md
generated
vendored
Normal file
47
src/static/node_modules/chosen-js/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
# Chosen
|
||||||
|
|
||||||
|
Chosen is a library for making long, unwieldy select boxes more user friendly.
|
||||||
|
|
||||||
|
- jQuery support: 1.4+
|
||||||
|
- Prototype support: 1.7+
|
||||||
|
|
||||||
|
For **documentation**, usage, and examples, see:
|
||||||
|
http://harvesthq.github.io/chosen/
|
||||||
|
|
||||||
|
For **downloads**, see:
|
||||||
|
https://github.com/harvesthq/chosen/releases/
|
||||||
|
|
||||||
|
### Package managers
|
||||||
|
|
||||||
|
Chosen is available through [Bower](https://bower.io/) and [npm](https://www.npmjs.com),
|
||||||
|
_however, the package names are not the same_.
|
||||||
|
|
||||||
|
To install with Bower:
|
||||||
|
|
||||||
|
```
|
||||||
|
bower install chosen
|
||||||
|
```
|
||||||
|
|
||||||
|
To install with npm:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install chosen-js
|
||||||
|
```
|
||||||
|
|
||||||
|
The compiled files for these packages are automatically generated and stored in a [2nd Chosen repository](https://github.com/harvesthq/chosen-package). No pull requests will be accepted to that repository.
|
||||||
|
|
||||||
|
### Contributing to this project
|
||||||
|
|
||||||
|
We welcome all to participate in making Chosen the best software it can be. The repository is maintained by only a few people, but has accepted contributions from over 50 authors after reviewing hundreds of pull requests related to thousands of issues. You can help reduce the maintainers' workload (and increase your chance of having an accepted contribution to Chosen) by following the
|
||||||
|
[guidelines for contributing](contributing.md).
|
||||||
|
|
||||||
|
* [Bug reports](contributing.md#bugs)
|
||||||
|
* [Feature requests](contributing.md#features)
|
||||||
|
* [Pull requests](contributing.md#pull-requests)
|
||||||
|
|
||||||
|
### Chosen Credits
|
||||||
|
|
||||||
|
- Concept and development by [Patrick Filler](http://patrickfiller.com) for [Harvest](http://getharvest.com/).
|
||||||
|
- Design and CSS by [Matthew Lettini](http://matthewlettini.com/)
|
||||||
|
- Repository maintained by [@pfiller](http://github.com/pfiller), [@kenearley](http://github.com/kenearley), [@stof](http://github.com/stof), [@koenpunt](http://github.com/koenpunt), and [@tjschuck](http://github.com/tjschuck).
|
||||||
|
- Chosen includes [contributions by many fine folks](https://github.com/harvesthq/chosen/contributors).
|
||||||
BIN
src/static/node_modules/chosen-js/chosen-sprite.png
generated
vendored
Normal file
BIN
src/static/node_modules/chosen-js/chosen-sprite.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 538 B |
BIN
src/static/node_modules/chosen-js/chosen-sprite@2x.png
generated
vendored
Normal file
BIN
src/static/node_modules/chosen-js/chosen-sprite@2x.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 738 B |
476
src/static/node_modules/chosen-js/chosen.css
generated
vendored
Normal file
476
src/static/node_modules/chosen-js/chosen.css
generated
vendored
Normal file
|
|
@ -0,0 +1,476 @@
|
||||||
|
/*!
|
||||||
|
Chosen, a Select Box Enhancer for jQuery and Prototype
|
||||||
|
by Patrick Filler for Harvest, http://getharvest.com
|
||||||
|
|
||||||
|
Version 1.7.0
|
||||||
|
Full source at https://github.com/harvesthq/chosen
|
||||||
|
Copyright (c) 2011-2017 Harvest http://getharvest.com
|
||||||
|
|
||||||
|
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
||||||
|
This file is generated by `grunt build`, do not edit it by hand.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* @group Base */
|
||||||
|
.chosen-container {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
font-size: 13px;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container * {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container .chosen-drop {
|
||||||
|
position: absolute;
|
||||||
|
top: 100%;
|
||||||
|
z-index: 1010;
|
||||||
|
width: 100%;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
border-top: 0;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
||||||
|
clip: rect(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container.chosen-with-drop .chosen-drop {
|
||||||
|
clip: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container a {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container .search-choice .group-name, .chosen-container .chosen-single .group-name {
|
||||||
|
margin-right: 4px;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
font-weight: normal;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container .search-choice .group-name:after, .chosen-container .chosen-single .group-name:after {
|
||||||
|
content: ":";
|
||||||
|
padding-left: 2px;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @end */
|
||||||
|
/* @group Single Chosen */
|
||||||
|
.chosen-container-single .chosen-single {
|
||||||
|
position: relative;
|
||||||
|
display: block;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 0 0 0 8px;
|
||||||
|
height: 25px;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: #fff;
|
||||||
|
background: linear-gradient(#fff 20%, #f6f6f6 50%, #eee 52%, #f4f4f4 100%);
|
||||||
|
background-clip: padding-box;
|
||||||
|
box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(0, 0, 0, 0.1);
|
||||||
|
color: #444;
|
||||||
|
text-decoration: none;
|
||||||
|
white-space: nowrap;
|
||||||
|
line-height: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-single .chosen-default {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-single .chosen-single span {
|
||||||
|
display: block;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-right: 26px;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-single .chosen-single-with-deselect span {
|
||||||
|
margin-right: 38px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-single .chosen-single abbr {
|
||||||
|
position: absolute;
|
||||||
|
top: 6px;
|
||||||
|
right: 26px;
|
||||||
|
display: block;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
background: url("chosen-sprite.png") -42px 1px no-repeat;
|
||||||
|
font-size: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-single .chosen-single abbr:hover {
|
||||||
|
background-position: -42px -10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-single.chosen-disabled .chosen-single abbr:hover {
|
||||||
|
background-position: -42px -10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-single .chosen-single div {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
display: block;
|
||||||
|
width: 18px;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-single .chosen-single div b {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: url("chosen-sprite.png") no-repeat 0px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-single .chosen-search {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1010;
|
||||||
|
margin: 0;
|
||||||
|
padding: 3px 4px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-single .chosen-search input[type="text"] {
|
||||||
|
margin: 1px 0;
|
||||||
|
padding: 4px 20px 4px 5px;
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
outline: 0;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
background: url("chosen-sprite.png") no-repeat 100% -20px;
|
||||||
|
font-size: 1em;
|
||||||
|
font-family: sans-serif;
|
||||||
|
line-height: normal;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-single .chosen-drop {
|
||||||
|
margin-top: -1px;
|
||||||
|
border-radius: 0 0 4px 4px;
|
||||||
|
background-clip: padding-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
|
||||||
|
position: absolute;
|
||||||
|
clip: rect(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @end */
|
||||||
|
/* @group Results */
|
||||||
|
.chosen-container .chosen-results {
|
||||||
|
color: #444;
|
||||||
|
position: relative;
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
margin: 0 4px 4px 0;
|
||||||
|
padding: 0 0 0 4px;
|
||||||
|
max-height: 240px;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container .chosen-results li {
|
||||||
|
display: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 5px 6px;
|
||||||
|
list-style: none;
|
||||||
|
line-height: 15px;
|
||||||
|
word-wrap: break-word;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container .chosen-results li.active-result {
|
||||||
|
display: list-item;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container .chosen-results li.disabled-result {
|
||||||
|
display: list-item;
|
||||||
|
color: #ccc;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container .chosen-results li.highlighted {
|
||||||
|
background-color: #3875d7;
|
||||||
|
background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container .chosen-results li.no-results {
|
||||||
|
color: #777;
|
||||||
|
display: list-item;
|
||||||
|
background: #f4f4f4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container .chosen-results li.group-result {
|
||||||
|
display: list-item;
|
||||||
|
font-weight: bold;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container .chosen-results li.group-option {
|
||||||
|
padding-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container .chosen-results li em {
|
||||||
|
font-style: normal;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @end */
|
||||||
|
/* @group Multi Chosen */
|
||||||
|
.chosen-container-multi .chosen-choices {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 5px;
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
background-color: #fff;
|
||||||
|
background-image: linear-gradient(#eee 1%, #fff 15%);
|
||||||
|
cursor: text;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-multi .chosen-choices li {
|
||||||
|
float: left;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-multi .chosen-choices li.search-field {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
|
||||||
|
margin: 1px 0;
|
||||||
|
padding: 0;
|
||||||
|
height: 25px;
|
||||||
|
outline: 0;
|
||||||
|
border: 0 !important;
|
||||||
|
background: transparent !important;
|
||||||
|
box-shadow: none;
|
||||||
|
color: #999;
|
||||||
|
font-size: 100%;
|
||||||
|
font-family: sans-serif;
|
||||||
|
line-height: normal;
|
||||||
|
border-radius: 0;
|
||||||
|
width: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-multi .chosen-choices li.search-choice {
|
||||||
|
position: relative;
|
||||||
|
margin: 3px 5px 3px 0;
|
||||||
|
padding: 3px 20px 3px 5px;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
max-width: 100%;
|
||||||
|
border-radius: 3px;
|
||||||
|
background-color: #eeeeee;
|
||||||
|
background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
|
||||||
|
background-size: 100% 19px;
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
background-clip: padding-box;
|
||||||
|
box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
|
||||||
|
color: #333;
|
||||||
|
line-height: 13px;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-multi .chosen-choices li.search-choice span {
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
|
||||||
|
position: absolute;
|
||||||
|
top: 4px;
|
||||||
|
right: 3px;
|
||||||
|
display: block;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
background: url("chosen-sprite.png") -42px 1px no-repeat;
|
||||||
|
font-size: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
|
||||||
|
background-position: -42px -10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-multi .chosen-choices li.search-choice-disabled {
|
||||||
|
padding-right: 5px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
background-color: #e4e4e4;
|
||||||
|
background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-multi .chosen-choices li.search-choice-focus {
|
||||||
|
background: #d4d4d4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
|
||||||
|
background-position: -42px -10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-multi .chosen-results {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-multi .chosen-drop .result-selected {
|
||||||
|
display: list-item;
|
||||||
|
color: #ccc;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @end */
|
||||||
|
/* @group Active */
|
||||||
|
.chosen-container-active .chosen-single {
|
||||||
|
border: 1px solid #5897fb;
|
||||||
|
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-active.chosen-with-drop .chosen-single {
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
background-image: linear-gradient(#eee 20%, #fff 80%);
|
||||||
|
box-shadow: 0 1px 0 #fff inset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-active.chosen-with-drop .chosen-single div {
|
||||||
|
border-left: none;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-active.chosen-with-drop .chosen-single div b {
|
||||||
|
background-position: -18px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-active .chosen-choices {
|
||||||
|
border: 1px solid #5897fb;
|
||||||
|
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-container-active .chosen-choices li.search-field input[type="text"] {
|
||||||
|
color: #222 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @end */
|
||||||
|
/* @group Disabled Support */
|
||||||
|
.chosen-disabled {
|
||||||
|
opacity: 0.5 !important;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-disabled .chosen-single {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @end */
|
||||||
|
/* @group Right to Left */
|
||||||
|
.chosen-rtl {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-rtl .chosen-single {
|
||||||
|
overflow: visible;
|
||||||
|
padding: 0 8px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-rtl .chosen-single span {
|
||||||
|
margin-right: 0;
|
||||||
|
margin-left: 26px;
|
||||||
|
direction: rtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-rtl .chosen-single-with-deselect span {
|
||||||
|
margin-left: 38px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-rtl .chosen-single div {
|
||||||
|
right: auto;
|
||||||
|
left: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-rtl .chosen-single abbr {
|
||||||
|
right: auto;
|
||||||
|
left: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-rtl .chosen-choices li {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-rtl .chosen-choices li.search-field input[type="text"] {
|
||||||
|
direction: rtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-rtl .chosen-choices li.search-choice {
|
||||||
|
margin: 3px 5px 3px 0;
|
||||||
|
padding: 3px 5px 3px 19px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-rtl .chosen-choices li.search-choice .search-choice-close {
|
||||||
|
right: auto;
|
||||||
|
left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-rtl.chosen-container-single .chosen-results {
|
||||||
|
margin: 0 0 4px 4px;
|
||||||
|
padding: 0 4px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-rtl .chosen-results li.group-option {
|
||||||
|
padding-right: 15px;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-rtl .chosen-search input[type="text"] {
|
||||||
|
padding: 4px 5px 4px 20px;
|
||||||
|
background: url("chosen-sprite.png") no-repeat -30px -20px;
|
||||||
|
direction: rtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-rtl.chosen-container-single .chosen-single div b {
|
||||||
|
background-position: 6px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
|
||||||
|
background-position: -12px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @end */
|
||||||
|
/* @group Retina compatibility */
|
||||||
|
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi), only screen and (min-resolution: 1.5dppx) {
|
||||||
|
.chosen-rtl .chosen-search input[type="text"],
|
||||||
|
.chosen-container-single .chosen-single abbr,
|
||||||
|
.chosen-container-single .chosen-single div b,
|
||||||
|
.chosen-container-single .chosen-search input[type="text"],
|
||||||
|
.chosen-container-multi .chosen-choices .search-choice .search-choice-close,
|
||||||
|
.chosen-container .chosen-results-scroll-down span,
|
||||||
|
.chosen-container .chosen-results-scroll-up span {
|
||||||
|
background-image: url("chosen-sprite@2x.png") !important;
|
||||||
|
background-size: 52px 37px !important;
|
||||||
|
background-repeat: no-repeat !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @end */
|
||||||
1309
src/static/node_modules/chosen-js/chosen.jquery.js
generated
vendored
Normal file
1309
src/static/node_modules/chosen-js/chosen.jquery.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
110
src/static/node_modules/chosen-js/package.json
generated
vendored
Normal file
110
src/static/node_modules/chosen-js/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"raw": "chosen-js",
|
||||||
|
"scope": null,
|
||||||
|
"escapedName": "chosen-js",
|
||||||
|
"name": "chosen-js",
|
||||||
|
"rawSpec": "",
|
||||||
|
"spec": "latest",
|
||||||
|
"type": "tag"
|
||||||
|
},
|
||||||
|
"C:\\Box Sync\\pyDataVizDay\\src\\static"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "chosen-js@latest",
|
||||||
|
"_id": "chosen-js@1.7.0",
|
||||||
|
"_inCache": true,
|
||||||
|
"_location": "/chosen-js",
|
||||||
|
"_nodeVersion": "7.7.4",
|
||||||
|
"_npmOperationalInternal": {
|
||||||
|
"host": "packages-18-east.internal.npmjs.com",
|
||||||
|
"tmp": "tmp/chosen-js-1.7.0.tgz_1490389234489_0.23706221161410213"
|
||||||
|
},
|
||||||
|
"_npmUser": {
|
||||||
|
"name": "chosenjs",
|
||||||
|
"email": "chosenjs@getharvest.com"
|
||||||
|
},
|
||||||
|
"_npmVersion": "4.1.2",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"raw": "chosen-js",
|
||||||
|
"scope": null,
|
||||||
|
"escapedName": "chosen-js",
|
||||||
|
"name": "chosen-js",
|
||||||
|
"rawSpec": "",
|
||||||
|
"spec": "latest",
|
||||||
|
"type": "tag"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"#USER"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/chosen-js/-/chosen-js-1.7.0.tgz",
|
||||||
|
"_shasum": "8ceb2e929e2a072886edd384d78989dfbffa58c3",
|
||||||
|
"_shrinkwrap": null,
|
||||||
|
"_spec": "chosen-js",
|
||||||
|
"_where": "C:\\Box Sync\\pyDataVizDay\\src\\static",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/harvesthq/chosen/issues"
|
||||||
|
},
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Patrick Filler",
|
||||||
|
"url": "https://github.com/pfiller"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Christophe Coevoet",
|
||||||
|
"url": "https://github.com/stof"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Ken Earley",
|
||||||
|
"url": "https://github.com/kenearley"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Koen Punt",
|
||||||
|
"url": "https://github.com/koenpunt"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {},
|
||||||
|
"description": "Chosen is a JavaScript plugin that makes select boxes user-friendly. It is currently available in both jQuery and Prototype flavors.",
|
||||||
|
"devDependencies": {},
|
||||||
|
"directories": {},
|
||||||
|
"dist": {
|
||||||
|
"shasum": "8ceb2e929e2a072886edd384d78989dfbffa58c3",
|
||||||
|
"tarball": "https://registry.npmjs.org/chosen-js/-/chosen-js-1.7.0.tgz"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"chosen.jquery.js",
|
||||||
|
"chosen.css",
|
||||||
|
"chosen-sprite@2x.png",
|
||||||
|
"chosen-sprite.png"
|
||||||
|
],
|
||||||
|
"gitHead": "20457c69249226af89fda0b357591622b922b36a",
|
||||||
|
"homepage": "https://harvesthq.github.io/chosen/",
|
||||||
|
"keywords": [
|
||||||
|
"select",
|
||||||
|
"multiselect",
|
||||||
|
"dropdown",
|
||||||
|
"form",
|
||||||
|
"input",
|
||||||
|
"ui"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "chosen.jquery.js",
|
||||||
|
"maintainers": [
|
||||||
|
{
|
||||||
|
"name": "chosenjs",
|
||||||
|
"email": "chosenjs@getharvest.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "chosen-js",
|
||||||
|
"optionalDependencies": {},
|
||||||
|
"readme": "ERROR: No README data found!",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/harvesthq/chosen.git"
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"version": "1.7.0"
|
||||||
|
}
|
||||||
33
src/static/node_modules/wordcloud/.jshintrc
generated
vendored
Normal file
33
src/static/node_modules/wordcloud/.jshintrc
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"camelcase": false,
|
||||||
|
"curly": true,
|
||||||
|
"forin": false,
|
||||||
|
"latedef": "nofunc",
|
||||||
|
"newcap": false,
|
||||||
|
"noarg": true,
|
||||||
|
"nonew": true,
|
||||||
|
"quotmark": "single",
|
||||||
|
"undef": true,
|
||||||
|
"unused": "vars",
|
||||||
|
"strict": true,
|
||||||
|
"trailing": true,
|
||||||
|
"maxlen": 80,
|
||||||
|
|
||||||
|
"eqnull": true,
|
||||||
|
"esnext": true,
|
||||||
|
"expr": true,
|
||||||
|
"globalstrict": true,
|
||||||
|
|
||||||
|
"maxerr": 1000,
|
||||||
|
"regexdash": true,
|
||||||
|
"laxcomma": true,
|
||||||
|
"proto": true,
|
||||||
|
|
||||||
|
"browser": true,
|
||||||
|
"devel": true,
|
||||||
|
"nonstandard": true,
|
||||||
|
"worker": true,
|
||||||
|
|
||||||
|
"-W078": true,
|
||||||
|
"predef": ["define", "module"]
|
||||||
|
}
|
||||||
4
src/static/node_modules/wordcloud/.npmignore
generated
vendored
Normal file
4
src/static/node_modules/wordcloud/.npmignore
generated
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
/slimerjs.log
|
||||||
|
/profile
|
||||||
|
/test
|
||||||
|
/.travis.yml
|
||||||
97
src/static/node_modules/wordcloud/API.md
generated
vendored
Normal file
97
src/static/node_modules/wordcloud/API.md
generated
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
# wordcloud2.js APIs
|
||||||
|
|
||||||
|
## Feature detection
|
||||||
|
|
||||||
|
WordCloud.isSupported
|
||||||
|
|
||||||
|
will evaluates to `false` if the browser doesn't supply necessary functionalities for wordcloud2.js to run.
|
||||||
|
|
||||||
|
## Minimum font size
|
||||||
|
|
||||||
|
Some browsers come with restrictions on minimum font size preference on, and the preference will also impact canvas.
|
||||||
|
wordcloud2.js works around it by scaling the canvas, but you may be interested to know value of the preference. The value detected is accessible at
|
||||||
|
|
||||||
|
WordCloud.minFontSize
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
WordCloud(elements, options);
|
||||||
|
|
||||||
|
`elements` is the DOM Element of the canvas, i.e. `document.getElementById('my_canvas')` or `$('#my_canvas')[0]` in jQuery.
|
||||||
|
It can be also an array of DOM Elements. If a `<canvas>` element is passed, Word Cloud would generate an image on it; if it's some other element, Word Cloud would create `<span>` elements and fill it.
|
||||||
|
|
||||||
|
Depend on the application, you may want to create an image (high fidelity but interaction is limited) or create the "cloud" with DOM to do further styling.
|
||||||
|
|
||||||
|
## Option
|
||||||
|
|
||||||
|
Available options as the property of the `options` object are:
|
||||||
|
|
||||||
|
### Presentation
|
||||||
|
|
||||||
|
* `list`: List of words/text to paint on the canvas in a 2-d array, in the form of `[word, size]`, e.g. `[['foo', 12], ['bar', 6]]`.
|
||||||
|
* `fontFamily`: font to use.
|
||||||
|
* `fontWeight`: font weight to use, e.g. `normal`, `bold` or `600`
|
||||||
|
* `color`: color of the text, can be any CSS color, or a `callback(word, weight, fontSize, distance, theta)` specifies different color for each item in the list.
|
||||||
|
You may also specify colors with built-in keywords: `random-dark` and `random-light`. If this is a DOM cloud, color can also be `null` to disable hardcoding of
|
||||||
|
color into span elements (allowing you to customize at the class level).
|
||||||
|
* `classes`: for DOM clouds, allows the user to define the class of the span elements. Can be a normal class string,
|
||||||
|
applying the same class to every span or a `callback(word, weight, fontSize, distance, theta)` for per-span class definition.
|
||||||
|
In canvas clouds or if equals `null`, this option has no effect.
|
||||||
|
* `minSize`: minimum font size to draw on the canvas.
|
||||||
|
* `weightFactor`: function to call or number to multiply for `size` of each word in the list.
|
||||||
|
* `clearCanvas`: paint the entire canvas with background color and consider it empty before start.
|
||||||
|
* `backgroundColor`: color of the background.
|
||||||
|
|
||||||
|
### Dimension
|
||||||
|
|
||||||
|
* `gridSize`: size of the grid in pixels for marking the availability of the canvas — the larger the grid size, the bigger the gap between words.
|
||||||
|
* `origin`: origin of the “cloud” in `[x, y]`.
|
||||||
|
* `drawOutOfBound`: set to `true` to allow word being draw partly outside of the canvas. Allow word bigger than the size of the canvas to be drawn.
|
||||||
|
|
||||||
|
### Mask
|
||||||
|
|
||||||
|
* `drawMask`: visualize the grid by draw squares to mask the drawn areas.
|
||||||
|
* `maskColor`: color of the mask squares.
|
||||||
|
* `maskGapWidth`: width of the gaps between mask squares.
|
||||||
|
|
||||||
|
### Timing
|
||||||
|
|
||||||
|
* `wait`: Wait for *x* milliseconds before start drawn the next item using `setTimeout`.
|
||||||
|
* `abortThreshold`: If the call with in the loop takes more than *x* milliseconds (and blocks the browser), abort immediately.
|
||||||
|
* `abort`: callback function to call when abort.
|
||||||
|
|
||||||
|
### Rotation
|
||||||
|
|
||||||
|
* `minRotation`: If the word should rotate, the minimum rotation (in rad) the text should rotate.
|
||||||
|
* `maxRotation`: If the word should rotate, the maximum rotation (in rad) the text should rotate. Set the two value equal to keep all text in one angle.
|
||||||
|
* `rotationSteps`: Force the use of a defined number of angles. Set the value equal to 2 in a -90°/90° range means just -90, 0 or 90 will be used.
|
||||||
|
|
||||||
|
### Randomness
|
||||||
|
|
||||||
|
* `shuffle`: Shuffle the points to draw so the result will be different each time for the same list and settings.
|
||||||
|
* `rotateRatio`: Probability for the word to rotate. Set the number to 1 to always rotate.
|
||||||
|
|
||||||
|
### Shape
|
||||||
|
|
||||||
|
* `shape`: The shape of the "cloud" to draw. Can be any polar equation represented as a callback function, or a keyword present.
|
||||||
|
Available presents are `circle` (default), `cardioid` (apple or heart shape curve, the most known polar equation), `diamond` (alias of `square`), `triangle-forward`, `triangle`, (alias of `triangle-upright`, `pentagon`, and `star`.
|
||||||
|
* `ellipticity`: degree of "flatness" of the shape wordcloud2.js should draw.
|
||||||
|
|
||||||
|
### Interactive
|
||||||
|
|
||||||
|
Notice: `hover` and `click` are currently only for HTML5 canvas word clouds.
|
||||||
|
|
||||||
|
* `hover`: callback to call when the cursor enters or leaves a region occupied by a word. The callback will take arugments `callback(item, dimension, event)`, where `event` is the original `mousemove` event.
|
||||||
|
* `click`: callback to call when the user clicks on a word. The callback will take arugments `callback(item, dimension, event)`, where `event` is the original `click` event.
|
||||||
|
|
||||||
|
## Events
|
||||||
|
|
||||||
|
You can listen to those custom DOM events filed from the canvas element, instead of using callbacks for taking the appropriate action.
|
||||||
|
Cancel the first two events causes the operation to stop immediately.
|
||||||
|
|
||||||
|
* `wordcloudstart`
|
||||||
|
* `wordclouddrawn`
|
||||||
|
* `wordcloudstop`
|
||||||
|
* `wordcloudabort`
|
||||||
|
|
||||||
|
wordcloud2.js itself will stop at `wordcloudstart` event.
|
||||||
79
src/static/node_modules/wordcloud/Gruntfile.js
generated
vendored
Normal file
79
src/static/node_modules/wordcloud/Gruntfile.js
generated
vendored
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = function(grunt) {
|
||||||
|
|
||||||
|
var HTTPD_PORT = 28080 + Math.floor(Math.random() * 10);
|
||||||
|
var TEST_URL = 'http://localhost:' + HTTPD_PORT + '/test/';
|
||||||
|
|
||||||
|
var BASE_COMMIT = grunt.option('base-commit') ||
|
||||||
|
process.env.TRAVIS_BRANCH ||
|
||||||
|
'';
|
||||||
|
|
||||||
|
grunt.initConfig({
|
||||||
|
shell: {
|
||||||
|
'qunit-slimerjs': {
|
||||||
|
command: './test/run-slimerjs.sh ' + TEST_URL + '?allownoref=true',
|
||||||
|
options: {
|
||||||
|
stdout: true,
|
||||||
|
stderr: true,
|
||||||
|
failOnError: true,
|
||||||
|
execOptions: {
|
||||||
|
maxBuffer: Infinity
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'compare-slimerjs': {
|
||||||
|
command: './test/run-slimerjs-compare.sh ' +
|
||||||
|
TEST_URL + ' ' + BASE_COMMIT,
|
||||||
|
options: {
|
||||||
|
stdout: true,
|
||||||
|
stderr: true,
|
||||||
|
failOnError: true,
|
||||||
|
execOptions: {
|
||||||
|
maxBuffer: Infinity
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
connect: {
|
||||||
|
test: {
|
||||||
|
options: {
|
||||||
|
port: HTTPD_PORT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
jshint: {
|
||||||
|
options: {
|
||||||
|
jshintrc: true,
|
||||||
|
reporterOutput: "" // Workaround jshint/jshint#2922
|
||||||
|
},
|
||||||
|
all: ['src/*.js']
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||||
|
|
||||||
|
grunt.loadNpmTasks('grunt-shell');
|
||||||
|
grunt.loadNpmTasks('grunt-contrib-connect');
|
||||||
|
|
||||||
|
grunt.registerTask('test', ['jshint','test-slimerjs']);
|
||||||
|
grunt.registerTask('compare', ['compare-slimerjs']);
|
||||||
|
|
||||||
|
// Run the test suite with QUnit on SlimerJS
|
||||||
|
grunt.registerTask('test-slimerjs', ['connect', 'shell:qunit-slimerjs']);
|
||||||
|
|
||||||
|
// Run the test suite with QUnit on SlimerJS
|
||||||
|
grunt.registerTask('compare-slimerjs',
|
||||||
|
['connect', 'shell:compare-slimerjs']);
|
||||||
|
|
||||||
|
grunt.registerTask('travis-ci', function() {
|
||||||
|
if (process.env.TRAVIS_PULL_REQUEST === 'false') {
|
||||||
|
// Not working on pull requests -- simply run test job.
|
||||||
|
grunt.task.run(['test']);
|
||||||
|
} else {
|
||||||
|
// Running on pull requests -- check linting, and compare the images with
|
||||||
|
// the branch to merge.
|
||||||
|
grunt.task.run(['jshint', 'compare']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
20
src/static/node_modules/wordcloud/LICENSE
generated
vendored
Normal file
20
src/static/node_modules/wordcloud/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
Copyright (c) 2011 Timothy Guan-tin Chien, http://timc.idv.tw/
|
||||||
|
|
||||||
|
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.
|
||||||
35
src/static/node_modules/wordcloud/README.md
generated
vendored
Normal file
35
src/static/node_modules/wordcloud/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
# wordcloud2.js [](https://travis-ci.org/timdream/wordcloud2.js) [](http://badge.fury.io/js/wordcloud)
|
||||||
|
|
||||||
|
Create a tag cloud/[Wordle](http://www.wordle.net/) presentation on 2D canvas or HTML.
|
||||||
|
|
||||||
|
This library is a spin-off project from [HTML5 Word Cloud](https://github.com/timdream/wordcloud).
|
||||||
|
|
||||||
|
**Visit the [demo page](http://timdream.org/wordcloud2.js/)**
|
||||||
|
|
||||||
|
## Simple usage
|
||||||
|
|
||||||
|
Load `wordcloud.js` script to the web page, and run:
|
||||||
|
|
||||||
|
WordCloud(document.getElementById('my_canvas'), { list: list } );
|
||||||
|
|
||||||
|
where `list` is an array that look like this: `[['foo', 12], ['bar', 6]]`.
|
||||||
|
|
||||||
|
Options available, see [API documentation](./API.md) for detail.
|
||||||
|
|
||||||
|
## Algorithm
|
||||||
|
|
||||||
|
Before putting each word on the canvas, it is drawn on a separate canvas to read back the pixels to record is drawn spaces.
|
||||||
|
With the information, wordcloud.js will then try to find a place to fit the word that is closest to the start point.
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
Tests are available with [QUnit](http://qunitjs.com/) and `grunt`.
|
||||||
|
To setup environment for testing, run `npm install` and manually install [SlimerJS](http://slimerjs.org/) of your platform.
|
||||||
|
|
||||||
|
Use `grunt test` to ensure all options can be set without JavaScript error.
|
||||||
|
|
||||||
|
Use `grunt compare --base-commit=gh-pages` to compare your proposed fix with `gh-pages` branch.
|
||||||
|
|
||||||
|
## Acknowledgement
|
||||||
|
|
||||||
|
The developer would like to thank [Chad Jensen](mailto:scubaaddiction@gmail.com) for sponsoring the work on image masking on the demo page.
|
||||||
9
src/static/node_modules/wordcloud/bootstrap-responsive.min.css
generated
vendored
Normal file
9
src/static/node_modules/wordcloud/bootstrap-responsive.min.css
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
9
src/static/node_modules/wordcloud/bootstrap.min.css
generated
vendored
Normal file
9
src/static/node_modules/wordcloud/bootstrap.min.css
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
src/static/node_modules/wordcloud/bootstrap.min.js
generated
vendored
Normal file
6
src/static/node_modules/wordcloud/bootstrap.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
205
src/static/node_modules/wordcloud/index.html
generated
vendored
Normal file
205
src/static/node_modules/wordcloud/index.html
generated
vendored
Normal file
|
|
@ -0,0 +1,205 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>wordcloud2.js - tag cloud/Wordle presentation on 2D canvas or HTML</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="author" content="">
|
||||||
|
<!-- Le styles -->
|
||||||
|
<link href="//netdna.bootstrapcdn.com/bootstrap/2.2.2/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link href="//netdna.bootstrapcdn.com/bootstrap/2.2.2/css/bootstrap-responsive.min.css" rel="stylesheet">
|
||||||
|
<link href="//fonts.googleapis.com/css?family=Finger+Paint" id="link-webfont" rel="stylesheet">
|
||||||
|
<script defer src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
|
||||||
|
<script defer src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.2.2/bootstrap.min.js"></script>
|
||||||
|
<script defer src="./src/wordcloud2.js"></script>
|
||||||
|
<script defer src="./index.js"></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@media (min-width: 980px) {
|
||||||
|
body { padding-top: 60px; }
|
||||||
|
}
|
||||||
|
|
||||||
|
*[hidden] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#canvas-container {
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: visible;
|
||||||
|
position: relative;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.canvas {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.canvas.hide {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#html-canvas > span {
|
||||||
|
transition: text-shadow 1s ease, opacity 1s ease;
|
||||||
|
-webkit-transition: text-shadow 1s ease, opacity 1s ease;
|
||||||
|
-ms-transition: text-shadow 1s ease, opacity 1s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
#html-canvas > span:hover {
|
||||||
|
text-shadow: 0 0 10px, 0 0 10px #fff, 0 0 10px #fff, 0 0 10px #fff;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
#box {
|
||||||
|
pointer-events: none;
|
||||||
|
position: absolute;
|
||||||
|
box-shadow: 0 0 200px 200px rgba(255, 255, 255, 0.5);
|
||||||
|
border-radius: 50px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
height: 20em;
|
||||||
|
}
|
||||||
|
#config-option {
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
select { width: 100%; }
|
||||||
|
|
||||||
|
#loading {
|
||||||
|
animation: blink 2s infinite;
|
||||||
|
-webkit-animation: blink 2s infinite;
|
||||||
|
}
|
||||||
|
@-webkit-keyframes blink {
|
||||||
|
0% { opacity: 1; }
|
||||||
|
100% { opacity: 0; }
|
||||||
|
}
|
||||||
|
@keyframes blink {
|
||||||
|
0% { opacity: 1; }
|
||||||
|
100% { opacity: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<script type="text/javascript">
|
||||||
|
if (window.location.hostname === 'timdream.org') {
|
||||||
|
var _gaq = _gaq || [];
|
||||||
|
_gaq.push(['_setAccount', 'UA-4623408-2']);
|
||||||
|
_gaq.push(['_trackPageview']);
|
||||||
|
}
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||||
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||||
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||||
|
})();
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<div class="container">
|
||||||
|
<a class="brand" href="./">wordcloud2.js</a>
|
||||||
|
<ul class="nav">
|
||||||
|
<li class="active"><a href="./">Demo</a></li>
|
||||||
|
<li><a href="https://github.com/timdream/wordcloud2.js">Code</a></li>
|
||||||
|
<li><a href="https://github.com/timdream/wordcloud2.js/blob/gh-pages/README.md">README</a></li>
|
||||||
|
<li><a href="https://github.com/timdream/wordcloud2.js/blob/gh-pages/API.md">API</a></li>
|
||||||
|
<li><a href="https://timdream.org/">timdream</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<p class="lead"><strong>wordcloud2.js</strong>, tag cloud/Wordle presentation on 2D canvas or HTML</p>
|
||||||
|
<div id="not-supported" class="alert" hidden>
|
||||||
|
<strong>Your browser is not supported.</strong>
|
||||||
|
</div>
|
||||||
|
<form id="form" method="get" action="">
|
||||||
|
<div class="row">
|
||||||
|
<div class="span12" id="canvas-container">
|
||||||
|
<canvas id="canvas" class="canvas"></canvas>
|
||||||
|
<div id="html-canvas" class="canvas hide"></div>
|
||||||
|
</div>
|
||||||
|
<div class="span6">
|
||||||
|
<button class="btn btn-primary" type="submit">Run</button>
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn" type="button" id="btn-canvas" disabled title="Show drawn canvas element.">Canvas</button>
|
||||||
|
<button class="btn" type="button" id="btn-html-canvas" title="Show Word Cloud with elements.">Elements</button>
|
||||||
|
</div>
|
||||||
|
<a class="btn" id="btn-save" href="#" download="wordcloud.png" title="Save canvas">Save Image</a>
|
||||||
|
<span id="loading" hidden>......</span>
|
||||||
|
</div>
|
||||||
|
<div class="span6">
|
||||||
|
<select id="examples" class="">
|
||||||
|
<option selected>Examples</option>
|
||||||
|
<option value="love">Love of the world</option>
|
||||||
|
<option value="web-tech">Web Technologies</option>
|
||||||
|
<option value="quick-fox">The quick brown fox</option>
|
||||||
|
<option value="les-miz">Les Misérables</option>
|
||||||
|
<option value="red-chamber" lang="zh-tw">紅樓夢</option>
|
||||||
|
<option value="taiwan">Taiwan</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="tabbable">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<li class="active"><a href="#tab-list" data-toggle="tab">List</a></li>
|
||||||
|
<li><a href="#tab-config" data-toggle="tab">Configuration</a></li>
|
||||||
|
<li><a href="#tab-dim" data-toggle="tab">Dimension</a></li>
|
||||||
|
<li><a href="#tab-mask" data-toggle="tab">Mask image</a></li>
|
||||||
|
<li><a href="#tab-webfont" data-toggle="tab">Web Font</a></li>
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content">
|
||||||
|
<div class="tab-pane active" id="tab-list">
|
||||||
|
<textarea id="input-list" placeholder="Put your list here." rows="2" cols="30" class="span12"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane" id="tab-config">
|
||||||
|
<label>Options as a literal Javascript object</label>
|
||||||
|
<textarea id="config-option" placeholder="Put your literal option object here." rows="2" cols="30" class="span12"></textarea>
|
||||||
|
<!--
|
||||||
|
XXX Security consideration:
|
||||||
|
Do not implement a feature that allow users to submit/share their script here
|
||||||
|
directly or indirectly. Doing so would invite XSS attack on your site.
|
||||||
|
-->
|
||||||
|
<span class="help-block">See <a href="https://github.com/timdream/wordcloud2.js/blob/gh-pages/API.md">API</a> document for available options.</span>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane" id="tab-dim">
|
||||||
|
<label for="config-width">Width</label>
|
||||||
|
<div class="input-append">
|
||||||
|
<input type="number" id="config-width" class="input-small" min="1">
|
||||||
|
<span class="add-on">px</span>
|
||||||
|
</div>
|
||||||
|
<span class="help-block">Leave blank to use page width.</span>
|
||||||
|
<label for="config-height">Height</label>
|
||||||
|
<div class="input-append">
|
||||||
|
<input type="number" id="config-height" class="input-small" min="1">
|
||||||
|
<span class="add-on">px</span>
|
||||||
|
</div>
|
||||||
|
<span class="help-block">Leave blank to use 0.65x of the width.</span>
|
||||||
|
<label for="config-height">Device pixel density (<span title="Dots per 'px' unit">dppx</span>)</label>
|
||||||
|
<div class="input-append">
|
||||||
|
<input type="number" id="config-dppx" class="input-mini" min="1" value="1" required>
|
||||||
|
<span class="add-on">x</span>
|
||||||
|
</div>
|
||||||
|
<span class="help-block">Adjust the weight, grid size, and canvas pixel size for high pixel density displays.</span>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane" id="tab-mask">
|
||||||
|
<label for="config-mask">Image mask</label>
|
||||||
|
<input type="file" id="config-mask"><button id="config-mask-clear" class="btn" type="button">Clear</button>
|
||||||
|
<span class="help-block">A silhouette image which the white area will be excluded from drawing texts. The <code>shape</code> option will continue to apply as the shape of the cloud to grow.</span>
|
||||||
|
<span class="help-block">When there is an image set, <code>clearCanvas</code> will be set to <code>false</code>.</span>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane" id="tab-webfont">
|
||||||
|
<label for="config-css">Extra Web Font CSS</label>
|
||||||
|
<input type="url" id="config-css" size="40" class="input-xxlarge" placeholder="https://fonts.googleapis.com/css?family=Libre+Baskerville:700" value="https://fonts.googleapis.com/css?family=Finger+Paint">
|
||||||
|
<span class="help-block">Find your favorite font on <a href="https://www.google.com/webfonts">Google Web Fonts</a>. Re-run if the font didn't load in time.</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
493
src/static/node_modules/wordcloud/index.js
generated
vendored
Normal file
493
src/static/node_modules/wordcloud/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,493 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var examples = {
|
||||||
|
'taiwan': {
|
||||||
|
list: (function() {
|
||||||
|
var names = ['台灣', '台湾', 'Taiwan', '臺灣'];
|
||||||
|
|
||||||
|
var str = ['40 台灣'];
|
||||||
|
var i = 20;
|
||||||
|
while (--i) {
|
||||||
|
names.forEach(function(name) {
|
||||||
|
str.push(i + ' ' + name);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return str.join('\n');
|
||||||
|
}()),
|
||||||
|
|
||||||
|
option: '{\n' +
|
||||||
|
' gridSize: 4,\n' +
|
||||||
|
' weightFactor: 1,\n' +
|
||||||
|
' fontFamily: \'Hiragino Mincho Pro, serif\',\n' +
|
||||||
|
' color: \'random-dark\',\n' +
|
||||||
|
' backgroundColor: \'#f0f0f0\',\n' +
|
||||||
|
' rotateRatio: 0.5,\n' +
|
||||||
|
' rotationSteps: 2\n,' +
|
||||||
|
' ellipticity: 1,\n' +
|
||||||
|
' shape: function(theta) {\n' +
|
||||||
|
' /' + '/ Function for simple shapes can be generated manually with http://timdream.org/wordcloud2.js/shape-generator.html.\n' +
|
||||||
|
' var max = 1026;\n' +
|
||||||
|
' var leng = [290,296,299,301,305,309,311,313,315,316,318,321,325,326,327,328,330,330,331,334,335,338,340,343,343,343,346,349,353,356,360,365,378,380,381,381,381,391,394,394,395,396,400,400,408,405,400,400,400,401,401,403,404,405,408,410,413,414,414,415,416,418,420,423,425,430,435,440,446,456,471,486,544,541,533,532,533,537,540,537,535,535,533,546,543,539,531,529,530,533,529,528,529,522,521,520,509,520,520,533,522,523,526,528,527,532,537,539,539,540,539,538,533,532,524,523,513,503,482,467,443,438,435,431,429,427,426,422,422,426,426,423,419,414,410,407,404,401,396,393,393,395,392,389,388,383,379,378,376,375,372,369,368,359,343,335,332,327,323,314,308,300,294,290,288,289,290,282,275,269,263,257,242,244,237,235,235,232,231,225,224,221,219,218,218,217,217,215,215,214,214,214,214,214,215,215,216,213,213,212,211,209,207,205,204,206,205,205,205,205,204,203,203,201,200,199,197,195,193,192,192,190,189,187,186,186,183,183,182,182,181,179,180,179,178,178,177,177,176,176,176,176,175,175,175,175,175,175,174,174,175,175,175,175,176,177,176,177,177,177,180,179,179,180,179,179,179,178,178,178,178,177,178,177,179,179,179,180,180,181,181,181,183,183,184,184,186,187,189,189,192,195,193,194,193,194,194,191,189,196,195,196,199,200,201,200,200,200,200,202,203,204,205,210,210,210,211,210,214,218,219,226,231,233,235,235,235,235,236,238,240,241,243,245,246,249,249,249,255,257,264,271,272,274,275,276,276,278,285,292,294,296,301,304,313,320,330,333,337,342,345,348,352,358,363,376,386,379,386,387,387,399,402,402,410,415,420,425,430,429,436,435,438,442,447,451,454,455,474,477,481,484,492,486,488,501,509,544,553,552,553,564,579,593,600,627,637,644,644,643,641,640,641,641,643,643,648,651,653,659,671,678,685,690,698,705,711,715,722,729,738,760,770,777,780,788,792,796,800,803,806,808,810,809,815,819,821,823,826,828,830,834,838,849,854,861,884,891,909,932,996,1026,1016,1011,1015,1018,999,987,827,806,779,754,734,727,700,690,686,682,677,675,672,668,665,664,658,641,614,610,609,609,608,596,591,583,577,576,570,561,553,547,539,531,526,525,524,519,513,502,484,480,478,470,464,458,453,450,448,448,445,441,435,431,423,420,411,408,405,398,388,385,385,385,383,379,372,370,369,368,366,367,371,370,367,365,345,343,342,340,336,334,331,329,326,323,323,322,321,321,319,318,315,313,312,309,308,307,306,305,304,303,303,302,302,300,299,299,297,296,294,292,291,290,289,290,291,291,289,289,285,285,286,287,287,288,288,288,288,288,289,288,287,279,275,273,272,272,272,274,274,274,275,275,277,281,284,285,286,286,286,283,280,279,279,280,281,283,284,288,291];\n\n' +
|
||||||
|
' return leng[(theta / (2 * Math.PI)) * leng.length | 0] / max;\n' +
|
||||||
|
' }\n'+
|
||||||
|
'}'
|
||||||
|
},
|
||||||
|
'web-tech': {
|
||||||
|
list: '26 Web Technologies\n20 HTML\n20 <canvas>\n' +
|
||||||
|
'15 CSS\n15 JavaScript\n12 Document Object Model\n12 <audio>\n12 <video>\n12 Web Workers\n12 XMLHttpRequest\n12 SVG\n' +
|
||||||
|
'9 JSON.parse()\n9 Geolocation\n9 data attribute\n9 transform\n9 transition\n9 animation\n' +
|
||||||
|
'7 setTimeout\n7 @font-face\n7 Typed Arrays\n7 FileReader API\n7 FormData\n7 IndexedDB\n' +
|
||||||
|
'7 getUserMedia()\n7 postMassage()\n7 CORS\n6 strict mode\n6 calc()\n6 supports()\n' +
|
||||||
|
'6 media queries\n6 full screen\n6 notification\n6 orientation\n6 requestAnimationFrame\n' +
|
||||||
|
'5 border-radius\n5 box-sizing\n5 rgba()\n5 text-shadow\n5 box-shadow\n5 flexbox\n5 viewpoint',
|
||||||
|
option: '{\n' +
|
||||||
|
' gridSize: 18,\n' +
|
||||||
|
' weightFactor: 3,\n' +
|
||||||
|
' fontFamily: \'Finger Paint, cursive, sans-serif\',\n' +
|
||||||
|
' color: \'#f0f0c0\',\n' +
|
||||||
|
' hover: window.drawBox,\n' +
|
||||||
|
' click: function(item) {\n' +
|
||||||
|
' alert(item[0] + \': \' + item[1]);\n' +
|
||||||
|
' },\n' +
|
||||||
|
' backgroundColor: \'#001f00\'\n' +
|
||||||
|
'}',
|
||||||
|
fontCSS: 'https://fonts.googleapis.com/css?family=Finger+Paint'
|
||||||
|
},
|
||||||
|
'les-miz': {
|
||||||
|
list: '30 Les Misérables\n20 Victor Hugo\n15 Jean Valjean\n15 Javert\n15 Fantine\n' +
|
||||||
|
'15 Cosette\n12 Éponine\n12 Marius\n12 Enjolras\n10 Thénardiers\n10 Gavroche\n' +
|
||||||
|
'10 Bishop Myriel\n10 Patron-Minette\n10 God\n8 ABC Café\n8 Paris\n8 Digne\n' +
|
||||||
|
'8 Elephant of the Bastille\n5 silverware\n5 Bagne of Toulon\n5 loaf of bread\n' +
|
||||||
|
'5 Rue Plumet\n5 revolution\n5 barricade\n4 sewers\n4 Fex urbis lex orbis',
|
||||||
|
option: '{\n' +
|
||||||
|
' gridSize: 18,\n' +
|
||||||
|
' weightFactor: 3,\n' +
|
||||||
|
' fontFamily: \'Average, Times, serif\',\n' +
|
||||||
|
' color: function() {\n' +
|
||||||
|
' return ([\'#d0d0d0\', \'#e11\', \'#44f\'])[Math.floor(Math.random() * 3)]\n' +
|
||||||
|
' },\n' +
|
||||||
|
' backgroundColor: \'#333\'\n' +
|
||||||
|
'}',
|
||||||
|
fontCSS: 'https://fonts.googleapis.com/css?family=Average'
|
||||||
|
},
|
||||||
|
'red-chamber': {
|
||||||
|
list: '6 紅樓夢\n3 賈寶玉\n3 林黛玉\n3 薛寶釵\n3 王熙鳳\n3 李紈\n3 賈元春\n3 賈迎春\n' +
|
||||||
|
'3 賈探春\n3 賈惜春\n3 秦可卿\n3 賈巧姐\n3 史湘雲\n3 妙玉\n2 賈政\n2 賈赦\n' +
|
||||||
|
'2 賈璉\n2 賈珍\n2 賈環\n2 賈母\n2 王夫人\n2 薛姨媽\n2 尤氏\n2 平兒\n2 鴛鴦\n' +
|
||||||
|
'2 襲人\n2 晴雯\n2 香菱\n2 紫鵑\n2 麝月\n2 小紅\n2 金釧\n2 甄士隱\n2 賈雨村',
|
||||||
|
option: '{\n' +
|
||||||
|
' gridSize: 8,\n' +
|
||||||
|
' weightFactor: 16,\n' +
|
||||||
|
' fontFamily: \'Hiragino Mincho Pro, serif\',\n' +
|
||||||
|
' color: \'random-dark\',\n' +
|
||||||
|
' backgroundColor: \'#f0f0f0\',\n' +
|
||||||
|
' rotateRatio: 0\n' +
|
||||||
|
'}'
|
||||||
|
},
|
||||||
|
'quick-fox': {
|
||||||
|
list: '2 The\n2 quick\n3 brown\n5 fox\n3 jumps\n3 over\n3.5 the\n3 lazy\n6 dog\n',
|
||||||
|
option: '{\n' +
|
||||||
|
' gridSize: 16,\n' +
|
||||||
|
' weightFactor: 16,\n' +
|
||||||
|
' origin: [90, 0],\n' +
|
||||||
|
' fontFamily: \'Times, serif\',\n' +
|
||||||
|
' color: \'random-light\',\n' +
|
||||||
|
' backgroundColor: \'#000\',\n' +
|
||||||
|
' shuffle: false,\n' +
|
||||||
|
' rotateRatio: 0\n' +
|
||||||
|
'}',
|
||||||
|
width: 180,
|
||||||
|
height: 480
|
||||||
|
},
|
||||||
|
'love' : {
|
||||||
|
list: (function generateLoveList() {
|
||||||
|
var list = ['12 Love'];
|
||||||
|
var nums = [5, 4, 3, 2, 2];
|
||||||
|
// This list of the word "Love" in language of the world was taken from
|
||||||
|
// the Language links of entry "Love" in English Wikipedia, with duplicate
|
||||||
|
// spelling removed.
|
||||||
|
var words = ('Liebe,ፍቅር,Lufu,حب,Aimor,Amor,Heyran,ভালোবাসা,Каханне,Любоў,Любов,བརྩེ་དུང་།,' +
|
||||||
|
'Ljubav,Karantez,Юрату,Láska,Amore,Cariad,Kærlighed,Armastus,Αγάπη,Amo,Amol,Maitasun,' +
|
||||||
|
'عشق,Pyar,Amour,Leafde,Gràdh,愛,爱,પ્રેમ,사랑,Սեր,Ihunanya,Cinta,ᑕᑯᑦᓱᒍᓱᑉᐳᖅ,Ást,אהבה,' +
|
||||||
|
'ಪ್ರೀತಿ,სიყვარული,Махаббат,Pendo,Сүйүү,Mīlestība,Meilė,Leefde,Bolingo,Szerelem,' +
|
||||||
|
'Љубов,സ്നേഹം,Imħabba,प्रेम,Ái,Хайр,အချစ်,Tlazohtiliztli,Liefde,माया,मतिना,' +
|
||||||
|
'Kjærlighet,Kjærleik,ପ୍ରେମ,Sevgi,ਪਿਆਰ,پیار,Miłość,Leevde,Dragoste,' +
|
||||||
|
'Khuyay,Любовь,Таптал,Dashuria,Amuri,ආදරය,Ljubezen,Jaceyl,خۆشەویستی,Љубав,Rakkaus,' +
|
||||||
|
'Kärlek,Pag-ibig,காதல்,ప్రేమ,ความรัก,Ишқ,Aşk,محبت,Tình yêu,Higugma,ליבע').split(',');
|
||||||
|
|
||||||
|
nums.forEach(function(n) {
|
||||||
|
words.forEach(function(w) {
|
||||||
|
list.push(n + ' ' + w);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return list.join('\n');
|
||||||
|
})(),
|
||||||
|
option: '{\n' +
|
||||||
|
' gridSize: Math.round(16 * $(\'#canvas\').width() / 1024),\n' +
|
||||||
|
' weightFactor: function (size) {\n' +
|
||||||
|
' return Math.pow(size, 2.3) * $(\'#canvas\').width() / 1024;\n' +
|
||||||
|
' },\n' +
|
||||||
|
' fontFamily: \'Times, serif\',\n' +
|
||||||
|
' color: function (word, weight) {\n' +
|
||||||
|
' return (weight === 12) ? \'#f02222\' : \'#c09292\';\n' +
|
||||||
|
' },\n' +
|
||||||
|
' rotateRatio: 0.5,\n' +
|
||||||
|
' rotationSteps: 2,\n' +
|
||||||
|
' backgroundColor: \'#ffe0e0\'\n' +
|
||||||
|
'}'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var maskCanvas;
|
||||||
|
|
||||||
|
jQuery(function($) {
|
||||||
|
var $form = $('#form');
|
||||||
|
var $canvas = $('#canvas');
|
||||||
|
var $htmlCanvas = $('#html-canvas');
|
||||||
|
var $canvasContainer = $('#canvas-container');
|
||||||
|
var $loading = $('#loading');
|
||||||
|
|
||||||
|
var $list = $('#input-list');
|
||||||
|
var $options = $('#config-option');
|
||||||
|
var $width = $('#config-width');
|
||||||
|
var $height = $('#config-height');
|
||||||
|
var $mask = $('#config-mask');
|
||||||
|
var $dppx = $('#config-dppx');
|
||||||
|
var $css = $('#config-css');
|
||||||
|
var $webfontLink = $('#link-webfont');
|
||||||
|
|
||||||
|
if (!WordCloud.isSupported) {
|
||||||
|
$('#not-supported').prop('hidden', false);
|
||||||
|
$form.find('textarea, input, select, button').prop('disabled', true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var $box = $('<div id="box" hidden />');
|
||||||
|
$canvasContainer.append($box);
|
||||||
|
window.drawBox = function drawBox(item, dimension) {
|
||||||
|
if (!dimension) {
|
||||||
|
$box.prop('hidden', true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dppx = $dppx.val();
|
||||||
|
|
||||||
|
$box.prop('hidden', false);
|
||||||
|
$box.css({
|
||||||
|
left: dimension.x / dppx + 'px',
|
||||||
|
top: dimension.y / dppx + 'px',
|
||||||
|
width: dimension.w / dppx + 'px',
|
||||||
|
height: dimension.h / dppx + 'px'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Update the default value if we are running in a hdppx device
|
||||||
|
if (('devicePixelRatio' in window) &&
|
||||||
|
window.devicePixelRatio !== 1) {
|
||||||
|
$dppx.val(window.devicePixelRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
$canvas.on('wordcloudstop', function wordcloudstopped(evt) {
|
||||||
|
$loading.prop('hidden', true);
|
||||||
|
});
|
||||||
|
|
||||||
|
$form.on('submit', function formSubmit(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
|
||||||
|
changeHash('');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#config-mask-clear').on('click', function() {
|
||||||
|
maskCanvas = null;
|
||||||
|
// Hack!
|
||||||
|
$mask.wrap('<form>').closest('form').get(0).reset();
|
||||||
|
$mask.unwrap();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Load the local image file, read it's pixels and transform it into a
|
||||||
|
// black-and-white mask image on the canvas.
|
||||||
|
$mask.on('change', function() {
|
||||||
|
maskCanvas = null;
|
||||||
|
|
||||||
|
var file = $mask[0].files[0];
|
||||||
|
|
||||||
|
if (!file) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var url = window.URL.createObjectURL(file);
|
||||||
|
var img = new Image();
|
||||||
|
img.src = url;
|
||||||
|
|
||||||
|
img.onload = function readPixels() {
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
|
||||||
|
maskCanvas = document.createElement('canvas');
|
||||||
|
maskCanvas.width = img.width;
|
||||||
|
maskCanvas.height = img.height;
|
||||||
|
|
||||||
|
var ctx = maskCanvas.getContext('2d');
|
||||||
|
ctx.drawImage(img, 0, 0, img.width, img.height);
|
||||||
|
|
||||||
|
var imageData = ctx.getImageData(
|
||||||
|
0, 0, maskCanvas.width, maskCanvas.height);
|
||||||
|
var newImageData = ctx.createImageData(imageData);
|
||||||
|
|
||||||
|
for (var i = 0; i < imageData.data.length; i += 4) {
|
||||||
|
var tone = imageData.data[i] +
|
||||||
|
imageData.data[i + 1] +
|
||||||
|
imageData.data[i + 2];
|
||||||
|
var alpha = imageData.data[i + 3];
|
||||||
|
|
||||||
|
if (alpha < 128 || tone > 128 * 3) {
|
||||||
|
// Area not to draw
|
||||||
|
newImageData.data[i] =
|
||||||
|
newImageData.data[i + 1] =
|
||||||
|
newImageData.data[i + 2] = 255;
|
||||||
|
newImageData.data[i + 3] = 0;
|
||||||
|
} else {
|
||||||
|
// Area to draw
|
||||||
|
newImageData.data[i] =
|
||||||
|
newImageData.data[i + 1] =
|
||||||
|
newImageData.data[i + 2] = 0;
|
||||||
|
newImageData.data[i + 3] = 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.putImageData(newImageData, 0, 0);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($mask[0].files.length) {
|
||||||
|
$mask.trigger('change');
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#btn-save').on('click', function save(evt) {
|
||||||
|
var url = $canvas[0].toDataURL();
|
||||||
|
if ('download' in document.createElement('a')) {
|
||||||
|
this.href = url;
|
||||||
|
} else {
|
||||||
|
evt.preventDefault();
|
||||||
|
alert('Please right click and choose "Save As..." to save the generated image.');
|
||||||
|
window.open(url, '_blank', 'width=500,height=300,menubar=yes');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#btn-canvas').on('click', function showCanvas(evt) {
|
||||||
|
$canvas.removeClass('hide');
|
||||||
|
$htmlCanvas.addClass('hide');
|
||||||
|
$('#btn-canvas').prop('disabled', true);
|
||||||
|
$('#btn-html-canvas').prop('disabled', false);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#btn-html-canvas').on('click', function showCanvas(evt) {
|
||||||
|
$canvas.addClass('hide');
|
||||||
|
$htmlCanvas.removeClass('hide');
|
||||||
|
$('#btn-canvas').prop('disabled', false);
|
||||||
|
$('#btn-html-canvas').prop('disabled', true);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#btn-canvas').prop('disabled', true);
|
||||||
|
$('#btn-html-canvas').prop('disabled', false);
|
||||||
|
|
||||||
|
var $examples = $('#examples');
|
||||||
|
$examples.on('change', function loadExample(evt) {
|
||||||
|
changeHash(this.value);
|
||||||
|
|
||||||
|
this.selectedIndex = 0;
|
||||||
|
$examples.blur();
|
||||||
|
});
|
||||||
|
|
||||||
|
var run = function run() {
|
||||||
|
$loading.prop('hidden', false);
|
||||||
|
|
||||||
|
// Load web font
|
||||||
|
$webfontLink.prop('href', $css.val());
|
||||||
|
|
||||||
|
// devicePixelRatio
|
||||||
|
var devicePixelRatio = parseFloat($dppx.val());
|
||||||
|
|
||||||
|
// Set the width and height
|
||||||
|
var width = $width.val() ? $width.val() : $('#canvas-container').width();
|
||||||
|
var height = $height.val() ? $height.val() : Math.floor(width * 0.65);
|
||||||
|
var pixelWidth = width;
|
||||||
|
var pixelHeight = height;
|
||||||
|
|
||||||
|
if (devicePixelRatio !== 1) {
|
||||||
|
$canvas.css({'width': width + 'px', 'height': height + 'px'});
|
||||||
|
|
||||||
|
pixelWidth *= devicePixelRatio;
|
||||||
|
pixelHeight *= devicePixelRatio;
|
||||||
|
} else {
|
||||||
|
$canvas.css({'width': '', 'height': '' });
|
||||||
|
}
|
||||||
|
|
||||||
|
$canvas.attr('width', pixelWidth);
|
||||||
|
$canvas.attr('height', pixelHeight);
|
||||||
|
|
||||||
|
$htmlCanvas.css({'width': pixelWidth + 'px', 'height': pixelHeight + 'px'});
|
||||||
|
|
||||||
|
// Set the options object
|
||||||
|
var options = {};
|
||||||
|
if ($options.val()) {
|
||||||
|
options = (function evalOptions() {
|
||||||
|
try {
|
||||||
|
return eval('(' + $options.val() + ')');
|
||||||
|
} catch (error) {
|
||||||
|
alert('The following Javascript error occurred in the option definition; all option will be ignored: \n\n' +
|
||||||
|
error.toString());
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set devicePixelRatio options
|
||||||
|
if (devicePixelRatio !== 1) {
|
||||||
|
if (!('gridSize' in options)) {
|
||||||
|
options.gridSize = 8;
|
||||||
|
}
|
||||||
|
options.gridSize *= devicePixelRatio;
|
||||||
|
|
||||||
|
if (options.origin) {
|
||||||
|
if (typeof options.origin[0] == 'number')
|
||||||
|
options.origin[0] *= devicePixelRatio;
|
||||||
|
if (typeof options.origin[1] == 'number')
|
||||||
|
options.origin[1] *= devicePixelRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!('weightFactor' in options)) {
|
||||||
|
options.weightFactor = 1;
|
||||||
|
}
|
||||||
|
if (typeof options.weightFactor == 'function') {
|
||||||
|
var origWeightFactor = options.weightFactor;
|
||||||
|
options.weightFactor =
|
||||||
|
function weightFactorDevicePixelRatioWrap() {
|
||||||
|
return origWeightFactor.apply(this, arguments) * devicePixelRatio;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
options.weightFactor *= devicePixelRatio;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Put the word list into options
|
||||||
|
if ($list.val()) {
|
||||||
|
var list = [];
|
||||||
|
$.each($list.val().split('\n'), function each(i, line) {
|
||||||
|
if (!$.trim(line))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var lineArr = line.split(' ');
|
||||||
|
var count = parseFloat(lineArr.shift()) || 0;
|
||||||
|
list.push([lineArr.join(' '), count]);
|
||||||
|
});
|
||||||
|
options.list = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maskCanvas) {
|
||||||
|
options.clearCanvas = false;
|
||||||
|
|
||||||
|
/* Determine bgPixel by creating
|
||||||
|
another canvas and fill the specified background color. */
|
||||||
|
var bctx = document.createElement('canvas').getContext('2d');
|
||||||
|
|
||||||
|
bctx.fillStyle = options.backgroundColor || '#fff';
|
||||||
|
bctx.fillRect(0, 0, 1, 1);
|
||||||
|
var bgPixel = bctx.getImageData(0, 0, 1, 1).data;
|
||||||
|
|
||||||
|
var maskCanvasScaled =
|
||||||
|
document.createElement('canvas');
|
||||||
|
maskCanvasScaled.width = $canvas[0].width;
|
||||||
|
maskCanvasScaled.height = $canvas[0].height;
|
||||||
|
var ctx = maskCanvasScaled.getContext('2d');
|
||||||
|
|
||||||
|
ctx.drawImage(maskCanvas,
|
||||||
|
0, 0, maskCanvas.width, maskCanvas.height,
|
||||||
|
0, 0, maskCanvasScaled.width, maskCanvasScaled.height);
|
||||||
|
|
||||||
|
var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
||||||
|
var newImageData = ctx.createImageData(imageData);
|
||||||
|
for (var i = 0; i < imageData.data.length; i += 4) {
|
||||||
|
if (imageData.data[i + 3] > 128) {
|
||||||
|
newImageData.data[i] = bgPixel[0];
|
||||||
|
newImageData.data[i + 1] = bgPixel[1];
|
||||||
|
newImageData.data[i + 2] = bgPixel[2];
|
||||||
|
newImageData.data[i + 3] = bgPixel[3];
|
||||||
|
} else {
|
||||||
|
// This color must not be the same w/ the bgPixel.
|
||||||
|
newImageData.data[i] = bgPixel[0];
|
||||||
|
newImageData.data[i + 1] = bgPixel[1];
|
||||||
|
newImageData.data[i + 2] = bgPixel[2];
|
||||||
|
newImageData.data[i + 3] = bgPixel[3] ? (bgPixel[3] - 1) : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.putImageData(newImageData, 0, 0);
|
||||||
|
|
||||||
|
ctx = $canvas[0].getContext('2d');
|
||||||
|
ctx.drawImage(maskCanvasScaled, 0, 0);
|
||||||
|
|
||||||
|
maskCanvasScaled = ctx = imageData = newImageData = bctx = bgPixel = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Always manually clean up the html output
|
||||||
|
if (!options.clearCanvas) {
|
||||||
|
$htmlCanvas.empty();
|
||||||
|
$htmlCanvas.css('background-color', options.backgroundColor || '#fff');
|
||||||
|
}
|
||||||
|
|
||||||
|
// All set, call the WordCloud()
|
||||||
|
// Order matters here because the HTML canvas might by
|
||||||
|
// set to display: none.
|
||||||
|
WordCloud([$canvas[0], $htmlCanvas[0]], options);
|
||||||
|
};
|
||||||
|
|
||||||
|
var loadExampleData = function loadExampleData(name) {
|
||||||
|
var example = examples[name];
|
||||||
|
|
||||||
|
$options.val(example.option || '');
|
||||||
|
$list.val(example.list || '');
|
||||||
|
$css.val(example.fontCSS || '');
|
||||||
|
$width.val(example.width || '');
|
||||||
|
$height.val(example.height || '');
|
||||||
|
};
|
||||||
|
|
||||||
|
var changeHash = function changeHash(name) {
|
||||||
|
if (window.location.hash === '#' + name ||
|
||||||
|
(!window.location.hash && !name)) {
|
||||||
|
// We got a same hash, call hashChanged() directly
|
||||||
|
hashChanged();
|
||||||
|
} else {
|
||||||
|
// Actually change the hash to invoke hashChanged()
|
||||||
|
window.location.hash = '#' + name;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var hashChanged = function hashChanged() {
|
||||||
|
var name = window.location.hash.substr(1);
|
||||||
|
if (!name) {
|
||||||
|
// If there is no name, run as-is.
|
||||||
|
run();
|
||||||
|
} else if (name in examples) {
|
||||||
|
// If the name matches one of the example, load it and run it
|
||||||
|
loadExampleData(name);
|
||||||
|
run();
|
||||||
|
} else {
|
||||||
|
// If the name doesn't match, reset it.
|
||||||
|
window.location.replace('#');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(window).on('hashchange', hashChanged);
|
||||||
|
|
||||||
|
if (!window.location.hash ||
|
||||||
|
!(window.location.hash.substr(1) in examples)) {
|
||||||
|
// If the initial hash doesn't match to any of the examples,
|
||||||
|
// or it doesn't exist, reset it to #love
|
||||||
|
window.location.replace('#love');
|
||||||
|
} else {
|
||||||
|
hashChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
4
src/static/node_modules/wordcloud/jquery.min.js
generated
vendored
Normal file
4
src/static/node_modules/wordcloud/jquery.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
99
src/static/node_modules/wordcloud/package.json
generated
vendored
Normal file
99
src/static/node_modules/wordcloud/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,99 @@
|
||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"raw": "wordcloud",
|
||||||
|
"scope": null,
|
||||||
|
"escapedName": "wordcloud",
|
||||||
|
"name": "wordcloud",
|
||||||
|
"rawSpec": "",
|
||||||
|
"spec": "latest",
|
||||||
|
"type": "tag"
|
||||||
|
},
|
||||||
|
"C:\\Box Sync\\pyDataVizDay\\src\\static"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "wordcloud@latest",
|
||||||
|
"_id": "wordcloud@1.0.6",
|
||||||
|
"_inCache": true,
|
||||||
|
"_location": "/wordcloud",
|
||||||
|
"_nodeVersion": "7.3.0",
|
||||||
|
"_npmOperationalInternal": {
|
||||||
|
"host": "packages-12-west.internal.npmjs.com",
|
||||||
|
"tmp": "tmp/wordcloud-1.0.6.tgz_1486270737936_0.9117981251329184"
|
||||||
|
},
|
||||||
|
"_npmUser": {
|
||||||
|
"name": "timdream",
|
||||||
|
"email": "timdream@gmail.com"
|
||||||
|
},
|
||||||
|
"_npmVersion": "3.10.10",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"raw": "wordcloud",
|
||||||
|
"scope": null,
|
||||||
|
"escapedName": "wordcloud",
|
||||||
|
"name": "wordcloud",
|
||||||
|
"rawSpec": "",
|
||||||
|
"spec": "latest",
|
||||||
|
"type": "tag"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"#USER"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/wordcloud/-/wordcloud-1.0.6.tgz",
|
||||||
|
"_shasum": "7e98e0a2fd2410c5ddbf67536135f0ae6e9e91b1",
|
||||||
|
"_shrinkwrap": null,
|
||||||
|
"_spec": "wordcloud",
|
||||||
|
"_where": "C:\\Box Sync\\pyDataVizDay\\src\\static",
|
||||||
|
"author": {
|
||||||
|
"name": "Timothy Guan-tin Chien",
|
||||||
|
"email": "timdream@gmail.com",
|
||||||
|
"url": "http://timdream.org/"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/timdream/wordcloud2.js/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {},
|
||||||
|
"description": "Tag cloud/Wordle presentation on 2D canvas or HTML",
|
||||||
|
"devDependencies": {
|
||||||
|
"grunt": "^0.4.1",
|
||||||
|
"grunt-cli": "^0.1.13",
|
||||||
|
"grunt-contrib-connect": "^0.7.1",
|
||||||
|
"grunt-contrib-jshint": "^0.10.0",
|
||||||
|
"grunt-shell": "^0.6.4"
|
||||||
|
},
|
||||||
|
"directories": {},
|
||||||
|
"dist": {
|
||||||
|
"shasum": "7e98e0a2fd2410c5ddbf67536135f0ae6e9e91b1",
|
||||||
|
"tarball": "https://registry.npmjs.org/wordcloud/-/wordcloud-1.0.6.tgz"
|
||||||
|
},
|
||||||
|
"gitHead": "976883a0b714883d08ca9ef27b57b6984eca746a",
|
||||||
|
"homepage": "http://timdream.org/wordcloud2.js/",
|
||||||
|
"keywords": [
|
||||||
|
"cloud",
|
||||||
|
"canvas",
|
||||||
|
"2D",
|
||||||
|
"html",
|
||||||
|
"Wordle",
|
||||||
|
"presentation",
|
||||||
|
"tag"
|
||||||
|
],
|
||||||
|
"main": "src/wordcloud2.js",
|
||||||
|
"maintainers": [
|
||||||
|
{
|
||||||
|
"name": "timdream",
|
||||||
|
"email": "timdream@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "wordcloud",
|
||||||
|
"optionalDependencies": {},
|
||||||
|
"readme": "ERROR: No README data found!",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/timdream/wordcloud2.js.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "grunt test"
|
||||||
|
},
|
||||||
|
"version": "1.0.6"
|
||||||
|
}
|
||||||
133
src/static/node_modules/wordcloud/shape-generator.html
generated
vendored
Normal file
133
src/static/node_modules/wordcloud/shape-generator.html
generated
vendored
Normal file
|
|
@ -0,0 +1,133 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Get approximate polar equation for given image</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="description" content="">
|
||||||
|
<meta name="author" content="">
|
||||||
|
<!-- Le styles -->
|
||||||
|
<link href="//netdna.bootstrapcdn.com/bootstrap/2.2.2/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link href="//netdna.bootstrapcdn.com/bootstrap/2.2.2/css/bootstrap-responsive.min.css" rel="stylesheet">
|
||||||
|
<link href="//fonts.googleapis.com/css?family=Finger+Paint" id="link-webfont" rel="stylesheet">
|
||||||
|
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.2.2/bootstrap.min.js"></script>
|
||||||
|
<script>
|
||||||
|
var img, url;
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
// DOM File object selected
|
||||||
|
var file = document.getElementById('file').files[0];
|
||||||
|
|
||||||
|
if (file) run();
|
||||||
|
}
|
||||||
|
|
||||||
|
function run() {
|
||||||
|
// DOM File object selected
|
||||||
|
var file = document.getElementById('file').files[0];
|
||||||
|
|
||||||
|
url = window.URL.createObjectURL(file);
|
||||||
|
img = new Image();
|
||||||
|
img.src = url;
|
||||||
|
|
||||||
|
img.onload = readPixels;
|
||||||
|
}
|
||||||
|
|
||||||
|
function readPixels() {
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
|
||||||
|
var canvas = document.createElement('canvas');
|
||||||
|
canvas.width = img.width;
|
||||||
|
canvas.height = img.height;
|
||||||
|
|
||||||
|
document.body.appendChild(canvas);
|
||||||
|
|
||||||
|
var ctx = canvas.getContext('2d');
|
||||||
|
ctx.drawImage(img, 0, 0, img.width, img.height);
|
||||||
|
|
||||||
|
var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
var mask = new Uint8Array(imageData.data.length / 4);
|
||||||
|
var width = canvas.width;
|
||||||
|
var height = canvas.height;
|
||||||
|
|
||||||
|
var o = [(img.width / 2) | 0, (img.height / 2) | 0];
|
||||||
|
var d = window.d = [];
|
||||||
|
|
||||||
|
// paint red on the center pixel (not really visible)
|
||||||
|
imageData.data[(o[1] * width + o[0]) * 4] = 254;
|
||||||
|
|
||||||
|
for (var theta = 0; theta < 2 * Math.PI; theta += 0.01) {
|
||||||
|
var dx = 1 * Math.cos(theta);
|
||||||
|
var dy = - 1 * Math.sin(theta);
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
var x = o[0];
|
||||||
|
var y = o[1];
|
||||||
|
var intX = x;
|
||||||
|
var intY = y;
|
||||||
|
while (true) {
|
||||||
|
x += dx;
|
||||||
|
y += dy;
|
||||||
|
|
||||||
|
intX = x | 0;
|
||||||
|
intY = y | 0;
|
||||||
|
|
||||||
|
if (intY < 0 || intY > canvas.height || intX < 0 || intX > width) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ptr = (intY * width + intX) * 4;
|
||||||
|
var tone = imageData.data[ptr] +
|
||||||
|
imageData.data[ptr + 1] +
|
||||||
|
imageData.data[ptr + 2];
|
||||||
|
var alpha = imageData.data[ptr + 3];
|
||||||
|
|
||||||
|
// draw a green line all the way until the boundary
|
||||||
|
imageData.data[ptr] = 0; // R
|
||||||
|
imageData.data[ptr + 1] = 254; // G
|
||||||
|
imageData.data[ptr + 2] = 0; // B
|
||||||
|
imageData.data[ptr + 3] = 254;
|
||||||
|
|
||||||
|
// are we there at the boundary?
|
||||||
|
if (alpha < 128 || tone > 128 * 3) {
|
||||||
|
d.push(i);
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.putImageData(imageData, 0, 0);
|
||||||
|
|
||||||
|
var max = d.reduce(function(prev, curr) {
|
||||||
|
return Math.max(prev, curr);
|
||||||
|
});
|
||||||
|
|
||||||
|
var resultText =
|
||||||
|
'function(theta) {\n' +
|
||||||
|
' var max = ' + max + ';\n' +
|
||||||
|
' var leng = ' + JSON.stringify(d) + ';\n\n' +
|
||||||
|
' return leng[(theta / (2 * Math.PI)) * leng.length | 0] / max;\n' +
|
||||||
|
'}\n';
|
||||||
|
|
||||||
|
var result = document.getElementById('result');
|
||||||
|
result.textContent = resultText;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<p class="lead">Get approximate polar equation for given image.</p>
|
||||||
|
<p>
|
||||||
|
Please select a black-white image below.
|
||||||
|
The black part shall be centered and it will be the shape to trace.
|
||||||
|
You would have to manually save, edit the code if you want any additional processing.
|
||||||
|
</p>
|
||||||
|
<form>
|
||||||
|
<input type="file" id="file" class="input-large" onchange="run()">
|
||||||
|
</form>
|
||||||
|
<pre id="result"></pre>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
1175
src/static/node_modules/wordcloud/src/wordcloud2.js
generated
vendored
Normal file
1175
src/static/node_modules/wordcloud/src/wordcloud2.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue