1/* 2 * Copyright 2009 by DISTINCT Corp 3 * 4 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General 5 * Public License as published by the Free Software Foundation; either version 2 of the License, or (at your 6 * option) any later version. 7 * 8 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 9 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10 * for more details. 11 * 12 * You should have received a copy of the GNU General Public License along with this program; if not, write to 13 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 14 * 15* Versions: 0.1 2009-06-16 Initial release 16* 0.2 2009-06-17 Fixed some bugs, added initial support for submenu's 17 * 18 */ 19 20(function($){ 21 $.fn.spritemenu = function(settings) { 22 var settings = $.extend({}, $.fn.spritemenu.defaults, settings); 23 return this.each(function() { 24 var aniParamsOrig = {}; 25 var aniParamsBack = {}; 26 $(this).children(settings.buttonselector).each(function(index) { 27 var $mainlink = $(this).children('a'); 28 $mainlink.parent().children('ul').css('opacity',0).hide(); 29 $mainlink 30 .css('display','block') 31 .css('position','relative') 32 .css('width',settings.buttonwidth) 33 .css('height',settings.buttonheight) 34 .css('background-image','url('+settings.grid+')') 35 .css('background-repeat','no-repeat') 36 .css('background-position',((0-index) * settings.buttonwidth)+'px 0px') 37 .css('z-index',settings.zindex) 38 .append('<span></span>').children('span') 39 .css('display','block') 40 .css('position','absolute') 41 .css('top',0) 42 .css('left',0) 43 .css('width',settings.buttonwidth) 44 .css('height',settings.buttonheight) 45 .css('background-image','url('+settings.grid+')') 46 .css('background-repeat','no-repeat') 47 .css('background-position',((0-index) * settings.buttonwidth)+'px ' + (-1*settings.buttonheight) + 'px') 48 .css('z-index',(settings.zindex+1)); 49 aniParamsOrig[settings.animate] = $mainlink.children('span').css(settings.animate); 50 aniParamsBack[settings.animate] = 0; 51 $mainlink.children('span').css(settings.animate,0).hide(); 52 }).hover(function () { 53 $(this).children('a').children('span').stop().show().animate(aniParamsOrig, {queue: true, duration: settings.speed, easing: settings.easing, complete: function() { 54 $(this).parent().parent().children('ul').stop().show().animate({opacity: 1}, {queue: true, duration: 'slow'}); 55 }}); 56 }, 57 function () { 58 $(this).children('a').children('span').stop().animate(aniParamsBack, {queue: true, duration: settings.speed, easing: settings.easing, complete: function() { 59 $(this).hide().parent().parent().children('ul').stop().animate({opacity: 0}, {queue: true, duration: 'slow'}).hide(); 60 }}); 61 }); 62 }); 63 } 64 $.fn.spritemenu.defaults = { 65 grid: 'menugrid.png', 66 buttonwidth: 100, 67 buttonheight: 100, 68 buttonselector: 'li', 69 zindex: 10, 70 speed: 'slow', 71 easing: 'swing', 72 animate: 'opacity' 73 }; 74 function abort() { 75 arguments[0] = 'spritemenu: ' + arguments[0]; 76 throw format.apply(null, arguments); 77 } 78 function format(str) { 79 for (var i = 1; i < arguments.length; i++) 80 str = str.replace(new RegExp('\\{' + (i-1) + '}', 'g'), arguments[i]); 81 return str; 82 } 83})(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.