├── .gitignore ├── CHANGELOG ├── Gemfile ├── Gemfile.lock ├── Guardfile ├── LICENSE ├── README.mkd ├── TODO ├── VERSION ├── bower.json ├── build.sh ├── config.rb ├── config.ru ├── package.json ├── push-tag.sh ├── release.sh ├── sortable.jquery.json ├── source ├── _limited_drop_targets.html.haml ├── _nested_bootstrap.html.haml ├── _nested_with_switch.html.haml ├── _serialization.html.haml ├── _simple_with_animation.html.haml ├── _simple_with_no_drop.html.haml ├── _table.html.haml ├── css │ ├── _base.sass │ ├── application.css.sass │ ├── bootstrap-switch.css │ ├── coderay.css │ ├── example.css │ ├── jquery-sortable.css.sass │ └── vendor.css ├── debug.html.erb ├── example.html ├── img │ ├── glyphicons-halflings-white.png │ └── glyphicons-halflings.png ├── index.html.haml ├── js │ ├── application.js │ ├── debug.js │ ├── examples │ │ ├── basic.js │ │ ├── limited_drop_targets.js │ │ ├── nested_bootstrap.js │ │ ├── nested_with_switch.js │ │ ├── serialization.js │ │ ├── simple_with_animation.js │ │ ├── simple_with_no_drop.js │ │ └── table.js │ ├── jquery-sortable-min.js │ ├── jquery-sortable.js │ ├── test.js │ └── vendor │ │ ├── bootstrap-button.js │ │ ├── bootstrap-dropdown.js │ │ ├── bootstrap-scrollspy.js │ │ ├── bootstrap-switch.js │ │ ├── jquery.color.js │ │ └── jquery.js ├── layouts │ ├── debug.haml │ └── layout.haml └── test.html.haml └── update-pages.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # dirs 2 | /vendor 3 | /bin/ 4 | /tmp/ 5 | /.sass-cache 6 | /build 7 | /.bundle 8 | /node_modules 9 | 10 | 11 | # tempfiles 12 | *[~#] 13 | .#* 14 | *_flymake* 15 | /.emacs-project 16 | /.irbrc 17 | *_out 18 | *.gz 19 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | [0.9.13] fix hovering over empty container (Jonny Gerig Meyer) 2 | allow custom drag classes (Jonny Gerig Meyer) 3 | support text areas inside sortables (Isaac Kearse) 4 | fix drag with placeholder issue (Michael McLaughlin) 5 | user outer dimensions for dragged item (Jared Mellentine) 6 | support npm and bower (Patrick Gunderson, Shaun Dern) 7 | fix issue with legacy jQuery 1.10 8 | fix for mobile chrome 9 | 10 | [0.9.12] expose mouse events in callbacks 11 | add refresh method 12 | add destroy method 13 | add delay option 14 | falsy return value in onMousedown prevents dragging 15 | fix exclusion of items 16 | fix ignore for select element (abixalmon) 17 | fix touch events (prateekjadhwani) 18 | fix itemPath issues (appending and dragInit) 19 | improve documentation 20 | [0.9.11] option tolerance accepts negative values 21 | rewrote enable/disable logic 22 | added (item|container)Path 23 | 24 | [0.9.10] Fix Array.indexOf() error in IE < 9 (Dev-Speranza) 25 | serialize() assumes one subcontainer per item 26 | remove call to stopPropagation() 27 | Added onMousedown() 28 | 29 | [0.9.9] Added options tolerance and distance 30 | Do not modify Array.prototype (by Joakin) 31 | serialize respects exclude option 32 | 33 | [0.9.8] Added Serialization 34 | Added onCancel 35 | 36 | [0.9.7] Support iFrame and Touch events 37 | Better behavior if the CSS position changes 38 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | 3 | gem 'thin' 4 | 5 | gem 'sass', '~> 3.1.0' 6 | 7 | gem 'compass' 8 | gem 'middleman', '>= 3' 9 | 10 | gem 'guard-livereload' 11 | gem 'rack-livereload' 12 | 13 | gem 'rack-coderay' 14 | 15 | gem 'therubyracer' 16 | gem 'closure-compiler' 17 | 18 | gem 'rdiscount' 19 | 20 | gem 'sass-twitter-bootstrap', '2.0.4', :git => 'https://github.com/johnny/sass-twitter-bootstrap.git', :branch => 'customizations' 21 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GIT 2 | remote: https://github.com/johnny/sass-twitter-bootstrap.git 3 | revision: 06795315e0476e1f64c991d6686a21c16c68423e 4 | branch: customizations 5 | specs: 6 | sass-twitter-bootstrap (2.0.4) 7 | 8 | GEM 9 | remote: http://rubygems.org/ 10 | specs: 11 | activesupport (3.2.22) 12 | i18n (~> 0.6, >= 0.6.4) 13 | multi_json (~> 1.0) 14 | chunky_png (1.3.4) 15 | closure-compiler (1.1.11) 16 | coderay (1.1.0) 17 | coffee-script (2.2.0) 18 | coffee-script-source 19 | execjs 20 | coffee-script-source (1.9.1.1) 21 | compass (0.12.2) 22 | chunky_png (~> 1.2) 23 | fssm (>= 0.2.7) 24 | sass (~> 3.1) 25 | daemons (1.2.3) 26 | em-websocket (0.5.1) 27 | eventmachine (>= 0.12.9) 28 | http_parser.rb (~> 0.6.0) 29 | eventmachine (1.0.7) 30 | execjs (1.4.1) 31 | multi_json (~> 1.0) 32 | ffi (1.9.9) 33 | formatador (0.2.5) 34 | fssm (0.2.10) 35 | guard (1.8.3) 36 | formatador (>= 0.2.4) 37 | listen (~> 1.3) 38 | lumberjack (>= 1.0.2) 39 | pry (>= 0.9.10) 40 | thor (>= 0.14.6) 41 | guard-livereload (1.4.0) 42 | em-websocket (>= 0.5.0) 43 | guard (>= 1.8.0) 44 | multi_json (~> 1.7) 45 | haml (4.0.6) 46 | tilt 47 | hike (1.2.3) 48 | hpricot (0.8.6) 49 | http_parser.rb (0.6.0) 50 | i18n (0.6.11) 51 | json (1.8.3) 52 | kramdown (1.7.0) 53 | libv8 (3.16.14.9) 54 | listen (1.3.1) 55 | rb-fsevent (>= 0.9.3) 56 | rb-inotify (>= 0.9) 57 | rb-kqueue (>= 0.2) 58 | lumberjack (1.0.9) 59 | method_source (0.8.2) 60 | middleman (3.2.2) 61 | coffee-script (~> 2.2.0) 62 | compass (>= 0.12.2) 63 | execjs (~> 1.4.0) 64 | haml (>= 3.1.6) 65 | kramdown (~> 1.2) 66 | middleman-core (= 3.2.2) 67 | middleman-sprockets (>= 3.1.2) 68 | sass (>= 3.1.20) 69 | uglifier (~> 2.4.0) 70 | middleman-core (3.2.2) 71 | activesupport (~> 3.2.6) 72 | bundler (~> 1.1) 73 | i18n (~> 0.6.9) 74 | listen (~> 1.1) 75 | rack (>= 1.4.5) 76 | rack-test (~> 0.6.1) 77 | thor (>= 0.15.2, < 2.0) 78 | tilt (~> 1.4.1) 79 | middleman-sprockets (3.3.3) 80 | middleman-core (>= 3.2) 81 | sprockets (~> 2.2) 82 | sprockets-helpers (~> 1.1.0) 83 | sprockets-sass (~> 1.1.0) 84 | multi_json (1.11.1) 85 | pry (0.10.1) 86 | coderay (~> 1.1.0) 87 | method_source (~> 0.8.1) 88 | slop (~> 3.4) 89 | rack (1.6.4) 90 | rack-coderay (0.2.0) 91 | coderay (>= 0.8.312) 92 | hpricot (>= 0.8.1) 93 | rack (>= 1.0.0) 94 | rack-livereload (0.3.15) 95 | rack 96 | rack-test (0.6.3) 97 | rack (>= 1.0) 98 | rb-fsevent (0.9.5) 99 | rb-inotify (0.9.5) 100 | ffi (>= 0.5.0) 101 | rb-kqueue (0.2.4) 102 | ffi (>= 0.5.0) 103 | rdiscount (2.1.8) 104 | ref (1.0.5) 105 | sass (3.1.21) 106 | slop (3.6.0) 107 | sprockets (2.12.4) 108 | hike (~> 1.2) 109 | multi_json (~> 1.0) 110 | rack (~> 1.0) 111 | tilt (~> 1.1, != 1.3.0) 112 | sprockets-helpers (1.1.0) 113 | sprockets (~> 2.0) 114 | sprockets-sass (1.1.0) 115 | sprockets (~> 2.0) 116 | tilt (~> 1.1) 117 | therubyracer (0.12.2) 118 | libv8 (~> 3.16.14.0) 119 | ref 120 | thin (1.6.3) 121 | daemons (~> 1.0, >= 1.0.9) 122 | eventmachine (~> 1.0) 123 | rack (~> 1.0) 124 | thor (0.19.1) 125 | tilt (1.4.1) 126 | uglifier (2.4.0) 127 | execjs (>= 0.3.0) 128 | json (>= 1.8.0) 129 | 130 | PLATFORMS 131 | ruby 132 | 133 | DEPENDENCIES 134 | closure-compiler 135 | compass 136 | guard-livereload 137 | middleman (>= 3) 138 | rack-coderay 139 | rack-livereload 140 | rdiscount 141 | sass (~> 3.1.0) 142 | sass-twitter-bootstrap (= 2.0.4)! 143 | therubyracer 144 | thin 145 | -------------------------------------------------------------------------------- /Guardfile: -------------------------------------------------------------------------------- 1 | # A sample Guardfile 2 | # More info at https://github.com/guard/guard#readme 3 | 4 | ignore /(_flymake|#.+)\.\w+$/ 5 | 6 | guard 'livereload' do 7 | watch(%r{source/.+\.(erb|haml|slim)\z}) 8 | watch(%r{source/js/.+\.(js|coffee)\z}) 9 | watch(%r{source/css/.+\.(sass|css)\z}) 10 | end 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Jonas von Andrian 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * The name of the author may not be used to endorse or promote products 12 | derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 18 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /README.mkd: -------------------------------------------------------------------------------- 1 | # jQuery Sortable 2 | 3 | jQuery Sortable is a flexible, opinionated sorting plugin. 4 | It enables items in a list (or table etc.) to be sorted horizontally and vertically using the mouse. 5 | Supports nested lists and pure drag/drop containers. 6 | 7 | jQuery Sortable does not depend on jQuery UI and works well with Twitter's Bootstrap (You can even sort the Bootstrap navigation). 8 | 9 | More information can be found on [http://johnny.github.com/jquery-sortable/](http://johnny.github.com/jquery-sortable/). 10 | 11 | ## Dependencies 12 | 13 | jquery (>= 1.7.0) 14 | 15 | ## Development Dependencies 16 | 17 | jQuery Sortable is developed using [middleman](http://middlemanapp.com/). 18 | A **bundle install** shoud pull in everything needed. 19 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | - [0/3] bugs 2 | - [ ] last Pointer is NaN in search valid target 3 | - [ ] prevent infinite recursion 4 | - [ ] bootstrap example jumps up on drop 5 | - (only sometimes. preventDefault() does not work if called inside drop or on containing element. Look up where the on handler attaches itself) 6 | - only firefox, chrome works 7 | - [0/6] consider 8 | - [ ] better name for searchValidTarget 9 | - [ ] shortcut on getNearest() 10 | - [ ] if items, break if distance is growing again 11 | - [ ] if containers, break if distance is 0 12 | - [ ] only calculate top/bottom if vertical and left/right if horizontal 13 | - [ ] support placeholder with height/width 14 | - [ ] calculate item/container dimensions relative to the container => Not all centers have to be recalculated 15 | - [ ] change subContainers handling, so that it becomes easier to remove them 16 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.9.13 2 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-sortable", 3 | "version": "0.9.13", 4 | "homepage": "http://johnny.github.io/jquery-sortable/", 5 | "authors": [ 6 | "Jonas von Andrian" 7 | ], 8 | "main": "./source/js/jquery-sortable.js", 9 | "moduleType": [ 10 | "globals" 11 | ], 12 | "keywords": [ 13 | "sortable", 14 | "sort", 15 | "sorting", 16 | "drag", 17 | "dragging" 18 | ], 19 | "license": "BSD-3", 20 | "ignore": [ 21 | "**/.*", 22 | "node_modules", 23 | "bower_components", 24 | "test", 25 | "tests" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -o nounset 3 | set -o errexit 4 | 5 | VERSION=`cat VERSION` 6 | 7 | cp README.mkd .. 8 | bundle exec middleman build 9 | git commit -am "Release $VERSION" 10 | git checkout gh-pages 11 | rm -R js css img 12 | mv build/* . 13 | mv ../README.mkd . 14 | git add . 15 | git commit -am 'Update pages. See main branch for changes' 16 | git push origin gh-pages 17 | git checkout master 18 | -------------------------------------------------------------------------------- /config.rb: -------------------------------------------------------------------------------- 1 | ### 2 | # Compass 3 | ### 4 | 5 | # Susy grids in Compass 6 | # First: gem install compass-susy-plugin 7 | # require 'susy' 8 | 9 | # Change Compass configuration 10 | # compass_config do |config| 11 | # config.output_style = :compact 12 | # end 13 | 14 | ### 15 | # Page options, layouts, aliases and proxies 16 | ### 17 | 18 | # Per-page layout changes: 19 | # 20 | # With no layout 21 | # page "/path/to/file.html", :layout => false 22 | # 23 | # With alternative layout 24 | page "/debug.html", :layout => 'debug.haml' 25 | # 26 | # A path which all have the same layout 27 | # with_layout :admin do 28 | # page "/admin/*" 29 | # end 30 | 31 | # Proxy (fake) files 32 | # page "/this-page-has-no-template.html", :proxy => "/template-file.html" do 33 | # @which_fake_page = "Rendering a fake page with a variable" 34 | # end 35 | 36 | ### 37 | # Helpers 38 | ### 39 | 40 | # Automatic image dimensions on image_tag helper 41 | # activate :automatic_image_sizes 42 | 43 | # Methods defined in the helpers block are available in templates 44 | helpers do 45 | def escape_file(name) 46 | html_escape File.read("source/"+ name) 47 | end 48 | def example(name) 49 | content = escape_file("js/examples/"+ name + ".js") 50 | content.match(/\A\$\(function\s*\(\)\s*\{\s*(.*)\s*\}\s*\);\s*\z/mi)[1].gsub(/^ /, "") 51 | end 52 | def show_code_button 53 | content_tag( :div, 54 | content_tag(:i, "", :class => "icon-chevron-down") + " show me the code", 55 | :class => "btn btn-primary show-code", "data-toggle" => "button") 56 | end 57 | def render_options(type, &block) 58 | content = File.read('source/js/jquery-sortable.js') 59 | options = content.match(%r{#{type}Defaults = \{\s*(.*)\s*\}, // end #{type} defaults}mi)[1] 60 | options.scan(/((?:^\s*\/\/[^\n]*\n)*)^\s*([^:\n]*):\s(fun.*? {2}\}|[^\n]*?),?$/m). 61 | map do |description, option, default| 62 | content_tag(:tr, capture_html(option, 63 | html_escape(default.gsub(/\n\s{4}/, "\n")), 64 | description.gsub(/\s*\n?\s*\/\/\s*/, " "), 65 | &block)) 66 | end.join 67 | end 68 | 69 | def iterate(length, label = "Item", &block) 70 | @nesting ||= [] 71 | prefix = @nesting.empty? ? '' : @nesting.join('.') + '.' 72 | 0.upto(length-1).map do |i| 73 | @nesting.push(i) 74 | out = capture_html(i, "#{label} #{prefix}#{i + 1}", &block) 75 | @nesting.pop 76 | out 77 | end.join 78 | end 79 | 80 | def file_kb(name) 81 | (File.size(name)/100.0).round / 10.0 if File.exists?(name) 82 | end 83 | end 84 | 85 | set :css_dir, 'css' 86 | 87 | ignore 'css/jquery-sortable.css.sass' 88 | 89 | set :js_dir, 'js' 90 | 91 | set :images_dir, 'img' 92 | 93 | def update_version(file) 94 | content = File.read(file).gsub(/("version": "|blob\/)[\d\.]+/, '\1' + VERSION) 95 | File.open(file, 'w') do |file| 96 | file.puts content 97 | end 98 | end 99 | # Build-specific configuration 100 | configure :build do 101 | filename = 'source/js/jquery-sortable.js' 102 | VERSION = File.read("VERSION").strip 103 | updated_file = File.read(filename).gsub(/(^\s\*.*v)[\d\.]+$/, '\1' + VERSION) 104 | File.open(filename, "w") do |file| 105 | file.puts updated_file 106 | end 107 | 108 | require 'closure-compiler' 109 | File.open('source/js/jquery-sortable-min.js','w') do |file| 110 | # closure = Closure::Compiler.new(:compilation_level => 'ADVANCED_OPTIMIZATIONS') 111 | closure = Closure::Compiler.new 112 | file.puts closure.compile(updated_file) 113 | end 114 | 115 | `gzip -c source/js/jquery-sortable-min.js > source/js/jquery-sortable-min.js.gz` 116 | 117 | ['sortable.jquery.json', 118 | 'bower.json', 119 | 'package.json' 120 | ].each { |package_file| update_version(package_file) } 121 | 122 | # For example, change the Compass output style for deployment 123 | # activate :minify_css 124 | 125 | # Minify Javascript on build 126 | # activate :minify_javascript 127 | 128 | # Enable cache buster 129 | # activate :cache_buster 130 | 131 | # Use relative URLs 132 | # activate :relative_assets 133 | 134 | # Compress PNGs after build 135 | # First: gem install middleman-smusher 136 | # require "middleman-smusher" 137 | # activate :smusher 138 | 139 | # Or use a different image path 140 | # set :http_path, "/Content/images/" 141 | set :http_prefix, "/jquery-sortable" 142 | end 143 | 144 | if development? 145 | require 'rack-livereload' 146 | use Rack::LiveReload, 147 | :source => :vendored 148 | end 149 | 150 | require 'rack/coderay' 151 | use Rack::Coderay, "//pre[@lang]" 152 | 153 | # Hack to fix haml output 154 | class Rack::Coderay::Parser 155 | private 156 | def coderay_render(text, language) #:nodoc: 157 | text = text.to_s.gsub(/ /i, "\n").gsub("<", '<').gsub(">", '>').gsub("&", '&').gsub(""", '"') 158 | ::CodeRay.scan(text, language.to_sym).div(self.coderay_options) 159 | end 160 | end 161 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'middleman' 3 | 4 | run Middleman.server -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-sortable", 3 | "version": "0.9.13", 4 | "description": "jquery plugin for sortable, nestable lists", 5 | "main": "./source/js/jquery-sortable.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/johnny/jquery-sortable.git" 12 | }, 13 | "keywords": [ 14 | "sortable", 15 | "sort", 16 | "sorting", 17 | "drag", 18 | "dragging" 19 | ], 20 | "author": [ 21 | "Jonas von Andrian" 22 | ], 23 | "license": "BSD-3", 24 | "bugs": { 25 | "url": "https://github.com/johnny/jquery-sortable/issues" 26 | }, 27 | "homepage": "https://github.com/johnny/jquery-sortable", 28 | "dependencies": { 29 | "jquery": "^2.1.2 || ^3.0.0" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /push-tag.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -o nounset 3 | set -o errexit 4 | 5 | VERSION=`cat VERSION` 6 | 7 | git tag $VERSION 8 | git push origin --tags 9 | -------------------------------------------------------------------------------- /release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -o nounset 3 | set -o errexit 4 | 5 | ./build.sh 6 | ./push-tag.sh 7 | -------------------------------------------------------------------------------- /sortable.jquery.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sortable", 3 | "title": "jQuery Sortable", 4 | "description": "Enables items in a list (or table etc.) to be sorted horizontally and vertically using the mouse. Supports nested lists and pure drag/drop containers. Does not require jQuery UI.", 5 | "keywords": [ 6 | "list", 7 | "sort", 8 | "sortable", 9 | "drag", 10 | "drop" 11 | ], 12 | "version": "0.9.13", 13 | "author": { 14 | "name": "Jonas von Andrian" 15 | }, 16 | "licenses": [ 17 | { 18 | "type": "BSD-3", 19 | "url": "https://github.com/johnny/jquery-sortable/blob/0.9.13/LICENSE" 20 | } 21 | ], 22 | "bugs": "https://github.com/johnny/jquery-sortable/issues", 23 | "homepage": "http://johnny.github.com/jquery-sortable/", 24 | "docs": "http://johnny.github.com/jquery-sortable/", 25 | "download": "http://johnny.github.com/jquery-sortable/", 26 | "dependencies": { 27 | "jquery": ">=1.7" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/_limited_drop_targets.html.haml: -------------------------------------------------------------------------------- 1 | %h2 Connected lists with limited drop targets 2 | .row 3 | .span12.example 4 | %pre(lang="js")= example("limited_drop_targets") 5 | .span4 6 | %ul 7 | %li 8 | %strong Limit the drop targets 9 | of the dragged item 10 | %li 11 | Customize 12 | %strong serialization 13 | of the lists 14 | %li 15 | Decrease sort 16 | %strong sensitivity 17 | %li 18 | Start dragging after a 19 | %strong distance 20 | has been met 21 | %p= show_code_button 22 | %h3 Serialize result 23 | %pre#serialize_output 24 | .span4 25 | %ol.limited_drop_targets.vertical 26 | = iterate(6,"Item") do |i,name| 27 | - if i % 2 == 0 28 | %li.highlight= name 29 | - else 30 | %li= name 31 | .span4 32 | %ol.limited_drop_targets.vertical 33 | = iterate(6,"Item") do |i,name| 34 | - if i >= 3 35 | %li.highlight= name 36 | - else 37 | %li= name 38 | -------------------------------------------------------------------------------- /source/_nested_bootstrap.html.haml: -------------------------------------------------------------------------------- 1 | %h2 Sorting a bootstrap menu 2 | .row 3 | .span4 4 | %ul 5 | %li 6 | Sort 7 | %strong vertically 8 | %li Define the nested containers differently 9 | %li 10 | %strong Exclude 11 | some items from being sortable 12 | %p 13 | %span.label.label-info Heads Up! 14 | The 15 | %code itemSelector 16 | should always match every sibling of any item. 17 | If you want to exclude some items, use the 18 | %code exclude 19 | option. 20 | %small 21 | See the first example 22 | %a(href="http://jqueryui.com/demos/sortable/#items") here 23 | why this is a good idea. 24 | .span8 25 | %pre(lang="js")= example("nested_bootstrap") 26 | .row 27 | .navbar-sort-container 28 | .navbar 29 | .navbar-inner 30 | .container 31 | %ol.nav.pull-left 32 | = iterate(6,"Item") do |i,name| 33 | - if i == 3 34 | %li.dropdown.open 35 | %a(href="#")= name 36 | %ol.dropdown-menu 37 | = iterate(4,"Item") do |j, name| 38 | %li 39 | %a(href="#")= name 40 | - else 41 | %li 42 | %a(href="#")= name 43 | - if i == 2 44 | %li.divider-vertical 45 | %ol.nav.pull-right 46 | = iterate(6,"Item") do |i,name| 47 | %li 48 | %a(href="#")=name 49 | - if i == 2 50 | %li.divider-vertical 51 | -------------------------------------------------------------------------------- /source/_nested_with_switch.html.haml: -------------------------------------------------------------------------------- 1 | %h2 Toggable nested lists 2 | .row 3 | .span12.example 4 | %pre(lang="js")= example("nested_with_switch") 5 | .span4 6 | %ul 7 | %li 8 | %strong Nest lists 9 | of arbitrary depth 10 | %li Highlight the current container 11 | %li 12 | %strong Enable/disable 13 | lists 14 | %p= show_code_button 15 | .span4 16 | .switch-container 17 | .switch.active(data-toggle="switch" data-on="ON" data-off="OFF") 18 | %ol.nested_with_switch.vertical 19 | = iterate(6) do |i, name| 20 | %li 21 | = name 22 | - if i == 3 23 | %ol 24 | = iterate(6) do |j, name| 25 | %li= name 26 | .span4 27 | .switch-container 28 | .switch.active(data-toggle="switch" data-on="ON" data-off="OFF") 29 | %ol.nested_with_switch.vertical 30 | = iterate(6) do |i, name| 31 | %li 32 | = name 33 | - if i == 3 34 | %ol 35 | = iterate(6) do |j, name| 36 | %li= name 37 | -------------------------------------------------------------------------------- /source/_serialization.html.haml: -------------------------------------------------------------------------------- 1 | %h2 Serialization and delay 2 | .row 3 | .span12.example 4 | %pre(lang="js")= example("serialization") 5 | .span4 6 | %ul 7 | %li 8 | Uses the default 9 | %strong serialize 10 | implementation, that reads out the 11 | %strong data attributes 12 | %p= show_code_button 13 | %h3 Serialize result 14 | %pre#serialize_output2 15 | .span4 16 | %ol.serialization.vertical 17 | = iterate(6) do |i,name| 18 | %li(data-id=i data-name=name) 19 | = name 20 | - if i == 3 21 | %ol 22 | = iterate(6) do |j, name| 23 | %li(data-id="#{i}-#{j}" data-name=name)= name 24 | .span4 25 | %ol.serialization.vertical 26 | = iterate(6,"Item") do |i,name| 27 | %li(data-id=i data-name=name)= name 28 | -------------------------------------------------------------------------------- /source/_simple_with_animation.html.haml: -------------------------------------------------------------------------------- 1 | %h2 Connected lists with drop animation 2 | .row 3 | .span12.example 4 | %pre(lang="js")= example("simple_with_animation") 5 | .span4 6 | %ul 7 | %li 8 | Define your own 9 | %strong drop animation 10 | %li 11 | Connect lists by placing them in the same 12 | %code group 13 | %li 14 | Only sort if the cursor is 15 | %strong above a container 16 | %p= show_code_button 17 | .span4 18 | %ol.simple_with_animation.vertical 19 | = iterate(6,"Item") do |i,name| 20 | %li= name 21 | .span4 22 | %ol.simple_with_animation.vertical 23 | = iterate(6,"Item") do |i,name| 24 | %li.highlight= name 25 | -------------------------------------------------------------------------------- /source/_simple_with_no_drop.html.haml: -------------------------------------------------------------------------------- 1 | %h2 Sort handle and limited drag/drop 2 | .row 3 | .span12.example 4 | %pre(lang="js")= example("simple_with_no_drop") 5 | .span4 6 | %ul 7 | %li 8 | Drag the items by a 9 | %strong handle 10 | %li 11 | Pure 12 | %strong drag/drop 13 | container 14 | %li 15 | %strong Clone 16 | items on drag 17 | %p= show_code_button 18 | .span4 19 | %h3 I'm draggable and droppable 20 | %ol.simple_with_drop.vertical 21 | = iterate(6,"Item") do |i,name| 22 | %li 23 | %i.icon-move 24 | = name 25 | .span4 26 | %h3 I'm only draggable 27 | %ol.simple_with_no_drop.vertical 28 | = iterate(3,"Item") do |i,name| 29 | %li.highlight 30 | %i.icon-move 31 | = name 32 | %h3 I'm only droppable 33 | %ol.simple_with_no_drag.vertical 34 | = iterate(3,"Item") do |i,name| 35 | %li 36 | %i.icon-move 37 | = name 38 | -------------------------------------------------------------------------------- /source/_table.html.haml: -------------------------------------------------------------------------------- 1 | %h2 2 | Sort tables 3 | %small (doesn't work well in Konqueror and IE) 4 | .row 5 | .span12.example 6 | %pre(lang="js")= example("table") 7 | .span4 8 | %ul 9 | %li 10 | Sort 11 | %strong tables 12 | %li 13 | Specify custom 14 | %code placeholder 15 | %li 16 | Provide custom 17 | %strong callbacks, 18 | to change the sorting behaviour 19 | %p= show_code_button 20 | .span4 21 | %h3 Sortable Rows 22 | %table.table.table-striped.table-bordered.sorted_table 23 | %thead 24 | %tr 25 | %th A Column 26 | %th B Column 27 | %tbody 28 | = iterate(6) do |i, name| 29 | %tr 30 | %td A #{name} 31 | %td B #{name} 32 | .span4 33 | %h3 Sortable column heads 34 | %table.table.table-striped.table-bordered 35 | %thead.sorted_head 36 | %tr 37 | %th A Column 38 | %th B Column 39 | %th C Column 40 | %tbody 41 | = iterate(6) do |i, name| 42 | %tr 43 | %td A #{name} 44 | %td B #{name} 45 | %td C #{name} 46 | -------------------------------------------------------------------------------- /source/css/_base.sass: -------------------------------------------------------------------------------- 1 | @import bootstrap 2 | -------------------------------------------------------------------------------- /source/css/application.css.sass: -------------------------------------------------------------------------------- 1 | @import base 2 | $error: red 3 | 4 | .hero-unit 5 | background: white 6 | text-align: center 7 | margin-bottom: 0 8 | .example 9 | display: none 10 | .row 11 | position: relative 12 | .page-header h1, h2, #test 13 | padding-top: 40px 14 | .footer 15 | margin-top: 45px 16 | padding: 35px 0 36px 17 | border-top: 1px solid #E5E5E5 18 | p 19 | margin-bottom: 0 20 | color: #555 21 | 22 | table.docs 23 | table-layout: fixed 24 | 25 | th:nth-child(1) 26 | width: 150px 27 | th:nth-child(2) 28 | width: 350px 29 | 30 | @import jquery-sortable 31 | 32 | ol 33 | list-style-type: none 34 | i.icon-move 35 | cursor: pointer 36 | li.highlight 37 | background: $grayDark 38 | color: $grayLight 39 | i.icon-move 40 | background-image: url($iconWhiteSpritePath) 41 | 42 | ol.nested_with_switch, ol.nested_with_switch ol 43 | border: 1px solid $grayLighter 44 | &.active 45 | border: 1px solid $grayDark 46 | 47 | ol.nested_with_switch, ol.simple_with_animation, ol.serialization, ol.default 48 | li 49 | cursor: pointer 50 | 51 | ol.simple_with_animation 52 | border: 1px solid $grayLight 53 | 54 | .switch-container 55 | display: block 56 | margin-left: auto 57 | margin-right: auto 58 | width: 80px 59 | 60 | .navbar-sort-container 61 | height: 200px 62 | 63 | ol.nav 64 | li, li a 65 | cursor: pointer 66 | .divider-vertical 67 | cursor: default 68 | 69 | li.dragged 70 | background-color: #2C2C2C 71 | li.placeholder 72 | position: relative 73 | &:before 74 | content: "" 75 | position: absolute 76 | width: 0 77 | height: 0 78 | border: 5px solid transparent 79 | border-top-color: $error 80 | top: -6px 81 | margin-left: -5px 82 | border-bottom: none 83 | ol.dropdown-menu 84 | li.placeholder:before 85 | border: 5px solid transparent 86 | border-left-color: $error 87 | margin-top: -5px 88 | margin-left: none 89 | top: 0 90 | left: 10px 91 | border-right: none 92 | 93 | .sorted_table 94 | tr 95 | cursor: pointer 96 | tr.placeholder 97 | display: block 98 | background: red 99 | position: relative 100 | margin: 0 101 | padding: 0 102 | border: none 103 | &:before 104 | content: "" 105 | position: absolute 106 | width: 0 107 | height: 0 108 | border: 5px solid transparent 109 | border-left-color: $error 110 | margin-top: -5px 111 | left: -5px 112 | border-right: none 113 | .sorted_head 114 | th 115 | cursor: pointer 116 | th.placeholder 117 | display: block 118 | background: red 119 | position: relative 120 | width: 0 121 | height: 0 122 | margin: 0 123 | padding: 0 124 | &:before 125 | content: "" 126 | position: absolute 127 | width: 0 128 | height: 0 129 | border: 5px solid transparent 130 | border-top-color: $error 131 | top: -6px 132 | margin-left: -5px 133 | border-bottom: none 134 | -------------------------------------------------------------------------------- /source/css/bootstrap-switch.css: -------------------------------------------------------------------------------- 1 | .switch{display:inline-block;width:75px;height:26px;position:relative;background-color:#f0f0f0;background-image:-moz-linear-gradient(top,#e6e6e6,#fff);background-image:-ms-linear-gradient(top,#e6e6e6,#fff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#e6e6e6),to(#fff));background-image:-webkit-linear-gradient(top,#e6e6e6,#fff);background-image:-o-linear-gradient(top,#e6e6e6,#fff);background-image:linear-gradient(top,#e6e6e6,#fff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e6e6e6',endColorstr='#ffffff',GradientType=0);border-color:#fff #fff #d9d9d9;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);*background-color:#fff;border:1px solid #ccc;-webkit-border-radius:13px;-moz-border-radius:13px;border-radius:13px;padding:0;outline:0;overflow:hidden;cursor:pointer}.switch:hover,.switch:active,.switch.active,.switch.disabled,.switch[disabled]{background-color:#fff;*background-color:#f2f2f2}.switch:active,.switch.active{background-color:#e6e6e6 \9}.switch>.switch-track{display:block;width:13px;height:26px;position:absolute;z-index:1;border:0;-webkit-border-radius:13px 0 0 13px;-moz-border-radius:13px 0 0 13px;border-radius:13px 0 0 13px;background-color:#0069cc;background-image:-moz-linear-gradient(top,#05c,#08c);background-image:-ms-linear-gradient(top,#05c,#08c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#05c),to(#08c));background-image:-webkit-linear-gradient(top,#05c,#08c);background-image:-o-linear-gradient(top,#05c,#08c);background-image:linear-gradient(top,#05c,#08c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0055cc',endColorstr='#0088cc',GradientType=0);border-color:#08c #08c #005580;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);*background-color:#08c;opacity:0;filter:alpha(opacity=0);-webkit-transition:width .15s linear,opacity .15s linear;-moz-transition:width .15s linear,opacity .15s linear;-ms-transition:width .15s linear,opacity .15s linear;-o-transition:width .15s linear,opacity .15s linear;transition:width .15s linear,opacity .15s linear}.switch>.switch-track:hover,.switch>.switch-track:active,.switch>.switch-track.active,.switch>.switch-track.disabled,.switch>.switch-track[disabled]{background-color:#08c;*background-color:#0077b3}.switch>.switch-track:active,.switch>.switch-track.active{background-color:#069 \9}.switch.switch-warning>.switch-track{background-color:#f9a123;background-image:-moz-linear-gradient(top,#f89406,#fbb450);background-image:-ms-linear-gradient(top,#f89406,#fbb450);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f89406),to(#fbb450));background-image:-webkit-linear-gradient(top,#f89406,#fbb450);background-image:-o-linear-gradient(top,#f89406,#fbb450);background-image:linear-gradient(top,#f89406,#fbb450);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f89406',endColorstr='#fbb450',GradientType=0);border-color:#fbb450 #fbb450 #f89406;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);*background-color:#fbb450}.switch.switch-warning>.switch-track:hover,.switch.switch-warning>.switch-track:active,.switch.switch-warning>.switch-track.active,.switch.switch-warning>.switch-track.disabled,.switch.switch-warning>.switch-track[disabled]{background-color:#fbb450;*background-color:#faa937}.switch.switch-warning>.switch-track:active,.switch.switch-warning>.switch-track.active{background-color:#fa9f1e \9}.switch.switch-danger>.switch-track{background-color:#d14641;background-image:-moz-linear-gradient(top,#bd362f,#ee5f5b);background-image:-ms-linear-gradient(top,#bd362f,#ee5f5b);background-image:-webkit-gradient(linear,0 0,0 100%,from(#bd362f),to(#ee5f5b));background-image:-webkit-linear-gradient(top,#bd362f,#ee5f5b);background-image:-o-linear-gradient(top,#bd362f,#ee5f5b);background-image:linear-gradient(top,#bd362f,#ee5f5b);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#bd362f',endColorstr='#ee5f5b',GradientType=0);border-color:#ee5f5b #ee5f5b #e51d18;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);*background-color:#ee5f5b}.switch.switch-danger>.switch-track:hover,.switch.switch-danger>.switch-track:active,.switch.switch-danger>.switch-track.active,.switch.switch-danger>.switch-track.disabled,.switch.switch-danger>.switch-track[disabled]{background-color:#ee5f5b;*background-color:#ec4844}.switch.switch-danger>.switch-track:active,.switch.switch-danger>.switch-track.active{background-color:#e9322d \9}.switch.switch-success>.switch-track{background-color:#58b058;background-image:-moz-linear-gradient(top,#51a351,#62c462);background-image:-ms-linear-gradient(top,#51a351,#62c462);background-image:-webkit-gradient(linear,0 0,0 100%,from(#51a351),to(#62c462));background-image:-webkit-linear-gradient(top,#51a351,#62c462);background-image:-o-linear-gradient(top,#51a351,#62c462);background-image:linear-gradient(top,#51a351,#62c462);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#51a351',endColorstr='#62c462',GradientType=0);border-color:#62c462 #62c462 #3b9e3b;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);*background-color:#62c462}.switch.switch-success>.switch-track:hover,.switch.switch-success>.switch-track:active,.switch.switch-success>.switch-track.active,.switch.switch-success>.switch-track.disabled,.switch.switch-success>.switch-track[disabled]{background-color:#62c462;*background-color:#4fbd4f}.switch.switch-success>.switch-track:active,.switch.switch-success>.switch-track.active{background-color:#42b142 \9}.switch.switch-info>.switch-track{background-color:#41a7c5;background-image:-moz-linear-gradient(top,#2f96b4,#5bc0de);background-image:-ms-linear-gradient(top,#2f96b4,#5bc0de);background-image:-webkit-gradient(linear,0 0,0 100%,from(#2f96b4),to(#5bc0de));background-image:-webkit-linear-gradient(top,#2f96b4,#5bc0de);background-image:-o-linear-gradient(top,#2f96b4,#5bc0de);background-image:linear-gradient(top,#2f96b4,#5bc0de);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#2f96b4',endColorstr='#5bc0de',GradientType=0);border-color:#5bc0de #5bc0de #28a1c5;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);*background-color:#5bc0de}.switch.switch-info>.switch-track:hover,.switch.switch-info>.switch-track:active,.switch.switch-info>.switch-track.active,.switch.switch-info>.switch-track.disabled,.switch.switch-info>.switch-track[disabled]{background-color:#5bc0de;*background-color:#46b8da}.switch.switch-info>.switch-track:active,.switch.switch-info>.switch-track.active{background-color:#31b0d5 \9}.switch.switch-inverse>.switch-track{background-color:#363636;background-image:-moz-linear-gradient(top,#222,#555);background-image:-ms-linear-gradient(top,#222,#555);background-image:-webkit-gradient(linear,0 0,0 100%,from(#222),to(#555));background-image:-webkit-linear-gradient(top,#222,#555);background-image:-o-linear-gradient(top,#222,#555);background-image:linear-gradient(top,#222,#555);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#222222',endColorstr='#555555',GradientType=0);border-color:#555 #555 #2f2f2f;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);*background-color:#555}.switch.switch-inverse>.switch-track:hover,.switch.switch-inverse>.switch-track:active,.switch.switch-inverse>.switch-track.active,.switch.switch-inverse>.switch-track.disabled,.switch.switch-inverse>.switch-track[disabled]{background-color:#555;*background-color:#484848}.switch.switch-inverse>.switch-track:active,.switch.switch-inverse>.switch-track.active{background-color:#3b3b3b \9}.switch.active>.switch-track{opacity:1;filter:alpha(opacity=100);width:61px}.switch>.switch-thumb{display:block;width:24px;height:24px;position:absolute;z-index:3;top:0;background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-ms-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(top,#fff,#e6e6e6);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff',endColorstr='#e6e6e6',GradientType=0);border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);*background-color:#e6e6e6;border:1px solid #999;-webkit-border-radius:13px;-moz-border-radius:13px;border-radius:13px;-webkit-transition:left .15s linear;-moz-transition:left .15s linear;-ms-transition:left .15s linear;-o-transition:left .15s linear;transition:left .15s linear}.switch>.switch-thumb:hover,.switch>.switch-thumb:active,.switch>.switch-thumb.active,.switch>.switch-thumb.disabled,.switch>.switch-thumb[disabled]{background-color:#e6e6e6;*background-color:#d9d9d9}.switch>.switch-thumb:active,.switch>.switch-thumb.active{background-color:#ccc \9}.switch>.switch-thumb:hover{background-position:0 -15px;-webkit-transition:left .15s linear,background-position .1s linear;-moz-transition:left .15s linear,background-position .1s linear;-ms-transition:left .15s linear,background-position .1s linear;-o-transition:left .15s linear,background-position .1s linear;transition:left .15s linear,background-position .1s linear}.switch>.switch-thumb:before,.switch>.switch-thumb:after{display:block;width:61px;height:24px;position:absolute;z-index:-1;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-weight:bold;line-height:24px;text-shadow:0 1px 1px rgba(0,0,0,0.25);text-align:center}.switch>.switch-thumb:before{content:attr(data-on);left:-50px;text-indent:-6px;color:#fff}.switch>.switch-thumb:after{content:attr(data-off);left:11px;text-indent:6px;color:#555}.switch.active>.switch-thumb{left:49px}.switch>input[type="checkbox"]{display:none}​ 2 | -------------------------------------------------------------------------------- /source/css/coderay.css: -------------------------------------------------------------------------------- 1 | .CodeRay { 2 | background-color: hsl(0,0%,95%); 3 | border: 1px solid silver; 4 | color: black; 5 | } 6 | .CodeRay pre { 7 | margin: 0px; 8 | } 9 | 10 | span.CodeRay { white-space: pre; border: 0px; padding: 2px; } 11 | 12 | table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px; } 13 | table.CodeRay td { padding: 2px 4px; vertical-align: top; } 14 | 15 | .CodeRay .line-numbers { 16 | background-color: hsl(180,65%,90%); 17 | color: gray; 18 | text-align: right; 19 | -webkit-user-select: none; 20 | -moz-user-select: none; 21 | user-select: none; 22 | } 23 | .CodeRay .line-numbers a { 24 | background-color: hsl(180,65%,90%) !important; 25 | color: gray !important; 26 | text-decoration: none !important; 27 | } 28 | .CodeRay .line-numbers a:target { color: blue !important; } 29 | .CodeRay .line-numbers .highlighted { color: red !important; } 30 | .CodeRay .line-numbers .highlighted a { color: red !important; } 31 | .CodeRay span.line-numbers { padding: 0px 4px; } 32 | .CodeRay .line { display: block; float: left; width: 100%; } 33 | .CodeRay .code { width: 100%; } 34 | 35 | .CodeRay .debug { color: white !important; background: blue !important; } 36 | 37 | .CodeRay .annotation { color:#007 } 38 | .CodeRay .attribute-name { color:#b48 } 39 | .CodeRay .attribute-value { color:#700 } 40 | .CodeRay .binary { color:#509 } 41 | .CodeRay .char .content { color:#D20 } 42 | .CodeRay .char .delimiter { color:#710 } 43 | .CodeRay .char { color:#D20 } 44 | .CodeRay .class { color:#B06; font-weight:bold } 45 | .CodeRay .class-variable { color:#369 } 46 | .CodeRay .color { color:#0A0 } 47 | .CodeRay .comment { color:#777 } 48 | .CodeRay .comment .char { color:#444 } 49 | .CodeRay .comment .delimiter { color:#444 } 50 | .CodeRay .complex { color:#A08 } 51 | .CodeRay .constant { color:#036; font-weight:bold } 52 | .CodeRay .decorator { color:#B0B } 53 | .CodeRay .definition { color:#099; font-weight:bold } 54 | .CodeRay .delimiter { color:black } 55 | .CodeRay .directive { color:#088; font-weight:bold } 56 | .CodeRay .doc { color:#970 } 57 | .CodeRay .doc-string { color:#D42; font-weight:bold } 58 | .CodeRay .doctype { color:#34b } 59 | .CodeRay .entity { color:#800; font-weight:bold } 60 | .CodeRay .error { color:#F00; background-color:#FAA } 61 | .CodeRay .escape { color:#666 } 62 | .CodeRay .exception { color:#C00; font-weight:bold } 63 | .CodeRay .float { color:#60E } 64 | .CodeRay .function { color:#06B; font-weight:bold } 65 | .CodeRay .global-variable { color:#d70 } 66 | .CodeRay .hex { color:#02b } 67 | .CodeRay .imaginary { color:#f00 } 68 | .CodeRay .include { color:#B44; font-weight:bold } 69 | .CodeRay .inline { background-color: hsla(0,0%,0%,0.07); color: black } 70 | .CodeRay .inline-delimiter { font-weight: bold; color: #666 } 71 | .CodeRay .instance-variable { color:#33B } 72 | .CodeRay .integer { color:#00D } 73 | .CodeRay .key .char { color: #60f } 74 | .CodeRay .key .delimiter { color: #404 } 75 | .CodeRay .key { color: #606 } 76 | .CodeRay .keyword { color:#080; font-weight:bold } 77 | .CodeRay .label { color:#970; font-weight:bold } 78 | .CodeRay .local-variable { color:#963 } 79 | .CodeRay .namespace { color:#707; font-weight:bold } 80 | .CodeRay .octal { color:#40E } 81 | .CodeRay .operator { } 82 | .CodeRay .predefined { color:#369; font-weight:bold } 83 | .CodeRay .predefined-constant { color:#069 } 84 | .CodeRay .predefined-type { color:#0a5; font-weight:bold } 85 | .CodeRay .preprocessor { color:#579 } 86 | .CodeRay .pseudo-class { color:#00C; font-weight:bold } 87 | .CodeRay .regexp .content { color:#808 } 88 | .CodeRay .regexp .delimiter { color:#404 } 89 | .CodeRay .regexp .modifier { color:#C2C } 90 | .CodeRay .regexp { background-color:hsla(300,100%,50%,0.06); } 91 | .CodeRay .reserved { color:#080; font-weight:bold } 92 | .CodeRay .shell .content { color:#2B2 } 93 | .CodeRay .shell .delimiter { color:#161 } 94 | .CodeRay .shell { background-color:hsla(120,100%,50%,0.06); } 95 | .CodeRay .string .char { color: #b0b } 96 | .CodeRay .string .content { color: #D20 } 97 | .CodeRay .string .delimiter { color: #710 } 98 | .CodeRay .string .modifier { color: #E40 } 99 | .CodeRay .string { background-color:hsla(0,100%,50%,0.05); } 100 | .CodeRay .symbol .content { color:#A60 } 101 | .CodeRay .symbol .delimiter { color:#630 } 102 | .CodeRay .symbol { color:#A60 } 103 | .CodeRay .tag { color:#070 } 104 | .CodeRay .type { color:#339; font-weight:bold } 105 | .CodeRay .value { color: #088; } 106 | .CodeRay .variable { color:#037 } 107 | 108 | .CodeRay .insert { background: hsla(120,100%,50%,0.12) } 109 | .CodeRay .delete { background: hsla(0,100%,50%,0.12) } 110 | .CodeRay .change { color: #bbf; background: #007; } 111 | .CodeRay .head { color: #f8f; background: #505 } 112 | .CodeRay .head .filename { color: white; } 113 | 114 | .CodeRay .delete .eyecatcher { background-color: hsla(0,100%,50%,0.2); border: 1px solid hsla(0,100%,45%,0.5); margin: -1px; border-bottom: none; border-top-left-radius: 5px; border-top-right-radius: 5px; } 115 | .CodeRay .insert .eyecatcher { background-color: hsla(120,100%,50%,0.2); border: 1px solid hsla(120,100%,25%,0.5); margin: -1px; border-top: none; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; } 116 | 117 | .CodeRay .insert .insert { color: #0c0; background:transparent; font-weight:bold } 118 | .CodeRay .delete .delete { color: #c00; background:transparent; font-weight:bold } 119 | .CodeRay .change .change { color: #88f } 120 | .CodeRay .head .head { color: #f4f } 121 | 122 | 123 | table.CodeRay { 124 | width: auto; 125 | } 126 | 127 | #main .example { 128 | width: 960px; 129 | overflow: auto; 130 | } 131 | 132 | #main .CodeRay pre { 133 | font-size: 13px ! important; 134 | line-height: 15px; 135 | } 136 | -------------------------------------------------------------------------------- /source/css/example.css: -------------------------------------------------------------------------------- 1 | body.dragging, body.dragging * { 2 | cursor: move !important; 3 | } 4 | 5 | .dragged { 6 | position: absolute; 7 | opacity: 0.5; 8 | z-index: 2000; 9 | } 10 | 11 | ol.example li.placeholder { 12 | position: relative; 13 | /** More li styles **/ 14 | } 15 | ol.example li.placeholder:before { 16 | position: absolute; 17 | /** Define arrowhead **/ 18 | } 19 | 20 | -------------------------------------------------------------------------------- /source/css/jquery-sortable.css.sass: -------------------------------------------------------------------------------- 1 | body.dragging, body.dragging * 2 | cursor: move !important 3 | 4 | .dragged 5 | position: absolute 6 | top: 0 7 | opacity: .5 8 | z-index: 2000 9 | 10 | ol.vertical 11 | margin: 0 0 9px 0 12 | min-height: 10px 13 | li 14 | display: block 15 | margin: 5px 16 | padding: 5px 17 | border: 1px solid #CCC 18 | color: $linkColor 19 | background: $grayLighter 20 | li.placeholder 21 | position: relative 22 | margin: 0 23 | padding: 0 24 | border: none 25 | &:before 26 | position: absolute 27 | content: "" 28 | width: 0 29 | height: 0 30 | margin-top: -5px 31 | left: -5px 32 | top: -4px 33 | border: 5px solid transparent 34 | border-left-color: $error 35 | border-right: none 36 | -------------------------------------------------------------------------------- /source/css/vendor.css: -------------------------------------------------------------------------------- 1 | //= require "bootstrap-switch.css" 2 | //= require "coderay.css" 3 | -------------------------------------------------------------------------------- /source/debug.html.erb: -------------------------------------------------------------------------------- 1 | 29 | 30 |
31 |
32 | Part 1 33 |
34 |
35 |
36 |
37 | Part 2 38 |
39 |
40 |
41 |
42 | Part 3 43 |
44 |
45 | Part 4 46 |
47 |
48 |
49 |
50 | Part 5 51 |
52 |
-------------------------------------------------------------------------------- /source/example.html: -------------------------------------------------------------------------------- 1 |
    2 |
  1. First
  2. 3 |
  3. Second
  4. 4 |
  5. Third
  6. 5 |
