PageSourceSearch

https://www.kittstillrocks.com/wp-content/plugins/gallery-by-supsy…/assets/js/lib/jquery.quicksand.js

js kittstillrocks.com collected 2026-10-08 09:23:54 UTC 10,549 bytes, 313 lines download raw bytes

1/*
2
3 Quicksand 1.4
4
5 Reorder and filter items with a nice shuffling animation.
6
7 Copyright (c) 2010 Jacek Galanciak (razorjack.net) and agilope.com
8 Big thanks for Piotr Petrus (riddle.pl) for deep code review and wonderful docs & demos.
9
10 Dual licensed under the MIT and GPL version 2 licenses.
11 http://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt
12 http://github.com/jquery/jquery/blob/master/GPL-LICENSE.txt
13
14 Project site: http://razorjack.net/quicksand
15 Github site: http://github.com/razorjack/quicksand
16
17 */
18
19(function (e) {
20  var t = function (e) {
21    var t = e.clone();
22    var n = e.find('canvas');
23    if (n.length) {
24      var r = t.find('canvas');
25      r.each(function (e) {
26        var t = this.getContext('2d');
27        t.drawImage(n.get(e), 0, 0);
28      });
29    }
30    return t;
31  };
32  e.fn.quicksand = function (n, r) {
33    var i = { duration: 750, easing: 'swing', attribute: 'data-id', adjustHeight: 'auto', adjustWidth: 'auto', useScaling: false, enhancement: function (e) {}, selector: '> *', atomic: false, dx: 0, dy: 0, maxWidth: 0, retainExisting: true },
34      s = (function () {
35        var e = 'transform WebkitTransform MozTransform OTransform msTransform'.split(' '),
36          t = document.createElement('div');
37        for (var n = 0; n < e.length; n++) {
38          if (typeof t.style[e[n]] != 'undefined') {
39            return true;
40          }
41        }
42        return false;
43      })();
44    e.extend(i, r);
45    if (!s || typeof e.fn.scale == 'undefined') {
46      i.useScaling = false;
47    }
48    var o;
49    if (typeof arguments[1] == 'function') {
50      o = arguments[1];
51    } else if (typeof (arguments[2] == 'function')) {
52      o = arguments[2];
53    }
54    return this.each(function (r) {
55      var s;
56      var u = [];
57      var a;
58      if (typeof i.attribute == 'function') {
59        a = e(n);
60      } else {
61        a = t(e(n).filter('[' + i.attribute + ']'));
62      }
63      var f = e(this);
64      var l = e(this).css('height');
65      var c = e(this).css('width');
66      var h, p;
67      var d = false;
68      var v = false;
69      var m = e(f).offset();
70      var g = [];
71      var y = e(this).find(i.selector);
72      var b = e(y).innerWidth();
73      if (navigator.userAgent.match(/msie [6]/i)) {
74        f.html('').append(a);
75        return;
76      }
77      var w = 0;
78      var E = function () {
79        e(this).css('margin', '').css('position', '').css('top', '').css('left', '').css('opacity', '');
80        if (!w) {
81          w = 1;
82          if (!i.atomic) {
83            var t = f.find(i.selector);
84            if (!i.retainExisting) {
85              f.prepend(C.find(i.selector));
86              t.remove();
87            } else {
88              var n = e([]);
89              C.find(i.selector).each(function (r) {
90                var s = e([]);
91                if (typeof i.attribute == 'function') {
92                  var o = i.attribute(e(this));
93                  t.each(function () {
94                    if (i.attribute(this) == o) {
95                      s = e(this);
96                      return false;
97                    }
98                  });
99                } else {
100                  s = t.filter('[' + i.attribute + '="' + e(this).attr(i.attribute) + '"]');
101                }
102                if (s.length > 0) {
103                  n = n.add(s);
104                  if (r === 0) {
105                    f.prepend(s);
106                  } else {
107                    s.insertAfter(f.find(i.selector).get(r - 1));
108                  }
109                }
110              });
111              t.not(n).remove();
112            }
113            if (d) {
114              f.css('height', h);
115            }
116            if (v) {
117              f.css('width', c);
118            }
119          }
120          i.enhancement(f);
121          if (typeof o == 'function') {
122            o.call(this);
123          }
124        }
125        if (false === i.adjustHeight) {
126          f.css('height', 'auto');
127        }
128        if (false === i.adjustWidth) {
129          f.css('width', 'auto');
130        }
131      };
132      var S = f.offsetParent();
133      var x = S.offset();
134      if (S.css('position') == 'relative') {
135        if (S.get(0).nodeName.toLowerCase() != 'body') {
136          x.top += parseFloat(S.css('border-top-width')) || 0;
137          x.left += parseFloat(S.css('border-left-width')) || 0;
138        }
139      } else {
140        x.top -= parseFloat(S.css('border-top-width')) || 0;
141        x.left -= parseFloat(S.css('border-left-width')) || 0;
142        x.top -= parseFloat(S.css('margin-top')) || 0;
143        x.left -= parseFloat(S.css('margin-left')) || 0;
144      }
145      if (isNaN(x.left)) {
146        x.left = 0;
147      }
148      if (isNaN(x.top)) {
149        x.top = 0;
150      }
151      x.left -= i.dx;
152      x.top -= i.dy;
153      f.css('height', e(this).height());
154      f.css('width', e(this).width());
155      y.each(function (t) {
156        g[t] = e(this).offset();
157      });
158      e(this).stop();
159      var T = 0;
160      var N = 0;
161      y.each(function (t) {
162        e(this).stop();
163        var n = e(this).get(0);
164        if (n.style.position == 'absolute') {
165          T = -i.dx;
166          N = -i.dy;
167        } else {
168          T = i.dx;
169          N = i.dy;
170        }
171        n.style.position = 'absolute';
172        n.style.margin = '0';
173        if (!i.adjustWidth) {
174          n.style.width = b + 'px';
175        }
176        n.style.top = g[t].top - parseFloat(n.style.marginTop) - x.top + N + 'px';
177        n.style.left = g[t].left - parseFloat(n.style.marginLeft) - x.left + T + 'px';
178        if (i.maxWidth > 0 && g[t].left > i.maxWidth) {
179          n.style.display = 'none';
180        }
181      });
182      var C = t(e(f));
183      var k = C.get(0);
184      k.innerHTML = '';
185      k.setAttribute('id', '');
186      k.style.height = 'auto';
187      k.style.width = f.width() + 'px';
188      C.append(a);
189      C.insertBefore(f);
190      C.css('opacity', 0);
191      k.style.zIndex = -1;
192      k.style.margin = '0';
193      k.style.position = 'absolute';
194      k.style.top = m.top - x.top + 'px';
195      k.style.left = m.left - x.left + 'px';
196      if (i.adjustHeight === 'dynamic') {
197        f.animate({ height: C.height() }, i.duration, i.easing);
198      } else if (i.adjustHeight === 'auto') {
199        h = C.height();
200        if (parseFloat(l) < parseFloat(h)) {
201          f.css('height', h);
202        } else {
203          d = true;
204        }
205      }
206      if (i.adjustWidth === 'dynamic') {
207        f.animate({ width: C.width() }, i.duration, i.easing);
208      } else if (i.adjustWidth === 'auto') {
209        p = C.width();
210        if (parseFloat(c) < parseFloat(p)) {
211          f.css('width', p);
212        } else {
213          v = true;
214        }
215      }
216      y.each(function (t) {
217        var n = [];
218        if (typeof i.attribute == 'function') {
219          s = i.attribute(e(this));
220          a.each(function () {
221            if (i.attribute(this) == s) {
222              n = e(this);
223              return false;
224            }
225          });
226        } else {
227          n = a.filter('[' + i.attribute + '="' + e(this).attr(i.attribute) + '"]');
228        }
229        if (n.length) {
230          if (!i.useScaling) {
231            u.push({ element: e(this), dest: n, style: { top: e(this).offset().top, left: e(this).offset().left, opacity: '' }, animation: { top: n.offset().top - x.top, left: n.offset().left - x.left, opacity: 1 } });
232          } else {
233            u.push({ element: e(this), dest: n, style: { top: e(this).offset().top, left: e(this).offset().left, opacity: '' }, animation: { top: n.offset().top - x.top, left: n.offset().left - x.left, opacity: 1, scale: '1.0' } });
234          }
235        } else {
236          if (!i.useScaling) {
237            u.push({ element: e(this), style: { top: e(this).offset().top, left: e(this).offset().left, opacity: '' }, animation: { opacity: '0.0' } });
238          } else {
239            u.push({ element: e(this), animation: { opacity: '0.0', style: { top: e(this).offset().top, left: e(this).offset().left, opacity: '' }, scale: '0.0' } });
240          }
241        }
242      });
243      a.each(function (n) {
244        var r = [];
245        var o = [];
246        if (typeof i.attribute == 'function') {
247          s = i.attribute(e(this));
248          y.each(function () {
249            if (i.attribute(this) == s) {
250              r = e(this);
251              return false;
252            }
253          });
254          a.each(function () {
255            if (i.attribute(this) == s) {
256              o = e(this);
257              return false;
258            }
259          });
260        } else {
261          r = y.filter('[' + i.attribute + '="' + e(this).attr(i.attribute) + '"]');
262          o = a.filter('[' + i.attribute + '="' + e(this).attr(i.attribute) + '"]');
263        }
264        var l;
265        if (r.length === 0 && o.length > 0) {
266          if (!i.useScaling) {
267            l = { opacity: '1.0' };
268          } else {
269            l = { opacity: '1.0', scale: '1.0' };
270          }
271          var c = t(o);
272          var h = c.get(0);
273          h.style.position = 'absolute';
274          h.style.margin = '0';
275          if (!i.adjustWidth) {
276            h.style.width = b + 'px';
277          }
278          h.style.top = o.offset().top - x.top + 'px';
279          h.style.left = o.offset().left - x.left + 'px';
280          c.css('opacity', 0);
281          if (i.useScaling) {
282            c.scale(0);
283          }
284          c.appendTo(f);
285          if (i.maxWidth === 0 || o.offset().left < i.maxWidth) {
286            u.push({ element: e(c), dest: o, animation: l });
287          }
288        }
289      });
290      C.remove();
291      if (!i.atomic) {
292        i.enhancement(f);
293        for (r = 0; r < u.length; r++) {
294          u[r].element.animate(u[r].animation, i.duration, i.easing, E);
295        }
296      } else {
297        $toDelete = f.find(i.selector);
298        f.prepend(C.find(i.selector));
299        for (r = 0; r < u.length; r++) {
300          if (u[r].dest && u[r].style) {
301            var L = u[r].dest;
302            var A = L.offset();
303            L.css({ position: 'relative', top: u[r].style.top - A.top, left: u[r].style.left - A.left });
304            L.animate({ top: '0', left: '0' }, i.duration, i.easing, E);
305          } else {
306            u[r].element.animate(u[r].animation, i.duration, i.easing, E);
307          }
308        }
309        $toDelete.remove();
310      }
311    });
312  };
313})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.