1/** 2 Fancy menu class 3 Jan 14, 2011 4*/ 5var ZTFancy = new Class({ 6 initialize: function(menu, options){ 7 this.setOptions(this.getOptions(), options); 8 this.menu = $(menu), this.current = $(document.body).getElement('li[class$=active]'); 9 this.menu.getElements('li').each(function(item){ 10 if(item.getProperty('class').split(' ')[0] != 'mega-li') 11 { 12 item.addEvent('mouseover', function(){this.moveBg(item);}.bind(this)); 13 item.addEvent('mouseout', function(){this.moveBg(this.current);}.bind(this)); 14 } 15 }.bind(this)); 16 this.back = new Element('li').addClass('fancy').adopt(new Element('div').addClass('fancy-left').adopt(new Element('div').addClass('fancy-right'))).injectInside(this.menu); 17 this.back.fx = this.back.effects(this.options); 18 if(this.current) this.setCurrent(this.current); 19 }, 20 21 setCurrent: function(el, effect){ 22 23 xPos = el.offsetLeft; 24 wPos = el.offsetWidth; 25 tempEl = el.offsetParent; 26 27 while(tempEl != null) { 28 xPos += tempEl.offsetLeft; 29 tempEl = tempEl.offsetParent; 30 } 31 32 this.back.setStyles({left: (xPos)+'px', width: (wPos)+'px'}); 33 (effect) ? this.back.effect('opacity').set(0).start(1) : this.back.setOpacity(1); 34 35 this.current = el; 36 }, 37 38 getOptions: function(){ 39 return { 40 transition: Fx.Transitions.linear, 41 duration: 500, wait: false, 42 onClick: Class.empty 43 }; 44 }, 45 46 clickItem: function(event, item) { 47 if(!this.current) this.setCurrent(item, true); 48 this.current = item; 49 this.options.onClick(new Event(event), item); 50 }, 51 52 moveBg: function(to) { 53 if(!this.current) return; 54 55 xPos = to.offsetLeft; 56 wPos = to.offsetWidth; 57 tempEl = to.offsetParent; 58 59 while(tempEl != null) { 60 xPos += tempEl.offsetLeft; 61 tempEl = tempEl.offsetParent; 62 } 63 64 this.back.fx.custom({ 65 left: [this.back.offsetLeft, xPos], 66 width: [wPos, wPos] 67 }); 68 } 69}); 70ZTFancy.implement(new Options);
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.