uikit-sass-rails 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +15 -12
  4. data/lib/uikit/sass/rails/engine.rb +1 -1
  5. data/lib/uikit/sass/rails/version.rb +1 -1
  6. data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
  7. data/vendor/assets/fonts/fontawesome-webfont.otf +0 -0
  8. data/vendor/assets/fonts/fontawesome-webfont.svg +525 -464
  9. data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
  10. data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
  11. data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
  12. data/vendor/assets/javascripts/uikit.js +30 -3
  13. data/vendor/assets/javascripts/uikit/components/accordion.js +172 -0
  14. data/vendor/assets/javascripts/uikit/components/autocomplete.js +48 -27
  15. data/vendor/assets/javascripts/uikit/components/datepicker.js +2887 -97
  16. data/vendor/assets/javascripts/uikit/components/form-password.js +24 -19
  17. data/vendor/assets/javascripts/uikit/components/form-select.js +24 -18
  18. data/vendor/assets/javascripts/uikit/components/grid.js +524 -0
  19. data/vendor/assets/javascripts/uikit/components/htmleditor.js +46 -39
  20. data/vendor/assets/javascripts/uikit/components/lightbox.js +543 -0
  21. data/vendor/assets/javascripts/uikit/components/nestable.js +125 -98
  22. data/vendor/assets/javascripts/uikit/components/notify.js +34 -22
  23. data/vendor/assets/javascripts/uikit/components/pagination.js +24 -21
  24. data/vendor/assets/javascripts/uikit/components/parallax.js +400 -0
  25. data/vendor/assets/javascripts/uikit/components/search.js +19 -16
  26. data/vendor/assets/javascripts/uikit/components/slider.js +482 -0
  27. data/vendor/assets/javascripts/uikit/components/slideset.js +498 -0
  28. data/vendor/assets/javascripts/uikit/components/slideshow-fx.js +377 -0
  29. data/vendor/assets/javascripts/uikit/components/slideshow.js +540 -0
  30. data/vendor/assets/javascripts/uikit/components/sortable.js +392 -263
  31. data/vendor/assets/javascripts/uikit/components/sticky.js +127 -68
  32. data/vendor/assets/javascripts/uikit/components/timepicker.js +65 -42
  33. data/vendor/assets/javascripts/uikit/components/tooltip.js +220 -0
  34. data/vendor/assets/javascripts/uikit/components/upload.js +11 -10
  35. data/vendor/assets/javascripts/uikit/core/alert.js +66 -0
  36. data/vendor/assets/javascripts/uikit/core/button.js +154 -0
  37. data/vendor/assets/javascripts/uikit/core/core.js +717 -0
  38. data/vendor/assets/javascripts/uikit/{components → core}/cover.js +41 -35
  39. data/vendor/assets/javascripts/uikit/core/dropdown.js +296 -0
  40. data/vendor/assets/javascripts/uikit/core/grid.js +172 -0
  41. data/vendor/assets/javascripts/uikit/core/modal.js +323 -0
  42. data/vendor/assets/javascripts/uikit/core/nav.js +117 -0
  43. data/vendor/assets/javascripts/uikit/core/offcanvas.js +178 -0
  44. data/vendor/assets/javascripts/uikit/core/scrollspy.js +208 -0
  45. data/vendor/assets/javascripts/uikit/core/smooth-scroll.js +62 -0
  46. data/vendor/assets/javascripts/uikit/core/switcher.js +298 -0
  47. data/vendor/assets/javascripts/uikit/core/tab.js +159 -0
  48. data/vendor/assets/javascripts/uikit/core/toggle.js +117 -0
  49. data/vendor/assets/javascripts/uikit/core/touch.js +173 -0
  50. data/vendor/assets/javascripts/uikit/core/utility.js +157 -0
  51. data/vendor/assets/javascripts/uikit/uikit.js +1538 -871
  52. data/vendor/assets/stylesheets/extra/font-awesome.scss +4 -7
  53. data/vendor/assets/stylesheets/uikit.scss +22 -1
  54. data/vendor/assets/stylesheets/uikit/almost-flat.scss +22 -2
  55. data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.scss +45 -0
  56. data/vendor/assets/stylesheets/uikit/components/accordion.gradient.scss +45 -0
  57. data/vendor/assets/stylesheets/uikit/components/accordion.scss +43 -0
  58. data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.scss +62 -0
  59. data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.scss +62 -0
  60. data/vendor/assets/stylesheets/uikit/components/autocomplete.scss +60 -0
  61. data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.scss +148 -0
  62. data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.scss +158 -0
  63. data/vendor/assets/stylesheets/uikit/components/datepicker.scss +142 -0
  64. data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.scss +152 -0
  65. data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.scss +152 -0
  66. data/vendor/assets/stylesheets/uikit/components/dotnav.scss +148 -0
  67. data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.scss +92 -0
  68. data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.scss +92 -0
  69. data/vendor/assets/stylesheets/uikit/components/form-advanced.scss +92 -0
  70. data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.scss +36 -0
  71. data/vendor/assets/stylesheets/uikit/components/form-file.gradient.scss +36 -0
  72. data/vendor/assets/stylesheets/uikit/components/form-file.scss +36 -0
  73. data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.scss +37 -0
  74. data/vendor/assets/stylesheets/uikit/components/form-password.gradient.scss +37 -0
  75. data/vendor/assets/stylesheets/uikit/components/form-password.scss +37 -0
  76. data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.scss +37 -0
  77. data/vendor/assets/stylesheets/uikit/components/form-select.gradient.scss +37 -0
  78. data/vendor/assets/stylesheets/uikit/components/form-select.scss +37 -0
  79. data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.scss +282 -0
  80. data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.scss +290 -0
  81. data/vendor/assets/stylesheets/uikit/components/htmleditor.scss +208 -0
  82. data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.scss +137 -0
  83. data/vendor/assets/stylesheets/uikit/components/nestable.gradient.scss +141 -0
  84. data/vendor/assets/stylesheets/uikit/components/nestable.scss +134 -0
  85. data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.scss +112 -0
  86. data/vendor/assets/stylesheets/uikit/components/notify.gradient.scss +112 -0
  87. data/vendor/assets/stylesheets/uikit/components/notify.scss +106 -0
  88. data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.scss +36 -0
  89. data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.scss +36 -0
  90. data/vendor/assets/stylesheets/uikit/components/placeholder.scss +36 -0
  91. data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.scss +130 -0
  92. data/vendor/assets/stylesheets/uikit/components/progress.gradient.scss +138 -0
  93. data/vendor/assets/stylesheets/uikit/components/progress.scss +118 -0
  94. data/vendor/assets/stylesheets/uikit/components/search.almost-flat.scss +216 -0
  95. data/vendor/assets/stylesheets/uikit/components/search.gradient.scss +216 -0
  96. data/vendor/assets/stylesheets/uikit/components/search.scss +214 -0
  97. data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.scss +110 -0
  98. data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.scss +110 -0
  99. data/vendor/assets/stylesheets/uikit/components/slidenav.scss +110 -0
  100. data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.scss +105 -0
  101. data/vendor/assets/stylesheets/uikit/components/slider.gradient.scss +105 -0
  102. data/vendor/assets/stylesheets/uikit/components/slider.scss +105 -0
  103. data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.scss +166 -0
  104. data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.scss +166 -0
  105. data/vendor/assets/stylesheets/uikit/components/slideshow.scss +166 -0
  106. data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.scss +90 -0
  107. data/vendor/assets/stylesheets/uikit/components/sortable.gradient.scss +90 -0
  108. data/vendor/assets/stylesheets/uikit/components/sortable.scss +90 -0
  109. data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.scss +39 -0
  110. data/vendor/assets/stylesheets/uikit/components/sticky.gradient.scss +39 -0
  111. data/vendor/assets/stylesheets/uikit/components/sticky.scss +39 -0
  112. data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.scss +129 -0
  113. data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.scss +129 -0
  114. data/vendor/assets/stylesheets/uikit/components/tooltip.scss +127 -0
  115. data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.scss +11 -0
  116. data/vendor/assets/stylesheets/uikit/components/upload.gradient.scss +11 -0
  117. data/vendor/assets/stylesheets/uikit/components/upload.scss +11 -0
  118. data/vendor/assets/stylesheets/uikit/gradient.scss +22 -2
  119. data/vendor/assets/stylesheets/uikit/uikit.almost-flat.scss +1768 -498
  120. data/vendor/assets/stylesheets/uikit/uikit.gradient.scss +1776 -512
  121. data/vendor/assets/stylesheets/uikit/uikit.scss +1722 -462
  122. metadata +92 -7
  123. data/vendor/assets/stylesheets/uikit/components/uikit.components.almost-flat.scss +0 -1586
  124. data/vendor/assets/stylesheets/uikit/components/uikit.components.gradient.scss +0 -1608
  125. data/vendor/assets/stylesheets/uikit/components/uikit.components.scss +0 -1489
