initial commit

This commit is contained in:
vieron
2012-07-18 18:31:44 +02:00
commit 257914ee99
52 changed files with 31624 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
demo/
node_modules/
LICENSE-GPL
LICENSE-MIT
README.md

48
dist/jquery.gridster.css vendored Normal file
View File

@@ -0,0 +1,48 @@
/*! gridster.js - v0.1.0 - 2012-07-18
* https://github.com/ducksboard/gridster.js
* Copyright (c) 2012 ducksboard; Licensed MIT, GPL */
.gridster {
position:relative;
}
.gridster > * {
margin: 0 auto;
-webkit-transition: height .4s;
-moz-transition: height .4s;
-o-transition: height .4s;
-ms-transition: height .4s;
transition: height .4s;
}
.gridster .gs_w{
z-index: 2;
position: absolute;
background: rgba(0,0,0,.23);
}
.ready .gs_w:not(.player):not(.preview-holder) {
-webkit-transition: left .3s, top .3s;
-moz-transition: left .3s, top .3s;
-o-transition: left .3s, top .3s;
}
.gridster.dragging .support-grid {
z-index: 5;
}
.gridster.dragging .ui-sortable-helper{
z-index: 10;
}
.gridster .preview-holder {
border: 2px dashed #333 ;
border-radius: 5px;
z-index: 1;
background:#FFF;
position: absolute;
}
.gridster .player {
z-index: 10!important;
}

2237
dist/jquery.gridster.js vendored Normal file

File diff suppressed because it is too large Load Diff

3
dist/jquery.gridster.min.css vendored Normal file
View File

