Skip to content

Commit cb5a65b

Browse files
Jonas von AndrianJonas von Andrian
authored andcommitted
Update pages. See main branch for changes
1 parent a4380e5 commit cb5a65b

16 files changed

+240
-246
lines changed

index.html

Lines changed: 70 additions & 61 deletions
Large diffs are not rendered by default.

js/application.js

Lines changed: 76 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,8 +1112,7 @@ colors = jQuery.Color.names = {
11121112

11131113

11141114
!function ( $, window, pluginName, undefined){
1115-
var eventNames,
1116-
containerDefaults = {
1115+
var containerDefaults = {
11171116
// If true, items can be dragged from this container
11181117
drag: true,
11191118
// If true, items can be droped onto this container
@@ -1776,76 +1775,73 @@ colors = jQuery.Color.names = {
17761775

17771776
}(jQuery, window, 'sortable');
17781777
$(function () {
1779-
$("ol.example").sortable()
1780-
})
1781-
;
1778+
$("ol.example").sortable();
1779+
});
17821780
$(function () {
17831781
var group = $("ol.limited_drop_targets").sortable({
17841782
group: 'limited_drop_targets',
17851783
isValidTarget: function ($item, container) {
17861784
if($item.is(".highlight"))
1787-
return true
1788-
else {
1789-
return $item.parent("ol")[0] == container.el[0]
1790-
}
1785+
return true;
1786+
else
1787+
return $item.parent("ol")[0] == container.el[0];
17911788
},
17921789
onDrop: function ($item, container, _super) {
1793-
$('#serialize_output').text(group.sortable("serialize").get().join("\n"))
1794-
_super($item, container)
1790+
$('#serialize_output').text(
1791+
group.sortable("serialize").get().join("\n"));
1792+
_super($item, container);
17951793
},
17961794
serialize: function (parent, children, isContainer) {
1797-
return isContainer ? children.join() : parent.text()
1795+
return isContainer ? children.join() : parent.text();
17981796
},
17991797
tolerance: 6,
18001798
distance: 10
1801-
})
1802-
})
1803-
;
1799+
});
1800+
});
18041801
$(function () {
18051802
$("ol.nav").sortable({
18061803
group: 'nav',
18071804
nested: false,
18081805
vertical: false,
18091806
exclude: '.divider-vertical',
18101807
onDragStart: function($item, container, _super) {
1811-
$item.find('ol.dropdown-menu').sortable('disable')
1812-
_super($item, container)
1808+
$item.find('ol.dropdown-menu').sortable('disable');
1809+
_super($item, container);
18131810
},
18141811
onDrop: function($item, container, _super) {
1815-
$item.find('ol.dropdown-menu').sortable('enable')
1816-
_super($item, container)
1812+
$item.find('ol.dropdown-menu').sortable('enable');
1813+
_super($item, container);
18171814
}
1818-
})
1815+
});
1816+
18191817
$("ol.dropdown-menu").sortable({
18201818
group: 'nav'
1821-
})
1822-
})
1823-
;
1819+
});
1820+
});
18241821
$(function () {
1825-
var oldContainer
1822+
var oldContainer;
18261823
$("ol.nested_with_switch").sortable({
18271824
group: 'nested',
18281825
afterMove: function (placeholder, container) {
18291826
if(oldContainer != container){
18301827
if(oldContainer)
1831-
oldContainer.el.removeClass("active")
1832-
container.el.addClass("active")
1828+
oldContainer.el.removeClass("active");
1829+
container.el.addClass("active");
18331830

1834-
oldContainer = container
1831+
oldContainer = container;
18351832
}
18361833
},
18371834
onDrop: function ($item, container, _super) {
1838-
container.el.removeClass("active")
1839-
_super($item, container)
1835+
container.el.removeClass("active");
1836+
_super($item, container);
18401837
}
1841-
})
1838+
});
18421839

18431840
$(".switch-container").on("click", ".switch", function (e) {
1844-
var method = $(this).hasClass("active") ? "enable" : "disable"
1845-
$(e.delegateTarget).next().sortable(method)
1846-
})
1847-
})
1848-
;
1841+
var method = $(this).hasClass("active") ? "enable" : "disable";
1842+
$(e.delegateTarget).next().sortable(method);
1843+
});
1844+
});
18491845
$(function () {
18501846
var group = $("ol.serialization").sortable({
18511847
group: 'serialization',
@@ -1856,111 +1852,108 @@ $(function () {
18561852
var jsonString = JSON.stringify(data, null, ' ');
18571853

18581854
$('#serialize_output2').text(jsonString);
1859-
_super($item, container)
1855+
_super($item, container);
18601856
}
1861-
})
1862-
})
1863-
;
1857+
});
1858+
});
18641859
$(function () {
1865-
var adjustment
1860+
var adjustment;
18661861

18671862
$("ol.simple_with_animation").sortable({
18681863
group: 'simple_with_animation',
18691864
pullPlaceholder: false,
18701865
// animation on drop
18711866
onDrop: function ($item, container, _super) {
1872-
var $clonedItem = $('<li/>').css({height: 0})
1873-
$item.before($clonedItem)
1874-
$clonedItem.animate({'height': $item.height()})
1867+
var $clonedItem = $('<li/>').css({height: 0});
1868+
$item.before($clonedItem);
1869+
$clonedItem.animate({'height': $item.height()});
18751870

18761871
$item.animate($clonedItem.position(), function () {
1877-
$clonedItem.detach()
1878-
_super($item, container)
1879-
})
1872+
$clonedItem.detach();
1873+
_super($item, container);
1874+
});
18801875
},
18811876

18821877
// set $item relative to cursor position
18831878
onDragStart: function ($item, container, _super) {
18841879
var offset = $item.offset(),
1885-
pointer = container.rootGroup.pointer
1880+
pointer = container.rootGroup.pointer;
18861881

18871882
adjustment = {
18881883
left: pointer.left - offset.left,
18891884
top: pointer.top - offset.top
1890-
}
1885+
};
18911886

1892-
_super($item, container)
1887+
_super($item, container);
18931888
},
18941889
onDrag: function ($item, position) {
18951890
$item.css({
18961891
left: position.left - adjustment.left,
18971892
top: position.top - adjustment.top
1898-
})
1893+
});
18991894
}
1900-
})
1901-
})
1902-
;
1895+
});
1896+
});
19031897
$(function() {
19041898
$("ol.simple_with_drop").sortable({
19051899
group: 'no-drop',
19061900
handle: 'i.icon-move',
19071901
onDragStart: function ($item, container, _super) {
19081902
// Duplicate items of the no drop area
19091903
if(!container.options.drop)
1910-
$item.clone().insertAfter($item)
1911-
_super($item, container)
1904+
$item.clone().insertAfter($item);
1905+
_super($item, container);
19121906
}
1913-
})
1907+
});
19141908
$("ol.simple_with_no_drop").sortable({
19151909
group: 'no-drop',
19161910
drop: false
1917-
})
1911+
});
19181912
$("ol.simple_with_no_drag").sortable({
19191913
group: 'no-drop',
19201914
drag: false
1921-
})
1922-
})
1923-
;
1915+
});
1916+
});
19241917
$(function () {
19251918
// Sortable rows
19261919
$('.sorted_table').sortable({
19271920
containerSelector: 'table',
19281921
itemPath: '> tbody',
19291922
itemSelector: 'tr',
19301923
placeholder: '<tr class="placeholder"/>'
1931-
})
1924+
});
19321925

19331926
// Sortable column heads
1934-
var oldIndex
1927+
var oldIndex;
19351928
$('.sorted_head tr').sortable({
19361929
containerSelector: 'tr',
19371930
itemSelector: 'th',
19381931
placeholder: '<th class="placeholder"/>',
19391932
vertical: false,
19401933
onDragStart: function ($item, container, _super) {
1941-
oldIndex = $item.index()
1942-
$item.appendTo($item.parent())
1943-
_super($item, container)
1934+
oldIndex = $item.index();
1935+
$item.appendTo($item.parent());
1936+
_super($item, container);
19441937
},
19451938
onDrop: function ($item, container, _super) {
19461939
var field,
1947-
newIndex = $item.index()
1940+
newIndex = $item.index();
19481941

1949-
if(newIndex != oldIndex)
1942+
if(newIndex != oldIndex) {
19501943
$item.closest('table').find('tbody tr').each(function (i, row) {
1951-
row = $(row)
1952-
field = row.children().eq(oldIndex)
1953-
if(newIndex)
1954-
field.before(row.children()[newIndex])
1955-
else
1956-
row.prepend(field)
1957-
})
1944+
row = $(row);
1945+
if(newIndex < oldIndex) {
1946+
row.children().eq(newIndex).before(row.children()[oldIndex]);
1947+
} else if (newIndex > oldIndex) {
1948+
row.children().eq(newIndex).after(row.children()[oldIndex]);
1949+
}
1950+
});
1951+
}
19581952

1959-
_super($item, container)
1953+
_super($item, container);
19601954
}
1961-
})
1962-
})
1963-
;
1955+
});
1956+
});
19641957

19651958

19661959

@@ -1972,10 +1965,9 @@ $(function () {
19721965

19731966
$(function () {
19741967
if(!/test/.test(window.location.pathname))
1975-
$('body').scrollspy()
1968+
$('body').scrollspy();
19761969
$('.show-code').on('click', function () {
1977-
$(this).closest('.row').children('.example').slideToggle()
1978-
})
1979-
$('ol.default').sortable()
1980-
})
1981-
;
1970+
$(this).closest('.row').children('.example').slideToggle();
1971+
});
1972+
$('ol.default').sortable();
1973+
});

js/debug.js

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

js/examples/basic.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
$(function () {
2-
$("ol.example").sortable()
3-
})
4-
;
2+
$("ol.example").sortable();
3+
});

js/examples/limited_drop_targets.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@ $(function () {
33
group: 'limited_drop_targets',
44
isValidTarget: function ($item, container) {
55
if($item.is(".highlight"))
6-
return true
7-
else {
8-
return $item.parent("ol")[0] == container.el[0]
9-
}
6+
return true;
7+
else
8+
return $item.parent("ol")[0] == container.el[0];
109
},
1110
onDrop: function ($item, container, _super) {
12-
$('#serialize_output').text(group.sortable("serialize").get().join("\n"))
13-
_super($item, container)
11+
$('#serialize_output').text(
12+
group.sortable("serialize").get().join("\n"));
13+
_super($item, container);
1414
},
1515
serialize: function (parent, children, isContainer) {
16-
return isContainer ? children.join() : parent.text()
16+
return isContainer ? children.join() : parent.text();
1717
},
1818
tolerance: 6,
1919
distance: 10
20-
})
21-
})
22-
;
20+
});
21+
});

js/examples/nested_bootstrap.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ $(function () {
55
vertical: false,
66
exclude: '.divider-vertical',
77
onDragStart: function($item, container, _super) {
8-
$item.find('ol.dropdown-menu').sortable('disable')
9-
_super($item, container)
8+
$item.find('ol.dropdown-menu').sortable('disable');
9+
_super($item, container);
1010
},
1111
onDrop: function($item, container, _super) {
12-
$item.find('ol.dropdown-menu').sortable('enable')
13-
_super($item, container)
12+
$item.find('ol.dropdown-menu').sortable('enable');
13+
_super($item, container);
1414
}
15-
})
15+
});
16+
1617
$("ol.dropdown-menu").sortable({
1718
group: 'nav'
18-
})
19-
})
20-
;
19+
});
20+
});

0 commit comments

Comments
 (0)