Advertisement
pushrbx

Herby Banner Shuffler

Apr 2nd, 2013
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.62 KB | None | 0 0
  1.  ;
  2. jQuery(window).load(function() {
  3.     Array.prototype.megkever = function() {
  4.         var i = this.length;
  5.         while (--i) {
  6.             var j = Math.floor(Math.random() * (i + 1));
  7.             var temp = this[i];
  8.             this[i] = this[j];
  9.             this[j] = temp;
  10.         }
  11.         return this;
  12.     };
  13.     var sn = jQuery;
  14.     var sd = sn("#sidebar .widget_text");
  15.     var last = sd.length - 1;
  16.     var olast = sd.eq(last);
  17.     var list = [];
  18.     sd.each(function(i,v) {
  19.         if(!(i == 1 || i == 0)) {
  20.             if(i != last)
  21.                 list.push(sn(v));
  22.             sn(v).remove();
  23.         }
  24.  
  25.     });
  26.     list.megkever();
  27.     list.push(olast);
  28.     sn(list).each(function(i,v) {
  29.         sn(this).appendTo("#sidebar");
  30.     });
  31. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement