##// END OF EJS Templates
never use `for (var i in array)`...
MinRK -
Show More
@@ -234,7 +234,7 b' var IPython = (function (IPython) {'
234 *
234 *
235 */
235 */
236 CellToolbar.rebuild_all = function(){
236 CellToolbar.rebuild_all = function(){
237 for(var i in CellToolbar._instances){
237 for(var i=0; i < CellToolbar._instances.length; i++){
238 CellToolbar._instances[i].rebuild();
238 CellToolbar._instances[i].rebuild();
239 }
239 }
240 };
240 };
@@ -252,8 +252,8 b' var IPython = (function (IPython) {'
252 var callbacks = CellToolbar._callback_dict;
252 var callbacks = CellToolbar._callback_dict;
253 var preset = CellToolbar._ui_controls_list;
253 var preset = CellToolbar._ui_controls_list;
254 // Yes we iterate on the class variable, not the instance one.
254 // Yes we iterate on the class variable, not the instance one.
255 for (var index in preset) {
255 for (var i=0; i < preset.length; i++) {
256 var key = preset[index];
256 var key = preset[i];
257 var callback = callbacks[key];
257 var callback = callbacks[key];
258 if (!callback) continue;
258 if (!callback) continue;
259
259
@@ -380,10 +380,10 b' var IPython = (function (IPython) {'
380 var button_container = $(div);
380 var button_container = $(div);
381 var lbl = $("<label/>").append($('<span/>').text(label));
381 var lbl = $("<label/>").append($('<span/>').text(label));
382 var select = $('<select/>').addClass('ui-widget ui-widget-content');
382 var select = $('<select/>').addClass('ui-widget ui-widget-content');
383 for(var itemn in list_list){
383 for(var i=0; i < list_list.length; i++){
384 var opt = $('<option/>')
384 var opt = $('<option/>')
385 .attr('value', list_list[itemn][1])
385 .attr('value', list_list[i][1])
386 .text(list_list[itemn][0]);
386 .text(list_list[i][0]);
387 select.append(opt);
387 select.append(opt);
388 }
388 }
389 select.val(getter(cell));
389 select.val(getter(cell));
@@ -13,15 +13,16 b' var IPython = (function (IPython) {'
13 str = '%'+str ;
13 str = '%'+str ;
14 }
14 }
15 return str;
15 return str;
16 }
16 };
17
17
18 function _existing_completion(item, completion_array){
18 function _existing_completion(item, completion_array){
19 for( var c in completion_array ) {
19 for( var i=0; i < completion_array.length; i++) {
20 if(completion_array[c].trim().substr(-item.length) == item)
20 if (completion_array[i].trim().substr(-item.length) == item) {
21 { return true; }
21 return true;
22 }
22 }
23 }
23 return false;
24 return false;
24 }
25 };
25
26
26 // what is the common start of all completions
27 // what is the common start of all completions
27 function shared_start(B, drop_prct) {
28 function shared_start(B, drop_prct) {
@@ -164,9 +165,9 b' var IPython = (function (IPython) {'
164 var filtered_results = [];
165 var filtered_results = [];
165 //remove results from context completion
166 //remove results from context completion
166 //that are already in kernel completion
167 //that are already in kernel completion
167 for (var elm in results) {
168 for (var i=0; i < results.length; i++) {
168 if (!_existing_completion(results[elm].str, matches)) {
169 if (!_existing_completion(results[i].str, matches)) {
169 filtered_results.push(results[elm]);
170 filtered_results.push(results[i]);
170 }
171 }
171 }
172 }
172
173
@@ -503,8 +503,8 b' var IPython = (function (IPython) {'
503 };
503 };
504
504
505 OutputArea.prototype.append_mime_type = function (json, element, handle_inserted) {
505 OutputArea.prototype.append_mime_type = function (json, element, handle_inserted) {
506 for (var type_i in OutputArea.display_order) {
506 for (var i=0; i < OutputArea.display_order.length; i++) {
507 var type = OutputArea.display_order[type_i];
507 var type = OutputArea.display_order[i];
508 var append = OutputArea.append_map[type];
508 var append = OutputArea.append_map[type];
509 if ((json[type] !== undefined) && append) {
509 if ((json[type] !== undefined) && append) {
510 var value = json[type];
510 var value = json[type];
@@ -65,20 +65,22 b' var IPython = (function (IPython) {'
65 */
65 */
66 ToolBar.prototype.add_buttons_group = function (list, group_id) {
66 ToolBar.prototype.add_buttons_group = function (list, group_id) {
67 var btn_group = $('<div/>').addClass("btn-group");
67 var btn_group = $('<div/>').addClass("btn-group");
68 if( group_id != undefined ) {
68 if( group_id !== undefined ) {
69 btn_group.attr('id',group_id);
69 btn_group.attr('id',group_id);
70 }
70 }
71 for(var el in list) {
71 var el;
72 for(var i=0; i < list.length; i++) {
73 el = list[i];
72 var button = $('<button/>')
74 var button = $('<button/>')
73 .addClass('btn')
75 .addClass('btn')
74 .attr("title", list[el].label)
76 .attr("title", el.label)
75 .append(
77 .append(
76 $("<i/>").addClass(list[el].icon)
78 $("<i/>").addClass(el.icon)
77 );
79 );
78 var id = list[el].id;
80 var id = el.id;
79 if( id != undefined )
81 if( id !== undefined )
80 button.attr('id',id);
82 button.attr('id',id);
81 var fun = list[el].callback;
83 var fun = el.callback;
82 button.click(fun);
84 button.click(fun);
83 btn_group.append(button);
85 btn_group.append(button);
84 }
86 }
@@ -96,7 +98,7 b' var IPython = (function (IPython) {'
96 */
98 */
97 ToolBar.prototype.toggle = function () {
99 ToolBar.prototype.toggle = function () {
98 this.element.toggle();
100 this.element.toggle();
99 if (IPython.layout_manager != undefined) {
101 if (IPython.layout_manager !== undefined) {
100 IPython.layout_manager.do_resize();
102 IPython.layout_manager.do_resize();
101 }
103 }
102 };
104 };
General Comments 0
You need to be logged in to leave comments. Login now