@@ -0,0 +1,3 @@
/*! gridster.js - v0.1.0 - 2012-07-18
* https://github.com/ducksboard/gridster.js
* Copyright (c) 2012 ducksboard; Licensed MIT, GPL */.gridster{position:relative}.gridster>*{margin:0 auto;-webkit-transition:height .4s;-moz-transition:height .4s;-o-transition:height .4s;-ms-transition:height .4s;transition:height .4s}.gridster .gs_w{z-index:2;position:absolute;background:rgba(0,0,0,.23)}.ready .gs_w:not(.player):not(.preview-holder){-webkit-transition:left .3s,top .3s;-moz-transition:left .3s,top .3s;-o-transition:left .3s,top .3s}.gridster.dragging .support-grid{z-index:5}.gridster.dragging .ui-sortable-helper{z-index:10}.gridster .preview-holder{border:2px dashed #333;border-radius:5px;z-index:1;background:#FFF;position:absolute}.gridster .player{z-index:10!important}

4
dist/jquery.gridster.min.js vendored Normal file

File diff suppressed because one or more lines are too long

11
docs/api.js Normal file
View File

@@ -0,0 +1,11 @@
YUI.add("yuidoc-meta", function(Y) {
Y.YUIDoc = { meta: {
"classes": [
"Collision",
"Coords",
"Gridster"
],
"modules": [],
"allModules": []
} };
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

BIN
docs/assets/css/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

782
docs/assets/css/main.css Normal file
View File

@@ -0,0 +1,782 @@
/*
Font sizes for all selectors other than the body are given in percentages,
with 100% equal to 13px. To calculate a font size percentage, multiply the
desired size in pixels by 7.6923076923.
Here's a quick lookup table:
10px - 76.923%
11px - 84.615%
12px - 92.308%
13px - 100%
14px - 107.692%
15px - 115.385%
16px - 123.077%
17px - 130.769%
18px - 138.462%
19px - 146.154%
20px - 153.846%
*/
html {
background: #fff;
color: #333;
overflow-y: scroll;
}
body {
font: 13px/1.4 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', 'Bitstream Vera Sans', 'Helvetica', 'Arial', sans-serif;
margin: 0;
padding: 0;
}
/* -- Links ----------------------------------------------------------------- */
a {
color: #356de4;
text-decoration: none;
}
.hidden {
display: none;
}
a:hover { text-decoration: underline; }
/* "Jump to Table of Contents" link is shown to assistive tools, but hidden from
sight until it's focused. */
.jump {
position: absolute;
padding: 3px 6px;
left: -99999px;
top: 0;
}
.jump:focus { left: 40%; }
/* -- Paragraphs ------------------------------------------------------------ */
p { margin: 1.3em 0; }
dd p, td p { margin-bottom: 0; }
dd p:first-child, td p:first-child { margin-top: 0; }
/* -- Headings -------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
color: #D98527;/*was #f80*/
font-family: 'Trebuchet MS', sans-serif;
font-weight: bold;
line-height: 1.1;
margin: 1.1em 0 0.5em;
}
h1 {
font-size: 184.6%;
color: #30418C;
margin: 0.75em 0 0.5em;
}
h2 {
font-size: 153.846%;
color: #E48A2B;
}
h3 { font-size: 138.462%; }
h4 {
border-bottom: 1px solid #DBDFEA;
color: #E48A2B;
font-size: 115.385%;
font-weight: normal;
padding-bottom: 2px;
}
h5, h6 { font-size: 107.692%; }
/* -- Code and examples ----------------------------------------------------- */
code, kbd, pre, samp {
font-family: Menlo, Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;
font-size: 92.308%;
line-height: 1.35;
}
p code, p kbd, p samp {
background: #FCFBFA;
border: 1px solid #EFEEED;
padding: 0 3px;
}
a code, a kbd, a samp,
pre code, pre kbd, pre samp,
table code, table kbd, table samp,
.intro code, .intro kbd, .intro samp,
.toc code, .toc kbd, .toc samp {
background: none;
border: none;
padding: 0;
}
pre.code, pre.terminal, pre.cmd {
overflow-x: auto;
*overflow-x: scroll;
padding: 0.3em 0.6em;
}
pre.code {
background: #FCFBFA;
border: 1px solid #EFEEED;
border-left-width: 5px;
}
pre.terminal, pre.cmd {
background: #F0EFFC;
border: 1px solid #D0CBFB;
border-left: 5px solid #D0CBFB;
}
/* Don't reduce the font size of <code>/<kbd>/<samp> elements inside <pre>
blocks. */
pre code, pre kbd, pre samp { font-size: 100%; }
/* Used to denote text that shouldn't be selectable, such as line numbers or
shell prompts. Guess which browser this doesn't work in. */
.noselect {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-o-user-select: none;
user-select: none;
}
/* -- Lists ----------------------------------------------------------------- */
dd { margin: 0.2em 0 0.7em 1em; }
dl { margin: 1em 0; }
dt { font-weight: bold; }
/* -- Tables ---------------------------------------------------------------- */
caption, th { text-align: left; }
table {
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #fff;
padding: 5px 12px;
vertical-align: top;
}
td { background: #E6E9F5; }
td dl { margin: 0; }
td dl dl { margin: 1em 0; }
td pre:first-child { margin-top: 0; }
th {
background: #D2D7E6;/*#97A0BF*/
border-bottom: none;
border-top: none;
color: #000;/*#FFF1D5*/
font-family: 'Trebuchet MS', sans-serif;
font-weight: bold;
line-height: 1.3;
white-space: nowrap;
}
/* -- Layout and Content ---------------------------------------------------- */
#doc {
margin: auto;
min-width: 1024px;
}
.content { padding: 0 20px 0 25px; }
.sidebar {
padding: 0 15px 0 10px;
}
#bd {
padding: 7px 0 130px;
position: relative;
width: 99%;
}
/* -- Table of Contents ----------------------------------------------------- */
/* The #toc id refers to the single global table of contents, while the .toc
class refers to generic TOC lists that could be used throughout the page. */
.toc code, .toc kbd, .toc samp { font-size: 100%; }
.toc li { font-weight: bold; }
.toc li li { font-weight: normal; }
/* -- Intro and Example Boxes ----------------------------------------------- */
/*
.intro, .example { margin-bottom: 2em; }
.example {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
-moz-box-shadow: 0 0 5px #bfbfbf;
-webkit-box-shadow: 0 0 5px #bfbfbf;
box-shadow: 0 0 5px #bfbfbf;
padding: 1em;
}
.intro {
background: none repeat scroll 0 0 #F0F1F8; border: 1px solid #D4D8EB; padding: 0 1em;
}
*/
/* -- Other Styles ---------------------------------------------------------- */
/* These are probably YUI-specific, and should be moved out of Selleck's default
theme. */
.button {
border: 1px solid #dadada;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
color: #444;
display: inline-block;
font-family: Helvetica, Arial, sans-serif;
font-size: 92.308%;
font-weight: bold;
padding: 4px 13px 3px;
-moz-text-shadow: 1px 1px 0 #fff;
-webkit-text-shadow: 1px 1px 0 #fff;
text-shadow: 1px 1px 0 #fff;
white-space: nowrap;
background: #EFEFEF; /* old browsers */
background: -moz-linear-gradient(top, #f5f5f5 0%, #efefef 50%, #e5e5e5 51%, #dfdfdf 100%); /* firefox */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f5f5f5), color-stop(50%,#efefef), color-stop(51%,#e5e5e5), color-stop(100%,#dfdfdf)); /* webkit */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#dfdfdf',GradientType=0 ); /* ie */
}
.button:hover {
border-color: #466899;
color: #fff;
text-decoration: none;
-moz-text-shadow: 1px 1px 0 #222;
-webkit-text-shadow: 1px 1px 0 #222;
text-shadow: 1px 1px 0 #222;
background: #6396D8; /* old browsers */
background: -moz-linear-gradient(top, #6396D8 0%, #5A83BC 50%, #547AB7 51%, #466899 100%); /* firefox */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6396D8), color-stop(50%,#5A83BC), color-stop(51%,#547AB7), color-stop(100%,#466899)); /* webkit */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6396D8', endColorstr='#466899',GradientType=0 ); /* ie */
}
.newwindow { text-align: center; }
.header .version em {
display: block;
text-align: right;
}
#classdocs .item {
border-bottom: 1px solid #466899;
margin: 1em 0;
padding: 1.5em;
}
#classdocs .item .params p,
#classdocs .item .returns p,{
display: inline;
}
#classdocs .item em code, #classdocs .item em.comment {
color: green;
}
#classdocs .item em.comment a {
color: green;
text-decoration: underline;
}
#classdocs .foundat {
font-size: 11px;
font-style: normal;
}
.attrs .emits {
margin-left: 2em;
padding: .5em;
border-left: 1px dashed #ccc;
}
abbr {
border-bottom: 1px dashed #ccc;
font-size: 80%;
cursor: help;
}
.prettyprint li.L0,
.prettyprint li.L1,
.prettyprint li.L2,
.prettyprint li.L3,
.prettyprint li.L5,
.prettyprint li.L6,
.prettyprint li.L7,
.prettyprint li.L8 {
list-style: decimal;
}
ul li p {
margin-top: 0;
}
.method .name {
font-size: 110%;
}
.apidocs .methods .extends .method,
.apidocs .properties .extends .property,
.apidocs .attrs .extends .attr,
.apidocs .events .extends .event {
font-weight: bold;
}
.apidocs .methods .extends .inherited,
.apidocs .properties .extends .inherited,
.apidocs .attrs .extends .inherited,
.apidocs .events .extends .inherited {
font-weight: normal;
}
#hd {
background: whiteSmoke;
background: -moz-linear-gradient(top,#DCDBD9 0,#F6F5F3 100%);
background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#DCDBD9),color-stop(100%,#F6F5F3));
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#dcdbd9',endColorstr='#F6F5F3',GradientType=0);
border-bottom: 1px solid #DFDFDF;
padding: 0 15px 1px 20px;
margin-bottom: 15px;
}
#hd img {
margin-right: 10px;
vertical-align: middle;
}
/* -- API Docs CSS ---------------------------------------------------------- */
/*
This file is organized so that more generic styles are nearer the top, and more
specific styles are nearer the bottom of the file. This allows us to take full
advantage of the cascade to avoid redundant style rules. Please respect this
convention when making changes.
*/
/* -- Generic TabView styles ------------------------------------------------ */
/*
These styles apply to all API doc tabviews. To change styles only for a
specific tabview, see the other sections below.
*/
.yui3-js-enabled .apidocs .tabview {
visibility: hidden; /* Hide until the TabView finishes rendering. */
_visibility: visible;
}
.apidocs .tabview.yui3-tabview-content { visibility: visible; }
.apidocs .tabview .yui3-tabview-panel { background: #fff; }
/* -- Generic Content Styles ------------------------------------------------ */
/* Headings */
h2, h3, h4, h5, h6 {
border: none;
color: #30418C;
font-weight: bold;
text-decoration: none;
}
.link-docs {
float: right;
font-size: 15px;
margin: 4px 4px 6px;
padding: 6px 30px 5px;
}
.apidocs { zoom: 1; }
/* Generic box styles. */
.apidocs .box {
border: 1px solid;
border-radius: 3px;
margin: 1em 0;
padding: 0 1em;
}
/* A flag is a compact, capsule-like indicator of some kind. It's used to
indicate private and protected items, item return types, etc. in an
attractive and unobtrusive way. */
.apidocs .flag {
background: #bababa;
border-radius: 3px;
color: #fff;
font-size: 11px;
margin: 0 0.5em;
padding: 2px 4px 1px;
}
/* Class/module metadata such as "Uses", "Extends", "Defined in", etc. */
.apidocs .meta {
background: #f9f9f9;
border-color: #efefef;
color: #555;
font-size: 11px;
padding: 3px 6px;
}
.apidocs .meta p { margin: 0; }
/* Deprecation warning. */
.apidocs .box.deprecated,
.apidocs .flag.deprecated {
background: #fdac9f;
border: 1px solid #fd7775;
}
.apidocs .box.deprecated p { margin: 0.5em 0; }
.apidocs .flag.deprecated { color: #333; }
/* Module/Class intro description. */
.apidocs .intro {
background: #f0f1f8;
border-color: #d4d8eb;
}
/* Loading spinners. */
#bd.loading .apidocs,
#api-list.loading .yui3-tabview-panel {
background: #fff url(../img/spinner.gif) no-repeat center 70px;
min-height: 150px;
}
#bd.loading .apidocs .content,
#api-list.loading .yui3-tabview-panel .apis {
display: none;
}
.apidocs .no-visible-items { color: #666; }
/* Generic inline list. */
.apidocs ul.inline {
display: inline;
list-style: none;
margin: 0;
padding: 0;
}
.apidocs ul.inline li { display: inline; }
/* Comma-separated list. */
.apidocs ul.commas li:after { content: ','; }
.apidocs ul.commas li:last-child:after { content: ''; }
/* Keyboard shortcuts. */
kbd .cmd { font-family: Monaco, Helvetica; }
/* -- Generic Access Level styles ------------------------------------------- */
.apidocs .item.protected,
.apidocs .item.private,
.apidocs .index-item.protected,
.apidocs .index-item.deprecated,
.apidocs .index-item.private {
display: none;
}
.show-deprecated .item.deprecated,
.show-deprecated .index-item.deprecated,
.show-protected .item.protected,
.show-protected .index-item.protected,
.show-private .item.private,
.show-private .index-item.private {
display: block;
}
.hide-inherited .item.inherited,
.hide-inherited .index-item.inherited {
display: none;
}
/* -- Generic Item Index styles --------------------------------------------- */
.apidocs .index { margin: 1.5em 0 3em; }
.apidocs .index h3 {
border-bottom: 1px solid #efefef;
color: #333;
font-size: 13px;
margin: 2em 0 0.6em;
padding-bottom: 2px;
}
.apidocs .index .no-visible-items { margin-top: 2em; }
.apidocs .index-list {
border-color: #efefef;
font-size: 12px;
list-style: none;
margin: 0;
padding: 0;
-moz-column-count: 4;
-moz-column-gap: 10px;
-moz-column-width: 170px;
-ms-column-count: 4;
-ms-column-gap: 10px;
-ms-column-width: 170px;
-o-column-count: 4;
-o-column-gap: 10px;
-o-column-width: 170px;
-webkit-column-count: 4;
-webkit-column-gap: 10px;
-webkit-column-width: 170px;
column-count: 4;
column-gap: 10px;
column-width: 170px;
}
.apidocs .no-columns .index-list {
-moz-column-count: 1;
-ms-column-count: 1;
-o-column-count: 1;
-webkit-column-count: 1;
column-count: 1;
}
.apidocs .index-item { white-space: nowrap; }
.apidocs .index-item .flag {
background: none;
border: none;
color: #afafaf;
display: inline;
margin: 0 0 0 0.2em;
padding: 0;
}
/* -- Generic API item styles ----------------------------------------------- */
.apidocs .args {
display: inline;
margin: 0 0.5em;
}
.apidocs .flag.chainable { background: #46ca3b; }
.apidocs .flag.protected { background: #9b86fc; }
.apidocs .flag.private { background: #fd6b1b; }
.apidocs .flag.async { background: #356de4; }
.apidocs .flag.required { background: #e60923; }
.apidocs .item {
border-bottom: 1px solid #efefef;
margin: 1.5em 0 2em;
padding-bottom: 2em;
}
.apidocs .item h4,
.apidocs .item h5,
.apidocs .item h6 {
color: #333;
font-family: inherit;
font-size: 100%;
}
.apidocs .item .description p,
.apidocs .item pre.code {
margin: 1em 0 0;
}
.apidocs .item .meta {
background: none;
border: none;
padding: 0;
}
.apidocs .item .name {
display: inline;
font-size: 14px;
}
.apidocs .item .type,
.apidocs .item .type a,
.apidocs .returns-inline {
color: #555;
}
.apidocs .item .type,
.apidocs .returns-inline {
font-size: 11px;
margin: 0 0 0 0;
}
.apidocs .item .type a { border-bottom: 1px dotted #afafaf; }
.apidocs .item .type a:hover { border: none; }
/* -- Item Parameter List --------------------------------------------------- */
.apidocs .params-list {
list-style: square;
margin: 1em 0 0 2em;
padding: 0;
}
.apidocs .param { margin-bottom: 1em; }
.apidocs .param .type,
.apidocs .param .type a {
color: #666;
}
.apidocs .param .type {
margin: 0 0 0 0.5em;
*margin-left: 0.5em;
}
.apidocs .param-name { font-weight: bold; }
/* -- Item "Emits" block ---------------------------------------------------- */
.apidocs .item .emits {
background: #f9f9f9;
border-color: #eaeaea;
}
/* -- Item "Returns" block -------------------------------------------------- */
.apidocs .item .returns .type,
.apidocs .item .returns .type a {
font-size: 100%;
margin: 0;
}
/* -- Class Constructor block ----------------------------------------------- */
.apidocs .constructor .item {
border: none;
padding-bottom: 0;
}
/* -- File Source View ------------------------------------------------------ */
.apidocs .file pre.code,
#doc .apidocs .file pre.prettyprint {
background: inherit;
border: none;
overflow: visible;
padding: 0;
}
.apidocs .L0,
.apidocs .L1,
.apidocs .L2,
.apidocs .L3,
.apidocs .L4,
.apidocs .L5,
.apidocs .L6,
.apidocs .L7,
.apidocs .L8,
.apidocs .L9 {
background: inherit;
}
/* -- Submodule List -------------------------------------------------------- */
.apidocs .module-submodule-description {
font-size: 12px;
margin: 0.3em 0 1em;
}
.apidocs .module-submodule-description p:first-child { margin-top: 0; }
/* -- Sidebar TabView ------------------------------------------------------- */
#api-tabview { margin-top: 0.6em; }
#api-tabview-filter,
#api-tabview-panel {
border: 1px solid #dfdfdf;
}
#api-tabview-filter {
border-bottom: none;
border-top: none;
padding: 0.6em 10px 0 10px;
}
#api-tabview-panel { border-top: none; }
#api-filter { width: 97%; }
/* -- Content TabView ------------------------------------------------------- */
#classdocs .yui3-tabview-panel { border: none; }
/* -- Source File Contents -------------------------------------------------- */
.prettyprint li.L0,
.prettyprint li.L1,
.prettyprint li.L2,
.prettyprint li.L3,
.prettyprint li.L5,
.prettyprint li.L6,
.prettyprint li.L7,
.prettyprint li.L8 {
list-style: decimal;
}
/* -- API options ----------------------------------------------------------- */
#api-options {
font-size: 11px;
margin-top: 2.2em;
position: absolute;
right: 1.5em;
}
/*#api-options label { margin-right: 0.6em; }*/
/* -- API list -------------------------------------------------------------- */
#api-list {
margin-top: 1.5em;
*zoom: 1;
}
.apis {
font-size: 12px;
line-height: 1.4;
list-style: none;
margin: 0;
padding: 0.5em 0 0.5em 0.4em;
}
.apis a {
border: 1px solid transparent;
display: block;
margin: 0 0 0 -4px;
padding: 1px 4px 0;
text-decoration: none;
_border: none;
_display: inline;
}
.apis a:hover,
.apis a:focus {
background: #E8EDFC;
background: -moz-linear-gradient(top, #e8edfc 0%, #becef7 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#E8EDFC), color-stop(100%,#BECEF7));
border-color: #AAC0FA;
border-radius: 3px;
color: #333;
outline: none;
}
.api-list-item a:hover,
.api-list-item a:focus {
font-weight: bold;
text-shadow: 1px 1px 1px #fff;
}
.apis .message { color: #888; }
.apis .result a { padding: 3px 5px 2px; }
.apis .result .type {
right: 4px;
top: 7px;
}
.api-list-item .yui3-highlight {
font-weight: bold;
}

BIN
docs/assets/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

BIN
docs/assets/img/spinner.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

10
docs/assets/index.html Normal file
View File

@@ -0,0 +1,10 @@
<!doctype html>
<html>
<head>
<title>Redirector</title>
<meta http-equiv="refresh" content="0;url=../">
</head>
<body>
<a href="../">Click here to redirect</a>
</body>
</html>

View File

@@ -0,0 +1,52 @@
YUI.add('api-filter', function (Y) {
Y.APIFilter = Y.Base.create('apiFilter', Y.Base, [Y.AutoCompleteBase], {
// -- Initializer ----------------------------------------------------------
initializer: function () {
this._bindUIACBase();
this._syncUIACBase();
},
getDisplayName: function(name) {
Y.each(Y.YUIDoc.meta.allModules, function(i) {
if (i.name === name && i.displayName) {
name = i.displayName;
}
});
return name;
}
}, {
// -- Attributes -----------------------------------------------------------
ATTRS: {
resultHighlighter: {
value: 'phraseMatch'
},
// May be set to "classes" or "modules".
queryType: {
value: 'classes'
},
source: {
valueFn: function() {
var self = this;
return function(q) {
var data = Y.YUIDoc.meta[self.get('queryType')],
out = [];
Y.each(data, function(v) {
if (v.toLowerCase().indexOf(q.toLowerCase()) > -1) {
out.push(v);
}
});
return out;
};
}
}
}
});
}, '3.4.0', {requires: [
'autocomplete-base', 'autocomplete-highlighters', 'autocomplete-sources'
]});

251
docs/assets/js/api-list.js Normal file
View File

@@ -0,0 +1,251 @@
YUI.add('api-list', function (Y) {
var Lang = Y.Lang,
YArray = Y.Array,
APIList = Y.namespace('APIList'),
classesNode = Y.one('#api-classes'),
inputNode = Y.one('#api-filter'),
modulesNode = Y.one('#api-modules'),
tabviewNode = Y.one('#api-tabview'),
tabs = APIList.tabs = {},
filter = APIList.filter = new Y.APIFilter({
inputNode : inputNode,
maxResults: 1000,
on: {
results: onFilterResults
}
}),
search = APIList.search = new Y.APISearch({
inputNode : inputNode,
maxResults: 100,
on: {
clear : onSearchClear,
results: onSearchResults
}
}),
tabview = APIList.tabview = new Y.TabView({
srcNode : tabviewNode,
panelNode: '#api-tabview-panel',
render : true,
on: {
selectionChange: onTabSelectionChange
}
}),
focusManager = APIList.focusManager = tabviewNode.plug(Y.Plugin.NodeFocusManager, {
circular : true,
descendants: '#api-filter, .yui3-tab-panel-selected .api-list-item a, .yui3-tab-panel-selected .result a',
keys : {next: 'down:40', previous: 'down:38'}
}).focusManager,
LIST_ITEM_TEMPLATE =
'<li class="api-list-item {typeSingular}">' +
'<a href="{rootPath}{typePlural}/{name}.html">{displayName}</a>' +
'</li>';
// -- Init ---------------------------------------------------------------------
// Duckpunch FocusManager's key event handling to prevent it from handling key
// events when a modifier is pressed.
Y.before(function (e, activeDescendant) {
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
return new Y.Do.Prevent();
}
}, focusManager, '_focusPrevious', focusManager);
Y.before(function (e, activeDescendant) {
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
return new Y.Do.Prevent();
}
}, focusManager, '_focusNext', focusManager);
// Create a mapping of tabs in the tabview so we can refer to them easily later.
tabview.each(function (tab, index) {
var name = tab.get('label').toLowerCase();
tabs[name] = {
index: index,
name : name,
tab : tab
};
});
// Switch tabs on Ctrl/Cmd-Left/Right arrows.
tabviewNode.on('key', onTabSwitchKey, 'down:37,39');
// Focus the filter input when the `/` key is pressed.
Y.one(Y.config.doc).on('key', onSearchKey, 'down:83');
// Keep the Focus Manager up to date.
inputNode.on('focus', function () {
focusManager.set('activeDescendant', inputNode);
});
// Update all tabview links to resolved URLs.
tabview.get('panelNode').all('a').each(function (link) {
link.setAttribute('href', link.get('href'));
});
// -- Private Functions --------------------------------------------------------
function getFilterResultNode() {
return filter.get('queryType') === 'classes' ? classesNode : modulesNode;
}
// -- Event Handlers -----------------------------------------------------------
function onFilterResults(e) {
var frag = Y.one(Y.config.doc.createDocumentFragment()),
resultNode = getFilterResultNode(),
typePlural = filter.get('queryType'),
typeSingular = typePlural === 'classes' ? 'class' : 'module';
if (e.results.length) {
YArray.each(e.results, function (result) {
frag.append(Lang.sub(LIST_ITEM_TEMPLATE, {
rootPath : APIList.rootPath,
displayName : filter.getDisplayName(result.highlighted),
name : result.text,
typePlural : typePlural,
typeSingular: typeSingular
}));
});
} else {
frag.append(
'<li class="message">' +
'No ' + typePlural + ' found.' +
'</li>'
);
}
resultNode.empty(true);
resultNode.append(frag);
focusManager.refresh();
}
function onSearchClear(e) {
focusManager.refresh();
}
function onSearchKey(e) {
var target = e.target;
if (target.test('input,select,textarea')
|| target.get('isContentEditable')) {
return;
}
e.preventDefault();
inputNode.focus();
focusManager.refresh();
}
function onSearchResults(e) {
var frag = Y.one(Y.config.doc.createDocumentFragment());
if (e.results.length) {
YArray.each(e.results, function (result) {
frag.append(result.display);
});
} else {
frag.append(
'<li class="message">' +
'No results found. Maybe you\'ll have better luck with a ' +
'different query?' +
'</li>'
);
}
focusManager.refresh();
}
function onTabSelectionChange(e) {
var tab = e.newVal,
name = tab.get('label').toLowerCase();
tabs.selected = {
index: tab.get('index'),
name : name,
tab : tab
};
switch (name) {
case 'classes': // fallthru
case 'modules':
filter.setAttrs({
minQueryLength: 0,
queryType : name
});
search.set('minQueryLength', -1);
// Only send a request if this isn't the initially-selected tab.
if (e.prevVal) {
filter.sendRequest(filter.get('value'));
}
break;
case 'everything':
filter.set('minQueryLength', -1);
search.set('minQueryLength', 1);
if (search.get('value')) {
search.sendRequest(search.get('value'));
} else {
inputNode.focus();
}
break;
default:
// WTF? We shouldn't be here!
filter.set('minQueryLength', -1);
search.set('minQueryLength', -1);
}
if (focusManager) {
setTimeout(function () {
focusManager.refresh();
}, 1);
}
}
function onTabSwitchKey(e) {
var currentTabIndex = tabs.selected.index;
if (!(e.ctrlKey || e.metaKey)) {
return;
}
e.preventDefault();
switch (e.keyCode) {
case 37: // left arrow
if (currentTabIndex > 0) {
tabview.selectChild(currentTabIndex - 1);
inputNode.focus();
}
break;
case 39: // right arrow
if (currentTabIndex < (Y.Object.size(tabs) - 2)) {
tabview.selectChild(currentTabIndex + 1);
inputNode.focus();
}
break;
}
}
}, '3.4.0', {requires: [
'api-filter', 'api-search', 'event-key', 'node-focusmanager', 'tabview'
]});

View File

@@ -0,0 +1,98 @@
YUI.add('api-search', function (Y) {
var Lang = Y.Lang,
Node = Y.Node,
YArray = Y.Array;
Y.APISearch = Y.Base.create('apiSearch', Y.Base, [Y.AutoCompleteBase], {
// -- Public Properties ----------------------------------------------------
RESULT_TEMPLATE:
'<li class="result {resultType}">' +
'<a href="{url}">' +
'<h3 class="title">{name}</h3>' +
'<span class="type">{resultType}</span>' +
'<div class="description">{description}</div>' +
'<span class="className">{class}</span>' +
'</a>' +
'</li>',
// -- Initializer ----------------------------------------------------------
initializer: function () {
this._bindUIACBase();
this._syncUIACBase();
},
// -- Protected Methods ----------------------------------------------------
_apiResultFilter: function (query, results) {
// Filter components out of the results.
return YArray.filter(results, function (result) {
return result.raw.resultType === 'component' ? false : result;
});
},
_apiResultFormatter: function (query, results) {
return YArray.map(results, function (result) {
var raw = Y.merge(result.raw), // create a copy
desc = raw.description || '';
// Convert description to text and truncate it if necessary.
desc = Node.create('<div>' + desc + '</div>').get('text');
if (desc.length > 65) {
desc = Y.Escape.html(desc.substr(0, 65)) + ' &hellip;';
} else {
desc = Y.Escape.html(desc);
}
raw['class'] || (raw['class'] = '');
raw.description = desc;
// Use the highlighted result name.
raw.name = result.highlighted;
return Lang.sub(this.RESULT_TEMPLATE, raw);
}, this);
},
_apiTextLocator: function (result) {
return result.displayName || result.name;
}
}, {
// -- Attributes -----------------------------------------------------------
ATTRS: {
resultFormatter: {
valueFn: function () {
return this._apiResultFormatter;
}
},
resultFilters: {
valueFn: function () {
return this._apiResultFilter;
}
},
resultHighlighter: {
value: 'phraseMatch'
},
resultListLocator: {
value: 'data.results'
},
resultTextLocator: {
valueFn: function () {
return this._apiTextLocator;
}
},
source: {
value: '/api/v1/search?q={query}&count={maxResults}'
}
}
});
}, '3.4.0', {requires: [
'autocomplete-base', 'autocomplete-highlighters', 'autocomplete-sources',
'escape'
]});

351
docs/assets/js/apidocs.js Normal file
View File

@@ -0,0 +1,351 @@
YUI().use(
'yuidoc-meta',
'api-list', 'history-hash', 'node-screen', 'node-style', 'pjax',
function (Y) {
var win = Y.config.win,
localStorage = win.localStorage,
bdNode = Y.one('#bd'),
pjax,
classTabView,
selectedTab;
// Kill pjax functionality unless serving over HTTP.
if (!Y.getLocation().protocol.match(/^https?\:/)) {
Y.Router.html5 = false;
}
pjax = new Y.Pjax({
container : '#docs-main',
contentSelector: '#docs-main > .content',
linkSelector : '#bd a',
titleSelector : '#xhr-title',
navigateOnHash: true,
root : '/',
routes : [
// -- / ----------------------------------------------------------------
{path: '/(index.html)?', callback: '_defaultRoute'},
// -- /classes/* -------------------------------------------------------
{path: '/classes/:class.html*', callback: 'handleClasses'},
{path: '/classes/:class.html*', callback: '_defaultRoute'},
// -- /files/* ---------------------------------------------------------
{path: '/files/*file', callback: 'handleFiles'},
{path: '/files/*file', callback: '_defaultRoute'},
// -- /modules/* -------------------------------------------------------
{path: '/modules/:module.html*', callback: '_defaultRoute'}
]
});
// -- Utility Functions --------------------------------------------------------
pjax.checkVisibility = function (tab) {
tab || (tab = selectedTab);
if (!tab) { return; }
var panelNode = tab.get('panelNode'),
visibleItems;
// If no items are visible in the tab panel due to the current visibility
// settings, display a message to that effect.
visibleItems = panelNode.all('.item,.index-item').some(function (itemNode) {
if (itemNode.getComputedStyle('display') !== 'none') {
return true;
}
});
panelNode.all('.no-visible-items').remove();
if (!visibleItems) {
if (Y.one('#index .index-item')) {
panelNode.append(
'<div class="no-visible-items">' +
'<p>' +
'Some items are not shown due to the current visibility ' +
'settings. Use the checkboxes at the upper right of this ' +
'page to change the visibility settings.' +
'</p>' +
'</div>'
);
} else {
panelNode.append(
'<div class="no-visible-items">' +
'<p>' +
'This class doesn\'t provide any methods, properties, ' +
'attributes, or events.' +
'</p>' +
'</div>'
);
}
}
// Hide index sections without any visible items.
Y.all('.index-section').each(function (section) {
var items = 0,
visibleItems = 0;
section.all('.index-item').each(function (itemNode) {
items += 1;
if (itemNode.getComputedStyle('display') !== 'none') {
visibleItems += 1;
}
});
section.toggleClass('hidden', !visibleItems);
section.toggleClass('no-columns', visibleItems < 4);
});
};
pjax.initClassTabView = function () {
if (!Y.all('#classdocs .api-class-tab').size()) {
return;
}
if (classTabView) {
classTabView.destroy();
selectedTab = null;
}
classTabView = new Y.TabView({
srcNode: '#classdocs',
on: {
selectionChange: pjax.onTabSelectionChange
}
});
pjax.updateTabState();
classTabView.render();
};
pjax.initLineNumbers = function () {
var hash = win.location.hash.substring(1),
container = pjax.get('container'),
hasLines, node;
// Add ids for each line number in the file source view.
container.all('.linenums>li').each(function (lineNode, index) {
lineNode.set('id', 'l' + (index + 1));
lineNode.addClass('file-line');
hasLines = true;
});
// Scroll to the desired line.
if (hasLines && /^l\d+$/.test(hash)) {
if ((node = container.getById(hash))) {
win.scroll(0, node.getY());
}
}
};
pjax.initRoot = function () {
var terminators = /^(?:classes|files|modules)$/,
parts = pjax._getRoot().split('/'),
root = [],
i, len, part;
for (i = 0, len = parts.length; i < len; i += 1) {
part = parts[i];
if (part.match(terminators)) {
// Makes sure the path will end with a "/".
root.push('');
break;
}
root.push(part);
}
pjax.set('root', root.join('/'));
};
pjax.updateTabState = function (src) {
var hash = win.location.hash.substring(1),
defaultTab, node, tab, tabPanel;
function scrollToNode() {
if (node.hasClass('protected')) {
Y.one('#api-show-protected').set('checked', true);
pjax.updateVisibility();
}
if (node.hasClass('private')) {
Y.one('#api-show-private').set('checked', true);
pjax.updateVisibility();
}
setTimeout(function () {
// For some reason, unless we re-get the node instance here,
// getY() always returns 0.
var node = Y.one('#classdocs').getById(hash);
win.scrollTo(0, node.getY() - 70);
}, 1);
}
if (!classTabView) {
return;
}
if (src === 'hashchange' && !hash) {
defaultTab = 'index';
} else {
if (localStorage) {
defaultTab = localStorage.getItem('tab_' + pjax.getPath()) ||
'index';
} else {
defaultTab = 'index';
}
}
if (hash && (node = Y.one('#classdocs').getById(hash))) {
if ((tabPanel = node.ancestor('.api-class-tabpanel', true))) {
if ((tab = Y.one('#classdocs .api-class-tab.' + tabPanel.get('id')))) {
if (classTabView.get('rendered')) {
Y.Widget.getByNode(tab).set('selected', 1);
} else {
tab.addClass('yui3-tab-selected');
}
}
}
// Scroll to the desired element if this is a hash URL.
if (node) {
if (classTabView.get('rendered')) {
scrollToNode();
} else {
classTabView.once('renderedChange', scrollToNode);
}
}
} else {
tab = Y.one('#classdocs .api-class-tab.' + defaultTab);
if (classTabView.get('rendered')) {
Y.Widget.getByNode(tab).set('selected', 1);
} else {
tab.addClass('yui3-tab-selected');
}
}
};
pjax.updateVisibility = function () {
var container = pjax.get('container');
container.toggleClass('hide-inherited',
!Y.one('#api-show-inherited').get('checked'));
container.toggleClass('show-deprecated',
Y.one('#api-show-deprecated').get('checked'));
container.toggleClass('show-protected',
Y.one('#api-show-protected').get('checked'));
container.toggleClass('show-private',
Y.one('#api-show-private').get('checked'));
pjax.checkVisibility();
};
// -- Route Handlers -----------------------------------------------------------
pjax.handleClasses = function (req, res, next) {
pjax.onceAfter(['error', 'load'], function (e) {
if (e.type === 'pjax:load') {
pjax.initClassTabView();
}
});
next();
};
pjax.handleFiles = function (req, res, next) {
pjax.onceAfter(['error', 'load'], function (e) {
if (e.type === 'pjax:load') {
pjax.initLineNumbers();
}
});
next();
};
// -- Event Handlers -----------------------------------------------------------
pjax.afterContent = function (e) {
// Enable syntax highlighting on the loaded content.
prettyPrint();
bdNode.removeClass('loading');
};
pjax.onNavigate = function (e) {
var hash = e.hash,
originTarget = e.originEvent && e.originEvent.target,
tab;
if (hash) {
tab = originTarget && originTarget.ancestor('.yui3-tab', true);
if (hash === win.location.hash) {
pjax.updateTabState('hashchange');
} else if (!tab) {
win.location.hash = hash;
}
e.preventDefault();
return;
}
// Only scroll to the top of the page when the URL doesn't have a hash.
this.set('scrollToTop', !e.url.match(/#.+$/));
bdNode.addClass('loading');
};
pjax.onOptionClick = function (e) {
pjax.updateVisibility();
};
pjax.onTabSelectionChange = function (e) {
var tab = e.newVal,
tabId = tab.get('contentBox').getAttribute('href').substring(1);
selectedTab = tab;
// If switching from a previous tab (i.e., this is not the default tab),
// replace the history entry with a hash URL that will cause this tab to
// be selected if the user navigates away and then returns using the back
// or forward buttons.
if (e.prevVal && localStorage) {
localStorage.setItem('tab_' + pjax.getPath(), tabId);
}
pjax.checkVisibility(tab);
};
// -- Init ---------------------------------------------------------------------
pjax.on('navigate', pjax.onNavigate);
pjax.after(['error', 'load'], pjax.afterContent);
pjax.initRoot();
pjax.initClassTabView();
pjax.initLineNumbers();
pjax.updateVisibility();
pjax.upgrade();
Y.APIList.rootPath = pjax.get('root');
Y.one('#api-options').delegate('click', pjax.onOptionClick, 'input');
Y.on('hashchange', function (e) {
pjax.updateTabState('hashchange');
}, win);
});

17
docs/assets/js/yui-prettify.js vendored Normal file
View File

@@ -0,0 +1,17 @@
YUI().use('node', function(Y) {
var code = Y.all('.prettyprint.linenums');
if (code.size()) {
code.each(function(c) {
var lis = c.all('ol li'),
l = 1;
lis.each(function(n) {
n.prepend('<a name="LINENUM_' + l + '"></a>');
l++;
});
});
var h = location.hash;
location.hash = '';
h = h.replace('LINE_', 'LINENUM_');
location.hash = h;
}
});

130
docs/assets/vendor/prettify/CHANGES.html vendored Normal file
View File

@@ -0,0 +1,130 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Change Log</title>
</head>
<body bgcolor="white">
<a style="float:right" href="README.html">README</a>
<h1>Known Issues</h1>
<ul>
<li>Perl formatting is really crappy. Partly because the author is lazy and
partly because Perl is
<a href="http://www.perlmonks.org/?node_id=663393">hard</a> to parse.
<li>On some browsers, <code>&lt;code&gt;</code> elements with newlines in the text
which use CSS to specify <code>white-space:pre</code> will have the newlines
improperly stripped if the element is not attached to the document at the time
the stripping is done. Also, on IE 6, all newlines will be stripped from
<code>&lt;code&gt;</code> elements because of the way IE6 produces
<code>innerHTML</code>. Workaround: use <code>&lt;pre&gt;</code> for code with
newlines.
</ul>
<h1>Change Log</h1>
<h2>29 March 2007</h2>
<ul>
<li>Added <a href="tests/prettify_test.html#PHP">tests</a> for PHP support
to address
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=3"
>issue 3</a>.
<li>Fixed
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=6"
>bug</a>: <code>prettyPrintOne</code> was not halting. This was not
reachable through the normal entry point.
<li>Fixed
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=4"
>bug</a>: recursing into a script block or PHP tag that was not properly
closed would not silently drop the content.
(<a href="tests/prettify_test.html#issue4">test</a>)
<li>Fixed
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=8"
>bug</a>: was eating tabs
(<a href="tests/prettify_test.html#issue8">test</a>)
<li>Fixed entity handling so that the caveat
<blockquote>
<p>Caveats: please properly escape less-thans. <tt>x&amp;lt;y</tt>
instead of <tt>x&lt;y</tt>, and use <tt>&quot;</tt> instead of
<tt>&amp;quot;</tt> for string delimiters.</p>
</blockquote>
is no longer applicable.
<li>Added noisefree's C#
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=4"
>patch</a>
<li>Added a <a href="http://google-code-prettify.googlecode.com/files/prettify-small.zip">distribution</a> that has comments and
whitespace removed to reduce download size from 45.5kB to 12.8kB.
</ul>
<h2>4 Jul 2008</h2>
<ul>
<li>Added <a href="http://code.google.com/p/google-code-prettify/issues/detail?id=17">language specific formatters</a> that are triggered by the presence
of a <code>lang-&lt;language-file-extension&gt;</code></li>
<li>Fixed <a href="http://code.google.com/p/google-code-prettify/issues/detail?id=29">bug</a>: python handling of <code>'''string'''</code>
<li>Fixed bug: <code>/</code> in regex <code>[charsets] should not end regex</code>
</ul>
<h2>5 Jul 2008</h2>
<ul>
<li>Defined language extensions for Lisp and Lua</code>
</ul>
<h2>14 Jul 2008</h2>
<ul>
<li>Language handlers for F#, OCAML, SQL</code>
<li>Support for <code>nocode</code> spans to allow embedding of line
numbers and code annotations which should not be styled or otherwise
affect the tokenization of prettified code.
See the issue 22
<a href="tests/prettify_test.html#issue22">testcase</a>.</code>
</ul>
<h2>6 Jan 2009</h2>
<ul>
<li>Language handlers for Visual Basic, Haskell, CSS, and WikiText</li>
<li>Added <tt>.mxml</tt> extension to the markup style handler for
Flex <a href="http://en.wikipedia.org/wiki/MXML">MXML files</a>. See
<a
href="http://code.google.com/p/google-code-prettify/issues/detail?id=37"
>issue 37</a>.
<li>Added <tt>.m</tt> extension to the C style handler so that Objective
C source files properly highlight. See
<a
href="http://code.google.com/p/google-code-prettify/issues/detail?id=58"
>issue 58</a>.
<li>Changed HTML lexer to use the same embedded source mechanism as the
wiki language handler, and changed to use the registered
CSS handler for STYLE element content.
</ul>
<h2>21 May 2009</h2>
<ul>
<li>Rewrote to improve performance on large files.
See <a href="http://mikesamuel.blogspot.com/2009/05/efficient-parsing-in-javascript.html">benchmarks</a>.</li>
<li>Fixed bugs with highlighting of Haskell line comments, Lisp
number literals, Lua strings, C preprocessor directives,
newlines in Wiki code on Windows, and newlines in IE6.</li>
</ul>
<h2>14 August 2009</h2>
<ul>
<li>Fixed prettifying of <code>&lt;code&gt;</code> blocks with embedded newlines.
</ul>
<h2>3 October 2009</h2>
<ul>
<li>Fixed prettifying of XML/HTML tags that contain uppercase letters.
</ul>
<h2>19 July 2010</h2>
<ul>
<li>Added support for line numbers. Bug
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=22"
>22</a></li>
<li>Added YAML support. Bug
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=123"
>123</a></li>
<li>Added VHDL support courtesy Le Poussin.</li>
<li>IE performance improvements. Bug
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=102"
>102</a> courtesy jacobly.</li>
<li>A variety of markup formatting fixes courtesy smain and thezbyg.</li>
<li>Fixed copy and paste in IE[678].
<li>Changed output to use <code>&amp;#160;</code> instead of
<code>&amp;nbsp;</code> so that the output works when embedded in XML.
Bug
<a href="http://code.google.com/p/google-code-prettify/issues/detail?id=108"
>108</a>.</li>
</ul>
</body>
</html>

202
docs/assets/vendor/prettify/COPYING vendored Normal file
View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.

203
docs/assets/vendor/prettify/README.html vendored Normal file
View File

@@ -0,0 +1,203 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Javascript code prettifier</title>
<link href="src/prettify.css" type="text/css" rel="stylesheet" />
<script src="src/prettify.js" type="text/javascript"></script>
<style type="text/css">
body { margin-left: .5in }
h1, h2, h3, h4, .footer { margin-left: -.4in; }
</style>
</head>
<body onload="prettyPrint()" bgcolor="white">
<small style="float: right">Languages : <a href="README-zh-Hans.html">CH</a></small>
<h1>Javascript code prettifier</h1>
<h2>Setup</h2>
<ol>
<li><a href="http://code.google.com/p/google-code-prettify/downloads/list">Download</a> a distribution
<li>Include the script and stylesheets in your document
(you will need to make sure the css and js file are on your server, and
adjust the paths in the <tt>script</tt> and <tt>link</tt> tag)
<pre class="prettyprint">
&lt;link href="prettify.css" type="text/css" rel="stylesheet" />
&lt;script type="text/javascript" src="prettify.js">&lt;/script></pre>
<li>Add <code class="prettyprint lang-html">onload="prettyPrint()"</code> to your
document's body tag.
<li>Modify the stylesheet to get the coloring you prefer</li>
</ol>
<h2>Usage</h2>
<p>Put code snippets in
<tt>&lt;pre class="prettyprint"&gt;...&lt;/pre&gt;</tt>
or <tt>&lt;code class="prettyprint"&gt;...&lt;/code&gt;</tt>
and it will automatically be pretty printed.
<table summary="code examples">
<tr>
<th>The original
<th>Prettier
<tr>
<td><pre style="border: 1px solid #888;padding: 2px"
><a name="voila1"></a>class Voila {
public:
// Voila
static const string VOILA = "Voila";
// will not interfere with embedded <a href="#voila1">tags</a>.
}</pre>
<td><pre class="prettyprint"><a name="voila2"></a>class Voila {
public:
// Voila
static const string VOILA = "Voila";
// will not interfere with embedded <a href="#voila2">tags</a>.
}</pre>
</table>
<h2>FAQ</h2>
<h3 id="langs">Which languages does it work for?</h3>
<p>The comments in <tt>prettify.js</tt> are authoritative but the lexer
should work on a number of languages including C and friends,
Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles.
It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl
and Ruby, but, because of commenting conventions, doesn't work on
Smalltalk, or CAML-like languages.</p>
<p>LISPy languages are supported via an extension:
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-lisp.js"
><code>lang-lisp.js</code></a>.</p>
<p>And similarly for
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-css.js"
><code>CSS</code></a>,
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-hs.js"
><code>Haskell</code></a>,
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-lua.js"
><code>Lua</code></a>,
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-ml.js"
><code>OCAML, SML, F#</code></a>,
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-vb.js"
><code>Visual Basic</code></a>,
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-sql.js"
><code>SQL</code></a>,
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-proto.js"
><code>Protocol Buffers</code></a>, and
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-wiki.js"
><code>WikiText</code></a>..
<p>If you'd like to add an extension for your favorite language, please
look at <tt>src/lang-lisp.js</tt> and file an
<a href="http://code.google.com/p/google-code-prettify/issues/list"
>issue</a> including your language extension, and a testcase.</p>
<h3>How do I specify which language my code is in?</h3>
<p>You don't need to specify the language since <code>prettyprint()</code>
will guess. You can specify a language by specifying the language extension
along with the <code>prettyprint</code> class like so:</p>
<pre class="prettyprint lang-html"
>&lt;pre class=&quot;prettyprint <b>lang-html</b>&quot;&gt;
The lang-* class specifies the language file extensions.
File extensions supported by default include
"bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
"java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
"xhtml", "xml", "xsl".
&lt;/pre&gt;</pre>
<h3>It doesn't work on <tt>&lt;obfuscated code sample&gt;</tt>?</h3>
<p>Yes. Prettifying obfuscated code is like putting lipstick on a pig
&mdash; i.e. outside the scope of this tool.</p>
<h3>Which browsers does it work with?</h3>
<p>It's been tested with IE 6, Firefox 1.5 &amp; 2, and Safari 2.0.4.
Look at <a href="tests/prettify_test.html">the test page</a> to see if it
works in your browser.</p>
<h3>What's changed?</h3>
<p>See the <a href="CHANGES.html">change log</a></p>
<h3>Why doesn't Prettyprinting of strings work on WordPress?</h3>
<p>Apparently wordpress does "smart quoting" which changes close quotes.
This causes end quotes to not match up with open quotes.
<p>This breaks prettifying as well as copying and pasting of code samples.
See
<a href="http://wordpress.org/support/topic/125038"
>WordPress's help center</a> for info on how to stop smart quoting of code
snippets.</p>
<h3 id="linenums">How do I put line numbers in my code?</h3>
<p>You can use the <code>linenums</code> class to turn on line
numbering. If your code doesn't start at line number 1, you can
add a colon and a line number to the end of that class as in
<code>linenums:52</code>.
<p>For example
<pre class="prettyprint">&lt;pre class="prettyprint linenums:<b>4</b>"
&gt;// This is line 4.
foo();
bar();
baz();
boo();
far();
faz();
&lt;pre&gt;</pre>
produces
<pre class="prettyprint linenums:4"
>// This is line 4.
foo();
bar();
baz();
boo();
far();
faz();
</pre>
<h3>How do I prevent a portion of markup from being marked as code?</h3>
<p>You can use the <code>nocode</code> class to identify a span of markup
that is not code.
<pre class="prettyprint">&lt;pre class=prettyprint&gt;
int x = foo(); /* This is a comment &lt;span class="nocode"&gt;This is not code&lt;/span&gt;
Continuation of comment */
int y = bar();
&lt;/pre&gt;</pre>
produces
<pre class="prettyprint">
int x = foo(); /* This is a comment <span class="nocode">This is not code</span>
Continuation of comment */
int y = bar();
</pre>
<p>For a more complete example see the issue22
<a href="tests/prettify_test.html#issue22">testcase</a>.</p>
<h3>I get an error message "a is not a function" or "opt_whenDone is not a function"</h3>
<p>If you are calling <code>prettyPrint</code> via an event handler, wrap it in a function.
Instead of doing
<blockquote>
<code class="prettyprint lang-js"
>addEventListener('load', prettyPrint, false);</code>
</blockquote>
wrap it in a closure like
<blockquote>
<code class="prettyprint lang-js"
>addEventListener('load', function (event) { prettyPrint() }, false);</code>
</blockquote>
so that the browser does not pass an event object to <code>prettyPrint</code> which
will confuse it.
<br><br><br>
<div class="footer">
<!-- Created: Tue Oct 3 17:51:56 PDT 2006 -->
<!-- hhmts start -->
Last modified: Wed Jul 19 13:56:00 PST 2010
<!-- hhmts end -->
</div>
</body>
</html>

View File

@@ -0,0 +1 @@
.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun{color:#660}.pln{color:#000}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec{color:#606}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}@media print{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun{color:#440}.pln{color:#000}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}

View File

@@ -0,0 +1,35 @@
window.PR_SHOULD_USE_CONTINUATION=true;window.PR_TAB_WIDTH=8;window.PR_normalizedHtml=window.PR=window.prettyPrintOne=window.prettyPrint=void 0;window._pr_isIE6=function(){var y=navigator&&navigator.userAgent&&navigator.userAgent.match(/\bMSIE ([678])\./);y=y?+y[1]:false;window._pr_isIE6=function(){return y};return y};
(function(){function y(b){return b.replace(L,"&amp;").replace(M,"&lt;").replace(N,"&gt;")}function H(b,f,i){switch(b.nodeType){case 1:var o=b.tagName.toLowerCase();f.push("<",o);var l=b.attributes,n=l.length;if(n){if(i){for(var r=[],j=n;--j>=0;)r[j]=l[j];r.sort(function(q,m){return q.name<m.name?-1:q.name===m.name?0:1});l=r}for(j=0;j<n;++j){r=l[j];r.specified&&f.push(" ",r.name.toLowerCase(),'="',r.value.replace(L,"&amp;").replace(M,"&lt;").replace(N,"&gt;").replace(X,"&quot;"),'"')}}f.push(">");
for(l=b.firstChild;l;l=l.nextSibling)H(l,f,i);if(b.firstChild||!/^(?:br|link|img)$/.test(o))f.push("</",o,">");break;case 3:case 4:f.push(y(b.nodeValue));break}}function O(b){function f(c){if(c.charAt(0)!=="\\")return c.charCodeAt(0);switch(c.charAt(1)){case "b":return 8;case "t":return 9;case "n":return 10;case "v":return 11;case "f":return 12;case "r":return 13;case "u":case "x":return parseInt(c.substring(2),16)||c.charCodeAt(1);case "0":case "1":case "2":case "3":case "4":case "5":case "6":case "7":return parseInt(c.substring(1),
8);default:return c.charCodeAt(1)}}function i(c){if(c<32)return(c<16?"\\x0":"\\x")+c.toString(16);c=String.fromCharCode(c);if(c==="\\"||c==="-"||c==="["||c==="]")c="\\"+c;return c}function o(c){var d=c.substring(1,c.length-1).match(RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g"));c=[];for(var a=[],k=d[0]==="^",e=k?1:0,h=d.length;e<h;++e){var g=d[e];switch(g){case "\\B":case "\\b":case "\\D":case "\\d":case "\\S":case "\\s":case "\\W":case "\\w":c.push(g);
continue}g=f(g);var s;if(e+2<h&&"-"===d[e+1]){s=f(d[e+2]);e+=2}else s=g;a.push([g,s]);if(!(s<65||g>122)){s<65||g>90||a.push([Math.max(65,g)|32,Math.min(s,90)|32]);s<97||g>122||a.push([Math.max(97,g)&-33,Math.min(s,122)&-33])}}a.sort(function(v,w){return v[0]-w[0]||w[1]-v[1]});d=[];g=[NaN,NaN];for(e=0;e<a.length;++e){h=a[e];if(h[0]<=g[1]+1)g[1]=Math.max(g[1],h[1]);else d.push(g=h)}a=["["];k&&a.push("^");a.push.apply(a,c);for(e=0;e<d.length;++e){h=d[e];a.push(i(h[0]));if(h[1]>h[0]){h[1]+1>h[0]&&a.push("-");
a.push(i(h[1]))}}a.push("]");return a.join("")}function l(c){for(var d=c.source.match(RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),a=d.length,k=[],e=0,h=0;e<a;++e){var g=d[e];if(g==="(")++h;else if("\\"===g.charAt(0))if((g=+g.substring(1))&&g<=h)k[g]=-1}for(e=1;e<k.length;++e)if(-1===k[e])k[e]=++n;for(h=e=0;e<a;++e){g=d[e];if(g==="("){++h;if(k[h]===undefined)d[e]="(?:"}else if("\\"===
g.charAt(0))if((g=+g.substring(1))&&g<=h)d[e]="\\"+k[h]}for(h=e=0;e<a;++e)if("^"===d[e]&&"^"!==d[e+1])d[e]="";if(c.ignoreCase&&r)for(e=0;e<a;++e){g=d[e];c=g.charAt(0);if(g.length>=2&&c==="[")d[e]=o(g);else if(c!=="\\")d[e]=g.replace(/[a-zA-Z]/g,function(s){s=s.charCodeAt(0);return"["+String.fromCharCode(s&-33,s|32)+"]"})}return d.join("")}for(var n=0,r=false,j=false,q=0,m=b.length;q<m;++q){var t=b[q];if(t.ignoreCase)j=true;else if(/[a-z]/i.test(t.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,
""))){r=true;j=false;break}}var p=[];q=0;for(m=b.length;q<m;++q){t=b[q];if(t.global||t.multiline)throw Error(""+t);p.push("(?:"+l(t)+")")}return RegExp(p.join("|"),j?"gi":"g")}function Y(b){var f=0;return function(i){for(var o=null,l=0,n=0,r=i.length;n<r;++n)switch(i.charAt(n)){case "\t":o||(o=[]);o.push(i.substring(l,n));l=b-f%b;for(f+=l;l>=0;l-=16)o.push(" ".substring(0,l));l=n+1;break;case "\n":f=0;break;default:++f}if(!o)return i;o.push(i.substring(l));return o.join("")}}function I(b,
f,i,o){if(f){b={source:f,c:b};i(b);o.push.apply(o,b.d)}}function B(b,f){var i={},o;(function(){for(var r=b.concat(f),j=[],q={},m=0,t=r.length;m<t;++m){var p=r[m],c=p[3];if(c)for(var d=c.length;--d>=0;)i[c.charAt(d)]=p;p=p[1];c=""+p;if(!q.hasOwnProperty(c)){j.push(p);q[c]=null}}j.push(/[\0-\uffff]/);o=O(j)})();var l=f.length;function n(r){for(var j=r.c,q=[j,z],m=0,t=r.source.match(o)||[],p={},c=0,d=t.length;c<d;++c){var a=t[c],k=p[a],e=void 0,h;if(typeof k==="string")h=false;else{var g=i[a.charAt(0)];
if(g){e=a.match(g[1]);k=g[0]}else{for(h=0;h<l;++h){g=f[h];if(e=a.match(g[1])){k=g[0];break}}e||(k=z)}if((h=k.length>=5&&"lang-"===k.substring(0,5))&&!(e&&typeof e[1]==="string")){h=false;k=P}h||(p[a]=k)}g=m;m+=a.length;if(h){h=e[1];var s=a.indexOf(h),v=s+h.length;if(e[2]){v=a.length-e[2].length;s=v-h.length}k=k.substring(5);I(j+g,a.substring(0,s),n,q);I(j+g+s,h,Q(k,h),q);I(j+g+v,a.substring(v),n,q)}else q.push(j+g,k)}r.d=q}return n}function x(b){var f=[],i=[];if(b.tripleQuotedStrings)f.push([A,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,
null,"'\""]);else b.multiLineStrings?f.push([A,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):f.push([A,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]);b.verbatimStrings&&i.push([A,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);if(b.hashComments)if(b.cStyleComments){f.push([C,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]);i.push([A,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,
null])}else f.push([C,/^#[^\r\n]*/,null,"#"]);if(b.cStyleComments){i.push([C,/^\/\/[^\r\n]*/,null]);i.push([C,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}b.regexLiterals&&i.push(["lang-regex",RegExp("^"+Z+"(/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/)")]);b=b.keywords.replace(/^\s+|\s+$/g,"");b.length&&i.push([R,RegExp("^(?:"+b.replace(/\s+/g,"|")+")\\b"),null]);f.push([z,/^\s+/,null," \r\n\t\u00a0"]);i.push([J,/^@[a-z_$][a-z_$@0-9]*/i,null],[S,/^@?[A-Z]+[a-z][A-Za-z_$@0-9]*/,
null],[z,/^[a-z_$][a-z_$@0-9]*/i,null],[J,/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],[E,/^.[^\s\w\.$@\'\"\`\/\#]*/,null]);return B(f,i)}function $(b){function f(D){if(D>r){if(j&&j!==q){n.push("</span>");j=null}if(!j&&q){j=q;n.push('<span class="',j,'">')}var T=y(p(i.substring(r,D))).replace(e?d:c,"$1&#160;");e=k.test(T);n.push(T.replace(a,s));r=D}}var i=b.source,o=b.g,l=b.d,n=[],r=0,j=null,q=null,m=0,t=0,p=Y(window.PR_TAB_WIDTH),c=/([\r\n ]) /g,
d=/(^| ) /gm,a=/\r\n?|\n/g,k=/[ \r\n]$/,e=true,h=window._pr_isIE6();h=h?b.b.tagName==="PRE"?h===6?"&#160;\r\n":h===7?"&#160;<br>\r":"&#160;\r":"&#160;<br />":"<br />";var g=b.b.className.match(/\blinenums\b(?::(\d+))?/),s;if(g){for(var v=[],w=0;w<10;++w)v[w]=h+'</li><li class="L'+w+'">';var F=g[1]&&g[1].length?g[1]-1:0;n.push('<ol class="linenums"><li class="L',F%10,'"');F&&n.push(' value="',F+1,'"');n.push(">");s=function(){var D=v[++F%10];return j?"</span>"+D+'<span class="'+j+'">':D}}else s=h;
for(;;)if(m<o.length?t<l.length?o[m]<=l[t]:true:false){f(o[m]);if(j){n.push("</span>");j=null}n.push(o[m+1]);m+=2}else if(t<l.length){f(l[t]);q=l[t+1];t+=2}else break;f(i.length);j&&n.push("</span>");g&&n.push("</li></ol>");b.a=n.join("")}function u(b,f){for(var i=f.length;--i>=0;){var o=f[i];if(G.hasOwnProperty(o))"console"in window&&console.warn("cannot override language handler %s",o);else G[o]=b}}function Q(b,f){b&&G.hasOwnProperty(b)||(b=/^\s*</.test(f)?"default-markup":"default-code");return G[b]}
function U(b){var f=b.f,i=b.e;b.a=f;try{var o,l=f.match(aa);f=[];var n=0,r=[];if(l)for(var j=0,q=l.length;j<q;++j){var m=l[j];if(m.length>1&&m.charAt(0)==="<"){if(!ba.test(m))if(ca.test(m)){f.push(m.substring(9,m.length-3));n+=m.length-12}else if(da.test(m)){f.push("\n");++n}else if(m.indexOf(V)>=0&&m.replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g,' $1="$2$3$4"').match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/)){var t=m.match(W)[2],p=1,c;c=j+1;a:for(;c<q;++c){var d=l[c].match(W);if(d&&
d[2]===t)if(d[1]==="/"){if(--p===0)break a}else++p}if(c<q){r.push(n,l.slice(j,c+1).join(""));j=c}else r.push(n,m)}else r.push(n,m)}else{var a;p=m;var k=p.indexOf("&");if(k<0)a=p;else{for(--k;(k=p.indexOf("&#",k+1))>=0;){var e=p.indexOf(";",k);if(e>=0){var h=p.substring(k+3,e),g=10;if(h&&h.charAt(0)==="x"){h=h.substring(1);g=16}var s=parseInt(h,g);isNaN(s)||(p=p.substring(0,k)+String.fromCharCode(s)+p.substring(e+1))}}a=p.replace(ea,"<").replace(fa,">").replace(ga,"'").replace(ha,'"').replace(ia," ").replace(ja,
"&")}f.push(a);n+=a.length}}o={source:f.join(""),h:r};var v=o.source;b.source=v;b.c=0;b.g=o.h;Q(i,v)(b);$(b)}catch(w){if("console"in window)console.log(w&&w.stack?w.stack:w)}}var A="str",R="kwd",C="com",S="typ",J="lit",E="pun",z="pln",P="src",V="nocode",Z=function(){for(var b=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=",
"~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"],f="(?:^^|[+-]",i=0;i<b.length;++i)f+="|"+b[i].replace(/([^=<>:&a-z])/g,"\\$1");f+=")\\s*";return f}(),L=/&/g,M=/</g,N=/>/g,X=/\"/g,ea=/&lt;/g,fa=/&gt;/g,ga=/&apos;/g,ha=/&quot;/g,ja=/&amp;/g,ia=/&nbsp;/g,ka=/[\r\n]/g,K=null,aa=RegExp("[^<]+|<!--[\\s\\S]*?--\>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>|</?[a-zA-Z](?:[^>\"']|'[^']*'|\"[^\"]*\")*>|<","g"),ba=/^<\!--/,ca=/^<!\[CDATA\[/,da=/^<br\b/i,W=/^<(\/?)([a-zA-Z][a-zA-Z0-9]*)/,
la=x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename using virtual wchar_t where break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params partial readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof debugger eval export function get null set undefined var with Infinity NaN caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END break continue do else for if return while and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None break continue do else for if return while alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END break continue do else for if return while case done elif esac eval fi function in local set then until ",
hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true}),G={};u(la,["default-code"]);u(B([],[[z,/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],[C,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[E,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup",
"htm","html","mxml","xhtml","xml","xsl"]);u(B([[z,/^[\s]+/,null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[E,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],
["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);u(B([],[["atv",/^[\s\S]+/]]),["uq.val"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename using virtual wchar_t where ",
hashComments:true,cStyleComments:true}),["c","cc","cpp","cxx","cyc","m"]);u(x({keywords:"null true false"}),["json"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params partial readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var ",
hashComments:true,cStyleComments:true,verbatimStrings:true}),["cs"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof abstract boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient ",
cStyleComments:true}),["java"]);u(x({keywords:"break continue do else for if return while case done elif esac eval fi function in local set then until ",hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);u(x({keywords:"break continue do else for if return while and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ",hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);
u(x({keywords:"caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ",hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);u(x({keywords:"break continue do else for if return while alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ",hashComments:true,
multiLineStrings:true,regexLiterals:true}),["rb"]);u(x({keywords:"break continue do else for if return while auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try typeof debugger eval export function get null set undefined var with Infinity NaN ",cStyleComments:true,regexLiterals:true}),["js"]);u(B([],[[A,/^[\s\S]+/]]),
["regex"]);window.PR_normalizedHtml=H;window.prettyPrintOne=function(b,f){var i={f:b,e:f};U(i);return i.a};window.prettyPrint=function(b){function f(){for(var t=window.PR_SHOULD_USE_CONTINUATION?j.now()+250:Infinity;q<o.length&&j.now()<t;q++){var p=o[q];if(p.className&&p.className.indexOf("prettyprint")>=0){var c=p.className.match(/\blang-(\w+)\b/);if(c)c=c[1];for(var d=false,a=p.parentNode;a;a=a.parentNode)if((a.tagName==="pre"||a.tagName==="code"||a.tagName==="xmp")&&a.className&&a.className.indexOf("prettyprint")>=
0){d=true;break}if(!d){a=p;if(null===K){d=document.createElement("PRE");d.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'));K=!/</.test(d.innerHTML)}if(K){d=a.innerHTML;if("XMP"===a.tagName)d=y(d);else{a=a;if("PRE"===a.tagName)a=true;else if(ka.test(d)){var k="";if(a.currentStyle)k=a.currentStyle.whiteSpace;else if(window.getComputedStyle)k=window.getComputedStyle(a,null).whiteSpace;a=!k||k==="pre"}else a=true;a||(d=d.replace(/(<br\s*\/?>)[\r\n]+/g,"$1").replace(/(?:[\r\n]+[ \t]*)+/g,
" "))}d=d}else{d=[];for(a=a.firstChild;a;a=a.nextSibling)H(a,d);d=d.join("")}d=d.replace(/(?:\r\n?|\n)$/,"");m={f:d,e:c,b:p};U(m);if(p=m.a){c=m.b;if("XMP"===c.tagName){d=document.createElement("PRE");for(a=0;a<c.attributes.length;++a){k=c.attributes[a];if(k.specified)if(k.name.toLowerCase()==="class")d.className=k.value;else d.setAttribute(k.name,k.value)}d.innerHTML=p;c.parentNode.replaceChild(d,c)}else c.innerHTML=p}}}}if(q<o.length)setTimeout(f,250);else b&&b()}for(var i=[document.getElementsByTagName("pre"),
document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],o=[],l=0;l<i.length;++l)for(var n=0,r=i[l].length;n<r;++n)o.push(i[l][n]);i=null;var j=Date;j.now||(j={now:function(){return(new Date).getTime()}});var q=0,m;f()};window.PR={combinePrefixPatterns:O,createSimpleLexer:B,registerLangHandler:u,sourceDecorator:x,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:C,PR_DECLARATION:"dec",PR_KEYWORD:R,PR_LITERAL:J,PR_NOCODE:V,PR_PLAIN:z,PR_PUNCTUATION:E,PR_SOURCE:P,PR_STRING:A,
PR_TAG:"tag",PR_TYPE:S}})()
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[ \t\r\n\f]+/,null," \t\r\n\u000c"]],[["str",/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],["str",/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],["kwd",/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],
["com",/^(?:<!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#(?:[0-9a-f]{3}){1,2}/i],["pln",/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],["pun",/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^\)\"\']+/]]),["css-str"])

368
docs/classes/Collision.html Normal file
View File

@@ -0,0 +1,368 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Collision</title>
<link rel="stylesheet" href="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.5.1&#x2F;build&#x2F;cssgrids&#x2F;cssgrids-min.css">
<link rel="stylesheet" href="..&#x2F;assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="..&#x2F;assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="..&#x2F;assets/favicon.png">
<script src="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;combo?3.5.1&#x2F;build&#x2F;yui&#x2F;yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<!-- <h1><img src="..&#x2F;assets/css/logo.png" title=""></h1> -->
<h1><img src="http://ducksboard.com/wp-content/themes/blog-theme-ducksboard/images/ducksboard.png" title=""></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: </em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="..&#x2F;classes/Collision.html">Collision</a></li>
<li><a href="..&#x2F;classes/Coords.html">Coords</a></li>
<li><a href="..&#x2F;classes/Gridster.html">Gridster</a></li>
</ul>
<ul id="api-modules" class="apis modules">
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1>Collision Class</h1>
<div class="box meta">
<div class="uses">
Uses
<ul class="inline commas">
<li><a href="Coords.html">Coords</a></li>
</ul>
</div>
<div class="foundat">
Defined in: <a href="..&#x2F;files&#x2F;src_jquery.collision.js.html#l22"><code>src&#x2F;jquery.collision.js:22</code></a>
</div>
</div>
<div class="box intro">
<p>Collision</p>
</div>
<div class="constructor">
<h2>Constructor</h2>
<div id="method_Collision" class="method item">
<h3 class="name"><code>Collision</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>element</code>
</li>
<li class="arg">
<code>colliders</code>
</li>
<li class="arg">
<code class="optional">[options]</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type">Object</span>
</span>
<div class="meta">
<p>
Defined in
<a href="..&#x2F;files&#x2F;src_jquery.collision.js.html#l22"><code>src&#x2F;jquery.collision.js:22</code></a>
</p>
</div>
<div class="description">
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">element</code>
<span class="type">HTMLElement</span>
<div class="param-description">
<p>An Attribute name or object property path</p>
</div>
</li>
<li class="param">
<code class="param-name">colliders</code>
<span class="type">String | HTMLElement | Array</span>
<div class="param-description">
<p>An Attribute name or object property path</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[options]</code>
<span class="type">Object</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>An Attribute name or object property path</p>
</div>
<ul class="params-list">
<li class="param">
<code class="param-name optional">[on_overlap]</code>
<span class="type">Function</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>An Attribute name or object property path</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[on_overlap_start]</code>
<span class="type">Function</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>An Attribute name or object property path</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[on_overlap_stop]</code>
<span class="type">Function</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>An Attribute name or object property path</p>
</div>
</li>
</ul>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Object</span>:
dasdasdadasd
</div>
</div>
</div>
</div>
<div id="classdocs" class="tabview">
<ul class="api-class-tabs">
<li class="api-class-tab index"><a href="#index">Index</a></li>
</ul>
<div>
<div id="index" class="api-class-tabpanel index">
<h2 class="off-left">Item Index</h2>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="..&#x2F;assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="..&#x2F;assets/js/yui-prettify.js"></script>
<script src="..&#x2F;assets/../api.js"></script>
<script src="..&#x2F;assets/js/api-filter.js"></script>
<script src="..&#x2F;assets/js/api-list.js"></script>
<script src="..&#x2F;assets/js/api-search.js"></script>
<script src="..&#x2F;assets/js/apidocs.js"></script>
</body>
</html>

253
docs/classes/Coords.html Normal file
View File

@@ -0,0 +1,253 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Coords</title>
<link rel="stylesheet" href="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.5.1&#x2F;build&#x2F;cssgrids&#x2F;cssgrids-min.css">
<link rel="stylesheet" href="..&#x2F;assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="..&#x2F;assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="..&#x2F;assets/favicon.png">
<script src="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;combo?3.5.1&#x2F;build&#x2F;yui&#x2F;yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<!-- <h1><img src="..&#x2F;assets/css/logo.png" title=""></h1> -->
<h1><img src="http://ducksboard.com/wp-content/themes/blog-theme-ducksboard/images/ducksboard.png" title=""></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: </em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="..&#x2F;classes/Collision.html">Collision</a></li>
<li><a href="..&#x2F;classes/Coords.html">Coords</a></li>
<li><a href="..&#x2F;classes/Gridster.html">Gridster</a></li>
</ul>
<ul id="api-modules" class="apis modules">
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1>Coords Class</h1>
<div class="box meta">
<div class="foundat">
Defined in: <a href="..&#x2F;files&#x2F;src_jquery.coords.js.html#l10"><code>src&#x2F;jquery.coords.js:10</code></a>
</div>
</div>
<div class="box intro">
<p>Coords description</p>
</div>
<div class="constructor">
<h2>Constructor</h2>
<div id="method_Coords" class="method item">
<h3 class="name"><code>Coords</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code>obj</code>
</li>
</ul><span class="paren">)</span>
</div>
<div class="meta">
<p>
Defined in
<a href="..&#x2F;files&#x2F;src_jquery.coords.js.html#l10"><code>src&#x2F;jquery.coords.js:10</code></a>
</p>
</div>
<div class="description">
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name">obj</code>
<span class="type">HTMLElement | Object</span>
<div class="param-description">
<p>HTMLElement or a literal Object with the left, top, width and height properties.</p>
</div>
</li>
</ul>
</div>
</div>
</div>
<div id="classdocs" class="tabview">
<ul class="api-class-tabs">
<li class="api-class-tab index"><a href="#index">Index</a></li>
</ul>
<div>
<div id="index" class="api-class-tabpanel index">
<h2 class="off-left">Item Index</h2>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="..&#x2F;assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="..&#x2F;assets/js/yui-prettify.js"></script>
<script src="..&#x2F;assets/../api.js"></script>
<script src="..&#x2F;assets/js/api-filter.js"></script>
<script src="..&#x2F;assets/js/api-list.js"></script>
<script src="..&#x2F;assets/js/api-search.js"></script>
<script src="..&#x2F;assets/js/apidocs.js"></script>
</body>
</html>

7646
docs/classes/Gridster.html Normal file

File diff suppressed because it is too large Load Diff

10
docs/classes/index.html Normal file
View File

@@ -0,0 +1,10 @@
<!doctype html>
<html>
<head>
<title>Redirector</title>
<meta http-equiv="refresh" content="0;url=../">
</head>
<body>
<a href="../">Click here to redirect</a>
</body>
</html>

1475
docs/data.json Normal file

File diff suppressed because it is too large Load Diff

10
docs/files/index.html Normal file
View File

@@ -0,0 +1,10 @@
<!doctype html>
<html>
<head>
<title>Redirector</title>
<meta http-equiv="refresh" content="0;url=../">
</head>
<body>
<a href="../">Click here to redirect</a>
</body>
</html>

View File

@@ -0,0 +1,320 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>src&#x2F;jquery.collision.js</title>
<link rel="stylesheet" href="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.5.1&#x2F;build&#x2F;cssgrids&#x2F;cssgrids-min.css">
<link rel="stylesheet" href="..&#x2F;assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="..&#x2F;assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="..&#x2F;assets/favicon.png">
<script src="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;combo?3.5.1&#x2F;build&#x2F;yui&#x2F;yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<!-- <h1><img src="..&#x2F;assets/css/logo.png" title=""></h1> -->
<h1><img src="http://ducksboard.com/wp-content/themes/blog-theme-ducksboard/images/ducksboard.png" title=""></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: </em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="..&#x2F;classes/Collision.html">Collision</a></li>
<li><a href="..&#x2F;classes/Coords.html">Coords</a></li>
<li><a href="..&#x2F;classes/Gridster.html">Gridster</a></li>
</ul>
<ul id="api-modules" class="apis modules">
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1 class="file-heading">File: src&#x2F;jquery.collision.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
&#x2F;*
* jquery.collision
* https:&#x2F;&#x2F;github.com&#x2F;ducksboard&#x2F;gridster.js
*
* Copyright (c) 2012 ducksboard
* Licensed under the MIT, GPL licenses.
*&#x2F;
;(function($, window, document, undefined){
var defaults = {
colliders_context: document.body,
on_overlap: function(collider_data){},
on_overlap_start : function(collider_data){
&#x2F;&#x2F; console.log(&#x27;the element START being a collider&#x27;, collider_data);
},
on_overlap_stop : function(collider_data){
&#x2F;&#x2F; console.log(&#x27;the element STOP being a collider&#x27;, collider_data);
}
};
&#x2F;**
* Collision
*
* @class Collision
* @uses Coords
* @param {HTMLElement} element An Attribute name or object property path
* @param {String|HTMLElement|Array} colliders An Attribute name or object property path
* @param {Object} [options] An Attribute name or object property path
* @param {Function} [options.on_overlap] An Attribute name or object property path
* @param {Function} [options.on_overlap_start] An Attribute name or object property path
* @param {Function} [options.on_overlap_stop] An Attribute name or object property path
* @return {Object} dasdasdadasd
* @constructor
*&#x2F;
function Collision(element, colliders, options) {
this.options = $.extend(defaults, options);
this.$element = element;
this.last_colliders = [];
this.last_colliders_coords = [];
if (typeof colliders === &#x27;string&#x27; || colliders instanceof jQuery) {
this.$colliders = $(colliders,
this.options.colliders_context).not(this.$element);
}else{
this.colliders = $(colliders);
}
this.init();
}
var fn = Collision.prototype;
fn.init = function() {
this.find_collisions();
};
fn.overlaps = function(a, b) {
var x = false;
var y = false;
if ((b.x1 &gt;= a.x1 &amp;&amp; b.x1 &lt;= a.x2) ||
(b.x2 &gt;= a.x1 &amp;&amp; b.x2 &lt;= a.x2) ||
(a.x1 &gt;= b.x1 &amp;&amp; a.x2 &lt;= b.x2)
) { x = true; }
if ((b.y1 &gt;= a.y1 &amp;&amp; b.y1 &lt;= a.y2) ||
(b.y2 &gt;= a.y1 &amp;&amp; b.y2 &lt;= a.y2) ||
(a.y1 &gt;= b.y1 &amp;&amp; a.y2 &lt;= b.y2)
) { y = true; }
return (x &amp;&amp; y);
};
fn.detect_overlapping_region = function(a, b){
var regionX = &#x27;&#x27;;
var regionY = &#x27;&#x27;;
if (a.y1 &gt; b.cy &amp;&amp; a.y1 &lt; b.y2) { regionX = &#x27;N&#x27;; }
if (a.y2 &gt; b.y1 &amp;&amp; a.y2 &lt; b.cy) { regionX = &#x27;S&#x27;; }
if (a.x1 &gt; b.cx &amp;&amp; a.x1 &lt; b.x2) { regionY = &#x27;W&#x27;; }
if (a.x2 &gt; b.x1 &amp;&amp; a.x2 &lt; b.cx) { regionY = &#x27;E&#x27;; }
return (regionX + regionY) || &#x27;C&#x27;;
};
fn.calculate_overlapped_area_coords = function(a, b){
var x1 = Math.max(a.x1, b.x1);
var y1 = Math.max(a.y1, b.y1);
var x2 = Math.min(a.x2, b.x2);
var y2 = Math.min(a.y2, b.y2);
return $({
left: x1,
top: y1,
width : (x2 - x1),
height: (y2 - y1)
}).coords().get();
};
fn.calculate_overlapped_area = function(coords){
return (coords.width * coords.height);
};
fn.manage_colliders_start_stop = function(new_colliders_coords, start_callback, stop_callback){
var last = this.last_colliders_coords;
for (var i = 0, il = last.length; i &lt; il; i++) {
if ($.inArray(last[i], new_colliders_coords) === -1) {
start_callback.call(this, last[i]);
}
}
for (var j = 0, jl = new_colliders_coords.length; j &lt; jl; j++) {
if ($.inArray(new_colliders_coords[j], last) === -1) {
stop_callback.call(this, new_colliders_coords[j]);
}
}
};
fn.find_collisions = function(){
var self = this;
var colliders_coords = [];
var colliders_data = [];
var $colliders = (this.colliders || this.$colliders);
var count = $colliders.length;
while(count--){
var $collider = self.$colliders ? $($colliders[count]) : $colliders[count];
var player_coords = self.$element.coords().update().get();
var $collider_coords_ins = ($collider.isCoords) ?
$collider.update() : $collider.coords();
var collider_coords = $collider_coords_ins.get();
var overlaps = self.overlaps(player_coords, collider_coords);
if (!overlaps) {
continue;
}
var region = self.detect_overlapping_region(player_coords,
collider_coords);
&#x2F;&#x2F;todo: make this if customizable
if (region === &#x27;C&#x27;){
var area_coords = self.calculate_overlapped_area_coords(
player_coords, collider_coords);
var area = self.calculate_overlapped_area(area_coords);
var collider_data = {
area: area,
area_coords : area_coords,
region: region,
coords: collider_coords,
player_coords: player_coords,
el: $collider
};
self.options.on_overlap.call(this, collider_data);
colliders_coords.push($collider_coords_ins);
colliders_data.push(collider_data);
}
}
this.manage_colliders_start_stop(colliders_coords,
self.options.on_overlap_stop, self.options.on_overlap_start);
this.last_colliders_coords = colliders_coords;
return colliders_data;
};
fn.get_closest_colliders = function(){
var colliders = this.find_collisions();
var min_area = 100;
colliders.sort(function(a, b){
if (a.area &lt;= min_area) {
return 1;
}
&#x2F;* if colliders are being overlapped by the &quot;C&quot; (center) region,
* we have to set a lower index in the array to which they are placed
* above in the grid. *&#x2F;
if (a.region === &#x27;C&#x27; &amp;&amp; b.region === &#x27;C&#x27;) {
if (a.coords.y1 &lt; b.coords.y1 || a.coords.x1 &lt; b.coords.x1) {
return - 1;
}else{
return 1;
}
}
if (a.area &lt; b.area){
return 1;
}
return 1;
});
return colliders;
};
&#x2F;&#x2F;jQuery adapter
$.fn.collision = function(collider, options) {
return new Collision( this, collider, options );
};
}(jQuery, window, document));
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="..&#x2F;assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="..&#x2F;assets/js/yui-prettify.js"></script>
<script src="..&#x2F;assets/../api.js"></script>
<script src="..&#x2F;assets/js/api-filter.js"></script>
<script src="..&#x2F;assets/js/api-list.js"></script>
<script src="..&#x2F;assets/js/api-search.js"></script>
<script src="..&#x2F;assets/js/apidocs.js"></script>
</body>
</html>

View File

@@ -0,0 +1,201 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>src&#x2F;jquery.coords.js</title>
<link rel="stylesheet" href="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.5.1&#x2F;build&#x2F;cssgrids&#x2F;cssgrids-min.css">
<link rel="stylesheet" href="..&#x2F;assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="..&#x2F;assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="..&#x2F;assets/favicon.png">
<script src="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;combo?3.5.1&#x2F;build&#x2F;yui&#x2F;yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<!-- <h1><img src="..&#x2F;assets/css/logo.png" title=""></h1> -->
<h1><img src="http://ducksboard.com/wp-content/themes/blog-theme-ducksboard/images/ducksboard.png" title=""></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: </em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="..&#x2F;classes/Collision.html">Collision</a></li>
<li><a href="..&#x2F;classes/Coords.html">Coords</a></li>
<li><a href="..&#x2F;classes/Gridster.html">Gridster</a></li>
</ul>
<ul id="api-modules" class="apis modules">
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1 class="file-heading">File: src&#x2F;jquery.coords.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
&#x2F;*
* jquery.coords
* https:&#x2F;&#x2F;github.com&#x2F;ducksboard&#x2F;gridster.js
*
* Copyright (c) 2012 ducksboard
* Licensed under the MIT, GPL licenses.
*&#x2F;
;(function($, window, document, undefined){
&#x2F;**
* Coords description
*
* @class Coords
* @param {HTMLElement|Object} obj HTMLElement or a literal Object with the left, top, width and height properties.
* @constructor
*&#x2F;
function Coords(obj) {
if (obj[0] &amp;&amp; $.isPlainObject(obj[0])) {
this.data = obj[0];
}else {
this.el = obj;
}
this.isCoords = true;
this.coords = {};
this.init();
return this;
}
var fn = Coords.prototype;
fn.init = function(){
this.set();
this.original_coords = this.get();
};
fn.set = function(update) {
var el = this.el;
if (el) {
this.data = el.offset();
this.data.width || (this.data.width = el.width());
this.data.height || (this.data.height = el.height());
}
var d = this.data;
this.coords.x1 = d.left;
this.coords.y1 = d.top;
this.coords.x2 = d.left + d.width;
this.coords.y2 = d.top + d.height;
this.coords.cx = d.left + (d.width &#x2F; 2);
this.coords.cy = d.top + (d.height &#x2F; 2);
this.coords.width = d.width;
this.coords.height = d.height;
this.coords.el = el || false ;
return this;
};
fn.update = function(data){
if (!data &amp;&amp; !this.el) {
return this;
}
if (data) {
var new_data = $.extend(this.data, data);
this.data = new_data;
}
this.set(true);
return this;
};
fn.get = function(){
return this.coords;
};
&#x2F;&#x2F;jQuery adapter
$.fn.coords = function() {
if (this.data(&#x27;coords&#x27;) ) {
return this.data(&#x27;coords&#x27;);
}
var ins = new Coords(this, arguments[0]);
this.data(&#x27;coords&#x27;, ins);
return ins;
};
}(jQuery, window, document));
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="..&#x2F;assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="..&#x2F;assets/js/yui-prettify.js"></script>
<script src="..&#x2F;assets/../api.js"></script>
<script src="..&#x2F;assets/js/api-filter.js"></script>
<script src="..&#x2F;assets/js/api-list.js"></script>
<script src="..&#x2F;assets/js/api-search.js"></script>
<script src="..&#x2F;assets/js/apidocs.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

127
docs/index.html Normal file
View File

@@ -0,0 +1,127 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.5.1&#x2F;build&#x2F;cssgrids&#x2F;cssgrids-min.css">
<link rel="stylesheet" href=".&#x2F;assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href=".&#x2F;assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href=".&#x2F;assets/favicon.png">
<script src="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;combo?3.5.1&#x2F;build&#x2F;yui&#x2F;yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<!-- <h1><img src=".&#x2F;assets/css/logo.png" title=""></h1> -->
<h1><img src="http://ducksboard.com/wp-content/themes/blog-theme-ducksboard/images/ducksboard.png" title=""></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: </em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href=".&#x2F;classes/Collision.html">Collision</a></li>
<li><a href=".&#x2F;classes/Coords.html">Coords</a></li>
<li><a href=".&#x2F;classes/Gridster.html">Gridster</a></li>
</ul>
<ul id="api-modules" class="apis modules">
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<div class="apidocs">
<div id="docs-main" class="content">
<p>
Browse to a module or class using the sidebar to view its API documentation.
</p>
<h2>Keyboard Shortcuts</h2>
<ul>
<li><p>Press <kbd>s</kbd> to focus the API search box.</p></li>
<li><p>Use <kbd>Up</kbd> and <kbd>Down</kbd> to select classes, modules, and search results.</p></li>
<li class="mac-only"><p>With the API search box or sidebar focused, use <kbd><span class="cmd">&#x2318;</span>-Left</kbd> or <kbd><span class="cmd">&#x2318;</span>-Right</kbd> to switch sidebar tabs.</p></li>
<li class="pc-only"><p>With the API search box or sidebar focused, use <kbd>Ctrl+Left</kbd> and <kbd>Ctrl+Right</kbd> to switch sidebar tabs.</p></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src=".&#x2F;assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src=".&#x2F;assets/js/yui-prettify.js"></script>
<script src=".&#x2F;assets/../api.js"></script>
<script src=".&#x2F;assets/js/api-filter.js"></script>
<script src=".&#x2F;assets/js/api-list.js"></script>
<script src=".&#x2F;assets/js/api-search.js"></script>
<script src=".&#x2F;assets/js/apidocs.js"></script>
</body>
</html>

10
docs/modules/index.html Normal file
View File

@@ -0,0 +1,10 @@
<!doctype html>
<html>
<head>
<title>Redirector</title>
<meta http-equiv="refresh" content="0;url=../">
</head>
<body>
<a href="../">Click here to redirect</a>
</body>
</html>

86
grunt.js Normal file
View File

@@ -0,0 +1,86 @@
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: '<json:package.json>',
meta: {
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
},
concat: {
dist_js: {
src: ['<banner:meta.banner>', '<file_strip_banner:src/jquery.coords.js>', '<file_strip_banner:src/jquery.collision.js>', '<file_strip_banner:src/<%= pkg.name %>.js>'],
dest: 'dist/<%= pkg.name %>.js'
},
dist_css: {
src: ['<banner:meta.banner>', 'src/<%= pkg.name %>.css'],
dest: 'dist/<%= pkg.name %>.css'
}
},
min: {
dist: {
src: ['<banner:meta.banner>', '<config:concat.dist_js.dest>'],
dest: 'dist/<%= pkg.name %>.min.js'
}
},
mincss: {
compress: {
files: {
"dist/<%= pkg.name %>.min.css": ["dist/<%= pkg.name %>.css"]
}
}
},
qunit: {
files: ['test/**/*.html']
},
lint: {
files: ['grunt.js', 'src/**/*.js', 'test/**/*.js']
},
watch: {
files: ['<config:lint.files>', 'src/<%= pkg.name %>.css'],
tasks: 'lint concat'
},
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
browser: true
},
globals: {
jQuery: true
}
},
uglify: {},
yuidoc: {
compile: {
"name": '<%= pkg.title || pkg.name %>',
"description": '<%= pkg.description %>',
"version": '<%= pkg.version %>',
"url": '<%= pkg.homepage %>',
"logo": 'http://ducksboard.com/wp-content/themes/blog-theme-ducksboard/images/ducksboard.png',
options: {
paths: "src/",
outdir: "docs/"
}
}
}
});
grunt.loadNpmTasks('grunt-contrib');
// Default task.
grunt.registerTask('default', 'lint qunit concat min mincss');
};

391
index.html Executable file
View File

@@ -0,0 +1,391 @@
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>gridster.js</title>
<meta name="description" content="">
<meta name="author" content="duscksboard">
<link rel="stylesheet" type="text/css" href="dist/jquery.gridster.css">
<link rel="stylesheet" href="www/css/style.css">
<link href='http://fonts.googleapis.com/css?family=Rancho' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Handlee' rel='stylesheet' type='text/css'>
</head>
<body>
<header role="header">
<div class="wrapper">
<a href="" class="logo">gridster.js</a>
<h1 class="claim">put a grid in your life</h1>
<nav>
<ul>
<li><a href="#intro">What?</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#documentation">Documentation</a></li>
<li><a href="#download">Download</a></li>
<li><a href="#">Issues</a></li>
</ul>
</nav>
</div>
</header>
<div role="main">
<section id="intro" class="wrapper m_txt">
<div>
<h2 class="heading-xl">Try it now!</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.</p>
</div>
<div class="ttr">
<a href="" class="i_download"><span>Download now</span></a>
</div>
</section>
<section class="demo">
<div class="gridster">
<ul>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1"></li>
<li data-row="2" data-col="1" data-sizex="1" data-sizey="1"></li>
<li data-row="3" data-col="1" data-sizex="1" data-sizey="1"></li>
<li data-row="3" data-col="2" data-sizex="2" data-sizey="1"></li>
<li data-row="1" data-col="2" data-sizex="2" data-sizey="2"></li>
<li class="try" data-row="1" data-col="4" data-sizex="1" data-sizey="1"></li>
<li data-row="2" data-col="4" data-sizex="2" data-sizey="1"></li>
<li data-row="3" data-col="4" data-sizex="1" data-sizey="1"></li>
<li data-row="1" data-col="5" data-sizex="1" data-sizey="1"></li>
<li data-row="3" data-col="5" data-sizex="1" data-sizey="1"></li>
<li data-row="1" data-col="6" data-sizex="1" data-sizey="1"></li>
<li data-row="2" data-col="6" data-sizex="1" data-sizey="2"></li>
</ul>
</div>
</section>
<section id="usage">
<div class="wrapper">
<header>
<h2 class="heading-xl">Usage</h2>
</header>
<article class="m_txt">
<h3 class="heading-l">Setup</h3>
<p>Nowadays griddable.js depends on jQuery and jQuery UI draggable, so you need to include this scripts in the head of your document.</p>
<h4 class="heading-m">Include dependencies</h4>
<p>Download the latest release at <a href="http://jquery.com/">jQuery</a> and <a href="http://jqueryui.com/">jQuery UI</a>.</p>
<script src="https://gist.github.com/3129541.js?file=gridder.html"></script>
<h4 class="heading-m">HTML Structure</h4>
<p>The HTML required to make gridster works. Class names and tags are customizable but is needed to follow the structure below:</p>
<script src="https://gist.github.com/3129747.js?file=gridster.html"></script>
<h4 class="heading-m">Let's go run gridster.js!</h4>
<p>Gridster only accepts one argument with configuration options. Take a look at the <a href="#documentation">documentation</a>.</p>
<script src="https://gist.github.com/3129767.js?file=gridder.js"></script>
</article>
<article class="m_txt">
<h3 class="heading-l">Playing with the API</h3>
<p>The API can be accesed as in most jQuery plugins via the jQuery data method like so:</p>
<script src="https://gist.github.com/3129811.js?file=gridster.js"></script>
<h4 class="heading-m">Add a new widget to the grid</h4><br>
<script src="https://gist.github.com/3129866.js?file=gridster.js"></script>
<h4 class="heading-m">Remove a widget from the grid</h4><br>
<script src="https://gist.github.com/3129893.js?file=gridster.js"></script>
<h4 class="heading-m">Get serialized array with the elements positions</h4>
<p>Creates a JavaScript array of objects, ready to be encoded as a JSON string.</p>
<script src="https://gist.github.com/3129908.js?file=gridster.js"></script>
</article>
</div><!-- .wrapper -->
</section>
<section id="documentation">
<div class="wrapper">
<header>
<h2 class="heading-xl">Documentation</h2>
<h3 class="heading-m">Options</h3>
<nav>
<ul class="m_tags">
<li><a href="#widget_class_opt">widget_class</a></li>
<li><a href="#widget_margins_opt">widget_margins</a></li>
<li><a href="#widget_base_dimensions_opt">widget_base_dimensions</a></li>
<li><a href="#min_cols_opt">min_cols</a></li>
<li><a href="#min_rows_opt">min_rows</a></li>
<li><a href="#extra_cols_opt">extra_cols</a></li>
<li><a href="#extra_rows_opt">extra_rows</a></li>
<li><a href="#autogenerate_stylesheet_opt">autogenerate_stylesheet</a></li>
<li><a href="#on_overlap_start_opt">on_overlap_start</a></li>
<li><a href="#on_overlap_opt">on_overlap</a></li>
<li><a href="#on_overlap_stop_opt">on_overlap_stop</a></li>
</ul>
</nav><br><br>
<div class="m_txt">
<h3 class="heading-m">Methods</h3>
<p>The methods listed here are the most common. If this is never enough take a look to the <a href="">documentation generated from source</a>.</p>
</div>
<nav>
<ul class="m_tags">
<li><a href="#add_widget_method">add_widget</a></li>
<li><a href="#remove_widget_method">remove_widget</a></li>
<li><a href="#serialize_method">serialize</a></li>
<li><a href="#serialize_changed_method">serialize_changed</a></li>
</ul>
</nav>
</header>
<article id="options" class="m_doc_method">
<div class="m_txt">
<h3 id="widget_class_opt" class="heading-l">Options</h3>
<p>gridder configuration object.</p>
<h4 id="widget_selector_opt" class="heading-m">widget_selector: <em>"> li"</em></h4>
<p>Define who are the widgets. Can be a CSS Selector string or a jQuery collection of HTMLElement</p>
<h4 id="widget_margins_opt" class="heading-m">widget_margins: <em>[10, 10]</em></h4>
<p>Horizontal and vertical margins respectively for widgets.</p>
<h4 id="widget_base_dimensions_opt" class="heading-m">widget_base_dimensions: <em>[140, 140]</em></h4>
<p>Base widget dimensions in pixels. The first index for the width and the second for the height.</p>
<h4 id="extra_rows_opt" class="heading-m">extra_rows: <em>0</em></h4>
<p>Add more rows in addition to those that have been calculated.</p>
<h4 id="extra_cols_opt" class="heading-m">extra_cols: <em>0</em></h4>
<p>Add more rows in addition to those that have been calculated.</p>
<h4 id="min_cols_opt" class="heading-m">min_cols: <em>1</em></h4>
<p>The minimum required columns.</p>
<h4 id="min_rows_opt" class="heading-m">min_rows: <em>10</em></h4>
<p>The minimum required rows.</p>
<h4 id="autogenerate_stylesheet_opt" class="heading-m">autogenerate_stylesheet: <em>true</em></h4>
<p>If true, all the CSS required to position all widgets in their respective columns and rows will be generated automatically and injected to the <code>&lt;head&gt;</code> of the document. You can set this to false, and write your own CSS targeting rows and cols via data-attributes like so: <code>[data-col="1"] { left: 10px; }</code></p>
<h4 id="serialize_params_opt" class="heading-m">serialize_params: <em>function($w, wgd) { return { col: wgd.col, row: wgd.row } }</em></h4>
<p>Return the data you want for each widget in the serialize method. Two arguments are passed: `$w`: the jQuery wrapped HTMLElement, and `wgd`: the grid coords object (`col`, `row`, `size_x`, `size_y`).</p>
<h4 id="draggable_opt" class="heading-m">draggable: <em>{}</em></h4>
<p>The configuration object of the jQuery UI Draggable Plugin. See <a href="http://jqueryui.com/demos/draggable/">http://jqueryui.com/demos/draggable/</a> for more information.</p>
<h4 id="on_overlap_start_opt" class="heading-m">collision.on_overlap_start: <em>function(collider_data) { }</em></h4>
<p>Executes a function first time a widget overlaps with a "faux" grid cell.</p>
<h4 id="on_overlap_opt" class="heading-m">collision.on_overlap: <em>function(collider_data) { }</em></h4>
<p>Executes a function each time a widget overlaps with a "faux" grid cell.</p>
<h4 id="on_overlap_stop_opt" class="heading-m">collision.on_overlap_stop: <em>function(collider_data) { }</em></h4>
<p>Executes a function last time a widget overlaps with a "faux" grid cell.</p>
</div>
</article>
<article id="add_widget_method" class="m_doc_method">
<h3>.add_widget( html, [size_x], [size_y] )</h3>
<div class="m_txt">
<p>Create a new widget with the given html and add it to the grid.</p>
<h4 class="heading-m">Parameters</h4>
<dl>
<dt>html <em>String</em></dt>
<dd>The string that represents the HTML of the widget.</dd>
<dt>size_x <em>Number</em></dt>
<dd>The number of rows that the widget occupies. Default is <em>1</em>.</dd>
<dt>size_y <em>Number</em></dt>
<dd>The number of columns that the widget occupies. Default is <em>1</em>.</dd>
</dl>
<h4 class="heading-m">Returns</h4>
<p>Returns the jQuery wrapped HTMLElement representing the widget that was just created.</p>
</div>
</article>
<article id="remove_widget_method" class="m_doc_method">
<h3>.remove_widget( el )</h3>
<div class="m_txt">
<p>Remove a widget from the grid</p>
<h4 class="heading-m">Parameters</h4>
<dl>
<dt>el <em>HTMLElement</em></dt>
<dd>The jQuery wrapped HTMLElement representing the widget that you want to remove.</dd>
</dl>
<h4 class="heading-m">Returns</h4>
<p>Returns the instance of the Gridster Class.</p>
</div>
</article>
<article id="serialize_method" class="m_doc_method">
<h3>.serialize( [$widgets] )</h3>
<div class="m_txt">
<p>Creates an array of objects representing the current position of all widgets in the grid.</p>
<h4 class="heading-m">Parameters</h4>
<dl>
<dt>$widgets <em>HTMLElement</em></dt>
<dd>The collection of jQuery wrapped HTMLElements you want to serialize. If no argument is passed all widgets will be serialized.</dd>
</dl>
<h4 class="heading-m">Returns</h4>
<p>Returns an Array of Objects (ready to be encoded as a JSON string) with the data specified in the serialize_params option.</p>
</div>
</article>
<article id="serialize_changed_method" class="m_doc_method">
<h3>.serialize_changed( )</h3>
<div class="m_txt">
<p>Creates an array of objects representing the current position of the widgets who have changed position.</p>
<h4 class="heading-m">Returns</h4>
<p>Returns an Array of Objects (ready to be encoded as a JSON string) with the data specified in the serialize_params option.</p>
</div>
</article>
</div><!-- .wrapper -->
</section>
<section id="download">
<div class="wrapper">
<header>
<h2 class="heading-xl">Download</h2>
</header>
<article class="m_txt">
<p>Reminds that gridster.js depends on jQuery and jQuery UI draggable. Download the latest release at <a href="http://jquery.com/">jQuery</a> and <a href="http://jqueryui.com/">jQuery UI</a>.
</p>
<h3 class="heading-l">gridster.<u>js</u></h3>
<dl>
<dt>Development version</dt>
<dd><a href="">jquery.gridster.js</a></dd>
<dt>Production version (minified)</dt>
<dd><a href="">jquery.gridster.min.js</a></dd>
</dl>
<h3 class="heading-l">gridster.<u>css</u></h3>
<dl>
<dt>Development version</dt>
<dd><a href="">jquery.gridster.css</a></dd>
<dt>Production version (minified)</dt>
<dd><a href="">jquery.gridster.min.css</a></dd>
</dl>
<h3 class="heading-l">or clone the repo from github</h3>
<dl>
<dt>Github project</dt>
<dd><a href="">gridster.js</a></dd>
<dt>Download .zip</dt>
<dd><a href="">gridster.js.zip</a></dd>
</dl>
</article>
</div><!-- .wrapper -->
</section>
<section id="download">
<div class="wrapper">
<header>
<h2 class="heading-xl">Browser support</h2>
</header>
<article class="m_txt">
<p>Gridster supports Internet Explorer 9+, Firefox, Chrome, Safari and Opera.</p>
</article>
</div><!-- .wrapper -->
</section>
</div>
<footer role="footer">
<div class="wrapper">
<a href="#" class="logo-small">gridster.js</a>
<p class="claim">put a grid in your life</p>
</div>
<p>
A project by: <a href="#" class="ducksboard-logo">Ducksboard</a>
</p>
</footer>
<script type="text/javascript" src="libs/jquery/jquery.js"></script>
<script type="text/javascript" src="libs/jquery-ui/jquery-ui.js"></script>
<script src="dist/jquery.gridster.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var gridster;
$(function(){
gridster = $(".gridster ul").gridster({
widget_margins: [10, 10],
widget_base_dimensions: [140, 140],
min_cols: 6,
min_rows: 10
}).data('gridster');
});
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-33489625-1']);
_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>
</body>
</html>

25
libs/jquery-ui/jquery-ui.js vendored Normal file

File diff suppressed because one or more lines are too long

9404
libs/jquery/jquery.js vendored Normal file

File diff suppressed because it is too large Load Diff

232
libs/qunit/qunit.css Normal file
View File

@@ -0,0 +1,232 @@
/**
* QUnit v1.4.0 - A JavaScript Unit Testing Framework
*
* http://docs.jquery.com/QUnit
*
* Copyright (c) 2012 John Resig, Jörn Zaefferer
* Dual licensed under the MIT (MIT-LICENSE.txt)
* or GPL (GPL-LICENSE.txt) licenses.
*/
/** Font Family and Sizes */
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
}
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
#qunit-tests { font-size: smaller; }
/** Resets */
#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
margin: 0;
padding: 0;
}
/** Header */
#qunit-header {
padding: 0.5em 0 0.5em 1em;
color: #8699a4;
background-color: #0d3349;
font-size: 1.5em;
line-height: 1em;
font-weight: normal;
border-radius: 15px 15px 0 0;
-moz-border-radius: 15px 15px 0 0;
-webkit-border-top-right-radius: 15px;
-webkit-border-top-left-radius: 15px;
}
#qunit-header a {
text-decoration: none;
color: #c2ccd1;
}
#qunit-header a:hover,
#qunit-header a:focus {
color: #fff;
}
#qunit-header label {
display: inline-block;
}
#qunit-banner {
height: 5px;
}
#qunit-testrunner-toolbar {
padding: 0.5em 0 0.5em 2em;
color: #5E740B;
background-color: #eee;
}
#qunit-userAgent {
padding: 0.5em 0 0.5em 2.5em;
background-color: #2b81af;
color: #fff;
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
}
/** Tests: Pass/Fail */
#qunit-tests {
list-style-position: inside;
}
#qunit-tests li {
padding: 0.4em 0.5em 0.4em 2.5em;
border-bottom: 1px solid #fff;
list-style-position: inside;
}
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
display: none;
}
#qunit-tests li strong {
cursor: pointer;
}
#qunit-tests li a {
padding: 0.5em;
color: #c2ccd1;
text-decoration: none;
}
#qunit-tests li a:hover,
#qunit-tests li a:focus {
color: #000;
}
#qunit-tests ol {
margin-top: 0.5em;
padding: 0.5em;
background-color: #fff;
border-radius: 15px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
box-shadow: inset 0px 2px 13px #999;
-moz-box-shadow: inset 0px 2px 13px #999;
-webkit-box-shadow: inset 0px 2px 13px #999;
}
#qunit-tests table {
border-collapse: collapse;
margin-top: .2em;
}
#qunit-tests th {
text-align: right;
vertical-align: top;
padding: 0 .5em 0 0;
}
#qunit-tests td {
vertical-align: top;
}
#qunit-tests pre {
margin: 0;
white-space: pre-wrap;
word-wrap: break-word;
}
#qunit-tests del {
background-color: #e0f2be;
color: #374e0c;
text-decoration: none;
}
#qunit-tests ins {
background-color: #ffcaca;
color: #500;
text-decoration: none;
}
/*** Test Counts */
#qunit-tests b.counts { color: black; }
#qunit-tests b.passed { color: #5E740B; }
#qunit-tests b.failed { color: #710909; }
#qunit-tests li li {
margin: 0.5em;
padding: 0.4em 0.5em 0.4em 0.5em;
background-color: #fff;
border-bottom: none;
list-style-position: inside;
}
/*** Passing Styles */
#qunit-tests li li.pass {
color: #5E740B;
background-color: #fff;
border-left: 26px solid #C6E746;
}
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
#qunit-tests .pass .test-name { color: #366097; }
#qunit-tests .pass .test-actual,
#qunit-tests .pass .test-expected { color: #999999; }
#qunit-banner.qunit-pass { background-color: #C6E746; }
/*** Failing Styles */
#qunit-tests li li.fail {
color: #710909;
background-color: #fff;
border-left: 26px solid #EE5757;
white-space: pre;
}
#qunit-tests > li:last-child {
border-radius: 0 0 15px 15px;
-moz-border-radius: 0 0 15px 15px;
-webkit-border-bottom-right-radius: 15px;
-webkit-border-bottom-left-radius: 15px;
}
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
#qunit-tests .fail .test-name,
#qunit-tests .fail .module-name { color: #000000; }
#qunit-tests .fail .test-actual { color: #EE5757; }
#qunit-tests .fail .test-expected { color: green; }
#qunit-banner.qunit-fail { background-color: #EE5757; }
/** Result */
#qunit-testresult {
padding: 0.5em 0.5em 0.5em 2.5em;
color: #2b81af;
background-color: #D2E0E6;
border-bottom: 1px solid white;
}
/** Fixture */
#qunit-fixture {
position: absolute;
top: -10000px;
left: -10000px;
width: 1000px;
height: 1000px;
}

