Skip to content

Commit 5da17ea

Browse files
committed
Update pages. See main branch for changes
1 parent 5060ba4 commit 5da17ea

File tree

4 files changed

+97
-29
lines changed

4 files changed

+97
-29
lines changed

index.html

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,15 @@ <h1>jQuery Sortable</h1>
7878
<a class='btn btn-large btn-success' href='js/jquery-sortable.js'>
7979
<i class='icon-hdd icon-white'></i>
8080
Download
81+
(v0.9)
8182
</a>
8283
</p>
8384
<p>
8485
<small>
8586
Download
8687
<a href='js/jquery-sortable-min.js'>minified</a>
8788
version
89+
(7.0 kb)
8890
</small>
8991
</p>
9092
</div>
@@ -135,6 +137,22 @@ <h3>The opinionated part</h3>
135137
This way we can cache the item dimensions.
136138
<small>This might change in the future, if need be.</small>
137139
</p>
140+
<h3>Compatibility</h3>
141+
<p>
142+
<code>jquery-sortable.js</code>
143+
has been tested with the following browsers
144+
</p>
145+
<ul>
146+
<li>Firefox >= 3.5</li>
147+
<li>Chrome</li>
148+
<li>Konqueror</li>
149+
<li>IE > 7</li>
150+
</ul>
151+
<p>
152+
If you confirmed, that it works on other browsers please
153+
<a href='mailto:jvadev@gmail.com'>tell me</a>
154+
.
155+
</p>
138156
</div>
139157
<div class='span6'>
140158
<h3>
@@ -746,7 +764,49 @@ <h3>Sortable column heads</h3>
746764
<div class='page-header'>
747765
<h1>Documentation</h1>
748766
</div>
749-
<h2>Group options</h2>
767+
<h2>jQuery API</h2>
768+
<p>
769+
The
770+
<code>sortable()</code>
771+
method must be invoked on valid containers,
772+
meaning they must match the
773+
<code>containerSelector</code>
774+
option.
775+
</p>
776+
<div class='row'>
777+
<div class='span6'>
778+
<h3>
779+
<code>.sortable([options])</code>
780+
</h3>
781+
<p>
782+
Instantiate sortable on each matched element.
783+
The available options are divided into
784+
<a href='#group-options'>group options</a>
785+
and
786+
<a href='#container-options'>container options</a>
787+
.
788+
</p>
789+
<p>
790+
Group options are shared between all member containers and
791+
are set on the first instantiation of a member container.
792+
Subsequent instantiations of further containers in the same group do not change the group options.
793+
</p>
794+
<p>
795+
Container options can be set seperately for each member of a group.
796+
</p>
797+
</div>
798+
<div class='span6'>
799+
<h3>
800+
<code>.sortable("enable")</code>
801+
</h3>
802+
<p>Enable all instantiated sortables in the set of matched elements</p>
803+
<h3>
804+
<code>.sortable("disable")</code>
805+
</h3>
806+
<p>Disable all instantiated sortables in the set of matched elements</p>
807+
</div>
808+
</div>
809+
<h2 id='group-options'>Group options</h2>
750810
<table class='table table-striped table-bordered docs'>
751811
<thead>
752812
<tr>
@@ -862,7 +922,7 @@ <h2>Group options</h2>
862922
</tr>
863923
</tbody>
864924
</table>
865-
<h2>Container options</h2>
925+
<h2 id='container-options'>Container options</h2>
866926
<table class='table table-striped table-bordered docs'>
867927
<thead>
868928
<tr>

js/application.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,10 @@ colors = jQuery.Color.names = {
10811081
})
10821082

10831083
}(window.jQuery);
1084-
/**
1084+
/* ===================================================
1085+
* jquery-sortable.js v0.9
1086+
* http://johnny.github.com/jquery-sortable/
1087+
* ===================================================
10851088
* Copyright (c) 2012 Jonas von Andrian
10861089
* All rights reserved.
10871090
*
@@ -1105,8 +1108,8 @@ colors = jQuery.Color.names = {
11051108
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11061109
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
11071110
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1108-
*
1109-
*/
1111+
* ========================================================== */
1112+
11101113

11111114
!function ( $, window, undefined){
11121115
var pluginName = 'sortable',
@@ -1429,7 +1432,7 @@ colors = jQuery.Color.names = {
14291432

14301433
Container.prototype = {
14311434
dragInit: function (e) {
1432-
if(e.button !== 0 ||
1435+
if(e.which !== 1 ||
14331436
!this.options.drag ||
14341437
$(e.target).is(this.options.exclude))
14351438
return;
@@ -1567,10 +1570,11 @@ colors = jQuery.Color.names = {
15671570
return this.each(function(){
15681571
var $t = $(this),
15691572
object = $t.data(pluginName)
1570-
if(!object)
1571-
$t.data(pluginName, new Container($t, methodOrOptions))
1572-
else if (API[methodOrOptions])
1573+
if(object && API[methodOrOptions])
15731574
API[methodOrOptions].apply(object, args)
1575+
else if(!object && (methodOrOptions === undefined ||
1576+
typeof methodOrOptions === "object"))
1577+
$t.data(pluginName, new Container($t, methodOrOptions))
15741578
});
15751579
};
15761580

@@ -1702,6 +1706,6 @@ $(function () {
17021706
$('.show-code').on('click', function () {
17031707
$(this).closest('.row').children('.example').slideToggle()
17041708
})
1705-
$('.default').sortable()
1709+
$('ol.default').sortable()
17061710
})
17071711
;

js/jquery-sortable-min.js

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/jquery-sortable.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
/**
1+
/* ===================================================
2+
* jquery-sortable.js v0.9
3+
* http://johnny.github.com/jquery-sortable/
4+
* ===================================================
25
* Copyright (c) 2012 Jonas von Andrian
36
* All rights reserved.
47
*
@@ -22,8 +25,8 @@
2225
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2326
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2427
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25-
*
26-
*/
28+
* ========================================================== */
29+
2730

2831
!function ( $, window, undefined){
2932
var pluginName = 'sortable',
@@ -346,7 +349,7 @@
346349

347350
Container.prototype = {
348351
dragInit: function (e) {
349-
if(e.button !== 0 ||
352+
if(e.which !== 1 ||
350353
!this.options.drag ||
351354
$(e.target).is(this.options.exclude))
352355
return;
@@ -484,10 +487,11 @@
484487
return this.each(function(){
485488
var $t = $(this),
486489
object = $t.data(pluginName)
487-
if(!object)
488-
$t.data(pluginName, new Container($t, methodOrOptions))
489-
else if (API[methodOrOptions])
490+
if(object && API[methodOrOptions])
490491
API[methodOrOptions].apply(object, args)
492+
else if(!object && (methodOrOptions === undefined ||
493+
typeof methodOrOptions === "object"))
494+
$t.data(pluginName, new Container($t, methodOrOptions))
491495
});
492496
};
493497

0 commit comments

Comments
 (0)