Initial Commit

This commit is contained in:
Barak Michener 2014-06-20 18:21:47 -04:00
commit bbb0a2f580
126 changed files with 14189 additions and 0 deletions

BIN
static/branding/cayley_bottom.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

266
static/branding/cayley_bottom.svg Executable file
View file

@ -0,0 +1,266 @@
<!--
// Copyright 2014 The Cayley Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="210"
version="1.1"
width="210"
id="svg2"
inkscape:version="0.48.4 r9939"
sodipodi:docname="cayley_bottom.svg"
inkscape:export-filename="U:\home\barak\src\cayley\static\text\cayley_bottom.png"
inkscape:export-xdpi="250"
inkscape:export-ydpi="250">
<metadata
id="metadata44">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2172"
inkscape:window-height="1473"
id="namedview42"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
showguides="false"
inkscape:zoom="4.6240876"
inkscape:cx="119.5"
inkscape:cy="88"
inkscape:window-x="997"
inkscape:window-y="558"
inkscape:window-maximized="0"
inkscape:current-layer="svg2"
inkscape:snap-global="false">
<inkscape:grid
type="xygrid"
id="grid3037"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true"
originx="-245.73938px"
originy="74.494766px" />
</sodipodi:namedview>
<defs
id="defs4" />
<line
x1="15"
x2="55"
y1="62.062759"
y2="62.062759"
id="line6"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="195"
x2="155"
y1="62.062759"
y2="62.062759"
id="line8"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="155"
x2="130"
y1="62.062759"
y2="18.761484"
id="line10"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="155"
x2="80"
y1="62.062759"
y2="18.761484"
id="line12"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="155"
x2="80"
y1="62.062759"
y2="105.36402"
id="line14"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="155"
x2="130"
y1="62.062759"
y2="105.36402"
id="line16"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="130"
x2="55"
y1="18.761484"
y2="62.062759"
id="line18"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="80"
x2="55"
y1="18.761484"
y2="62.062759"
id="line20"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="55"
x2="80"
y1="62.062759"
y2="105.36402"
id="line22"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="55"
x2="130"
y1="62.062759"
y2="105.36402"
id="line24"
style="stroke:#999999;stroke-width:2.5" />
<circle
cx="155"
cy="65"
r="15"
id="circle26"
sodipodi:cx="155"
sodipodi:cy="65"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#4285f4"
transform="translate(0,-2.9372461)" />
<circle
cx="130"
cy="21.69873"
r="15"
id="circle28"
sodipodi:cx="130"
sodipodi:cy="21.69873"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#db4437"
transform="translate(0,-2.9372461)" />
<circle
cx="80"
cy="21.69873"
r="15"
id="circle30"
sodipodi:cx="80"
sodipodi:cy="21.69873"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#f4b400"
transform="translate(0,-2.9372461)" />
<circle
cx="55"
cy="65"
r="15"
id="circle32"
sodipodi:cx="55"
sodipodi:cy="65"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#4285f4"
transform="translate(0,-2.9372461)" />
<circle
cx="80"
cy="108.30127"
r="15"
id="circle34"
sodipodi:cx="80"
sodipodi:cy="108.30127"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#db4437"
transform="translate(0,-2.9372461)" />
<circle
cx="130"
cy="108.30127"
r="15"
id="circle36"
sodipodi:cx="130"
sodipodi:cy="108.30127"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#f4b400"
transform="translate(0,-2.9372461)" />
<circle
cx="15"
cy="65"
r="15"
id="circle38"
sodipodi:cx="15"
sodipodi:cy="65"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#999999"
transform="translate(0,-2.9372461)" />
<circle
cx="195"
cy="65"
r="15"
id="circle40"
sodipodi:cx="195"
sodipodi:cy="65"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#999999"
transform="translate(0,-2.9372461)" />
<flowRoot
xml:space="preserve"
id="flowRoot3025"
style="font-size:72px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Open Sans;-inkscape-font-specification:Open Sans"
transform="translate(0,15.761484)"><flowRegion
id="flowRegion3027"><rect
id="rect3029"
width="305.06277"
height="118.24139"
x="220.71725"
y="-0.062292095"
style="font-size:72px" /></flowRegion><flowPara
id="flowPara3031" /></flowRoot> <text
xml:space="preserve"
style="font-size:100px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Open Sans;-inkscape-font-specification:Open Sans"
x="0.46484375"
y="188.70313"
id="text3033"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3035"
x="0.46484375"
y="188.70313"
style="font-size:72px;font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Open Sans Light;-inkscape-font-specification:'Open Sans Light, Light'">Cayley</tspan></text>
</svg>

BIN
static/branding/cayley_side.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

265
static/branding/cayley_side.svg Executable file
View file

@ -0,0 +1,265 @@
<!--
// Copyright 2014 The Cayley Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="116.60254"
version="1.1"
width="430.28"
id="svg2"
inkscape:version="0.48.4 r9939"
sodipodi:docname="cayley_side.svg"
inkscape:export-filename="U:\home\barak\src\cayley\static\text\cayley_side.png"
inkscape:export-xdpi="250"
inkscape:export-ydpi="250">
<metadata
id="metadata44">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2172"
inkscape:window-height="1473"
id="namedview42"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
showguides="false"
inkscape:zoom="3.2360288"
inkscape:cx="245.81598"
inkscape:cy="52.763956"
inkscape:window-x="323"
inkscape:window-y="134"
inkscape:window-maximized="0"
inkscape:current-layer="svg2"
inkscape:snap-global="false">
<inkscape:grid
type="xygrid"
id="grid3037"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true"
originx="-245.73938px"
originy="-3.1412048px" />
</sodipodi:namedview>
<defs
id="defs4" />
<line
x1="15"
x2="55"
y1="58.30127"
y2="58.30127"
id="line6"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="195"
x2="155"
y1="58.30127"
y2="58.30127"
id="line8"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="155"
x2="130"
y1="58.30127"
y2="15"
id="line10"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="155"
x2="80"
y1="58.30127"
y2="15"
id="line12"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="155"
x2="80"
y1="58.30127"
y2="101.60254"
id="line14"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="155"
x2="130"
y1="58.30127"
y2="101.60254"
id="line16"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="130"
x2="55"
y1="15"
y2="58.30127"
id="line18"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="80"
x2="55"
y1="15"
y2="58.30127"
id="line20"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="55"
x2="80"
y1="58.30127"
y2="101.60254"
id="line22"
style="stroke:#999999;stroke-width:2.5" />
<line
x1="55"
x2="130"
y1="58.30127"
y2="101.60254"
id="line24"
style="stroke:#999999;stroke-width:2.5" />
<circle
cx="155"
cy="65"
r="15"
id="circle26"
sodipodi:cx="155"
sodipodi:cy="65"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#4285f4"
transform="translate(0,-6.6987305)" />
<circle
cx="130"
cy="21.69873"
r="15"
id="circle28"
sodipodi:cx="130"
sodipodi:cy="21.69873"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#db4437"
transform="translate(0,-6.6987305)" />
<circle
cx="80"
cy="21.69873"
r="15"
id="circle30"
sodipodi:cx="80"
sodipodi:cy="21.69873"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#f4b400"
transform="translate(0,-6.6987305)" />
<circle
cx="55"
cy="65"
r="15"
id="circle32"
sodipodi:cx="55"
sodipodi:cy="65"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#4285f4"
transform="translate(0,-6.6987305)" />
<circle
cx="80"
cy="108.30127"
r="15"
id="circle34"
sodipodi:cx="80"
sodipodi:cy="108.30127"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#db4437"
transform="translate(0,-6.6987305)" />
<circle
cx="130"
cy="108.30127"
r="15"
id="circle36"
sodipodi:cx="130"
sodipodi:cy="108.30127"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#f4b400"
transform="translate(0,-6.6987305)" />
<circle
cx="15"
cy="65"
r="15"
id="circle38"
sodipodi:cx="15"
sodipodi:cy="65"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#999999"
transform="translate(0,-6.6987305)" />
<circle
cx="195"
cy="65"
r="15"
id="circle40"
sodipodi:cx="195"
sodipodi:cy="65"
sodipodi:rx="15"
sodipodi:ry="15"
style="fill:#999999"
transform="translate(0,-6.6987305)" />
<flowRoot
xml:space="preserve"
id="flowRoot3025"
style="font-size:72px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Open Sans;-inkscape-font-specification:Open Sans"><flowRegion
id="flowRegion3027"><rect
id="rect3029"
width="305.06277"
height="118.24139"
x="220.71725"
y="-0.062292095"
style="font-size:72px" /></flowRegion><flowPara
id="flowPara3031" /></flowRoot> <text
xml:space="preserve"
style="font-size:100px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Open Sans;-inkscape-font-specification:Open Sans"
x="224.53387"
y="78.020462"
id="text3033"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3035"
x="224.53387"
y="78.020462"
style="font-size:72px;font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Open Sans Light;-inkscape-font-specification:'Open Sans Light, Light'">Cayley</tspan></text>
</svg>

