diff --git a/.gitignore b/.gitignore
index cbaf437..3cf5132 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
/.sass-cache
/build
/.bundle
+/node_modules
# tempfiles
diff --git a/CHANGELOG b/CHANGELOG
index f9da5f2..bb9c4fd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,28 +1,37 @@
+[0.9.13] fix hovering over empty container (Jonny Gerig Meyer)
+ allow custom drag classes (Jonny Gerig Meyer)
+ support text areas inside sortables (Isaac Kearse)
+ fix drag with placeholder issue (Michael McLaughlin)
+ user outer dimensions for dragged item (Jared Mellentine)
+ support npm and bower (Patrick Gunderson, Shaun Dern)
+ fix issue with legacy jQuery 1.10
+ fix for mobile chrome
+
[0.9.12] expose mouse events in callbacks
- add refresh method
- add destroy method
- add delay option
- falsy return value in onMousedown prevents dragging
- fix exclusion of items
- fix ignore for select element (abixalmon)
- fix touch events (prateekjadhwani)
- fix itemPath issues (appending and dragInit)
- improve documentation
+ add refresh method
+ add destroy method
+ add delay option
+ falsy return value in onMousedown prevents dragging
+ fix exclusion of items
+ fix ignore for select element (abixalmon)
+ fix touch events (prateekjadhwani)
+ fix itemPath issues (appending and dragInit)
+ improve documentation
[0.9.11] option tolerance accepts negative values
- rewrote enable/disable logic
- added (item|container)Path
+ rewrote enable/disable logic
+ added (item|container)Path
-[0.9.10]Fix Array.indexOf() error in IE < 9 (Dev-Speranza)
- serialize() assumes one subcontainer per item
- remove call to stopPropagation()
- Added onMousedown()
+[0.9.10] Fix Array.indexOf() error in IE < 9 (Dev-Speranza)
+ serialize() assumes one subcontainer per item
+ remove call to stopPropagation()
+ Added onMousedown()
[0.9.9] Added options tolerance and distance
- Do not modify Array.prototype (by Joakin)
- serialize respects exclude option
+ Do not modify Array.prototype (by Joakin)
+ serialize respects exclude option
[0.9.8] Added Serialization
- Added onCancel
+ Added onCancel
[0.9.7] Support iFrame and Touch events
- Better behavior if the CSS position changes
\ No newline at end of file
+ Better behavior if the CSS position changes
diff --git a/Gemfile.lock b/Gemfile.lock
index bd11fa4..ed60e39 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -8,112 +8,124 @@ GIT
GEM
remote: http://rubygems.org/
specs:
- activesupport (3.2.16)
+ activesupport (3.2.22)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
- addressable (2.2.8)
- chunky_png (1.2.9)
- closure-compiler (1.1.6)
- coderay (1.0.7)
+ chunky_png (1.3.4)
+ closure-compiler (1.1.11)
+ coderay (1.1.0)
coffee-script (2.2.0)
coffee-script-source
execjs
- coffee-script-source (1.6.3)
+ coffee-script-source (1.9.1.1)
compass (0.12.2)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
- daemons (1.1.8)
- em-websocket (0.3.8)
- addressable (>= 2.1.1)
+ daemons (1.2.3)
+ em-websocket (0.5.1)
eventmachine (>= 0.12.9)
- eventmachine (0.12.10)
- execjs (1.4.0)
+ http_parser.rb (~> 0.6.0)
+ eventmachine (1.0.7)
+ execjs (1.4.1)
multi_json (~> 1.0)
- ffi (1.9.3)
+ ffi (1.9.9)
+ formatador (0.2.5)
fssm (0.2.10)
- guard (1.2.3)
- listen (>= 0.4.2)
+ guard (1.8.3)
+ formatador (>= 0.2.4)
+ listen (~> 1.3)
+ lumberjack (>= 1.0.2)
+ pry (>= 0.9.10)
thor (>= 0.14.6)
- guard-livereload (1.0.0)
- em-websocket (>= 0.2.0)
- guard (>= 1.1.0)
- multi_json (~> 1.0)
- haml (4.0.5)
+ guard-livereload (1.4.0)
+ em-websocket (>= 0.5.0)
+ guard (>= 1.8.0)
+ multi_json (~> 1.7)
+ haml (4.0.6)
tilt
hike (1.2.3)
hpricot (0.8.6)
- i18n (0.6.9)
- kramdown (1.3.1)
- libv8 (3.16.14.3)
- listen (1.1.6)
+ http_parser.rb (0.6.0)
+ i18n (0.6.11)
+ json (1.8.3)
+ kramdown (1.7.0)
+ libv8 (3.16.14.9)
+ listen (1.3.1)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
rb-kqueue (>= 0.2)
- middleman (3.2.1)
+ lumberjack (1.0.9)
+ method_source (0.8.2)
+ middleman (3.2.2)
coffee-script (~> 2.2.0)
compass (>= 0.12.2)
execjs (~> 1.4.0)
haml (>= 3.1.6)
kramdown (~> 1.2)
- middleman-core (= 3.2.1)
+ middleman-core (= 3.2.2)
middleman-sprockets (>= 3.1.2)
sass (>= 3.1.20)
- uglifier (~> 2.1.0)
- middleman-core (3.2.1)
+ uglifier (~> 2.4.0)
+ middleman-core (3.2.2)
activesupport (~> 3.2.6)
bundler (~> 1.1)
- i18n (~> 0.6.1)
+ i18n (~> 0.6.9)
listen (~> 1.1)
rack (>= 1.4.5)
rack-test (~> 0.6.1)
thor (>= 0.15.2, < 2.0)
tilt (~> 1.4.1)
- middleman-sprockets (3.2.0)
- middleman-core (~> 3.2)
- sprockets (~> 2.1)
- sprockets-helpers (~> 1.0.0)
- sprockets-sass (~> 1.0.0)
- multi_json (1.8.2)
- rack (1.5.2)
+ middleman-sprockets (3.3.3)
+ middleman-core (>= 3.2)
+ sprockets (~> 2.2)
+ sprockets-helpers (~> 1.1.0)
+ sprockets-sass (~> 1.1.0)
+ multi_json (1.11.1)
+ pry (0.10.1)
+ coderay (~> 1.1.0)
+ method_source (~> 0.8.1)
+ slop (~> 3.4)
+ rack (1.6.4)
rack-coderay (0.2.0)
coderay (>= 0.8.312)
hpricot (>= 0.8.1)
rack (>= 1.0.0)
- rack-livereload (0.3.6)
+ rack-livereload (0.3.15)
rack
- rack-test (0.6.2)
+ rack-test (0.6.3)
rack (>= 1.0)
- rb-fsevent (0.9.4)
- rb-inotify (0.9.3)
+ rb-fsevent (0.9.5)
+ rb-inotify (0.9.5)
ffi (>= 0.5.0)
- rb-kqueue (0.2.0)
+ rb-kqueue (0.2.4)
ffi (>= 0.5.0)
- rdiscount (1.6.8)
+ rdiscount (2.1.8)
ref (1.0.5)
sass (3.1.21)
- sprockets (2.10.1)
+ slop (3.6.0)
+ sprockets (2.12.4)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- sprockets-helpers (1.0.1)
+ sprockets-helpers (1.1.0)
sprockets (~> 2.0)
- sprockets-sass (1.0.2)
+ sprockets-sass (1.1.0)
sprockets (~> 2.0)
tilt (~> 1.1)
- therubyracer (0.12.0)
+ therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
ref
- thin (1.4.1)
- daemons (>= 1.0.9)
- eventmachine (>= 0.12.6)
- rack (>= 1.0.0)
- thor (0.18.1)
+ thin (1.6.3)
+ daemons (~> 1.0, >= 1.0.9)
+ eventmachine (~> 1.0)
+ rack (~> 1.0)
+ thor (0.19.1)
tilt (1.4.1)
- uglifier (2.1.2)
+ uglifier (2.4.0)
execjs (>= 0.3.0)
- multi_json (~> 1.0, >= 1.0.2)
+ json (>= 1.8.0)
PLATFORMS
ruby
diff --git a/VERSION b/VERSION
index 583b27a..62ea259 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.9.12
+0.9.13
diff --git a/bower.json b/bower.json
index 7da7175..5c77614 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "jquery-sortable",
- "version": "0.9.12",
+ "version": "0.9.13",
"homepage": "http://johnny.github.io/jquery-sortable/",
"authors": [
"Jonas von Andrian"
@@ -16,7 +16,7 @@
"drag",
"dragging"
],
- "license": "MIT",
+ "license": "BSD-3",
"ignore": [
"**/.*",
"node_modules",
diff --git a/config.rb b/config.rb
index cd47f4e..c301336 100644
--- a/config.rb
+++ b/config.rb
@@ -47,7 +47,7 @@ def escape_file(name)
end
def example(name)
content = escape_file("js/examples/"+ name + ".js")
- content.match(/\A\$\(function\s*\(\)\s*\{\s*(.*)\s*\}\s*\)\s*\z/mi)[1].gsub(/^ /, "")
+ content.match(/\A\$\(function\s*\(\)\s*\{\s*(.*)\s*\}\s*\);\s*\z/mi)[1].gsub(/^ /, "")
end
def show_code_button
content_tag( :div,
@@ -90,6 +90,12 @@ def file_kb(name)
set :images_dir, 'img'
+def update_version(file)
+ content = File.read(file).gsub(/("version": "|blob\/)[\d\.]+/, '\1' + VERSION)
+ File.open(file, 'w') do |file|
+ file.puts content
+ end
+end
# Build-specific configuration
configure :build do
filename = 'source/js/jquery-sortable.js'
@@ -108,11 +114,10 @@ def file_kb(name)
`gzip -c source/js/jquery-sortable-min.js > source/js/jquery-sortable-min.js.gz`
- manifest = 'sortable.jquery.json'
- content = File.read(manifest).gsub(/("version": "|blob\/)[\d\.]+/, '\1' + VERSION)
- File.open(manifest, 'w') do |file|
- file.puts content
- end
+ ['sortable.jquery.json',
+ 'bower.json',
+ 'package.json'
+ ].each { |package_file| update_version(package_file) }
# For example, change the Compass output style for deployment
# activate :minify_css
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..39166ca
--- /dev/null
+++ b/package.json
@@ -0,0 +1,31 @@
+{
+ "name": "jquery-sortable",
+ "version": "0.9.13",
+ "description": "jquery plugin for sortable, nestable lists",
+ "main": "./source/js/jquery-sortable.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/johnny/jquery-sortable.git"
+ },
+ "keywords": [
+ "sortable",
+ "sort",
+ "sorting",
+ "drag",
+ "dragging"
+ ],
+ "author": [
+ "Jonas von Andrian"
+ ],
+ "license": "BSD-3",
+ "bugs": {
+ "url": "https://github.com/johnny/jquery-sortable/issues"
+ },
+ "homepage": "https://github.com/johnny/jquery-sortable",
+ "dependencies": {
+ "jquery": "^2.1.2 || ^3.0.0"
+ }
+}
diff --git a/sortable.jquery.json b/sortable.jquery.json
index d9982fd..425ac93 100644
--- a/sortable.jquery.json
+++ b/sortable.jquery.json
@@ -9,14 +9,14 @@
"drag",
"drop"
],
- "version": "0.9.12",
+ "version": "0.9.13",
"author": {
"name": "Jonas von Andrian"
},
"licenses": [
{
"type": "BSD-3",
- "url": "https://github.com/johnny/jquery-sortable/blob/0.9.12/LICENSE"
+ "url": "https://github.com/johnny/jquery-sortable/blob/0.9.13/LICENSE"
}
],
"bugs": "https://github.com/johnny/jquery-sortable/issues",
diff --git a/source/_table.html.haml b/source/_table.html.haml
index 2e948ef..1157cb5 100644
--- a/source/_table.html.haml
+++ b/source/_table.html.haml
@@ -36,8 +36,10 @@
%tr
%th A Column
%th B Column
+ %th C Column
%tbody
= iterate(6) do |i, name|
%tr
%td A #{name}
%td B #{name}
+ %td C #{name}
diff --git a/source/index.html.haml b/source/index.html.haml
index 8fe8668..b2e83ba 100644
--- a/source/index.html.haml
+++ b/source/index.html.haml
@@ -140,6 +140,13 @@
= partial "serialization"
#table
= partial "table"
+ #external
+ %h2 External examples
+ %ul
+ %li
+ %a(href="http://www.catch.jp/program/soramame_block/") SoraMame Block
+ \- program by drag and drop
+
#docs
.page-header
%h1 Documentation
diff --git a/source/js/application.js b/source/js/application.js
index 531d907..c569157 100644
--- a/source/js/application.js
+++ b/source/js/application.js
@@ -9,9 +9,9 @@
$(function () {
if(!/test/.test(window.location.pathname))
- $('body').scrollspy()
+ $('body').scrollspy();
$('.show-code').on('click', function () {
- $(this).closest('.row').children('.example').slideToggle()
- })
- $('ol.default').sortable()
-})
+ $(this).closest('.row').children('.example').slideToggle();
+ });
+ $('ol.default').sortable();
+});
diff --git a/source/js/debug.js b/source/js/debug.js
index dfc3754..e1dc04e 100644
--- a/source/js/debug.js
+++ b/source/js/debug.js
@@ -7,6 +7,6 @@ $(function () {
itemSelector: '.part, .layout',
containerSelector: '.region',
nested: true,
- placeholder: '
Drop here
',
+ placeholder: 'Drop here
'
});
-})
+});
diff --git a/source/js/examples/basic.js b/source/js/examples/basic.js
index ed2b7a4..0446d1a 100644
--- a/source/js/examples/basic.js
+++ b/source/js/examples/basic.js
@@ -1,3 +1,3 @@
$(function () {
- $("ol.example").sortable()
-})
+ $("ol.example").sortable();
+});
diff --git a/source/js/examples/limited_drop_targets.js b/source/js/examples/limited_drop_targets.js
index cb1e5e1..65280f1 100644
--- a/source/js/examples/limited_drop_targets.js
+++ b/source/js/examples/limited_drop_targets.js
@@ -3,19 +3,19 @@ $(function () {
group: 'limited_drop_targets',
isValidTarget: function ($item, container) {
if($item.is(".highlight"))
- return true
- else {
- return $item.parent("ol")[0] == container.el[0]
- }
+ return true;
+ else
+ return $item.parent("ol")[0] == container.el[0];
},
onDrop: function ($item, container, _super) {
- $('#serialize_output').text(group.sortable("serialize").get().join("\n"))
- _super($item, container)
+ $('#serialize_output').text(
+ group.sortable("serialize").get().join("\n"));
+ _super($item, container);
},
serialize: function (parent, children, isContainer) {
- return isContainer ? children.join() : parent.text()
+ return isContainer ? children.join() : parent.text();
},
tolerance: 6,
distance: 10
- })
-})
+ });
+});
diff --git a/source/js/examples/nested_bootstrap.js b/source/js/examples/nested_bootstrap.js
index 7732d6e..e6cd920 100644
--- a/source/js/examples/nested_bootstrap.js
+++ b/source/js/examples/nested_bootstrap.js
@@ -5,15 +5,16 @@ $(function () {
vertical: false,
exclude: '.divider-vertical',
onDragStart: function($item, container, _super) {
- $item.find('ol.dropdown-menu').sortable('disable')
- _super($item, container)
+ $item.find('ol.dropdown-menu').sortable('disable');
+ _super($item, container);
},
onDrop: function($item, container, _super) {
- $item.find('ol.dropdown-menu').sortable('enable')
- _super($item, container)
+ $item.find('ol.dropdown-menu').sortable('enable');
+ _super($item, container);
}
- })
+ });
+
$("ol.dropdown-menu").sortable({
group: 'nav'
- })
-})
+ });
+});
diff --git a/source/js/examples/nested_with_switch.js b/source/js/examples/nested_with_switch.js
index 5f406c1..053cefc 100644
--- a/source/js/examples/nested_with_switch.js
+++ b/source/js/examples/nested_with_switch.js
@@ -1,24 +1,24 @@
$(function () {
- var oldContainer
+ var oldContainer;
$("ol.nested_with_switch").sortable({
group: 'nested',
afterMove: function (placeholder, container) {
if(oldContainer != container){
if(oldContainer)
- oldContainer.el.removeClass("active")
- container.el.addClass("active")
+ oldContainer.el.removeClass("active");
+ container.el.addClass("active");
- oldContainer = container
+ oldContainer = container;
}
},
onDrop: function ($item, container, _super) {
- container.el.removeClass("active")
- _super($item, container)
+ container.el.removeClass("active");
+ _super($item, container);
}
- })
+ });
$(".switch-container").on("click", ".switch", function (e) {
- var method = $(this).hasClass("active") ? "enable" : "disable"
- $(e.delegateTarget).next().sortable(method)
- })
-})
+ var method = $(this).hasClass("active") ? "enable" : "disable";
+ $(e.delegateTarget).next().sortable(method);
+ });
+});
diff --git a/source/js/examples/serialization.js b/source/js/examples/serialization.js
index 6f1d5e6..6bb3e23 100644
--- a/source/js/examples/serialization.js
+++ b/source/js/examples/serialization.js
@@ -8,7 +8,7 @@ $(function () {
var jsonString = JSON.stringify(data, null, ' ');
$('#serialize_output2').text(jsonString);
- _super($item, container)
+ _super($item, container);
}
- })
-})
+ });
+});
diff --git a/source/js/examples/simple_with_animation.js b/source/js/examples/simple_with_animation.js
index b2eb80d..71748c6 100644
--- a/source/js/examples/simple_with_animation.js
+++ b/source/js/examples/simple_with_animation.js
@@ -1,38 +1,38 @@
$(function () {
- var adjustment
+ var adjustment;
$("ol.simple_with_animation").sortable({
group: 'simple_with_animation',
pullPlaceholder: false,
// animation on drop
onDrop: function ($item, container, _super) {
- var $clonedItem = $('').css({height: 0})
- $item.before($clonedItem)
- $clonedItem.animate({'height': $item.height()})
+ var $clonedItem = $('').css({height: 0});
+ $item.before($clonedItem);
+ $clonedItem.animate({'height': $item.height()});
$item.animate($clonedItem.position(), function () {
- $clonedItem.detach()
- _super($item, container)
- })
+ $clonedItem.detach();
+ _super($item, container);
+ });
},
// set $item relative to cursor position
onDragStart: function ($item, container, _super) {
var offset = $item.offset(),
- pointer = container.rootGroup.pointer
+ pointer = container.rootGroup.pointer;
adjustment = {
left: pointer.left - offset.left,
top: pointer.top - offset.top
- }
+ };
- _super($item, container)
+ _super($item, container);
},
onDrag: function ($item, position) {
$item.css({
left: position.left - adjustment.left,
top: position.top - adjustment.top
- })
+ });
}
- })
-})
+ });
+});
diff --git a/source/js/examples/simple_with_no_drop.js b/source/js/examples/simple_with_no_drop.js
index c5276e1..db94fcc 100644
--- a/source/js/examples/simple_with_no_drop.js
+++ b/source/js/examples/simple_with_no_drop.js
@@ -5,16 +5,16 @@ $(function() {
onDragStart: function ($item, container, _super) {
// Duplicate items of the no drop area
if(!container.options.drop)
- $item.clone().insertAfter($item)
- _super($item, container)
+ $item.clone().insertAfter($item);
+ _super($item, container);
}
- })
+ });
$("ol.simple_with_no_drop").sortable({
group: 'no-drop',
drop: false
- })
+ });
$("ol.simple_with_no_drag").sortable({
group: 'no-drop',
drag: false
- })
-})
+ });
+});
diff --git a/source/js/examples/table.js b/source/js/examples/table.js
index 0534e12..051d52e 100644
--- a/source/js/examples/table.js
+++ b/source/js/examples/table.js
@@ -5,35 +5,36 @@ $(function () {
itemPath: '> tbody',
itemSelector: 'tr',
placeholder: '
'
- })
+ });
// Sortable column heads
- var oldIndex
+ var oldIndex;
$('.sorted_head tr').sortable({
containerSelector: 'tr',
itemSelector: 'th',
placeholder: ' | ',
vertical: false,
onDragStart: function ($item, container, _super) {
- oldIndex = $item.index()
- $item.appendTo($item.parent())
- _super($item, container)
+ oldIndex = $item.index();
+ $item.appendTo($item.parent());
+ _super($item, container);
},
onDrop: function ($item, container, _super) {
var field,
- newIndex = $item.index()
+ newIndex = $item.index();
- if(newIndex != oldIndex)
+ if(newIndex != oldIndex) {
$item.closest('table').find('tbody tr').each(function (i, row) {
- row = $(row)
- field = row.children().eq(oldIndex)
- if(newIndex)
- field.before(row.children()[newIndex])
- else
- row.prepend(field)
- })
+ row = $(row);
+ if(newIndex < oldIndex) {
+ row.children().eq(newIndex).before(row.children()[oldIndex]);
+ } else if (newIndex > oldIndex) {
+ row.children().eq(newIndex).after(row.children()[oldIndex]);
+ }
+ });
+ }
- _super($item, container)
+ _super($item, container);
}
- })
-})
+ });
+});
diff --git a/source/js/jquery-sortable-min.js b/source/js/jquery-sortable-min.js
index 3d2977a..4b483e5 100644
--- a/source/js/jquery-sortable-min.js
+++ b/source/js/jquery-sortable-min.js
@@ -1,19 +1,19 @@
-!function(d,y,k,j){function s(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 t(a,b,c,e){for(var h=a.length,e=e?"offset":"position",c=c||0;h--;){var f=a[h].el?a[h].el:d(a[h]),i=f[e]();i.left+=parseInt(f.css("margin-left"),10);i.top+=parseInt(f.css("margin-top"),10);b[h]=[i.left-c,i.left+f.outerWidth()+c,i.top-c,i.top+f.outerHeight()+c]}}function m(a,b){var c=b.offset();return{left:a.left-c.left,top:a.top-c.top}}function u(a,b,c){for(var b=[b.left,b.top],
-c=c&&[c.left,c.top],e,h=a.length,d=[];h--;)e=a[h],d[h]=[h,s(e,b),c&&s(e,c)];return d=d.sort(function(a,b){return b[1]-a[1]||b[2]-a[2]||b[0]-a[0]})}function n(a){this.options=d.extend({},l,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=j))}function q(a,b){this.el=a;this.options=d.extend({},
-w,b);this.group=n.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(o.start,this.handle,d.proxy(this.dragInit,this));this.options.drop&&this.group.containers.push(this)}var o,w={drag:!0,drop:!0,exclude:"",nested:!0,vertical:!0},l={afterMove:function(){},containerPath:"",containerSelector:"ol, ul",distance:0,delay:0,
-handle:"",itemPath:"",itemSelector:"li",isValidTarget:function(){return!0},onCancel:function(){},onDrag:function(a,b){a.css(b)},onDragStart:function(a){a.css({height:a.height(),width:a.width()});a.addClass("dragged");d("body").addClass("dragging")},onDrop:function(a){a.removeClass("dragged").removeAttr("style");d("body").removeClass("dragging")},onMousedown:function(a,b,c){if(!c.target.nodeName.match(/^(input|select)$/i))return c.preventDefault(),!0},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},p={},v=0,x={left:0,top:0,bottom:0,right:0};o={start:"touchstart.sortable mousedown.sortable",drop:"touchend.sortable touchcancel.sortable mouseup.sortable",drag:"touchmove.sortable mousemove.sortable",scroll:"scroll.sortable"};n.get=function(a){p[a.group]||(a.group===j&&(a.group=v++),p[a.group]=new n(a));return p[a.group]};n.prototype={dragInit:function(a,
-b){this.$document=d(b.el[0].ownerDocument);this.item=d(a.target).closest(this.options.itemSelector);this.itemContainer=b;!this.item.is(this.options.exclude)&&this.options.onMousedown(this.item,l.onMousedown,a)&&(this.setPointer(a),this.toggleListeners("on"),this.setupDelayTimer(),this.dragInitDone=!0)},drag:function(a){if(!this.dragging){if(!this.distanceMet(a)||!this.delayMet)return;this.options.onDragStart(this.item,this.itemContainer,l.onDragStart,a);this.item.before(this.placeholder);this.dragging=
-!0}this.setPointer(a);this.options.onDrag(this.item,m(this.pointer,this.item.offsetParent()),l.onDrag,a);var b=a.pageX||a.originalEvent.pageX,a=a.pageY||a.originalEvent.pageY,c=this.sameResultBox,e=this.options.tolerance;if(!c||c.top-e>a||c.bottom+eb||c.right+e=this.options.distance},getPointer:function(a){return{left:a.pageX||a.originalEvent.pageX,top:a.pageY||a.originalEvent.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(){this.clearDimensions();this.clearOffsetParent()},toggleListeners:function(a){var b=this;d.each(["drag","drop","scroll"],function(c,e){b.$document[a](o[e],b[e+"Proxy"])})},clearOffsetParent:function(){this.offsetParent=j},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=j},_destroy:function(){p[this.options.group]=
-j}};q.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==a.which||"touchstart"==a.type&&1==a.originalEvent.touches.length},searchValidTarget:function(a,b){var c=u(this.getItemDimensions(),a,b),e=c.length,d=this.rootGroup,f=!d.options.isValidTarget||d.options.isValidTarget(d.item,this);if(!e&&f)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(f)return this.movePlaceholder(d,a),!0},movePlaceholder:function(a,b){var c=d(this.items[a]),e=this.itemDimensions[a],h="after",f=c.outerWidth(),i=c.outerHeight(),g=c.offset(),g={left:g.left,right:g.left+f,top:g.top,bottom:g.top+i};this.options.vertical?b.top<=(e[2]+e[3])/2?(h="before",g.bottom-=i/2):g.top+=i/2:b.left<=(e[0]+e[1])/2?(h="before",g.right-=f/2):g.left+=f/2;this.hasChildGroup(a)&&(g=x);
-this.rootGroup.movePlaceholder(this,c,h,g)},getItemDimensions:function(){this.itemDimensions||(this.items=this.$getChildren(this.el,"item").filter(":not(.placeholder, .dragged)").get(),t(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===j){var c=this.$getChildren(this.items[a],"container"),b=!1;c[0]&&(b=d.extend({},this.options,{rootGroup:this.rootGroup,group:v++}),b=c[k](b).data(k).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,e,b)},traverse:function(a){d.each(this.items||[],function(){var b=d.data(this,"subContainers");b&&b.traverse(a)});a(this)},_clearDimensions:function(){this.itemDimensions=j},_destroy:function(){var a=this;this.target.off(o.start,this.handle);this.el.removeData(k);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 r={enable:function(){this.traverse(function(a){a.disabled=
-!1})},disable:function(){this.traverse(function(a){a.disabled=!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(q.prototype,r);d.fn[k]=function(a){var b=Array.prototype.slice.call(arguments,1);return this.map(function(){var c=d(this),e=c.data(k);if(e&&r[a])return r[a].apply(e,b)||this;!e&&(a===j||"object"===typeof a)&&c.data(k,new q(c,a));return this})}}(jQuery,
-window,"sortable");
+!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=
+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({},
+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,
+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)},
+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",
+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(),
+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=
+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+
+"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==
+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]),
+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+
+", ."+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],
+"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,
+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=
+!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");
diff --git a/source/js/jquery-sortable.js b/source/js/jquery-sortable.js
index 52c2432..69a1312 100644
--- a/source/js/jquery-sortable.js
+++ b/source/js/jquery-sortable.js
@@ -1,5 +1,5 @@
/* ===================================================
- * jquery-sortable.js v0.9.12
+ * jquery-sortable.js v0.9.13
* http://johnny.github.com/jquery-sortable/
* ===================================================
* Copyright (c) 2012 Jonas von Andrian
@@ -28,8 +28,7 @@
* ========================================================== */
!function ( $, window, pluginName, undefined){
- var eventNames,
- containerDefaults = {
+ var containerDefaults = {
// If true, items can be dragged from this container
drag: true,
// If true, items can be droped onto this container
@@ -88,19 +87,19 @@
$item.css(position)
},
// Called after the drag has been started,
- // that is the mouse button is beeing held down and
+ // that is the mouse button is being held down and
// the mouse is moving.
// The container is the closest initialized container.
// Therefore it might not be the container, that actually contains the item.
onDragStart: function ($item, container, _super, event) {
$item.css({
- height: $item.height(),
- width: $item.width()
+ height: $item.outerHeight(),
+ width: $item.outerWidth()
})
$item.addClass(container.group.options.draggedClass)
$("body").addClass(container.group.options.bodyClass)
},
- // Called when the mouse button is beeing released
+ // Called when the mouse button is being released
onDrop: function ($item, container, _super, event) {
$item.removeClass(container.group.options.draggedClass).removeAttr("style")
$("body").removeClass(container.group.options.bodyClass)
diff --git a/source/layouts/layout.haml b/source/layouts/layout.haml
index 4625f36..3911635 100644
--- a/source/layouts/layout.haml
+++ b/source/layouts/layout.haml
@@ -32,6 +32,8 @@
%a(href="#bootstrap") Sorting a bootstrap menu
%li
%a(href="#table") Sort tables
+ %li
+ %a(href="#external") External examples
%li
%a(href="#docs") Documentation
%li