1659
libs/qunit/qunit.js Normal file

File diff suppressed because it is too large Load Diff

32
package.json Normal file
View File

@@ -0,0 +1,32 @@
{
"name": "jquery.gridster",
"title": "gridster.js",
"description": "Put a grid in your life",
"version": "0.1.0",
"homepage": "https://github.com/ducksboard/gridster.js",
"author": {
"name": "ducksboard",
"email": "hackers@ducksboard.com"
},
"repository": {
"type": "git",
"url": "git://github.com/ducksboard/gridster.js.git"
},
"bugs": {
"url": "https://github.com/ducksboard/gridster.js/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/ducksboard/gridster.js/blob/master/LICENSE-MIT"
},
{
"type": "GPL",
"url": "https://github.com/ducksboard/gridster.js/blob/master/LICENSE-GPL"
}
],
"dependencies": {
"jquery": "~1.5"
},
"keywords": []
}

207
src/jquery.collision.js Normal file
View File

@@ -0,0 +1,207 @@
/*
* jquery.collision
* https://github.com/ducksboard/gridster.js
*
* Copyright (c) 2012 ducksboard
* Licensed under the MIT, GPL licenses.
*/
;(function($, window, document, undefined){
var defaults = {
colliders_context: document.body,
on_overlap: function(collider_data){},
on_overlap_start : function(collider_data){
// console.log('the element START being a collider', collider_data);
},
on_overlap_stop : function(collider_data){
// console.log('the element STOP being a collider', collider_data);
}
};
/**
* Collision
*
* @class Collision
* @uses Coords
* @param {HTMLElement} element An Attribute name or object property path
* @param {String|HTMLElement|Array} colliders An Attribute name or object property path
* @param {Object} [options] An Attribute name or object property path
* @param {Function} [options.on_overlap] An Attribute name or object property path
* @param {Function} [options.on_overlap_start] An Attribute name or object property path
* @param {Function} [options.on_overlap_stop] An Attribute name or object property path
* @return {Object} dasdasdadasd
* @constructor
*/
function Collision(element, colliders, options) {
this.options = $.extend(defaults, options);
this.$element = element;
this.last_colliders = [];
this.last_colliders_coords = [];
if (typeof colliders === 'string' || colliders instanceof jQuery) {
this.$colliders = $(colliders,
this.options.colliders_context).not(this.$element);
}else{
this.colliders = $(colliders);
}
this.init();
}
var fn = Collision.prototype;
fn.init = function() {
this.find_collisions();
};
fn.overlaps = function(a, b) {
var x = false;
var y = false;
if ((b.x1 >= a.x1 && b.x1 <= a.x2) ||
(b.x2 >= a.x1 && b.x2 <= a.x2) ||
(a.x1 >= b.x1 && a.x2 <= b.x2)
) { x = true; }
if ((b.y1 >= a.y1 && b.y1 <= a.y2) ||
(b.y2 >= a.y1 && b.y2 <= a.y2) ||
(a.y1 >= b.y1 && a.y2 <= b.y2)
) { y = true; }
return (x && y);
};
fn.detect_overlapping_region = function(a, b){
var regionX = '';
var regionY = '';
if (a.y1 > b.cy && a.y1 < b.y2) { regionX = 'N'; }
if (a.y2 > b.y1 && a.y2 < b.cy) { regionX = 'S'; }
if (a.x1 > b.cx && a.x1 < b.x2) { regionY = 'W'; }
if (a.x2 > b.x1 && a.x2 < b.cx) { regionY = 'E'; }
return (regionX + regionY) || 'C';
};
fn.calculate_overlapped_area_coords = function(a, b){
var x1 = Math.max(a.x1, b.x1);
var y1 = Math.max(a.y1, b.y1);
var x2 = Math.min(a.x2, b.x2);
var y2 = Math.min(a.y2, b.y2);
return $({
left: x1,
top: y1,
width : (x2 - x1),
height: (y2 - y1)
}).coords().get();
};
fn.calculate_overlapped_area = function(coords){
return (coords.width * coords.height);
};
fn.manage_colliders_start_stop = function(new_colliders_coords, start_callback, stop_callback){
var last = this.last_colliders_coords;
for (var i = 0, il = last.length; i < il; i++) {
if ($.inArray(last[i], new_colliders_coords) === -1) {
start_callback.call(this, last[i]);
}
}
for (var j = 0, jl = new_colliders_coords.length; j < jl; j++) {
if ($.inArray(new_colliders_coords[j], last) === -1) {
stop_callback.call(this, new_colliders_coords[j]);
}
}
};
fn.find_collisions = function(){
var self = this;
var colliders_coords = [];
var colliders_data = [];
var $colliders = (this.colliders || this.$colliders);
var count = $colliders.length;
while(count--){
var $collider = self.$colliders ? $($colliders[count]) : $colliders[count];
var player_coords = self.$element.coords().update().get();
var $collider_coords_ins = ($collider.isCoords) ?
$collider.update() : $collider.coords();
var collider_coords = $collider_coords_ins.get();
var overlaps = self.overlaps(player_coords, collider_coords);
if (!overlaps) {
continue;
}
var region = self.detect_overlapping_region(player_coords,
collider_coords);
//todo: make this if customizable
if (region === 'C'){
var area_coords = self.calculate_overlapped_area_coords(
player_coords, collider_coords);
var area = self.calculate_overlapped_area(area_coords);
var collider_data = {
area: area,
area_coords : area_coords,
region: region,
coords: collider_coords,
player_coords: player_coords,
el: $collider
};
self.options.on_overlap.call(this, collider_data);
colliders_coords.push($collider_coords_ins);
colliders_data.push(collider_data);
}
}
this.manage_colliders_start_stop(colliders_coords,
self.options.on_overlap_stop, self.options.on_overlap_start);
this.last_colliders_coords = colliders_coords;
return colliders_data;
};
fn.get_closest_colliders = function(){
var colliders = this.find_collisions();
var min_area = 100;
colliders.sort(function(a, b){
if (a.area <= min_area) {
return 1;
}
/* if colliders are being overlapped by the "C" (center) region,
* we have to set a lower index in the array to which they are placed
* above in the grid. */
if (a.region === 'C' && b.region === 'C') {
if (a.coords.y1 < b.coords.y1 || a.coords.x1 < b.coords.x1) {
return - 1;
}else{
return 1;
}
}
if (a.area < b.area){
return 1;
}
return 1;
});
return colliders;
};
//jQuery adapter
$.fn.collision = function(collider, options) {
return new Collision( this, collider, options );
};
}(jQuery, window, document));