BIN
static/cayley.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

17
static/cayley.svg Normal file
View file

@ -0,0 +1,17 @@
<!--
// Copyright 2014 The Cayley Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<?xml version="1.0" encoding="utf-8" ?>
<svg baseProfile="full" height="100%" version="1.1" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink"><defs /><line stroke="#999999" stroke-width="2.5" x1="15" x2="55.0" y1="65" y2="65.0" /><line stroke="#999999" stroke-width="2.5" x1="195" x2="155.0" y1="65" y2="65.0" /><line stroke="#999999" stroke-width="2.5" x1="155.0" x2="130.0" y1="65.0" y2="21.6987298108" /><line stroke="#999999" stroke-width="2.5" x1="155.0" x2="80.0" y1="65.0" y2="21.6987298108" /><line stroke="#999999" stroke-width="2.5" x1="155.0" x2="80.0" y1="65.0" y2="108.301270189" /><line stroke="#999999" stroke-width="2.5" x1="155.0" x2="130.0" y1="65.0" y2="108.301270189" /><line stroke="#999999" stroke-width="2.5" x1="130.0" x2="55.0" y1="21.6987298108" y2="65.0" /><line stroke="#999999" stroke-width="2.5" x1="80.0" x2="55.0" y1="21.6987298108" y2="65.0" /><line stroke="#999999" stroke-width="2.5" x1="55.0" x2="80.0" y1="65.0" y2="108.301270189" /><line stroke="#999999" stroke-width="2.5" x1="55.0" x2="130.0" y1="65.0" y2="108.301270189" /><circle cx="155.0" cy="65.0" fill="#4285F4" r="15" /><circle cx="130.0" cy="21.6987298108" fill="#DB4437" r="15" /><circle cx="80.0" cy="21.6987298108" fill="#F4B400" r="15" /><circle cx="55.0" cy="65.0" fill="#4285F4" r="15" /><circle cx="80.0" cy="108.301270189" fill="#DB4437" r="15" /><circle cx="130.0" cy="108.301270189" fill="#F4B400" r="15" /><circle cx="15" cy="65" fill="#999999" r="15" /><circle cx="195" cy="65" fill="#999999" r="15" /></svg>

293
static/css/docs.css Normal file
View file

