Changeset 16048 for extensions/luciano/js
- Timestamp:
- Jun 26, 2012, 10:33:51 AM (12 years ago)
- Location:
- extensions/luciano/js
- Files:
-
- 2 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/luciano/js/script.js
r12533 r16048 1 window.addEvent('domready', function() {2 galleryThumbs = $$('.thumbnailCategories li');3 galleryThumbs.each(function(el){4 el.linkUrl = el.getElement('a').href;5 el.addEvents({6 'mouseenter' : function(){addOver(el)},7 'mouseleave' : function(){removeOver(el)},8 'click' : function(){goToUrl(el)}9 });10 });11 12 catThumbs = $$('.thumbnails li');13 catThumbs.each(function(el){14 el.addEvents({15 'mouseenter' : function(){addOver(el)},16 'mouseleave' : function(){removeOver(el)}17 });18 });19 20 var mySelect = new elSelect( {container : 'order', onClicked: function(){new URI(this.hiddenInput.value).go();}} );21 var themeSelect = new elSelect( {container : 'themeSelect'} );22 var languageSelect = new elSelect( {container : 'languageSelect'} );23 24 var photoPrev = $('linkPrev');25 26 if(photoPrev)27 {28 photoPrev.image = photoPrev.getElement('img');29 photoPrev.image.setStyle('opacity', 0);30 photoPrev.setStyle('display', 'block');31 photoPrev.addEvents({32 'mouseenter': function(){ showElement(photoPrev.image) },33 'mouseleave': function(){ hideElement(photoPrev.image)}34 });35 }36 37 var photoNext = $('linkNext');38 if(photoNext)39 {40 photoNext.image = photoNext.getElement('img');41 photoNext.image.setStyle('opacity', 0);42 photoNext.setStyle('display', 'block');43 photoNext.addEvents({44 'mouseenter': function(){ showElement(photoNext.image) },45 'mouseleave': function(){ hideElement(photoNext.image)}46 });47 }48 });49 50 function addOver(el){51 if(!el.hasClass('hover')) el.addClass('hover');52 }53 54 function removeOver(el){55 if(el.hasClass('hover')) el.removeClass('hover');56 }57 58 function goToUrl(el){59 new URI(el.linkUrl).go();60 }61 62 function showElement(el)63 {64 el.morph({'opacity': 1});65 }66 67 function hideElement(el)68 {69 el.morph({'opacity': 0});70 }71 72 function toggleElement(el)73 {74 if(el.getStyle('opacity') == 0) showElement(el); else hideElement(el);75 }76 77 var gRatingOptions, gRatingButtons, gUserRating;78 79 1 function makeNiceRatingForm(options) 80 2 { … … 205 127 return false; 206 128 } 207 208 209 /**210 * @file elSelect.js211 * @downloaded from http://www.cult-f.net/2007/12/14/elselect/212 * @hacked by Luciano Amodio www.lucianoamodio.it213 * @author Sergey Korzhov aka elPas0214 * @site http://www.cult-f.net215 * @date December 14, 2007216 *217 */218 var elSelect = new Class({219 options: {220 container: false,221 baseClass : 'elSelect',222 onClicked: $lambda(false)223 },224 source : false,225 selected : false,226 _select : false,227 current : false,228 selectedOption : false,229 dropDown : false,230 optionsContainer : false,231 hiddenInput : false,232 /*233 pass the options,234 create html and inject into container235 */236 initialize: function(options){237 this.setOptions(options)238 239 if ( !$(this.options.container) ) return240 241 this.selected = false242 this.source = $(this.options.container).getElement('select')243 this.buildFrameWork()244 245 $(this.source).getElements('option').each( this.addOption, this )246 $(this.options.container).set('html', '')247 this._select.injectInside($(this.options.container))248 249 this.bindEvents()250 251 },252 253 buildFrameWork : function() {254 this._select = new Element('div').addClass( this.options.baseClass )255 this.current = new Element('div').addClass('selected').injectInside($(this._select))256 this.selectedOption = new Element('div').addClass('selectedOption').injectInside($(this.current))257 this.dropDown = new Element('div').addClass('dropDown').injectInside($(this.current))258 new Element('div').addClass('clear').injectInside($(this._select))259 this.optionsContainer = new Element('div').addClass('optionsContainer').injectInside($(this._select))260 var t = new Element('div').addClass('optionsContainerTop').injectInside($(this.optionsContainer))261 var o = new Element('div').injectInside($(t))262 var p = new Element('div').injectInside($(o))263 var t = new Element('div').addClass('optionsContainerBottom').injectInside($(this.optionsContainer))264 var o = new Element('div').injectInside($(t))265 var p = new Element('div').injectInside($(o))266 267 this.hiddenInput = new Element('input', {268 'type' : 'hidden',269 'name' : this.source.get('name')270 }).inject($(this.options.container), 'before');271 272 },273 274 bindEvents : function() {275 document.addEvent('click', function() {276 if ( this.optionsContainer.getStyle('display') == 'block')277 this.onDropDown()278 }.bind(this));279 280 $(this.options.container).addEvent( 'click', function(e) { new Event(e).stop(); } )281 this.current.addEvent('click', this.onDropDown.bindWithEvent(this) )282 283 },284 285 //add single option to select286 addOption: function( option ){287 var o = new Element('div').addClass('option').setProperty('value',option.value)288 if ( option.disabled ) { o.addClass('disabled') } else {289 o.addEvents( {290 'click': this.onOptionClick.bindWithEvent(this),291 'mouseout': this.onOptionMouseout.bindWithEvent(this),292 'mouseover': this.onOptionMouseover.bindWithEvent(this)293 })294 }295 296 if ( $defined(option.getProperty('class')) && $chk(option.getProperty('class')) )297 o.addClass(option.getProperty('class'))298 299 300 if ( option.selected ) {301 if ( this.selected) this.selected.removeClass('selected');302 this.selected = o303 o.addClass('selected')304 this.selectedOption.set('text', option.text);305 this.hiddenInput.setProperty('value',option.value);306 }307 o.set('text', option.text);308 o.injectBefore($(this.optionsContainer).getLast());309 },310 311 onDropDown : function( e ) {312 313 if ( this.optionsContainer.getStyle('display') == 'block') {314 this.optionsContainer.setStyle('display','none')315 } else {316 this.optionsContainer.setStyle('display','block')317 this.selected.addClass('selected')318 //needed to fix min-width in ie6319 var width = this.optionsContainer.getStyle('width').toInt() > this._select.getStyle('width').toInt() ?320 this.optionsContainer.getStyle('width')321 :322 this._select.getStyle('width')323 324 this.optionsContainer.setStyle('width', width)325 this.optionsContainer.getFirst().setStyle('width', width)326 this.optionsContainer.getLast().setStyle('width', width)327 }328 },329 onOptionClick : function(e) {330 var event = new Event(e)331 if ( this.selected != event.target ) {332 this.selected.removeClass('selected')333 event.target.addClass('selected')334 this.selected = event.target335 this.selectedOption.set('text', this.selected.get('text'));336 this.hiddenInput.setProperty('value',this.selected.getProperty('value'));337 this.fireEvent('clicked');338 }339 this.onDropDown()340 },341 onOptionMouseover : function(e){342 var event = new Event(e)343 this.selected.removeClass('selected')344 event.target.addClass('selected')345 },346 onOptionMouseout : function(e){347 var event = new Event(e)348 event.target.removeClass('selected')349 }350 351 });352 elSelect.implement(new Events);353 elSelect.implement(new Options);
Note: See TracChangeset
for help on using the changeset viewer.