88
src/jquery.coords.js Normal file
View File

@@ -0,0 +1,88 @@
/*
* jquery.coords
* https://github.com/ducksboard/gridster.js
*
* Copyright (c) 2012 ducksboard
* Licensed under the MIT, GPL licenses.
*/
;(function($, window, document, undefined){
/**
* Coords description
*
* @class Coords
* @param {HTMLElement|Object} obj HTMLElement or a literal Object with the left, top, width and height properties.
* @constructor
*/
function Coords(obj) {
if (obj[0] && $.isPlainObject(obj[0])) {
this.data = obj[0];
}else {
this.el = obj;
}
this.isCoords = true;
this.coords = {};
this.init();
return this;
}
var fn = Coords.prototype;
fn.init = function(){
this.set();
this.original_coords = this.get();
};
fn.set = function(update) {
var el = this.el;
if (el) {
this.data = el.offset();
this.data.width || (this.data.width = el.width());
this.data.height || (this.data.height = el.height());
}
var d = this.data;
this.coords.x1 = d.left;
this.coords.y1 = d.top;
this.coords.x2 = d.left + d.width;
this.coords.y2 = d.top + d.height;
this.coords.cx = d.left + (d.width / 2);
this.coords.cy = d.top + (d.height / 2);
this.coords.width = d.width;
this.coords.height = d.height;
this.coords.el = el || false ;
return this;
};
fn.update = function(data){
if (!data && !this.el) {
return this;
}
if (data) {
var new_data = $.extend(this.data, data);
this.data = new_data;
}
this.set(true);
return this;
};
fn.get = function(){
return this.coords;
};
//jQuery adapter
$.fn.coords = function() {
if (this.data('coords') ) {
return this.data('coords');
}
var ins = new Coords(this, arguments[0]);
this.data('coords', ins);
return ins;
};
}(jQuery, window, document));

