Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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