6 | 7 | -------------------------------------------------------------------------------- /source/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnny/jquery-sortable/4d31eeaf0136307c4d70e9e2252bee001384cf72/source/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /source/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnny/jquery-sortable/4d31eeaf0136307c4d70e9e2252bee001384cf72/source/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /source/index.html.haml: -------------------------------------------------------------------------------- 1 | #home 2 | .hero-unit 3 | %h1 jQuery Sortable 4 | %p A flexible, opinionated sorting plugin for jQuery 5 | %p 6 | %a.btn.btn-large.btn-primary(href="https://github.com/johnny/jquery-sortable") 7 | %i.icon-eye-open.icon-white 8 | View on GitHub 9 | %a.btn.btn-large.btn-success(href="js/jquery-sortable.js") 10 | %i.icon-hdd.icon-white 11 | Download 12 | (v#{File.read("VERSION").strip}) 13 | %p 14 | %small 15 | Download 16 | %a(href="js/jquery-sortable-min.js") minified 17 | version 18 | (#{file_kb("source/js/jquery-sortable-min.js")} kb, gzipped ~#{file_kb("source/js/jquery-sortable-min.js.gz")} kb) 19 | #features 20 | .page-header 21 | %h1 Features 22 | .row 23 | .span6 24 | %h3 So what does it do? 25 | %ul 26 | %li Sorts any items in any container 27 | %li Fully supports nested containers 28 | %li Connect lists 29 | %li Callbacks and events (see docs) 30 | %li Pure drag/drop lists 31 | %li Vertical and horizontal sorting 32 | %h3 Why another sortable plugin? 33 | %p 34 | you might ask. 35 | Aren't there 36 | %a(href="#alternatives") many 37 | others? 38 | %p 39 | %strong The answer is: nested lists. 40 | None of the other solutions had a decent support for nested lists. 41 | %a(href="http://mjsarfatti.com/sandbox/nestedSortable/") nestedSortable 42 | relies on a fixed width hierarchy. 43 | Others mimic the way jQuery UI does 44 | %a(href="http://jqueryui.com/demos/sortable/") sortables 45 | and therefore require ugly 46 | %a(href="https://github.com/jquery/jquery-ui/pull/555") hacks 47 | that suffer from sudden jumps. 48 | %h3 The opinionated part 49 | %p 50 | This plugin does one and only one thing: 51 | %strong sorting 52 | \. If you need animations or autoscrolling, do them 53 | %a(href="#connected") yourself 54 | \. 55 | %p 56 | Moreover this plugin assumes that the placeholder has zero height/width. 57 | As a result, the item dimensions may be cached. 58 | %small This might change in the future, if need be. 59 | %h3 Compatibility 60 | %p 61 | %code jquery-sortable.js 62 | has been tested with the following browsers 63 | %ul 64 | %li Firefox >= 3.5 65 | %li Chrome 66 | %li IE > 7 67 | %li Safari >= 6 68 | %li Opera 69 | %li Konqueror 70 | %p 71 | If you confirmed, that it works on other browsers please 72 | %a(href="mailto:jvadev@gmail.com") tell me 73 | \. 74 | .span6 75 | %h3 76 | Show it to me! 77 | %small 78 | With default options. 79 | %p 80 | %span.label.label-info Heads Up! 81 | There is no on-the-fly creation of sublists. 82 | Only list items that contain a sublist are drop targets. 83 | %ol.default.vertical 84 | %li 85 | First 86 | %ol 87 | %li 88 | Second 89 | %ol 90 | %li 91 | Third 92 | %ol 93 | %li First 94 | %li Second 95 | %li 96 | Third 97 | %ol 98 | %li First 99 | %li Second 100 | %ol 101 | %li First 102 | %li Second 103 | %li Fourth 104 | %li Fifth 105 | %li Sixth 106 | #getting-started 107 | .page-header 108 | %h1 Getting started 109 | %p Making a list sortable consists of 3 easy steps 110 | .row 111 | .span4 112 | %h3 Add styles 113 | %pre(lang="css")= escape_file("css/example.css") 114 | %p 115 | %small 116 | Look 117 | %a(href="https://github.com/johnny/jquery-sortable/blob/master/source/css/jquery-sortable.css.sass") here 118 | for a complete example 119 | .span4 120 | %h3 Define your HTML 121 | %pre(lang="html")= escape_file("example.html") 122 | .span4 123 | %h3 Call the initializer 124 | %pre(lang="js")= escape_file("js/examples/basic.js") 125 | 126 | #examples 127 | .page-header 128 | %h1 Examples 129 | #connected 130 | = partial "simple_with_animation" 131 | #handle 132 | = partial "simple_with_no_drop" 133 | #nested 134 | = partial "nested_with_switch" 135 | #limited-target 136 | = partial "limited_drop_targets" 137 | #bootstrap 138 | = partial "nested_bootstrap" 139 | #serialization 140 | = partial "serialization" 141 | #table 142 | = partial "table" 143 | #external 144 | %h2 External examples 145 | %ul 146 | %li 147 | %a(href="http://www.catch.jp/program/soramame_block/") SoraMame Block 148 | \- program by drag and drop 149 | 150 | #docs 151 | .page-header 152 | %h1 Documentation 153 | %h2 jQuery API 154 | %p 155 | The 156 | %code sortable() 157 | method must be invoked on valid containers, 158 | meaning they must match the 159 | %code containerSelector 160 | option. 161 | .row 162 | .span6 163 | %h3 164 | %code .sortable([options]) 165 | %p 166 | Instantiate sortable on each matched element. 167 | The available options are divided into 168 | %a(href="#group-options") group options 169 | and 170 | %a(href="#container-options") container options 171 | \. 172 | %p 173 | Group options are shared between all member containers and 174 | are set on the first instantiation of a member container. 175 | Subsequent instantiations of further containers in the same group do not change the group options. 176 | %p 177 | Container options can be set seperately for each member of a group. 178 | .span6 179 | %h3 180 | %code .sortable("enable") 181 | %p Enable all instantiated sortables in the set of matched elements 182 | %h3 183 | %code .sortable("disable") 184 | %p Disable all instantiated sortables in the set of matched elements 185 | %h3 186 | %code .sortable("refresh") 187 | %p Reset all cached element dimensions 188 | %h3 189 | %code .sortable("destroy") 190 | %p Remove the sortable plugin from the set of matched elements 191 | %h3 192 | %code .sortable("serialize") 193 | %p 194 | Serialize all selected containers. Returns a 195 | %code jQuery 196 | object . Use 197 | %code .get() 198 | to retrieve the array, if needed. 199 | %h2#group-options Group options 200 | %table.table.table-striped.table-bordered.docs 201 | %thead 202 | %tr 203 | %th Option 204 | %th Default 205 | %th Description 206 | %tbody 207 | = render_options('group') do |option, default, description| 208 | %td 209 | %code= option 210 | %td 211 | %pre(lang="js")= default 212 | %td= description 213 | %h2#container-options Container options 214 | %table.table.table-striped.table-bordered.docs 215 | %thead 216 | %tr 217 | %th Option 218 | %th Default 219 | %th Description 220 | %tbody 221 | = render_options('container') do |option, default, description| 222 | %td 223 | %code= option 224 | %td 225 | %pre(lang="js")= default 226 | %td= description 227 | 228 | #alternatives 229 | .page-header 230 | %h1 Alternatives 231 | %p Listed in alphabetical order 232 | %ul 233 | %li 234 | %a(href="https://github.com/voidberg/html5sortable") HTML5 Sortable 235 | (uses native dnd events, supports IE5.5+) 236 | %li 237 | %a(href="http://jqueryui.com/demos/sortable/") jQuery UI sortable 238 | %li 239 | %a(href="http://dbushell.github.com/Nestable/") Nestable 240 | (requires no jQuery UI) 241 | %li 242 | %a(href="https://github.com/ilikenwf/nestedSortable") nestedSortable 243 | (an extension of jQuery UI) 244 | %li 245 | %a(href="https://github.com/RubaXa/Sortable") RubaXa's Sortable 246 | (supports touch devices and AngularJS) 247 | %li 248 | %a(href="http://yuilibrary.com/yui/docs/sortable/") YUI sortable 249 | 250 | %footer.footer 251 | :markdown 252 | Created by 253 | [Jonas von Andrian](https://github.com/johnny). 254 | 255 | jquery-sortable.js is released under the 256 | [Modified BSD License](http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5). 257 | 258 | Built with [Bootstrap](http://twitter.github.com/bootstrap/). 259 | Icons from [Glyphicons Free](http://glyphicons.com/). 260 | -------------------------------------------------------------------------------- /source/js/application.js: -------------------------------------------------------------------------------- 1 | //= require "vendor/jquery" 2 | //= require "vendor/jquery.color" 3 | //= require "vendor/bootstrap-switch" 4 | //= require "vendor/bootstrap-scrollspy" 5 | //= require "vendor/bootstrap-dropdown" 6 | //= require "vendor/bootstrap-button" 7 | //= require "jquery-sortable" 8 | //= require_directory "./examples/" 9 | 10 | $(function () { 11 | if(!/test/.test(window.location.pathname)) 12 | $('body').scrollspy(); 13 | $('.show-code').on('click', function () { 14 | $(this).closest('.row').children('.example').slideToggle(); 15 | }); 16 | $('ol.default').sortable(); 17 | }); 18 | -------------------------------------------------------------------------------- /source/js/debug.js: -------------------------------------------------------------------------------- 1 | //= require "vendor/jquery" 2 | //= require "jquery-sortable" 3 | 4 | $(function () { 5 | $('#root.region').sortable({ 6 | group: 'nested', 7 | itemSelector: '.part, .layout', 8 | containerSelector: '.region', 9 | nested: true, 10 | placeholder: '
Drop here
' 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /source/js/examples/basic.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | $("ol.example").sortable(); 3 | }); 4 | -------------------------------------------------------------------------------- /source/js/examples/limited_drop_targets.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | var group = $("ol.limited_drop_targets").sortable({ 3 | group: 'limited_drop_targets', 4 | isValidTarget: function ($item, container) { 5 | if($item.is(".highlight")) 6 | return true; 7 | else 8 | return $item.parent("ol")[0] == container.el[0]; 9 | }, 10 | onDrop: function ($item, container, _super) { 11 | $('#serialize_output').text( 12 | group.sortable("serialize").get().join("\n")); 13 | _super($item, container); 14 | }, 15 | serialize: function (parent, children, isContainer) { 16 | return isContainer ? children.join() : parent.text(); 17 | }, 18 | tolerance: 6, 19 | distance: 10 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /source/js/examples/nested_bootstrap.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | $("ol.nav").sortable({ 3 | group: 'nav', 4 | nested: false, 5 | vertical: false, 6 | exclude: '.divider-vertical', 7 | onDragStart: function($item, container, _super) { 8 | $item.find('ol.dropdown-menu').sortable('disable'); 9 | _super($item, container); 10 | }, 11 | onDrop: function($item, container, _super) { 12 | $item.find('ol.dropdown-menu').sortable('enable'); 13 | _super($item, container); 14 | } 15 | }); 16 | 17 | $("ol.dropdown-menu").sortable({ 18 | group: 'nav' 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /source/js/examples/nested_with_switch.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | var oldContainer; 3 | $("ol.nested_with_switch").sortable({ 4 | group: 'nested', 5 | afterMove: function (placeholder, container) { 6 | if(oldContainer != container){ 7 | if(oldContainer) 8 | oldContainer.el.removeClass("active"); 9 | container.el.addClass("active"); 10 | 11 | oldContainer = container; 12 | } 13 | }, 14 | onDrop: function ($item, container, _super) { 15 | container.el.removeClass("active"); 16 | _super($item, container); 17 | } 18 | }); 19 | 20 | $(".switch-container").on("click", ".switch", function (e) { 21 | var method = $(this).hasClass("active") ? "enable" : "disable"; 22 | $(e.delegateTarget).next().sortable(method); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /source/js/examples/serialization.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | var group = $("ol.serialization").sortable({ 3 | group: 'serialization', 4 | delay: 500, 5 | onDrop: function ($item, container, _super) { 6 | var data = group.sortable("serialize").get(); 7 | 8 | var jsonString = JSON.stringify(data, null, ' '); 9 | 10 | $('#serialize_output2').text(jsonString); 11 | _super($item, container); 12 | } 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /source/js/examples/simple_with_animation.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | var adjustment; 3 | 4 | $("ol.simple_with_animation").sortable({ 5 | group: 'simple_with_animation', 6 | pullPlaceholder: false, 7 | // animation on drop 8 | onDrop: function ($item, container, _super) { 9 | var $clonedItem = $('
  • ').css({height: 0}); 10 | $item.before($clonedItem); 11 | $clonedItem.animate({'height': $item.height()}); 12 | 13 | $item.animate($clonedItem.position(), function () { 14 | $clonedItem.detach(); 15 | _super($item, container); 16 | }); 17 | }, 18 | 19 | // set $item relative to cursor position 20 | onDragStart: function ($item, container, _super) { 21 | var offset = $item.offset(), 22 | pointer = container.rootGroup.pointer; 23 | 24 | adjustment = { 25 | left: pointer.left - offset.left, 26 | top: pointer.top - offset.top 27 | }; 28 | 29 | _super($item, container); 30 | }, 31 | onDrag: function ($item, position) { 32 | $item.css({ 33 | left: position.left - adjustment.left, 34 | top: position.top - adjustment.top 35 | }); 36 | } 37 | }); 38 | }); 39 | -------------------------------------------------------------------------------- /source/js/examples/simple_with_no_drop.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $("ol.simple_with_drop").sortable({ 3 | group: 'no-drop', 4 | handle: 'i.icon-move', 5 | onDragStart: function ($item, container, _super) { 6 | // Duplicate items of the no drop area 7 | if(!container.options.drop) 8 | $item.clone().insertAfter($item); 9 | _super($item, container); 10 | } 11 | }); 12 | $("ol.simple_with_no_drop").sortable({ 13 | group: 'no-drop', 14 | drop: false 15 | }); 16 | $("ol.simple_with_no_drag").sortable({ 17 | group: 'no-drop', 18 | drag: false 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /source/js/examples/table.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | // Sortable rows 3 | $('.sorted_table').sortable({ 4 | containerSelector: 'table', 5 | itemPath: '> tbody', 6 | itemSelector: 'tr', 7 | placeholder: '' 8 | }); 9 | 10 | // Sortable column heads 11 | var oldIndex; 12 | $('.sorted_head tr').sortable({ 13 | containerSelector: 'tr', 14 | itemSelector: 'th', 15 | placeholder: '', 16 | vertical: false, 17 | onDragStart: function ($item, container, _super) { 18 | oldIndex = $item.index(); 19 | $item.appendTo($item.parent()); 20 | _super($item, container); 21 | }, 22 | onDrop: function ($item, container, _super) { 23 | var field, 24 | newIndex = $item.index(); 25 | 26 | if(newIndex != oldIndex) { 27 | $item.closest('table').find('tbody tr').each(function (i, row) { 28 | row = $(row); 29 | if(newIndex < oldIndex) { 30 | row.children().eq(newIndex).before(row.children()[oldIndex]); 31 | } else if (newIndex > oldIndex) { 32 | row.children().eq(newIndex).after(row.children()[oldIndex]); 33 | } 34 | }); 35 | } 36 | 37 | _super($item, container); 38 | } 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /source/js/jquery-sortable-min.js: -------------------------------------------------------------------------------- 1 | !function(d,B,m,f){function v(a,b){var c=Math.max(0,a[0]-b[0],b[0]-a[1]),e=Math.max(0,a[2]-b[1],b[1]-a[3]);return c+e}function w(a,b,c,e){var k=a.length;e=e?"offset":"position";for(c=c||0;k--;){var g=a[k].el?a[k].el:d(a[k]),l=g[e]();l.left+=parseInt(g.css("margin-left"),10);l.top+=parseInt(g.css("margin-top"),10);b[k]=[l.left-c,l.left+g.outerWidth()+c,l.top-c,l.top+g.outerHeight()+c]}}function p(a,b){var c=b.offset();return{left:a.left-c.left,top:a.top-c.top}}function x(a,b,c){b=[b.left,b.top];c= 2 | c&&[c.left,c.top];for(var e,k=a.length,d=[];k--;)e=a[k],d[k]=[k,v(e,b),c&&v(e,c)];return d=d.sort(function(a,b){return b[1]-a[1]||b[2]-a[2]||b[0]-a[0]})}function q(a){this.options=d.extend({},n,a);this.containers=[];this.options.rootGroup||(this.scrollProxy=d.proxy(this.scroll,this),this.dragProxy=d.proxy(this.drag,this),this.dropProxy=d.proxy(this.drop,this),this.placeholder=d(this.options.placeholder),a.isValidTarget||(this.options.isValidTarget=f))}function t(a,b){this.el=a;this.options=d.extend({}, 3 | z,b);this.group=q.get(this.options);this.rootGroup=this.options.rootGroup||this.group;this.handle=this.rootGroup.options.handle||this.rootGroup.options.itemSelector;var c=this.rootGroup.options.itemPath;this.target=c?this.el.find(c):this.el;this.target.on(r.start,this.handle,d.proxy(this.dragInit,this));this.options.drop&&this.group.containers.push(this)}var r,z={drag:!0,drop:!0,exclude:"",nested:!0,vertical:!0},n={afterMove:function(a,b,c){},containerPath:"",containerSelector:"ol, ul",distance:0, 4 | delay:0,handle:"",itemPath:"",itemSelector:"li",bodyClass:"dragging",draggedClass:"dragged",isValidTarget:function(a,b){return!0},onCancel:function(a,b,c,e){},onDrag:function(a,b,c,e){a.css(b)},onDragStart:function(a,b,c,e){a.css({height:a.outerHeight(),width:a.outerWidth()});a.addClass(b.group.options.draggedClass);d("body").addClass(b.group.options.bodyClass)},onDrop:function(a,b,c,e){a.removeClass(b.group.options.draggedClass).removeAttr("style");d("body").removeClass(b.group.options.bodyClass)}, 5 | onMousedown:function(a,b,c){if(!c.target.nodeName.match(/^(input|select|textarea)$/i))return c.preventDefault(),!0},placeholderClass:"placeholder",placeholder:'
  • ',pullPlaceholder:!0,serialize:function(a,b,c){a=d.extend({},a.data());if(c)return[b];b[0]&&(a.children=b);delete a.subContainers;delete a.sortable;return a},tolerance:0},s={},y=0,A={left:0,top:0,bottom:0,right:0};r={start:"touchstart.sortable mousedown.sortable",drop:"touchend.sortable touchcancel.sortable mouseup.sortable", 6 | drag:"touchmove.sortable mousemove.sortable",scroll:"scroll.sortable"};q.get=function(a){s[a.group]||(a.group===f&&(a.group=y++),s[a.group]=new q(a));return s[a.group]};q.prototype={dragInit:function(a,b){this.$document=d(b.el[0].ownerDocument);var c=d(a.target).closest(this.options.itemSelector);c.length&&(this.item=c,this.itemContainer=b,!this.item.is(this.options.exclude)&&this.options.onMousedown(this.item,n.onMousedown,a)&&(this.setPointer(a),this.toggleListeners("on"),this.setupDelayTimer(), 7 | this.dragInitDone=!0))},drag:function(a){if(!this.dragging){if(!this.distanceMet(a)||!this.delayMet)return;this.options.onDragStart(this.item,this.itemContainer,n.onDragStart,a);this.item.before(this.placeholder);this.dragging=!0}this.setPointer(a);this.options.onDrag(this.item,p(this.pointer,this.item.offsetParent()),n.onDrag,a);a=this.getPointer(a);var b=this.sameResultBox,c=this.options.tolerance;(!b||b.top-c>a.top||b.bottom+ca.left||b.right+c=this.options.distance},getPointer:function(a){var b= 12 | a.originalEvent||a.originalEvent.touches&&a.originalEvent.touches[0];return{left:a.pageX||b.pageX,top:a.pageY||b.pageY}},setupDelayTimer:function(){var a=this;this.delayMet=!this.options.delay;this.delayMet||(clearTimeout(this._mouseDelayTimer),this._mouseDelayTimer=setTimeout(function(){a.delayMet=!0},this.options.delay))},scroll:function(a){this.clearDimensions();this.clearOffsetParent()},toggleListeners:function(a){var b=this;d.each(["drag","drop","scroll"],function(c,e){b.$document[a](r[e],b[e+ 13 | "Proxy"])})},clearOffsetParent:function(){this.offsetParent=f},clearDimensions:function(){this.traverse(function(a){a._clearDimensions()})},traverse:function(a){a(this);for(var b=this.containers.length;b--;)this.containers[b].traverse(a)},_clearDimensions:function(){this.containerDimensions=f},_destroy:function(){s[this.options.group]=f}};t.prototype={dragInit:function(a){var b=this.rootGroup;!this.disabled&&!b.dragInitDone&&this.options.drag&&this.isValidDrag(a)&&b.dragInit(a,this)},isValidDrag:function(a){return 1== 14 | a.which||"touchstart"==a.type&&1==a.originalEvent.touches.length},searchValidTarget:function(a,b){var c=x(this.getItemDimensions(),a,b),e=c.length,d=this.rootGroup,g=!d.options.isValidTarget||d.options.isValidTarget(d.item,this);if(!e&&g)return d.movePlaceholder(this,this.target,"append"),!0;for(;e--;)if(d=c[e][0],!c[e][1]&&this.hasChildGroup(d)){if(this.getContainerGroup(d).searchValidTarget(a,b))return!0}else if(g)return this.movePlaceholder(d,a),!0},movePlaceholder:function(a,b){var c=d(this.items[a]), 15 | e=this.itemDimensions[a],k="after",g=c.outerWidth(),f=c.outerHeight(),h=c.offset(),h={left:h.left,right:h.left+g,top:h.top,bottom:h.top+f};this.options.vertical?b.top<=(e[2]+e[3])/2?(k="before",h.bottom-=f/2):h.top+=f/2:b.left<=(e[0]+e[1])/2?(k="before",h.right-=g/2):h.left+=g/2;this.hasChildGroup(a)&&(h=A);this.rootGroup.movePlaceholder(this,c,k,h)},getItemDimensions:function(){this.itemDimensions||(this.items=this.$getChildren(this.el,"item").filter(":not(."+this.group.options.placeholderClass+ 16 | ", ."+this.group.options.draggedClass+")").get(),w(this.items,this.itemDimensions=[],this.options.tolerance));return this.itemDimensions},getItemOffsetParent:function(){var a=this.el;return"relative"===a.css("position")||"absolute"===a.css("position")||"fixed"===a.css("position")?a:a.offsetParent()},hasChildGroup:function(a){return this.options.nested&&this.getContainerGroup(a)},getContainerGroup:function(a){var b=d.data(this.items[a],"subContainers");if(b===f){var c=this.$getChildren(this.items[a], 17 | "container"),b=!1;c[0]&&(b=d.extend({},this.options,{rootGroup:this.rootGroup,group:y++}),b=c[m](b).data(m).group);d.data(this.items[a],"subContainers",b)}return b},$getChildren:function(a,b){var c=this.rootGroup.options,e=c[b+"Path"],c=c[b+"Selector"];a=d(a);e&&(a=a.find(e));return a.children(c)},_serialize:function(a,b){var c=this,e=this.$getChildren(a,b?"item":"container").not(this.options.exclude).map(function(){return c._serialize(d(this),!b)}).get();return this.rootGroup.options.serialize(a, 18 | e,b)},traverse:function(a){d.each(this.items||[],function(b){(b=d.data(this,"subContainers"))&&b.traverse(a)});a(this)},_clearDimensions:function(){this.itemDimensions=f},_destroy:function(){var a=this;this.target.off(r.start,this.handle);this.el.removeData(m);this.options.drop&&(this.group.containers=d.grep(this.group.containers,function(b){return b!=a}));d.each(this.items||[],function(){d.removeData(this,"subContainers")})}};var u={enable:function(){this.traverse(function(a){a.disabled=!1})},disable:function(){this.traverse(function(a){a.disabled= 19 | !0})},serialize:function(){return this._serialize(this.el,!0)},refresh:function(){this.traverse(function(a){a._clearDimensions()})},destroy:function(){this.traverse(function(a){a._destroy()})}};d.extend(t.prototype,u);d.fn[m]=function(a){var b=Array.prototype.slice.call(arguments,1);return this.map(function(){var c=d(this),e=c.data(m);if(e&&u[a])return u[a].apply(e,b)||this;e||a!==f&&"object"!==typeof a||c.data(m,new t(c,a));return this})}}(jQuery,window,"sortable"); 20 | -------------------------------------------------------------------------------- /source/js/jquery-sortable.js: -------------------------------------------------------------------------------- 1 | /* =================================================== 2 | * jquery-sortable.js v0.9.13 3 | * http://johnny.github.com/jquery-sortable/ 4 | * =================================================== 5 | * Copyright (c) 2012 Jonas von Andrian 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * * Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * ========================================================== */ 29 | 30 | !function ( $, window, pluginName, undefined){ 31 | var containerDefaults = { 32 | // If true, items can be dragged from this container 33 | drag: true, 34 | // If true, items can be droped onto this container 35 | drop: true, 36 | // Exclude items from being draggable, if the 37 | // selector matches the item 38 | exclude: "", 39 | // If true, search for nested containers within an item.If you nest containers, 40 | // either the original selector with which you call the plugin must only match the top containers, 41 | // or you need to specify a group (see the bootstrap nav example) 42 | nested: true, 43 | // If true, the items are assumed to be arranged vertically 44 | vertical: true 45 | }, // end container defaults 46 | groupDefaults = { 47 | // This is executed after the placeholder has been moved. 48 | // $closestItemOrContainer contains the closest item, the placeholder 49 | // has been put at or the closest empty Container, the placeholder has 50 | // been appended to. 51 | afterMove: function ($placeholder, container, $closestItemOrContainer) { 52 | }, 53 | // The exact css path between the container and its items, e.g. "> tbody" 54 | containerPath: "", 55 | // The css selector of the containers 56 | containerSelector: "ol, ul", 57 | // Distance the mouse has to travel to start dragging 58 | distance: 0, 59 | // Time in milliseconds after mousedown until dragging should start. 60 | // This option can be used to prevent unwanted drags when clicking on an element. 61 | delay: 0, 62 | // The css selector of the drag handle 63 | handle: "", 64 | // The exact css path between the item and its subcontainers. 65 | // It should only match the immediate items of a container. 66 | // No item of a subcontainer should be matched. E.g. for ol>div>li the itemPath is "> div" 67 | itemPath: "", 68 | // The css selector of the items 69 | itemSelector: "li", 70 | // The class given to "body" while an item is being dragged 71 | bodyClass: "dragging", 72 | // The class giving to an item while being dragged 73 | draggedClass: "dragged", 74 | // Check if the dragged item may be inside the container. 75 | // Use with care, since the search for a valid container entails a depth first search 76 | // and may be quite expensive. 77 | isValidTarget: function ($item, container) { 78 | return true 79 | }, 80 | // Executed before onDrop if placeholder is detached. 81 | // This happens if pullPlaceholder is set to false and the drop occurs outside a container. 82 | onCancel: function ($item, container, _super, event) { 83 | }, 84 | // Executed at the beginning of a mouse move event. 85 | // The Placeholder has not been moved yet. 86 | onDrag: function ($item, position, _super, event) { 87 | $item.css(position) 88 | }, 89 | // Called after the drag has been started, 90 | // that is the mouse button is being held down and 91 | // the mouse is moving. 92 | // The container is the closest initialized container. 93 | // Therefore it might not be the container, that actually contains the item. 94 | onDragStart: function ($item, container, _super, event) { 95 | $item.css({ 96 | height: $item.outerHeight(), 97 | width: $item.outerWidth() 98 | }) 99 | $item.addClass(container.group.options.draggedClass) 100 | $("body").addClass(container.group.options.bodyClass) 101 | }, 102 | // Called when the mouse button is being released 103 | onDrop: function ($item, container, _super, event) { 104 | $item.removeClass(container.group.options.draggedClass).removeAttr("style") 105 | $("body").removeClass(container.group.options.bodyClass) 106 | }, 107 | // Called on mousedown. If falsy value is returned, the dragging will not start. 108 | // Ignore if element clicked is input, select or textarea 109 | onMousedown: function ($item, _super, event) { 110 | if (!event.target.nodeName.match(/^(input|select|textarea)$/i)) { 111 | event.preventDefault() 112 | return true 113 | } 114 | }, 115 | // The class of the placeholder (must match placeholder option markup) 116 | placeholderClass: "placeholder", 117 | // Template for the placeholder. Can be any valid jQuery input 118 | // e.g. a string, a DOM element. 119 | // The placeholder must have the class "placeholder" 120 | placeholder: '
  • ', 121 | // If true, the position of the placeholder is calculated on every mousemove. 122 | // If false, it is only calculated when the mouse is above a container. 123 | pullPlaceholder: true, 124 | // Specifies serialization of the container group. 125 | // The pair $parent/$children is either container/items or item/subcontainers. 126 | serialize: function ($parent, $children, parentIsContainer) { 127 | var result = $.extend({}, $parent.data()) 128 | 129 | if(parentIsContainer) 130 | return [$children] 131 | else if ($children[0]){ 132 | result.children = $children 133 | } 134 | 135 | delete result.subContainers 136 | delete result.sortable 137 | 138 | return result 139 | }, 140 | // Set tolerance while dragging. Positive values decrease sensitivity, 141 | // negative values increase it. 142 | tolerance: 0 143 | }, // end group defaults 144 | containerGroups = {}, 145 | groupCounter = 0, 146 | emptyBox = { 147 | left: 0, 148 | top: 0, 149 | bottom: 0, 150 | right:0 151 | }, 152 | eventNames = { 153 | start: "touchstart.sortable mousedown.sortable", 154 | drop: "touchend.sortable touchcancel.sortable mouseup.sortable", 155 | drag: "touchmove.sortable mousemove.sortable", 156 | scroll: "scroll.sortable" 157 | }, 158 | subContainerKey = "subContainers" 159 | 160 | /* 161 | * a is Array [left, right, top, bottom] 162 | * b is array [left, top] 163 | */ 164 | function d(a,b) { 165 | var x = Math.max(0, a[0] - b[0], b[0] - a[1]), 166 | y = Math.max(0, a[2] - b[1], b[1] - a[3]) 167 | return x+y; 168 | } 169 | 170 | function setDimensions(array, dimensions, tolerance, useOffset) { 171 | var i = array.length, 172 | offsetMethod = useOffset ? "offset" : "position" 173 | tolerance = tolerance || 0 174 | 175 | while(i--){ 176 | var el = array[i].el ? array[i].el : $(array[i]), 177 | // use fitting method 178 | pos = el[offsetMethod]() 179 | pos.left += parseInt(el.css('margin-left'), 10) 180 | pos.top += parseInt(el.css('margin-top'),10) 181 | dimensions[i] = [ 182 | pos.left - tolerance, 183 | pos.left + el.outerWidth() + tolerance, 184 | pos.top - tolerance, 185 | pos.top + el.outerHeight() + tolerance 186 | ] 187 | } 188 | } 189 | 190 | function getRelativePosition(pointer, element) { 191 | var offset = element.offset() 192 | return { 193 | left: pointer.left - offset.left, 194 | top: pointer.top - offset.top 195 | } 196 | } 197 | 198 | function sortByDistanceDesc(dimensions, pointer, lastPointer) { 199 | pointer = [pointer.left, pointer.top] 200 | lastPointer = lastPointer && [lastPointer.left, lastPointer.top] 201 | 202 | var dim, 203 | i = dimensions.length, 204 | distances = [] 205 | 206 | while(i--){ 207 | dim = dimensions[i] 208 | distances[i] = [i,d(dim,pointer), lastPointer && d(dim, lastPointer)] 209 | } 210 | distances = distances.sort(function (a,b) { 211 | return b[1] - a[1] || b[2] - a[2] || b[0] - a[0] 212 | }) 213 | 214 | // last entry is the closest 215 | return distances 216 | } 217 | 218 | function ContainerGroup(options) { 219 | this.options = $.extend({}, groupDefaults, options) 220 | this.containers = [] 221 | 222 | if(!this.options.rootGroup){ 223 | this.scrollProxy = $.proxy(this.scroll, this) 224 | this.dragProxy = $.proxy(this.drag, this) 225 | this.dropProxy = $.proxy(this.drop, this) 226 | this.placeholder = $(this.options.placeholder) 227 | 228 | if(!options.isValidTarget) 229 | this.options.isValidTarget = undefined 230 | } 231 | } 232 | 233 | ContainerGroup.get = function (options) { 234 | if(!containerGroups[options.group]) { 235 | if(options.group === undefined) 236 | options.group = groupCounter ++ 237 | 238 | containerGroups[options.group] = new ContainerGroup(options) 239 | } 240 | 241 | return containerGroups[options.group] 242 | } 243 | 244 | ContainerGroup.prototype = { 245 | dragInit: function (e, itemContainer) { 246 | this.$document = $(itemContainer.el[0].ownerDocument) 247 | 248 | // get item to drag 249 | var closestItem = $(e.target).closest(this.options.itemSelector); 250 | // using the length of this item, prevents the plugin from being started if there is no handle being clicked on. 251 | // this may also be helpful in instantiating multidrag. 252 | if (closestItem.length) { 253 | this.item = closestItem; 254 | this.itemContainer = itemContainer; 255 | if (this.item.is(this.options.exclude) || !this.options.onMousedown(this.item, groupDefaults.onMousedown, e)) { 256 | return; 257 | } 258 | this.setPointer(e); 259 | this.toggleListeners('on'); 260 | this.setupDelayTimer(); 261 | this.dragInitDone = true; 262 | } 263 | }, 264 | drag: function (e) { 265 | if(!this.dragging){ 266 | if(!this.distanceMet(e) || !this.delayMet) 267 | return 268 | 269 | this.options.onDragStart(this.item, this.itemContainer, groupDefaults.onDragStart, e) 270 | this.item.before(this.placeholder) 271 | this.dragging = true 272 | } 273 | 274 | this.setPointer(e) 275 | // place item under the cursor 276 | this.options.onDrag(this.item, 277 | getRelativePosition(this.pointer, this.item.offsetParent()), 278 | groupDefaults.onDrag, 279 | e) 280 | 281 | var p = this.getPointer(e), 282 | box = this.sameResultBox, 283 | t = this.options.tolerance 284 | 285 | if(!box || box.top - t > p.top || box.bottom + t < p.top || box.left - t > p.left || box.right + t < p.left) 286 | if(!this.searchValidTarget()){ 287 | this.placeholder.detach() 288 | this.lastAppendedItem = undefined 289 | } 290 | }, 291 | drop: function (e) { 292 | this.toggleListeners('off') 293 | 294 | this.dragInitDone = false 295 | 296 | if(this.dragging){ 297 | // processing Drop, check if placeholder is detached 298 | if(this.placeholder.closest("html")[0]){ 299 | this.placeholder.before(this.item).detach() 300 | } else { 301 | this.options.onCancel(this.item, this.itemContainer, groupDefaults.onCancel, e) 302 | } 303 | this.options.onDrop(this.item, this.getContainer(this.item), groupDefaults.onDrop, e) 304 | 305 | // cleanup 306 | this.clearDimensions() 307 | this.clearOffsetParent() 308 | this.lastAppendedItem = this.sameResultBox = undefined 309 | this.dragging = false 310 | } 311 | }, 312 | searchValidTarget: function (pointer, lastPointer) { 313 | if(!pointer){ 314 | pointer = this.relativePointer || this.pointer 315 | lastPointer = this.lastRelativePointer || this.lastPointer 316 | } 317 | 318 | var distances = sortByDistanceDesc(this.getContainerDimensions(), 319 | pointer, 320 | lastPointer), 321 | i = distances.length 322 | 323 | while(i--){ 324 | var index = distances[i][0], 325 | distance = distances[i][1] 326 | 327 | if(!distance || this.options.pullPlaceholder){ 328 | var container = this.containers[index] 329 | if(!container.disabled){ 330 | if(!this.$getOffsetParent()){ 331 | var offsetParent = container.getItemOffsetParent() 332 | pointer = getRelativePosition(pointer, offsetParent) 333 | lastPointer = getRelativePosition(lastPointer, offsetParent) 334 | } 335 | if(container.searchValidTarget(pointer, lastPointer)) 336 | return true 337 | } 338 | } 339 | } 340 | if(this.sameResultBox) 341 | this.sameResultBox = undefined 342 | }, 343 | movePlaceholder: function (container, item, method, sameResultBox) { 344 | var lastAppendedItem = this.lastAppendedItem 345 | if(!sameResultBox && lastAppendedItem && lastAppendedItem[0] === item[0]) 346 | return; 347 | 348 | item[method](this.placeholder) 349 | this.lastAppendedItem = item 350 | this.sameResultBox = sameResultBox 351 | this.options.afterMove(this.placeholder, container, item) 352 | }, 353 | getContainerDimensions: function () { 354 | if(!this.containerDimensions) 355 | setDimensions(this.containers, this.containerDimensions = [], this.options.tolerance, !this.$getOffsetParent()) 356 | return this.containerDimensions 357 | }, 358 | getContainer: function (element) { 359 | return element.closest(this.options.containerSelector).data(pluginName) 360 | }, 361 | $getOffsetParent: function () { 362 | if(this.offsetParent === undefined){ 363 | var i = this.containers.length - 1, 364 | offsetParent = this.containers[i].getItemOffsetParent() 365 | 366 | if(!this.options.rootGroup){ 367 | while(i--){ 368 | if(offsetParent[0] != this.containers[i].getItemOffsetParent()[0]){ 369 | // If every container has the same offset parent, 370 | // use position() which is relative to this parent, 371 | // otherwise use offset() 372 | // compare #setDimensions 373 | offsetParent = false 374 | break; 375 | } 376 | } 377 | } 378 | 379 | this.offsetParent = offsetParent 380 | } 381 | return this.offsetParent 382 | }, 383 | setPointer: function (e) { 384 | var pointer = this.getPointer(e) 385 | 386 | if(this.$getOffsetParent()){ 387 | var relativePointer = getRelativePosition(pointer, this.$getOffsetParent()) 388 | this.lastRelativePointer = this.relativePointer 389 | this.relativePointer = relativePointer 390 | } 391 | 392 | this.lastPointer = this.pointer 393 | this.pointer = pointer 394 | }, 395 | distanceMet: function (e) { 396 | var currentPointer = this.getPointer(e) 397 | return (Math.max( 398 | Math.abs(this.pointer.left - currentPointer.left), 399 | Math.abs(this.pointer.top - currentPointer.top) 400 | ) >= this.options.distance) 401 | }, 402 | getPointer: function(e) { 403 | var o = e.originalEvent || e.originalEvent.touches && e.originalEvent.touches[0] 404 | return { 405 | left: e.pageX || o.pageX, 406 | top: e.pageY || o.pageY 407 | } 408 | }, 409 | setupDelayTimer: function () { 410 | var that = this 411 | this.delayMet = !this.options.delay 412 | 413 | // init delay timer if needed 414 | if (!this.delayMet) { 415 | clearTimeout(this._mouseDelayTimer); 416 | this._mouseDelayTimer = setTimeout(function() { 417 | that.delayMet = true 418 | }, this.options.delay) 419 | } 420 | }, 421 | scroll: function (e) { 422 | this.clearDimensions() 423 | this.clearOffsetParent() // TODO is this needed? 424 | }, 425 | toggleListeners: function (method) { 426 | var that = this, 427 | events = ['drag','drop','scroll'] 428 | 429 | $.each(events,function (i,event) { 430 | that.$document[method](eventNames[event], that[event + 'Proxy']) 431 | }) 432 | }, 433 | clearOffsetParent: function () { 434 | this.offsetParent = undefined 435 | }, 436 | // Recursively clear container and item dimensions 437 | clearDimensions: function () { 438 | this.traverse(function(object){ 439 | object._clearDimensions() 440 | }) 441 | }, 442 | traverse: function(callback) { 443 | callback(this) 444 | var i = this.containers.length 445 | while(i--){ 446 | this.containers[i].traverse(callback) 447 | } 448 | }, 449 | _clearDimensions: function(){ 450 | this.containerDimensions = undefined 451 | }, 452 | _destroy: function () { 453 | containerGroups[this.options.group] = undefined 454 | } 455 | } 456 | 457 | function Container(element, options) { 458 | this.el = element 459 | this.options = $.extend( {}, containerDefaults, options) 460 | 461 | this.group = ContainerGroup.get(this.options) 462 | this.rootGroup = this.options.rootGroup || this.group 463 | this.handle = this.rootGroup.options.handle || this.rootGroup.options.itemSelector 464 | 465 | var itemPath = this.rootGroup.options.itemPath 466 | this.target = itemPath ? this.el.find(itemPath) : this.el 467 | 468 | this.target.on(eventNames.start, this.handle, $.proxy(this.dragInit, this)) 469 | 470 | if(this.options.drop) 471 | this.group.containers.push(this) 472 | } 473 | 474 | Container.prototype = { 475 | dragInit: function (e) { 476 | var rootGroup = this.rootGroup 477 | 478 | if( !this.disabled && 479 | !rootGroup.dragInitDone && 480 | this.options.drag && 481 | this.isValidDrag(e)) { 482 | rootGroup.dragInit(e, this) 483 | } 484 | }, 485 | isValidDrag: function(e) { 486 | return e.which == 1 || 487 | e.type == "touchstart" && e.originalEvent.touches.length == 1 488 | }, 489 | searchValidTarget: function (pointer, lastPointer) { 490 | var distances = sortByDistanceDesc(this.getItemDimensions(), 491 | pointer, 492 | lastPointer), 493 | i = distances.length, 494 | rootGroup = this.rootGroup, 495 | validTarget = !rootGroup.options.isValidTarget || 496 | rootGroup.options.isValidTarget(rootGroup.item, this) 497 | 498 | if(!i && validTarget){ 499 | rootGroup.movePlaceholder(this, this.target, "append") 500 | return true 501 | } else 502 | while(i--){ 503 | var index = distances[i][0], 504 | distance = distances[i][1] 505 | if(!distance && this.hasChildGroup(index)){ 506 | var found = this.getContainerGroup(index).searchValidTarget(pointer, lastPointer) 507 | if(found) 508 | return true 509 | } 510 | else if(validTarget){ 511 | this.movePlaceholder(index, pointer) 512 | return true 513 | } 514 | } 515 | }, 516 | movePlaceholder: function (index, pointer) { 517 | var item = $(this.items[index]), 518 | dim = this.itemDimensions[index], 519 | method = "after", 520 | width = item.outerWidth(), 521 | height = item.outerHeight(), 522 | offset = item.offset(), 523 | sameResultBox = { 524 | left: offset.left, 525 | right: offset.left + width, 526 | top: offset.top, 527 | bottom: offset.top + height 528 | } 529 | if(this.options.vertical){ 530 | var yCenter = (dim[2] + dim[3]) / 2, 531 | inUpperHalf = pointer.top <= yCenter 532 | if(inUpperHalf){ 533 | method = "before" 534 | sameResultBox.bottom -= height / 2 535 | } else 536 | sameResultBox.top += height / 2 537 | } else { 538 | var xCenter = (dim[0] + dim[1]) / 2, 539 | inLeftHalf = pointer.left <= xCenter 540 | if(inLeftHalf){ 541 | method = "before" 542 | sameResultBox.right -= width / 2 543 | } else 544 | sameResultBox.left += width / 2 545 | } 546 | if(this.hasChildGroup(index)) 547 | sameResultBox = emptyBox 548 | this.rootGroup.movePlaceholder(this, item, method, sameResultBox) 549 | }, 550 | getItemDimensions: function () { 551 | if(!this.itemDimensions){ 552 | this.items = this.$getChildren(this.el, "item").filter( 553 | ":not(." + this.group.options.placeholderClass + ", ." + this.group.options.draggedClass + ")" 554 | ).get() 555 | setDimensions(this.items, this.itemDimensions = [], this.options.tolerance) 556 | } 557 | return this.itemDimensions 558 | }, 559 | getItemOffsetParent: function () { 560 | var offsetParent, 561 | el = this.el 562 | // Since el might be empty we have to check el itself and 563 | // can not do something like el.children().first().offsetParent() 564 | if(el.css("position") === "relative" || el.css("position") === "absolute" || el.css("position") === "fixed") 565 | offsetParent = el 566 | else 567 | offsetParent = el.offsetParent() 568 | return offsetParent 569 | }, 570 | hasChildGroup: function (index) { 571 | return this.options.nested && this.getContainerGroup(index) 572 | }, 573 | getContainerGroup: function (index) { 574 | var childGroup = $.data(this.items[index], subContainerKey) 575 | if( childGroup === undefined){ 576 | var childContainers = this.$getChildren(this.items[index], "container") 577 | childGroup = false 578 | 579 | if(childContainers[0]){ 580 | var options = $.extend({}, this.options, { 581 | rootGroup: this.rootGroup, 582 | group: groupCounter ++ 583 | }) 584 | childGroup = childContainers[pluginName](options).data(pluginName).group 585 | } 586 | $.data(this.items[index], subContainerKey, childGroup) 587 | } 588 | return childGroup 589 | }, 590 | $getChildren: function (parent, type) { 591 | var options = this.rootGroup.options, 592 | path = options[type + "Path"], 593 | selector = options[type + "Selector"] 594 | 595 | parent = $(parent) 596 | if(path) 597 | parent = parent.find(path) 598 | 599 | return parent.children(selector) 600 | }, 601 | _serialize: function (parent, isContainer) { 602 | var that = this, 603 | childType = isContainer ? "item" : "container", 604 | 605 | children = this.$getChildren(parent, childType).not(this.options.exclude).map(function () { 606 | return that._serialize($(this), !isContainer) 607 | }).get() 608 | 609 | return this.rootGroup.options.serialize(parent, children, isContainer) 610 | }, 611 | traverse: function(callback) { 612 | $.each(this.items || [], function(item){ 613 | var group = $.data(this, subContainerKey) 614 | if(group) 615 | group.traverse(callback) 616 | }); 617 | 618 | callback(this) 619 | }, 620 | _clearDimensions: function () { 621 | this.itemDimensions = undefined 622 | }, 623 | _destroy: function() { 624 | var that = this; 625 | 626 | this.target.off(eventNames.start, this.handle); 627 | this.el.removeData(pluginName) 628 | 629 | if(this.options.drop) 630 | this.group.containers = $.grep(this.group.containers, function(val){ 631 | return val != that 632 | }) 633 | 634 | $.each(this.items || [], function(){ 635 | $.removeData(this, subContainerKey) 636 | }) 637 | } 638 | } 639 | 640 | var API = { 641 | enable: function() { 642 | this.traverse(function(object){ 643 | object.disabled = false 644 | }) 645 | }, 646 | disable: function (){ 647 | this.traverse(function(object){ 648 | object.disabled = true 649 | }) 650 | }, 651 | serialize: function () { 652 | return this._serialize(this.el, true) 653 | }, 654 | refresh: function() { 655 | this.traverse(function(object){ 656 | object._clearDimensions() 657 | }) 658 | }, 659 | destroy: function () { 660 | this.traverse(function(object){ 661 | object._destroy(); 662 | }) 663 | } 664 | } 665 | 666 | $.extend(Container.prototype, API) 667 | 668 | /** 669 | * jQuery API 670 | * 671 | * Parameters are 672 | * either options on init 673 | * or a method name followed by arguments to pass to the method 674 | */ 675 | $.fn[pluginName] = function(methodOrOptions) { 676 | var args = Array.prototype.slice.call(arguments, 1) 677 | 678 | return this.map(function(){ 679 | var $t = $(this), 680 | object = $t.data(pluginName) 681 | 682 | if(object && API[methodOrOptions]) 683 | return API[methodOrOptions].apply(object, args) || this 684 | else if(!object && (methodOrOptions === undefined || 685 | typeof methodOrOptions === "object")) 686 | $t.data(pluginName, new Container($t, methodOrOptions)) 687 | 688 | return this 689 | }); 690 | }; 691 | 692 | }(jQuery, window, 'sortable'); 693 | -------------------------------------------------------------------------------- /source/js/test.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | var container = $('ol.test').sortable().data("sortable"), 3 | group = container.group 4 | group.relativePointer = $('ol.test li:eq(2)').position() 5 | if (window.console && window.console.profile) { 6 | console.profile("label for profile"); 7 | console.time("processMove") 8 | group.processMove() 9 | console.timeEnd("processMove") 10 | console.profileEnd(); 11 | } 12 | }) 13 | -------------------------------------------------------------------------------- /source/js/vendor/bootstrap-button.js: -------------------------------------------------------------------------------- 1 | /* ============================================================ 2 | * bootstrap-button.js v2.0.4 3 | * http://twitter.github.com/bootstrap/javascript.html#buttons 4 | * ============================================================ 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ============================================================ */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* BUTTON PUBLIC CLASS DEFINITION 27 | * ============================== */ 28 | 29 | var Button = function (element, options) { 30 | this.$element = $(element) 31 | this.options = $.extend({}, $.fn.button.defaults, options) 32 | } 33 | 34 | Button.prototype.setState = function (state) { 35 | var d = 'disabled' 36 | , $el = this.$element 37 | , data = $el.data() 38 | , val = $el.is('input') ? 'val' : 'html' 39 | 40 | state = state + 'Text' 41 | data.resetText || $el.data('resetText', $el[val]()) 42 | 43 | $el[val](data[state] || this.options[state]) 44 | 45 | // push to event loop to allow forms to submit 46 | setTimeout(function () { 47 | state == 'loadingText' ? 48 | $el.addClass(d).attr(d, d) : 49 | $el.removeClass(d).removeAttr(d) 50 | }, 0) 51 | } 52 | 53 | Button.prototype.toggle = function () { 54 | var $parent = this.$element.parent('[data-toggle="buttons-radio"]') 55 | 56 | $parent && $parent 57 | .find('.active') 58 | .removeClass('active') 59 | 60 | this.$element.toggleClass('active') 61 | } 62 | 63 | 64 | /* BUTTON PLUGIN DEFINITION 65 | * ======================== */ 66 | 67 | $.fn.button = function (option) { 68 | return this.each(function () { 69 | var $this = $(this) 70 | , data = $this.data('button') 71 | , options = typeof option == 'object' && option 72 | if (!data) $this.data('button', (data = new Button(this, options))) 73 | if (option == 'toggle') data.toggle() 74 | else if (option) data.setState(option) 75 | }) 76 | } 77 | 78 | $.fn.button.defaults = { 79 | loadingText: 'loading...' 80 | } 81 | 82 | $.fn.button.Constructor = Button 83 | 84 | 85 | /* BUTTON DATA-API 86 | * =============== */ 87 | 88 | $(function () { 89 | $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) { 90 | var $btn = $(e.target) 91 | if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') 92 | $btn.button('toggle') 93 | }) 94 | }) 95 | 96 | }(window.jQuery); -------------------------------------------------------------------------------- /source/js/vendor/bootstrap-dropdown.js: -------------------------------------------------------------------------------- 1 | /* ============================================================ 2 | * bootstrap-dropdown.js v2.0.4 3 | * http://twitter.github.com/bootstrap/javascript.html#dropdowns 4 | * ============================================================ 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ============================================================ */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* DROPDOWN CLASS DEFINITION 27 | * ========================= */ 28 | 29 | var toggle = '[data-toggle="dropdown"]' 30 | , Dropdown = function (element) { 31 | var $el = $(element).on('click.dropdown.data-api', this.toggle) 32 | $('html').on('click.dropdown.data-api', function () { 33 | $el.parent().removeClass('open') 34 | }) 35 | } 36 | 37 | Dropdown.prototype = { 38 | 39 | constructor: Dropdown 40 | 41 | , toggle: function (e) { 42 | var $this = $(this) 43 | , $parent 44 | , selector 45 | , isActive 46 | 47 | if ($this.is('.disabled, :disabled')) return 48 | 49 | selector = $this.attr('data-target') 50 | 51 | if (!selector) { 52 | selector = $this.attr('href') 53 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 54 | } 55 | 56 | $parent = $(selector) 57 | $parent.length || ($parent = $this.parent()) 58 | 59 | isActive = $parent.hasClass('open') 60 | 61 | clearMenus() 62 | 63 | if (!isActive) $parent.toggleClass('open') 64 | 65 | return false 66 | } 67 | 68 | } 69 | 70 | function clearMenus() { 71 | $(toggle).parent().removeClass('open') 72 | } 73 | 74 | 75 | /* DROPDOWN PLUGIN DEFINITION 76 | * ========================== */ 77 | 78 | $.fn.dropdown = function (option) { 79 | return this.each(function () { 80 | var $this = $(this) 81 | , data = $this.data('dropdown') 82 | if (!data) $this.data('dropdown', (data = new Dropdown(this))) 83 | if (typeof option == 'string') data[option].call($this) 84 | }) 85 | } 86 | 87 | $.fn.dropdown.Constructor = Dropdown 88 | 89 | 90 | /* APPLY TO STANDARD DROPDOWN ELEMENTS 91 | * =================================== */ 92 | 93 | $(function () { 94 | $('html').on('click.dropdown.data-api', clearMenus) 95 | $('body') 96 | .on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() }) 97 | .on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle) 98 | }) 99 | 100 | }(window.jQuery); -------------------------------------------------------------------------------- /source/js/vendor/bootstrap-scrollspy.js: -------------------------------------------------------------------------------- 1 | /* ============================================================= 2 | * bootstrap-scrollspy.js v2.0.4 3 | * http://twitter.github.com/bootstrap/javascript.html#scrollspy 4 | * ============================================================= 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ============================================================== */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* SCROLLSPY CLASS DEFINITION 27 | * ========================== */ 28 | 29 | function ScrollSpy( element, options) { 30 | var process = $.proxy(this.process, this) 31 | , $element = $(element).is('body') ? $(window) : $(element) 32 | , href 33 | this.options = $.extend({}, $.fn.scrollspy.defaults, options) 34 | this.$scrollElement = $element.on('scroll.scroll.data-api', process) 35 | this.selector = (this.options.target 36 | || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 37 | || '') + ' .nav li > a' 38 | this.$body = $('body') 39 | this.refresh() 40 | this.process() 41 | } 42 | 43 | ScrollSpy.prototype = { 44 | 45 | constructor: ScrollSpy 46 | 47 | , refresh: function () { 48 | var self = this 49 | , $targets 50 | 51 | this.offsets = $([]) 52 | this.targets = $([]) 53 | 54 | $targets = this.$body 55 | .find(this.selector) 56 | .map(function () { 57 | var $el = $(this) 58 | , href = $el.data('target') || $el.attr('href') 59 | , $href = /^#\w/.test(href) && $(href) 60 | return ( $href 61 | && href.length 62 | && [[ $href.position().top, href ]] ) || null 63 | }) 64 | .sort(function (a, b) { return a[0] - b[0] }) 65 | .each(function () { 66 | self.offsets.push(this[0]) 67 | self.targets.push(this[1]) 68 | }) 69 | } 70 | 71 | , process: function () { 72 | var scrollTop = this.$scrollElement.scrollTop() + this.options.offset 73 | , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight 74 | , maxScroll = scrollHeight - this.$scrollElement.height() 75 | , offsets = this.offsets 76 | , targets = this.targets 77 | , activeTarget = this.activeTarget 78 | , i 79 | 80 | if (scrollTop >= maxScroll) { 81 | return activeTarget != (i = targets.last()[0]) 82 | && this.activate ( i ) 83 | } 84 | 85 | for (i = offsets.length; i--;) { 86 | activeTarget != targets[i] 87 | && scrollTop >= offsets[i] 88 | && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) 89 | && this.activate( targets[i] ) 90 | } 91 | } 92 | 93 | , activate: function (target) { 94 | var active 95 | , selector 96 | 97 | this.activeTarget = target 98 | 99 | $(this.selector) 100 | .parent('.active') 101 | .removeClass('active') 102 | 103 | selector = this.selector 104 | + '[data-target="' + target + '"],' 105 | + this.selector + '[href="' + target + '"]' 106 | 107 | active = $(selector) 108 | .parent('li') 109 | .addClass('active') 110 | 111 | if (active.parent('.dropdown-menu')) { 112 | active = active.closest('li.dropdown').addClass('active') 113 | } 114 | 115 | active.trigger('activate') 116 | } 117 | 118 | } 119 | 120 | 121 | /* SCROLLSPY PLUGIN DEFINITION 122 | * =========================== */ 123 | 124 | $.fn.scrollspy = function ( option ) { 125 | return this.each(function () { 126 | var $this = $(this) 127 | , data = $this.data('scrollspy') 128 | , options = typeof option == 'object' && option 129 | if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options))) 130 | if (typeof option == 'string') data[option]() 131 | }) 132 | } 133 | 134 | $.fn.scrollspy.Constructor = ScrollSpy 135 | 136 | $.fn.scrollspy.defaults = { 137 | offset: 10 138 | } 139 | 140 | 141 | /* SCROLLSPY DATA-API 142 | * ================== */ 143 | 144 | $(function () { 145 | $('[data-spy="scroll"]').each(function () { 146 | var $spy = $(this) 147 | $spy.scrollspy($spy.data()) 148 | }) 149 | }) 150 | 151 | }(window.jQuery); -------------------------------------------------------------------------------- /source/js/vendor/bootstrap-switch.js: -------------------------------------------------------------------------------- 1 | !function ($) { 2 | 3 | "use strict"; // jshint ;_; 4 | 5 | 6 | /* SWITCH PUBLIC CLASS DEFINITION 7 | * ============================== */ 8 | 9 | var Switch = function (element, options) { 10 | this.init(element, options) 11 | } 12 | 13 | Switch.prototype = { 14 | 15 | constructor: Switch 16 | 17 | , init: function (element, options) { 18 | this.$element = $(element) 19 | this.options = $.extend({}, $.fn.switchbtn.defaults, options) 20 | 21 | this.addChildren() 22 | 23 | this.$element.on('click.switch.data-api', $.proxy(this.toggle, this)) 24 | } 25 | 26 | , toggle: function (e) { 27 | var $el = this.$element 28 | , disabled = 'disabled' 29 | , active = 'active' 30 | 31 | if ($el.attr(disabled) || $el.hasClass(disabled)) return 32 | 33 | $el.toggleClass(active) 34 | this.$checkbox && this.$checkbox.attr('checked', $el.hasClass(active)) 35 | } 36 | 37 | , addChildren: function () { 38 | var $el = this.$element 39 | , options = this.options 40 | 41 | $el.empty() 42 | 43 | this.$checkbox = options.checkbox 44 | && $('') 45 | .attr('name', options.checkbox) 46 | .attr('checked', $el.hasClass('active')) 47 | .appendTo($el) 48 | 49 | $('') 50 | .addClass('switch-track') 51 | .appendTo($el) 52 | $('').addClass('switch-thumb') 53 | .attr('data-on', options.on) 54 | .attr('data-off', options.off) 55 | .appendTo($el) 56 | } 57 | 58 | } 59 | 60 | 61 | /* SWITCH PLUGIN DEFINITION 62 | * ======================== */ 63 | 64 | // IE8- incorrectly treat the 'switch' in '$.fn.switch' as a reserved word so we'll use '$.fn.switchbtn' instead 65 | $.fn.switchbtn = function (option) { 66 | return this.each(function () { 67 | var $this = $(this) 68 | , data = $this.data('switch') 69 | , options = typeof option == 'object' && option 70 | data || $this.data('switch', (data = new Switch(this, options))) 71 | option == 'toggle' && data.toggle() 72 | }) 73 | } 74 | 75 | $.fn.switchbtn.defaults = { 76 | on: 'ON' 77 | , off: 'OFF' 78 | , checkbox: false 79 | } 80 | 81 | $.fn.switchbtn.Constructor = Switch 82 | 83 | 84 | /* SWITCH DATA-API 85 | * =============== */ 86 | 87 | $(function () { 88 | $('[data-toggle="switch"]').each(function () { 89 | var $switch = $(this) 90 | $switch.switchbtn($switch.data()) 91 | }) 92 | }) 93 | 94 | }(window.jQuery); 95 | 96 | -------------------------------------------------------------------------------- /source/js/vendor/jquery.color.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Color Animations v@VERSION 3 | * http://jquery.com/ 4 | * 5 | * Copyright 2012 jQuery Foundation and other contributors 6 | * Dual licensed under the MIT or GPL Version 2 licenses. 7 | * http://jquery.org/license 8 | * 9 | * Date: @DATE 10 | */ 11 | (function( jQuery, undefined ) { 12 | 13 | var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor".split(" "), 14 | 15 | // plusequals test for += 100 -= 100 16 | rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, 17 | // a set of RE's that can match strings and generate color tuples. 18 | stringParsers = [{ 19 | re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, 20 | parse: function( execResult ) { 21 | return [ 22 | execResult[ 1 ], 23 | execResult[ 2 ], 24 | execResult[ 3 ], 25 | execResult[ 4 ] 26 | ]; 27 | } 28 | }, { 29 | re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, 30 | parse: function( execResult ) { 31 | return [ 32 | execResult[ 1 ] * 2.55, 33 | execResult[ 2 ] * 2.55, 34 | execResult[ 3 ] * 2.55, 35 | execResult[ 4 ] 36 | ]; 37 | } 38 | }, { 39 | // this regex ignores A-F because it's compared against an already lowercased string 40 | re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, 41 | parse: function( execResult ) { 42 | return [ 43 | parseInt( execResult[ 1 ], 16 ), 44 | parseInt( execResult[ 2 ], 16 ), 45 | parseInt( execResult[ 3 ], 16 ) 46 | ]; 47 | } 48 | }, { 49 | // this regex ignores A-F because it's compared against an already lowercased string 50 | re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, 51 | parse: function( execResult ) { 52 | return [ 53 | parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), 54 | parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), 55 | parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ) 56 | ]; 57 | } 58 | }, { 59 | re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/, 60 | space: "hsla", 61 | parse: function( execResult ) { 62 | return [ 63 | execResult[ 1 ], 64 | execResult[ 2 ] / 100, 65 | execResult[ 3 ] / 100, 66 | execResult[ 4 ] 67 | ]; 68 | } 69 | }], 70 | 71 | // jQuery.Color( ) 72 | color = jQuery.Color = function( color, green, blue, alpha ) { 73 | return new jQuery.Color.fn.parse( color, green, blue, alpha ); 74 | }, 75 | spaces = { 76 | rgba: { 77 | props: { 78 | red: { 79 | idx: 0, 80 | type: "byte" 81 | }, 82 | green: { 83 | idx: 1, 84 | type: "byte" 85 | }, 86 | blue: { 87 | idx: 2, 88 | type: "byte" 89 | } 90 | } 91 | }, 92 | 93 | hsla: { 94 | props: { 95 | hue: { 96 | idx: 0, 97 | type: "degrees" 98 | }, 99 | saturation: { 100 | idx: 1, 101 | type: "percent" 102 | }, 103 | lightness: { 104 | idx: 2, 105 | type: "percent" 106 | } 107 | } 108 | } 109 | }, 110 | propTypes = { 111 | "byte": { 112 | floor: true, 113 | max: 255 114 | }, 115 | "percent": { 116 | max: 1 117 | }, 118 | "degrees": { 119 | mod: 360, 120 | floor: true 121 | } 122 | }, 123 | support = color.support = {}, 124 | 125 | // element for support tests 126 | supportElem = jQuery( "

    " )[ 0 ], 127 | 128 | // colors = jQuery.Color.names 129 | colors, 130 | 131 | // local aliases of functions called often 132 | each = jQuery.each; 133 | 134 | // determine rgba support immediately 135 | supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; 136 | support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; 137 | 138 | // define cache name and alpha properties 139 | // for rgba and hsla spaces 140 | each( spaces, function( spaceName, space ) { 141 | space.cache = "_" + spaceName; 142 | space.props.alpha = { 143 | idx: 3, 144 | type: "percent", 145 | def: 1 146 | }; 147 | }); 148 | 149 | function clamp( value, prop, allowEmpty ) { 150 | var type = propTypes[ prop.type ] || {}; 151 | 152 | if ( value == null ) { 153 | return (allowEmpty || !prop.def) ? null : prop.def; 154 | } 155 | 156 | // ~~ is an short way of doing floor for positive numbers 157 | value = type.floor ? ~~value : parseFloat( value ); 158 | 159 | // IE will pass in empty strings as value for alpha, 160 | // which will hit this case 161 | if ( isNaN( value ) ) { 162 | return prop.def; 163 | } 164 | 165 | if ( type.mod ) { 166 | // we add mod before modding to make sure that negatives values 167 | // get converted properly: -10 -> 350 168 | return (value + type.mod) % type.mod; 169 | } 170 | 171 | // for now all property types without mod have min and max 172 | return 0 > value ? 0 : type.max < value ? type.max : value; 173 | } 174 | 175 | function stringParse( string ) { 176 | var inst = color(), 177 | rgba = inst._rgba = []; 178 | 179 | string = string.toLowerCase(); 180 | 181 | each( stringParsers, function( i, parser ) { 182 | var parsed, 183 | match = parser.re.exec( string ), 184 | values = match && parser.parse( match ), 185 | spaceName = parser.space || "rgba"; 186 | 187 | if ( values ) { 188 | parsed = inst[ spaceName ]( values ); 189 | 190 | // if this was an rgba parse the assignment might happen twice 191 | // oh well.... 192 | inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; 193 | rgba = inst._rgba = parsed._rgba; 194 | 195 | // exit each( stringParsers ) here because we matched 196 | return false; 197 | } 198 | }); 199 | 200 | // Found a stringParser that handled it 201 | if ( rgba.length ) { 202 | 203 | // if this came from a parsed string, force "transparent" when alpha is 0 204 | // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) 205 | if ( rgba.join() === "0,0,0,0" ) { 206 | jQuery.extend( rgba, colors.transparent ); 207 | } 208 | return inst; 209 | } 210 | 211 | // named colors 212 | return colors[ string ]; 213 | } 214 | 215 | color.fn = jQuery.extend( color.prototype, { 216 | parse: function( red, green, blue, alpha ) { 217 | if ( red === undefined ) { 218 | this._rgba = [ null, null, null, null ]; 219 | return this; 220 | } 221 | if ( red.jquery || red.nodeType ) { 222 | red = jQuery( red ).css( green ); 223 | green = undefined; 224 | } 225 | 226 | var inst = this, 227 | type = jQuery.type( red ), 228 | rgba = this._rgba = [], 229 | source; 230 | 231 | // more than 1 argument specified - assume ( red, green, blue, alpha ) 232 | if ( green !== undefined ) { 233 | red = [ red, green, blue, alpha ]; 234 | type = "array"; 235 | } 236 | 237 | if ( type === "string" ) { 238 | return this.parse( stringParse( red ) || colors._default ); 239 | } 240 | 241 | if ( type === "array" ) { 242 | each( spaces.rgba.props, function( key, prop ) { 243 | rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); 244 | }); 245 | return this; 246 | } 247 | 248 | if ( type === "object" ) { 249 | if ( red instanceof color ) { 250 | each( spaces, function( spaceName, space ) { 251 | if ( red[ space.cache ] ) { 252 | inst[ space.cache ] = red[ space.cache ].slice(); 253 | } 254 | }); 255 | } else { 256 | each( spaces, function( spaceName, space ) { 257 | each( space.props, function( key, prop ) { 258 | var cache = space.cache; 259 | 260 | // if the cache doesn't exist, and we know how to convert 261 | if ( !inst[ cache ] && space.to ) { 262 | 263 | // if the value was null, we don't need to copy it 264 | // if the key was alpha, we don't need to copy it either 265 | if ( key === "alpha" || red[ key ] == null ) { 266 | return; 267 | } 268 | inst[ cache ] = space.to( inst._rgba ); 269 | } 270 | 271 | // this is the only case where we allow nulls for ALL properties. 272 | // call clamp with alwaysAllowEmpty 273 | inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); 274 | }); 275 | }); 276 | } 277 | return this; 278 | } 279 | }, 280 | is: function( compare ) { 281 | var is = color( compare ), 282 | same = true, 283 | inst = this; 284 | 285 | each( spaces, function( _, space ) { 286 | var localCache, 287 | isCache = is[ space.cache ]; 288 | if (isCache) { 289 | localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; 290 | each( space.props, function( _, prop ) { 291 | if ( isCache[ prop.idx ] != null ) { 292 | same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); 293 | return same; 294 | } 295 | }); 296 | } 297 | return same; 298 | }); 299 | return same; 300 | }, 301 | _space: function() { 302 | var used = [], 303 | inst = this; 304 | each( spaces, function( spaceName, space ) { 305 | if ( inst[ space.cache ] ) { 306 | used.push( spaceName ); 307 | } 308 | }); 309 | return used.pop(); 310 | }, 311 | transition: function( other, distance ) { 312 | var end = color( other ), 313 | spaceName = end._space(), 314 | space = spaces[ spaceName ], 315 | startColor = this.alpha() === 0 ? color( "transparent" ) : this, 316 | start = startColor[ space.cache ] || space.to( startColor._rgba ), 317 | result = start.slice(); 318 | 319 | end = end[ space.cache ]; 320 | each( space.props, function( key, prop ) { 321 | var index = prop.idx, 322 | startValue = start[ index ], 323 | endValue = end[ index ], 324 | type = propTypes[ prop.type ] || {}; 325 | 326 | // if null, don't override start value 327 | if ( endValue === null ) { 328 | return; 329 | } 330 | // if null - use end 331 | if ( startValue === null ) { 332 | result[ index ] = endValue; 333 | } else { 334 | if ( type.mod ) { 335 | if ( endValue - startValue > type.mod / 2 ) { 336 | startValue += type.mod; 337 | } else if ( startValue - endValue > type.mod / 2 ) { 338 | startValue -= type.mod; 339 | } 340 | } 341 | result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); 342 | } 343 | }); 344 | return this[ spaceName ]( result ); 345 | }, 346 | blend: function( opaque ) { 347 | // if we are already opaque - return ourself 348 | if ( this._rgba[ 3 ] === 1 ) { 349 | return this; 350 | } 351 | 352 | var rgb = this._rgba.slice(), 353 | a = rgb.pop(), 354 | blend = color( opaque )._rgba; 355 | 356 | return color( jQuery.map( rgb, function( v, i ) { 357 | return ( 1 - a ) * blend[ i ] + a * v; 358 | })); 359 | }, 360 | toRgbaString: function() { 361 | var prefix = "rgba(", 362 | rgba = jQuery.map( this._rgba, function( v, i ) { 363 | return v == null ? ( i > 2 ? 1 : 0 ) : v; 364 | }); 365 | 366 | if ( rgba[ 3 ] === 1 ) { 367 | rgba.pop(); 368 | prefix = "rgb("; 369 | } 370 | 371 | return prefix + rgba.join() + ")"; 372 | }, 373 | toHslaString: function() { 374 | var prefix = "hsla(", 375 | hsla = jQuery.map( this.hsla(), function( v, i ) { 376 | if ( v == null ) { 377 | v = i > 2 ? 1 : 0; 378 | } 379 | 380 | // catch 1 and 2 381 | if ( i && i < 3 ) { 382 | v = Math.round( v * 100 ) + "%"; 383 | } 384 | return v; 385 | }); 386 | 387 | if ( hsla[ 3 ] === 1 ) { 388 | hsla.pop(); 389 | prefix = "hsl("; 390 | } 391 | return prefix + hsla.join() + ")"; 392 | }, 393 | toHexString: function( includeAlpha ) { 394 | var rgba = this._rgba.slice(), 395 | alpha = rgba.pop(); 396 | 397 | if ( includeAlpha ) { 398 | rgba.push( ~~( alpha * 255 ) ); 399 | } 400 | 401 | return "#" + jQuery.map( rgba, function( v, i ) { 402 | 403 | // default to 0 when nulls exist 404 | v = ( v || 0 ).toString( 16 ); 405 | return v.length === 1 ? "0" + v : v; 406 | }).join(""); 407 | }, 408 | toString: function() { 409 | return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); 410 | } 411 | }); 412 | color.fn.parse.prototype = color.fn; 413 | 414 | // hsla conversions adapted from: 415 | // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 416 | 417 | function hue2rgb( p, q, h ) { 418 | h = ( h + 1 ) % 1; 419 | if ( h * 6 < 1 ) { 420 | return p + (q - p) * h * 6; 421 | } 422 | if ( h * 2 < 1) { 423 | return q; 424 | } 425 | if ( h * 3 < 2 ) { 426 | return p + (q - p) * ((2/3) - h) * 6; 427 | } 428 | return p; 429 | } 430 | 431 | spaces.hsla.to = function ( rgba ) { 432 | if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { 433 | return [ null, null, null, rgba[ 3 ] ]; 434 | } 435 | var r = rgba[ 0 ] / 255, 436 | g = rgba[ 1 ] / 255, 437 | b = rgba[ 2 ] / 255, 438 | a = rgba[ 3 ], 439 | max = Math.max( r, g, b ), 440 | min = Math.min( r, g, b ), 441 | diff = max - min, 442 | add = max + min, 443 | l = add * 0.5, 444 | h, s; 445 | 446 | if ( min === max ) { 447 | h = 0; 448 | } else if ( r === max ) { 449 | h = ( 60 * ( g - b ) / diff ) + 360; 450 | } else if ( g === max ) { 451 | h = ( 60 * ( b - r ) / diff ) + 120; 452 | } else { 453 | h = ( 60 * ( r - g ) / diff ) + 240; 454 | } 455 | 456 | if ( l === 0 || l === 1 ) { 457 | s = l; 458 | } else if ( l <= 0.5 ) { 459 | s = diff / add; 460 | } else { 461 | s = diff / ( 2 - add ); 462 | } 463 | return [ Math.round(h) % 360, s, l, a == null ? 1 : a ]; 464 | }; 465 | 466 | spaces.hsla.from = function ( hsla ) { 467 | if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { 468 | return [ null, null, null, hsla[ 3 ] ]; 469 | } 470 | var h = hsla[ 0 ] / 360, 471 | s = hsla[ 1 ], 472 | l = hsla[ 2 ], 473 | a = hsla[ 3 ], 474 | q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, 475 | p = 2 * l - q, 476 | r, g, b; 477 | 478 | return [ 479 | Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), 480 | Math.round( hue2rgb( p, q, h ) * 255 ), 481 | Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), 482 | a 483 | ]; 484 | }; 485 | 486 | 487 | each( spaces, function( spaceName, space ) { 488 | var props = space.props, 489 | cache = space.cache, 490 | to = space.to, 491 | from = space.from; 492 | 493 | // makes rgba() and hsla() 494 | color.fn[ spaceName ] = function( value ) { 495 | 496 | // generate a cache for this space if it doesn't exist 497 | if ( to && !this[ cache ] ) { 498 | this[ cache ] = to( this._rgba ); 499 | } 500 | if ( value === undefined ) { 501 | return this[ cache ].slice(); 502 | } 503 | 504 | var ret, 505 | type = jQuery.type( value ), 506 | arr = ( type === "array" || type === "object" ) ? value : arguments, 507 | local = this[ cache ].slice(); 508 | 509 | each( props, function( key, prop ) { 510 | var val = arr[ type === "object" ? key : prop.idx ]; 511 | if ( val == null ) { 512 | val = local[ prop.idx ]; 513 | } 514 | local[ prop.idx ] = clamp( val, prop ); 515 | }); 516 | 517 | if ( from ) { 518 | ret = color( from( local ) ); 519 | ret[ cache ] = local; 520 | return ret; 521 | } else { 522 | return color( local ); 523 | } 524 | }; 525 | 526 | // makes red() green() blue() alpha() hue() saturation() lightness() 527 | each( props, function( key, prop ) { 528 | // alpha is included in more than one space 529 | if ( color.fn[ key ] ) { 530 | return; 531 | } 532 | color.fn[ key ] = function( value ) { 533 | var vtype = jQuery.type( value ), 534 | fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ), 535 | local = this[ fn ](), 536 | cur = local[ prop.idx ], 537 | match; 538 | 539 | if ( vtype === "undefined" ) { 540 | return cur; 541 | } 542 | 543 | if ( vtype === "function" ) { 544 | value = value.call( this, cur ); 545 | vtype = jQuery.type( value ); 546 | } 547 | if ( value == null && prop.empty ) { 548 | return this; 549 | } 550 | if ( vtype === "string" ) { 551 | match = rplusequals.exec( value ); 552 | if ( match ) { 553 | value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); 554 | } 555 | } 556 | local[ prop.idx ] = value; 557 | return this[ fn ]( local ); 558 | }; 559 | }); 560 | }); 561 | 562 | // add .fx.step functions 563 | each( stepHooks, function( i, hook ) { 564 | jQuery.cssHooks[ hook ] = { 565 | set: function( elem, value ) { 566 | var parsed, backgroundColor, curElem; 567 | 568 | if ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) { 569 | value = color( parsed || value ); 570 | if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { 571 | curElem = hook === "backgroundColor" ? elem.parentNode : elem; 572 | do { 573 | backgroundColor = jQuery.css( curElem, "backgroundColor" ); 574 | } while ( 575 | ( backgroundColor === "" || backgroundColor === "transparent" ) && 576 | ( curElem = curElem.parentNode ) && 577 | curElem.style 578 | ); 579 | 580 | value = value.blend( backgroundColor && backgroundColor !== "transparent" ? 581 | backgroundColor : 582 | "_default" ); 583 | } 584 | 585 | value = value.toRgbaString(); 586 | } 587 | try { 588 | elem.style[ hook ] = value; 589 | } catch( value ) { 590 | // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' 591 | } 592 | } 593 | }; 594 | jQuery.fx.step[ hook ] = function( fx ) { 595 | if ( !fx.colorInit ) { 596 | fx.start = color( fx.elem, hook ); 597 | fx.end = color( fx.end ); 598 | fx.colorInit = true; 599 | } 600 | jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); 601 | }; 602 | }); 603 | 604 | // Basic color names only. 605 | // Usage of any of the other color names requires adding yourself or including 606 | // jquery.color.svg-names.js. 607 | colors = jQuery.Color.names = { 608 | // 4.1. Basic color keywords 609 | aqua: "#00ffff", 610 | black: "#000000", 611 | blue: "#0000ff", 612 | fuchsia: "#ff00ff", 613 | gray: "#808080", 614 | green: "#008000", 615 | lime: "#00ff00", 616 | maroon: "#800000", 617 | navy: "#000080", 618 | olive: "#808000", 619 | purple: "#800080", 620 | red: "#ff0000", 621 | silver: "#c0c0c0", 622 | teal: "#008080", 623 | white: "#ffffff", 624 | yellow: "#ffff00", 625 | 626 | // 4.2.3. ‘transparent’ color keyword 627 | transparent: [ null, null, null, 0 ], 628 | 629 | _default: "#ffffff" 630 | }; 631 | 632 | })( jQuery ); 633 | -------------------------------------------------------------------------------- /source/js/vendor/jquery.js: -------------------------------------------------------------------------------- 1 | /*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ 2 | !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="

    ",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b) 3 | },_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*\s*$/g,ib={option:[1,""],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("