Subversion Repositories SmartDukaan

Rev

Rev 4372 | Rev 4922 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4372 Rev 4798
Line 1... Line 1...
1
$(function(){
1
$(function(){
-
 
2
	
-
 
3
	function updateCompareCount()	{
-
 
4
		$('#research_compare_count').html($('#myresearch input[type="checkbox"]:checked').length);
-
 
5
	}
-
 
6
	
2
	/** Sidebar Widgets **/
7
	/** Sidebar Widgets **/
3
	
8
	
4
	$('#shoppingExpInfo').click(function(){
9
	$('#shoppingExpInfo').click(function(){
5
		$.colorbox({
10
		$.colorbox({
6
    		width: "550px",
11
    		width: "550px",
Line 44... Line 49...
44
	
49
	
45
	/**
50
	/**
46
	 * Update count of products checked for comparison
51
	 * Update count of products checked for comparison
47
	 **/
52
	 **/
48
	$('#myresearch input[type="checkbox"]').live('click', function(){
53
	$('#myresearch input[type="checkbox"]').live('click', function(){
49
		$('#research_compare_count').html($('#myresearch input[type="checkbox"]:checked').length);
54
		updateCompareCount();
50
	});
55
	});
51
	
56
	
52
	$("#research_compare").live('click', function(){
57
	$("#research_compare").live('click', function(){
53
		var seldata = "";
58
		var seldata = "";
54
		var tot = 1;
59
		var tot = 1;
Line 162... Line 167...
162
					load_history_widget();
167
					load_history_widget();
163
				}
168
				}
164
			}
169
			}
165
		}
170
		}
166
	}
171
	}
-
 
172
	
-
 
173
	function load_research_items(){
-
 
174
		jQuery.ajax({
-
 
175
			type: "GET",
-
 
176
			url: "/myresearch",
-
 
177
			cache: false,
-
 
178
			success: function(json) {
-
 
179
			    $.Storage.set("resitems", json);
-
 
180
			    load_research_widget();
-
 
181
		    }
-
 
182
		});
-
 
183
	}
-
 
184
 
-
 
185
	function load_research_widget(){
-
 
186
		var myResearchWidgetContainer = $("#myresearch");
-
 
187
		
-
 
188
		if($(myResearchWidgetContainer).length == 0) {
-
 
189
			return;
-
 
190
		}
-
 
191
		var resitems = $.Storage.get("resitems");
-
 
192
		
-
 
193
		if (resitems == "[]") {
-
 
194
			var emptyResWidgetHtml = '<table border="0" width="100%" cellspacing="1" cellpadding="0" id="research_default">\
-
 
195
		      <tbody>\
-
 
196
		        <tr><td align="center"><b>Add items to compare list</b></td></tr>\
-
 
197
		       </tbody>\
-
 
198
		      </table>';
-
 
199
			$(myResearchWidgetContainer).find(".common-widget-content-area").html(emptyResWidgetHtml);
-
 
200
			$(myResearchWidgetContainer).children(".common-widget-top-bar").trigger('click');
-
 
201
			return;
-
 
202
		}
-
 
203
		var params = "/" + resitems;
-
 
204
		
-
 
205
		jQuery.ajax({
-
 
206
			type : "GET",
-
 
207
			url : "/myresearch" + params,
-
 
208
			cache: true,
-
 
209
			success : function(html) {
-
 
210
	   		    $("#myresearch").html(html);
-
 
211
	   			updateCompareCount();
-
 
212
 
-
 
213
			    // Product Title
-
 
214
			    $("#myresearch table td div a.truncate").each(function() {
-
 
215
						$(this).truncate({addtitle : true});
-
 
216
			    });
-
 
217
 
-
 
218
			    // Product Price
-
 
219
			    $("#myresearch table td div div.price").each(function() {
-
 
220
						$(this).truncate({addtitle : true});
-
 
221
				});
-
 
222
 
-
 
223
			    // Product Details
-
 
224
			    $("#myresearch table td div div.text").each(function() {
-
 
225
						$(this).truncate( {addtitle : true});
-
 
226
				});
-
 
227
		    }
-
 
228
		});
-
 
229
	}
167
});
230
});
168
231