1/* 2* jQuery Firefly v0.1 3* https://github.com/motyar/firefly 4 5* Licensed under the MIT license. 6* Copyright 2011 Dharmveer Motyar 7* http://motyar.blogspot.com 8*/ 9(function($) { 10 11 /* Plugin defaults */ 12 var defaults = { 13 images : [ 14 'http://dharmmotyar.googlecode.com/svn/trunk/images/spark.png', 15 'http://dharmmotyar.googlecode.com/svn/trunk/images//spark2.png', 16 'http://dharmmotyar.googlecode.com/svn/trunk/images/spark3.png', 17 'http://dharmmotyar.googlecode.com/svn/trunk/images/spark4.png'], 18 total : 40 19 }; 20 21 $.firefly = function(settings) { 22 $.firefly.settings = $.extend({}, defaults, settings); 23 if($.firefly.preloadImages()){ 24 for (i = 0; i < $.firefly.settings.total; i++){ 25 $.firefly.fly($.firefly.create($.firefly.settings.images[$.firefly.random(($.firefly.settings.images).length)])); 26 } 27 } 28 return; 29 }; 30 31 /* Public Functions */ 32 $.firefly.create = function(img){ 33 spark = $('<img>').attr({'src' : img}).hide(); 34 $(document.body).append(spark); 35 return spark.css({ 36 'position':'absolute', 37 'z-index': $.firefly.random(20), 38 top: $.firefly.random(($(window).height()-150)), //offsets 39 left: $.firefly.random(($(window).width()-150)) //offsets 40 }).show(); 41} 42 43$.firefly.fly = function(sp) { 44 $(sp).animate({ 45 top: $.firefly.random(($(window).height()-150)), //offsets 46 left: $.firefly.random(($(window).width()-150)) 47 }, (($.firefly.random(10) + 5) * 1100),function(){ $.firefly.fly(sp) } ); 48}; 49 50$.firefly.preloadImages = function() { 51 var preloads = new Object(); 52 for (i = 0; i < ($.firefly.settings.images).length; i++){ 53 preloads[i] = new Image(); preloads[i].src = $.firefly.settings.images[i]; 54 } 55 return true; 56} 57 58$.firefly.random = function(max) { 59 return Math.ceil(Math.random() * max) - 1; 60} 61 62})(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.