diff --git a/.npmignore b/.npmignore index b6a4120..642611f 100644 --- a/.npmignore +++ b/.npmignore @@ -1,12 +1,4 @@ -example/ -docs/ -assets/ -spec/ -src/ -vendor/ - .npmignore .gitignore -Cakefile README.md diff --git a/CAKEFILE b/CAKEFILE deleted file mode 100644 index a504861..0000000 --- a/CAKEFILE +++ /dev/null @@ -1,82 +0,0 @@ -{print} = require 'util' -{exec} = require 'child_process' - - -package = "Backpack" - -src_path = "./src" -lib_path = "./lib" -js_path = "#{lib_path}/js" -bndl_path = "#{lib_path}/#{package}-bundle.js" -min_path = "#{lib_path}/#{package}-bundle.min.js" -nm_path = "./node_modules" -bin_path = "#{nm_path}/.bin" -spec_path = "./spec" -spec_lib_path = "#{spec_path}/lib" -spec_src_path = "#{spec_path}/src" -spec_bndl_path = "#{spec_lib_path}/#{package}Spec-bundle.js" - - -run = (command, callback) -> - # executes a command and runs a callback when it's done, - # prints out info while it's doing so - proc = exec command - proc.stdout.on 'data', (data) -> print data.toString() - proc.stderr.on 'data', (data) -> print data.toString() - proc.on 'exit', (status) -> callback?() if status is 0 - -# ---------------------------------- -# Commands -# ---------------------------------- - -compile = (watch, callback) -> - # creates /lib_path/js - run "#{bin_path}/coffee -co #{js_path} #{src_path}", callback - -watchJS = (callback) -> - # recompiles /src_path to individual JavaScript files in /lib_path/js - run "#{bin_path}/coffee -wco #{js_path} #{src_path}", callback - -watchBundle = (callback) -> - # recompiles and joins /src_path to /lib_path - run "#{bin_path}/coffee -j #{bndl_path} -wco #{lib_path} #{src_path}", callback - -watchSpecBundle = (callback) -> - run "#{bin_path}/coffee -j #{spec_bndl_path} -wco #{spec_path} #{spec_src_path}", callback - -bundle = (callback) -> - # creates /lib_path/Backpack-bundle.js - run "#{bin_path}/coffee -j #{bndl_path} -co #{lib_path} #{src_path}", callback - -minify = (callback) -> - # creates /lib_path/Backpack-bundle.min.js - run "#{bin_path}/uglifyjs -o #{min_path} #{bndl_path}", callback - -test = (callback) -> - run "open #{spec_path}/SpecRunner.html", callback - -docs = (callback) -> - run "#{bin_path}/docco #{src_path}/*.coffee", callback - - -# ---------------------------------- -# Tasks -# ---------------------------------- - -task 'compile', 'Compile CoffeeScript source files', -> - compile() - -task 'build', "Creates /lib_path/Backpack-bundle.js & /lib_path/Backpack-bundle.min.js & /lib_path/js/*.js", -> - compile(bundle(minify)) - -task 'test', "Opens Jasmine SpecRunner. Watches BackpackSpec-Bundle.js for changes", -> - bundle(test(watchSpecBundle)) - -task 'docs', 'Generate annotated source code with Docco', -> - docs() - -task 'watch', "Recompile CoffeeScript source files when modified to Backpack-bundle.js", -> - watchBundle() - -task 'watch:js', "Recompile CoffeeScript source files when modified to individual .js files", -> - watchJS() \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 63b5381..0000000 --- a/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2012 Airbnb, Inc. - -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. \ No newline at end of file diff --git a/README.md b/README.md index e67ae3e..8b31333 100644 --- a/README.md +++ b/README.md @@ -1,53 +1 @@ - ______ _ _ _ | - | ___ \ | | | | (_) | A pack of UI components for Backbone projects. - | |_/ / __ _ ___| | ___ __ __ _ ___| | __ _ ___ | Grab your backpack and enjoy the Views. - | ___ \/ _` |/ __| |/ / '_ \ / _` |/ __| |/ / | / __| | - | |_/ / (_| | (__| <| |_) | (_| | (__| < _| \__ \ | - \____/ \__,_|\___|_|\_\ .__/ \__,_|\___|_|\_(_) |___/ | - | | _/ | | - |_| |__/ | - - - -### Visit the [Backpack.js User Guide](http://airbnb.github.com/backpack.js/) - - - - -## Quick Start - -1. `git clone git@github.com:airbnb/backpack.js.git` -1. `cd backpack.js && open example/index.html` - - ----------------------------- - - -## Hack on Backpack - -### Quick Start - -1. `git clone git@github.com:airbnb/backpack.js.git` -1. `cd backpack.js && npm install` - - -### Cake Build Tools - -The Cakefile defines the following tasks: - - cake compile # Compile CoffeeScript source files - cake build # Creates /lib_path/Backpack-bundle.js & /lib_path/Backpack-bundle.min.js & /lib_path/js/*.js - cake test # Opens Jasmine SpecRunner. Watches BackpackSpec-Bundle.js for changes - cake docs # Generate annotated source code with Docco - cake watch # Recompile CoffeeScript source files when modified to Backpack-bundle.js - cake watch:js # Recompile CoffeeScript source files when modified to individual .js files - - -### Testing - -Backpack.js tests are written using [jasmine](http://pivotal.github.com/jasmine/) with [sinon.js](https://github.com/cjohansen/Sinon.JS) and [jasmine-sinon](https://github.com/froots/jasmine-sinon). - -You can run the test suite with `cake test`. - - - +# Backpack diff --git a/assets/css/docs.css b/assets/css/docs.css deleted file mode 100644 index 1641623..0000000 --- a/assets/css/docs.css +++ /dev/null @@ -1,418 +0,0 @@ -* { - margin: 0; - padding: 0; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -p { - font-size: 16px; - line-height: 1.4em; - margin-bottom: 15px; -} - -a { - color: #888; -} - -pre { - font-family: monaco, monospace; - font-size: 14px; -} - -footer { - color: #999; - text-align: center; - padding: 100px 0 40px; -} - -footer p { - font-size: 14px; - line-height: 1em; -} - -.center { - text-align: center; -} - -.description { - position: relative; -} - -.description > p { - font-size: 14px; - margin-top: 20px; -} - -.logo { - display: block; - text-align: center; - margin: 40px 0 70px 0; -} - -.chrome { - background: #ececec; /* Old browsers */ - background: -moz-linear-gradient(top, #f6f6f6 0%, #e6e6e6 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fcfcfc), color-stop(100%,#e6e6e6)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #f6f6f6 0%,#e6e6e6 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #fcfcfc 0%,#e6e6e6 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #fcfcfc 0%,#e6e6e6 100%); /* IE10+ */ - background: linear-gradient(top, #fcfcfc 0%,#e6e6e6 100%); /* W3C */ - -webkit-box-shadow: inset 0 0 6px 0 rgba(255,255,255,0.9), - inset 0 1px 0 0 white, - inset 0 -1px 3px rgba(0,0,0,0.1); - -moz-box-shadow: inset 0 0 6px 0 rgba(255,255,255,0.9), - inset 0 1px 0 0 white, - inset 0 -1px 3px rgba(0,0,0,0.1); - -ms-box-shadow: inset 0 0 6px 0 rgba(255,255,255,0.9), - inset 0 1px 0 0 white, - inset 0 -1px 3px rgba(0,0,0,0.1); - -o-box-shadow: inset 0 0 6px 0 rgba(255,255,255,0.9), - inset 0 1px 0 0 white, - inset 0 -1px 3px rgba(0,0,0,0.1); - box-shadow: inset 0 0 6px 0 rgba(255,255,255,0.9), - inset 0 1px 0 0 white, - inset 0 -1px 3px rgba(0,0,0,0.1); - text-shadow: 0 1px white; -} - -.download, .fork { - display: block; - float: left; - margin-right: 17px; -} - -.component ul { - list-style: none; -} - -.component li { - float: left; - margin: 4px 8px 4px 0; -} - -.component pre { - background-color: #F7F7F9; - border: 1px solid #E1E1E7; - display: inline-block; - padding: 2px 5px; - color: #229695; - -webkit-border-radius: 3px; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - border-radius: 3px; -} - -pre.inline { - background-color: #F7F7F9; - border: 1px solid #E1E1E7; - display: inline; - padding: 2px 5px; - color: #229695; - -webkit-border-radius: 3px; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - border-radius: 3px; -} - -button, -a.button { - font-size: 1.54em; - font-weight: 400; - padding: 0.5em 1.1em; - font-weight: bold; -} - -.tk-league-gothic { - font-weight: 400; - text-transform: uppercase; -} - -#sidebar { - width: 200px; - height: 100%; - top: 0; - left: 0; - position: fixed; - padding: 0 25px; - overflow: auto; - background-color: #FFF; - border-right: 1px solid #ddd; - -webkit-box-shadow: inset -2px 0 8px rgba(0,0,0,0.2); - -moz-box-shadow: inset -2px 0 8px rgba(0,0,0,0.2); - -ms-box-shadow: inset -2px 0 8px rgba(0,0,0,0.2); - -o-box-shadow: inset -2px 0 8px rgba(0,0,0,0.2); - box-shadow: inset -2px 0 8px rgba(0,0,0,0.2); -} - -#sidebar h4 { - text-align: center; - margin-bottom: 20px; -} - -#guideContainer { - margin-left: 200px; - background-color: #f8f8f8; -} - -#guide { - width: 580px; - height: 100%; - margin: 0 0 0 80px; -} - -.backpack-tabs { - border: 1px solid #ddd; - padding-top: 7px; - padding-left: 7px; -} - -.backpack-tab-content { - padding: 10px 10px 0; -} - -.code { - padding: 20px 20px 0; -} - -.tab-code .backpack-tab-content { - padding-bottom: 10px; -} - -.backpack-tab-content button { - font-size: 23px; - padding: 5px 25px; - margin: 10px 0 10px 0; - float: right; -} - -#sidebar .backpack-list > li, -#sidebar .backpack-list .backpack-menu-item { - float: none; - border: none; - font-size: 15px; -} - - -#sidebar .backpack-list > li > a, -#sidebar .backpack-list .backpack-menu-item a { - color: #444; - font-weight: normal; - padding: 10px 0; - display: block; - vertical-align: middle; - text-decoration: none; - border: none; - width: 100%; -} - -#sidebar .backpack-list > li > ul { - display: block; - margin-top: 5px; - margin-bottom: 15px; -} - -#sidebar .backpack-menu-item > .backpack-list > .backpack-menu-item > a { - font-weight: normal; - color: #999; - padding: 3px 3px 3px 0; - font-size: 13px; -} - -.sidebar-overview > a, -.sidebar-contribute > a { - border-bottom: 1px dotted #ddd !important; - margin-bottom: 10px !important; - padding-bottom: 7px !important; -} - -.sidebar-logo { - right: 68px; - position: absolute; - bottom: 18px; -} - -#sidebar .backpack-list > .sidebar-logo a { - padding: 0; -} - -#header { - background: url('../img/backpack-logo.png') no-repeat 15px 30px; - width: 650px; - padding-top: 40px; - position: relative; - padding-bottom: 15px; - padding-left: 263px; -} - -.big-h1 { - font-size: 55px; - color: #444; -} - -.big-h2 { - font-size: 28px; - color: #999; - margin-top: 10px; -} - -.big-h3 { - color: #999; - font-weight: normal; - margin-top: 15px; - font-size: 18px; -} - -.w310 { - width: 310px; -} - -.github-social { - margin: 20px 0 30px; -} - -.title-h3 { - color: #333637; - font-size: 30px; - margin-bottom: 15px; -} - -.title-h4 { - color: #333637; - font-size: 20px; - margin-top: 40px; - display: block; - border-bottom: 1px dotted rgba(0,0,0,0.1); - padding-bottom: 10px; -} - -.top-20 { - margin-top: 20px; -} - -.bottom-60 { - margin-bottom: 60px; -} - -.padding-20 { - padding: 20px; -} - -.code p { - color: #999; -} - -button.orange, -a.button.orange { - color: #FFF; - text-shadow: 0 -1px 0 rgba(0,0,0,0.3); - background: #FF4519; /* Old browsers */ - background: -moz-linear-gradient(top, #A2A9AF 0%, #536473 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#A2A9AF), color-stop(100%,#536473)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #A2A9AF 0%,#536473 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #A2A9AF 0%,#536473 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #A2A9AF 0%,#536473 100%); /* IE10+ */ - background: linear-gradient(top, #A2A9AF 0%,#536473 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#A2A9AF', endColorstr='#536473',GradientType=0 ); /* IE6-9 */ - -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 3px 0.5px rgba(0,0,0,0.3); - -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 3px 0.5px rgba(0,0,0,0.3); - -ms-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 3px 0.5px rgba(0,0,0,0.3); - -o-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 3px 0.5px rgba(0,0,0,0.3); - box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 3px 0.5px rgba(0,0,0,0.3); -} - -button.orange:hover, -button:focus, -a.button.orange:hover, -a.button.orange:focus { - background: #FF4519; /* Old browsers */ - background: -moz-linear-gradient(top, #A2A9AF 0%, #536473 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#FF4519), color-stop(100%,#536473)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #A2A9AF 0%,#536473 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #A2A9AF 0%,#536473 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #A2A9AF 0%,#536473 100%); /* IE10+ */ - background: linear-gradient(top, #A2A9AF 0%,#536473 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#A2A9AF', endColorstr='#536473',GradientType=0 ); /* IE6-9 */ - -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 2px 0.5px rgba(0,0,0,0.2); - -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 2px 0.5px rgba(0,0,0,0.2); - -ms-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 2px 0.5px rgba(0,0,0,0.2); - -o-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 2px 0.5px rgba(0,0,0,0.2); - box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 2px 0.5px rgba(0,0,0,0.2); -} - -button.orange:active, -a.button.orange:active { - color: #FFF; - text-shadow: 0 -1px 0 rgba(0,0,0,0.3); - background: #FF4519; /* Old browsers */ - background: -moz-linear-gradient(top, #536473 0%, #A2A9AF 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#536473), color-stop(100%,#A2A9AF)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #536473 0%,#A2A9AF 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #536473 0%,#A2A9AF 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #536473 0%,#A2A9AF 100%); /* IE10+ */ - background: linear-gradient(top, #536473 0%,#A2A9AF 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#A2A9AF', endColorstr='#536473',GradientType=0 ); /* IE6-9 */ - -webkit-box-shadow: inset -2px 0 8px rgba(0,0,0,0.2); - -moz-box-shadow: inset -2px 0 8px rgba(0,0,0,0.2); - -ms-box-shadow: inset -2px 0 8px rgba(0,0,0,0.2); - -o-box-shadow: inset -2px 0 8px rgba(0,0,0,0.2); - box-shadow: inset -2px 0 8px rgba(0,0,0,0.2); -} - -table { - width: 100%; - color: #444; - background: #FFF; - border-collapse:collapse; -} - -thead { - font-weight: bold; -} - -thead td { - color: #666; - padding: 10px; - text-shadow: 0 1px white; -} - - -td { - padding: 5px; - border: 1px solid #ddd; -} \ No newline at end of file diff --git a/assets/css/prettify.css b/assets/css/prettify.css deleted file mode 100644 index ab2ccce..0000000 --- a/assets/css/prettify.css +++ /dev/null @@ -1,30 +0,0 @@ -.com { color: #93a1a1; } -.lit { color: #195f91; } -.pun, .opn, .clo { color: #93a1a1; } -.fun { color: #dc322f; } -.str, .atv { color: #D14; } -.kwd, .linenums .tag { color: #1e347b; } -.typ, .atn, .dec, .var { color: teal; } -.pln { color: #48484c; } - -.prettyprint { - padding: 8px; - background-color: #f7f7f9; - border: 1px solid #e1e1e8; -} -.prettyprint.linenums { - -webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; - -moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; - box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0; -} - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin: 0 0 0 33px; /* IE indents via margin-left */ -} -ol.linenums li { - padding-left: 12px; - color: #bebec5; - line-height: 18px; - text-shadow: 0 1px 0 #fff; -} diff --git a/assets/img/backpack-icon.png b/assets/img/backpack-icon.png deleted file mode 100644 index eef20c4..0000000 Binary files a/assets/img/backpack-icon.png and /dev/null differ diff --git a/assets/img/backpack-logo.png b/assets/img/backpack-logo.png deleted file mode 100644 index 06a5d41..0000000 Binary files a/assets/img/backpack-logo.png and /dev/null differ diff --git a/assets/img/swipe/1.jpg b/assets/img/swipe/1.jpg deleted file mode 100644 index c27a325..0000000 Binary files a/assets/img/swipe/1.jpg and /dev/null differ diff --git a/assets/img/swipe/10.jpg b/assets/img/swipe/10.jpg deleted file mode 100644 index b193711..0000000 Binary files a/assets/img/swipe/10.jpg and /dev/null differ diff --git a/assets/img/swipe/11.jpg b/assets/img/swipe/11.jpg deleted file mode 100644 index 9f13754..0000000 Binary files a/assets/img/swipe/11.jpg and /dev/null differ diff --git a/assets/img/swipe/2.jpg b/assets/img/swipe/2.jpg deleted file mode 100644 index ad1677a..0000000 Binary files a/assets/img/swipe/2.jpg and /dev/null differ diff --git a/assets/img/swipe/3.jpg b/assets/img/swipe/3.jpg deleted file mode 100644 index 204f2ef..0000000 Binary files a/assets/img/swipe/3.jpg and /dev/null differ diff --git a/assets/img/swipe/4.jpg b/assets/img/swipe/4.jpg deleted file mode 100644 index 3a1a59a..0000000 Binary files a/assets/img/swipe/4.jpg and /dev/null differ diff --git a/assets/img/swipe/5.jpg b/assets/img/swipe/5.jpg deleted file mode 100644 index c9cf55a..0000000 Binary files a/assets/img/swipe/5.jpg and /dev/null differ diff --git a/assets/img/swipe/6.jpg b/assets/img/swipe/6.jpg deleted file mode 100644 index 50dabf2..0000000 Binary files a/assets/img/swipe/6.jpg and /dev/null differ diff --git a/assets/img/swipe/7.jpg b/assets/img/swipe/7.jpg deleted file mode 100644 index 4217da3..0000000 Binary files a/assets/img/swipe/7.jpg and /dev/null differ diff --git a/assets/img/swipe/8.jpg b/assets/img/swipe/8.jpg deleted file mode 100644 index cb91ae3..0000000 Binary files a/assets/img/swipe/8.jpg and /dev/null differ diff --git a/assets/img/swipe/9.jpg b/assets/img/swipe/9.jpg deleted file mode 100644 index b1a104a..0000000 Binary files a/assets/img/swipe/9.jpg and /dev/null differ diff --git a/assets/js/lang-apollo.js b/assets/js/lang-apollo.js deleted file mode 100644 index 7098baf..0000000 --- a/assets/js/lang-apollo.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["com",/^#[^\n\r]*/,null,"#"],["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \xa0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,null,'"']],[["kwd",/^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/, -null],["typ",/^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[ES]?BANK=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],["lit",/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[!-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["apollo","agc","aea"]); diff --git a/assets/js/lang-clj.js b/assets/js/lang-clj.js deleted file mode 100644 index 542a220..0000000 --- a/assets/js/lang-clj.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - Copyright (C) 2011 Google Inc. - - 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. -*/ -var a=null; -PR.registerLangHandler(PR.createSimpleLexer([["opn",/^[([{]+/,a,"([{"],["clo",/^[)\]}]+/,a,")]}"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \xa0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:def|if|do|let|quote|var|fn|loop|recur|throw|try|monitor-enter|monitor-exit|defmacro|defn|defn-|macroexpand|macroexpand-1|for|doseq|dosync|dotimes|and|or|when|not|assert|doto|proxy|defstruct|first|rest|cons|defprotocol|deftype|defrecord|reify|defmulti|defmethod|meta|with-meta|ns|in-ns|create-ns|import|intern|refer|alias|namespace|resolve|ref|deref|refset|new|set!|memfn|to-array|into-array|aset|gen-class|reduce|map|filter|find|nil?|empty?|hash-map|hash-set|vec|vector|seq|flatten|reverse|assoc|dissoc|list|list?|disj|get|union|difference|intersection|extend|extend-type|extend-protocol|prn)\b/,a], -["typ",/^:[\dA-Za-z-]+/]]),["clj"]); diff --git a/assets/js/lang-css.js b/assets/js/lang-css.js deleted file mode 100644 index 041e1f5..0000000 --- a/assets/js/lang-css.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\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]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", -/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/assets/js/lang-go.js b/assets/js/lang-go.js deleted file mode 100644 index fc18dc0..0000000 --- a/assets/js/lang-go.js +++ /dev/null @@ -1 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \xa0"],["pln",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])+(?:'|$)|`[^`]*(?:`|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\n\r]*|\/\*[\S\s]*?\*\/)/],["pln",/^(?:[^"'/`]|\/(?![*/]))+/]]),["go"]); diff --git a/assets/js/lang-hs.js b/assets/js/lang-hs.js deleted file mode 100644 index 9d77b08..0000000 --- a/assets/js/lang-hs.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t-\r ]+/,null,"\t\n \r "],["str",/^"(?:[^\n\f\r"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["str",/^'(?:[^\n\f\r'\\]|\\[^&])'?/,null,"'"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,null,"0123456789"]],[["com",/^(?:--+[^\n\f\r]*|{-(?:[^-]|-+[^}-])*-})/],["kwd",/^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^\d'A-Za-z]|$)/, -null],["pln",/^(?:[A-Z][\w']*\.)*[A-Za-z][\w']*/],["pun",/^[^\d\t-\r "'A-Za-z]+/]]),["hs"]); diff --git a/assets/js/lang-lisp.js b/assets/js/lang-lisp.js deleted file mode 100644 index 02a30e8..0000000 --- a/assets/js/lang-lisp.js +++ /dev/null @@ -1,3 +0,0 @@ -var a=null; -PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,a,"("],["clo",/^\)+/,a,")"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \xa0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,a], -["lit",/^[+-]?(?:[#0]x[\da-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[de][+-]?\d+)?)/i],["lit",/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[_a-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/i],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["cl","el","lisp","scm"]); diff --git a/assets/js/lang-lua.js b/assets/js/lang-lua.js deleted file mode 100644 index e83a3c4..0000000 --- a/assets/js/lang-lua.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \xa0"],["str",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$))/,null,"\"'"]],[["com",/^--(?:\[(=*)\[[\S\s]*?(?:]\1]|$)|[^\n\r]*)/],["str",/^\[(=*)\[[\S\s]*?(?:]\1]|$)/],["kwd",/^(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,null],["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i], -["pln",/^[_a-z]\w*/i],["pun",/^[^\w\t\n\r \xa0][^\w\t\n\r "'+=\xa0-]*/]]),["lua"]); diff --git a/assets/js/lang-ml.js b/assets/js/lang-ml.js deleted file mode 100644 index 6df02d7..0000000 --- a/assets/js/lang-ml.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \xa0"],["com",/^#(?:if[\t\n\r \xa0]+(?:[$_a-z][\w']*|``[^\t\n\r`]*(?:``|$))|else|endif|light)/i,null,"#"],["str",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])(?:'|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\n\r]*|\(\*[\S\s]*?\*\))/],["kwd",/^(?:abstract|and|as|assert|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|if|in|inherit|inline|interface|internal|lazy|let|match|member|module|mutable|namespace|new|null|of|open|or|override|private|public|rec|return|static|struct|then|to|true|try|type|upcast|use|val|void|when|while|with|yield|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|global|include|method|mixin|object|parallel|process|protected|pure|sealed|trait|virtual|volatile)\b/], -["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i],["pln",/^(?:[_a-z][\w']*[!#?]?|``[^\t\n\r`]*(?:``|$))/i],["pun",/^[^\w\t\n\r "'\xa0]+/]]),["fs","ml"]); diff --git a/assets/js/lang-n.js b/assets/js/lang-n.js deleted file mode 100644 index 6c2e85b..0000000 --- a/assets/js/lang-n.js +++ /dev/null @@ -1,4 +0,0 @@ -var a=null; -PR.registerLangHandler(PR.createSimpleLexer([["str",/^(?:'(?:[^\n\r'\\]|\\.)*'|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,a,'"'],["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,a,"#"],["pln",/^\s+/,a," \r\n\t\xa0"]],[["str",/^@"(?:[^"]|"")*(?:"|$)/,a],["str",/^<#[^#>]*(?:#>|$)/,a],["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,a],["com",/^\/\/[^\n\r]*/,a],["com",/^\/\*[\S\s]*?(?:\*\/|$)/, -a],["kwd",/^(?:abstract|and|as|base|catch|class|def|delegate|enum|event|extern|false|finally|fun|implements|interface|internal|is|macro|match|matches|module|mutable|namespace|new|null|out|override|params|partial|private|protected|public|ref|sealed|static|struct|syntax|this|throw|true|try|type|typeof|using|variant|virtual|volatile|when|where|with|assert|assert2|async|break|checked|continue|do|else|ensures|for|foreach|if|late|lock|new|nolate|otherwise|regexp|repeat|requires|return|surroundwith|unchecked|unless|using|while|yield)\b/, -a],["typ",/^(?:array|bool|byte|char|decimal|double|float|int|list|long|object|sbyte|short|string|ulong|uint|ufloat|ulong|ushort|void)\b/,a],["lit",/^@[$_a-z][\w$@]*/i,a],["typ",/^@[A-Z]+[a-z][\w$@]*/,a],["pln",/^'?[$_a-z][\w$@]*/i,a],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,a,"0123456789"],["pun",/^.[^\s\w"-$'./@`]*/,a]]),["n","nemerle"]); diff --git a/assets/js/lang-proto.js b/assets/js/lang-proto.js deleted file mode 100644 index f006ad8..0000000 --- a/assets/js/lang-proto.js +++ /dev/null @@ -1 +0,0 @@ -PR.registerLangHandler(PR.sourceDecorator({keywords:"bytes,default,double,enum,extend,extensions,false,group,import,max,message,option,optional,package,repeated,required,returns,rpc,service,syntax,to,true",types:/^(bool|(double|s?fixed|[su]?int)(32|64)|float|string)\b/,cStyleComments:!0}),["proto"]); diff --git a/assets/js/lang-scala.js b/assets/js/lang-scala.js deleted file mode 100644 index 60d034d..0000000 --- a/assets/js/lang-scala.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \xa0"],["str",/^"(?:""(?:""?(?!")|[^"\\]|\\.)*"{0,3}|(?:[^\n\r"\\]|\\.)*"?)/,null,'"'],["lit",/^`(?:[^\n\r\\`]|\\.)*`?/,null,"`"],["pun",/^[!#%&(--:-@[-^{-~]+/,null,"!#%&()*+,-:;<=>?@[\\]^{|}~"]],[["str",/^'(?:[^\n\r'\\]|\\(?:'|[^\n\r']+))'/],["lit",/^'[$A-Z_a-z][\w$]*(?![\w$'])/],["kwd",/^(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|object|override|package|private|protected|requires|return|sealed|super|throw|trait|try|type|val|var|while|with|yield)\b/], -["lit",/^(?:true|false|null|this)\b/],["lit",/^(?:0(?:[0-7]+|x[\da-f]+)l?|(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:e[+-]?\d+)?f?|l?)|\\.\d+(?:e[+-]?\d+)?f?)/i],["typ",/^[$_]*[A-Z][\d$A-Z_]*[a-z][\w$]*/],["pln",/^[$A-Z_a-z][\w$]*/],["com",/^\/(?:\/.*|\*(?:\/|\**[^*/])*(?:\*+\/?)?)/],["pun",/^(?:\.+|\/)/]]),["scala"]); diff --git a/assets/js/lang-sql.js b/assets/js/lang-sql.js deleted file mode 100644 index da705b0..0000000 --- a/assets/js/lang-sql.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \xa0"],["str",/^(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/,null,"\"'"]],[["com",/^(?:--[^\n\r]*|\/\*[\S\s]*?(?:\*\/|$))/],["kwd",/^(?:add|all|alter|and|any|as|asc|authorization|backup|begin|between|break|browse|bulk|by|cascade|case|check|checkpoint|close|clustered|coalesce|collate|column|commit|compute|constraint|contains|containstable|continue|convert|create|cross|current|current_date|current_time|current_timestamp|current_user|cursor|database|dbcc|deallocate|declare|default|delete|deny|desc|disk|distinct|distributed|double|drop|dummy|dump|else|end|errlvl|escape|except|exec|execute|exists|exit|fetch|file|fillfactor|for|foreign|freetext|freetexttable|from|full|function|goto|grant|group|having|holdlock|identity|identitycol|identity_insert|if|in|index|inner|insert|intersect|into|is|join|key|kill|left|like|lineno|load|match|merge|national|nocheck|nonclustered|not|null|nullif|of|off|offsets|on|open|opendatasource|openquery|openrowset|openxml|option|or|order|outer|over|percent|plan|precision|primary|print|proc|procedure|public|raiserror|read|readtext|reconfigure|references|replication|restore|restrict|return|revoke|right|rollback|rowcount|rowguidcol|rule|save|schema|select|session_user|set|setuser|shutdown|some|statistics|system_user|table|textsize|then|to|top|tran|transaction|trigger|truncate|tsequal|union|unique|update|updatetext|use|user|using|values|varying|view|waitfor|when|where|while|with|writetext)(?=[^\w-]|$)/i, -null],["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i],["pln",/^[_a-z][\w-]*/i],["pun",/^[^\w\t\n\r "'\xa0][^\w\t\n\r "'+\xa0-]*/]]),["sql"]); diff --git a/assets/js/lang-tex.js b/assets/js/lang-tex.js deleted file mode 100644 index ce96fbb..0000000 --- a/assets/js/lang-tex.js +++ /dev/null @@ -1 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \xa0"],["com",/^%[^\n\r]*/,null,"%"]],[["kwd",/^\\[@-Za-z]+/],["kwd",/^\\./],["typ",/^[$&]/],["lit",/[+-]?(?:\.\d+|\d+(?:\.\d*)?)(cm|em|ex|in|pc|pt|bp|mm)/i],["pun",/^[()=[\]{}]+/]]),["latex","tex"]); diff --git a/assets/js/lang-vb.js b/assets/js/lang-vb.js deleted file mode 100644 index 07506b0..0000000 --- a/assets/js/lang-vb.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0\u2028\u2029]+/,null,"\t\n\r \xa0

"],["str",/^(?:["\u201c\u201d](?:[^"\u201c\u201d]|["\u201c\u201d]{2})(?:["\u201c\u201d]c|$)|["\u201c\u201d](?:[^"\u201c\u201d]|["\u201c\u201d]{2})*(?:["\u201c\u201d]|$))/i,null,'"“”'],["com",/^['\u2018\u2019].*/,null,"'‘’"]],[["kwd",/^(?:addhandler|addressof|alias|and|andalso|ansi|as|assembly|auto|boolean|byref|byte|byval|call|case|catch|cbool|cbyte|cchar|cdate|cdbl|cdec|char|cint|class|clng|cobj|const|cshort|csng|cstr|ctype|date|decimal|declare|default|delegate|dim|directcast|do|double|each|else|elseif|end|endif|enum|erase|error|event|exit|finally|for|friend|function|get|gettype|gosub|goto|handles|if|implements|imports|in|inherits|integer|interface|is|let|lib|like|long|loop|me|mod|module|mustinherit|mustoverride|mybase|myclass|namespace|new|next|not|notinheritable|notoverridable|object|on|option|optional|or|orelse|overloads|overridable|overrides|paramarray|preserve|private|property|protected|public|raiseevent|readonly|redim|removehandler|resume|return|select|set|shadows|shared|short|single|static|step|stop|string|structure|sub|synclock|then|throw|to|try|typeof|unicode|until|variant|wend|when|while|with|withevents|writeonly|xor|endif|gosub|let|variant|wend)\b/i, -null],["com",/^rem.*/i],["lit",/^(?:true\b|false\b|nothing\b|\d+(?:e[+-]?\d+[dfr]?|[dfilrs])?|(?:&h[\da-f]+|&o[0-7]+)[ils]?|\d*\.\d+(?:e[+-]?\d+)?[dfr]?|#\s+(?:\d+[/-]\d+[/-]\d+(?:\s+\d+:\d+(?::\d+)?(\s*(?:am|pm))?)?|\d+:\d+(?::\d+)?(\s*(?:am|pm))?)\s+#)/i],["pln",/^(?:(?:[a-z]|_\w)\w*|\[(?:[a-z]|_\w)\w*])/i],["pun",/^[^\w\t\n\r "'[\]\xa0\u2018\u2019\u201c\u201d\u2028\u2029]+/],["pun",/^(?:\[|])/]]),["vb","vbs"]); diff --git a/assets/js/lang-vhdl.js b/assets/js/lang-vhdl.js deleted file mode 100644 index 128b5b6..0000000 --- a/assets/js/lang-vhdl.js +++ /dev/null @@ -1,3 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \xa0"]],[["str",/^(?:[box]?"(?:[^"]|"")*"|'.')/i],["com",/^--[^\n\r]*/],["kwd",/^(?:abs|access|after|alias|all|and|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|constant|disconnect|downto|else|elsif|end|entity|exit|file|for|function|generate|generic|group|guarded|if|impure|in|inertial|inout|is|label|library|linkage|literal|loop|map|mod|nand|new|next|nor|not|null|of|on|open|or|others|out|package|port|postponed|procedure|process|pure|range|record|register|reject|rem|report|return|rol|ror|select|severity|shared|signal|sla|sll|sra|srl|subtype|then|to|transport|type|unaffected|units|until|use|variable|wait|when|while|with|xnor|xor)(?=[^\w-]|$)/i, -null],["typ",/^(?:bit|bit_vector|character|boolean|integer|real|time|string|severity_level|positive|natural|signed|unsigned|line|text|std_u?logic(?:_vector)?)(?=[^\w-]|$)/i,null],["typ",/^'(?:active|ascending|base|delayed|driving|driving_value|event|high|image|instance_name|last_active|last_event|last_value|left|leftof|length|low|path_name|pos|pred|quiet|range|reverse_range|right|rightof|simple_name|stable|succ|transaction|val|value)(?=[^\w-]|$)/i,null],["lit",/^\d+(?:_\d+)*(?:#[\w.\\]+#(?:[+-]?\d+(?:_\d+)*)?|(?:\.\d+(?:_\d+)*)?(?:e[+-]?\d+(?:_\d+)*)?)/i], -["pln",/^(?:[a-z]\w*|\\[^\\]*\\)/i],["pun",/^[^\w\t\n\r "'\xa0][^\w\t\n\r "'\xa0-]*/]]),["vhdl","vhd"]); diff --git a/assets/js/lang-wiki.js b/assets/js/lang-wiki.js deleted file mode 100644 index 9b0b448..0000000 --- a/assets/js/lang-wiki.js +++ /dev/null @@ -1,2 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\d\t a-gi-z\xa0]+/,null,"\t \xa0abcdefgijklmnopqrstuvwxyz0123456789"],["pun",/^[*=[\]^~]+/,null,"=*~^[]"]],[["lang-wiki.meta",/(?:^^|\r\n?|\n)(#[a-z]+)\b/],["lit",/^[A-Z][a-z][\da-z]+[A-Z][a-z][^\W_]+\b/],["lang-",/^{{{([\S\s]+?)}}}/],["lang-",/^`([^\n\r`]+)`/],["str",/^https?:\/\/[^\s#/?]*(?:\/[^\s#?]*)?(?:\?[^\s#]*)?(?:#\S*)?/i],["pln",/^(?:\r\n|[\S\s])[^\n\r#*=A-[^`h{~]*/]]),["wiki"]); -PR.registerLangHandler(PR.createSimpleLexer([["kwd",/^#[a-z]+/i,null,"#"]],[]),["wiki.meta"]); diff --git a/assets/js/lang-xq.js b/assets/js/lang-xq.js deleted file mode 100644 index e323ae3..0000000 --- a/assets/js/lang-xq.js +++ /dev/null @@ -1,3 +0,0 @@ -PR.registerLangHandler(PR.createSimpleLexer([["var pln",/^\$[\w-]+/,null,"$"]],[["pln",/^[\s=][<>][\s=]/],["lit",/^@[\w-]+/],["tag",/^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["com",/^\(:[\S\s]*?:\)/],["pln",/^[(),/;[\]{}]$/],["str",/^(?:"(?:[^"\\{]|\\[\S\s])*(?:"|$)|'(?:[^'\\{]|\\[\S\s])*(?:'|$))/,null,"\"'"],["kwd",/^(?:xquery|where|version|variable|union|typeswitch|treat|to|then|text|stable|sortby|some|self|schema|satisfies|returns|return|ref|processing-instruction|preceding-sibling|preceding|precedes|parent|only|of|node|namespace|module|let|item|intersect|instance|in|import|if|function|for|follows|following-sibling|following|external|except|every|else|element|descending|descendant-or-self|descendant|define|default|declare|comment|child|cast|case|before|attribute|assert|ascending|as|ancestor-or-self|ancestor|after|eq|order|by|or|and|schema-element|document-node|node|at)\b/], -["typ",/^(?:xs:yearMonthDuration|xs:unsignedLong|xs:time|xs:string|xs:short|xs:QName|xs:Name|xs:long|xs:integer|xs:int|xs:gYearMonth|xs:gYear|xs:gMonthDay|xs:gDay|xs:float|xs:duration|xs:double|xs:decimal|xs:dayTimeDuration|xs:dateTime|xs:date|xs:byte|xs:boolean|xs:anyURI|xf:yearMonthDuration)\b/,null],["fun pln",/^(?:xp:dereference|xinc:node-expand|xinc:link-references|xinc:link-expand|xhtml:restructure|xhtml:clean|xhtml:add-lists|xdmp:zip-manifest|xdmp:zip-get|xdmp:zip-create|xdmp:xquery-version|xdmp:word-convert|xdmp:with-namespaces|xdmp:version|xdmp:value|xdmp:user-roles|xdmp:user-last-login|xdmp:user|xdmp:url-encode|xdmp:url-decode|xdmp:uri-is-file|xdmp:uri-format|xdmp:uri-content-type|xdmp:unquote|xdmp:unpath|xdmp:triggers-database|xdmp:trace|xdmp:to-json|xdmp:tidy|xdmp:subbinary|xdmp:strftime|xdmp:spawn-in|xdmp:spawn|xdmp:sleep|xdmp:shutdown|xdmp:set-session-field|xdmp:set-response-encoding|xdmp:set-response-content-type|xdmp:set-response-code|xdmp:set-request-time-limit|xdmp:set|xdmp:servers|xdmp:server-status|xdmp:server-name|xdmp:server|xdmp:security-database|xdmp:security-assert|xdmp:schema-database|xdmp:save|xdmp:role-roles|xdmp:role|xdmp:rethrow|xdmp:restart|xdmp:request-timestamp|xdmp:request-status|xdmp:request-cancel|xdmp:request|xdmp:redirect-response|xdmp:random|xdmp:quote|xdmp:query-trace|xdmp:query-meters|xdmp:product-edition|xdmp:privilege-roles|xdmp:privilege|xdmp:pretty-print|xdmp:powerpoint-convert|xdmp:platform|xdmp:permission|xdmp:pdf-convert|xdmp:path|xdmp:octal-to-integer|xdmp:node-uri|xdmp:node-replace|xdmp:node-kind|xdmp:node-insert-child|xdmp:node-insert-before|xdmp:node-insert-after|xdmp:node-delete|xdmp:node-database|xdmp:mul64|xdmp:modules-root|xdmp:modules-database|xdmp:merging|xdmp:merge-cancel|xdmp:merge|xdmp:md5|xdmp:logout|xdmp:login|xdmp:log-level|xdmp:log|xdmp:lock-release|xdmp:lock-acquire|xdmp:load|xdmp:invoke-in|xdmp:invoke|xdmp:integer-to-octal|xdmp:integer-to-hex|xdmp:http-put|xdmp:http-post|xdmp:http-options|xdmp:http-head|xdmp:http-get|xdmp:http-delete|xdmp:hosts|xdmp:host-status|xdmp:host-name|xdmp:host|xdmp:hex-to-integer|xdmp:hash64|xdmp:hash32|xdmp:has-privilege|xdmp:groups|xdmp:group-serves|xdmp:group-servers|xdmp:group-name|xdmp:group-hosts|xdmp:group|xdmp:get-session-field-names|xdmp:get-session-field|xdmp:get-response-encoding|xdmp:get-response-code|xdmp:get-request-username|xdmp:get-request-user|xdmp:get-request-url|xdmp:get-request-protocol|xdmp:get-request-path|xdmp:get-request-method|xdmp:get-request-header-names|xdmp:get-request-header|xdmp:get-request-field-names|xdmp:get-request-field-filename|xdmp:get-request-field-content-type|xdmp:get-request-field|xdmp:get-request-client-certificate|xdmp:get-request-client-address|xdmp:get-request-body|xdmp:get-current-user|xdmp:get-current-roles|xdmp:get|xdmp:function-name|xdmp:function-module|xdmp:function|xdmp:from-json|xdmp:forests|xdmp:forest-status|xdmp:forest-restore|xdmp:forest-restart|xdmp:forest-name|xdmp:forest-delete|xdmp:forest-databases|xdmp:forest-counts|xdmp:forest-clear|xdmp:forest-backup|xdmp:forest|xdmp:filesystem-file|xdmp:filesystem-directory|xdmp:exists|xdmp:excel-convert|xdmp:eval-in|xdmp:eval|xdmp:estimate|xdmp:email|xdmp:element-content-type|xdmp:elapsed-time|xdmp:document-set-quality|xdmp:document-set-property|xdmp:document-set-properties|xdmp:document-set-permissions|xdmp:document-set-collections|xdmp:document-remove-properties|xdmp:document-remove-permissions|xdmp:document-remove-collections|xdmp:document-properties|xdmp:document-locks|xdmp:document-load|xdmp:document-insert|xdmp:document-get-quality|xdmp:document-get-properties|xdmp:document-get-permissions|xdmp:document-get-collections|xdmp:document-get|xdmp:document-forest|xdmp:document-delete|xdmp:document-add-properties|xdmp:document-add-permissions|xdmp:document-add-collections|xdmp:directory-properties|xdmp:directory-locks|xdmp:directory-delete|xdmp:directory-create|xdmp:directory|xdmp:diacritic-less|xdmp:describe|xdmp:default-permissions|xdmp:default-collections|xdmp:databases|xdmp:database-restore-validate|xdmp:database-restore-status|xdmp:database-restore-cancel|xdmp:database-restore|xdmp:database-name|xdmp:database-forests|xdmp:database-backup-validate|xdmp:database-backup-status|xdmp:database-backup-purge|xdmp:database-backup-cancel|xdmp:database-backup|xdmp:database|xdmp:collection-properties|xdmp:collection-locks|xdmp:collection-delete|xdmp:collation-canonical-uri|xdmp:castable-as|xdmp:can-grant-roles|xdmp:base64-encode|xdmp:base64-decode|xdmp:architecture|xdmp:apply|xdmp:amp-roles|xdmp:amp|xdmp:add64|xdmp:add-response-header|xdmp:access|trgr:trigger-set-recursive|trgr:trigger-set-permissions|trgr:trigger-set-name|trgr:trigger-set-module|trgr:trigger-set-event|trgr:trigger-set-description|trgr:trigger-remove-permissions|trgr:trigger-module|trgr:trigger-get-permissions|trgr:trigger-enable|trgr:trigger-disable|trgr:trigger-database-online-event|trgr:trigger-data-event|trgr:trigger-add-permissions|trgr:remove-trigger|trgr:property-content|trgr:pre-commit|trgr:post-commit|trgr:get-trigger-by-id|trgr:get-trigger|trgr:document-scope|trgr:document-content|trgr:directory-scope|trgr:create-trigger|trgr:collection-scope|trgr:any-property-content|thsr:set-entry|thsr:remove-term|thsr:remove-synonym|thsr:remove-entry|thsr:query-lookup|thsr:lookup|thsr:load|thsr:insert|thsr:expand|thsr:add-synonym|spell:suggest-detailed|spell:suggest|spell:remove-word|spell:make-dictionary|spell:load|spell:levenshtein-distance|spell:is-correct|spell:insert|spell:double-metaphone|spell:add-word|sec:users-collection|sec:user-set-roles|sec:user-set-password|sec:user-set-name|sec:user-set-description|sec:user-set-default-permissions|sec:user-set-default-collections|sec:user-remove-roles|sec:user-privileges|sec:user-get-roles|sec:user-get-description|sec:user-get-default-permissions|sec:user-get-default-collections|sec:user-doc-permissions|sec:user-doc-collections|sec:user-add-roles|sec:unprotect-collection|sec:uid-for-name|sec:set-realm|sec:security-version|sec:security-namespace|sec:security-installed|sec:security-collection|sec:roles-collection|sec:role-set-roles|sec:role-set-name|sec:role-set-description|sec:role-set-default-permissions|sec:role-set-default-collections|sec:role-remove-roles|sec:role-privileges|sec:role-get-roles|sec:role-get-description|sec:role-get-default-permissions|sec:role-get-default-collections|sec:role-doc-permissions|sec:role-doc-collections|sec:role-add-roles|sec:remove-user|sec:remove-role-from-users|sec:remove-role-from-role|sec:remove-role-from-privileges|sec:remove-role-from-amps|sec:remove-role|sec:remove-privilege|sec:remove-amp|sec:protect-collection|sec:privileges-collection|sec:privilege-set-roles|sec:privilege-set-name|sec:privilege-remove-roles|sec:privilege-get-roles|sec:privilege-add-roles|sec:priv-doc-permissions|sec:priv-doc-collections|sec:get-user-names|sec:get-unique-elem-id|sec:get-role-names|sec:get-role-ids|sec:get-privilege|sec:get-distinct-permissions|sec:get-collection|sec:get-amp|sec:create-user-with-role|sec:create-user|sec:create-role|sec:create-privilege|sec:create-amp|sec:collections-collection|sec:collection-set-permissions|sec:collection-remove-permissions|sec:collection-get-permissions|sec:collection-add-permissions|sec:check-admin|sec:amps-collection|sec:amp-set-roles|sec:amp-remove-roles|sec:amp-get-roles|sec:amp-doc-permissions|sec:amp-doc-collections|sec:amp-add-roles|search:unparse|search:suggest|search:snippet|search:search|search:resolve-nodes|search:resolve|search:remove-constraint|search:parse|search:get-default-options|search:estimate|search:check-options|prof:value|prof:reset|prof:report|prof:invoke|prof:eval|prof:enable|prof:disable|prof:allowed|ppt:clean|pki:template-set-request|pki:template-set-name|pki:template-set-key-type|pki:template-set-key-options|pki:template-set-description|pki:template-in-use|pki:template-get-version|pki:template-get-request|pki:template-get-name|pki:template-get-key-type|pki:template-get-key-options|pki:template-get-id|pki:template-get-description|pki:need-certificate|pki:is-temporary|pki:insert-trusted-certificates|pki:insert-template|pki:insert-signed-certificates|pki:insert-certificate-revocation-list|pki:get-trusted-certificate-ids|pki:get-template-ids|pki:get-template-certificate-authority|pki:get-template-by-name|pki:get-template|pki:get-pending-certificate-requests-xml|pki:get-pending-certificate-requests-pem|pki:get-pending-certificate-request|pki:get-certificates-for-template-xml|pki:get-certificates-for-template|pki:get-certificates|pki:get-certificate-xml|pki:get-certificate-pem|pki:get-certificate|pki:generate-temporary-certificate-if-necessary|pki:generate-temporary-certificate|pki:generate-template-certificate-authority|pki:generate-certificate-request|pki:delete-template|pki:delete-certificate|pki:create-template|pdf:make-toc|pdf:insert-toc-headers|pdf:get-toc|pdf:clean|p:status-transition|p:state-transition|p:remove|p:pipelines|p:insert|p:get-by-id|p:get|p:execute|p:create|p:condition|p:collection|p:action|ooxml:runs-merge|ooxml:package-uris|ooxml:package-parts-insert|ooxml:package-parts|msword:clean|mcgm:polygon|mcgm:point|mcgm:geospatial-query-from-elements|mcgm:geospatial-query|mcgm:circle|math:tanh|math:tan|math:sqrt|math:sinh|math:sin|math:pow|math:modf|math:log10|math:log|math:ldexp|math:frexp|math:fmod|math:floor|math:fabs|math:exp|math:cosh|math:cos|math:ceil|math:atan2|math:atan|math:asin|math:acos|map:put|map:map|map:keys|map:get|map:delete|map:count|map:clear|lnk:to|lnk:remove|lnk:insert|lnk:get|lnk:from|lnk:create|kml:polygon|kml:point|kml:interior-polygon|kml:geospatial-query-from-elements|kml:geospatial-query|kml:circle|kml:box|gml:polygon|gml:point|gml:interior-polygon|gml:geospatial-query-from-elements|gml:geospatial-query|gml:circle|gml:box|georss:point|georss:geospatial-query|georss:circle|geo:polygon|geo:point|geo:interior-polygon|geo:geospatial-query-from-elements|geo:geospatial-query|geo:circle|geo:box|fn:zero-or-one|fn:years-from-duration|fn:year-from-dateTime|fn:year-from-date|fn:upper-case|fn:unordered|fn:true|fn:translate|fn:trace|fn:tokenize|fn:timezone-from-time|fn:timezone-from-dateTime|fn:timezone-from-date|fn:sum|fn:subtract-dateTimes-yielding-yearMonthDuration|fn:subtract-dateTimes-yielding-dayTimeDuration|fn:substring-before|fn:substring-after|fn:substring|fn:subsequence|fn:string-to-codepoints|fn:string-pad|fn:string-length|fn:string-join|fn:string|fn:static-base-uri|fn:starts-with|fn:seconds-from-time|fn:seconds-from-duration|fn:seconds-from-dateTime|fn:round-half-to-even|fn:round|fn:root|fn:reverse|fn:resolve-uri|fn:resolve-QName|fn:replace|fn:remove|fn:QName|fn:prefix-from-QName|fn:position|fn:one-or-more|fn:number|fn:not|fn:normalize-unicode|fn:normalize-space|fn:node-name|fn:node-kind|fn:nilled|fn:namespace-uri-from-QName|fn:namespace-uri-for-prefix|fn:namespace-uri|fn:name|fn:months-from-duration|fn:month-from-dateTime|fn:month-from-date|fn:minutes-from-time|fn:minutes-from-duration|fn:minutes-from-dateTime|fn:min|fn:max|fn:matches|fn:lower-case|fn:local-name-from-QName|fn:local-name|fn:last|fn:lang|fn:iri-to-uri|fn:insert-before|fn:index-of|fn:in-scope-prefixes|fn:implicit-timezone|fn:idref|fn:id|fn:hours-from-time|fn:hours-from-duration|fn:hours-from-dateTime|fn:floor|fn:false|fn:expanded-QName|fn:exists|fn:exactly-one|fn:escape-uri|fn:escape-html-uri|fn:error|fn:ends-with|fn:encode-for-uri|fn:empty|fn:document-uri|fn:doc-available|fn:doc|fn:distinct-values|fn:distinct-nodes|fn:default-collation|fn:deep-equal|fn:days-from-duration|fn:day-from-dateTime|fn:day-from-date|fn:data|fn:current-time|fn:current-dateTime|fn:current-date|fn:count|fn:contains|fn:concat|fn:compare|fn:collection|fn:codepoints-to-string|fn:codepoint-equal|fn:ceiling|fn:boolean|fn:base-uri|fn:avg|fn:adjust-time-to-timezone|fn:adjust-dateTime-to-timezone|fn:adjust-date-to-timezone|fn:abs|feed:unsubscribe|feed:subscription|feed:subscribe|feed:request|feed:item|feed:description|excel:clean|entity:enrich|dom:set-pipelines|dom:set-permissions|dom:set-name|dom:set-evaluation-context|dom:set-domain-scope|dom:set-description|dom:remove-pipeline|dom:remove-permissions|dom:remove|dom:get|dom:evaluation-context|dom:domains|dom:domain-scope|dom:create|dom:configuration-set-restart-user|dom:configuration-set-permissions|dom:configuration-set-evaluation-context|dom:configuration-set-default-domain|dom:configuration-get|dom:configuration-create|dom:collection|dom:add-pipeline|dom:add-permissions|dls:retention-rules|dls:retention-rule-remove|dls:retention-rule-insert|dls:retention-rule|dls:purge|dls:node-expand|dls:link-references|dls:link-expand|dls:documents-query|dls:document-versions-query|dls:document-version-uri|dls:document-version-query|dls:document-version-delete|dls:document-version-as-of|dls:document-version|dls:document-update|dls:document-unmanage|dls:document-set-quality|dls:document-set-property|dls:document-set-properties|dls:document-set-permissions|dls:document-set-collections|dls:document-retention-rules|dls:document-remove-properties|dls:document-remove-permissions|dls:document-remove-collections|dls:document-purge|dls:document-manage|dls:document-is-managed|dls:document-insert-and-manage|dls:document-include-query|dls:document-history|dls:document-get-permissions|dls:document-extract-part|dls:document-delete|dls:document-checkout-status|dls:document-checkout|dls:document-checkin|dls:document-add-properties|dls:document-add-permissions|dls:document-add-collections|dls:break-checkout|dls:author-query|dls:as-of-query|dbk:convert|dbg:wait|dbg:value|dbg:stopped|dbg:stop|dbg:step|dbg:status|dbg:stack|dbg:out|dbg:next|dbg:line|dbg:invoke|dbg:function|dbg:finish|dbg:expr|dbg:eval|dbg:disconnect|dbg:detach|dbg:continue|dbg:connect|dbg:clear|dbg:breakpoints|dbg:break|dbg:attached|dbg:attach|cvt:save-converted-documents|cvt:part-uri|cvt:destination-uri|cvt:basepath|cvt:basename|cts:words|cts:word-query-weight|cts:word-query-text|cts:word-query-options|cts:word-query|cts:word-match|cts:walk|cts:uris|cts:uri-match|cts:train|cts:tokenize|cts:thresholds|cts:stem|cts:similar-query-weight|cts:similar-query-nodes|cts:similar-query|cts:shortest-distance|cts:search|cts:score|cts:reverse-query-weight|cts:reverse-query-nodes|cts:reverse-query|cts:remainder|cts:registered-query-weight|cts:registered-query-options|cts:registered-query-ids|cts:registered-query|cts:register|cts:query|cts:quality|cts:properties-query-query|cts:properties-query|cts:polygon-vertices|cts:polygon|cts:point-longitude|cts:point-latitude|cts:point|cts:or-query-queries|cts:or-query|cts:not-query-weight|cts:not-query-query|cts:not-query|cts:near-query-weight|cts:near-query-queries|cts:near-query-options|cts:near-query-distance|cts:near-query|cts:highlight|cts:geospatial-co-occurrences|cts:frequency|cts:fitness|cts:field-words|cts:field-word-query-weight|cts:field-word-query-text|cts:field-word-query-options|cts:field-word-query-field-name|cts:field-word-query|cts:field-word-match|cts:entity-highlight|cts:element-words|cts:element-word-query-weight|cts:element-word-query-text|cts:element-word-query-options|cts:element-word-query-element-name|cts:element-word-query|cts:element-word-match|cts:element-values|cts:element-value-ranges|cts:element-value-query-weight|cts:element-value-query-text|cts:element-value-query-options|cts:element-value-query-element-name|cts:element-value-query|cts:element-value-match|cts:element-value-geospatial-co-occurrences|cts:element-value-co-occurrences|cts:element-range-query-weight|cts:element-range-query-value|cts:element-range-query-options|cts:element-range-query-operator|cts:element-range-query-element-name|cts:element-range-query|cts:element-query-query|cts:element-query-element-name|cts:element-query|cts:element-pair-geospatial-values|cts:element-pair-geospatial-value-match|cts:element-pair-geospatial-query-weight|cts:element-pair-geospatial-query-region|cts:element-pair-geospatial-query-options|cts:element-pair-geospatial-query-longitude-name|cts:element-pair-geospatial-query-latitude-name|cts:element-pair-geospatial-query-element-name|cts:element-pair-geospatial-query|cts:element-pair-geospatial-boxes|cts:element-geospatial-values|cts:element-geospatial-value-match|cts:element-geospatial-query-weight|cts:element-geospatial-query-region|cts:element-geospatial-query-options|cts:element-geospatial-query-element-name|cts:element-geospatial-query|cts:element-geospatial-boxes|cts:element-child-geospatial-values|cts:element-child-geospatial-value-match|cts:element-child-geospatial-query-weight|cts:element-child-geospatial-query-region|cts:element-child-geospatial-query-options|cts:element-child-geospatial-query-element-name|cts:element-child-geospatial-query-child-name|cts:element-child-geospatial-query|cts:element-child-geospatial-boxes|cts:element-attribute-words|cts:element-attribute-word-query-weight|cts:element-attribute-word-query-text|cts:element-attribute-word-query-options|cts:element-attribute-word-query-element-name|cts:element-attribute-word-query-attribute-name|cts:element-attribute-word-query|cts:element-attribute-word-match|cts:element-attribute-values|cts:element-attribute-value-ranges|cts:element-attribute-value-query-weight|cts:element-attribute-value-query-text|cts:element-attribute-value-query-options|cts:element-attribute-value-query-element-name|cts:element-attribute-value-query-attribute-name|cts:element-attribute-value-query|cts:element-attribute-value-match|cts:element-attribute-value-geospatial-co-occurrences|cts:element-attribute-value-co-occurrences|cts:element-attribute-range-query-weight|cts:element-attribute-range-query-value|cts:element-attribute-range-query-options|cts:element-attribute-range-query-operator|cts:element-attribute-range-query-element-name|cts:element-attribute-range-query-attribute-name|cts:element-attribute-range-query|cts:element-attribute-pair-geospatial-values|cts:element-attribute-pair-geospatial-value-match|cts:element-attribute-pair-geospatial-query-weight|cts:element-attribute-pair-geospatial-query-region|cts:element-attribute-pair-geospatial-query-options|cts:element-attribute-pair-geospatial-query-longitude-name|cts:element-attribute-pair-geospatial-query-latitude-name|cts:element-attribute-pair-geospatial-query-element-name|cts:element-attribute-pair-geospatial-query|cts:element-attribute-pair-geospatial-boxes|cts:document-query-uris|cts:document-query|cts:distance|cts:directory-query-uris|cts:directory-query-depth|cts:directory-query|cts:destination|cts:deregister|cts:contains|cts:confidence|cts:collections|cts:collection-query-uris|cts:collection-query|cts:collection-match|cts:classify|cts:circle-radius|cts:circle-center|cts:circle|cts:box-west|cts:box-south|cts:box-north|cts:box-east|cts:box|cts:bearing|cts:arc-intersection|cts:and-query-queries|cts:and-query-options|cts:and-query|cts:and-not-query-positive-query|cts:and-not-query-negative-query|cts:and-not-query|css:get|css:convert|cpf:success|cpf:failure|cpf:document-set-state|cpf:document-set-processing-status|cpf:document-set-last-updated|cpf:document-set-error|cpf:document-get-state|cpf:document-get-processing-status|cpf:document-get-last-updated|cpf:document-get-error|cpf:check-transition|alert:spawn-matching-actions|alert:rule-user-id-query|alert:rule-set-user-id|alert:rule-set-query|alert:rule-set-options|alert:rule-set-name|alert:rule-set-description|alert:rule-set-action|alert:rule-remove|alert:rule-name-query|alert:rule-insert|alert:rule-id-query|alert:rule-get-user-id|alert:rule-get-query|alert:rule-get-options|alert:rule-get-name|alert:rule-get-id|alert:rule-get-description|alert:rule-get-action|alert:rule-action-query|alert:remove-triggers|alert:make-rule|alert:make-log-action|alert:make-config|alert:make-action|alert:invoke-matching-actions|alert:get-my-rules|alert:get-all-rules|alert:get-actions|alert:find-matching-rules|alert:create-triggers|alert:config-set-uri|alert:config-set-trigger-ids|alert:config-set-options|alert:config-set-name|alert:config-set-description|alert:config-set-cpf-domain-names|alert:config-set-cpf-domain-ids|alert:config-insert|alert:config-get-uri|alert:config-get-trigger-ids|alert:config-get-options|alert:config-get-name|alert:config-get-id|alert:config-get-description|alert:config-get-cpf-domain-names|alert:config-get-cpf-domain-ids|alert:config-get|alert:config-delete|alert:action-set-options|alert:action-set-name|alert:action-set-module-root|alert:action-set-module-db|alert:action-set-module|alert:action-set-description|alert:action-remove|alert:action-insert|alert:action-get-options|alert:action-get-name|alert:action-get-module-root|alert:action-get-module-db|alert:action-get-module|alert:action-get-description|zero-or-one|years-from-duration|year-from-dateTime|year-from-date|upper-case|unordered|true|translate|trace|tokenize|timezone-from-time|timezone-from-dateTime|timezone-from-date|sum|subtract-dateTimes-yielding-yearMonthDuration|subtract-dateTimes-yielding-dayTimeDuration|substring-before|substring-after|substring|subsequence|string-to-codepoints|string-pad|string-length|string-join|string|static-base-uri|starts-with|seconds-from-time|seconds-from-duration|seconds-from-dateTime|round-half-to-even|round|root|reverse|resolve-uri|resolve-QName|replace|remove|QName|prefix-from-QName|position|one-or-more|number|not|normalize-unicode|normalize-space|node-name|node-kind|nilled|namespace-uri-from-QName|namespace-uri-for-prefix|namespace-uri|name|months-from-duration|month-from-dateTime|month-from-date|minutes-from-time|minutes-from-duration|minutes-from-dateTime|min|max|matches|lower-case|local-name-from-QName|local-name|last|lang|iri-to-uri|insert-before|index-of|in-scope-prefixes|implicit-timezone|idref|id|hours-from-time|hours-from-duration|hours-from-dateTime|floor|false|expanded-QName|exists|exactly-one|escape-uri|escape-html-uri|error|ends-with|encode-for-uri|empty|document-uri|doc-available|doc|distinct-values|distinct-nodes|default-collation|deep-equal|days-from-duration|day-from-dateTime|day-from-date|data|current-time|current-dateTime|current-date|count|contains|concat|compare|collection|codepoints-to-string|codepoint-equal|ceiling|boolean|base-uri|avg|adjust-time-to-timezone|adjust-dateTime-to-timezone|adjust-date-to-timezone|abs)\b/], -["pln",/^[\w:-]+/],["pln",/^[\t\n\r \xa0]+/]]),["xq","xquery"]); diff --git a/assets/js/lang-yaml.js b/assets/js/lang-yaml.js deleted file mode 100644 index c38729b..0000000 --- a/assets/js/lang-yaml.js +++ /dev/null @@ -1,2 +0,0 @@ -var a=null; -PR.registerLangHandler(PR.createSimpleLexer([["pun",/^[:>?|]+/,a,":|>?"],["dec",/^%(?:YAML|TAG)[^\n\r#]+/,a,"%"],["typ",/^&\S+/,a,"&"],["typ",/^!\S*/,a,"!"],["str",/^"(?:[^"\\]|\\.)*(?:"|$)/,a,'"'],["str",/^'(?:[^']|'')*(?:'|$)/,a,"'"],["com",/^#[^\n\r]*/,a,"#"],["pln",/^\s+/,a," \t\r\n"]],[["dec",/^(?:---|\.\.\.)(?:[\n\r]|$)/],["pun",/^-/],["kwd",/^\w+:[\n\r ]/],["pln",/^\w+/]]),["yaml","yml"]); diff --git a/assets/js/prettify.js b/assets/js/prettify.js deleted file mode 100644 index eef5ad7..0000000 --- a/assets/js/prettify.js +++ /dev/null @@ -1,28 +0,0 @@ -var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; -(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= -[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), -l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, -q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, -q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, -"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), -a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} -for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"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"],F=[w,"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,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], -H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,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"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"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"], -J=[v,"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"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"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"+ -I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), -["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["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"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), -["cv","py"]);k(u({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:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", -hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= -!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p Backpack.Component.coffee

Backpack.Component.coffee

class Backpack.Component extends Backbone.View
-
-  tagName: 'div'
-  className: 'backpack-component'
-
-  options:
-    'parent': 'body'
-
-  initialize: ->
-    @options = _.extend({}, @defaults, @options)
-    for func, args of @options
-      unless _.isArray(args)
-        @[func]?.call?(@, args)
-      else
-        @[func]?.apply?(@, args)
-      null
-
-  render: =>
-    @$parent.append(@el)
-    @
-
-  show: =>
-    @render()
-    @delegateEvents(@events)
-    @$el.removeClass('hide')
-    @
-
-  hide: =>
-    @$el.addClass('hide')
-    @undelegateEvents()
-    @
-
-  close: =>
-    @hide()
-    @remove()
-    @
-
-  remove: =>
-    @undelegateEvents()
-    super()
-    @
-
-  before: (content) =>
-    return @ unless content?
-    content = @setContent(content)
-    @$el.before(content)
-    @
-  
-  after: (content) =>
-    return @ unless content?
-    content = @setContent(content)
-    @$el.after(content)
-    @
-
-  append: (content) =>
-    return @ unless content?
-    content = @setContent(content)
-    @$el.append(content)
-    @
-
-  prepend: (content) =>
-    return @ unless content?
-    content = @setContent(content)
-    @$el.prepend(content)
-    @
-
-  setContent: (content) =>
-    return @ unless content?
-    if content.el?
-      if content.render?
-        content = content.render().el
-      else
-        content = content.el
-    else
-      content = content
-
-  content: (content) =>
-    return @ unless content?
-    @_content = @setContent(content)
-    wrappedContent = @make('div', {class: 'content clearfix'}, @_content)
-    @$el.append(wrappedContent)
-    @
-
-  parent: (parent) =>
-    return @ unless parent?
-    @$parent = $(parent)
-    @
-
-  addClass: (klass) =>
-    return @ unless klass?
-    @$el.addClass(klass)
-    @
-  
-  removeClass: (klass) =>
-    return @ unless klass?
-    @$el.removeClass(klass)
-    @
-
-  bump: (direction) =>
-    return @ unless direction?
-    @addClass("bump-#{direction}")
-    @
-
-  name: (name) =>
-    return @ unless name?
-    @name = @addClass(@slug(name))
-    @
-
-  slug: (string) =>
-    return @ unless string?
-    string
-      .toLowerCase()
-      .replace(/\ +/g, "-")
-      .replace(/[^a-z0-9-]/g, "")
-
-
\ No newline at end of file diff --git a/docs/Backpack.Dialog.html b/docs/Backpack.Dialog.html deleted file mode 100644 index 49f8a1f..0000000 --- a/docs/Backpack.Dialog.html +++ /dev/null @@ -1,87 +0,0 @@ - Backpack.Dialog.coffee

Backpack.Dialog.coffee

Backpack.Overlay

class Backpack.Overlay extends Backpack.Component
-
-  events:
-    'click': 'unlock'
-
-  defaults:
-    'lockOverlay': false
-    'color': 'rgba(0,0,0,0.7)'
-
-  initialize: ->
-    super()
-    @addClass('backpack-overlay')
-    {lockOverlay, color} = @options
-    @setLock(lockOverlay)
-    @setColor(color)
-    @
-
-  render: =>
-    @parent.prepend(@el)
-    @
-    
-  unlock: =>
-    @close() unless @lockOverlay
-    @
-
-  close: =>
-    super()
-    @trigger('overlay-close')
-    @
-    
-  setLock: (@lockOverlay) =>
-    @
-  
-  setColor: (color) =>
-    @el.style.backgroundColor = color
-    @

Backpack.Dialog

class Backpack.Dialog extends Backpack.Component
-
-  events:
-    'click .close': 'close'
-
-  defaults:
-    'lockOverlay': false
-    'showOverlay': false
-    'closable': true
-
-  initialize: ->
-    super()
-    @addClass('backpack-dialog')
-    @setOverlay() if @options.showOverlay
-    @setClosable() if @options.closable
-    @
-
-  setClosable: =>
-    @$el.prepend("<span class='close'>×</span>")
-    @
-
-  setOverlay: =>
-    @overlay = new Backpack.Overlay({ lockOverlay: @options.lockOverlay })
-    @overlay.on('overlay-close', @close)
-    @
-
-  show: =>
-    super()
-    @overlay?.render().show()
-    @
-
-  hide: =>
-    super()
-    @overlay?.hide()
-    @
-
-  close: =>
-    super()
-    @overlay?.remove()
-    @

Backpack.Modal

class Backpack.Modal extends Backpack.Dialog
-
-  defaults:
-    'lockOverlay': true
-    'showOverlay': true
-    'closable': true
-
-  initialize: ->
-    super(@defaults)
-    @addClass('backpack-modal')
-    @
-
-
\ No newline at end of file diff --git a/docs/Backpack.Menu.html b/docs/Backpack.Menu.html deleted file mode 100644 index 5716728..0000000 --- a/docs/Backpack.Menu.html +++ /dev/null @@ -1,52 +0,0 @@ - Backpack.Menu.coffee

Backpack.Menu.coffee

Backpack.Menu

class Backpack.Menu extends Backpack.Component
-
-  tagName: 'ul'
-
-  initialize: ->
-    super()
-    @addClass('backpack-menu')
-    @
-
-  add: =>
-    for item in arguments
-      {content, events, el} = item
-      if el
-        menuItem = item
-      else
-        menuItem = new Backpack.MenuItem(item)
-      @append(menuItem.show().el)
-    @

Backpack.MenuItem

class Backpack.MenuItem extends Backpack.Component
-
-  tagName: 'li'
-  template: _.template("<a href='<%= href %>'><%= content %></a>")
-
-
-  initialize: ->
-    @addClass 'backpack-menu-item'
-    super()
-    {content, events} = @options
-    @content(content, events)
-    @delegateEvents(@events)
-    @
-
-  render: =>
-    @$el.html(@_content)
-    @
-
-  content: (content, events = {}) =>
-    if content.el?
-      @_content = content.el
-      return @
-    if _.isString(events)
-      @_content = @template({ href: events, content: content })
-      return @
-    if _.isFunction(events)
-      @events  = {'click': events}
-      @_content = @template({ href: 'javascript:void(0);', content: content })
-      return @
-      
-    @events  = events
-    @_content = @template({ href: 'javascript:void(0);', content: content })
-    @
-
-
\ No newline at end of file diff --git a/docs/Backpack.Modal.html b/docs/Backpack.Modal.html deleted file mode 100644 index ed070ad..0000000 --- a/docs/Backpack.Modal.html +++ /dev/null @@ -1,111 +0,0 @@ - Backpack.Modal.coffee

Backpack.Modal.coffee

Backpack.Lift

class Backpack.Overlay extends Backpack.Component
-
-  template: """
-              <div class='backpack-overlay-outer'>
-                <div class='backpack-overlay-inner'>
-                  <div class='backpack-overlay-container'></div>
-                </div>
-              </div>
-            """
-  events:
-    'click': 'unlock'
-    'click .backpack-overlay-container': (e) -> e.stopPropagation()
-
-  defaults:
-    'lockOverlay': false
-    'color': 'rgba(0,0,0,0.7)'
-
-  initialize: ->
-    @addClass('backpack-overlay')
-    @append @template
-    super()
-
-  render: =>
-    @$('.backpack-overlay-container').html(@_content)
-    @$parent.prepend(@el)
-    @
-
-  content: (content) =>
-    return @ unless content?
-    @_content = @setContent(content)
-    @
-
-  show: =>
-    super()
-    @$parent.addClass('overlay')
-    @
-
-  unlock: =>
-    @close() unless @_lockOverlay
-    @
-
-  close: =>
-    super()
-    @trigger('overlay-close')
-    @
-    
-  lockOverlay: (lockOverlay) =>
-    @_lockOverlay = !!lockOverlay
-    @
-
-  color: (color) =>
-    @el.style.backgroundColor = color
-    @
-
-  remove: =>
-    @$parent.removeClass('overlay')
-    super()
-    @

Backpack.Modal

class Backpack.Modal extends Backpack.Component
-
-  events:
-    'click .close': 'close'
-
-  defaults:
-    'closable':    true 
-    'lockOverlay': true
-
-  initialize: ->
-    @addClass('backpack-modal')
-    super()
-    @newOverlay()
-    @
-
-  show: =>
-    super()
-    @overlay?.show()
-    @
-
-  hide: =>
-    super()
-    @overlay?.hide()
-    @
-
-  close: =>
-    super()
-    @overlay?.remove()
-    @
-
-  closable: =>
-    return @ unless !!arguments[0]
-    @$el.prepend("<span class='close'>&times;</span>")
-    @
-
-  newOverlay: =>
-    @overlay = new Backpack.Overlay
-      lockOverlay: @options.lockOverlay
-      content:     @el
-      color:       @options.color
-      show:        true
-    @overlay.on('overlay-close', @close)
-    @
-
-  remove: =>
-    super()
-    @overlay?.remove()
-    @

addButton: (button) => - return unless button? - container = @make("div", {"class": "backpack-dialog-button-container"}) - $(container).append(button.setParent(container).render().show()) - button.on('button-close', @close) - @$el.append(container) - @

\ No newline at end of file diff --git a/docs/Backpack.Tabs.html b/docs/Backpack.Tabs.html deleted file mode 100644 index 12c39d1..0000000 --- a/docs/Backpack.Tabs.html +++ /dev/null @@ -1,97 +0,0 @@ - Backpack.Tabs.coffee

Backpack.Tabs.coffee

class Backpack.Tabs extends Backpack.Component
-
-  tagName: 'ul'
-
-  initialize: ->
-    @addClass('backpack-tabs clearfix')

@items is an array of tab items

    @items = []

@active is the index of the current -active tab in @items. Defaults to 0

    @active = @options.active ? 0
-    super()

add

- -
@return {Tabs}
-
  add: =>

iterate over each item in the -arguments array

    for item in arguments

set the item's parent to this -set of Tabs

      item = _.extend(item, {parent: @})
-      if item.el

the item is already a View

        tab = item
-      else
-        tab = new Backpack.Tab(item)

setup the added tab

      @setTab(tab)

after all the tabs are added -set the active tab

    @setActive()
-    @

setTab

- -
@param {Tab} tab
-@return {Tabs}
-
  setTab: (tab) =>

subscribe to 'tab-click' event -and call @select when it is -triggered

    tab.on('tab-click', @select)

subscribe to 'tab-exit' event -and call @exit when it is -triggered

    tab.on('tab-exit', @exit)

add the tab

    @append(tab.show().el)
-    @items.push(tab)
-    @

setActive

- -
@return {Tabs}
-
  setActive: =>
-    activeTab = @items[@active]
-    activeTab.addClass('backpack-tab-active')
-    @select(activeTab)
-    @

select

- -
@param {Tab} tab
-@return {Tabs}
-
  select: (tab) =>

remove active class from the current @active tab

    curActive = @items[@active]
-    curActive.trigger('tab-exit', curActive)

set new @active tab

    @active = _.indexOf(@items, tab)
-    tab.addClass('backpack-tab-active')

remove the previous active tab's tab content -and put the current active tab's content in

    @$el.next('.backpack-tab-content').remove()
-    @after(tab.tabContent.show().el)
-    @
-
-  exit: (tab) =>
-    tab.removeClass('backpack-tab-active')
-    @
-
-
-
-
-class Backpack.Tab extends Backpack.Component
-
-  tagName: 'li'
-
-  template: _.template("<a class='round-top' href='<%= href %>'><%= content %></a>")
-
-  events:
-    'click': 'select'
-
-  initialize: ->
-    super()
-    @addClass('backpack-tab')
-    @tabContent = new Backpack.TabContent
-      content: @options.tabContent
-      parent:  @$parent
-
-  render: =>
-    @$el.html(@_content)
-    @
-
-  content: (content) =>
-    return @ unless content?
-    content = @setContent(content)
-    @_content = @template({ href: 'javascript:void(0);', content: content })
-    @

select

- -
@returns {Tab}
-
  select: =>

Emits a 'tab-click' event. -Passes the selected tab object to -those listening to that event

    @trigger('tab-click', @)
-    @
-
-
-
-class Backpack.TabContent extends Backpack.Component
-
-  initialize: ->
-    super()
-    @addClass('backpack-tab-content round-bottom')
-
-  render: =>
-    @$parent.html(@_content)
-    @
-
-
\ No newline at end of file diff --git a/docs/Backpack.html b/docs/Backpack.html deleted file mode 100644 index c54519d..0000000 --- a/docs/Backpack.html +++ /dev/null @@ -1,6 +0,0 @@ - Backpack.coffee

Backpack.coffee

support server + browser

root = exports ? this
-
-Backpack = root.Backpack = 

Current version of Backpack.js -keep in sync with package.json

    VERSION: '0.0.1'
-
-
\ No newline at end of file diff --git a/docs/docco.css b/docs/docco.css deleted file mode 100644 index 5aa0a8d..0000000 --- a/docs/docco.css +++ /dev/null @@ -1,186 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h1, h2, h3, h4, h5, h6 { - margin: 0px 0 15px 0; -} - h1 { - margin-top: 40px; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/example/index.html b/example/index.html deleted file mode 100644 index 6b7dd09..0000000 --- a/example/index.html +++ /dev/null @@ -1,317 +0,0 @@ - - - - - Backpack.js - - - - - - - - -
- -
-
- - - diff --git a/index.html b/index.html deleted file mode 100644 index d55efd6..0000000 --- a/index.html +++ /dev/null @@ -1,1019 +0,0 @@ - - - - - Backpack.js User Guide - - - - - - - - - - - - - - - -
-
- - -
- - Download Backpack.js - - - Fork on Github - -
- -
- -

Introduction

-
-

- Backpack.js is a lightweight Backbone extension for composing and - structuring UI components, and was built by a couple - of Airbnb Engineers. -

-

- Backpack's focus is to be a helper for storing and structuring - decoupled, extensible UI components. Think of it as a roll-your-own - YUI or jQuery UI, with components built with Backbone.Views. It's a - micro-library that you build on as you go. -

-

- Your Backpack will come with some common UI components that you can - easily extend. As you build out your app, you'll start throwing - more components in your backpack. Then you just pull out the components - you need when you need them. -

-

- This initial release is the result of our work abstracting - components that we built for the Airbnb mobile site. - We would like to open this initial release to the - community to hear your thoughts and welcome - contributions and ideas for its future. -

-
- -
- -

Overview

-
- - -
- -

Backpack

-
-

- Backpack is the global namespace everything gets attached too. - Backpack also comes equiped with a ham radio. It extends Backbone.Events, - so you have a global dispatcher/observer at your disposal. -

- -
- - - -
- -

Backpack.Component

-
-

- Component is the base View which all Backpack.js components - extend. It provides convenient helper methods for manipulating - the component and it’s content, many of which follow a syntax - similar to jQuery in that methods can be chained, or - alternatively can be passed in upon initialization of the - component. -

-

- Component provides the following convenience methods to - all components: -

- -
    -
  • render
  • -
  • show
  • -
  • hide
  • -
  • close
  • -
  • remove
  • -
  • before
  • -
  • after
  • -
  • append
  • -
  • prepend
  • -
  • content
  • -
  • setContent
  • -
  • parent
  • -
  • addClass
  • -
  • removeClass
  • -
  • css
  • -
  • name
  • -
  • slug
  • -
- - - -
- - -
- -

Backpack.Tabs

-
-

- Tabs are a grouping of TabItems, responsible for automatically - displaying the content associated with any given tab. Clicking - on a TabItem automatically displays the content, and can also - be extended to execute any number of given arbitrary functions. -

- -
- -
-
-var tabs = new Backpack.Tabs({
-      add: [{
-        content:    'Tab 1',
-        tabContent: 'Some tab 1 content'
-      },{
-        content:    'Tab 2',
-        tabContent: 'Some tab 2 content'
-      }]
-});
-
-
-
-var tabs = new Backpack.Tabs({});
-
-tabs.add({
-  content:    'Tab 1',
-  tabContent: 'Some tab 1 content'
-});
-
-tabs.add({
-  content:    'Tab 2',
-  tabContent: 'Some tab 2 content'
-});
-
-tabs.add({
-    content:    'Tab 3',
-    tabContent: 'Some tab 3 content'
-  },{
-    content:    'Tab 4',
-    tabContent: 'Some tab 4 content'
-});
-
-
- - - - - - - - -
- -

Backpack.Layout

-
-

- Layout is a simple grid helper for component placement. - Set the number of columns and gutter size and Layout - will figure out the sizing of everything. No need to - worry about class names or calculating widths. -

- -
- -
-
-var testComponent = new Backpack.Component({
-      name: 'test component',
-      css: {
-        'background-color': 'lightgrey',
-        'padding': '20px'
-      }
-    });
-
-var basic = new Backpack.Layout({
-      add: [{
-            content: testComponent
-        },{
-            content: testComponent
-        },{
-            content: testComponent
-      }]
-});
- - -
- -
- - -
- -

Swipe.js Example Component

-
-

- It's easy to create components from existing libraries. Here's - an example of how to create a Backpack component out of the Swipe.js library. -

- -
- - - -
-
-class Backpack.Swipe extends Backpack.Component
-
-  id: 'slider'
-
-  config:
-    'type': 'swipe'
-    'renderType': 'append'
-    'startSlide': 0
-    'speed': 300
-    'auto': 4000
-    'continuous': true
-    'disableScroll': false
-    'callback': ->
-    'transitionEnd': ->
-
-  initialize: ->
-    super()
-    # being lazy and attaching it to window for now
-    window.s = new window.Swipe(@el, @options)
-
-  content: (slides) =>
-    for content in arguments
-        @$el.append(content)
-    @
-
- -
- - - - -
- -
- - -
- -

Hack on Backpack

-
-

- Backpack.js is still in it's early-days. We’re open-sourcing our - progress thus far with the hope to continue to build Backpack.js - with the help of the Backbone community. -

-
-
- -

Getting Started

-
-
-git clone git@github.com:airbnb/backpack.js.git
-cd backpack.js && npm install
- -

- - -

Cake Build Tools

-
-
-cake compile        # Compile CoffeeScript source files
-
-cake build          # Creates /lib_path/Backpack-bundle.js & 
-                    # /lib_path/Backpack-bundle.min.js & 
-                    # /lib_path/js/*.js
-
-cake test           # Opens Jasmine SpecRunner. Watches
-                    # BackpackSpec-Bundle.js for changes
-
-cake docs           # Generate annotated source code 
-                    # with Docco
-
-cake watch          # Recompile CoffeeScript source files when 
-                    # modified to Backpack-bundle.js
-
-cake watch:js       # Recompile CoffeeScript source files when 
-                    # modified to individual .js files
- -

- - -

Testing

-
- -
- Backpack.js tests are written using jasmine with sinon.js and jasmine-sinon. -
- -
- -
- You can run the test suite with
cake test
. -
- -
-
- - - -
-
- - - - - - - - - - - - \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 5a9e115..0000000 --- a/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/Backpack-bundle'); \ No newline at end of file diff --git a/lib/Backpack-bundle.js b/lib/Backpack-bundle.js deleted file mode 100644 index 948d9d4..0000000 --- a/lib/Backpack-bundle.js +++ /dev/null @@ -1,830 +0,0 @@ -(function() { - "use strict"; - var Backpack, root, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __hasProp = Object.prototype.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; - - root = typeof exports !== "undefined" && exports !== null ? exports : this; - - Backpack = root.Backpack = { - VERSION: '0.0.1', - Prefix: 'backpack' - }; - - _.extend(Backpack, Backbone.Events); - - Backpack.Component = (function(_super) { - - __extends(Component, _super); - - function Component() { - this.slug = __bind(this.slug, this); - this.setContent = __bind(this.setContent, this); - this.getLayout = __bind(this.getLayout, this); - this.hasLayout = __bind(this.hasLayout, this); - this.layout = __bind(this.layout, this); - this.isRendered = __bind(this.isRendered, this); - this.getItems = __bind(this.getItems, this); - this.items = __bind(this.items, this); - this.name = __bind(this.name, this); - this.css = __bind(this.css, this); - this.removeClass = __bind(this.removeClass, this); - this.addClass = __bind(this.addClass, this); - this.parent = __bind(this.parent, this); - this.content = __bind(this.content, this); - this.prepend = __bind(this.prepend, this); - this.append = __bind(this.append, this); - this.after = __bind(this.after, this); - this.before = __bind(this.before, this); - this.remove = __bind(this.remove, this); - this.close = __bind(this.close, this); - this.hide = __bind(this.hide, this); - this.show = __bind(this.show, this); - this.visible = __bind(this.visible, this); - this.getType = __bind(this.getType, this); - this.type = __bind(this.type, this); - this.getRenderEl = __bind(this.getRenderEl, this); - this.renderEl = __bind(this.renderEl, this); - this.renderType = __bind(this.renderType, this); - this.render = __bind(this.render, this); - Component.__super__.constructor.apply(this, arguments); - } - - Component.prototype.tagName = 'div'; - - Component.prototype.className = 'backpack-component'; - - Component.prototype.defaults = { - 'parent': 'body', - 'type': 'component', - 'renderType': 'append', - 'content': null, - 'visible': true - }; - - Component.prototype.initialize = function() { - var args, func, _base, _base2, _ref, _results; - this._items = []; - this._rendered = false; - this._renderTypes = ['append', 'prepend', 'html']; - this.options = _.extend({}, this.defaults, this.config, this.options); - _ref = this.options; - _results = []; - for (func in _ref) { - args = _ref[func]; - if (this[func] != null) { - if (!_.isArray(args)) { - if (typeof (_base = this[func]).call === "function") { - _base.call(this, args); - } - } else { - if (typeof (_base2 = this[func]).apply === "function") { - _base2.apply(this, args); - } - } - } - _results.push(null); - } - return _results; - }; - - Component.prototype.render = function() { - var func; - func = this.$parent[this._renderType]; - func.call(this.$parent, this.getRenderEl()); - this._rendered = true; - return this; - }; - - Component.prototype.renderType = function(type) { - var hasType; - hasType = _.include(this._renderTypes, type); - if (!hasType) return this; - this._renderType = type; - return this; - }; - - Component.prototype.renderEl = function(el) { - this._renderEl = el; - return this; - }; - - Component.prototype.getRenderEl = function() { - if (this._renderEl != null) return this._renderEl; - return this.el; - }; - - Component.prototype.type = function(type) { - this._type = this.slug("" + Backpack.Prefix + " " + type); - this.addClass(this._type); - return this; - }; - - Component.prototype.getType = function() { - return this._type; - }; - - Component.prototype.visible = function(show) { - if (show) { - this.show(); - } else { - this.hide(); - } - return this; - }; - - Component.prototype.show = function() { - if (!this.isRendered()) this.render(); - this.delegateEvents(this.events); - this.$el.removeClass('hide'); - this._visible = true; - return this; - }; - - Component.prototype.hide = function() { - this.$el.addClass('hide'); - this.undelegateEvents(); - this._visible = false; - return this; - }; - - Component.prototype.close = function() { - this.hide(); - this.remove(); - return this; - }; - - Component.prototype.remove = function() { - this.undelegateEvents(); - Component.__super__.remove.call(this); - return this; - }; - - Component.prototype.before = function(content) { - content = this.setContent(content); - this.$el.before(content); - return this; - }; - - Component.prototype.after = function(content) { - content = this.setContent(content); - this.$el.after(content); - return this; - }; - - Component.prototype.append = function(content) { - content = this.setContent(content); - this.$el.append(content); - return this; - }; - - Component.prototype.prepend = function(content) { - content = this.setContent(content); - this.$el.prepend(content); - return this; - }; - - Component.prototype.content = function(content) { - var wrappedContent; - if (content == null) return this; - this._content = this.setContent(content); - wrappedContent = this.make('div', { - "class": 'content clearfix' - }, this._content); - this.$el.append(wrappedContent); - return this; - }; - - Component.prototype.parent = function(parent) { - if (parent == null) return this; - this.$parent = $(parent); - return this; - }; - - Component.prototype.addClass = function(klass) { - this.$el.addClass(klass); - return this; - }; - - Component.prototype.removeClass = function(klass) { - this.$el.removeClass(klass); - return this; - }; - - Component.prototype.css = function(css) { - this.$el.css(css); - return this; - }; - - Component.prototype.name = function(name) { - this.name = this.addClass(this.slug(name)); - return this; - }; - - Component.prototype.items = function() { - var item, _i, _len; - for (_i = 0, _len = arguments.length; _i < _len; _i++) { - item = arguments[_i]; - this._items.push(item); - } - return this; - }; - - Component.prototype.getItems = function() { - return this._items; - }; - - Component.prototype.isRendered = function() { - return this._rendered; - }; - - Component.prototype.layout = function(layout) { - this._layout = layout; - return this; - }; - - Component.prototype.hasLayout = function() { - return !!this._layout; - }; - - Component.prototype.getLayout = function() { - return this._layout; - }; - - Component.prototype.setContent = function(content) { - if (content == null) return this; - if (content.el != null) { - if (content.render != null) { - return content = content.render().el; - } else { - return content = content.el; - } - } else { - return content = content; - } - }; - - Component.prototype.slug = function(string) { - if (string == null) return this; - return string.toLowerCase().replace(/\ +/g, "-").replace(/[^a-z0-9-]/g, ""); - }; - - return Component; - - })(Backbone.View); - - Backpack.Layout = (function(_super) { - - __extends(Layout, _super); - - function Layout() { - this.wrap = __bind(this.wrap, this); - this.gutter = __bind(this.gutter, this); - this.columnWidth = __bind(this.columnWidth, this); - this.columns = __bind(this.columns, this); - this.add = __bind(this.add, this); - Layout.__super__.constructor.apply(this, arguments); - } - - Layout.prototype.tagName = 'div'; - - Layout.prototype.config = { - 'type': 'layout', - 'columns': 1, - 'gutter': '30' - }; - - Layout.prototype.initialize = function() { - this.addClass('clearfix'); - Layout.__super__.initialize.call(this); - return this; - }; - - Layout.prototype.add = function() { - var content, element, item, span, _i, _len, _results; - this.columns(arguments.length); - this.columnWidth(); - _results = []; - for (_i = 0, _len = arguments.length; _i < _len; _i++) { - item = arguments[_i]; - if (_.isFunction(item)) { - content = item; - } else { - content = item.content, span = item.span; - } - span || (span = 1); - element = this.setContent(content); - element = this.wrap(element, span); - _results.push(this.append(element)); - } - return _results; - }; - - Layout.prototype.columns = function(count) { - this._cols = count; - this._remaining = count; - return this; - }; - - Layout.prototype.columnWidth = function() { - var availableWidth, parentWidth; - parentWidth = this.$parent.width(); - availableWidth = parentWidth - (this._cols * this._gutter); - this._colWidth = availableWidth / this._cols; - return this; - }; - - Layout.prototype.gutter = function(width) { - this.css({ - 'margin-left': "-" + width + "px" - }); - this._gutter = width; - return this; - }; - - Layout.prototype.wrap = function(el, span) { - var style, wrapped; - style = "float: left; width: " + (this._colWidth * span) + "px; margin-left: " + this._gutter + "px"; - return wrapped = this.make('div', { - style: style - }, el); - }; - - return Layout; - - })(Backpack.Component); - - Backpack.Menu = (function(_super) { - - __extends(Menu, _super); - - function Menu() { - this.add = __bind(this.add, this); - Menu.__super__.constructor.apply(this, arguments); - } - - Menu.prototype.tagName = 'ul'; - - Menu.prototype.initialize = function() { - Menu.__super__.initialize.call(this); - this.addClass('backpack-menu'); - return this; - }; - - Menu.prototype.add = function() { - var item, menuItem, _i, _len; - for (_i = 0, _len = arguments.length; _i < _len; _i++) { - item = arguments[_i]; - if (item.el) { - menuItem = item; - } else { - menuItem = new Backpack.MenuItem(item); - } - this.append(menuItem.show().el); - } - return this; - }; - - return Menu; - - })(Backpack.Component); - - Backpack.MenuItem = (function(_super) { - - __extends(MenuItem, _super); - - function MenuItem() { - this.content = __bind(this.content, this); - this.render = __bind(this.render, this); - MenuItem.__super__.constructor.apply(this, arguments); - } - - MenuItem.prototype.tagName = 'li'; - - MenuItem.prototype.template = _.template("<%= content %>"); - - MenuItem.prototype.initialize = function() { - var content, events, _ref; - this.addClass('backpack-menu-item'); - MenuItem.__super__.initialize.call(this); - _ref = this.options, content = _ref.content, events = _ref.events; - this.content(content, events); - this.delegateEvents(this.events); - return this; - }; - - MenuItem.prototype.render = function() { - this.$el.html(this._content); - return this; - }; - - MenuItem.prototype.content = function(content, events) { - if (events == null) events = {}; - if (content.el != null) { - this._content = content.el; - return this; - } - if (_.isString(events)) { - this._content = this.template({ - href: events, - content: content - }); - return this; - } - if (_.isFunction(events)) { - this.events = { - 'click': events - }; - this._content = this.template({ - href: 'javascript:void(0);', - content: content - }); - return this; - } - this.events = events; - this._content = this.template({ - href: 'javascript:void(0);', - content: content - }); - return this; - }; - - return MenuItem; - - })(Backpack.Component); - - Backpack.Overlay = (function(_super) { - - __extends(Overlay, _super); - - function Overlay() { - this.remove = __bind(this.remove, this); - this.color = __bind(this.color, this); - this.lockOverlay = __bind(this.lockOverlay, this); - this.close = __bind(this.close, this); - this.unlock = __bind(this.unlock, this); - this.show = __bind(this.show, this); - this.content = __bind(this.content, this); - this.render = __bind(this.render, this); - Overlay.__super__.constructor.apply(this, arguments); - } - - Overlay.prototype.template = "
\n
\n
\n
\n
"; - - Overlay.prototype.events = { - 'click': 'unlock', - 'click .backpack-overlay-container': function(e) { - return e.stopPropagation(); - } - }; - - Overlay.prototype.config = { - 'type': 'overlay', - 'color': 'rgba(0,0,0,0.7)', - 'renderType': 'prepend', - 'lockOverlay': false - }; - - Overlay.prototype.initialize = function() { - this.append(this.template); - return Overlay.__super__.initialize.call(this); - }; - - Overlay.prototype.render = function() { - this.$('.backpack-overlay-container').html(this._content); - Overlay.__super__.render.call(this); - return this; - }; - - Overlay.prototype.content = function(content) { - if (content == null) return this; - this._content = this.setContent(content); - return this; - }; - - Overlay.prototype.show = function() { - Overlay.__super__.show.call(this); - this.$parent.addClass('overlay'); - return this; - }; - - Overlay.prototype.unlock = function() { - if (!this._lockOverlay) this.close(); - return this; - }; - - Overlay.prototype.close = function() { - Overlay.__super__.close.call(this); - this.trigger('overlay-close'); - return this; - }; - - Overlay.prototype.lockOverlay = function(lockOverlay) { - this._lockOverlay = !!lockOverlay; - return this; - }; - - Overlay.prototype.color = function(color) { - this.el.style.backgroundColor = color; - return this; - }; - - Overlay.prototype.remove = function() { - this.$parent.removeClass('overlay'); - Overlay.__super__.remove.call(this); - return this; - }; - - return Overlay; - - })(Backpack.Component); - - Backpack.Modal = (function(_super) { - - __extends(Modal, _super); - - function Modal() { - this.newOverlay = __bind(this.newOverlay, this); - this.closable = __bind(this.closable, this); - this.title = __bind(this.title, this); - this.remove = __bind(this.remove, this); - this.close = __bind(this.close, this); - this.hide = __bind(this.hide, this); - this.show = __bind(this.show, this); - Modal.__super__.constructor.apply(this, arguments); - } - - Modal.prototype.events = { - 'click .close': 'close' - }; - - Modal.prototype.config = { - 'type': 'modal', - 'closable': true, - 'lockOverlay': true - }; - - Modal.prototype.initialize = function() { - Modal.__super__.initialize.call(this); - this.newOverlay(); - return this; - }; - - Modal.prototype.show = function() { - var _ref; - Modal.__super__.show.call(this); - if ((_ref = this.overlay) != null) _ref.show(); - return this; - }; - - Modal.prototype.hide = function() { - var _ref; - Modal.__super__.hide.call(this); - if ((_ref = this.overlay) != null) _ref.hide(); - return this; - }; - - Modal.prototype.close = function() { - var _ref; - Modal.__super__.close.call(this); - if ((_ref = this.overlay) != null) _ref.remove(); - return this; - }; - - Modal.prototype.remove = function() { - var _ref; - Modal.__super__.remove.call(this); - if ((_ref = this.overlay) != null) _ref.remove(); - return this; - }; - - Modal.prototype.title = function(title) { - this._title = title; - this.prepend("" + title + ""); - return this; - }; - - Modal.prototype.closable = function() { - if (!arguments[0]) return this; - this.prepend("×"); - return this; - }; - - Modal.prototype.newOverlay = function() { - this.overlay = new Backpack.Overlay({ - lockOverlay: this.options.lockOverlay, - content: this.el, - color: this.options.color - }); - this.overlay.on('overlay-close', this.close); - return this; - }; - - return Modal; - - })(Backpack.Component); - - Backpack.Swipe = (function(_super) { - - __extends(Swipe, _super); - - function Swipe() { - this.content = __bind(this.content, this); - Swipe.__super__.constructor.apply(this, arguments); - } - - Swipe.prototype.id = 'slider'; - - Swipe.prototype.config = { - 'type': 'swipe', - 'renderType': 'append', - 'startSlide': 0, - 'speed': 300, - 'auto': 4000, - 'continuous': true, - 'disableScroll': false, - 'callback': function() {}, - 'transitionEnd': function() {} - }; - - Swipe.prototype.initialize = function() { - Swipe.__super__.initialize.call(this); - return window.s = new window.Swipe(this.el, this.options); - }; - - Swipe.prototype.content = function(slides) { - var content, _i, _len; - for (_i = 0, _len = arguments.length; _i < _len; _i++) { - content = arguments[_i]; - this.$el.append(content); - } - return this; - }; - - return Swipe; - - })(Backpack.Component); - - Backpack.Tabs = (function(_super) { - - __extends(Tabs, _super); - - function Tabs() { - this.exit = __bind(this.exit, this); - this.select = __bind(this.select, this); - this.setActive = __bind(this.setActive, this); - this.setTab = __bind(this.setTab, this); - this.add = __bind(this.add, this); - Tabs.__super__.constructor.apply(this, arguments); - } - - Tabs.prototype.tagName = 'ul'; - - Tabs.prototype.config = { - 'type': 'tabs' - }; - - Tabs.prototype.initialize = function() { - var _ref; - this.addClass('clearfix'); - this.active = (_ref = this.options.active) != null ? _ref : 0; - return Tabs.__super__.initialize.call(this); - }; - - Tabs.prototype.add = function() { - var item, tab, _i, _len; - for (_i = 0, _len = arguments.length; _i < _len; _i++) { - item = arguments[_i]; - item = _.extend(item, { - parent: this - }); - if (item.el) { - tab = item; - } else { - tab = new Backpack.Tab(item); - } - this.setTab(tab); - } - this.setActive(); - return this; - }; - - Tabs.prototype.setTab = function(tab) { - tab.on('tab-click', this.select); - tab.on('tab-exit', this.exit); - this.append(tab.show().el); - this._items.push(tab); - return this; - }; - - Tabs.prototype.setActive = function() { - var activeTab; - activeTab = this._items[this.active]; - activeTab.addClass('backpack-tab-active'); - this.select(activeTab); - return this; - }; - - Tabs.prototype.select = function(tab) { - var curActive; - curActive = this._items[this.active]; - curActive.trigger('tab-exit', curActive); - this.active = _.indexOf(this._items, tab); - tab.addClass('backpack-tab-active'); - this.$el.next('.backpack-tab-content').remove(); - this.after(tab.tabContent.show().el); - return this; - }; - - Tabs.prototype.exit = function(tab) { - tab.removeClass('backpack-tab-active'); - return this; - }; - - return Tabs; - - })(Backpack.Component); - - Backpack.Tab = (function(_super) { - - __extends(Tab, _super); - - function Tab() { - this.select = __bind(this.select, this); - this.content = __bind(this.content, this); - this.render = __bind(this.render, this); - Tab.__super__.constructor.apply(this, arguments); - } - - Tab.prototype.tagName = 'li'; - - Tab.prototype.template = _.template("<%= content %>"); - - Tab.prototype.events = { - 'click': 'select' - }; - - Tab.prototype.config = { - 'type': 'tab' - }; - - Tab.prototype.initialize = function() { - Tab.__super__.initialize.call(this); - return this.tabContent = new Backpack.TabContent({ - content: this.options.tabContent, - parent: this.$parent - }); - }; - - Tab.prototype.render = function() { - this.$el.html(this._content); - return this; - }; - - Tab.prototype.content = function(content) { - if (content == null) return this; - content = this.setContent(content); - this._content = this.template({ - href: 'javascript:void(0);', - content: content - }); - return this; - }; - - Tab.prototype.select = function() { - this.trigger('tab-click', this); - return this; - }; - - return Tab; - - })(Backpack.Component); - - Backpack.TabContent = (function(_super) { - - __extends(TabContent, _super); - - function TabContent() { - this.render = __bind(this.render, this); - TabContent.__super__.constructor.apply(this, arguments); - } - - TabContent.prototype.config = { - 'type': 'tab-content' - }; - - TabContent.prototype.initialize = function() { - return TabContent.__super__.initialize.call(this); - }; - - TabContent.prototype.render = function() { - this.$parent.html(this._content); - return this; - }; - - return TabContent; - - })(Backpack.Component); - -}).call(this); diff --git a/lib/Backpack-bundle.min.js b/lib/Backpack-bundle.min.js deleted file mode 100644 index 3ee018b..0000000 --- a/lib/Backpack-bundle.min.js +++ /dev/null @@ -1 +0,0 @@ -((function(){"use strict";var a,b,c=function(a,b){return function(){return a.apply(b,arguments)}},d=Object.prototype.hasOwnProperty,e=function(a,b){function e(){this.constructor=a}for(var c in b)d.call(b,c)&&(a[c]=b[c]);return e.prototype=b.prototype,a.prototype=new e,a.__super__=b.prototype,a};b=typeof exports!="undefined"&&exports!==null?exports:this,a=b.Backpack={VERSION:"0.0.1",Prefix:"backpack"},_.extend(a,Backbone.Events),a.Component=function(b){function d(){this.slug=c(this.slug,this),this.setContent=c(this.setContent,this),this.getLayout=c(this.getLayout,this),this.hasLayout=c(this.hasLayout,this),this.layout=c(this.layout,this),this.isRendered=c(this.isRendered,this),this.getItems=c(this.getItems,this),this.items=c(this.items,this),this.name=c(this.name,this),this.css=c(this.css,this),this.removeClass=c(this.removeClass,this),this.addClass=c(this.addClass,this),this.parent=c(this.parent,this),this.content=c(this.content,this),this.prepend=c(this.prepend,this),this.append=c(this.append,this),this.after=c(this.after,this),this.before=c(this.before,this),this.remove=c(this.remove,this),this.close=c(this.close,this),this.hide=c(this.hide,this),this.show=c(this.show,this),this.visible=c(this.visible,this),this.getType=c(this.getType,this),this.type=c(this.type,this),this.getRenderEl=c(this.getRenderEl,this),this.renderEl=c(this.renderEl,this),this.renderType=c(this.renderType,this),this.render=c(this.render,this),d.__super__.constructor.apply(this,arguments)}return e(d,b),d.prototype.tagName="div",d.prototype.className="backpack-component",d.prototype.defaults={parent:"body",type:"component",renderType:"append",content:null,visible:!0},d.prototype.initialize=function(){var a,b,c,d,e,f;this._items=[],this._rendered=!1,this._renderTypes=["append","prepend","html"],this.options=_.extend({},this.defaults,this.config,this.options),e=this.options,f=[];for(b in e)a=e[b],this[b]!=null&&(_.isArray(a)?typeof (d=this[b]).apply=="function"&&d.apply(this,a):typeof (c=this[b]).call=="function"&&c.call(this,a)),f.push(null);return f},d.prototype.render=function(){var a;return a=this.$parent[this._renderType],a.call(this.$parent,this.getRenderEl()),this._rendered=!0,this},d.prototype.renderType=function(a){var b;return b=_.include(this._renderTypes,a),b?(this._renderType=a,this):this},d.prototype.renderEl=function(a){return this._renderEl=a,this},d.prototype.getRenderEl=function(){return this._renderEl!=null?this._renderEl:this.el},d.prototype.type=function(b){return this._type=this.slug(""+a.Prefix+" "+b),this.addClass(this._type),this},d.prototype.getType=function(){return this._type},d.prototype.visible=function(a){return a?this.show():this.hide(),this},d.prototype.show=function(){return this.isRendered()||this.render(),this.delegateEvents(this.events),this.$el.removeClass("hide"),this._visible=!0,this},d.prototype.hide=function(){return this.$el.addClass("hide"),this.undelegateEvents(),this._visible=!1,this},d.prototype.close=function(){return this.hide(),this.remove(),this},d.prototype.remove=function(){return this.undelegateEvents(),d.__super__.remove.call(this),this},d.prototype.before=function(a){return a=this.setContent(a),this.$el.before(a),this},d.prototype.after=function(a){return a=this.setContent(a),this.$el.after(a),this},d.prototype.append=function(a){return a=this.setContent(a),this.$el.append(a),this},d.prototype.prepend=function(a){return a=this.setContent(a),this.$el.prepend(a),this},d.prototype.content=function(a){var b;return a==null?this:(this._content=this.setContent(a),b=this.make("div",{"class":"content clearfix"},this._content),this.$el.append(b),this)},d.prototype.parent=function(a){return a==null?this:(this.$parent=$(a),this)},d.prototype.addClass=function(a){return this.$el.addClass(a),this},d.prototype.removeClass=function(a){return this.$el.removeClass(a),this},d.prototype.css=function(a){return this.$el.css(a),this},d.prototype.name=function(a){return this.name=this.addClass(this.slug(a)),this},d.prototype.items=function(){var a,b,c;for(b=0,c=arguments.length;b<%= content %>"),b.prototype.initialize=function(){var a,c,d;return this.addClass("backpack-menu-item"),b.__super__.initialize.call(this),d=this.options,a=d.content,c=d.events,this.content(a,c),this.delegateEvents(this.events),this},b.prototype.render=function(){return this.$el.html(this._content),this},b.prototype.content=function(a,b){return b==null&&(b={}),a.el!=null?(this._content=a.el,this):_.isString(b)?(this._content=this.template({href:b,content:a}),this):_.isFunction(b)?(this.events={click:b},this._content=this.template({href:"javascript:void(0);",content:a}),this):(this.events=b,this._content=this.template({href:"javascript:void(0);",content:a}),this)},b}(a.Component),a.Overlay=function(a){function b(){this.remove=c(this.remove,this),this.color=c(this.color,this),this.lockOverlay=c(this.lockOverlay,this),this.close=c(this.close,this),this.unlock=c(this.unlock,this),this.show=c(this.show,this),this.content=c(this.content,this),this.render=c(this.render,this),b.__super__.constructor.apply(this,arguments)}return e(b,a),b.prototype.template="
\n
\n
\n
\n
",b.prototype.events={click:"unlock","click .backpack-overlay-container":function(a){return a.stopPropagation()}},b.prototype.config={type:"overlay",color:"rgba(0,0,0,0.7)",renderType:"prepend",lockOverlay:!1},b.prototype.initialize=function(){return this.append(this.template),b.__super__.initialize.call(this)},b.prototype.render=function(){return this.$(".backpack-overlay-container").html(this._content),b.__super__.render.call(this),this},b.prototype.content=function(a){return a==null?this:(this._content=this.setContent(a),this)},b.prototype.show=function(){return b.__super__.show.call(this),this.$parent.addClass("overlay"),this},b.prototype.unlock=function(){return this._lockOverlay||this.close(),this},b.prototype.close=function(){return b.__super__.close.call(this),this.trigger("overlay-close"),this},b.prototype.lockOverlay=function(a){return this._lockOverlay=!!a,this},b.prototype.color=function(a){return this.el.style.backgroundColor=a,this},b.prototype.remove=function(){return this.$parent.removeClass("overlay"),b.__super__.remove.call(this),this},b}(a.Component),a.Modal=function(b){function d(){this.newOverlay=c(this.newOverlay,this),this.closable=c(this.closable,this),this.title=c(this.title,this),this.remove=c(this.remove,this),this.close=c(this.close,this),this.hide=c(this.hide,this),this.show=c(this.show,this),d.__super__.constructor.apply(this,arguments)}return e(d,b),d.prototype.events={"click .close":"close"},d.prototype.config={type:"modal",closable:!0,lockOverlay:!0},d.prototype.initialize=function(){return d.__super__.initialize.call(this),this.newOverlay(),this},d.prototype.show=function(){var a;return d.__super__.show.call(this),(a=this.overlay)!=null&&a.show(),this},d.prototype.hide=function(){var a;return d.__super__.hide.call(this),(a=this.overlay)!=null&&a.hide(),this},d.prototype.close=function(){var a;return d.__super__.close.call(this),(a=this.overlay)!=null&&a.remove(),this},d.prototype.remove=function(){var a;return d.__super__.remove.call(this),(a=this.overlay)!=null&&a.remove(),this},d.prototype.title=function(a){return this._title=a,this.prepend(""+a+""),this},d.prototype.closable=function(){return arguments[0]?(this.prepend("×"),this):this},d.prototype.newOverlay=function(){return this.overlay=new a.Overlay({lockOverlay:this.options.lockOverlay,content:this.el,color:this.options.color}),this.overlay.on("overlay-close",this.close),this},d}(a.Component),a.Swipe=function(a){function b(){this.content=c(this.content,this),b.__super__.constructor.apply(this,arguments)}return e(b,a),b.prototype.id="slider",b.prototype.config={type:"swipe",renderType:"append",startSlide:0,speed:300,auto:4e3,continuous:!0,disableScroll:!1,callback:function(){},transitionEnd:function(){}},b.prototype.initialize=function(){return b.__super__.initialize.call(this),window.s=new window.Swipe(this.el,this.options)},b.prototype.content=function(a){var b,c,d;for(c=0,d=arguments.length;c<%= content %>"),d.prototype.events={click:"select"},d.prototype.config={type:"tab"},d.prototype.initialize=function(){return d.__super__.initialize.call(this),this.tabContent=new a.TabContent({content:this.options.tabContent,parent:this.$parent})},d.prototype.render=function(){return this.$el.html(this._content),this},d.prototype.content=function(a){return a==null?this:(a=this.setContent(a),this._content=this.template({href:"javascript:void(0);",content:a}),this)},d.prototype.select=function(){return this.trigger("tab-click",this),this},d}(a.Component),a.TabContent=function(a){function b(){this.render=c(this.render,this),b.__super__.constructor.apply(this,arguments)}return e(b,a),b.prototype.config={type:"tab-content"},b.prototype.initialize=function(){return b.__super__.initialize.call(this)},b.prototype.render=function(){return this.$parent.html(this._content),this},b}(a.Component)})).call(this); \ No newline at end of file diff --git a/lib/css/Backpack-bare.css b/lib/css/Backpack-bare.css deleted file mode 100644 index cc9e8f3..0000000 --- a/lib/css/Backpack-bare.css +++ /dev/null @@ -1,403 +0,0 @@ -.backpack { - margin: 0; - padding: 0; -} - -.backpack-component { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - - -/* -------------------- - * Backpack Helpers - * -------------------- - */ -.backpack .hide { - opacity: 0; - pointer-events: none; - filter: alpha(opacity=0); - position: absolute; - overflow: hidden; - clip: rect(0 0 0 0); - height: 1px; width: 1px; - margin: -1px; padding: 0; border: 0; -} - -.backpack .hidden { - opacity: 0; -} - -.backpack .clearfix { - zoom: 1; -} - -.backpack .clearfix::after { - clear: both; - content: "."; - display: block; - font-size: 0; - height: 0; - line-height: 0; - visibility: hidden; -} - -.backpack .round { - -webkit-border-radius: 4px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - border-radius: 4px; -} - -.backpack .round-top { - -webkit-border-top-left-radius: 4px; - -webkit-border-top-right-radius: 4px; - -moz-border-radius-topleft: 4px; - -moz-border-radius-topright: 4px; - border-top-left-radius: 4px; - border-top-right-radius: 4px; -} - -.backpack .round-bottom { - -webkit-border-bottom-left-radius: 4px; - -webkit-border-bottom-right-radius: 4px; - -moz-border-radius-bottomleft: 4px; - -moz-border-radius-bottomright: 4px; - border-bottom-left-radius: 4px; - border-bottom-right-radius: 4px; -} - -.backpack .round-left { - -webkit-border-top-left-radius: 4px; - -webkit-border-bottom-left-radius: 4px; - -moz-border-radius-topleft: 4px; - -moz-border-radius-bottomleft: 4px; - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; -} - -.backpack .round-right { - -webkit-border-top-right-radius: 4px; - -webkit-border-bottom-right-radius: 4px; - -moz-border-radius-topright: 4px; - -moz-border-radius-bottomright: 4px; - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; -} -/* -------------------- - * Backpack.Menu - * Backpack.MenuItem - * -------------------- - */ -.backpack-menu { - padding: 0; - margin: 0; - display: block; - overflow: hidden; - text-align: center; -} - -.backpack-list { - border: none; - display: inline; - text-align: left; -} - -.backpack-menu > li, -.backpack-menu-item { - float: left; - list-style: none; -} - -.backpack-list > li, -.backpack-list .backpack-menu-item { - float: none; -} - -.backpack-menu > li > a, -.backpack-menu-item a { - display: table-cell; - vertical-align: middle; -} - -.backpack-list > li > a, -.backpack-list .backpack-menu-item a { - display: table-cell; - vertical-align: middle; -} - -.backpack-menu > li:first-child > a { - -} - -.backpack-menu > li:last-child > a { - -} - -.backpack-list > li:first-child { - -} - -.backpack-menu > li > a:hover { - -} - - - -/* -------------------- - * Backpack.Tabs - * Backpack.Tab - * -------------------- - */ -.backpack-tabs { - padding: 0; - margin: 0; - display: block; - text-align: center; -} - -.backpack-tabs::before, -.backpack-tabs::after { - display: table; - content: ""; -} - -.backpack-tabs > a, -.backpack-tab { - float: left; - list-style: none; -} - -.backpack-tab > a { - display: table-cell; - vertical-align: middle; - text-decoration: none; -} - -.backpack-tab > a:hover { - -} - -.backpack-tabs > li:first { - -} - -.backpack-tab-content { - -} - -.backpack-tab-active { - -} - -.backpack-tab-active > a { - -} - -.backpack-tab-active > a:hover { - -} - - - -/* -------------------- - * Backpack.Dialog - * Backpack.Modal - * -------------------- - */ -.backpack-modal { - position: relative; - text-align: left; - margin: 20px 0; - padding: 10px 23px; - min-width: 10px; - background-color: #FFF; -} - -.backpack-modal > .close { - display: block; - position: absolute; - top: 0; - right: 0; - padding: 0 6px; - font-size: 20px; - font-weight: bold; - color: #888; - cursor: pointer; -} - -.backpack-modal > .close:hover { - color: #333; -} - -.backpack-modal > .content { - clear: both; - margin: 0; -} - -.backpack-modal > .title { - font-weight: bold; - display: block; - font-weight: 1.4em; - border-bottom: 1px solid #ddd; -} - - -/* -------------------- - * Backpack.Overlay - * -------------------- - */ - -.backpack.overlay { - overflow: auto; -} - -.backpack-overlay { - overflow: auto; - position: fixed; - top: 0; - left: 0; - bottom: 0; - right: 0; - z-index: 9; -} - -.backpack-overlay-outer { - display: table; - height: 100%; - table-layout: fixed; - width: 100%; -} - -.backpack-overlay-inner { - display: table-cell; - text-align: center; - vertical-align: middle; - width: 100%; -} - -.backpack-overlay-container { - display: inline-block; - outline: none; - text-align: left; -} - -.backpack-overlay-border { - margin: 20px 0; -} - -/* -------------------- - * Backpack Layout - * -------------------- - */ -.backpack-layout { - -} - - -/* -------------------- - * Backpack Swipe - * -------------------- - */ -.swipe-active { - overflow:hidden; - position:relative; -} -.swipe-active > * { - display:block; - visibility:hidden; - position:absolute; - top:0; - left:0; -} - - -/* -------------------- - * Backpack Button - * -------------------- - */ -button, -a.button { - color: #888; - font-size: 1.4em; - font-weight: bold; - padding: 0.5em 0.8em; - position: relative; - display: table-cell; - vertical-align: middle; - border: none; - cursor: pointer; - text-align: center; - text-decoration: none; - text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); - -webkit-user-select:none; - -moz-user-select:none; - -ms-user-select:none; - -o-user-select:none; - user-select:none; - -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 2px 0.5px rgba(0,0,0,0.2); - -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 2px 0.5px rgba(0,0,0,0.2); - -ms-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 2px 0.5px rgba(0,0,0,0.2); - -o-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 2px 0.5px rgba(0,0,0,0.2); - box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 2px 0.5px rgba(0,0,0,0.2); - background: #eeeeee; /* Old browsers */ - background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */ - background: linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */ - -webkit-transition-duration: 0.2s; - -moz-transition-duration: 0.2s; - -ms-transition-duration: 0.2s; - -o-transition-duration: 0.2s; - transition-duration: 0.2s; -} - -button:hover, -button:focus, -a.button:hover, -a.button:focus { - /* Gradient #eeeeee -> #d4d4d4 */ - background: #eeeeee; /* Old browsers */ - background: -moz-linear-gradient(top, #eeeeee 0%, #d4d4d4 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#d4d4d4)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #eeeeee 0%,#d4d4d4 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #eeeeee 0%,#d4d4d4 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #eeeeee 0%,#d4d4d4 100%); /* IE10+ */ - background: linear-gradient(top, #eeeeee 0%,#d4d4d4 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#d4d4d4',GradientType=0 ); /* IE6-9 */ -} - -button:active, -a.button:active { - /* Gradient #cccccc -> #eeeeee */ - background: #eeeeee; /* Old browsers */ - background: -moz-linear-gradient(top, #cccccc 0%, #eeeeee 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#cccccc), color-stop(100%,#eeeeee)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #cccccc 0%,#eeeeee 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #cccccc 0%,#eeeeee 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #cccccc 0%,#eeeeee 100%); /* IE10+ */ - background: linear-gradient(top, #cccccc 0%,#eeeeee 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cccccc', endColorstr='#eeeeee',GradientType=0 ); /* IE6-9 */ -} -} \ No newline at end of file diff --git a/lib/css/Backpack.css b/lib/css/Backpack.css deleted file mode 100644 index e051e00..0000000 --- a/lib/css/Backpack.css +++ /dev/null @@ -1,483 +0,0 @@ -.backpack { - margin: 0; - padding: 0; - font-family: Helvetica, Arial, sans-serif; -} - -.backpack-component { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - - -/* -------------------- - * Backpack Helpers - * -------------------- - */ -.backpack .hide { - opacity: 0; - pointer-events: none; - filter: alpha(opacity=0); - position: absolute; - overflow: hidden; - clip: rect(0 0 0 0); - height: 1px; width: 1px; - margin: -1px; padding: 0; border: 0; -} - -.backpack .hidden { - opacity: 0; -} - -.backpack .clearfix { - zoom: 1; -} - -.backpack .clearfix::after { - clear: both; - content: "."; - display: block; - font-size: 0; - height: 0; - line-height: 0; - visibility: hidden; -} - -.backpack .round { - -webkit-border-radius: 4px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - border-radius: 4px; -} - -.backpack .round-top { - -webkit-border-top-left-radius: 4px; - -webkit-border-top-right-radius: 4px; - -moz-border-radius-topleft: 4px; - -moz-border-radius-topright: 4px; - border-top-left-radius: 4px; - border-top-right-radius: 4px; -} - -.backpack .round-bottom { - -webkit-border-bottom-left-radius: 4px; - -webkit-border-bottom-right-radius: 4px; - -moz-border-radius-bottomleft: 4px; - -moz-border-radius-bottomright: 4px; - border-bottom-left-radius: 4px; - border-bottom-right-radius: 4px; -} - -.backpack .round-left { - -webkit-border-top-left-radius: 4px; - -webkit-border-bottom-left-radius: 4px; - -moz-border-radius-topleft: 4px; - -moz-border-radius-bottomleft: 4px; - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; -} - -.backpack .round-right { - -webkit-border-top-right-radius: 4px; - -webkit-border-bottom-right-radius: 4px; - -moz-border-radius-topright: 4px; - -moz-border-radius-bottomright: 4px; - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; -} - -.backpack .press { - border-top: 1px solid rgba(200,200,200,0.3); - border-right: 1px solid rgba(200,200,200,0.5); - border-left: 1px solid rgba(200,200,200,0.5); - border-bottom: 1px solid rgba(200,200,200,0.8); - background:-webkit-gradient(linear,center top,center bottom,from(#FEFEFE),to(#F0F0F0)); - background:-moz-linear-gradient(top,#FEFEFE,#F0F0F0); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FEFEFE',endColorstr='#F0F0F0',GradientType=0); - -webkit-box-shadow: 0 2px 6px rgba(128,128,128,0.2); - -moz-box-shadow: 0 2px 6px rgba(128,128,128,0.2); - box-shadow: 0 2px 6px rgba(128,128,128,0.2); -} - -/* -------------------- - * Backpack.Menu - * Backpack.MenuItem - * -------------------- - */ -.backpack-menu { - padding: 0; - margin: 0; - display: block; - overflow: hidden; - text-align: center; - background: #FEFEFE; - border: 1px solid #DDD; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - -ms-border-radius: 4px; - -o-border-radius: 4px; - border-radius: 4px; -} - -.backpack-list { - border: none; - display: inline; - text-align: left; -} - -.backpack-menu > li, -.backpack-menu-item { - float: left; - list-style: none; -} - -.backpack-list > li, -.backpack-list .backpack-menu-item { - float: none; - border-top: 1px solid rgba(128,128,128,0.1); -} - -.backpack-menu > li > a, -.backpack-menu-item a { - color: #999; - padding: 20px 25px; - display: table-cell; - vertical-align: middle; - text-decoration: none; - border-right: 1px solid #EEE; - border-top: 1px solid rgba(255,255,255,0.9); -} - -.backpack-list > li > a, -.backpack-list .backpack-menu-item a { - color: #999; - padding: 15px 10px; - display: table-cell; - vertical-align: middle; - text-decoration: none; - border: none; -} - -.backpack-menu > li:first-child > a { - -webkit-border-top-left-radius: 4px; - -webkit-border-bottom-left-radius: 4px; - -moz-border-radius-topleft: 4px; - -moz-border-radius-bottomleft: 4px; - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; -} - -.backpack-menu > li:last-child > a { - -webkit-border-top-right-radius: 4px; - -webkit-border-bottom-right-radius: 4px; - -moz-border-radius-topright: 4px; - -moz-border-radius-bottomright: 4px; - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; - border-right: none; -} - -.backpack-list > li:first-child { - border-top-color: transparent; -} - -.backpack-menu > li > a:hover { - opacity: 0.8; - filter: alpha(opacity=0); -} - - - -/* -------------------- - * Backpack.Tabs - * Backpack.Tab - * -------------------- - */ -.backpack-tabs { - padding: 0; - margin: 0; - display: block; - text-align: center; - border-bottom: 1px solid #DDD; -} - -.backpack-tabs::before, -.backpack-tabs::after { - display: table; - content: ""; -} - -.backpack-tabs > a, -.backpack-tab { - float: left; - list-style: none; - border: 1px solid transparent; -} - -.backpack-tab > a { - color: #999; - padding: 15px 25px; - display: table-cell; - vertical-align: middle; - text-decoration: none; -} - -.backpack-tab > a:hover { - text-decoration: none; - background-color: #f8f8f8; -} - -.backpack-tabs > li:first { - margin-left: -1px; -} - -.backpack-tab-content { - padding: 0 20px 25px; - margin: 0 0 50px 0; - border: 1px solid #ddd; - background-color: #fff; - border-top-color: transparent; -} - -.backpack-tab-active { - margin-bottom: -2px; -} - -.backpack-tab-active > a { - background-color: #fff; - padding: 14px 24px 17px; - border: 1px solid #ddd; - border-bottom: transparent; -} - -.backpack-tab-active > a:hover { - background-color: #fff; -} - - - -/* -------------------- - * Backpack.Dialog - * Backpack.Modal - * -------------------- - */ -.backpack-modal { - position: relative; - text-align: left; - color: #333; - margin: 20px 0; - padding: 10px 23px; - font-size: 15px; - min-width: 400px; - border: 1px solid #DDD; - background-color: #FFF; - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - border-radius: 2px; - -webkit-box-shadow: 0 3px 8px 0 rgba(0, 0, 0, 0.2); - -moz-box-shadow: 0 3px 8px 0 rgba(0, 0, 0, 0.2); - box-shadow: 0 3px 8px 0 rgba(0, 0, 0, 0.2); -} - -.backpack-modal > .close { - display: block; - position: absolute; - top: 0; - right: 0; - padding: 0 6px; - font-size: 20px; - font-weight: bold; - color: #888; - cursor: pointer; -} - -.backpack-modal > .close:hover { - color: #333; -} - -.backpack-modal > .content { - clear: both; - margin: 0; -} - -.backpack-modal > .title { - color: #333; - font-weight: bold; - display: block; - font-weight: 1.4em; - padding-bottom: 10px; - margin-bottom: 15px; - border-bottom: 1px solid #ddd; -} - -.backpack-modal > .backpack-dialog-button-container { - position: absolute; - bottom: 0; - left: 0; - width: 100%; - background: pink; - text-align: right; -} - - -/* -------------------- - * Backpack.Overlay - * -------------------- - */ - -.backpack.overlay { - overflow: auto; -} - -.backpack-overlay { - overflow: auto; - position: fixed; - top: 0; - left: 0; - bottom: 0; - right: 0; - z-index: 9; - -webkit-transition-duration: 0.2s; - -moz-transition-duration: 0.2s; - -ms-transition-duration: 0.2s; - -o-transition-duration: 0.2s; - transition-duration: 0.2s; -} - -.backpack-overlay-outer { - display: table; - height: 100%; - table-layout: fixed; - width: 100%; -} - -.backpack-overlay-inner { - display: table-cell; - text-align: center; - vertical-align: middle; - width: 100%; -} - -.backpack-overlay-container { - display: inline-block; - outline: none; - text-align: left; -} - -.backpack-overlay-border { - margin: 20px 0; -} - -/* -------------------- - * Backpack Layout - * -------------------- - */ -.backpack-layout { - -} - - -/* -------------------- - * Backpack Swipe - * -------------------- - */ -.swipe-active { - overflow:hidden; - position:relative; -} -.swipe-active > * { - display:block; - visibility:hidden; - position:absolute; - top:0; - left:0; -} - - -/* -------------------- - * Backpack Button - * -------------------- - */ -button, -a.button { - color: #888; - font-size: 1.4em; - font-weight: bold; - padding: 0.5em 0.8em; - position: relative; - display: table-cell; - vertical-align: middle; - border: none; - cursor: pointer; - text-align: center; - text-decoration: none; - text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); - -webkit-user-select:none; - -moz-user-select:none; - -ms-user-select:none; - -o-user-select:none; - user-select:none; - -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 2px 0.5px rgba(0,0,0,0.2); - -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 2px 0.5px rgba(0,0,0,0.2); - -ms-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 2px 0.5px rgba(0,0,0,0.2); - -o-box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 2px 0.5px rgba(0,0,0,0.2); - box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), - inset 0 0 3px rgba(255,255,255,0.8), - inset 0 0 2px 0.5px rgba(0,0,0,0.7), - 0 1px 2px 0.5px rgba(0,0,0,0.2); - background: #eeeeee; /* Old browsers */ - background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */ - background: linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */ - -webkit-transition-duration: 0.2s; - -moz-transition-duration: 0.2s; - -ms-transition-duration: 0.2s; - -o-transition-duration: 0.2s; - transition-duration: 0.2s; -} - -button:hover, -button:focus, -a.button:hover, -a.button:focus { - background: #eeeeee; /* Old browsers */ - background: -moz-linear-gradient(top, #eeeeee 0%, #d4d4d4 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#d4d4d4)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #eeeeee 0%,#d4d4d4 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #eeeeee 0%,#d4d4d4 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #eeeeee 0%,#d4d4d4 100%); /* IE10+ */ - background: linear-gradient(top, #eeeeee 0%,#d4d4d4 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#d4d4d4',GradientType=0 ); /* IE6-9 */ -} - -button:active, -a.button:active { - background: #eeeeee; /* Old browsers */ - background: -moz-linear-gradient(top, #cccccc 0%, #eeeeee 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#cccccc), color-stop(100%,#eeeeee)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #cccccc 0%,#eeeeee 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #cccccc 0%,#eeeeee 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #cccccc 0%,#eeeeee 100%); /* IE10+ */ - background: linear-gradient(top, #cccccc 0%,#eeeeee 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cccccc', endColorstr='#eeeeee',GradientType=0 ); /* IE6-9 */ -} -} \ No newline at end of file diff --git a/lib/js/Backpack.Component.js b/lib/js/Backpack.Component.js deleted file mode 100644 index 5b9c00d..0000000 --- a/lib/js/Backpack.Component.js +++ /dev/null @@ -1,266 +0,0 @@ -(function() { - var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __hasProp = Object.prototype.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; - - Backpack.Component = (function(_super) { - - __extends(Component, _super); - - function Component() { - this.slug = __bind(this.slug, this); - this.setContent = __bind(this.setContent, this); - this.getLayout = __bind(this.getLayout, this); - this.hasLayout = __bind(this.hasLayout, this); - this.layout = __bind(this.layout, this); - this.isRendered = __bind(this.isRendered, this); - this.getItems = __bind(this.getItems, this); - this.items = __bind(this.items, this); - this.name = __bind(this.name, this); - this.css = __bind(this.css, this); - this.removeClass = __bind(this.removeClass, this); - this.addClass = __bind(this.addClass, this); - this.parent = __bind(this.parent, this); - this.content = __bind(this.content, this); - this.prepend = __bind(this.prepend, this); - this.append = __bind(this.append, this); - this.after = __bind(this.after, this); - this.before = __bind(this.before, this); - this.remove = __bind(this.remove, this); - this.close = __bind(this.close, this); - this.hide = __bind(this.hide, this); - this.show = __bind(this.show, this); - this.visible = __bind(this.visible, this); - this.getType = __bind(this.getType, this); - this.type = __bind(this.type, this); - this.getRenderEl = __bind(this.getRenderEl, this); - this.renderEl = __bind(this.renderEl, this); - this.renderType = __bind(this.renderType, this); - this.render = __bind(this.render, this); - Component.__super__.constructor.apply(this, arguments); - } - - Component.prototype.tagName = 'div'; - - Component.prototype.className = 'backpack-component'; - - Component.prototype.defaults = { - 'parent': 'body', - 'type': 'component', - 'renderType': 'append', - 'content': null, - 'visible': true - }; - - Component.prototype.initialize = function() { - var args, func, _base, _base2, _ref, _results; - this._items = []; - this._rendered = false; - this._renderTypes = ['append', 'prepend', 'html']; - this.options = _.extend({}, this.defaults, this.config, this.options); - _ref = this.options; - _results = []; - for (func in _ref) { - args = _ref[func]; - if (this[func] != null) { - if (!_.isArray(args)) { - if (typeof (_base = this[func]).call === "function") { - _base.call(this, args); - } - } else { - if (typeof (_base2 = this[func]).apply === "function") { - _base2.apply(this, args); - } - } - } - _results.push(null); - } - return _results; - }; - - Component.prototype.render = function() { - var func; - func = this.$parent[this._renderType]; - func.call(this.$parent, this.getRenderEl()); - this._rendered = true; - return this; - }; - - Component.prototype.renderType = function(type) { - var hasType; - hasType = _.include(this._renderTypes, type); - if (!hasType) return this; - this._renderType = type; - return this; - }; - - Component.prototype.renderEl = function(el) { - this._renderEl = el; - return this; - }; - - Component.prototype.getRenderEl = function() { - if (this._renderEl != null) return this._renderEl; - return this.el; - }; - - Component.prototype.type = function(type) { - this._type = this.slug("" + Backpack.Prefix + " " + type); - this.addClass(this._type); - return this; - }; - - Component.prototype.getType = function() { - return this._type; - }; - - Component.prototype.visible = function(show) { - if (show) { - this.show(); - } else { - this.hide(); - } - return this; - }; - - Component.prototype.show = function() { - if (!this.isRendered()) this.render(); - this.delegateEvents(this.events); - this.$el.removeClass('hide'); - this._visible = true; - return this; - }; - - Component.prototype.hide = function() { - this.$el.addClass('hide'); - this.undelegateEvents(); - this._visible = false; - return this; - }; - - Component.prototype.close = function() { - this.hide(); - this.remove(); - return this; - }; - - Component.prototype.remove = function() { - this.undelegateEvents(); - Component.__super__.remove.call(this); - return this; - }; - - Component.prototype.before = function(content) { - content = this.setContent(content); - this.$el.before(content); - return this; - }; - - Component.prototype.after = function(content) { - content = this.setContent(content); - this.$el.after(content); - return this; - }; - - Component.prototype.append = function(content) { - content = this.setContent(content); - this.$el.append(content); - return this; - }; - - Component.prototype.prepend = function(content) { - content = this.setContent(content); - this.$el.prepend(content); - return this; - }; - - Component.prototype.content = function(content) { - var wrappedContent; - if (content == null) return this; - this._content = this.setContent(content); - wrappedContent = this.make('div', { - "class": 'content clearfix' - }, this._content); - this.$el.append(wrappedContent); - return this; - }; - - Component.prototype.parent = function(parent) { - if (parent == null) return this; - this.$parent = $(parent); - return this; - }; - - Component.prototype.addClass = function(klass) { - this.$el.addClass(klass); - return this; - }; - - Component.prototype.removeClass = function(klass) { - this.$el.removeClass(klass); - return this; - }; - - Component.prototype.css = function(css) { - this.$el.css(css); - return this; - }; - - Component.prototype.name = function(name) { - this.name = this.addClass(this.slug(name)); - return this; - }; - - Component.prototype.items = function() { - var item, _i, _len; - for (_i = 0, _len = arguments.length; _i < _len; _i++) { - item = arguments[_i]; - this._items.push(item); - } - return this; - }; - - Component.prototype.getItems = function() { - return this._items; - }; - - Component.prototype.isRendered = function() { - return this._rendered; - }; - - Component.prototype.layout = function(layout) { - this._layout = layout; - return this; - }; - - Component.prototype.hasLayout = function() { - return !!this._layout; - }; - - Component.prototype.getLayout = function() { - return this._layout; - }; - - Component.prototype.setContent = function(content) { - if (content == null) return this; - if (content.el != null) { - if (content.render != null) { - return content = content.render().el; - } else { - return content = content.el; - } - } else { - return content = content; - } - }; - - Component.prototype.slug = function(string) { - if (string == null) return this; - return string.toLowerCase().replace(/\ +/g, "-").replace(/[^a-z0-9-]/g, ""); - }; - - return Component; - - })(Backbone.View); - -}).call(this); diff --git a/lib/js/Backpack.Layout.js b/lib/js/Backpack.Layout.js deleted file mode 100644 index d4d3bb7..0000000 --- a/lib/js/Backpack.Layout.js +++ /dev/null @@ -1,87 +0,0 @@ -(function() { - var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __hasProp = Object.prototype.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; - - Backpack.Layout = (function(_super) { - - __extends(Layout, _super); - - function Layout() { - this.wrap = __bind(this.wrap, this); - this.gutter = __bind(this.gutter, this); - this.columnWidth = __bind(this.columnWidth, this); - this.columns = __bind(this.columns, this); - this.add = __bind(this.add, this); - Layout.__super__.constructor.apply(this, arguments); - } - - Layout.prototype.tagName = 'div'; - - Layout.prototype.config = { - 'type': 'layout', - 'columns': 1, - 'gutter': '30' - }; - - Layout.prototype.initialize = function() { - this.addClass('clearfix'); - Layout.__super__.initialize.call(this); - return this; - }; - - Layout.prototype.add = function() { - var content, element, item, span, _i, _len, _results; - this.columns(arguments.length); - this.columnWidth(); - _results = []; - for (_i = 0, _len = arguments.length; _i < _len; _i++) { - item = arguments[_i]; - if (_.isFunction(item)) { - content = item; - } else { - content = item.content, span = item.span; - } - span || (span = 1); - element = this.setContent(content); - element = this.wrap(element, span); - _results.push(this.append(element)); - } - return _results; - }; - - Layout.prototype.columns = function(count) { - this._cols = count; - this._remaining = count; - return this; - }; - - Layout.prototype.columnWidth = function() { - var availableWidth, parentWidth; - parentWidth = this.$parent.width(); - availableWidth = parentWidth - (this._cols * this._gutter); - this._colWidth = availableWidth / this._cols; - return this; - }; - - Layout.prototype.gutter = function(width) { - this.css({ - 'margin-left': "-" + width + "px" - }); - this._gutter = width; - return this; - }; - - Layout.prototype.wrap = function(el, span) { - var style, wrapped; - style = "float: left; width: " + (this._colWidth * span) + "px; margin-left: " + this._gutter + "px"; - return wrapped = this.make('div', { - style: style - }, el); - }; - - return Layout; - - })(Backpack.Component); - -}).call(this); diff --git a/lib/js/Backpack.Menu.js b/lib/js/Backpack.Menu.js deleted file mode 100644 index 7d2ba00..0000000 --- a/lib/js/Backpack.Menu.js +++ /dev/null @@ -1,105 +0,0 @@ -(function() { - var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __hasProp = Object.prototype.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; - - Backpack.Menu = (function(_super) { - - __extends(Menu, _super); - - function Menu() { - this.add = __bind(this.add, this); - Menu.__super__.constructor.apply(this, arguments); - } - - Menu.prototype.tagName = 'ul'; - - Menu.prototype.initialize = function() { - Menu.__super__.initialize.call(this); - this.addClass('backpack-menu'); - return this; - }; - - Menu.prototype.add = function() { - var item, menuItem, _i, _len; - for (_i = 0, _len = arguments.length; _i < _len; _i++) { - item = arguments[_i]; - if (item.el) { - menuItem = item; - } else { - menuItem = new Backpack.MenuItem(item); - } - this.append(menuItem.show().el); - } - return this; - }; - - return Menu; - - })(Backpack.Component); - - Backpack.MenuItem = (function(_super) { - - __extends(MenuItem, _super); - - function MenuItem() { - this.content = __bind(this.content, this); - this.render = __bind(this.render, this); - MenuItem.__super__.constructor.apply(this, arguments); - } - - MenuItem.prototype.tagName = 'li'; - - MenuItem.prototype.template = _.template("<%= content %>"); - - MenuItem.prototype.initialize = function() { - var content, events, _ref; - this.addClass('backpack-menu-item'); - MenuItem.__super__.initialize.call(this); - _ref = this.options, content = _ref.content, events = _ref.events; - this.content(content, events); - this.delegateEvents(this.events); - return this; - }; - - MenuItem.prototype.render = function() { - this.$el.html(this._content); - return this; - }; - - MenuItem.prototype.content = function(content, events) { - if (events == null) events = {}; - if (content.el != null) { - this._content = content.el; - return this; - } - if (_.isString(events)) { - this._content = this.template({ - href: events, - content: content - }); - return this; - } - if (_.isFunction(events)) { - this.events = { - 'click': events - }; - this._content = this.template({ - href: 'javascript:void(0);', - content: content - }); - return this; - } - this.events = events; - this._content = this.template({ - href: 'javascript:void(0);', - content: content - }); - return this; - }; - - return MenuItem; - - })(Backpack.Component); - -}).call(this); diff --git a/lib/js/Backpack.Modal.js b/lib/js/Backpack.Modal.js deleted file mode 100644 index 58234dc..0000000 --- a/lib/js/Backpack.Modal.js +++ /dev/null @@ -1,177 +0,0 @@ -(function() { - var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __hasProp = Object.prototype.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; - - Backpack.Overlay = (function(_super) { - - __extends(Overlay, _super); - - function Overlay() { - this.remove = __bind(this.remove, this); - this.color = __bind(this.color, this); - this.lockOverlay = __bind(this.lockOverlay, this); - this.close = __bind(this.close, this); - this.unlock = __bind(this.unlock, this); - this.show = __bind(this.show, this); - this.content = __bind(this.content, this); - this.render = __bind(this.render, this); - Overlay.__super__.constructor.apply(this, arguments); - } - - Overlay.prototype.template = "
\n
\n
\n
\n
"; - - Overlay.prototype.events = { - 'click': 'unlock', - 'click .backpack-overlay-container': function(e) { - return e.stopPropagation(); - } - }; - - Overlay.prototype.config = { - 'type': 'overlay', - 'color': 'rgba(0,0,0,0.7)', - 'renderType': 'prepend', - 'lockOverlay': false - }; - - Overlay.prototype.initialize = function() { - this.append(this.template); - return Overlay.__super__.initialize.call(this); - }; - - Overlay.prototype.render = function() { - this.$('.backpack-overlay-container').html(this._content); - Overlay.__super__.render.call(this); - return this; - }; - - Overlay.prototype.content = function(content) { - if (content == null) return this; - this._content = this.setContent(content); - return this; - }; - - Overlay.prototype.show = function() { - Overlay.__super__.show.call(this); - this.$parent.addClass('overlay'); - return this; - }; - - Overlay.prototype.unlock = function() { - if (!this._lockOverlay) this.close(); - return this; - }; - - Overlay.prototype.close = function() { - Overlay.__super__.close.call(this); - this.trigger('overlay-close'); - return this; - }; - - Overlay.prototype.lockOverlay = function(lockOverlay) { - this._lockOverlay = !!lockOverlay; - return this; - }; - - Overlay.prototype.color = function(color) { - this.el.style.backgroundColor = color; - return this; - }; - - Overlay.prototype.remove = function() { - this.$parent.removeClass('overlay'); - Overlay.__super__.remove.call(this); - return this; - }; - - return Overlay; - - })(Backpack.Component); - - Backpack.Modal = (function(_super) { - - __extends(Modal, _super); - - function Modal() { - this.newOverlay = __bind(this.newOverlay, this); - this.closable = __bind(this.closable, this); - this.title = __bind(this.title, this); - this.remove = __bind(this.remove, this); - this.close = __bind(this.close, this); - this.hide = __bind(this.hide, this); - this.show = __bind(this.show, this); - Modal.__super__.constructor.apply(this, arguments); - } - - Modal.prototype.events = { - 'click .close': 'close' - }; - - Modal.prototype.config = { - 'type': 'modal', - 'closable': true, - 'lockOverlay': true - }; - - Modal.prototype.initialize = function() { - Modal.__super__.initialize.call(this); - this.newOverlay(); - return this; - }; - - Modal.prototype.show = function() { - var _ref; - Modal.__super__.show.call(this); - if ((_ref = this.overlay) != null) _ref.show(); - return this; - }; - - Modal.prototype.hide = function() { - var _ref; - Modal.__super__.hide.call(this); - if ((_ref = this.overlay) != null) _ref.hide(); - return this; - }; - - Modal.prototype.close = function() { - var _ref; - Modal.__super__.close.call(this); - if ((_ref = this.overlay) != null) _ref.remove(); - return this; - }; - - Modal.prototype.remove = function() { - var _ref; - Modal.__super__.remove.call(this); - if ((_ref = this.overlay) != null) _ref.remove(); - return this; - }; - - Modal.prototype.title = function(title) { - this._title = title; - this.prepend("" + title + ""); - return this; - }; - - Modal.prototype.closable = function() { - if (!arguments[0]) return this; - this.prepend("×"); - return this; - }; - - Modal.prototype.newOverlay = function() { - this.overlay = new Backpack.Overlay({ - lockOverlay: this.options.lockOverlay, - content: this.el, - color: this.options.color - }); - this.overlay.on('overlay-close', this.close); - return this; - }; - - return Modal; - - })(Backpack.Component); - -}).call(this); diff --git a/lib/js/Backpack.Swipe.js b/lib/js/Backpack.Swipe.js deleted file mode 100644 index b1e51aa..0000000 --- a/lib/js/Backpack.Swipe.js +++ /dev/null @@ -1,47 +0,0 @@ -(function() { - var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __hasProp = Object.prototype.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; - - Backpack.Swipe = (function(_super) { - - __extends(Swipe, _super); - - function Swipe() { - this.content = __bind(this.content, this); - Swipe.__super__.constructor.apply(this, arguments); - } - - Swipe.prototype.id = 'slider'; - - Swipe.prototype.config = { - 'type': 'swipe', - 'renderType': 'append', - 'startSlide': 0, - 'speed': 300, - 'auto': 4000, - 'continuous': true, - 'disableScroll': false, - 'callback': function() {}, - 'transitionEnd': function() {} - }; - - Swipe.prototype.initialize = function() { - Swipe.__super__.initialize.call(this); - return window.s = new window.Swipe(this.el, this.options); - }; - - Swipe.prototype.content = function(slides) { - var content, _i, _len; - for (_i = 0, _len = arguments.length; _i < _len; _i++) { - content = arguments[_i]; - this.$el.append(content); - } - return this; - }; - - return Swipe; - - })(Backpack.Component); - -}).call(this); diff --git a/lib/js/Backpack.Tabs.js b/lib/js/Backpack.Tabs.js deleted file mode 100644 index beaec42..0000000 --- a/lib/js/Backpack.Tabs.js +++ /dev/null @@ -1,167 +0,0 @@ -(function() { - var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __hasProp = Object.prototype.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; - - Backpack.Tabs = (function(_super) { - - __extends(Tabs, _super); - - function Tabs() { - this.exit = __bind(this.exit, this); - this.select = __bind(this.select, this); - this.setActive = __bind(this.setActive, this); - this.setTab = __bind(this.setTab, this); - this.add = __bind(this.add, this); - Tabs.__super__.constructor.apply(this, arguments); - } - - Tabs.prototype.tagName = 'ul'; - - Tabs.prototype.config = { - 'type': 'tabs' - }; - - Tabs.prototype.initialize = function() { - var _ref; - this.addClass('clearfix'); - this.active = (_ref = this.options.active) != null ? _ref : 0; - return Tabs.__super__.initialize.call(this); - }; - - Tabs.prototype.add = function() { - var item, tab, _i, _len; - for (_i = 0, _len = arguments.length; _i < _len; _i++) { - item = arguments[_i]; - item = _.extend(item, { - parent: this - }); - if (item.el) { - tab = item; - } else { - tab = new Backpack.Tab(item); - } - this.setTab(tab); - } - this.setActive(); - return this; - }; - - Tabs.prototype.setTab = function(tab) { - tab.on('tab-click', this.select); - tab.on('tab-exit', this.exit); - this.append(tab.show().el); - this._items.push(tab); - return this; - }; - - Tabs.prototype.setActive = function() { - var activeTab; - activeTab = this._items[this.active]; - activeTab.addClass('backpack-tab-active'); - this.select(activeTab); - return this; - }; - - Tabs.prototype.select = function(tab) { - var curActive; - curActive = this._items[this.active]; - curActive.trigger('tab-exit', curActive); - this.active = _.indexOf(this._items, tab); - tab.addClass('backpack-tab-active'); - this.$el.next('.backpack-tab-content').remove(); - this.after(tab.tabContent.show().el); - return this; - }; - - Tabs.prototype.exit = function(tab) { - tab.removeClass('backpack-tab-active'); - return this; - }; - - return Tabs; - - })(Backpack.Component); - - Backpack.Tab = (function(_super) { - - __extends(Tab, _super); - - function Tab() { - this.select = __bind(this.select, this); - this.content = __bind(this.content, this); - this.render = __bind(this.render, this); - Tab.__super__.constructor.apply(this, arguments); - } - - Tab.prototype.tagName = 'li'; - - Tab.prototype.template = _.template("<%= content %>"); - - Tab.prototype.events = { - 'click': 'select' - }; - - Tab.prototype.config = { - 'type': 'tab' - }; - - Tab.prototype.initialize = function() { - Tab.__super__.initialize.call(this); - return this.tabContent = new Backpack.TabContent({ - content: this.options.tabContent, - parent: this.$parent - }); - }; - - Tab.prototype.render = function() { - this.$el.html(this._content); - return this; - }; - - Tab.prototype.content = function(content) { - if (content == null) return this; - content = this.setContent(content); - this._content = this.template({ - href: 'javascript:void(0);', - content: content - }); - return this; - }; - - Tab.prototype.select = function() { - this.trigger('tab-click', this); - return this; - }; - - return Tab; - - })(Backpack.Component); - - Backpack.TabContent = (function(_super) { - - __extends(TabContent, _super); - - function TabContent() { - this.render = __bind(this.render, this); - TabContent.__super__.constructor.apply(this, arguments); - } - - TabContent.prototype.config = { - 'type': 'tab-content' - }; - - TabContent.prototype.initialize = function() { - return TabContent.__super__.initialize.call(this); - }; - - TabContent.prototype.render = function() { - this.$parent.html(this._content); - return this; - }; - - return TabContent; - - })(Backpack.Component); - -}).call(this); diff --git a/lib/js/Backpack.js b/lib/js/Backpack.js deleted file mode 100644 index d1a4987..0000000 --- a/lib/js/Backpack.js +++ /dev/null @@ -1,14 +0,0 @@ -(function() { - "use strict"; - var Backpack, root; - - root = typeof exports !== "undefined" && exports !== null ? exports : this; - - Backpack = root.Backpack = { - VERSION: '0.0.1', - Prefix: 'backpack' - }; - - _.extend(Backpack, Backbone.Events); - -}).call(this); diff --git a/package.json b/package.json index 5f175a5..ef14263 100644 --- a/package.json +++ b/package.json @@ -1,36 +1,21 @@ { - "private": true - , "name": "Backpack" - , "description": "A backpack full of UI components for your Backbone.js projects" - , "version": "0.0.1" - , "main": "./lib/Backpack-bundle" - , "homepage": "https://github.com/airbnb/backpack.js" - , "keywords": [ - "ui" - , "backbone" - , "backpack" - , "airbnb" - ] - , "authors": [ - "Harrison Shoff <@hshoff>" - ] - , "repository": { - "type": "git" - , "url": "https://github.com/airbnb/backpack.js.git" - } - , "engine": { - "node": ">=0.6" - } - , "scripts": { - "test": "cake test" - } - , "dependencies": { - "backbone": "0.9.x" - , "underscore": "1.3.x" - } - , "devDependencies": { - "coffee-script": "1.2.x" - , "docco": "*" - , "uglify-js": "*" - } -} \ No newline at end of file + "name": "backpack", + "version": "0.0.0", + "description": "UI Primitives - built with Backbone.", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git://github.com/airbnb/backpack.git" + }, + "keywords": [ + "backpack", + "backbone", + "ui", + "components" + ], + "author": "Harrison Shoff", + "license": "MIT" +} diff --git a/spec/BackpackSpec-bundle.js b/spec/BackpackSpec-bundle.js deleted file mode 100644 index 07c2194..0000000 --- a/spec/BackpackSpec-bundle.js +++ /dev/null @@ -1,657 +0,0 @@ -(function() { - - describe('BackpackSpec', function() { - it('should be defined', function() { - return expect(Backpack).toBeDefined(); - }); - it('should have a version', function() { - return expect(Backpack.VERSION).toBeDefined(); - }); - return describe("Backpack's components", function() { - it('should have a Component', function() { - return expect(Backpack.Component).toBeDefined(); - }); - it('should have a Menu', function() { - return expect(Backpack.Menu).toBeDefined(); - }); - it('should have a MenuItem', function() { - return expect(Backpack.MenuItem).toBeDefined(); - }); - it('should have a Modal', function() { - return expect(Backpack.Modal).toBeDefined(); - }); - it('should have an Overlay', function() { - return expect(Backpack.Overlay).toBeDefined(); - }); - return it('should have a Layout', function() { - return expect(Backpack.Layout).toBeDefined(); - }); - }); - }); - - describe("Backpack.Component", function() { - beforeEach(function() { - return this.component = new Backpack.Component({ - hide: true - }); - }); - describe("#initialize", function() { - it("should create a
", function() { - var nodeName; - nodeName = this.component.el.nodeName; - return expect(nodeName).toEqual('DIV'); - }); - it("should have a 'backpack-component' class", function() { - var hasClass; - hasClass = this.component.$el.hasClass('backpack-component'); - return expect(hasClass).toBeTruthy(); - }); - it("should define @$parent", function() { - return expect(this.component.$parent).toBeDefined(); - }); - it("should have no items (children)", function() { - return expect(this.component._items.length).toEqual(0); - }); - describe("options", function() { - beforeEach(function() { - return this.options = this.component.options; - }); - it("should have a blank default content", function() { - return expect(this.options._content).toBeUndefined(); - }); - it("should have 'body' as a default $parent", function() { - return expect(this.options.parent).toEqual('body'); - }); - return it("should set options", function() { - var options; - options = (new Backpack.Component({ - name: 'test', - parent: '#test', - hide: true, - content: '' - })).options; - expect(options.name).toEqual('test'); - expect(options.parent).toEqual('#test'); - return expect(options.content).toEqual(''); - }); - }); - return describe("events", function() { - beforeEach(function() { - return this.events = this.component.events; - }); - return it("should have no events", function() { - return expect(this.events).toBeUndefined(); - }); - }); - }); - describe("#render", function() { - it("should append the component to it's parent", function() { - var parent; - parent = $('
'); - this.component.parent(parent); - this.component.render(); - return expect(parent.children().length).toEqual(1); - }); - it("should return the component for chaining", function() { - var parent; - parent = $('
'); - this.component.parent(parent); - return expect(this.component.render()).toEqual(this.component); - }); - return it("should call the parents #append", function() { - var spy; - this.component.parent('
'); - spy = sinon.spy(this.component.$parent, 'append'); - this.component.render(); - expect(spy).toHaveBeenCalled(); - return this.component.$parent.append.restore(); - }); - }); - describe("#addClass", function() { - it("should add a class to the component", function() { - this.component.addClass("test"); - return expect(this.component.$el.hasClass("test")).toBeTruthy(); - }); - return it("should do nothing if passed nothing", function() { - var className; - className = this.component.$el.className; - this.component.addClass(); - return expect(this.component.$el.className).toEqual(className); - }); - }); - describe("#removeClass", function() { - it("should remove a class to the component", function() { - this.component.addClass("test").removeClass('test'); - return expect(this.component.$el.hasClass("test")).toBeFalsy(); - }); - return it("should do nothing if passed nothing", function() { - var className; - className = this.component.$el.className; - this.component.removeClass(); - return expect(this.component.$el.className).toEqual(className); - }); - }); - describe("#parent", function() { - it("should set the component's parent", function() { - var parent1, parent2; - parent1 = $('
'); - this.component.parent(parent1); - expect(this.component.$parent).toEqual(parent1); - parent2 = $('
    '); - this.component.parent(parent2); - return expect(this.component.$parent).toEqual(parent2); - }); - return it("should do nothing if passed nothing", function() { - var parent; - parent = this.component.$parent; - this.component.parent(); - return expect(this.component.$parent).toEqual(parent); - }); - }); - describe("#hide", function() { - it("should add the hide class to the component", function() { - this.component.show(); - expect(this.component.$el.hasClass('hide')).toBeFalsy(); - this.component.hide(); - return expect(this.component.$el.hasClass('hide')).toBeTruthy(); - }); - it("should call #undelegateEvents", function() { - var spy; - spy = sinon.spy(this.component, 'undelegateEvents'); - this.component.hide(); - expect(spy).toHaveBeenCalled(); - return this.component.undelegateEvents.restore(); - }); - return it("should call #addClass", function() { - var spy; - spy = sinon.spy(this.component.$el, 'addClass'); - this.component.hide(); - expect(spy).toHaveBeenCalled(); - return this.component.$el.addClass.restore(); - }); - }); - describe("#show", function() { - it("should remove the hide class from the component", function() { - this.component.hide(); - expect(this.component.$el.hasClass('hide')).toBeTruthy(); - this.component.show(); - return expect(this.component.$el.hasClass('hide')).toBeFalsy(); - }); - it("should call #delegateEvents", function() { - var spy; - spy = sinon.spy(this.component, 'delegateEvents'); - this.component.show(); - expect(spy).toHaveBeenCalled(); - return this.component.delegateEvents.restore(); - }); - return it("should call #removeClass", function() { - var spy; - spy = sinon.spy(this.component.$el, 'removeClass'); - this.component.show(); - expect(spy).toHaveBeenCalled(); - return this.component.$el.removeClass.restore(); - }); - }); - describe("#close", function() { - it("should call #hide", function() { - var spy; - spy = sinon.spy(this.component, 'hide'); - this.component.close(); - expect(spy).toHaveBeenCalled(); - return this.component.hide.restore(); - }); - return it("should call #remove", function() { - var spy; - spy = sinon.spy(this.component, 'remove'); - this.component.close(); - expect(spy).toHaveBeenCalled(); - return this.component.remove.restore(); - }); - }); - describe("#append", function() { - it("should call $.append", function() { - var spy; - spy = sinon.spy(this.component.$el, 'append'); - this.component.append(''); - expect(spy).toHaveBeenCalled(); - return this.component.$el.append.restore(); - }); - it("should call #setContent", function() { - var spy; - spy = sinon.spy(this.component, 'setContent'); - this.component.append(''); - expect(spy).toHaveBeenCalled(); - return this.component.setContent.restore(); - }); - return it("should do nothing if passed nothing", function() { - var testContent; - testContent = this.component.content; - this.component.setContent(); - return expect(this.component.content).toEqual(testContent); - }); - }); - describe("#prepend", function() { - it("should call $.prepend", function() { - var spy; - spy = sinon.spy(this.component.$el, 'prepend'); - this.component.prepend(''); - expect(spy).toHaveBeenCalled(); - return this.component.$el.prepend.restore(); - }); - it("should call #setContent", function() { - var spy; - spy = sinon.spy(this.component, 'setContent'); - this.component.append(''); - expect(spy).toHaveBeenCalled(); - return this.component.setContent.restore(); - }); - return it("should do nothing if passed nothing", function() { - var testContent; - testContent = this.component.content; - this.component.setContent(); - return expect(this.component.content).toEqual(testContent); - }); - }); - describe("#before", function() { - it("should call $.before", function() { - var spy; - spy = sinon.spy(this.component.$el, 'before'); - this.component.before(''); - expect(spy).toHaveBeenCalled(); - return this.component.$el.before.restore(); - }); - it("should call #setContent", function() { - var spy; - spy = sinon.spy(this.component, 'setContent'); - this.component.append(''); - expect(spy).toHaveBeenCalled(); - return this.component.setContent.restore(); - }); - return it("should do nothing if passed nothing", function() { - this.component.content = 'lkja'; - this.component.setContent(); - return expect(this.component.content).toEqual('lkja'); - }); - }); - describe("#after", function() { - it("should call $.after", function() { - var spy; - spy = sinon.spy(this.component.$el, 'after'); - this.component.after(''); - expect(spy).toHaveBeenCalled(); - return this.component.$el.after.restore(); - }); - it("should call #setContent", function() { - var spy; - spy = sinon.spy(this.component, 'setContent'); - this.component.append(''); - expect(spy).toHaveBeenCalled(); - return this.component.setContent.restore(); - }); - return it("should do nothing if passed nothing", function() { - var testContent; - testContent = this.component.content; - this.component.setContent(); - return expect(this.component.content).toEqual(testContent); - }); - }); - describe("#content", function() { - it("should do nothing if passed nothing", function() { - var testContent; - testContent = ''; - this.component.content(testContent); - this.component.content(); - return expect(this.component._content).toEqual(testContent); - }); - it("should return content if content isn't a View", function() { - var testContent; - testContent = ''; - this.component.content(testContent); - return expect(this.component._content).toEqual(testContent); - }); - it("should return content.render().el if it's a View", function() { - var spy, testContent; - testContent = new Backbone.View({ - hide: true - }); - spy = sinon.spy(testContent, 'render'); - this.component.content(testContent); - expect(spy).toHaveBeenCalled(); - expect(this.component._content).toEqual(testContent.render().el); - return testContent.render.restore(); - }); - it("should return content.el if content.render doesn't exist", function() { - var testContent; - testContent = { - el: document.createElement('div') - }; - this.component.content(testContent); - return expect(this.component._content).toEqual(testContent.el); - }); - return it("should call #setContent", function() { - var spy; - spy = sinon.spy(this.component, 'setContent'); - this.component.content(''); - return expect(spy).toHaveBeenCalled(); - }); - }); - return describe("#getItems", function() { - return it("should return the component's items", function() { - var item; - this.component.items('testy', { - test: 'test' - }); - item = this.component.getItems(); - expect(item[0]).toBe('testy'); - return expect(item[1]['test']).toBe('test'); - }); - }); - }); - - describe('dependencies', function() { - it('should have $', function() { - return expect($).toBeDefined(); - }); - it('should have Underscore', function() { - return expect(_).toBeDefined(); - }); - it('should have Backbone', function() { - return expect(Backbone).toBeDefined(); - }); - return it('should have Backbone', function() { - return expect(Backpack).toBeDefined(); - }); - }); - - describe('LayoutSpec', function() { - beforeEach(function() { - return this.Layout = new Backpack.Layout; - }); - afterEach(function() { - return this.Layout.remove(); - }); - describe('#initialize', function() { - it('should create a section', function() { - var nodeName; - nodeName = this.Layout.el.nodeName; - return expect(nodeName).toEqual('DIV'); - }); - it("should have a 'backpack-component' class", function() { - var hasClass; - hasClass = this.Layout.$el.hasClass('backpack-component'); - return expect(hasClass).toBeTruthy(); - }); - it("should have a 'backpack-layout' class", function() { - var hasClass; - hasClass = this.Layout.$el.hasClass('backpack-layout'); - return expect(hasClass).toBeTruthy(); - }); - return describe('defaults', function() { - return it('should have 1 for default _cols', function() { - return expect(this.Layout._cols).toEqual(1); - }); - }); - }); - return describe('#cols', function() { - return it('should set @_cols', function() { - this.Layout.columns(4); - return expect(this.Layout._cols).toEqual(4); - }); - }); - }); - - describe('Backpack.Menu', function() { - beforeEach(function() { - return this.menu = new Backpack.Menu({ - hide: true - }); - }); - return describe('instantiation', function() { - return it('should create a
      ', function() { - return expect(this.menu.el.nodeName).toEqual("UL"); - }); - }); - }); - - describe("Backpack.Modal", function() { - beforeEach(function() { - return this.Modal = new Backpack.Modal({ - hide: true - }); - }); - afterEach(function() { - return this.Modal.remove(); - }); - describe("#initialize", function() { - it("should create a
      ", function() { - var nodeName; - nodeName = this.Modal.el.nodeName; - return expect(nodeName).toEqual('DIV'); - }); - it("should have a 'backpack-component' class", function() { - var hasClass; - hasClass = this.Modal.$el.hasClass('backpack-component'); - return expect(hasClass).toBeTruthy(); - }); - it("should have a 'backpack-Modal' class", function() { - var hasClass; - hasClass = this.Modal.$el.hasClass('backpack-modal'); - return expect(hasClass).toBeTruthy(); - }); - describe("options", function() { - beforeEach(function() { - return this.options = this.Modal.options; - }); - it("should have a blank default content", function() { - return expect(this.options._content).toBeUndefined(); - }); - it("should have 'body' as a default parent", function() { - return expect(this.options.parent).toEqual('body'); - }); - return it("should have false as a default lock", function() { - return expect(this.options._lockOverlay).toBeFalsy(); - }); - }); - return describe("events", function() { - beforeEach(function() { - return this.events = this.Modal.events; - }); - it("should have events defined", function() { - return expect(this.events).toBeDefined(); - }); - it("should have a click event", function() { - return expect(this.events['click .close']).toBeDefined(); - }); - return it("should call #close when click event triggered", function() { - var spy; - spy = sinon.spy(this.Modal, 'close'); - this.Modal.render(); - this.Modal.show(); - this.Modal.$el.find('.close').trigger('click'); - expect(spy).toHaveBeenCalled(); - return this.Modal.close.restore(); - }); - }); - }); - return describe("overlay", function() { - it("should exist on default initialization", function() { - return expect(this.Modal.overlay).toBeDefined(); - }); - return describe("options._lockOverlay", function() { - return it("should set lockOverlay based on arguments", function() { - var Modal1, Modal2; - Modal1 = new Backpack.Modal({ - lockOverlay: true, - hide: true - }); - Modal2 = new Backpack.Modal({ - lockOverlay: false, - hide: true - }); - expect(Modal1.overlay._lockOverlay).toBeTruthy(); - expect(Modal2.overlay._lockOverlay).toBeFalsy(); - Modal1.remove(); - return Modal2.remove(); - }); - }); - }); - }); - - describe("it has an overlay", function() { - beforeEach(function() { - return this.oModal = new Backpack.Modal({ - hide: true - }); - }); - afterEach(function() { - return this.oModal.remove(); - }); - describe("#show", function() { - return it("should render and show it's overlay", function() { - var spyShow; - spyShow = sinon.spy(this.oModal.overlay, 'show'); - this.oModal.show(); - expect(spyShow).toHaveBeenCalled(); - return this.oModal.overlay.show.restore(); - }); - }); - describe("#hide", function() { - return it("should hide it's overlay", function() { - var spy; - spy = sinon.spy(this.oModal.overlay, 'hide'); - this.oModal.hide(); - expect(spy).toHaveBeenCalled(); - return this.oModal.overlay.hide.restore(); - }); - }); - describe("#close", function() { - return it("should remove it's overlay", function() { - var spy; - spy = sinon.spy(this.oModal.overlay, 'remove'); - this.oModal.close(); - expect(spy).toHaveBeenCalled(); - return this.oModal.overlay.remove.restore(); - }); - }); - return describe("options._lockOverlay is false", function() { - return it("should trigger 'overlay-close' when the overlay is clicked", function() { - var Modal, spy; - Modal = new Backpack.Modal({ - lockOverlay: false, - hide: true - }); - spy = sinon.spy(Modal.overlay, 'trigger'); - Modal.render().show(); - Modal.overlay.$el.trigger('click'); - expect(spy).toHaveBeenCalledWith('overlay-close'); - return Modal.remove(); - }); - }); - }); - - describe("Backpack.Overlay", function() { - beforeEach(function() { - return this.overlay = new Backpack.Overlay({ - hide: true - }); - }); - afterEach(function() { - return this.overlay.remove(); - }); - describe("#initialize", function() { - it("should create a
      ", function() { - var nodeName; - nodeName = this.overlay.el.nodeName; - return expect(nodeName).toEqual('DIV'); - }); - it("should have a 'backpack-component' class", function() { - var hasClass; - hasClass = this.overlay.$el.hasClass('backpack-component'); - return expect(hasClass).toBeTruthy(); - }); - it("should have a 'backpack-overlay' class", function() { - var hasClass; - hasClass = this.overlay.$el.hasClass('backpack-overlay'); - return expect(hasClass).toBeTruthy(); - }); - describe("options", function() { - beforeEach(function() { - return this.options = this.overlay.options; - }); - it("should have a blank default content", function() { - return expect(this.options._content).toBeUndefined(); - }); - it("should have 'body' as a default parent", function() { - return expect(this.options.parent).toEqual('body'); - }); - it("should have false as a default lockOverlay", function() { - return expect(this.options.lockOverlay).toBeFalsy(); - }); - return it("should have rgba(0,0,0,0.7) as a default color", function() { - expect(this.options.color).toEqual("rgba(0,0,0,0.7)"); - return expect(this.options.lockOverlay).toBeFalsy(); - }); - }); - return describe("events", function() { - beforeEach(function() { - return this.events = this.overlay.events; - }); - it("should have events defined", function() { - return expect(this.events).toBeDefined(); - }); - it("should have a click event", function() { - return expect(this.events.click).toBeDefined(); - }); - return it("should call unlock on click", function() { - var overlay, spy; - overlay = new Backpack.Overlay({ - hide: true - }); - spy = sinon.spy(overlay, 'unlock'); - overlay.render().show(); - overlay.$el.trigger('click'); - expect(spy).toHaveBeenCalled(); - return overlay.unlock.restore(); - }); - }); - }); - describe("#render", function() { - return it("should call parent's prepend", function() { - var spy; - spy = sinon.spy(this.overlay.$parent, 'prepend'); - this.overlay.render(); - expect(spy).toHaveBeenCalled(); - return this.overlay.$parent.prepend.restore(); - }); - }); - describe("#unlock", function() { - return it("should call #close if lockOverlay is false", function() { - var spy; - spy = sinon.spy(this.overlay, 'close'); - this.overlay.render().unlock(); - expect(spy).toHaveBeenCalled(); - return this.overlay.close.restore(); - }); - }); - describe("#close", function() { - return it("should trigger 'overlay-close'", function() { - var spy; - spy = sinon.spy(this.overlay, 'trigger'); - this.overlay.render().close(); - expect(spy).toHaveBeenCalledWith('overlay-close'); - return this.overlay.trigger.restore(); - }); - }); - return describe("#lockOverlay", function() { - return it("should set lockOverlay appropriately", function() { - this.overlay.lockOverlay(false); - expect(this.overlay._lockOverlay).toBeFalsy(); - this.overlay.lockOverlay(); - expect(this.overlay._lockOverlay).toBeFalsy(); - this.overlay.lockOverlay(true); - return expect(this.overlay._lockOverlay).toBeTruthy(); - }); - }); - }); - -}).call(this); diff --git a/spec/SpecRunner.html b/spec/SpecRunner.html deleted file mode 100644 index 5f7dd6c..0000000 --- a/spec/SpecRunner.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - Backpack Spec Runner - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/spec/src/BackpackSpec.coffee b/spec/src/BackpackSpec.coffee deleted file mode 100644 index eed324b..0000000 --- a/spec/src/BackpackSpec.coffee +++ /dev/null @@ -1,27 +0,0 @@ -describe 'BackpackSpec', -> - - it 'should be defined', -> - expect(Backpack).toBeDefined() - - it 'should have a version', -> - expect(Backpack.VERSION).toBeDefined() - - describe "Backpack's components", -> - - it 'should have a Component', -> - expect(Backpack.Component).toBeDefined() - - it 'should have a Menu', -> - expect(Backpack.Menu).toBeDefined() - - it 'should have a MenuItem', -> - expect(Backpack.MenuItem).toBeDefined() - - it 'should have a Modal', -> - expect(Backpack.Modal).toBeDefined() - - it 'should have an Overlay', -> - expect(Backpack.Overlay).toBeDefined() - - it 'should have a Layout', -> - expect(Backpack.Layout).toBeDefined() \ No newline at end of file diff --git a/spec/src/ComponentSpec.coffee b/spec/src/ComponentSpec.coffee deleted file mode 100644 index 2ee468c..0000000 --- a/spec/src/ComponentSpec.coffee +++ /dev/null @@ -1,287 +0,0 @@ -describe "Backpack.Component", -> - - beforeEach -> - @component = new Backpack.Component({hide: true}) - - - describe "#initialize", -> - - it "should create a
      ", -> - nodeName = @component.el.nodeName - expect(nodeName).toEqual('DIV') - - it "should have a 'backpack-component' class", -> - hasClass = @component.$el.hasClass('backpack-component') - expect(hasClass).toBeTruthy() - - it "should define @$parent", -> - expect(@component.$parent).toBeDefined() - - it "should have no items (children)", -> - expect(@component._items.length).toEqual(0) - - describe "options", -> - - beforeEach -> - @options = @component.options - - it "should have a blank default content", -> - expect(@options._content).toBeUndefined() - - it "should have 'body' as a default $parent", -> - expect(@options.parent).toEqual('body') - - it "should set options", -> - options = (new Backpack.Component { - name: 'test' - , parent: '#test' - , hide: true - , content: '' }).options - expect(options.name).toEqual('test') - expect(options.parent).toEqual('#test') - expect(options.content).toEqual('') - - describe "events", -> - - beforeEach -> - @events = @component.events - - it "should have no events", -> - expect(@events).toBeUndefined() - - - describe "#render", -> - - it "should append the component to it's parent", -> - parent = $('
      ') - @component.parent(parent) - @component.render() - expect(parent.children().length).toEqual(1) - - it "should return the component for chaining", -> - parent = $('
      ') - @component.parent(parent) - expect(@component.render()).toEqual(@component) - - it "should call the parents #append", -> - @component.parent('
      ') - spy = sinon.spy(@component.$parent, 'append') - @component.render() - expect(spy).toHaveBeenCalled() - @component.$parent.append.restore() - - - describe "#addClass", -> - - it "should add a class to the component", -> - @component.addClass("test") - expect(@component.$el.hasClass("test")).toBeTruthy() - - it "should do nothing if passed nothing", -> - className = @component.$el.className - @component.addClass() - expect(@component.$el.className).toEqual(className) - - describe "#removeClass", -> - - it "should remove a class to the component", -> - @component.addClass("test").removeClass('test') - expect(@component.$el.hasClass("test")).toBeFalsy() - - it "should do nothing if passed nothing", -> - className = @component.$el.className - @component.removeClass() - expect(@component.$el.className).toEqual(className) - - - describe "#parent", -> - - it "should set the component's parent", -> - parent1 = $('
      ') - @component.parent(parent1) - expect(@component.$parent).toEqual(parent1) - parent2 = $('
        ') - @component.parent(parent2) - expect(@component.$parent).toEqual(parent2) - - it "should do nothing if passed nothing", -> - parent = @component.$parent - @component.parent() - expect(@component.$parent).toEqual(parent) - - - describe "#hide", -> - - it "should add the hide class to the component", -> - @component.show() - expect(@component.$el.hasClass('hide')).toBeFalsy() - @component.hide() - expect(@component.$el.hasClass('hide')).toBeTruthy() - - it "should call #undelegateEvents", -> - spy = sinon.spy(@component, 'undelegateEvents') - @component.hide() - expect(spy).toHaveBeenCalled() - @component.undelegateEvents.restore() - - it "should call #addClass", -> - spy = sinon.spy(@component.$el, 'addClass') - @component.hide() - expect(spy).toHaveBeenCalled() - @component.$el.addClass.restore() - - - describe "#show", -> - - it "should remove the hide class from the component", -> - @component.hide() - expect(@component.$el.hasClass('hide')).toBeTruthy() - @component.show() - expect(@component.$el.hasClass('hide')).toBeFalsy() - - it "should call #delegateEvents", -> - spy = sinon.spy(@component, 'delegateEvents') - @component.show() - expect(spy).toHaveBeenCalled() - @component.delegateEvents.restore() - - it "should call #removeClass", -> - spy = sinon.spy(@component.$el, 'removeClass') - @component.show() - expect(spy).toHaveBeenCalled() - @component.$el.removeClass.restore() - - - describe "#close", -> - - it "should call #hide", -> - spy = sinon.spy(@component, 'hide') - @component.close() - expect(spy).toHaveBeenCalled() - @component.hide.restore() - - it "should call #remove", -> - spy = sinon.spy(@component, 'remove') - @component.close() - expect(spy).toHaveBeenCalled() - @component.remove.restore() - - - describe "#append", -> - - it "should call $.append", -> - spy = sinon.spy(@component.$el, 'append') - @component.append('') - expect(spy).toHaveBeenCalled() - @component.$el.append.restore() - - it "should call #setContent", -> - spy = sinon.spy(@component, 'setContent') - @component.append('') - expect(spy).toHaveBeenCalled() - @component.setContent.restore() - - it "should do nothing if passed nothing", -> - testContent = @component.content - @component.setContent() - expect(@component.content).toEqual(testContent) - - - describe "#prepend", -> - - it "should call $.prepend", -> - spy = sinon.spy(@component.$el, 'prepend') - @component.prepend('') - expect(spy).toHaveBeenCalled() - @component.$el.prepend.restore() - - it "should call #setContent", -> - spy = sinon.spy(@component, 'setContent') - @component.append('') - expect(spy).toHaveBeenCalled() - @component.setContent.restore() - - it "should do nothing if passed nothing", -> - testContent = @component.content - @component.setContent() - expect(@component.content).toEqual(testContent) - - - describe "#before", -> - - it "should call $.before", -> - spy = sinon.spy(@component.$el, 'before') - @component.before('') - expect(spy).toHaveBeenCalled() - @component.$el.before.restore() - - it "should call #setContent", -> - spy = sinon.spy(@component, 'setContent') - @component.append('') - expect(spy).toHaveBeenCalled() - @component.setContent.restore() - - it "should do nothing if passed nothing", -> - @component.content = 'lkja' - @component.setContent() - expect(@component.content).toEqual('lkja') - - - describe "#after", -> - - it "should call $.after", -> - spy = sinon.spy(@component.$el, 'after') - @component.after('') - expect(spy).toHaveBeenCalled() - @component.$el.after.restore() - - it "should call #setContent", -> - spy = sinon.spy(@component, 'setContent') - @component.append('') - expect(spy).toHaveBeenCalled() - @component.setContent.restore() - - it "should do nothing if passed nothing", -> - testContent = @component.content - @component.setContent() - expect(@component.content).toEqual(testContent) - - - describe "#content", -> - - it "should do nothing if passed nothing", -> - testContent = '' - @component.content(testContent) - @component.content() - expect(@component._content).toEqual(testContent) - - it "should return content if content isn't a View", -> - testContent = '' - @component.content(testContent) - expect(@component._content).toEqual(testContent) - - it "should return content.render().el if it's a View", -> - testContent = new Backbone.View({ hide: true }) - spy = sinon.spy(testContent, 'render') - @component.content(testContent) - expect(spy).toHaveBeenCalled() - expect(@component._content).toEqual(testContent.render().el) - testContent.render.restore() - - it "should return content.el if content.render doesn't exist", -> - testContent = { el: document.createElement('div') } - @component.content(testContent) - expect(@component._content).toEqual(testContent.el) - - it "should call #setContent", -> - spy = sinon.spy(@component, 'setContent') - @component.content('') - expect(spy).toHaveBeenCalled() - - describe "#getItems", -> - - it "should return the component's items", -> - @component.items('testy', {test: 'test'}) - item = @component.getItems() - expect(item[0]).toBe('testy') - expect(item[1]['test']).toBe('test') diff --git a/spec/src/DependenciesSpec.coffee b/spec/src/DependenciesSpec.coffee deleted file mode 100644 index e0aee6f..0000000 --- a/spec/src/DependenciesSpec.coffee +++ /dev/null @@ -1,13 +0,0 @@ -describe 'dependencies', -> - - it 'should have $', -> - expect($).toBeDefined() - - it 'should have Underscore', -> - expect(_).toBeDefined() - - it 'should have Backbone', -> - expect(Backbone).toBeDefined() - - it 'should have Backbone', -> - expect(Backpack).toBeDefined() diff --git a/spec/src/LayoutSpec.coffee b/spec/src/LayoutSpec.coffee deleted file mode 100644 index bb9d34a..0000000 --- a/spec/src/LayoutSpec.coffee +++ /dev/null @@ -1,32 +0,0 @@ -describe 'LayoutSpec', -> - - beforeEach -> - @Layout = new Backpack.Layout - - afterEach -> - @Layout.remove() - - describe '#initialize', -> - - it 'should create a section', -> - nodeName = @Layout.el.nodeName - expect(nodeName).toEqual('DIV') - - it "should have a 'backpack-component' class", -> - hasClass = @Layout.$el.hasClass('backpack-component') - expect(hasClass).toBeTruthy() - - it "should have a 'backpack-layout' class", -> - hasClass = @Layout.$el.hasClass('backpack-layout') - expect(hasClass).toBeTruthy() - - describe 'defaults', -> - - it 'should have 1 for default _cols', -> - expect(@Layout._cols).toEqual(1) - - describe '#cols', -> - - it 'should set @_cols', -> - @Layout.columns(4) - expect(@Layout._cols).toEqual(4) \ No newline at end of file diff --git a/spec/src/MenuSpec.coffee b/spec/src/MenuSpec.coffee deleted file mode 100644 index 32e6a7c..0000000 --- a/spec/src/MenuSpec.coffee +++ /dev/null @@ -1,10 +0,0 @@ -describe 'Backpack.Menu', -> - - beforeEach -> - @menu = new Backpack.Menu({ hide: true }) - - - describe 'instantiation', -> - - it 'should create a
          ', -> - expect(@menu.el.nodeName).toEqual("UL") \ No newline at end of file diff --git a/spec/src/ModalSpec.coffee b/spec/src/ModalSpec.coffee deleted file mode 100644 index 6a6e3a4..0000000 --- a/spec/src/ModalSpec.coffee +++ /dev/null @@ -1,112 +0,0 @@ -describe "Backpack.Modal", -> - - beforeEach -> - @Modal = new Backpack.Modal({ hide: true }) - - afterEach -> - @Modal.remove() - - - describe "#initialize", -> - - it "should create a
          ", -> - nodeName = @Modal.el.nodeName - expect(nodeName).toEqual('DIV') - - it "should have a 'backpack-component' class", -> - hasClass = @Modal.$el.hasClass('backpack-component') - expect(hasClass).toBeTruthy() - - it "should have a 'backpack-Modal' class", -> - hasClass = @Modal.$el.hasClass('backpack-modal') - expect(hasClass).toBeTruthy() - - describe "options", -> - - beforeEach -> - @options = @Modal.options - - it "should have a blank default content", -> - expect(@options._content).toBeUndefined() - - it "should have 'body' as a default parent", -> - expect(@options.parent).toEqual('body') - - it "should have false as a default lock", -> - expect(@options._lockOverlay).toBeFalsy() - - describe "events", -> - - beforeEach -> - @events = @Modal.events - - it "should have events defined", -> - expect(@events).toBeDefined() - - it "should have a click event", -> - expect(@events['click .close']).toBeDefined() - - it "should call #close when click event triggered", -> - spy = sinon.spy(@Modal, 'close') - @Modal.render() - @Modal.show() - @Modal.$el.find('.close').trigger('click') - expect(spy).toHaveBeenCalled() - @Modal.close.restore() - - describe "overlay", -> - - it "should exist on default initialization", -> - expect(@Modal.overlay).toBeDefined() - - describe "options._lockOverlay", -> - - it "should set lockOverlay based on arguments", -> - Modal1 = new Backpack.Modal({ lockOverlay: true, hide: true }) - Modal2 = new Backpack.Modal({ lockOverlay: false, hide: true }) - expect(Modal1.overlay._lockOverlay).toBeTruthy() - expect(Modal2.overlay._lockOverlay).toBeFalsy() - Modal1.remove() - Modal2.remove() - -describe "it has an overlay", -> - - beforeEach -> - @oModal = new Backpack.Modal({ hide: true }) - - afterEach -> - @oModal.remove() - - describe "#show", -> - - it "should render and show it's overlay", -> - spyShow = sinon.spy(@oModal.overlay, 'show') - @oModal.show() - expect(spyShow).toHaveBeenCalled() - @oModal.overlay.show.restore() - - describe "#hide", -> - - it "should hide it's overlay", -> - spy = sinon.spy(@oModal.overlay, 'hide') - @oModal.hide() - expect(spy).toHaveBeenCalled() - @oModal.overlay.hide.restore() - - describe "#close", -> - - it "should remove it's overlay", -> - spy = sinon.spy(@oModal.overlay, 'remove') - @oModal.close() - expect(spy).toHaveBeenCalled() - @oModal.overlay.remove.restore() - - describe "options._lockOverlay is false", -> - - it "should trigger 'overlay-close' when the overlay is clicked", -> - Modal = new Backpack.Modal({ lockOverlay: false, hide: true }) - spy = sinon.spy(Modal.overlay, 'trigger') - Modal.render().show() - Modal.overlay.$el.trigger('click') - expect(spy).toHaveBeenCalledWith('overlay-close') - Modal.remove() \ No newline at end of file diff --git a/spec/src/OverlaySpec.coffee b/spec/src/OverlaySpec.coffee deleted file mode 100644 index 58d5a86..0000000 --- a/spec/src/OverlaySpec.coffee +++ /dev/null @@ -1,92 +0,0 @@ -describe "Backpack.Overlay", -> - - beforeEach -> - @overlay = new Backpack.Overlay({hide: true}) - - afterEach -> - @overlay.remove() - - describe "#initialize", -> - it "should create a
          ", -> - nodeName = @overlay.el.nodeName - expect(nodeName).toEqual('DIV') - - it "should have a 'backpack-component' class", -> - hasClass = @overlay.$el.hasClass('backpack-component') - expect(hasClass).toBeTruthy() - - it "should have a 'backpack-overlay' class", -> - hasClass = @overlay.$el.hasClass('backpack-overlay') - expect(hasClass).toBeTruthy() - - describe "options", -> - - beforeEach -> - @options = @overlay.options - - it "should have a blank default content", -> - expect(@options._content).toBeUndefined() - - it "should have 'body' as a default parent", -> - expect(@options.parent).toEqual('body') - - it "should have false as a default lockOverlay", -> - expect(@options.lockOverlay).toBeFalsy() - - it "should have rgba(0,0,0,0.7) as a default color", -> - expect(@options.color).toEqual("rgba(0,0,0,0.7)") - expect(@options.lockOverlay).toBeFalsy() - - - describe "events", -> - - beforeEach -> - @events = @overlay.events - - it "should have events defined", -> - expect(@events).toBeDefined() - - it "should have a click event", -> - expect(@events.click).toBeDefined() - - it "should call unlock on click", -> - overlay = new Backpack.Overlay({ hide: true }) - spy = sinon.spy(overlay, 'unlock') - overlay.render().show() - overlay.$el.trigger('click') - expect(spy).toHaveBeenCalled() - overlay.unlock.restore() - - describe "#render", -> - - it "should call parent's prepend", -> - spy = sinon.spy(@overlay.$parent, 'prepend') - @overlay.render() - expect(spy).toHaveBeenCalled() - @overlay.$parent.prepend.restore() - - describe "#unlock", -> - - it "should call #close if lockOverlay is false", -> - spy = sinon.spy(@overlay, 'close') - @overlay.render().unlock() - expect(spy).toHaveBeenCalled() - @overlay.close.restore() - - describe "#close", -> - - it "should trigger 'overlay-close'", -> - spy = sinon.spy(@overlay, 'trigger') - @overlay.render().close() - expect(spy).toHaveBeenCalledWith('overlay-close') - @overlay.trigger.restore() - - describe "#lockOverlay", -> - - it "should set lockOverlay appropriately", -> - @overlay.lockOverlay(false) - expect(@overlay._lockOverlay).toBeFalsy() - @overlay.lockOverlay() - expect(@overlay._lockOverlay).toBeFalsy() - @overlay.lockOverlay(true) - expect(@overlay._lockOverlay).toBeTruthy() \ No newline at end of file diff --git a/src/Backpack.Component.coffee b/src/Backpack.Component.coffee deleted file mode 100644 index 01e4c6e..0000000 --- a/src/Backpack.Component.coffee +++ /dev/null @@ -1,168 +0,0 @@ -class Backpack.Component extends Backbone.View - - tagName: 'div' - className: 'backpack-component' - - defaults: - 'parent': 'body' - 'type': 'component' - 'renderType': 'append' - 'content': null - 'visible': true - - initialize: -> - @_items = [] - @_rendered = false - @_renderTypes = ['append', 'prepend', 'html'] - @options = _.extend({}, @defaults, @config, @options) - for func, args of @options - if @[func]? - unless _.isArray(args) - @[func].call?(@, args) - else - @[func].apply?(@, args) - null - - render: => - func = @$parent[@_renderType] - func.call(@$parent, @getRenderEl()) - @_rendered = true - @ - - renderType: (type) => - hasType = _.include(@_renderTypes, type) - return @ unless hasType - @_renderType = type - @ - - renderEl: (el) => - @_renderEl = el - @ - - getRenderEl: => - return @_renderEl if @_renderEl? - return @el - - type: (type) => - @_type = @slug("#{Backpack.Prefix} #{type}") - @addClass(@_type) - @ - - getType: => - return @_type - - visible: (show) => - if show - @show() - else - @hide() - @ - - show: => - @render() unless @isRendered() - @delegateEvents(@events) - @$el.removeClass('hide') - @_visible = true - @ - - hide: => - @$el.addClass('hide') - @undelegateEvents() - @_visible = false - @ - - close: => - @hide() - @remove() - @ - - remove: => - @undelegateEvents() - super() - @ - - before: (content) => - content = @setContent(content) - @$el.before(content) - @ - - after: (content) => - content = @setContent(content) - @$el.after(content) - @ - - append: (content) => - content = @setContent(content) - @$el.append(content) - @ - - prepend: (content) => - content = @setContent(content) - @$el.prepend(content) - @ - - content: (content) => - return @ unless content? - @_content = @setContent(content) - wrappedContent = @make('div', {class: 'content clearfix'}, @_content) - @$el.append(wrappedContent) - @ - - parent: (parent) => - return @ unless parent? - @$parent = $(parent) - @ - - addClass: (klass) => - @$el.addClass(klass) - @ - - removeClass: (klass) => - @$el.removeClass(klass) - @ - - css: (css) => - @$el.css(css) - @ - - name: (name) => - @name = @addClass(@slug(name)) - @ - - items: => - for item in arguments - @_items.push(item) - @ - - getItems: => - return @_items - - isRendered: => - @_rendered - - layout: (layout) => - @_layout = layout - @ - - hasLayout: => - !!@_layout - - getLayout: => - return @_layout - - setContent: (content) => - return @ unless content? - if content.el? - if content.render? - content = content.render().el - else - content = content.el - else - content = content - - slug: (string) => - return @ unless string? - string - .toLowerCase() - .replace(/\ +/g, "-") - .replace(/[^a-z0-9-]/g, "") \ No newline at end of file diff --git a/src/Backpack.Layout.coffee b/src/Backpack.Layout.coffee deleted file mode 100644 index 9589ba8..0000000 --- a/src/Backpack.Layout.coffee +++ /dev/null @@ -1,47 +0,0 @@ -class Backpack.Layout extends Backpack.Component - - tagName: 'div' - - config: - 'type': 'layout' - 'columns': 1 - 'gutter': '30' - - initialize: -> - @addClass('clearfix') - super() - @ - - add: => - @columns(arguments.length) - @columnWidth() - - for item in arguments - if _.isFunction(item) - content = item - else - {content, span} = item - span or= 1 - element = @setContent(content) - element = @wrap(element, span) - @append(element) - - columns: (count) => - @_cols = count - @_remaining = count - @ - - columnWidth: => - parentWidth = @$parent.width() - availableWidth = parentWidth - (@_cols * @_gutter) - @_colWidth = (availableWidth / @_cols) - @ - - gutter: (width) => - @css({ 'margin-left': "-#{ width }px" }) - @_gutter = width - @ - - wrap: (el, span) => - style = "float: left; width: #{@_colWidth*span}px; margin-left: #{@_gutter}px" - wrapped = @make('div', {style}, el) \ No newline at end of file diff --git a/src/Backpack.Menu.coffee b/src/Backpack.Menu.coffee deleted file mode 100644 index dbe919f..0000000 --- a/src/Backpack.Menu.coffee +++ /dev/null @@ -1,57 +0,0 @@ -# ## Backpack.Menu - -class Backpack.Menu extends Backpack.Component - - tagName: 'ul' - - - initialize: -> - super() - @addClass('backpack-menu') - @ - - add: => - for item in arguments - if item.el - menuItem = item - else - menuItem = new Backpack.MenuItem(item) - @append(menuItem.show().el) - @ - - -# ## Backpack.MenuItem - -class Backpack.MenuItem extends Backpack.Component - - tagName: 'li' - template: _.template("<%= content %>") - - - initialize: -> - @addClass 'backpack-menu-item' - super() - {content, events} = @options - @content(content, events) - @delegateEvents(@events) - @ - - render: => - @$el.html(@_content) - @ - - content: (content, events = {}) => - if content.el? - @_content = content.el - return @ - if _.isString(events) - @_content = @template({ href: events, content: content }) - return @ - if _.isFunction(events) - @events = {'click': events} - @_content = @template({ href: 'javascript:void(0);', content: content }) - return @ - - @events = events - @_content = @template({ href: 'javascript:void(0);', content: content }) - @ \ No newline at end of file diff --git a/src/Backpack.Modal.coffee b/src/Backpack.Modal.coffee deleted file mode 100644 index 42734b4..0000000 --- a/src/Backpack.Modal.coffee +++ /dev/null @@ -1,116 +0,0 @@ -# ## Backpack.Lift -class Backpack.Overlay extends Backpack.Component - - template: """ -
          -
          -
          -
          -
          - """ - events: - 'click': 'unlock' - 'click .backpack-overlay-container': (e) -> e.stopPropagation() - - config: - 'type': 'overlay' - 'color': 'rgba(0,0,0,0.7)' - 'renderType': 'prepend' - 'lockOverlay': false - - initialize: -> - @append @template - super() - - render: => - @.$('.backpack-overlay-container').html(@_content) - super() - @ - - content: (content) => - return @ unless content? - @_content = @setContent(content) - @ - - show: => - super() - @$parent.addClass('overlay') - @ - - unlock: => - @close() unless @_lockOverlay - @ - - close: => - super() - @trigger('overlay-close') - @ - - lockOverlay: (lockOverlay) => - @_lockOverlay = !!lockOverlay - @ - - color: (color) => - @el.style.backgroundColor = color - @ - - remove: => - @$parent.removeClass('overlay') - super() - @ - - - -# ## Backpack.Modal -class Backpack.Modal extends Backpack.Component - - events: - 'click .close': 'close' - - config: - 'type': 'modal' - 'closable': true - 'lockOverlay': true - - initialize: -> - super() - @newOverlay() - @ - - show: => - super() - @overlay?.show() - @ - - hide: => - super() - @overlay?.hide() - @ - - close: => - super() - @overlay?.remove() - @ - - remove: => - super() - @overlay?.remove() - @ - - title: (title) => - @_title = title - @prepend("#{title}") - @ - - closable: => - return @ unless !!arguments[0] - @prepend("×") - @ - - newOverlay: => - @overlay = new Backpack.Overlay - lockOverlay: @options.lockOverlay - content: @el - color: @options.color - @overlay.on('overlay-close', @close) - @ diff --git a/src/Backpack.Swipe.coffee b/src/Backpack.Swipe.coffee deleted file mode 100644 index 9e25097..0000000 --- a/src/Backpack.Swipe.coffee +++ /dev/null @@ -1,23 +0,0 @@ -class Backpack.Swipe extends Backpack.Component - - id: 'slider' - - config: - 'type': 'swipe' - 'renderType': 'append' - 'startSlide': 0 - 'speed': 300 - 'auto': 4000 - 'continuous': true - 'disableScroll': false - 'callback': -> - 'transitionEnd': -> - - initialize: -> - super() - window.s = new window.Swipe(@el, @options) - - content: (slides) => - for content in arguments - @$el.append(content) - @ diff --git a/src/Backpack.Tabs.coffee b/src/Backpack.Tabs.coffee deleted file mode 100644 index 25c4ae5..0000000 --- a/src/Backpack.Tabs.coffee +++ /dev/null @@ -1,97 +0,0 @@ -class Backpack.Tabs extends Backpack.Component - - tagName: 'ul' - - config: - 'type': 'tabs' - - initialize: -> - @addClass('clearfix') - @active = @options.active ? 0 - super() - - add: => - for item in arguments - item = _.extend(item, {parent: @}) - if item.el - tab = item - else - tab = new Backpack.Tab(item) - @setTab(tab) - @setActive() - @ - - setTab: (tab) => - tab.on('tab-click', @select) - tab.on('tab-exit', @exit) - @append(tab.show().el) - @_items.push(tab) - @ - - setActive: => - activeTab = @_items[@active] - activeTab.addClass('backpack-tab-active') - @select(activeTab) - @ - - select: (tab) => - curActive = @_items[@active] - curActive.trigger('tab-exit', curActive) - @active = _.indexOf(@_items, tab) - tab.addClass('backpack-tab-active') - @$el.next('.backpack-tab-content').remove() - @after(tab.tabContent.show().el) - @ - - exit: (tab) => - tab.removeClass('backpack-tab-active') - @ - - - - -class Backpack.Tab extends Backpack.Component - - tagName: 'li' - - template: _.template("<%= content %>") - - events: - 'click': 'select' - - config: - 'type': 'tab' - - initialize: -> - super() - @tabContent = new Backpack.TabContent - content: @options.tabContent - parent: @$parent - - render: => - @$el.html(@_content) - @ - - content: (content) => - return @ unless content? - content = @setContent(content) - @_content = @template({ href: 'javascript:void(0);', content: content }) - @ - - select: => - @trigger('tab-click', @) - @ - - - -class Backpack.TabContent extends Backpack.Component - - config: - 'type': 'tab-content' - - initialize: -> - super() - - render: => - @$parent.html(@_content) - @ \ No newline at end of file diff --git a/src/Backpack.coffee b/src/Backpack.coffee deleted file mode 100644 index 7150125..0000000 --- a/src/Backpack.coffee +++ /dev/null @@ -1,9 +0,0 @@ -"use strict" - -root = exports ? this - -Backpack = root.Backpack = - VERSION: '0.0.1' - Prefix: 'backpack' - -_.extend(Backpack, Backbone.Events) \ No newline at end of file diff --git a/vendor/backbone.js b/vendor/backbone.js deleted file mode 100644 index 7c56f42..0000000 --- a/vendor/backbone.js +++ /dev/null @@ -1,1290 +0,0 @@ -// Backbone.js 0.9.1 - -// (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc. -// Backbone may be freely distributed under the MIT license. -// For all details and documentation: -// http://backbonejs.org - -(function(){ - - // Initial Setup - // ------------- - - // Save a reference to the global object (`window` in the browser, `global` - // on the server). - var root = this; - - // Save the previous value of the `Backbone` variable, so that it can be - // restored later on, if `noConflict` is used. - var previousBackbone = root.Backbone; - - // Create a local reference to slice/splice. - var slice = Array.prototype.slice; - var splice = Array.prototype.splice; - - // The top-level namespace. All public Backbone classes and modules will - // be attached to this. Exported for both CommonJS and the browser. - var Backbone; - if (typeof exports !== 'undefined') { - Backbone = exports; - } else { - Backbone = root.Backbone = {}; - } - - // Current version of the library. Keep in sync with `package.json`. - Backbone.VERSION = '0.9.1'; - - // Require Underscore, if we're on the server, and it's not already present. - var _ = root._; - if (!_ && (typeof require !== 'undefined')) _ = require('underscore'); - - // For Backbone's purposes, jQuery, Zepto, or Ender owns the `$` variable. - var $ = root.jQuery || root.Zepto || root.ender; - - // Set the JavaScript library that will be used for DOM manipulation and - // Ajax calls (a.k.a. the `$` variable). By default Backbone will use: jQuery, - // Zepto, or Ender; but the `setDomLibrary()` method lets you inject an - // alternate JavaScript library (or a mock library for testing your views - // outside of a browser). - Backbone.setDomLibrary = function(lib) { - $ = lib; - }; - - // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable - // to its previous owner. Returns a reference to this Backbone object. - Backbone.noConflict = function() { - root.Backbone = previousBackbone; - return this; - }; - - // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option - // will fake `"PUT"` and `"DELETE"` requests via the `_method` parameter and - // set a `X-Http-Method-Override` header. - Backbone.emulateHTTP = false; - - // Turn on `emulateJSON` to support legacy servers that can't deal with direct - // `application/json` requests ... will encode the body as - // `application/x-www-form-urlencoded` instead and will send the model in a - // form param named `model`. - Backbone.emulateJSON = false; - - // Backbone.Events - // ----------------- - - // A module that can be mixed in to *any object* in order to provide it with - // custom events. You may bind with `on` or remove with `off` callback functions - // to an event; trigger`-ing an event fires all callbacks in succession. - // - // var object = {}; - // _.extend(object, Backbone.Events); - // object.on('expand', function(){ alert('expanded'); }); - // object.trigger('expand'); - // - Backbone.Events = { - - // Bind an event, specified by a string name, `ev`, to a `callback` - // function. Passing `"all"` will bind the callback to all events fired. - on: function(events, callback, context) { - var ev; - events = events.split(/\s+/); - var calls = this._callbacks || (this._callbacks = {}); - while (ev = events.shift()) { - // Create an immutable callback list, allowing traversal during - // modification. The tail is an empty object that will always be used - // as the next node. - var list = calls[ev] || (calls[ev] = {}); - var tail = list.tail || (list.tail = list.next = {}); - tail.callback = callback; - tail.context = context; - list.tail = tail.next = {}; - } - return this; - }, - - // Remove one or many callbacks. If `context` is null, removes all callbacks - // with that function. If `callback` is null, removes all callbacks for the - // event. If `ev` is null, removes all bound callbacks for all events. - off: function(events, callback, context) { - var ev, calls, node; - if (!events) { - delete this._callbacks; - } else if (calls = this._callbacks) { - events = events.split(/\s+/); - while (ev = events.shift()) { - node = calls[ev]; - delete calls[ev]; - if (!callback || !node) continue; - // Create a new list, omitting the indicated event/context pairs. - while ((node = node.next) && node.next) { - if (node.callback === callback && - (!context || node.context === context)) continue; - this.on(ev, node.callback, node.context); - } - } - } - return this; - }, - - // Trigger an event, firing all bound callbacks. Callbacks are passed the - // same arguments as `trigger` is, apart from the event name. - // Listening for `"all"` passes the true event name as the first argument. - trigger: function(events) { - var event, node, calls, tail, args, all, rest; - if (!(calls = this._callbacks)) return this; - all = calls['all']; - (events = events.split(/\s+/)).push(null); - // Save references to the current heads & tails. - while (event = events.shift()) { - if (all) events.push({next: all.next, tail: all.tail, event: event}); - if (!(node = calls[event])) continue; - events.push({next: node.next, tail: node.tail}); - } - // Traverse each list, stopping when the saved tail is reached. - rest = slice.call(arguments, 1); - while (node = events.pop()) { - tail = node.tail; - args = node.event ? [node.event].concat(rest) : rest; - while ((node = node.next) !== tail) { - node.callback.apply(node.context || this, args); - } - } - return this; - } - - }; - - // Aliases for backwards compatibility. - Backbone.Events.bind = Backbone.Events.on; - Backbone.Events.unbind = Backbone.Events.off; - - // Backbone.Model - // -------------- - - // Create a new model, with defined attributes. A client id (`cid`) - // is automatically generated and assigned for you. - Backbone.Model = function(attributes, options) { - var defaults; - attributes || (attributes = {}); - if (options && options.parse) attributes = this.parse(attributes); - if (defaults = getValue(this, 'defaults')) { - attributes = _.extend({}, defaults, attributes); - } - if (options && options.collection) this.collection = options.collection; - this.attributes = {}; - this._escapedAttributes = {}; - this.cid = _.uniqueId('c'); - if (!this.set(attributes, {silent: true})) { - throw new Error("Can't create an invalid model"); - } - delete this._changed; - this._previousAttributes = _.clone(this.attributes); - this.initialize.apply(this, arguments); - }; - - // Attach all inheritable methods to the Model prototype. - _.extend(Backbone.Model.prototype, Backbone.Events, { - - // The default name for the JSON `id` attribute is `"id"`. MongoDB and - // CouchDB users may want to set this to `"_id"`. - idAttribute: 'id', - - // Initialize is an empty function by default. Override it with your own - // initialization logic. - initialize: function(){}, - - // Return a copy of the model's `attributes` object. - toJSON: function() { - return _.clone(this.attributes); - }, - - // Get the value of an attribute. - get: function(attr) { - return this.attributes[attr]; - }, - - // Get the HTML-escaped value of an attribute. - escape: function(attr) { - var html; - if (html = this._escapedAttributes[attr]) return html; - var val = this.attributes[attr]; - return this._escapedAttributes[attr] = _.escape(val == null ? '' : '' + val); - }, - - // Returns `true` if the attribute contains a value that is not null - // or undefined. - has: function(attr) { - return this.attributes[attr] != null; - }, - - // Set a hash of model attributes on the object, firing `"change"` unless - // you choose to silence it. - set: function(key, value, options) { - var attrs, attr, val; - if (_.isObject(key) || key == null) { - attrs = key; - options = value; - } else { - attrs = {}; - attrs[key] = value; - } - - // Extract attributes and options. - options || (options = {}); - if (!attrs) return this; - if (attrs instanceof Backbone.Model) attrs = attrs.attributes; - if (options.unset) for (attr in attrs) attrs[attr] = void 0; - - // Run validation. - if (!this._validate(attrs, options)) return false; - - // Check for changes of `id`. - if (this.idAttribute in attrs) this.id = attrs[this.idAttribute]; - - var now = this.attributes; - var escaped = this._escapedAttributes; - var prev = this._previousAttributes || {}; - var alreadySetting = this._setting; - this._changed || (this._changed = {}); - this._setting = true; - - // Update attributes. - for (attr in attrs) { - val = attrs[attr]; - if (!_.isEqual(now[attr], val)) delete escaped[attr]; - options.unset ? delete now[attr] : now[attr] = val; - if (this._changing && !_.isEqual(this._changed[attr], val)) { - this.trigger('change:' + attr, this, val, options); - this._moreChanges = true; - } - delete this._changed[attr]; - if (!_.isEqual(prev[attr], val) || (_.has(now, attr) != _.has(prev, attr))) { - this._changed[attr] = val; - } - } - - // Fire the `"change"` events, if the model has been changed. - if (!alreadySetting) { - if (!options.silent && this.hasChanged()) this.change(options); - this._setting = false; - } - return this; - }, - - // Remove an attribute from the model, firing `"change"` unless you choose - // to silence it. `unset` is a noop if the attribute doesn't exist. - unset: function(attr, options) { - (options || (options = {})).unset = true; - return this.set(attr, null, options); - }, - - // Clear all attributes on the model, firing `"change"` unless you choose - // to silence it. - clear: function(options) { - (options || (options = {})).unset = true; - return this.set(_.clone(this.attributes), options); - }, - - // Fetch the model from the server. If the server's representation of the - // model differs from its current attributes, they will be overriden, - // triggering a `"change"` event. - fetch: function(options) { - options = options ? _.clone(options) : {}; - var model = this; - var success = options.success; - options.success = function(resp, status, xhr) { - if (!model.set(model.parse(resp, xhr), options)) return false; - if (success) success(model, resp); - }; - options.error = Backbone.wrapError(options.error, model, options); - return (this.sync || Backbone.sync).call(this, 'read', this, options); - }, - - // Set a hash of model attributes, and sync the model to the server. - // If the server returns an attributes hash that differs, the model's - // state will be `set` again. - save: function(key, value, options) { - var attrs, current; - if (_.isObject(key) || key == null) { - attrs = key; - options = value; - } else { - attrs = {}; - attrs[key] = value; - } - - options = options ? _.clone(options) : {}; - if (options.wait) current = _.clone(this.attributes); - var silentOptions = _.extend({}, options, {silent: true}); - if (attrs && !this.set(attrs, options.wait ? silentOptions : options)) { - return false; - } - var model = this; - var success = options.success; - options.success = function(resp, status, xhr) { - var serverAttrs = model.parse(resp, xhr); - if (options.wait) serverAttrs = _.extend(attrs || {}, serverAttrs); - if (!model.set(serverAttrs, options)) return false; - if (success) { - success(model, resp); - } else { - model.trigger('sync', model, resp, options); - } - }; - options.error = Backbone.wrapError(options.error, model, options); - var method = this.isNew() ? 'create' : 'update'; - var xhr = (this.sync || Backbone.sync).call(this, method, this, options); - if (options.wait) this.set(current, silentOptions); - return xhr; - }, - - // Destroy this model on the server if it was already persisted. - // Optimistically removes the model from its collection, if it has one. - // If `wait: true` is passed, waits for the server to respond before removal. - destroy: function(options) { - options = options ? _.clone(options) : {}; - var model = this; - var success = options.success; - - var triggerDestroy = function() { - model.trigger('destroy', model, model.collection, options); - }; - - if (this.isNew()) return triggerDestroy(); - options.success = function(resp) { - if (options.wait) triggerDestroy(); - if (success) { - success(model, resp); - } else { - model.trigger('sync', model, resp, options); - } - }; - options.error = Backbone.wrapError(options.error, model, options); - var xhr = (this.sync || Backbone.sync).call(this, 'delete', this, options); - if (!options.wait) triggerDestroy(); - return xhr; - }, - - // Default URL for the model's representation on the server -- if you're - // using Backbone's restful methods, override this to change the endpoint - // that will be called. - url: function() { - var base = getValue(this.collection, 'url') || getValue(this, 'urlRoot') || urlError(); - if (this.isNew()) return base; - return base + (base.charAt(base.length - 1) == '/' ? '' : '/') + encodeURIComponent(this.id); - }, - - // **parse** converts a response into the hash of attributes to be `set` on - // the model. The default implementation is just to pass the response along. - parse: function(resp, xhr) { - return resp; - }, - - // Create a new model with identical attributes to this one. - clone: function() { - return new this.constructor(this.attributes); - }, - - // A model is new if it has never been saved to the server, and lacks an id. - isNew: function() { - return this.id == null; - }, - - // Call this method to manually fire a `"change"` event for this model and - // a `"change:attribute"` event for each changed attribute. - // Calling this will cause all objects observing the model to update. - change: function(options) { - if (this._changing || !this.hasChanged()) return this; - this._changing = true; - this._moreChanges = true; - for (var attr in this._changed) { - this.trigger('change:' + attr, this, this._changed[attr], options); - } - while (this._moreChanges) { - this._moreChanges = false; - this.trigger('change', this, options); - } - this._previousAttributes = _.clone(this.attributes); - delete this._changed; - this._changing = false; - return this; - }, - - // Determine if the model has changed since the last `"change"` event. - // If you specify an attribute name, determine if that attribute has changed. - hasChanged: function(attr) { - if (!arguments.length) return !_.isEmpty(this._changed); - return this._changed && _.has(this._changed, attr); - }, - - // Return an object containing all the attributes that have changed, or - // false if there are no changed attributes. Useful for determining what - // parts of a view need to be updated and/or what attributes need to be - // persisted to the server. Unset attributes will be set to undefined. - // You can also pass an attributes object to diff against the model, - // determining if there *would be* a change. - changedAttributes: function(diff) { - if (!diff) return this.hasChanged() ? _.clone(this._changed) : false; - var val, changed = false, old = this._previousAttributes; - for (var attr in diff) { - if (_.isEqual(old[attr], (val = diff[attr]))) continue; - (changed || (changed = {}))[attr] = val; - } - return changed; - }, - - // Get the previous value of an attribute, recorded at the time the last - // `"change"` event was fired. - previous: function(attr) { - if (!arguments.length || !this._previousAttributes) return null; - return this._previousAttributes[attr]; - }, - - // Get all of the attributes of the model at the time of the previous - // `"change"` event. - previousAttributes: function() { - return _.clone(this._previousAttributes); - }, - - // Check if the model is currently in a valid state. It's only possible to - // get into an *invalid* state if you're using silent changes. - isValid: function() { - return !this.validate(this.attributes); - }, - - // Run validation against a set of incoming attributes, returning `true` - // if all is well. If a specific `error` callback has been passed, - // call that instead of firing the general `"error"` event. - _validate: function(attrs, options) { - if (options.silent || !this.validate) return true; - attrs = _.extend({}, this.attributes, attrs); - var error = this.validate(attrs, options); - if (!error) return true; - if (options && options.error) { - options.error(this, error, options); - } else { - this.trigger('error', this, error, options); - } - return false; - } - - }); - - // Backbone.Collection - // ------------------- - - // Provides a standard collection class for our sets of models, ordered - // or unordered. If a `comparator` is specified, the Collection will maintain - // its models in sort order, as they're added and removed. - Backbone.Collection = function(models, options) { - options || (options = {}); - if (options.comparator) this.comparator = options.comparator; - this._reset(); - this.initialize.apply(this, arguments); - if (models) this.reset(models, {silent: true, parse: options.parse}); - }; - - // Define the Collection's inheritable methods. - _.extend(Backbone.Collection.prototype, Backbone.Events, { - - // The default model for a collection is just a **Backbone.Model**. - // This should be overridden in most cases. - model: Backbone.Model, - - // Initialize is an empty function by default. Override it with your own - // initialization logic. - initialize: function(){}, - - // The JSON representation of a Collection is an array of the - // models' attributes. - toJSON: function() { - return this.map(function(model){ return model.toJSON(); }); - }, - - // Add a model, or list of models to the set. Pass **silent** to avoid - // firing the `add` event for every new model. - add: function(models, options) { - var i, index, length, model, cid, id, cids = {}, ids = {}; - options || (options = {}); - models = _.isArray(models) ? models.slice() : [models]; - - // Begin by turning bare objects into model references, and preventing - // invalid models or duplicate models from being added. - for (i = 0, length = models.length; i < length; i++) { - if (!(model = models[i] = this._prepareModel(models[i], options))) { - throw new Error("Can't add an invalid model to a collection"); - } - if (cids[cid = model.cid] || this._byCid[cid] || - (((id = model.id) != null) && (ids[id] || this._byId[id]))) { - throw new Error("Can't add the same model to a collection twice"); - } - cids[cid] = ids[id] = model; - } - - // Listen to added models' events, and index models for lookup by - // `id` and by `cid`. - for (i = 0; i < length; i++) { - (model = models[i]).on('all', this._onModelEvent, this); - this._byCid[model.cid] = model; - if (model.id != null) this._byId[model.id] = model; - } - - // Insert models into the collection, re-sorting if needed, and triggering - // `add` events unless silenced. - this.length += length; - index = options.at != null ? options.at : this.models.length; - splice.apply(this.models, [index, 0].concat(models)); - if (this.comparator) this.sort({silent: true}); - if (options.silent) return this; - for (i = 0, length = this.models.length; i < length; i++) { - if (!cids[(model = this.models[i]).cid]) continue; - options.index = i; - model.trigger('add', model, this, options); - } - return this; - }, - - // Remove a model, or a list of models from the set. Pass silent to avoid - // firing the `remove` event for every model removed. - remove: function(models, options) { - var i, l, index, model; - options || (options = {}); - models = _.isArray(models) ? models.slice() : [models]; - for (i = 0, l = models.length; i < l; i++) { - model = this.getByCid(models[i]) || this.get(models[i]); - if (!model) continue; - delete this._byId[model.id]; - delete this._byCid[model.cid]; - index = this.indexOf(model); - this.models.splice(index, 1); - this.length--; - if (!options.silent) { - options.index = index; - model.trigger('remove', model, this, options); - } - this._removeReference(model); - } - return this; - }, - - // Get a model from the set by id. - get: function(id) { - if (id == null) return null; - return this._byId[id.id != null ? id.id : id]; - }, - - // Get a model from the set by client id. - getByCid: function(cid) { - return cid && this._byCid[cid.cid || cid]; - }, - - // Get the model at the given index. - at: function(index) { - return this.models[index]; - }, - - // Force the collection to re-sort itself. You don't need to call this under - // normal circumstances, as the set will maintain sort order as each item - // is added. - sort: function(options) { - options || (options = {}); - if (!this.comparator) throw new Error('Cannot sort a set without a comparator'); - var boundComparator = _.bind(this.comparator, this); - if (this.comparator.length == 1) { - this.models = this.sortBy(boundComparator); - } else { - this.models.sort(boundComparator); - } - if (!options.silent) this.trigger('reset', this, options); - return this; - }, - - // Pluck an attribute from each model in the collection. - pluck: function(attr) { - return _.map(this.models, function(model){ return model.get(attr); }); - }, - - // When you have more items than you want to add or remove individually, - // you can reset the entire set with a new list of models, without firing - // any `add` or `remove` events. Fires `reset` when finished. - reset: function(models, options) { - models || (models = []); - options || (options = {}); - for (var i = 0, l = this.models.length; i < l; i++) { - this._removeReference(this.models[i]); - } - this._reset(); - this.add(models, {silent: true, parse: options.parse}); - if (!options.silent) this.trigger('reset', this, options); - return this; - }, - - // Fetch the default set of models for this collection, resetting the - // collection when they arrive. If `add: true` is passed, appends the - // models to the collection instead of resetting. - fetch: function(options) { - options = options ? _.clone(options) : {}; - if (options.parse === undefined) options.parse = true; - var collection = this; - var success = options.success; - options.success = function(resp, status, xhr) { - collection[options.add ? 'add' : 'reset'](collection.parse(resp, xhr), options); - if (success) success(collection, resp); - }; - options.error = Backbone.wrapError(options.error, collection, options); - return (this.sync || Backbone.sync).call(this, 'read', this, options); - }, - - // Create a new instance of a model in this collection. Add the model to the - // collection immediately, unless `wait: true` is passed, in which case we - // wait for the server to agree. - create: function(model, options) { - var coll = this; - options = options ? _.clone(options) : {}; - model = this._prepareModel(model, options); - if (!model) return false; - if (!options.wait) coll.add(model, options); - var success = options.success; - options.success = function(nextModel, resp, xhr) { - if (options.wait) coll.add(nextModel, options); - if (success) { - success(nextModel, resp); - } else { - nextModel.trigger('sync', model, resp, options); - } - }; - model.save(null, options); - return model; - }, - - // **parse** converts a response into a list of models to be added to the - // collection. The default implementation is just to pass it through. - parse: function(resp, xhr) { - return resp; - }, - - // Proxy to _'s chain. Can't be proxied the same way the rest of the - // underscore methods are proxied because it relies on the underscore - // constructor. - chain: function () { - return _(this.models).chain(); - }, - - // Reset all internal state. Called when the collection is reset. - _reset: function(options) { - this.length = 0; - this.models = []; - this._byId = {}; - this._byCid = {}; - }, - - // Prepare a model or hash of attributes to be added to this collection. - _prepareModel: function(model, options) { - if (!(model instanceof Backbone.Model)) { - var attrs = model; - options.collection = this; - model = new this.model(attrs, options); - if (!model._validate(model.attributes, options)) model = false; - } else if (!model.collection) { - model.collection = this; - } - return model; - }, - - // Internal method to remove a model's ties to a collection. - _removeReference: function(model) { - if (this == model.collection) { - delete model.collection; - } - model.off('all', this._onModelEvent, this); - }, - - // Internal method called every time a model in the set fires an event. - // Sets need to update their indexes when models change ids. All other - // events simply proxy through. "add" and "remove" events that originate - // in other collections are ignored. - _onModelEvent: function(ev, model, collection, options) { - if ((ev == 'add' || ev == 'remove') && collection != this) return; - if (ev == 'destroy') { - this.remove(model, options); - } - if (model && ev === 'change:' + model.idAttribute) { - delete this._byId[model.previous(model.idAttribute)]; - this._byId[model.id] = model; - } - this.trigger.apply(this, arguments); - } - - }); - - // Underscore methods that we want to implement on the Collection. - var methods = ['forEach', 'each', 'map', 'reduce', 'reduceRight', 'find', - 'detect', 'filter', 'select', 'reject', 'every', 'all', 'some', 'any', - 'include', 'contains', 'invoke', 'max', 'min', 'sortBy', 'sortedIndex', - 'toArray', 'size', 'first', 'initial', 'rest', 'last', 'without', 'indexOf', - 'shuffle', 'lastIndexOf', 'isEmpty', 'groupBy']; - - // Mix in each Underscore method as a proxy to `Collection#models`. - _.each(methods, function(method) { - Backbone.Collection.prototype[method] = function() { - return _[method].apply(_, [this.models].concat(_.toArray(arguments))); - }; - }); - - // Backbone.Router - // ------------------- - - // Routers map faux-URLs to actions, and fire events when routes are - // matched. Creating a new one sets its `routes` hash, if not set statically. - Backbone.Router = function(options) { - options || (options = {}); - if (options.routes) this.routes = options.routes; - this._bindRoutes(); - this.initialize.apply(this, arguments); - }; - - // Cached regular expressions for matching named param parts and splatted - // parts of route strings. - var namedParam = /:\w+/g; - var splatParam = /\*\w+/g; - var escapeRegExp = /[-[\]{}()+?.,\\^$|#\s]/g; - - // Set up all inheritable **Backbone.Router** properties and methods. - _.extend(Backbone.Router.prototype, Backbone.Events, { - - // Initialize is an empty function by default. Override it with your own - // initialization logic. - initialize: function(){}, - - // Manually bind a single named route to a callback. For example: - // - // this.route('search/:query/p:num', 'search', function(query, num) { - // ... - // }); - // - route: function(route, name, callback) { - Backbone.history || (Backbone.history = new Backbone.History); - if (!_.isRegExp(route)) route = this._routeToRegExp(route); - if (!callback) callback = this[name]; - Backbone.history.route(route, _.bind(function(fragment) { - var args = this._extractParameters(route, fragment); - callback && callback.apply(this, args); - this.trigger.apply(this, ['route:' + name].concat(args)); - Backbone.history.trigger('route', this, name, args); - }, this)); - return this; - }, - - // Simple proxy to `Backbone.history` to save a fragment into the history. - navigate: function(fragment, options) { - Backbone.history.navigate(fragment, options); - }, - - // Bind all defined routes to `Backbone.history`. We have to reverse the - // order of the routes here to support behavior where the most general - // routes can be defined at the bottom of the route map. - _bindRoutes: function() { - if (!this.routes) return; - var routes = []; - for (var route in this.routes) { - routes.unshift([route, this.routes[route]]); - } - for (var i = 0, l = routes.length; i < l; i++) { - this.route(routes[i][0], routes[i][1], this[routes[i][1]]); - } - }, - - // Convert a route string into a regular expression, suitable for matching - // against the current location hash. - _routeToRegExp: function(route) { - route = route.replace(escapeRegExp, '\\$&') - .replace(namedParam, '([^\/]+)') - .replace(splatParam, '(.*?)'); - return new RegExp('^' + route + '$'); - }, - - // Given a route, and a URL fragment that it matches, return the array of - // extracted parameters. - _extractParameters: function(route, fragment) { - return route.exec(fragment).slice(1); - } - - }); - - // Backbone.History - // ---------------- - - // Handles cross-browser history management, based on URL fragments. If the - // browser does not support `onhashchange`, falls back to polling. - Backbone.History = function() { - this.handlers = []; - _.bindAll(this, 'checkUrl'); - }; - - // Cached regex for cleaning leading hashes and slashes . - var routeStripper = /^[#\/]/; - - // Cached regex for detecting MSIE. - var isExplorer = /msie [\w.]+/; - - // Has the history handling already been started? - var historyStarted = false; - - // Set up all inheritable **Backbone.History** properties and methods. - _.extend(Backbone.History.prototype, Backbone.Events, { - - // The default interval to poll for hash changes, if necessary, is - // twenty times a second. - interval: 50, - - // Get the cross-browser normalized URL fragment, either from the URL, - // the hash, or the override. - getFragment: function(fragment, forcePushState) { - if (fragment == null) { - if (this._hasPushState || forcePushState) { - fragment = window.location.pathname; - var search = window.location.search; - if (search) fragment += search; - } else { - fragment = window.location.hash; - } - } - fragment = decodeURIComponent(fragment); - if (!fragment.indexOf(this.options.root)) fragment = fragment.substr(this.options.root.length); - return fragment.replace(routeStripper, ''); - }, - - // Start the hash change handling, returning `true` if the current URL matches - // an existing route, and `false` otherwise. - start: function(options) { - - // Figure out the initial configuration. Do we need an iframe? - // Is pushState desired ... is it available? - if (historyStarted) throw new Error("Backbone.history has already been started"); - this.options = _.extend({}, {root: '/'}, this.options, options); - this._wantsHashChange = this.options.hashChange !== false; - this._wantsPushState = !!this.options.pushState; - this._hasPushState = !!(this.options.pushState && window.history && window.history.pushState); - var fragment = this.getFragment(); - var docMode = document.documentMode; - var oldIE = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7)); - if (oldIE) { - this.iframe = $('