@@ -1,28 +1,30 @@
1
- /*! UIkit 2.11.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
1
+ /*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
2
  /*
3
3
  * Based on Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
4
4
  */
5
- (function(addon) {
5
+ (function(addon) {
6
6
 
7
- var component;
7
+ var component;
8
8
 
9
- if (jQuery && jQuery.UIkit) {
10
- component = addon(jQuery, jQuery.UIkit);
11
- }
9
+ if (window.UIkit) {
10
+ component = addon(UIkit);
11
+ }
12
12
 
13
- if (typeof define == "function" && define.amd) {
14
- define("uikit-nestable", ["uikit"], function(){
15
- return component || addon(jQuery, jQuery.UIkit);
16
- });
17
- }
13
+ if (typeof define == "function" && define.amd) {
14
+ define("uikit-nestable", ["uikit"], function(){
15
+ return component || addon(UIkit);
16
+ });
17
+ }
18
+
19
+ })(function(UI) {
18
20
 
19
- })(function($, UI) {
21
+ "use strict";
20
22
 
21
23
  var hasTouch = 'ontouchstart' in window,
22
- html = $("html"),
24
+ html = UI.$html,
23
25
  touchedlists = [],
24
26
  $win = UI.$win,
25
- draggingElement;
27
+ draggingElement, dragSource;
26
28
 
27
29
  /**
28
30
  * Detect CSS pointer-events property
@@ -31,7 +33,7 @@
31
33
  */
32
34
  var hasPointerEvents = (function() {
33
35
 
34
- var el = document.createElement('div'), docEl = document.documentElement;
36
+ var el = document.createElement('div'), docEl = document.documentElement;
35
37
 
36
38
  if (!('pointerEvents' in el.style)) {
37
39
  return false;
@@ -58,27 +60,59 @@
58
60
  UI.component('nestable', {
59
61
 
60
62
  defaults: {
61
- prefix : 'uk',
63
+ prefix : 'uk-',
62
64
  listNodeName : 'ul',
63
65
  itemNodeName : 'li',
64
- listBaseClass : '{prefix}-nestable',
65
- listClass : '{prefix}-nestable-list',
66
- listitemClass : '{prefix}-nestable-list-item',
67
- itemClass : '{prefix}-nestable-item',
68
- dragClass : '{prefix}-nestable-list-dragged',
69
- movingClass : '{prefix}-nestable-moving',
70
- handleClass : '{prefix}-nestable-handle',
71
- collapsedClass : '{prefix}-collapsed',
72
- placeClass : '{prefix}-nestable-placeholder',
73
- noDragClass : '{prefix}-nestable-nodrag',
74
- emptyClass : '{prefix}-nestable-empty',
66
+ listBaseClass : '{prefix}nestable',
67
+ listClass : '{prefix}nestable-list',
68
+ listitemClass : '{prefix}nestable-list-item',
69
+ itemClass : '{prefix}nestable-item',
70
+ dragClass : '{prefix}nestable-list-dragged',
71
+ movingClass : '{prefix}nestable-moving',
72
+ handleClass : '{prefix}nestable-handle',
73
+ collapsedClass : '{prefix}collapsed',
74
+ placeClass : '{prefix}nestable-placeholder',
75
+ noDragClass : '{prefix}nestable-nodrag',
76
+ emptyClass : '{prefix}nestable-empty',
75
77
  group : 0,
76
78
  maxDepth : 10,
77
79
  threshold : 20
78
80
  },
79
81
 
80
- init: function()
81
- {
82
+ boot: function() {
83
+
84
+ // adjust document scrolling
85
+ UI.$html.on('mousemove touchmove', function(e) {
86
+
87
+ if (draggingElement) {
88
+
89
+
90
+ var top = draggingElement.offset().top;
91
+
92
+ if (top < UI.$win.scrollTop()) {
93
+ UI.$win.scrollTop(UI.$win.scrollTop() - Math.ceil(draggingElement.height()/2));
94
+ } else if ( (top + draggingElement.height()) > (window.innerHeight + UI.$win.scrollTop()) ) {
95
+ UI.$win.scrollTop(UI.$win.scrollTop() + Math.ceil(draggingElement.height()/2));
96
+ }
97
+ }
98
+ });
99
+
100
+ // init code
101
+ UI.ready(function(context) {
102
+
103
+ UI.$("[data-uk-nestable]", context).each(function(){
104
+
105
+ var ele = UI.$(this);
106
+
107
+ if(!ele.data("nestable")) {
108
+ var plugin = UI.nestable(ele, UI.Utils.options(ele.attr("data-uk-nestable")));
109
+ }
110
+ });
111
+ });
112
+ },
113
+
114
+ init: function() {
115
+
82
116
  var $this = this;
83
117
 
84
118
  Object.keys(this.options).forEach(function(key){
@@ -102,10 +136,10 @@
102
136
  this.element.data("nestable-id", "ID"+(new Date().getTime())+"RAND"+(Math.ceil(Math.random() *100000)));
103
137
  this.reset();
104
138
  this.element.data('nestable-group', this.options.group);
105
- this.placeEl = $('<div class="' + this.options.placeClass + '"/>');
139
+ this.placeEl = UI.$('<div class="' + this.options.placeClass + '"/>');
106
140
 
107
141
  this.find(this.options.itemNodeName).each(function() {
108
- $this.setParent($(this));
142
+ $this.setParent(UI.$(this));
109
143
  });
110
144
 
111
145
  this.on('click', '[data-nestable-action]', function(e) {
@@ -116,7 +150,7 @@
116
150
 
117
151
  e.preventDefault();
118
152
 
119
- var target = $(e.currentTarget),
153
+ var target = UI.$(e.currentTarget),
120
154
  action = target.data('nestableAction'),
121
155
  item = target.closest($this.options.itemNodeName);
122
156
  if (action === 'collapse') {
@@ -132,7 +166,7 @@
132
166
 
133
167
  var onStartEvent = function(e) {
134
168
 
135
- var handle = $(e.target);
169
+ var handle = UI.$(e.target);
136
170
 
137
171
  if (!handle.hasClass($this.options.handleClass)) {
138
172
  if (handle.closest('.' + $this.options.noDragClass).length) {
@@ -145,14 +179,14 @@
145
179
  }
146
180
  e.preventDefault();
147
181
  $this.dragStart(hasTouch ? e.touches[0] : e);
148
- $this.trigger('uk.nestable.start', [$this]);
182
+ $this.trigger('start.uk.nestable', [$this]);
149
183
  };
150
184
 
151
185
  var onMoveEvent = function(e) {
152
186
  if ($this.dragEl) {
153
187
  e.preventDefault();
154
188
  $this.dragMove(hasTouch ? e.touches[0] : e);
155
- $this.trigger('uk.nestable.move', [$this]);
189
+ $this.trigger('move.uk.nestable', [$this]);
156
190
  }
157
191
  };
158
192
 
@@ -160,7 +194,6 @@
160
194
  if ($this.dragEl) {
161
195
  e.preventDefault();
162
196
  $this.dragStop(hasTouch ? e.touches[0] : e);
163
- $this.trigger('uk.nestable.stop', [$this]);
164
197
  }
165
198
 
166
199
  draggingElement = false;
@@ -183,21 +216,30 @@
183
216
 
184
217
  var data,
185
218
  depth = 0,
186
- list = this;
219
+ list = this,
187
220
  step = function(level, depth) {
188
221
 
189
222
  var array = [ ], items = level.children(list.options.itemNodeName);
190
223
 
191
224
  items.each(function() {
192
225
 
193
- var li = $(this),
194
- item = $.extend({}, li.data()),
195
- sub = li.children(list.options.listNodeName);
226
+ var li = UI.$(this),
227
+ item = {}, attribute,
228
+ sub = li.children(list.options.listNodeName);
229
+
230
+ for (var i = 0; i < li[0].attributes.length; i++) {
231
+ attribute = li[0].attributes[i];
232
+ if (attribute.name.indexOf('data-') === 0) {
233
+ item[attribute.name.substr(5)] = UI.Utils.str2json(attribute.value);
234
+ }
235
+ }
196
236
 
197
237
  if (sub.length) {
198
238
  item.children = step(sub, depth + 1);
199
239
  }
240
+
200
241
  array.push(item);
242
+
201
243
  });
202
244
  return array;
203
245
  };
@@ -209,18 +251,17 @@
209
251
 
210
252
  list: function(options) {
211
253
 
212
- var data = [],
213
- list = this,
254
+ var data = [],
255
+ list = this,
214
256
  depth = 0,
215
- options = $.extend({}, list.options, options),
216
- step = function(level, depth, parent) {
257
+ step = function(level, depth, parent) {
217
258
 
218
259
  var items = level.children(options.itemNodeName);
219
260
 
220
261
  items.each(function(index) {
221
- var li = $(this),
222
- item = $.extend({parent_id: (parent ? parent : null), depth: depth, order: index}, li.data()),
223
- sub = li.children(options.listNodeName);
262
+ var li = UI.$(this),
263
+ item = UI.$.extend({parent_id: (parent ? parent : null), depth: depth, order: index}, li.data()),
264
+ sub = li.children(options.listNodeName);
224
265
 
225
266
  data.push(item);
226
267
 
@@ -230,6 +271,8 @@
230
271
  });
231
272
  };
232
273
 
274
+ options = UI.$.extend({}, list.options, options);
275
+
233
276
  step(list.element, depth);
234
277
 
235
278
  return data;
@@ -264,9 +307,8 @@
264
307
  this.pointEl = null;
265
308
 
266
309
  for (var i=0; i<touchedlists.length; i++) {
267
- if (!touchedlists[i].children().length) {
268
- touchedlists[i].append(this.tplempty);
269
- }
310
+
311
+ this.checkEmptyList(touchedlists[i]);
270
312
  }
271
313
 
272
314
  touchedlists = [];
@@ -290,14 +332,14 @@
290
332
  expandAll: function() {
291
333
  var list = this;
292
334
  this.find(list.options.itemNodeName).each(function() {
293
- list.expandItem($(this));
335
+ list.expandItem(UI.$(this));
294
336
  });
295
337
  },
296
338
 
297
339
  collapseAll: function() {
298
340
  var list = this;
299
341
  this.find(list.options.itemNodeName).each(function() {
300
- list.collapseItem($(this));
342
+ list.collapseItem(UI.$(this));
301
343
  });
302
344
  },
303
345
 
@@ -314,7 +356,7 @@
314
356
 
315
357
  dragStart: function(e) {
316
358
  var mouse = this.mouse,
317
- target = $(e.target),
359
+ target = UI.$(e.target),
318
360
  dragItem = target.closest(this.options.itemNodeName),
319
361
  offset = dragItem.offset();
320
362
 
@@ -328,7 +370,7 @@
328
370
 
329
371
  this.dragRootEl = this.element;
330
372
 
331
- this.dragEl = $(document.createElement(this.options.listNodeName)).addClass(this.options.listClass + ' ' + this.options.dragClass);
373
+ this.dragEl = UI.$(document.createElement(this.options.listNodeName)).addClass(this.options.listClass + ' ' + this.options.dragClass);
332
374
  this.dragEl.css('width', dragItem.width());
333
375
 
334
376
  draggingElement = this.dragEl;
@@ -341,7 +383,7 @@
341
383
  dragItem[0].parentNode.removeChild(dragItem[0]);
342
384
  dragItem.appendTo(this.dragEl);
343
385
 
344
- $(document.body).append(this.dragEl);
386
+ UI.$body.append(this.dragEl);
345
387
 
346
388
  this.dragEl.css({
347
389
  left : offset.left,
@@ -352,7 +394,7 @@
352
394
  var i, depth,
353
395
  items = this.dragEl.find(this.options.itemNodeName);
354
396
  for (i = 0; i < items.length; i++) {
355
- depth = $(items[i]).parents(this.options.listNodeName).length;
397
+ depth = UI.$(items[i]).parents(this.options.listNodeName).length;
356
398
  if (depth > this.dragDepth) {
357
399
  this.dragDepth = depth;
358
400
  }
@@ -362,23 +404,29 @@
362
404
  },
363
405
 
364
406
  dragStop: function(e) {
407
+
365
408
  // fix for zepto.js
366
409
  //this.placeEl.replaceWith(this.dragEl.children(this.options.itemNodeName + ':first').detach());
367
- var el = this.dragEl.children(this.options.itemNodeName).first();
410
+ var el = this.dragEl.children(this.options.itemNodeName).first(),
411
+ root = this.placeEl.parents('.'+this.options.listBaseClass+':first');
412
+
368
413
  el[0].parentNode.removeChild(el[0]);
414
+
369
415
  this.placeEl.replaceWith(el);
370
416
 
371
417
  this.dragEl.remove();
372
418
 
373
- if (this.tmpDragOnSiblings[0]!=el[0].previousSibling || this.tmpDragOnSiblings[0]!=el[0].previousSibling) {
419
+ if (this.element[0] !== root[0]) {
374
420
 
375
- this.element.trigger('uk.nestable.change',[el, this.hasNewRoot ? "added":"moved"]);
421
+ root.trigger('change.uk.nestable',[el, "added", root, root.data('nestable')]);
422
+ this.element.trigger('change.uk.nestable', [el, "removed", this.element, this]);
376
423
 
377
- if (this.hasNewRoot) {
378
- this.dragRootEl.trigger('uk.nestable.change', [el, "removed"]);
379
- }
424
+ } else {
425
+ this.element.trigger('change.uk.nestable',[el, "moved", this.element, this]);
380
426
  }
381
427
 
428
+ this.trigger('stop.uk.nestable', [this, el]);
429
+
382
430
  this.reset();
383
431
 
384
432
  html.removeClass(this.options.movingClass);
@@ -451,7 +499,7 @@
451
499
  if (depth + this.dragDepth <= opt.maxDepth) {
452
500
  // create new sub-level if one doesn't exist
453
501
  if (!list.length) {
454
- list = $('<' + opt.listNodeName + '/>').addClass(opt.listClass);
502
+ list = UI.$('<' + opt.listNodeName + '/>').addClass(opt.listClass);
455
503
  list.append(this.placeEl);
456
504
  prev.append(list);
457
505
  this.setParent(prev);
@@ -482,7 +530,7 @@
482
530
  if (!hasPointerEvents) {
483
531
  this.dragEl[0].style.visibility = 'hidden';
484
532
  }
485
- this.pointEl = $(document.elementFromPoint(e.pageX - document.body.scrollLeft, e.pageY - (window.pageYOffset || document.documentElement.scrollTop)));
533
+ this.pointEl = UI.$(document.elementFromPoint(e.pageX - document.body.scrollLeft, e.pageY - (window.pageYOffset || document.documentElement.scrollTop)));
486
534
  if (!hasPointerEvents) {
487
535
  this.dragEl[0].style.visibility = 'visible';
488
536
  }
@@ -493,7 +541,7 @@
493
541
 
494
542
  var nestableitem = this.pointEl.closest('.'+opt.itemClass);
495
543
 
496
- if(nestableitem.length) {
544
+ if (nestableitem.length) {
497
545
  this.pointEl = nestableitem.closest(opt.itemNodeName);
498
546
  }
499
547
  }
@@ -502,7 +550,7 @@
502
550
  isEmpty = true;
503
551
  } else if (this.pointEl.data('nestable') && !this.pointEl.children().length) {
504
552
  isEmpty = true;
505
- this.pointEl = $(this.tplempty).appendTo(this.pointEl);
553
+ this.pointEl = UI.$(this.tplempty).appendTo(this.pointEl);
506
554
  } else if (!this.pointEl.length || !this.pointEl.hasClass(opt.listitemClass)) {
507
555
  return;
508
556
  }
@@ -510,15 +558,15 @@
510
558
  // find parent list of item under cursor
511
559
  var pointElRoot = this.element,
512
560
  tmpRoot = this.pointEl.closest('.'+this.options.listBaseClass),
513
- isNewRoot = pointElRoot[0] !== this.pointEl.closest('.'+this.options.listBaseClass)[0],
514
- $newRoot = tmpRoot;
561
+ isNewRoot = pointElRoot[0] !== this.pointEl.closest('.'+this.options.listBaseClass)[0];
515
562
 
516
563
  /**
517
564
  * move vertical
518
565
  */
519
566
  if (!mouse.dirAx || isNewRoot || isEmpty) {
567
+
520
568
  // check if groups match if dragging over new root
521
- if (isNewRoot && opt.group !== $newRoot.data('nestable-group')) {
569
+ if (isNewRoot && opt.group !== tmpRoot.data('nestable-group')) {
522
570
  return;
523
571
  } else {
524
572
  touchedlists.push(pointElRoot);
@@ -548,9 +596,8 @@
548
596
  if(!parent.data("nestable")) this.unsetParent(parent.parent());
549
597
  }
550
598
 
551
- if (!this.dragRootEl.find(opt.itemNodeName).length && !this.dragRootEl.children().length) {
552
- this.dragRootEl.append(this.tplempty);
553
- }
599
+ this.checkEmptyList(this.dragRootEl);
600
+ this.checkEmptyList(pointElRoot);
554
601
 
555
602
  // parent root list has changed
556
603
  if (isNewRoot) {
@@ -558,38 +605,18 @@
558
605
  this.hasNewRoot = this.element[0] !== this.dragRootEl[0];
559
606
  }
560
607
  }
561
- }
562
-
563
- });
564
-
565
- // adjust document scrolling
566
- $('html').on('mousemove touchmove', function(e) {
567
-
568
- if (draggingElement) {
608
+ },
569
609
 
610
+ checkEmptyList: function(list) {
570
611
 
571
- var top = draggingElement.offset().top;
612
+ list = list ? UI.$(list) : this.element;
572
613
 
573
- if (top < UI.$win.scrollTop()) {
574
- UI.$win.scrollTop(UI.$win.scrollTop() - Math.ceil(draggingElement.height()/2));
575
- } else if ( (top + draggingElement.height()) > (window.innerHeight + UI.$win.scrollTop()) ) {
576
- UI.$win.scrollTop(UI.$win.scrollTop() + Math.ceil(draggingElement.height()/2));
614
+ if (!list.children().length) {
615
+ list.find('.'+this.options.emptyClass).remove().end().append(this.tplempty);
577
616
  }
578
617
  }
579
- });
580
618
 
581
- // init code
582
- UI.ready(function(context) {
583
-
584
- $("[data-uk-nestable]", context).each(function(){
585
-
586
- var ele = $(this);
587
-
588
- if(!ele.data("nestable")) {
589
- var plugin = UI.nestable(ele, UI.Utils.options(ele.attr("data-uk-nestable")));
590
- }
591
- });
592
619
  });
593
620
 
594
621
  return UI.nestable;
595
- });
622
+ });