r57830 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57829‎ | r57830 | r57831 >
Date:19:35, 16 October 2009
Author:nimishg
Status:ok
Tags:
Comment:
fully functional special:clicktracking tool
Modified paths:
  • /trunk/extensions/UsabilityInitiative/ClickTracking/SpecialClickTracking.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/ClickTracking/SpecialClickTracking.js
@@ -78,11 +78,11 @@
7979
8080 var setContribs = function(conditionArray, contribName){
8181
82 - initialDiv = $("<div>").attr("id", contribName +"_div");
 82+ initialDiv = $("<div></div>").attr("id", contribName +"_div");
8383 initialDiv.addClass("checkbox_div");
8484 initialDiv.addClass("control_div");
8585
86 - textDiv = $("<div>").attr("id", contribName +"_text_div");
 86+ textDiv = $("<div></div>").attr("id", contribName +"_text_div");
8787 mainCheckbox = $("<input>").attr("id", contribName +"_checkbox");
8888 mainCheckbox.attr("type", "checkbox");
8989 mainCheckbox.addClass("user_def_checkbox");
@@ -100,12 +100,12 @@
101101
102102
103103 var buildConditionDiv = function (condition, counter, isChecked){
104 - conditionDiv = $("<div>").attr("id", contribName + "_range_" + counter + "_div");
 104+ conditionDiv = $("<div></div>").attr("id", contribName + "_range_" + counter + "_div");
105105 conditionDiv.addClass("checkbox_div");
106106 conditionDiv.addClass("sub_option_div");
107107
108108 //initialDiv.append(conditionDiv);
109 - cCheckbox = $("<input>").attr("id", contribName+"_"+counter+"_checkbox");
 109+ cCheckbox = $("<input></input>").attr("id", contribName+"_"+counter+"_checkbox");
110110 cCheckbox.attr("type", "checkbox");
111111 if(isChecked){
112112 cCheckbox.attr("checked", true);
@@ -113,10 +113,10 @@
114114 cCheckbox.addClass("number_select_checkbox");
115115 conditionDiv.append(cCheckbox);
116116
117 - cSelect = $("<select>").attr("id", contribName+"_"+counter+"_ltgt");
 117+ cSelect = $("<select></select>").attr("id", contribName+"_"+counter+"_ltgt");
118118 cSelect.addClass("number_select_ltgt");
119119
120 - cOpt1 = $("<option>").attr("id", contribName+"_"+counter+"_lt");
 120+ cOpt1 = $("<option></option>").attr("id", contribName+"_"+counter+"_lt");
121121 cOpt1.addClass("number_select_ltgt_opt");
122122 cOpt1.attr("value", "lt");
123123 cOpt1.text("<");
@@ -125,7 +125,7 @@
126126 }
127127
128128
129 - cOpt2 = $("<option>").attr("id", contribName+"_"+counter+"_gt");
 129+ cOpt2 = $("<option></option>").attr("id", contribName+"_"+counter+"_gt");
130130 cOpt2.addClass("number_select_ltgt_opt");
131131 cOpt2.attr("value", "gt");
132132 cOpt2.text(">");
@@ -133,7 +133,7 @@
134134 cOpt2.attr("selected", true);
135135 }
136136
137 - cOpt3 = $("<option>").attr("id", contribName+"_"+counter+"_lteq");
 137+ cOpt3 = $("<option></option>").attr("id", contribName+"_"+counter+"_lteq");
138138 cOpt3.addClass("number_select_ltgt_opt");
139139 cOpt3.attr("value", "lteq");
140140 cOpt3.text("<=");
@@ -141,7 +141,7 @@
142142 cOpt3.attr("selected", true);
143143 }
144144
145 - cOpt4 = $("<option>").attr("id", contribName+"_"+counter+"_gteq");
 145+ cOpt4 = $("<option></option>").attr("id", contribName+"_"+counter+"_gteq");
146146 cOpt4.addClass("number_select_ltgt_opt");
147147 cOpt4.attr("value", "gteq");
148148 cOpt4.text(">=");
@@ -155,7 +155,7 @@
156156 cSelect.append(cOpt4);
157157 conditionDiv.append(cSelect);
158158
159 - cTextInput = $("<input>").attr("id", contribName+"_"+counter+"_text");
 159+ cTextInput = $("<input></input>").attr("id", contribName+"_"+counter+"_text");
160160 cTextInput.addClass("number_select_text");
161161 cTextInput.attr('value', condition["value"]);
162162 conditionDiv.append(cTextInput);
@@ -170,7 +170,7 @@
171171 initialDiv.append(conditionDiv);
172172 } //forloop
173173 initialDiv.data("totalConditions", i);
174 - addConditions = $("<div>").attr("id", contribName+"_addbutton");
 174+ addConditions = $("<div></div>").attr("id", contribName+"_addbutton");
175175 addConditions.data("contribName", contribName);
176176 addConditions.addClass("add_condition_button");
177177 addConditions.text("+");
@@ -293,6 +293,7 @@
294294 $.colorizeTable = function (){
295295 //expert
296296
 297+
297298 //get totals
298299 var expert_total = 0;
299300
@@ -367,37 +368,42 @@
368369 $.updateTable = function(){
369370
370371 var processTableJSON = function(data, status){
371 - $("#clicktrack_data_table").empty();
 372+
 373+ //clear
 374+ $(".table_data_row").each(function(){ $(this).remove();});
 375+
372376 var row_count = 0;
373 - for( var row in data['tablevals']['vals']){
 377+ for( var row_iter in data['tablevals']['vals']){
 378+ var row = data['tablevals']['vals'][row_iter]; //really, JS?
374379 row_count++;
375 - var outputRow = $("<tr>");
 380+
 381+ var outputRow = $("<tr></tr>");
376382 outputRow.addClass("table_data_row");
377383
378 - var cell =$("<td>").attr("id", "event_name_" + row_count);
 384+ var cell =$("<td></td>").attr("id", "event_name_" + row_count);
379385 cell.addClass("event_name");
380386 cell.attr("value", row['event_id']);
381 - cell.append(row['event_name']);
382 -
 387+ cell.text(row['event_name']);
383388 outputRow.append(cell);
384389
385390 var createClassCell = function(userclass){
386 - var newcell = $("<td>").attr("id", "event_"+userclass+"_" + row_count);
 391+ var newcell = $("<td></td>").attr("id", "event_"+userclass+"_" + row_count);
387392 newcell.addClass("event_data");
388393 newcell.addClass(userclass+"_data");
389 - newcell.append(row[userclass]);
 394+ newcell.text(row[userclass]);
 395+ newcell.attr("value", row[userclass]);
390396 outputRow.append(newcell);
 397+
391398 };
392399
393400 createClassCell("expert");
394401 createClassCell("intermediate");
395402 createClassCell("basic");
396403 createClassCell("total");
397 -
398404 $("#clicktrack_data_table").append(outputRow);
399405 }
 406+
400407 $.colorizeTable();
401 -
402408 };
403409
404410

Status & tagging log