44
src/jquery.gridster.css Normal file
View File

@@ -0,0 +1,44 @@
.gridster {
position:relative;
}
.gridster > * {
margin: 0 auto;
-webkit-transition: height .4s;
-moz-transition: height .4s;
-o-transition: height .4s;
-ms-transition: height .4s;
transition: height .4s;
}
.gridster .gs_w{
z-index: 2;
position: absolute;
background: rgba(0,0,0,.23);
}
.ready .gs_w:not(.player):not(.preview-holder) {
-webkit-transition: left .3s, top .3s;
-moz-transition: left .3s, top .3s;
-o-transition: left .3s, top .3s;
}
.gridster.dragging .support-grid {
z-index: 5;
}
.gridster.dragging .ui-sortable-helper{
z-index: 10;
}
.gridster .preview-holder {
border: 2px dashed #333 ;
border-radius: 5px;
z-index: 1;
background:#FFF;
position: absolute;
}
.gridster .player {
z-index: 10!important;
}

1959
src/jquery.gridster.js Normal file

File diff suppressed because it is too large Load Diff

68
test/jquery.gridder.html Normal file
View File

@@ -0,0 +1,68 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>gridster.js Test Suite</title>
<!-- Load local jQuery, removing access to $ (use jQuery, not $). -->
<script src="../libs/jquery/jquery.js"></script>
<script>jQuery.noConflict()</script>
<script type="text/javascript" src="../libs/jquery/jquery.js"></script>
<script type="text/javascript" src="../libs/jquery-ui/jquery-ui.js"></script>
<script src="../dist/jquery.gridster.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="../dist/jquery.gridster.css">
<!-- Load local QUnit (grunt requires v1.0.0 or newer). -->
<link rel="stylesheet" href="../libs/qunit/qunit.css" media="screen">
<script src="../libs/qunit/qunit.js"></script>
<!-- Load local lib and tests. -->
<script src="../src/jquery.gridster.js"></script>
<script src="jquery.gridster_test.js"></script>
</head>
<body>
<h1 id="qunit-header">gridster.js Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">
<div class="wrapper">
<ul>
<li data-row="1" data-col="1" data-sizex="2" data-sizey="2"></li>
<li data-row="1" data-col="3" data-sizex="1" data-sizey="2"></li>
<li data-row="1" data-col="4" data-sizex="1" data-sizey="1"></li>
<li data-row="3" data-col="2" data-sizex="3" data-sizey="1"></li>
<li data-row="4" data-col="1" data-sizex="1" data-sizey="1"></li>
<li data-row="3" data-col="1" data-sizex="1" data-sizey="1"></li>
<li data-row="4" data-col="2" data-sizex="1" data-sizey="1"></li>
<li data-row="5" data-col="2" data-sizex="1" data-sizey="1"></li>
<li data-row="4" data-col="4" data-sizex="1" data-sizey="1"></li>
<li data-row="1" data-col="5" data-sizex="1" data-sizey="3"></li>
<li data-row="5" data-col="1" data-sizex="1" data-sizey="2"></li>
<li data-row="4" data-col="3" data-sizex="1" data-sizey="2"></li>
<li data-row="5" data-col="4" data-sizex="1" data-sizey="1"></li>
<li data-row="6" data-col="2" data-sizex="3" data-sizey="1"></li>
<li data-row="4" data-col="5" data-sizex="1" data-sizey="2"></li>
<li data-row="6" data-col="5" data-sizex="1" data-sizey="1"></li>
<li data-row="7" data-col="3" data-sizex="1" data-sizey="1"></li>
</ul>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,38 @@
/*global QUnit:false, module:false, test:false, asyncTest:false, expect:false*/
/*global start:false, stop:false ok:false, equal:false, notEqual:false, deepEqual:false*/
/*global notDeepEqual:false, strictEqual:false, notStrictEqual:false, raises:false*/
(function($) {
/*
======== A Handy Little QUnit Reference ========
http://docs.jquery.com/QUnit
Test methods:
expect(numAssertions)
stop(increment)
start(decrement)
Test assertions:
ok(value, [message])
equal(actual, expected, [message])
notEqual(actual, expected, [message])
deepEqual(actual, expected, [message])
notDeepEqual(actual, expected, [message])
strictEqual(actual, expected, [message])
notStrictEqual(actual, expected, [message])
raises(block, [expected], [message])
*/
module('jQuery#gridster', {
setup: function() {
this.el = $('#qunit-fixture').find(".wrapper ul");
}
});
// test('is chainable', 1, function() {
// // Not a bad test to run on collection methods.
// strictEqual(this.el, this.el.gridster(), 'should be chaninable');
// });
}(jQuery));

