| 538 |
rajveer |
1 |
$(document).ready(function(){
|
|
|
2 |
|
|
|
3 |
/* Widget */
|
|
|
4 |
if($("#sidebar:visible").length == 1){
|
|
|
5 |
|
|
|
6 |
// Product Title
|
|
|
7 |
$(".lightbox table td div a").each(function(){
|
|
|
8 |
var str = charLimit($(this), $(this).text(), 1, 17);
|
|
|
9 |
$(this).text(str);
|
|
|
10 |
});
|
|
|
11 |
|
|
|
12 |
// Product Price
|
|
|
13 |
$(".lightbox table td div div.price").each(function(){
|
|
|
14 |
var str = charLimit($(this), $(this).text(), 1, 21);
|
|
|
15 |
$(this).text(str);
|
|
|
16 |
});
|
|
|
17 |
|
|
|
18 |
// Product Details
|
|
|
19 |
$(".lightbox table td div div.text").each(function(){
|
|
|
20 |
var str = charLimit($(this), $(this).text(), 2, 21);
|
|
|
21 |
$(this).text(str);
|
|
|
22 |
});
|
|
|
23 |
}
|
|
|
24 |
|
|
|
25 |
/* Home */
|
|
|
26 |
if($("#products:visible").length == 1){
|
|
|
27 |
|
|
|
28 |
// Product Title
|
|
|
29 |
$(".productItem .productDetails .title a").each(function(){
|
|
|
30 |
var str = charLimit($(this), $(this).text(), 2, 20);
|
|
|
31 |
$(this).text(str);
|
|
|
32 |
});
|
|
|
33 |
|
|
|
34 |
// Product Description
|
|
|
35 |
$(".productItem .productDetails .productDesp").each(function(){
|
|
|
36 |
if($("ul", this).length != 1){
|
|
|
37 |
var str = charLimit($(this), $(this).text(), 5, 24);
|
|
|
38 |
$(this).text(str);
|
|
|
39 |
}
|
|
|
40 |
});
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
/* Product Category : Browse Tab */
|
|
|
44 |
if($("#browseContent:visible").length == 1){
|
|
|
45 |
|
|
|
46 |
// Product Title
|
|
|
47 |
$(".productItem .productDetails .title a").each(function(){
|
|
|
48 |
var str = charLimit($(this), $(this).text(), 2, 20);
|
|
|
49 |
$(this).text(str);
|
|
|
50 |
});
|
|
|
51 |
|
|
|
52 |
// Product Description
|
|
|
53 |
$(".productItem .productDetails .productDesp").each(function(){
|
|
|
54 |
if($("ul", this).length != 1){
|
|
|
55 |
var str = charLimit($(this), $(this).text(), 5, 24);
|
|
|
56 |
$(this).text(str);
|
|
|
57 |
}
|
|
|
58 |
});
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
/* Product Category : Other Tab */
|
|
|
62 |
if($("#otherTabContent:visible").length == 1){
|
|
|
63 |
|
|
|
64 |
// Product Title
|
|
|
65 |
$(".productItem .productDetails .title a").each(function(){
|
|
|
66 |
var str = charLimit($(this), $(this).text(), 2, 20);
|
|
|
67 |
$(this).text(str);
|
|
|
68 |
});
|
|
|
69 |
|
|
|
70 |
// Product Description
|
|
|
71 |
$(".productItem .productDetails .productDesp").each(function(){
|
|
|
72 |
if($("ul", this).length != 1){
|
|
|
73 |
var str = charLimit($(this), $(this).text(), 5, 24);
|
|
|
74 |
$(this).text(str);
|
|
|
75 |
}
|
|
|
76 |
});
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
/* Search Result */
|
|
|
80 |
if($("#searchResult:visible").length == 1){
|
|
|
81 |
|
|
|
82 |
// Product Title
|
|
|
83 |
$(".productItem .productDetails .title a").each(function(){
|
|
|
84 |
var str = charLimit($(this), $(this).text(), 2, 32);
|
|
|
85 |
$(this).text(str);
|
|
|
86 |
});
|
|
|
87 |
|
|
|
88 |
// Product Description
|
|
|
89 |
$(".productItem .productDetails .productDesp").each(function(){
|
|
|
90 |
if($("ul", this).length != 1){
|
|
|
91 |
var str = charLimit($(this), $(this).text(), 4, 40);
|
|
|
92 |
$(this).text(str);
|
|
|
93 |
}
|
|
|
94 |
});
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
});
|
|
|
99 |
|
|
|
100 |
/*
|
|
|
101 |
* param : selector, characters, no. of lines, each line char limit
|
|
|
102 |
*/
|
|
|
103 |
function charLimit(selector, char, line, limit){
|
|
|
104 |
var temp = "";
|
|
|
105 |
var str = jQuery.trim(char);
|
|
|
106 |
var len = str.length;
|
|
|
107 |
|
|
|
108 |
limit = line * limit;
|
|
|
109 |
|
|
|
110 |
if(len > limit){
|
|
|
111 |
$(selector).attr("title", str);
|
|
|
112 |
temp = str.substr(0, limit-3) + "...";
|
|
|
113 |
|
|
|
114 |
return temp;
|
|
|
115 |
}else{
|
|
|
116 |
return str;
|
|
|
117 |
}
|
|
|
118 |
}
|