").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Jc=a.document.documentElement;function Kc(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Kc(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Jc;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Jc})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Kc(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=yb(k.pixelPosition,function(a,c){return c?(c=xb(a,b),vb.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Lc=a.jQuery,Mc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Mc),b&&a.jQuery===n&&(a.jQuery=Lc),n},typeof b===U&&(a.jQuery=a.$=n),n});
From 797cc50c96a91902c39c7d786061ec3e283cf37e Mon Sep 17 00:00:00 2001
From: Jonas von Andrian
Date: Mon, 17 Nov 2014 17:31:49 +0100
Subject: [PATCH 43/56] add docs on how to nest properly
closes #126
---
source/js/jquery-sortable.js | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/source/js/jquery-sortable.js b/source/js/jquery-sortable.js
index 66ca77e..7e1bf21 100644
--- a/source/js/jquery-sortable.js
+++ b/source/js/jquery-sortable.js
@@ -37,7 +37,9 @@
// Exclude items from being draggable, if the
// selector matches the item
exclude: "",
- // If true, search for nested containers within an item
+ // If true, search for nested containers within an item.If you nest containers,
+ // either the original selector with which you call the plugin must only match the top containers,
+ // or you need to specify a group (see the bootstrap nav example)
nested: true,
// If true, the items are assumed to be arranged vertically
vertical: true
@@ -70,8 +72,6 @@
bodyClass: "dragging",
// The class giving to an item while being dragged
draggedClass: "dragged",
- // The class of the placeholder (must match placeholder option markup)
- placeholderClass: "placeholder",
// Check if the dragged item may be inside the container.
// Use with care, since the search for a valid container entails a depth first search
// and may be quite expensive.
@@ -113,6 +113,8 @@
return true
}
},
+ // The class of the placeholder (must match placeholder option markup)
+ placeholderClass: "placeholder",
// Template for the placeholder. Can be any valid jQuery input
// e.g. a string, a DOM element.
// The placeholder must have the class "placeholder"
From d261b1f06d75a11dcfcba32dadfeeccb0b598dc8 Mon Sep 17 00:00:00 2001
From: Dan Dascalescu
Date: Mon, 17 Nov 2014 09:26:13 -0800
Subject: [PATCH 44/56] Update two projects maintained by new developers, add
RubaXa
All in alphabetical order.
---
source/index.html.haml | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/source/index.html.haml b/source/index.html.haml
index 56c89a5..e60a99f 100644
--- a/source/index.html.haml
+++ b/source/index.html.haml
@@ -224,16 +224,19 @@
%p Listed in alphabetical order
%ul
%li
- %a(href="http://farhadi.ir/projects/html5sortable/") HTML5 Sortable
- (uses native dnd events)
+ %a(href="https://github.com/voidberg/html5sortable") HTML5 Sortable
+ (uses native dnd events, supports IE5.5+, ~180 GitHub stars)
%li
%a(href="http://jqueryui.com/demos/sortable/") jQuery UI sortable
%li
%a(href="http://dbushell.github.com/Nestable/") Nestable
- (requires no jQuery UI)
+ (requires no jQuery UI, ~1200 GitHub stars)
%li
- %a(href="http://mjsarfatti.com/sandbox/nestedSortable/") nestedSortable
- (an extension of jQuery UI)
+ %a(href="https://github.com/ilikenwf/nestedSortable") nestedSortable
+ (an extension of jQuery UI, ~75 GitHub stars)
+ %li
+ %a(href="https://github.com/RubaXa/Sortable") RubaXa's Sortable
+ (supports touch devices and AngularJS, ~800 GitHub stars)
%li
%a(href="http://yuilibrary.com/yui/docs/sortable/") YUI sortable
From d663be2f70dca2f9b280156b0f5ed0f3ccfb07d7 Mon Sep 17 00:00:00 2001
From: Dan Dascalescu
Date: Mon, 17 Nov 2014 11:23:56 -0800
Subject: [PATCH 45/56] Remove number of stars
Not that this file is update more than once every few months now...
---
source/index.html.haml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/source/index.html.haml b/source/index.html.haml
index e60a99f..8fe8668 100644
--- a/source/index.html.haml
+++ b/source/index.html.haml
@@ -225,18 +225,18 @@
%ul
%li
%a(href="https://github.com/voidberg/html5sortable") HTML5 Sortable
- (uses native dnd events, supports IE5.5+, ~180 GitHub stars)
+ (uses native dnd events, supports IE5.5+)
%li
%a(href="http://jqueryui.com/demos/sortable/") jQuery UI sortable
%li
%a(href="http://dbushell.github.com/Nestable/") Nestable
- (requires no jQuery UI, ~1200 GitHub stars)
+ (requires no jQuery UI)
%li
%a(href="https://github.com/ilikenwf/nestedSortable") nestedSortable
- (an extension of jQuery UI, ~75 GitHub stars)
+ (an extension of jQuery UI)
%li
%a(href="https://github.com/RubaXa/Sortable") RubaXa's Sortable
- (supports touch devices and AngularJS, ~800 GitHub stars)
+ (supports touch devices and AngularJS)
%li
%a(href="http://yuilibrary.com/yui/docs/sortable/") YUI sortable
From 01c7a012297a710cb4e54d0d8e017414bdaa1502 Mon Sep 17 00:00:00 2001
From: Michael McLaughlin
Date: Sat, 22 Nov 2014 12:36:17 -0600
Subject: [PATCH 46/56] issue #148 made a check to make sure the clicked on
element was actually there
---
source/js/jquery-sortable.js | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/source/js/jquery-sortable.js b/source/js/jquery-sortable.js
index 7e1bf21..52c2432 100644
--- a/source/js/jquery-sortable.js
+++ b/source/js/jquery-sortable.js
@@ -247,19 +247,20 @@
this.$document = $(itemContainer.el[0].ownerDocument)
// get item to drag
- this.item = $(e.target).closest(this.options.itemSelector)
- this.itemContainer = itemContainer
-
- if(this.item.is(this.options.exclude) ||
- !this.options.onMousedown(this.item, groupDefaults.onMousedown, e)){
- return
+ var closestItem = $(e.target).closest(this.options.itemSelector);
+ // using the length of this item, prevents the plugin from being started if there is no handle being clicked on.
+ // this may also be helpful in instantiating multidrag.
+ if (closestItem.length) {
+ this.item = closestItem;
+ this.itemContainer = itemContainer;
+ if (this.item.is(this.options.exclude) || !this.options.onMousedown(this.item, groupDefaults.onMousedown, e)) {
+ return;
+ }
+ this.setPointer(e);
+ this.toggleListeners('on');
+ this.setupDelayTimer();
+ this.dragInitDone = true;
}
-
- this.setPointer(e)
- this.toggleListeners('on')
-
- this.setupDelayTimer()
- this.dragInitDone = true
},
drag: function (e) {
if(!this.dragging){
From e14fc1ce115e62b6a8d542297eeaf8964cb23c91 Mon Sep 17 00:00:00 2001
From: Patrick Gunderson
Date: Wed, 17 Dec 2014 14:00:09 -0800
Subject: [PATCH 47/56] added package.json file
---
package.json | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
create mode 100644 package.json
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..112c664
--- /dev/null
+++ b/package.json
@@ -0,0 +1,28 @@
+{
+ "name": "jquery-sortable",
+ "version": "0.9.12",
+ "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": "MIT",
+ "bugs": {
+ "url": "https://github.com/johnny/jquery-sortable/issues"
+ },
+ "homepage": "https://github.com/johnny/jquery-sortable"
+}
From 041ea7042240e005adcaed9eb9086d90be4973b9 Mon Sep 17 00:00:00 2001
From: Patrick Gunderson
Date: Wed, 17 Dec 2014 14:03:09 -0800
Subject: [PATCH 48/56] updated license
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 112c664..ebed673 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,7 @@
"author": [
"Jonas von Andrian"
],
- "license": "MIT",
+ "license": "BSD-3",
"bugs": {
"url": "https://github.com/johnny/jquery-sortable/issues"
},
From 40cd853474112d66bb88887213721871c090eb5e Mon Sep 17 00:00:00 2001
From: Patrick Gunderson
Date: Wed, 17 Dec 2014 14:07:08 -0800
Subject: [PATCH 49/56] added node_modules to ignore, added jquery as a
dependency
---
.gitignore | 1 +
package.json | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)
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/package.json b/package.json
index ebed673..46152fc 100644
--- a/package.json
+++ b/package.json
@@ -24,5 +24,8 @@
"bugs": {
"url": "https://github.com/johnny/jquery-sortable/issues"
},
- "homepage": "https://github.com/johnny/jquery-sortable"
+ "homepage": "https://github.com/johnny/jquery-sortable",
+ "dependencies": {
+ "jquery": "^2.1.2"
+ }
}
From cc0039f6c9069f866ee2a48972aff1dd76797a3e Mon Sep 17 00:00:00 2001
From: Simon Harriyott
Date: Fri, 1 May 2015 15:44:04 +0100
Subject: [PATCH 50/56] Fixed typo: beeing => being.
---
source/js/jquery-sortable.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source/js/jquery-sortable.js b/source/js/jquery-sortable.js
index 52c2432..db5edb2 100644
--- a/source/js/jquery-sortable.js
+++ b/source/js/jquery-sortable.js
@@ -88,7 +88,7 @@
$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.
@@ -100,7 +100,7 @@
$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)
From 52929d2f86668c71fa8a889da5dc3e726bef55ee Mon Sep 17 00:00:00 2001
From: Jared Mellentine
Date: Thu, 18 Jun 2015 17:18:13 -0700
Subject: [PATCH 51/56] Use outerHeight/outerWidth on dragged items
Padded/bordered items that were dragged and sized using height/width were incorrectly sized.
---
source/js/jquery-sortable.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source/js/jquery-sortable.js b/source/js/jquery-sortable.js
index 52c2432..5914b97 100644
--- a/source/js/jquery-sortable.js
+++ b/source/js/jquery-sortable.js
@@ -94,8 +94,8 @@
// 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)
From f8627f15213636f15bf6a9b8e23bad46adacbfdc Mon Sep 17 00:00:00 2001
From: Jonas von Andrian
Date: Sat, 27 Jun 2015 16:54:24 +0200
Subject: [PATCH 52/56] Update package files
---
Gemfile.lock | 116 ++++++++++++++++++++++++++++-----------------------
bower.json | 2 +-
config.rb | 15 ++++---
3 files changed, 75 insertions(+), 58 deletions(-)
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/bower.json b/bower.json
index 7da7175..b11f822 100644
--- a/bower.json
+++ b/bower.json
@@ -16,7 +16,7 @@
"drag",
"dragging"
],
- "license": "MIT",
+ "license": "BSD-3",
"ignore": [
"**/.*",
"node_modules",
diff --git a/config.rb b/config.rb
index cd47f4e..e9baeec 100644
--- a/config.rb
+++ b/config.rb
@@ -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
From 74a710047e4947decd3f3a6ca14bee92429b0b51 Mon Sep 17 00:00:00 2001
From: Jonas von Andrian
Date: Sat, 27 Jun 2015 17:01:30 +0200
Subject: [PATCH 53/56] Release 0.9.13
---
VERSION | 2 +-
bower.json | 2 +-
package.json | 2 +-
sortable.jquery.json | 4 ++--
source/js/jquery-sortable-min.js | 38 ++++++++++++++++----------------
source/js/jquery-sortable.js | 2 +-
6 files changed, 25 insertions(+), 25 deletions(-)
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 b11f822..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"
diff --git a/package.json b/package.json
index 46152fc..d9435dd 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jquery-sortable",
- "version": "0.9.12",
+ "version": "0.9.13",
"description": "jquery plugin for sortable, nestable lists",
"main": "./source/js/jquery-sortable.js",
"scripts": {
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/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 6a7ba28..5e93508 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
From 0f9f239b693d9aeb3dd0bb75a31e3b7a220f419a Mon Sep 17 00:00:00 2001
From: Jonas von Andrian
Date: Sat, 27 Jun 2015 17:22:04 +0200
Subject: [PATCH 54/56] update examples and changelog
closes #173
---
CHANGELOG | 47 ++++++++++++---------
config.rb | 2 +-
source/_table.html.haml | 2 +
source/js/application.js | 10 ++---
source/js/debug.js | 4 +-
source/js/examples/basic.js | 4 +-
source/js/examples/limited_drop_targets.js | 18 ++++----
source/js/examples/nested_bootstrap.js | 15 ++++---
source/js/examples/nested_with_switch.js | 22 +++++-----
source/js/examples/serialization.js | 6 +--
source/js/examples/simple_with_animation.js | 26 ++++++------
source/js/examples/simple_with_no_drop.js | 12 +++---
source/js/examples/table.js | 35 +++++++--------
source/js/jquery-sortable.js | 3 +-
14 files changed, 109 insertions(+), 97 deletions(-)
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/config.rb b/config.rb
index e9baeec..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,
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/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.js b/source/js/jquery-sortable.js
index 5e93508..69a1312 100644
--- a/source/js/jquery-sortable.js
+++ b/source/js/jquery-sortable.js
@@ -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
From 35f4ffaf5802ebf61202279cbab5037edf2af82a Mon Sep 17 00:00:00 2001
From: Jonas von Andrian
Date: Sat, 27 Jun 2015 18:02:29 +0200
Subject: [PATCH 55/56] create example section with external examples
---
source/index.html.haml | 7 +++++++
source/layouts/layout.haml | 2 ++
2 files changed, 9 insertions(+)
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/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
From d3b90d611bc6635636cb9ea47cfafdc9f3ee4b14 Mon Sep 17 00:00:00 2001
From: Andreas Lemke
Date: Wed, 6 Jun 2018 09:07:54 +0200
Subject: [PATCH 56/56] add jquery ^3.0.0 to dependencies
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index d9435dd..39166ca 100644
--- a/package.json
+++ b/package.json
@@ -26,6 +26,6 @@
},
"homepage": "https://github.com/johnny/jquery-sortable",
"dependencies": {
- "jquery": "^2.1.2"
+ "jquery": "^2.1.2 || ^3.0.0"
}
}