fix lint errors

This commit is contained in:
vitalets 2013-08-06 11:00:54 +04:00
parent a77664603b
commit 2b81ed2532

@ -93,78 +93,78 @@
placement = inside ? placement.split(' ')[1] : placement; placement = inside ? placement.split(' ')[1] : placement;
tpb = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} tpb = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2};
tpt = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2} tpt = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2};
tpl = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth} tpl = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth};
tpr = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width} tpr = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width};
switch (placement) { switch (placement) {
case 'bottom': case 'bottom':
if ((tpb.top + actualHeight) > ($(window).scrollTop() + $(window).height())) { if ((tpb.top + actualHeight) > ($(window).scrollTop() + $(window).height())) {
if (tpt.top > $(window).scrollTop()) { if (tpt.top > $(window).scrollTop()) {
placement = 'top' placement = 'top';
} else if ((tpr.left + actualWidth) < ($(window).scrollLeft() + $(window).width())) { } else if ((tpr.left + actualWidth) < ($(window).scrollLeft() + $(window).width())) {
placement = 'right' placement = 'right';
} else if (tpl.left > $(window).scrollLeft()) { } else if (tpl.left > $(window).scrollLeft()) {
placement = 'left' placement = 'left';
} else { } else {
placement = 'right' placement = 'right';
} }
} }
break break;
case 'top': case 'top':
if (tpt.top < $(window).scrollTop()) { if (tpt.top < $(window).scrollTop()) {
if ((tpb.top + actualHeight) < ($(window).scrollTop() + $(window).height())) { if ((tpb.top + actualHeight) < ($(window).scrollTop() + $(window).height())) {
placement = 'bottom' placement = 'bottom';
} else if ((tpr.left + actualWidth) < ($(window).scrollLeft() + $(window).width())) { } else if ((tpr.left + actualWidth) < ($(window).scrollLeft() + $(window).width())) {
placement = 'right' placement = 'right';
} else if (tpl.left > $(window).scrollLeft()) { } else if (tpl.left > $(window).scrollLeft()) {
placement = 'left' placement = 'left';
} else { } else {
placement = 'right' placement = 'right';
} }
} }
break break;
case 'left': case 'left':
if (tpl.left < $(window).scrollLeft()) { if (tpl.left < $(window).scrollLeft()) {
if ((tpr.left + actualWidth) < ($(window).scrollLeft() + $(window).width())) { if ((tpr.left + actualWidth) < ($(window).scrollLeft() + $(window).width())) {
placement = 'right' placement = 'right';
} else if (tpt.top > $(window).scrollTop()) { } else if (tpt.top > $(window).scrollTop()) {
placement = 'top' placement = 'top';
} else if (tpt.top > $(window).scrollTop()) { } else if (tpt.top > $(window).scrollTop()) {
placement = 'bottom' placement = 'bottom';
} else { } else {
placement = 'right' placement = 'right';
} }
} }
break break;
case 'right': case 'right':
if ((tpr.left + actualWidth) > ($(window).scrollLeft() + $(window).width())) { if ((tpr.left + actualWidth) > ($(window).scrollLeft() + $(window).width())) {
if (tpl.left > $(window).scrollLeft()) { if (tpl.left > $(window).scrollLeft()) {
placement = 'left' placement = 'left';
} else if (tpt.top > $(window).scrollTop()) { } else if (tpt.top > $(window).scrollTop()) {
placement = 'top' placement = 'top';
} else if (tpt.top > $(window).scrollTop()) { } else if (tpt.top > $(window).scrollTop()) {
placement = 'bottom' placement = 'bottom';
} }
} }
break break;
} }
switch (placement) { switch (placement) {
case 'bottom': case 'bottom':
tp = tpb; tp = tpb;
break break;
case 'top': case 'top':
tp = tpt; tp = tpt;
break break;
case 'left': case 'left':
tp = tpl; tp = tpl;
break break;
case 'right': case 'right':
tp = tpr; tp = tpr;
break break;
} }
$tip $tip
.offset(tp) .offset(tp)