@ -0,0 +1,293 @@
/*
// Copyright 2014 The Cayley Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
*/
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
margin-top: 0 !important; }
body > *:last-child {
margin-bottom: 0 !important; }
a {
color: #4183C4; }
a.absent {
color: #cc0000; }
a.anchor {
display: block;
padding-left: 30px;
margin-left: -30px;
cursor: pointer;
position: absolute;
top: 0;
left: 0;
bottom: 0; }
h1, h2, h3, h4, h5, h6 {
margin: 20px 0 10px;
padding: 0;
font-weight: bold;
-webkit-font-smoothing: antialiased;
cursor: text;
position: relative; }
h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover a.anchor, h6:hover a.anchor {
background: url("../../images/modules/styleguide/para.png") no-repeat 10px center;
text-decoration: none; }
h1 tt, h1 code {
font-size: inherit; }
h2 tt, h2 code {
font-size: inherit; }
h3 tt, h3 code {
font-size: inherit; }
h4 tt, h4 code {
font-size: inherit; }
h5 tt, h5 code {
font-size: inherit; }
h6 tt, h6 code {
font-size: inherit; }
h1 {
font-size: 28px;
color: black; }
h2 {
font-size: 24px;
border-bottom: 1px solid #cccccc;
color: black; }
h3 {
font-size: 18px; }
h4 {
font-size: 16px; }
h5 {
font-size: 14px; }
h6 {
color: #777777;
font-size: 14px; }
p, blockquote, ul, ol, dl, li, table, pre {
margin: 15px 0; }
hr {
background: transparent url("../../images/modules/pulls/dirty-shade.png") repeat-x 0 0;
border: 0 none;
color: #cccccc;
height: 4px;
padding: 0; }
body > h2:first-child {
margin-top: 0;
padding-top: 0; }
body > h1:first-child {
margin-top: 0;
padding-top: 0; }
body > h1:first-child + h2 {
margin-top: 0;
padding-top: 0; }
body > h3:first-child, body > h4:first-child, body > h5:first-child, body > h6:first-child {
margin-top: 0;
padding-top: 0; }
a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
margin-top: 0;
padding-top: 0; }
h1 p, h2 p, h3 p, h4 p, h5 p, h6 p {
margin-top: 0; }
li p.first {
display: inline-block; }
ul, ol {
padding-left: 30px; }
ul :first-child, ol :first-child {
margin-top: 0; }
ul :last-child, ol :last-child {
margin-bottom: 0; }
dl {
padding: 0; }
dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px; }
dl dt:first-child {
padding: 0; }
dl dt > :first-child {
margin-top: 0; }
dl dt > :last-child {
margin-bottom: 0; }
dl dd {
margin: 0 0 15px;
padding: 0 15px; }
dl dd > :first-child {
margin-top: 0; }
dl dd > :last-child {
margin-bottom: 0; }
blockquote {
border-left: 4px solid #dddddd;
padding: 0 15px;
color: #777777; }
blockquote > :first-child {
margin-top: 0; }
blockquote > :last-child {
margin-bottom: 0; }
table {
padding: 0; }
table tr {
border-top: 1px solid #cccccc;
background-color: white;
margin: 0;
padding: 0; }
table tr:nth-child(2n) {
background-color: #f8f8f8; }
table tr th {
font-weight: bold;
border: 1px solid #cccccc;
text-align: left;
margin: 0;
padding: 6px 13px; }
table tr td {
border: 1px solid #cccccc;
text-align: left;
margin: 0;
padding: 6px 13px; }
table tr th :first-child, table tr td :first-child {
margin-top: 0; }
table tr th :last-child, table tr td :last-child {
margin-bottom: 0; }
img {
max-width: 100%; }
span.frame {
display: block;
overflow: hidden; }
span.frame > span {
border: 1px solid #dddddd;
display: block;
float: left;
overflow: hidden;
margin: 13px 0 0;
padding: 7px;
width: auto; }
span.frame span img {
display: block;
float: left; }
span.frame span span {
clear: both;
color: #333333;
display: block;
padding: 5px 0 0; }
span.align-center {
display: block;
overflow: hidden;
clear: both; }
span.align-center > span {
display: block;
overflow: hidden;
margin: 13px auto 0;
text-align: center; }
span.align-center span img {
margin: 0 auto;
text-align: center; }
span.align-right {
display: block;
overflow: hidden;
clear: both; }
span.align-right > span {
display: block;
overflow: hidden;
margin: 13px 0 0;
text-align: right; }
span.align-right span img {
margin: 0;
text-align: right; }
span.float-left {
display: block;
margin-right: 13px;
overflow: hidden;
float: left; }
span.float-left span {
margin: 13px 0 0; }
span.float-right {
display: block;
margin-left: 13px;
overflow: hidden;
float: right; }
span.float-right > span {
display: block;
overflow: hidden;
margin: 13px auto 0;
text-align: right; }
code, tt {
margin: 0 2px;
padding: 0 5px;
white-space: nowrap;
border: 1px solid #eaeaea;
background-color: #f8f8f8;
border-radius: 3px; }
pre code {
margin: 0;
padding: 0;
white-space: pre;
border: none;
background: transparent; }
.highlight pre {
background-color: #f8f8f8;
border: 1px solid #cccccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
border-radius: 3px; }
pre {
background-color: #f8f8f8;
border: 1px solid #cccccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
border-radius: 3px; }
pre code, pre tt {
background-color: transparent;
border: none; }

172
static/css/grid.css Normal file
View file

@ -0,0 +1,172 @@
/*
// Copyright 2014 The Cayley Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
*/
body {
padding-top: 104px;
font-weight: 300;
font-family: 'Open Sans', sans-serif;
}
.text-center {
padding-top: 20px;
}
.col-xs-12 {
background-color: #fff;
}
#sidebar {
height: 100%;
padding-right: 0;
padding-top: 20px;
}
#sidebar .nav {
width: 95%;
}
#sidebar li {
border:0 #f2f2f2 solid;
border-bottom-width:1px;
}
.navbar-color-back {
background-color: #2c3e50;
border-color: #2c3e50;
padding-top: 20px;
padding-left:20px;
}
.navbar-toggle .icon-bar {
/*display:block;*/
width:22px;
height:2px;
border-radius:1px;
background-color: #ddd;
}
.navbar-toggle .icon-bar+.icon-bar {
margin-top:4px;
}
#logo {
width: 105px;
height: 65px;
float:left;
}
#logo-div h1 {
float:left;
font-weight: 300;
font-family: 'Open Sans', sans-serif;
padding-left: 15px;
margin-top: 8.0px;
}
h2 {
font-weight: 300;
font-family: 'Open Sans', sans-serif;
}
.navbar {
background-color: #ffffff;
border-bottom: 1px solid rgba(0,0,0,0.2);
padding-top: 10px;
padding-bottom: 10px;
padding-left 20px;
}
.bottompad {
padding-bottom: 10px;
}
.button-row {
padding-top: 10px;
padding-bottom: 10px;
}
#alertBox {
position: fixed;
top: 0px;
right: 0%;
display: none;
z-index: 2000;
}
.at-bottom {
position: fixed;
bottom: 0%;
}
/* collapsed sidebar styles */
@media screen and (max-width: 767px) {
.row-offcanvas {
position: relative;
-webkit-transition: all 0.25s ease-out;
-moz-transition: all 0.25s ease-out;
transition: all 0.25s ease-out;
}
.row-offcanvas-right
.sidebar-offcanvas {
right: -41.6%;
}
.row-offcanvas-left
.sidebar-offcanvas {
left: -41.6%;
}
.row-offcanvas-right.active {
right: 41.6%;
}
.row-offcanvas-left.active {
left: 41.6%;
}
.sidebar-offcanvas {
position: absolute;
top: 0;
width: 41.6%;
}
#sidebar {
background-color:#3b3b3b;
padding-top:0;
}
#sidebar .nav>li {
color: #ddd;
background: linear-gradient(#3E3E3E, #383838);
border-top: 1px solid #484848;
border-bottom: 1px solid #2E2E2E;
}
#sidebar .nav>li:first-child {
border-top:0;
}
#sidebar .nav>li>a {
color: #ddd;
}
#sidebar .nav>li>a>img {
max-width: 14px;
}
#sidebar .nav>li>a:hover, #sidebar .nav>li>a:focus {
text-decoration: none;
background: linear-gradient(#373737, #323232);
color: #fff;
}
#sidebar .nav .caret {
border-top-color: #fff;
border-bottom-color: #fff;
}
#sidebar .nav a:hover .caret{
border-top-color: #fff;
border-bottom-color: #fff;
}
.hide-small {
display: none;
}
}

View file

@ -0,0 +1,45 @@
/*
// Copyright 2014 The Cayley Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
*/
.codecol {
/* background-color: rgba(0,0,0,.2); */
margin-bottom: 10px;
padding-bottom: 10px;
border: 0 #f2f2f2 solid;
border-bottom-width: 1px;
}
.spacer {
margin-bottom: 2em;
}
line.link {
fill: none;
stroke-width: 1.5px;
}
.active {
font-weight: bold;
}
.CodeMirror {
font-family: "Inconsolata", monospace;
font-size: 120%;
}
#visualize {
width: 700px;
height: 700px;
}

BIN
static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

167
static/js/cayley_main.js Normal file
View file

