| 7272 |
amit.gupta |
1 |
function hideSlides(){
|
|
|
2 |
$('.comparision-hide').each(function(){
|
|
|
3 |
this.style.display = 'none';
|
|
|
4 |
});
|
|
|
5 |
var styleTrack = $('.jspTrack').attr('style');
|
|
|
6 |
$('.jspTrackbottom').attr('style', styleTrack);
|
|
|
7 |
var styleDrag = $('.jspDrag').attr('style');
|
|
|
8 |
$('.jspDragbottom').attr('style', styleDrag);
|
|
|
9 |
}
|
|
|
10 |
|
|
|
11 |
function renderComparison(){
|
|
|
12 |
var SelectID;
|
|
|
13 |
var subtract;
|
|
|
14 |
var check = 0;
|
|
|
15 |
var count = $('.comparision-product-column').length;
|
|
|
16 |
if(count < 4) {
|
|
|
17 |
if(count == 3) {
|
|
|
18 |
subtract = 6;
|
|
|
19 |
} else if(count == 2) {
|
|
|
20 |
subtract = 3;
|
|
|
21 |
} else {
|
|
|
22 |
subtract = 0;
|
|
|
23 |
}
|
|
|
24 |
var parentWidth = $('#comparision-right').width();
|
|
|
25 |
var width = (parentWidth - subtract)/count;
|
|
|
26 |
var newWidth = parseInt(width);
|
|
|
27 |
$('.product-name').width(newWidth);
|
|
|
28 |
$('.comparision-product-column').width(newWidth);
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
$('.ui-state-default').click(function(){
|
|
|
32 |
if(typeof api !== 'undefined'){
|
|
|
33 |
api.destroy();
|
|
|
34 |
}
|
|
|
35 |
var aID = $("li.ui-state-active").children('a:first').attr('href');
|
|
|
36 |
var array = aID.split("#");
|
|
|
37 |
var displayID = array[1];
|
|
|
38 |
var new_aID = $(this).children('a:first').attr('href');
|
|
|
39 |
var new_array = new_aID.split("#");
|
|
|
40 |
var new_displayID = new_array[1];
|
|
|
41 |
$('.'+displayID).each(function(){
|
|
|
42 |
this.style.display = 'none';
|
|
|
43 |
$(this).removeClass("comparision-block").addClass('comparision-hide');
|
|
|
44 |
});
|
|
|
45 |
if(new_displayID == 'vtab-summary') {
|
|
|
46 |
$('#comparision-right').removeClass("product-comparision-internal").addClass('product-comparision-home');
|
|
|
47 |
$('.scroller-columns').hide();
|
|
|
48 |
$('#comparision-summary-content').show();
|
|
|
49 |
$('.comparision-page-title').hide();
|
|
|
50 |
} else {
|
|
|
51 |
$('#comparision-right').removeClass("product-comparision-home").addClass('product-comparision-internal');
|
|
|
52 |
$('.scroller-columns').show();
|
|
|
53 |
$('#comparision-summary-content').hide();
|
|
|
54 |
$('.comparision-page-title').show();
|
|
|
55 |
}
|
|
|
56 |
$('.comparision-page-title').html(this.title);
|
|
|
57 |
$('.ui-state-active').removeClass("ui-tabs-selected ui-state-active");
|
|
|
58 |
$(this).addClass("ui-tabs-selected ui-state-active");
|
|
|
59 |
$('.'+new_displayID).each(function() {
|
|
|
60 |
var new_count = $('.'+new_displayID).length;
|
|
|
61 |
if(new_count !== count) {
|
|
|
62 |
$('.comparision-product-column').each(function(){
|
|
|
63 |
var check_childern = $(this).find('.'+new_displayID).html();
|
|
|
64 |
if(check_childern == null && check == 0) {
|
|
|
65 |
$(this).append("<div class='"+new_displayID+" comparision-hide comparision-empty-column'><div class='featureslisting'><ul><li class='mainFeature'>No features listed for this category.</li></ul></div></div>");
|
|
|
66 |
check = 1;
|
|
|
67 |
}
|
|
|
68 |
});
|
|
|
69 |
}
|
|
|
70 |
$(this).removeClass("comparision-hide").addClass('comparision-block');
|
|
|
71 |
check = 0;
|
|
|
72 |
this.style.display = 'block';
|
|
|
73 |
});
|
|
|
74 |
|
|
|
75 |
var maxHeight = 0;
|
|
|
76 |
$('.comparision-block .inner-column .featureslisting').each(function(){
|
|
|
77 |
maxHeight = $(this).height() > maxHeight ? $(this).height() : maxHeight;
|
|
|
78 |
});
|
|
|
79 |
maxHeight = Math.max(maxHeight + 10, $(".comparision-product-column").height());
|
|
|
80 |
rightHeight = maxHeight + 177;
|
|
|
81 |
var leftHeight = $("#sideNav").height() + 25;
|
|
|
82 |
|
|
|
83 |
adjustHeights(Math.max(leftHeight, rightHeight));
|
|
|
84 |
if(typeof pane !== 'undefined'){
|
|
|
85 |
pane = $(selector).jScrollPane({showArrows:true});
|
|
|
86 |
api = pane.data('jsp');
|
|
|
87 |
}
|
|
|
88 |
return false;
|
|
|
89 |
});
|
|
|
90 |
|
|
|
91 |
var count_item_rows = $('.summarypage-row').length;
|
|
|
92 |
var total_column = $('.column-score-total').length;
|
|
|
93 |
var cols_row = count_item_rows - total_column;
|
|
|
94 |
$(".summary-dropdown").change(function(){
|
|
|
95 |
var product_values = '';
|
|
|
96 |
var item_Value = this.value;
|
|
|
97 |
var item_data = Array();
|
|
|
98 |
var importance_data = Array();
|
|
|
99 |
var column_count = $('.summary-column').length;
|
|
|
100 |
|
|
|
101 |
SelectID = this.id;
|
|
|
102 |
|
|
|
103 |
for(i = 0; i < total_column; i++){
|
|
|
104 |
item_data[i] = Array();
|
|
|
105 |
var Scores = '';
|
|
|
106 |
var k = i + 1;
|
|
|
107 |
var j = 0;
|
|
|
108 |
$('.product-'+k).each(function(){
|
|
|
109 |
var items_html = $(this).html();
|
|
|
110 |
if(items_html !== null) {
|
|
|
111 |
Scores += items_html+'::';
|
|
|
112 |
}
|
|
|
113 |
item_data[i][j] = parseFloat(items_html);
|
|
|
114 |
j++;
|
|
|
115 |
});
|
|
|
116 |
}
|
|
|
117 |
var items_total = 'itemvalue='+item_Value+'&column='+column_count+'&total='+total_column+'&data='+product_values;
|
|
|
118 |
|
|
|
119 |
var i = 0;
|
|
|
120 |
$('.summary-dropdown').each(function(){
|
|
|
121 |
importance_data[i] = parseInt($(this).val());
|
|
|
122 |
i++;
|
|
|
123 |
});
|
|
|
124 |
|
|
|
125 |
var item = "";
|
|
|
126 |
for(i = 0; i < total_column; i++){
|
|
|
127 |
var commulative_weighted_score = 0.0;
|
|
|
128 |
var commulative_weights = 0.0;
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
for (var j = 0; j < importance_data.length; j++){
|
|
|
132 |
if(importance_data[j] == 1){
|
|
|
133 |
commulative_weighted_score += item_data[i][j]*55;
|
|
|
134 |
commulative_weights += 55;
|
|
|
135 |
}
|
|
|
136 |
if(importance_data[j] == 2){
|
|
|
137 |
commulative_weighted_score += item_data[i][j]*30;
|
|
|
138 |
commulative_weights += 30;
|
|
|
139 |
}
|
|
|
140 |
if(importance_data[j] == 3){
|
|
|
141 |
commulative_weighted_score += item_data[i][j]*15;
|
|
|
142 |
commulative_weights += 15;
|
|
|
143 |
}
|
|
|
144 |
}
|
|
|
145 |
var weighted_score = commulative_weighted_score/commulative_weights;
|
|
|
146 |
weighted_score = Math.round(weighted_score*Math.pow(10,1))/Math.pow(10,1);
|
|
|
147 |
|
|
|
148 |
item += weighted_score + ' / 10::';
|
|
|
149 |
}
|
|
|
150 |
|
|
|
151 |
var items_break = '';
|
|
|
152 |
items_break = item.split('::');
|
|
|
153 |
for(i = 0; i < items_break.length; i++){
|
|
|
154 |
var incre = i+1;
|
|
|
155 |
var class_name = '.score-total-'+incre;
|
|
|
156 |
$(class_name).html(items_break[i]);
|
|
|
157 |
|
|
|
158 |
}
|
|
|
159 |
});
|
|
|
160 |
$('.scroller-columns').hide();
|
|
|
161 |
$('.comparision-page-title').hide();
|
|
|
162 |
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
function adjustHeights(h) {
|
|
|
166 |
$('#slideGuideNav').height(h);
|
|
|
167 |
var feat = $('.comparision-block .inner-column .featureslisting');
|
|
|
168 |
if(!feat.attr("adjusted")) {
|
|
|
169 |
feat.attr("adjusted", "adjusted").height(h - 177);
|
|
|
170 |
|
|
|
171 |
}
|
|
|
172 |
$('#comparision-right .mk_seperator').height(h - 177);
|
|
|
173 |
$('#comparision-right').height(h);
|
|
|
174 |
|
|
|
175 |
}
|