MAID: make code look cleaner

This commit is contained in:
walljm 2017-01-28 11:47:10 -05:00
parent e6a3d1b2c0
commit 55effbef56

View File

@ -39,42 +39,32 @@ export class Words implements AfterViewChecked, OnInit
if (wr.scrollWidth < 500) // 1 col if (wr.scrollWidth < 500) // 1 col
{ {
// 5 rows // 5 rows
len < 6 ? $(el).css("height", len * 44.4 + 25) : $(el).css("height", 250); len < 6 ? $(el).css("height", len * 44.4 + 25) : $(el).css("height", 250);
} }
else if (wr.scrollWidth < 699) // 2 col else if (wr.scrollWidth < 699) // 2 col
{ {
if (len < 13) // 6 rows // 6 rows
$(el).css("height", Math.ceil(len / 2) * 44.4 + 25); len < 13 ? $(el).css("height", Math.ceil(len / 2) * 44.4 + 25) : $(el).css("height", 300);
else
$(el).css("height", 300);
} }
else if (wr.scrollWidth < 799) // 3 col else if (wr.scrollWidth < 799) // 3 col
{ {
if (len < 22) // 7 rows // 7 rows
$(el).css("height", Math.ceil(len / 3) * 44.4 + 25); len < 22 ? $(el).css("height", Math.ceil(len / 3) * 44.4 + 25) : $(el).css("height", 350);
else
$(el).css("height", 350);
} }
else if (wr.scrollWidth < 899) // 4 col else if (wr.scrollWidth < 899) // 4 col
{ {
if (len < 29) // 7 rows // 7 rows
$(el).css("height", Math.ceil(len / 4) * 44.4 + 25); len < 29 ? $(el).css("height", Math.ceil(len / 4) * 44.4 + 25) : $(el).css("height", 375);
else
$(el).css("height", 350);
} }
else if (wr.scrollWidth < 1199) // 5 col else if (wr.scrollWidth < 1199) // 5 col
{ {
if (len < 41) // 8 rows // 8 rows
$(el).css("height", Math.ceil(len / 5) * 44.4 + 25); len < 41 ? $(el).css("height", Math.ceil(len / 5) * 44.4 + 25) : $(el).css("height", 400);
else
$(el).css("height", 400);
} }
else // 6 col else // 6 col
{ {
if (len < 49) // 8 rows // 8 rows
$(el).css("height", Math.ceil(len / 6) * 44.4 + 25); len < 49 ? $(el).css("height", Math.ceil(len / 6) * 44.4 + 25) : $(el).css("height", 425);
else
$(el).css("height", 400);
} }
}); });
} }