@ -0,0 +1,167 @@
// Copyright 2014 The Cayley Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
$(function() {
s = null;
group = null;
Snap.load("/static/cayley.svg", function(d, err) {
//Snap(105,65).append(d);
s = Snap("#logo").append(d);
svg = Snap("svg");
var c = svg.selectAll("*")
group = svg.group()
group.add(c)
scale = new Snap.Matrix();
scale.scale(0.5);
group.transform(scale)
})
neutralColor = "#999999"
green = "#0F9D58"
stopAndReset = function () {
for (var i = 0; i < 19; i++) {
group[i].stop()
}
for (var i = 0; i < currentTimeouts.length; i++) {
clearTimeout(currentTimeouts[i])
}
currentTimeouts = []
group[17].attr({fill: neutralColor})
group[18].attr({fill: neutralColor})
for (var i = 1; i < 11; i++) {
group[i].attr({stroke: neutralColor})
}
}
currentTimeouts = []
flash = function(elem, start) {
currentTimeouts.push(
setTimeout(function() { elem.animate({stroke: green}, 1000)}, start * 1000))
currentTimeouts.push(
setTimeout(function() { elem.animate({stroke: neutralColor}, 1200)}, (start + 1) * 1000))
}
animate = function() {
group[17].animate({fill: green}, 1000)
currentTimeouts.push(
setTimeout(function() {group[17].animate({fill: neutralColor}, 1200)}, 1000))
flash(group[1], 0.5)
flash(group[8], 1.0)
flash(group[4], 1.5)
flash(group[10], 1.0)
flash(group[6], 1.5)
flash(group[2], 2.0)
currentTimeouts.push(
setTimeout(function() {group[18].animate({fill: green}, 1000)}, 2500))
currentTimeouts.push(
setTimeout(function() {group[18].animate({fill: neutralColor}, 1200)}, 3500))
currentTimeouts.push(
setTimeout(function() {group[17].animate({fill: green}, 1000)}, 3500))
currentTimeouts.push(
setTimeout(function() {group[17].animate({fill: neutralColor}, 1200)}, 4500))
flash(group[1], 4.0)
flash(group[7], 4.5)
flash(group[5], 5.0)
flash(group[9], 4.5)
flash(group[3], 5.0)
flash(group[2], 5.5)
currentTimeouts.push(
setTimeout(function() {group[18].animate({fill: green}, 1000)}, 6000))
currentTimeouts.push(
setTimeout(function() {group[18].animate({fill: neutralColor}, 1200, function() {
stopAndReset();
animate();
})}, 7000))
}
if ($("#code").length != 0) {
editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
continueComments: "Enter",
// extraKeys: {"Ctrl-Q": "toggleComment"}
});
} else{
editor = null;
}
var defaultQueryStrings = {
"gremlin": "g.Emit('Hello World')",
"mql": "[{\n \"id\": \"Hello World\"\n}]"
}
var getLastQueryStringFor = function(type) {
if (typeof(Storage) !== "undefined") {
return localStorage.getItem("cayleySavedQueries" + type)
} else {
return defaultQueryStrings[type]
}
}
var switchTo = function(type) {
if (type === "gremlin") { switchToGremlin()}
if (type === "mql") { switchToMQL()}
if (typeof(Storage) !== "undefined") {
localStorage.setItem("cayleyQueryLang", type);
}
if (editor) {
editor.setValue(getLastQueryStringFor(type))
}
}
var switchToGremlin = function () {
$("#selected-query-lang").html("Gremlin " + caretSpan)
selectedQueryLanguage = "gremlin"
}
var switchToMQL = function() {
$("#selected-query-lang").html("MQL" + caretSpan)
selectedQueryLanguage = "mql"
}
selectedQueryLanguage = "gremlin"
var caretSpan = " &nbsp <span class='caret'></span>"
if (typeof(Storage) !== "undefined") {
savedQueries = localStorage.getItem("cayleySavedQueriesmql");
if (savedQueries === null) {
for (var key in defaultQueryStrings) {
localStorage.setItem("cayleySavedQueries" + key, defaultQueryStrings[key])
}
}
lang = localStorage.getItem("cayleyQueryLang");
if (lang !== null) {
switchTo(lang)
} else {
switchTo("gremlin")
}
} else {
switchTo("gremlin")
}
$("#gremlin-dropdown").click(function() {
switchTo("gremlin")
})
$("#mql-dropdown").click(function() {
switchTo("mql")
})
});

41
static/js/cayley_query.js Normal file
View file

@ -0,0 +1,41 @@
// Copyright 2014 The Cayley Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
$(function() {
$("#sbQuery").addClass("active");
output_editor = CodeMirror.fromTextArea(document.getElementById("output"), {
lineNumbers: true,
matchBrackets: true,
});
$("#run_button").click(function() {
var data = editor.getValue()
$("#output").text(editor.getValue())
animate();
$.post("/api/v1/query/" + selectedQueryLanguage, data)
.done(function(return_data) {
if (typeof(Storage) !== "undefined") {
localStorage.setItem("cayleySavedQueries" + selectedQueryLanguage, data)
}
output_editor.setValue(return_data)
stopAndReset();
})
.fail(function(jqxhr, textStatus, errorThrown){
output_editor.setValue(jqxhr.responseText)
stopAndReset();
})
})
});

33
static/js/cayley_shape.js Normal file
View file

@ -0,0 +1,33 @@
// Copyright 2014 The Cayley Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
$(function() {
$("#sbQueryShape").addClass("active");
$("#run_button").click(function() {
var data = editor.getValue()
$.post("/api/v1/shape/" + selectedQueryLanguage, data)
.done(function(return_data) {
if (typeof(Storage) !== "undefined") {
localStorage.setItem("cayleySavedQueries" + selectedQueryLanguage, data)
}
shape = $.parseJSON(return_data)
$("#viz").empty()
if (shape.hasOwnProperty("nodes")) {
var net = Network()
net("#viz", shape)
}
});
});
})

View file

@ -0,0 +1,113 @@
// Copyright 2014 The Cayley Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
$(function() {
$("#sbVisualize").addClass("active");
var createGraphVisualization = function(results) {
if (window.sigmaGraph !== undefined) {
sigmaGraph.stopForceAtlas2()
sigmaGraph.kill()
$("#visualize").text("")
}
var nodeMap = {}
var g = {nodes: [], edges: []}
for (var i = 0; i < results.length; i++) {
result = results[i];
source = result["source"]
target = result["target"]
var source_color
var target_color
if (result["source_color"] != undefined) {
source_color = result["source_color"]
} else {
//source_color = "#2c3e50"
source_color = "#001B8A"
}
if (result["target_color"] != undefined) {
target_color = result["target_color"]
} else {
target_color = "#F09300"
}
if (nodeMap[source] !== true) {
var data = {
id: source,
x: Math.random(),
y: Math.random(),
size: 10,
color: source_color
}
if (result["source_label"] != undefined) {
data.label = result["source_label"]
} else {
data.label = source
}
g.nodes.push(data)
nodeMap[source] = true
}
if (nodeMap[target] !== true) {
var data = {
id: target,
x: Math.random(),
y: Math.random(),
size: 10,
color: target_color
}
if (result["target_label"] != undefined) {
data.label = result["target_label"]
} else {
data.label = target
}
g.nodes.push(data)
nodeMap[target] = true
}
g.edges.push({
id: "e" + i,
source: source,
target: target,
size: 5,
color: '#ccc'
})
}
sigmaGraph = new sigma({
graph: g,
container: 'visualize',
settings: {
defaultNodeColor: '#ec5148'
}
});
sigmaGraph.startForceAtlas2();
sigmaGraph.forceatlas2.p.linLogMode = true;
}
$("#run_button").click(function() {
var data = editor.getValue()
animate();
$.post("/api/v1/query/" + selectedQueryLanguage, data)
.done(function(return_data) {
stopAndReset();
if (typeof(Storage) !== "undefined") {
localStorage.setItem("cayleySavedQueries" + selectedQueryLanguage, data)
}
links = $.parseJSON(return_data)
createGraphVisualization(links.result)
})
.fail(function() {
stopAndReset();
});
});
})