437
www/css/style.css Executable file
View File

@@ -0,0 +1,437 @@
/* =============================================================================
NORMALIZATION
========================================================================== */
* {
margin: 0;
padding: 0;
}
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; }
[hidden] { display: none; }
ul, ol {
list-style: none;
}
/* =============================================================================
COMMONS
========================================================================== */
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }
body {
background-color: #EEEEEE;
font-family: 'Helvetica Neue', Arial, sans-serif;
-webkit-font-smoothing: antialiased;
font-size: x-small;
color: #666666;
}
a {
color: #004756;
text-decoration: underline;
font-weight: bold;
}
.wrapper {
margin: 0 auto;
width: 960px;
}
[role='header'] {
padding-top: 78px;
text-align: center;
background: #FFF;
}
.logo,
.logo-small,
.ducksboard-logo {
display: inline-block;
text-indent: -999em;
background-image: url(../img/sprite.png);
background-repeat: no-repeat;
}
.ducksboard-logo {
width: 120px;
height: 18px;
background-position: right bottom;
margin:0 5px;
}
.logo {
width: 300px;
height: 100px;
background-position:20px top;
}
.logo-small {
width: 200px;
height: 60px;
background-position: 14px -110px;
}
.i_download {
background: #FFF;
padding: 1.8em 2.5em;
color: #333;
}
.i_download,
.i_download:before,
.i_download span {
display: inline-block;
vertical-align: middle;
}
.i_download:before {
content: '';
background: url(../img/sprite.png) no-repeat -216px -198px;
height: 50px;
width: 50px;
margin-right: 15px;
}
.i_download:hover {
background-color: #004756;
color: #FFF;
}
.i_download:hover:before {
background-position: -158px -198px;
}
.i_download span {
font-size: 2em;
}
.claim {
font-family: 'Rancho', cursive;
font-weight: normal;
}
[role='header'] .claim {
font-size: 2em;
font-style: italic;
font-weight: normal;
margin-top: -20px;
padding-bottom: 60px;
}
[role='header'] nav li,
[role='header'] nav a {
display: inline-block;
}
[role='header'] nav a {
padding: .6em 1.3em;
background: #F6F6F6;
font-size: 2em;
text-decoration: none;
color: #666666;
background-color: #F6F6F6;
font-weight: bold;
background-color: #EEEEEE;
-webkit-transition: color .3s;
transition: color .3s;
}
[role='header'] nav a:hover {
color: #333;
}
[role='header'] nav .active {
background-color: #EEEEEE;
}
[role='header'] nav .active a {
color: #333333;
}
footer {
margin-top: 70px;
background: #004756;
padding-top: 3.3em;
text-align: center;
}
footer .claim {
font-size: 1.6em;
font-style: italic;
color: #FFF;
margin-top: -16px;
}
footer > p{
margin-top: 2.6em;
background: #FFF;
padding: .8em 0;
color: #333333;
font-weight: bold;
font-size: 1.3em;
}
section header,
.scoped {
margin: 0 38px;
}
.ttr {
text-align: right;
}
section header .m_txt{
margin-top: -2.5em;
padding: 0 0 25px 0;
}
/* Headings */
.heading-xl,
.heading-l,
.heading-m {
color: #333333;
text-shadow: 1px 0 0 #FFF;
padding-bottom: .5em;
}
.heading-xl {
font-size: 3em;
padding:2em 0 1em;
}
.heading-l {
font-size: 2.6em;
}
.heading-m {
font-size: 2.2em;
color: #999999;
}
.heading-m em {
color: #666;
font-weight: normal;
font-size: .8em;
}
/* Mod text */
.m_txt {
padding: 38px;
}
.m_txt p,
.m_txt ul,
.m_txt ol,
.m_txt dl {
font-size: 1.6em;
text-shadow: 1px 0 0 #FFF;
padding-bottom: 2em;
line-height: 1.4em;
}
.m_txt :last-child:not(a) {
padding-bottom: 0;
}
.m_txt .gist {
margin-top: -10px;
margin-bottom: 40px;
font-size: 1.4em;
line-height: 1.3em;
}
.m_txt .heading-xl {
padding-top: 1em;
}
.m_txt dl {
padding-top: 10px;
padding-left: 30px;
}
.m_txt dt {
color: #333;
font-weight: bold;
padding-bottom:.4em;
}
.m_txt dt em{
color: #666666;
font-weight: normal;
font-style: italic;
}
.m_txt dd {
padding-bottom: 1em;
}
.m_txt hr {
margin-bottom: 30px;
border-width: 1px 0 0 0 0;
border-top: 1px solid #CCC;
}
/* tags */
.m_tags {
margin-bottom: 30px;
}
.m_tags li {
padding-bottom:4px;
}
.m_tags li,
.m_tags a {
display: inline-block;
}
.m_tags li {
margin-right: 4px;
}
.m_tags a {
color: #666666;
font-size: 1.6em;
background: #FFF;
padding: .3em .6em;
text-decoration: none;
}
.m_tags a:hover {
color: #FFF;
background-color: #004756;
}
/* Gridster styles */
.demo {
margin: 3em 0;
padding: 7.5em 0 5.5em;
background: #004756;
}
.demo:hover .gridster {
opacity: 1;
}
.gridster {
width: 940px;
margin: 0 auto;
opacity: .8;
-webkit-transition: opacity .6s;
-moz-transition: opacity .6s;
-o-transition: opacity .6s;
-ms-transition: opacity .6s;
transition: opacity .6s;
}
.gridster .gs_w {
background: #FFF;
cursor: pointer;
-webkit-box-shadow: 0 0 5px rgba(0,0,0,0.3);
box-shadow: 0 0 5px rgba(0,0,0,0.3);
}
.gridster .player {
-webkit-box-shadow: 3px 3px 5px rgba(0,0,0,0.3);
box-shadow: 3px 3px 5px rgba(0,0,0,0.3);
}
.gridster .gs_w.try {
background-image: url(../img/sprite.png);
background-repeat: no-repeat;
background-position: 37px -169px;
}
.gridster .preview-holder {
border: none!important;
border-radius: 0!important;
background: rgba(255,255,255,.2)!important;
}
article,
.m_doc_method {
background: #FFF;
}
article:not(:last-child),
.m_doc_method:not(:last-child) {
margin-bottom: 50px;
}
.m_doc_method > h3 {
background-color: #E5E5E5;
padding: 1.4em 2em;
color: #333333;
font-size: 1.8em;
}
.m_doc_method .heading-m {
color: #333333;
}
#intro {
overflow: hidden;
}
#intro .i_download {
margin-top: 100px;
}
#intro > div{
width: 65%;
float: left;
}
#intro {
padding-right: 0;
}
#intro > div:last-child{
width: 32%;
float: right;
}

4
www/css/untitled Normal file
View File

@@ -0,0 +1,4 @@
{
-webkit-box-shadow: 0 0 5px rgba(0,0,0,0.3);
box-shadow: 0 0 5px rgba(0,0,0,0.3);
}

BIN
www/img/sprite.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

4
www/js/libs/jquery-1.7.2.min.js vendored Executable file

File diff suppressed because one or more lines are too long

4
www/js/libs/modernizr-2.5.3.min.js vendored Executable file

File diff suppressed because one or more lines are too long

10
www/js/script.js Executable file
View File

@@ -0,0 +1,10 @@
/* Author:
*/