Показать сообщение отдельно
  #2 (permalink)  
Старый 06.11.2014, 20:32
Новичок на форуме
Отправить личное сообщение для vorobei4ik Посмотреть профиль Найти все сообщения от vorobei4ik
 
Регистрация: 06.11.2014
Сообщений: 6

окончание скрипта
switch(status) {
				case 'true':
					t.debug('keepItOpened: true');
					t.d.keepItOpened = true;
					t.d.minBmax = true;
					t.d.minBmax_reset = false;
					break;
				case 'false':
					t.debug('keepItOpened: false');
					t.d.keepItOpened = false;
					t.d.minBmax = false;
					t.d.minBmax_reset = false;
					break;
				case 'restore':
					t.debug('keepItOpened: restore');
					t.d.keepItOpened = t.d.kfo.keepItOpened;
					t.d.minBmax = t.d.kfo.minBmax;
					t.d.minBmax_reset = t.d.kfo.minBmax_reset;
					break;
			}
		},
		
		sense: function() {
			var t = this, senseObj = null;
			if(t.o.sense !== true) return;
			
			t.debug('sense: on');
			t.d.elObj.children().each(function(i, el) {
				senseObj = jQuery(this);
				if(senseObj.attr('id') !== '') {
					jQuery( 'a[rel=' + senseObj.attr('id') + ']' ).hover(
						function() { t.maximize(i); },
						function() { t.delayedMinimize(i); }
					);
				}
			});
		},
		
		bindPanel: function(index) {
			var t = this,
				elem = null,
				elObjChildElems = t.d.elObj.children();
				
			t.debug('bind panel');
				
			elem = typeof index == 'number' ? elObjChildElems.eq( index ) : elObjChildElems;
			elem.mouseenter(function(event) {
				var i = elObjChildElems.index(this);
				t.maximize(i);
				jQuery(this).mouseleave(function(event) {
					t.delayedMinimize(i);
				});
			});
		},
		
		unbindPanel: function(index) {
			var t = this, i = index;
			if(t.isControl(t.d.elObj) || t.o.activePanel === true) return;
			
			if(typeof i == 'number') {
				t.debug('minimize unbind "'+index+'"');
				t.d.elObj.children().eq(i).unbind('mouseenter hover mouseout mouseleave');
			} else {
				t.debug('minimize unbind all');
				t.d.elObj.children().unbind('mouseenter hover mouseout mouseleave');
			}
		},
		
		delayedMinimize: function(index) {
			var t = this, i = index;
			
			
			if(t.d.keepItOpened === true) return;
			
			t.clearTimeout(i);
			
			t.d.minimizetimeouts[i] = setTimeout(function() {
				t.minimize(i);
			}, t.d.minimizeTimeout);
		},
		
		clearTimeout: function(index) {
			var t = this, i = index;
			
			if(t.d.minimizetimeouts[i]) {
				clearTimeout(t.d.minimizetimeouts[i]);
			}
		},
		
		minimizeAll: function() {
			var t = this,
				elObjChildElems = t.d.elObj.children();

			t.debug('minimizeAll');

			t.d.elObj.children().each(function(i, elm) {
				t.minimize(i);
			});
		},
		
		minimize: function(index) {
			var t = this,
				elObjChildElems = t.d.elObj.children(),
				i = index;

			t.debug('minimize');

			t.clearTimeout(i);
			t.hideControl(i);
			t.unbindPanel();
			t.trigger(t.o.beforeMin, i, function() {
				if(t.d.minWidth > 0) {
					t.resetClipValues(true, function() {
						t.trigger(t.o.afterMin, i);
					});
				} else {
					t.setClip(i, t.d.cv[i], true, function() {
						t.trigger(t.o.afterMin, i);
					});
				}
				if(t.o.contentRelations === true) {
					jQuery('a[rel='+ t.d.elObj.children().eq(i).attr('id') +']').removeClass('on');
				}
			});
		},
		
		minBeforeMax: function(index) {
			var t = this;
			if(t.d.minBmax == false || typeof index == 'undefined') return;
			t.minimize(index);
			if(t.d.minBmax_reset == true) {
				t.d.minBmax = false;
			}
		},
		
		maximize: function(index) {
			var t = this, i = index, lastIndex = t.d.index;

			t.debug('maximize');

			t.d.index = i;
			t.minBeforeMax((typeof lastIndex == 'undefined' ? i : lastIndex));
			t.showControl(i);
			t.d.elObj.children().css('z-index','1').eq(i).css('z-index','10');
			t.trigger(t.o.beforeMax, i, function() {
				if(t.o.contentRelations === true) {
					jQuery('a[rel='+ t.d.elObj.children().eq(i).attr('id') +']').addClass('on');
				}
				if(t.d.minWidth > 0) {
					t.devideClips(i, function() {
						t.trigger(t.o.afterMax, i);
					});
				} else {
					t.setClip(i, [0, t.d.elObj.width(), t.d.elObj.height(), 0], true, function() {
						t.trigger(t.o.afterMax, i);
					});
				}
			});
		},
		
		devideClips: function(index, callback) {
			var t = this,
				el = {obj: t.d.elObj, dim: {w: t.d.elObj.width(), h: t.d.elObj.height()}},
				ce = el.obj.children(),
				indexWidth = el.dim.w,
				widths = [];
			
			indexWidth = el.dim.w - ((ce.length - 1) * t.d.minWidth);
			ce.each(function(i, elm) {
				widths[i] = i === index ? indexWidth : parseInt(t.d.minWidth);
			});
			t.setEachChildren(widths, true, callback);
		},
		
		resetClipValues: function(animated, callback, resetCallback) {
			var t = this, ret = null;

			ret = t.setEachChildren((t.d.elObj.width() / t.d.elObj.children().length), animated, callback, true);
			if(jQuery.isFunction(resetCallback)) {
				resetCallback();
			}
			return ret;
		},
		
		setEachChildren: function(width, animated, callback, ret) {
			var t = this;
			
			var el = {obj: t.d.elObj, dim: {w: t.d.elObj.width(), h: t.d.elObj.height()}},
				ce = el.obj.children(),
				z = 0,
				x = z,
				d = typeof t.o.clipSpacing == 'number' ? t.o.clipSpacing : 0,
				values = [];

			ce.each(function(i, elm) {
				var nLastItem = (i + 1) < ce.length ? true : false,
					distance = nLastItem ? true : false,
					s = typeof width == 'object' ? width[i] : width,
					rx = x + (d > 0 && distance ? s - d : s),
					rx_rnd = nLastItem ? Math.floor(rx) : Math.round(rx);
				values[i] = [0, rx_rnd, el.dim.h, x];
				t.setClip(i, values[i], animated, callback);
				x = x + s;
			});
			
			if(ret === true) {
				return values;
			}
		},
		
		setClip: function(index, c, animated, callback) {
			var t = this;
			
			if(typeof animated == 'undefined' || animated !== false) {
				t.animateClip(index, c, callback);
			} else {
				t.cssClip(index, c, callback);
			}
		},
		
		animateClip: function(index, c, callback) {
			var t = this,
				rect = typeof c == 'string' ? c : t.rect([c]);
			
			t.d.elObj.children().eq(index).stop().animate({clip: rect}, t.o.animationSpeed, function() {
				if(jQuery.isFunction(callback)) {
					callback();
				}
			});
		},
		
		cssClip: function(index, c, callback) {
			var t = this,
				rect = typeof c == 'string' ? c : t.rect([c]);
			
			t.d.elObj.children().eq(index).stop().css('clip', rect);
			if(jQuery.isFunction(callback)) {
				callback();
			}
		},
		
		showControl: function(index) {
			var t = this;
			if(t.o.autoOpenControl !== true) return;
			jQuery(t.d.c).children().eq(index).children('ul').show().css('visibility', 'visible');
		},
		
		hideControl: function(index) {
			var t = this;
			
			if(t.o.autoOpenControl !== true || !t.isControl(t.o.control)) return;
			if(jQuery(t.d.c).find('ul').length <= 0) return;
			if(typeof index == 'undefined') {
				jQuery(t.d.c).find('ul').hide().css('visibility', 'hidden');
			} else {
				jQuery(t.d.c).children().eq(index).children('ul').hide().css('visibility', 'hidden');
			}
		},
		
		getClipValues: function() {
			var t = this, values = [];
			
			t.debug(t.d.elObj.children().first().css('clip'));
			if(t.o.autoCliping === true) {
				values = t.setEachChildren((t.d.elObj.width() / t.d.elObj.children().length), animated, callback);
			} else {
				t.d.elObj.children().each(function() {  
					values[jQuery(this).index()] = jQuery(this).css('clip');
				});
			}
			return values;
		},
		
		rect: function(c) {
			var t = this;
			
			if(typeof c === 'undefined') {
				t.debug('undefined coordinates in rect()');
				return t.rect([0,0,0,0]);
			}
			return 'rect('+c[0]+'px '+c[1]+'px '+c[2]+'px '+c[3]+'px)';
		},
		
		isControl: function(selector) {
			var t = this;
			
			if(jQuery(t.d.c)[0] == jQuery(selector)[0]) {
				return true;
			} return false;
		},
		
		trigger: function(trigger, index, callback) {
			var t = this, i = index;
			
			if(jQuery.isFunction(trigger)) {
				trigger.apply(t, [i]);
			}
			if(jQuery.isFunction(callback)) {
				callback();
			}
		},
		
		debug: function(msg) {
			if(this.o.debug !== true) return;

			if(window.console) {
				window.console.log(msg);
			} else {
				if(jQuery('#facetsDebug').length == 0) {
					jQuery('<div id="facetsDebug"><div><b>Facets-debugger:</b></div></div>').appendTo(document.body);
				}
				jQuery('#facetsDebug').prepend('<div>'+msg+'</div>');
			}
		}
	}
	
})(jQuery);
Ответить с цитированием