158
static/js/cayley_write.js Normal file
View file

@ -0,0 +1,158 @@
// Copyright 2014 The Cayley Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
$(function() {
var alertFail = function(text) {
$("#alertBox").text(text)
$("#alertBox").addClass("alert-danger").fadeIn(300).delay(2000).fadeOut(300).queue(function(){ $(this).removeClass("alert-danger")});
}
var alertSucceed = function(text) {
$("#alertBox").text(text)
$("#alertBox").addClass("alert-success").fadeIn(300).delay(2000).fadeOut(300).queue(function(){ $(this).removeClass("alert-success")});
}
var checkTriple = function(t) {
if (t.subject == "") {
alertFail("Need a subject")
return false
}
if (t.predicate == "") {
alertFail("Need a predicate")
return false
}
if (t.object == "") {
alertFail("Need an object")
return false
}
return true
}
$("#sbWrite").addClass("active");
$("#add_triple").click(function() {
var triple = {
subject: $("#subject").val(),
predicate: $("#predicate").val(),
object: $("#object").val(),
provenance: $("#provenance").val()
}
if (!checkTriple(triple)) {
return
}
$.post("/api/v1/write", JSON.stringify([triple]))
.done(function(return_data){
alertSucceed("Wrote a triple!")
})
.fail(function(jqxhr) {
var data = $.parseJSON(jqxhr.responseText)
alertFail(data.error)
})
})
$("#delete_triple").click(function() {
var triple = {
subject: $("#rsubject").val(),
predicate: $("#rpredicate").val(),
object: $("#robject").val(),
provenance: $("#rprovenance").val()
}
if (!checkTriple(triple)) {
return
}
$.post("/api/v1/delete", JSON.stringify([triple]))
.done(function(return_data){
alertSucceed("Deleted a triple!")
})
.fail(function(jqxhr) {
var data = $.parseJSON(jqxhr.responseText)
alertFail(data.error)
})
})
var upload = null
var uploadProgress = function(event) {
if (event.lengthComputable) {
var percentComplete = Math.round(event.loaded * 100 / event.total);
$("#alertBox").text("Uploaded " + percentComplete.toString() + "%")
} else {
$("#alertBox").text("Uploading...")
}
}
var uploadComplete = function(event) {
stopAndReset();
var data = $.parseJSON(upload.responseText)
$("#alertBox").text("Upload complete! " + data.result);
$("#alertBox").removeClass("alert-info").addClass("alert-success")
.delay(2000).fadeOut(300)
.queue(function () {
$("#write_file").fadeIn(30);
$("#alertBox").removeClass("alert-success");
})
upload = null
}
var uploadCanceled = function(event) {
upload = null
stopAndReset();
$("#alertBox").text("Upload canceled!")
$("#alertBox").removeClass("alert-info").addClass("alert-danger")
.delay(2000).fadeOut(300)
.queue(function () {
$("#write_file").fadeIn(30);
$("#alertBox").removeClass("alert-danger");
})
}
var uploadFailed = function(event) {
upload = null
stopAndReset();
$("#alertBox").text("Upload failed!")
$("#alertBox").removeClass("alert-info").addClass("alert-danger")
.delay(2000).fadeOut(300)
.queue(function () {
$("#write_file").fadeIn(30);
$("#alertBox").removeClass("alert-danger");
})
}
$("#write_file").click(function() {
try {
animate();
var fd = new FormData()
fd.append("NQuadFile", document.getElementById("nquad_file").files[0])
var xhr = new XMLHttpRequest()
upload = xhr
$("#write_file").fadeOut(30);
$("#alertBox").addClass("alert-info").fadeIn(300);
xhr.upload.addEventListener("progress", uploadProgress, false);
xhr.addEventListener("load", uploadComplete, false);
xhr.addEventListener("error", uploadFailed, false);
xhr.addEventListener("abort", uploadCanceled, false);
xhr.open("POST", "/api/v1/write/file/nquad");
xhr.send(fd);
} catch(err) {
$("#alertBox").removeClass("alert-info");
stopAndReset();
alertFail(err)
$("#write_file").fadeIn(30);
}
})
});

351
static/js/query_viz.js Normal file
View file

@ -0,0 +1,351 @@
// Copyright 2014 The Cayley Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
function Network() {
var height = 800;
var width = 800;
// Things in the first force graph.
var nodesG = null;
var linksG = null;
var linkNodesG = null;
var node = null;
var linknode = null;
var link = null;
var curLinksData = null;
var curNodesData = null;
// Things in the second force graph
var tag_nodesG = null;
var tag_linksG = null;
var tag_node = null;
var tag_link = null;
var curTagLinksData = null;
var curTagNodesData = null;
var allData = null;
var dragstart = function(d) {
d3.select(this).classed("fixed", d.fixed = true);
}
//our force directed layout
var force = d3.layout.force()
var force_drag = force.drag().on("dragstart", dragstart)
var tag_force = d3.layout.force()
//color function used to color nodes
var baseNodeColors = d3.scale.category20()
var linkNodeColors = function(d) {
return d3.rgb("#555").toString()
}
var strokeFor = function(d) {
return d3.rgb("#000").brighter().toString()
}
var rotationTransformForLinkNode = function (d) {
var center_x = (d.link.source.x + d.link.target.x) / 2
var center_y = (d.link.source.y + d.link.target.y) / 2
var dx = d.link.target.x - d.link.source.x
var dy = d.link.target.y - d.link.source.y
var rotation_radians = Math.atan2(dy,dx)
var rotation_degrees = rotation_radians * (180 / Math.PI)
return "rotate(" + rotation_degrees + ", " + center_x + ", " + center_y + ")"
}
var updateLink = function() {
this.attr("x1", function(d) {return d.source.x})
.attr("y1", function(d) {return d.source.y})
.attr("x2", function(d) {return d.target.x})
.attr("y2", function(d) {return d.target.y})
}
var forceTick = function(e) {
tag_force.start()
node
.attr("cx", function(d) {return d.x})
.attr("cy", function(d) {return d.y})
linknode.each(function(d) {
d.x = (d.link.source.x + d.link.target.x) / 2
d.y = (d.link.source.y + d.link.target.y) / 2
})
linknode
.attr("cx", function(d) {return d.x })
.attr("cy", function(d) {return d.y })
.attr("transform", rotationTransformForLinkNode)
link.call(updateLink);
tagForceTick(e)
}
var tagForceTick = function(e) {
tag_node.each(function(d) {
if(d.is_tag === false) {
d.x = d.node.x;
d.y = d.node.y;
} else {
var b = this.childNodes[1].getBBox();
var diffX = d.x - d.node.x;
var diffY = d.y - d.node.y;
var dist = Math.sqrt(diffX * diffX + diffY * diffY);
var shiftX = b.width * (diffX - dist) / (dist * 2);
shiftX = Math.max(-b.width, Math.min(0, shiftX));
var shiftY = 5;
this.childNodes[1].setAttribute("transform", "translate(" + shiftX + "," + shiftY + ")");
}
});
tag_node
.attr("transform", function(d) {
return "translate(" + d.x + "," + d.y + ")";
});
tag_link.call(updateLink);
}
var setupData = function (data) {
data.nodes.forEach(function (n) {
n.x = randomnumber=Math.floor(Math.random()*width)
n.y = randomnumber=Math.floor(Math.random()*height)
n.radius = 10
});
var nodesMap = mapNodes(data.nodes)
data.links.forEach(function (l) {
l.source = nodesMap.get(l.source)
l.target = nodesMap.get(l.target)
nodesMap.get(l.link_node).link = l
})
data.tag_links = []
data.tag_nodes = []
var tag_id_counter = 0
data.nodes.forEach(function (n) {
if (n.tags !== undefined) {
n.tags.forEach( function (tag) {
var tag_node = {}
tag_node.id = "tag" + tag_id_counter
tag_node.tag = tag
tag_node.x = n.x
tag_node.y = n.y
tag_node.is_tag = true
tag_node.is_value = false
tag_node.node = n
tag_node.radius = 0
tag_id_counter += 1;
var fake_node = {}
fake_node.id = "tag" + tag_id_counter
fake_node.x = n.x
fake_node.y = n.y
fake_node.node = n
fake_node.radius = 0
fake_node.is_tag = false
tag_id_counter += 1;
var tag_link = {}
tag_link.source = fake_node
tag_link.target = tag_node
data.tag_nodes.push(tag_node)
data.tag_nodes.push(fake_node)
data.tag_links.push(tag_link)
})
}
if (n.values !== undefined) {
n.values.forEach( function (value) {
var tag_node = {}
tag_node.id = "tag" + tag_id_counter
tag_node.tag = value
tag_node.x = n.x
tag_node.y = n.y
tag_node.is_tag = true
tag_node.is_value = true
tag_node.node = n
tag_node.radius = 0
tag_id_counter += 1;
var fake_node = {}
fake_node.id = "tag" + tag_id_counter
fake_node.x = n.x
fake_node.y = n.y
fake_node.node = n
fake_node.radius = 0
fake_node.is_tag = false
tag_id_counter += 1;
var tag_link = {}
tag_link.source = fake_node
tag_link.target = tag_node
data.tag_nodes.push(tag_node)
data.tag_nodes.push(fake_node)
data.tag_links.push(tag_link)
})
}
})
return data;
}
var mapNodes = function (nodes) {
var nodesMap = d3.map()
nodes.forEach(function (n) {
nodesMap.set(n.id, n)
})
return nodesMap
}
var network = function (selection, data) {
allData = setupData(data)
var vis = d3.select(selection).append("svg")
.attr("width", width)
.attr("height", height)
vis.append("defs").append("marker")
.attr("id", "arrowhead")
.attr("refX", 6 + 3) // shift?
.attr("refY", 2)
.attr("markerWidth", 6)
.attr("markerHeight", 4)
.attr("orient", "auto")
.append("path")
.attr("d", "M 0,0 V 4 L6,2 Z");
linksG = vis.append("g").attr("id", "links")
nodesG = vis.append("g").attr("id", "nodes")
linkNodesG = vis.append("g").attr("id", "link-nodes")
tagNodesG = vis.append("g").attr("id", "tag_nodes")
tagLinksG = vis.append("g").attr("id", "tag_links")
force.size([width, height])
force.on("tick", forceTick)
.charge(-200)
.linkDistance(100);
tag_force
.gravity(0)
.linkDistance(25)
.linkStrength(20)
.charge(-100)
.size([width, height])
tag_force.start()
//perform rendering and start force layout
update()
}
var update = function () {
allNodes = allData.nodes;
curLinksData = allData.links;
curNodesData = $.grep(allData.nodes, function(n) { return n.is_link_node === false; })
curLinkNodesData = $.grep(allData.nodes, function(n) { return n.is_link_node; })
curTagLinksData = allData.tag_links
curTagNodesData = allData.tag_nodes
force.nodes(allNodes);
node = nodesG.selectAll("circle.node")
.data(curNodesData, function(d) {return d.id})
node.enter().append("circle")
.attr("class", "node")
.attr("cx", function(d) {return d.x})
.attr("cy", function(d) {return d.y})
.attr("r", function(d) {return d.radius;})
.style("fill", function(d) {return baseNodeColors(d.id);})
.style("stroke", function(d) {return strokeFor(d);})
.style("stroke-width", 1.0)
.call(force_drag)
node.exit().remove();
linknode = linkNodesG.selectAll("ellipse.node")
.data(curLinkNodesData, function(d) { return d.id })
linknode.enter().append("ellipse")
.attr("class", "node")
.attr("cx", function(d) {return d.x})
.attr("cy", function(d) {return d.y})
.attr("rx", function(d) {return d.radius;})
.attr("ry", function(d) {return d.radius / 2;})
.style("fill", function(d) {return linkNodeColors(d.id);})
.style("stroke", function(d) {return strokeFor(d);})
.style("stroke-width", 1.0);
linknode.exit().remove();
force.links(curLinksData);
link = linksG.selectAll("line.link")
.data(curLinksData, function(d) { return d.source.id + "_" + d.target.id});
link.enter().append("line")
.attr("class", "link")
.attr("stroke", "#222")
.attr("stroke-opacity", 1.0)
.attr("marker-end", "url(#arrowhead)")
.style("stroke-width", 2.0)
.attr("x1", function(d) {return d.source.x})
.attr("y1", function(d) {return d.source.y})
.attr("x2", function(d) {return d.target.x})
.attr("y2", function(d) {return d.target.y});
link.exit().remove();
force.start();
tag_force.nodes(curTagNodesData);
tag_node = nodesG.selectAll("g.tag_node")
.data(curTagNodesData, function(d) { return d.id })
var tag_g = tag_node.enter().append("g").attr("class", "tag_node")
tag_g.append("svg:circle").attr("r", 0).style("fill", "#FFF");
tag_g.append("svg:text")
.text(function(d) { return d.is_tag ? d.tag : "" })
.style("fill", "#555")
.style("font-family", function(d) { return d.is_value ? "Courier" : "Arial"})
.style("font-size", 12);
tag_force.links(curTagLinksData);
tag_link = linksG.selectAll("line.tag_link")
.data(curTagLinksData, function(d) { return d.source.id + "_" + d.target.id});
tag_link.enter().append("line")
.attr("class", "tag_link")
.attr("stroke", "#ddd")
.attr("stroke-opacity", 0.5)
.attr("x1", function(d) {return d.source.x})
.attr("y1", function(d) {return d.source.y})
.attr("x2", function(d) {return d.target.x})
.attr("y2", function(d) {return d.target.y});
tag_link.exit().remove();
tag_force.start()
}
return network
};

File diff suppressed because one or more lines are too long

35
static/third_party/sigmajs/README.md vendored Normal file
View file

@ -0,0 +1,35 @@
[![Build Status](https://travis-ci.org/jacomyal/sigma.js.png)](https://travis-ci.org/jacomyal/sigma.js)
sigma.js - v1.0.2
=================
Sigma is a JavaScript library dedicated to graph drawing.
### Resources
[The website](http://sigmajs.org) provides a global overview of the project, and the documentation is available in the [Github Wiki](https://github.com/jacomyal/sigma.js/wiki).
Also, the `plugins` and `examples` directories contain some various use-cases, that might help you understanding how to use sigma.
### How to use it
To use it, clone the repository:
```
git clone git@github.com:jacomyal/sigma.js.git
```
To build the code:
- Install [Node.js](http://nodejs.org/).
- Install [gjslint](https://developers.google.com/closure/utilities/docs/linter_howto?hl=en).
- Use `npm install` to install sigma development dependencies.
- Use `npm run build` to minify the code with [Uglify](https://github.com/mishoo/UglifyJS). The minified file `sigma.min.js` will then be accessible in the `build/` folder.
Also, you can customize the build by adding or removing files from the `coreJsFiles` array in `Gruntfile.js` before applying the grunt task.
### Contributing
You can contribute by submitting [issues tickets](http://github.com/jacomyal/sigma.js/issues) and proposing [pull requests](http://github.com/jacomyal/sigma.js/pulls). Make sure that tests and linting pass before submitting any pull request by running the command `grunt`.
The whole source code is validated by the [Google Closure Linter](https://developers.google.com/closure/utilities/) and [JSHint](http://www.jshint.com/), and the comments are written in [JSDoc](http://en.wikipedia.org/wiki/JSDoc) (tags description is available [here](https://developers.google.com/closure/compiler/docs/js-for-compiler)).

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
(function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.parsers"),sigma.utils.pkg("sigma.utils"),sigma.utils.xhr=function(){if(window.XMLHttpRequest)return new XMLHttpRequest;var a,b;if(window.ActiveXObject){a=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"];for(b in a)try{return new ActiveXObject(a[b])}catch(c){}}return null},sigma.parsers.json=function(a,b,c){var d,e=sigma.utils.xhr();if(!e)throw"XMLHttpRequest not supported, cannot load the file.";e.open("GET",a,!0),e.onreadystatechange=function(){4===e.readyState&&(d=JSON.parse(e.responseText),b instanceof sigma?(b.graph.clear(),b.graph.read(d)):"object"==typeof b?(b.graph=d,b=new sigma(b)):"function"==typeof b&&(c=b,b=null),c&&c(b||d))},e.send()}}).call(this);

View file

@ -0,0 +1 @@
(function(){"use strict";function a(a){if(d[a])return d[a];var b=[0,0,0];return a.match(/^#/)?(a=(a||"").replace(/^#/,""),b=3===a.length?[parseInt(a.charAt(0)+a.charAt(0),16),parseInt(a.charAt(1)+a.charAt(1),16),parseInt(a.charAt(2)+a.charAt(2),16)]:[parseInt(a.charAt(0)+a.charAt(1),16),parseInt(a.charAt(2)+a.charAt(3),16),parseInt(a.charAt(4)+a.charAt(5),16)]):a.match(/^ *rgba? *\(/)&&(a=a.match(/^ *rgba? *\( *([0-9]*) *, *([0-9]*) *, *([0-9]*) *(,.*)?\) *$/),b=[+a[1],+a[2],+a[3]]),d[a]={r:b[0],g:b[1],b:b[2]},d[a]}function b(b,c,d){b=a(b),c=a(c);var e={r:b.r*(1-d)+c.r*d,g:b.g*(1-d)+c.g*d,b:b.b*(1-d)+c.b*d};return"rgb("+[0|e.r,0|e.g,0|e.b].join(",")+")"}if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.plugins");var c=0,d={};sigma.plugins.animate=function(a,d,e){function f(){var c=(sigma.utils.dateNow()-k)/i;c>=1?(a.graph.nodes().forEach(function(a){for(var b in d)b in d&&(a[b]=a[d[b]])}),a.refresh(),"function"==typeof g.onComplete&&g.onComplete()):(c=j(c),a.graph.nodes().forEach(function(a){for(var e in d)e in d&&(a[e]=e.match(/color$/)?b(l[a.id][e],a[d[e]],c):a[d[e]]*c+l[a.id][e]*(1-c))}),a.refresh(),a.animations[h]=requestAnimationFrame(f))}var g=e||{},h=++c,i=g.duration||a.settings("animationsTime"),j="string"==typeof g.easing?sigma.utils.easings[g.easing]:"function"==typeof g.easing?g.easing:sigma.utils.easings.quadraticInOut,k=sigma.utils.dateNow(),l=a.graph.nodes().reduce(function(a,b){var c;a[b.id]={};for(c in d)c in b&&(a[b.id][c]=b[c]);return a},{});a.animations=a.animations||Object.create({}),sigma.plugins.kill(a),f()},sigma.plugins.kill=function(a){for(var b in a.animations||{})cancelAnimationFrame(a.animations[b])}}).call(window);

View file

@ -0,0 +1 @@
(function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.plugins"),sigma.plugins.dragNodes=function(a,b){if(sigma.renderers.webgl&&b instanceof sigma.renderers.webgl)throw new Error("The sigma.plugins.dragNodes is not compatible with the WebGL renderer");var c=document.body,d=b.container,e=d.lastChild,f=b.camera,g=null,h="",i=!1;h=b instanceof sigma.renderers.webgl?b.options.prefix.substr(5):b.options.prefix;var j=function(a){i||(g=a.data.node,e.addEventListener("mousedown",l),i=!0)},k=function(){i&&(e.removeEventListener("mousedown",l),i=!1)},l=function(){var d=a.graph.nodes().length;d>1&&(e.removeEventListener("mousedown",l),c.addEventListener("mousemove",n),c.addEventListener("mouseup",m),b.unbind("outNode",k),b.settings({mouseEnabled:!1,enableHovering:!1}),a.refresh())},m=function(){e.addEventListener("mousedown",l),c.removeEventListener("mousemove",n),c.removeEventListener("mouseup",m),k(),b.bind("outNode",k),b.settings({mouseEnabled:!0,enableHovering:!0}),a.refresh()},n=function(b){for(var c=b.pageX-d.offsetLeft,e=b.pageY-d.offsetTop,i=Math.cos(f.angle),j=Math.sin(f.angle),k=a.graph.nodes(),l=[],m=0;2>m;m++){var n=k[m],o={x:n.x*i+n.y*j,y:n.y*i-n.x*j,renX:n[h+"x"],renY:n[h+"y"]};l.push(o)}c=(c-l[0].renX)/(l[1].renX-l[0].renX)*(l[1].x-l[0].x)+l[0].x,e=(e-l[0].renY)/(l[1].renY-l[0].renY)*(l[1].y-l[0].y)+l[0].y,g.x=c*i-e*j,g.y=e*i+c*j,a.refresh()};b.bind("overNode",j),b.bind("outNode",k)}}).call(window);

View file

@ -0,0 +1 @@
(function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.classes.graph.addMethod("neighborhood",function(a){var b,c,d,e,f,g={},h={},i={nodes:[],edges:[]};if(!this.nodes(a))return i;e=this.nodes(a),f={},f.center=!0;for(b in e)f[b]=e[b];g[a]=!0,i.nodes.push(f);for(b in this.allNeighborsIndex[a]){g[b]||(g[b]=!0,i.nodes.push(this.nodesIndex[b]));for(c in this.allNeighborsIndex[a][b])h[c]||(h[c]=!0,i.edges.push(this.edgesIndex[c]))}for(b in g)if(b!==a)for(c in g)if(c!==a&&b!==c&&this.allNeighborsIndex[b][c])for(d in this.allNeighborsIndex[b][c])h[d]||(h[d]=!0,i.edges.push(this.edgesIndex[d]));return i}),sigma.utils.pkg("sigma.plugins"),sigma.plugins.neighborhoods=function(){var a=new sigma.classes.graph;this.neighborhood=function(b){return a.neighborhood(b)},this.load=function(b,c){var d=function(){if(window.XMLHttpRequest)return new XMLHttpRequest;var a,b;if(window.ActiveXObject){a=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"];for(b in a)try{return new ActiveXObject(a[b])}catch(c){}}return null}();if(!d)throw"XMLHttpRequest not supported, cannot load the data.";return d.open("GET",b,!0),d.onreadystatechange=function(){4===d.readyState&&(a.clear().read(JSON.parse(d.responseText)),c&&c())},d.send(),this},this.read=function(b){a.clear().read(b)}}}).call(window);

View file

@ -0,0 +1 @@
(function(){"use strict";var a=[],b=function(b,c,d){a.push({name:b,drawShape:c,drawBorder:d})},c=function(){return a},d=function(a){return function(b,c,d,e,f,g){g.fillStyle=f,g.beginPath(),a(b,c,d,e,g),g.closePath(),g.fill()}},e=function(a){return function(b,c,d,e,f,g){g.strokeStyle=f,g.lineWidth=e/5,g.beginPath(),a(b,c,d,e,g),g.closePath(),g.stroke()}},f=function(a,b,c,d,e){var f=45*Math.PI/180;e.moveTo(b+d*Math.sin(f),c-d*Math.cos(f));for(var g=1;4>g;g++)e.lineTo(b+Math.sin(f+2*Math.PI*g/4)*d,c-Math.cos(f+2*Math.PI*g/4)*d)};b("square",d(f),e(f));var g=function(a,b,c,d,e){e.arc(b,c,d,0,2*Math.PI,!0)};b("circle",d(g),e(g));var h=function(a,b,c,d,e){e.moveTo(b-d,c),e.lineTo(b,c-d),e.lineTo(b+d,c),e.lineTo(b,c+d)};b("diamond",d(h),e(h));var i=function(a,b,c,d,e){var f=a.equilateral&&a.equilateral.numPoints||5,g=(a.equilateral&&a.equilateral.rotate||0)*Math.PI/180,h=d;e.moveTo(b+h*Math.sin(g),c-h*Math.cos(g));for(var i=1;f>i;i++)e.lineTo(b+Math.sin(g+2*Math.PI*i/f)*h,c-Math.cos(g+2*Math.PI*i/f)*h)};b("equilateral",d(i),e(i));var j=function(a,b,c,d,e){var f=a.star&&a.star.numPoints||5,g=a.star&&a.star.innerRatio||.5,h=d,i=d*g,j=Math.PI/f;e.moveTo(b,c-d);for(var k=0;f>k;k++)e.lineTo(b+Math.sin(j+2*Math.PI*k/f)*i,c-Math.cos(j+2*Math.PI*k/f)*i),e.lineTo(b+Math.sin(2*Math.PI*(k+1)/f)*h,c-Math.cos(2*Math.PI*(k+1)/f)*h)};b("star",d(j),e(j));var k=function(a,b,c,d,e,f){f.fillStyle="yellow",f.beginPath(),f.arc(b,c,d,1.25*Math.PI,0,!1),f.arc(b,c,d,0,.75*Math.PI,!1),f.lineTo(b,c),f.closePath(),f.fill(),f.fillStyle="white",f.strokeStyle="black",f.beginPath(),f.arc(b+d/3,c-d/3,d/4,0,2*Math.PI,!1),f.closePath(),f.fill(),f.stroke(),f.fillStyle="black",f.beginPath(),f.arc(b+4*d/9,c-d/3,d/8,0,2*Math.PI,!1),f.closePath(),f.fill()};b("pacman",k,null),this.ShapeLibrary={enumerate:c,version:"0.1"}}).call(this),function(a){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";if("undefined"==typeof ShapeLibrary)throw"ShapeLibrary is not declared";sigma.utils.pkg("sigma.canvas.nodes");var b=a,c={},d=function(a){b=a},e=function(a,d,e,f,g){if(b&&a.image&&a.image.url){var h=a.image.url,i=a.image.h||1,j=a.image.w||1,k=a.image.scale||1,l=a.image.clip||1,m=c[h];m||(m=document.createElement("IMG"),m.src=h,m.onload=function(){console.log("redraw on image load"),b.refresh()},c[h]=m);var n=i>j?j/i:1,o=j>i?i/j:1,p=f*k;g.save(),g.beginPath(),g.arc(d,e,f*l,0,2*Math.PI,!0),g.closePath(),g.clip(),g.drawImage(m,d+Math.sin(-0.7855)*p*n,e-Math.cos(-0.7855)*p*o,p*n*2*Math.sin(-0.7855)*-1,p*o*2*Math.cos(-0.7855)),g.restore()}},f=function(a,b,c){sigma.canvas.nodes[a]=function(a,d,f){var g=f("prefix")||"",h=a[g+"size"],i=a.color||f("defaultNodeColor"),j=a.borderColor||i,k=a[g+"x"],l=a[g+"y"];d.save(),b&&b(a,k,l,h,i,d),c&&c(a,k,l,h,j,d),e(a,k,l,h,d),d.restore()}};ShapeLibrary.enumerate().forEach(function(a){f(a.name,a.drawShape,a.drawBorder)}),this.CustomShapes={init:d,version:"0.1"}}.call(this);

File diff suppressed because one or more lines are too long