Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 407d1f6

Browse files
committed
eliminate tabs!!
1 parent 90cbc77 commit 407d1f6

File tree

8 files changed

+383
-355
lines changed

8 files changed

+383
-355
lines changed

CONTRIBUTING.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Contributing to the Runestone Components
2+
========================================
3+
4+
We welcome contributions through pull requests to the Runestone Components.
5+
6+
Understand the RoadMap
7+
----------------------
8+
9+
You should look at the [development road map](https://github.com/bnmnetp/runestone/wiki/DevelopmentRoadmap)
10+
and especially RSE-0001 which gives you a clear idea of the current philosophy behind the components. Any
11+
Sphinx directives should create very simple html and let Javascript take care of the rest.
12+
13+
Coding Standards
14+
----------------
15+
16+
* All components must remain Python 3/2 compatible. The ``six`` module is already
17+
in the requirements.txt file, so feel free to use that.
18+
* No Tabs
19+
* Avoid profliferation of jQuery versions. Make your stuff compatible with the version
20+
of jQuery in the common folder.
21+
* Avoid proliferation of additional third party javascript modules. We are already out of
22+
control in this regard and it would be nice to rein it in.
23+
24+
25+
Provide an example
26+
------------------
27+
28+
The folder ``runestone/common/project_template/_sources`` folder is a great place to add a file
29+
that demonstrates your new feature or component in action.

runestone/activecode/activecode.py

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -113,44 +113,44 @@ def setup(app):
113113
$('#%(divid)s_loadb').toggle();
114114
}
115115
if ($("#%(divid)s").attr("lang") !== "html" && $("#%(divid)s_code_div").parents(".admonition").length == 0 && $("#%(divid)s_code_div").parents("#exercises").length == 0){
116-
if ($(window).width() > 975){
117-
$("#%(divid)s_code_div").offset({
118-
left: $("#%(divid)s .clearfix").offset().left
119-
});
120-
}
121-
$("#%(divid)s_runb").one("click", function(){
122-
$({})
123-
.queue(function (next) {
124-
if ($(window).width() > 975){
125-
$("#%(divid)s_code_div").animate({
126-
left: 40
127-
}, 500, next);
116+
if ($(window).width() > 975){
117+
$("#%(divid)s_code_div").offset({
118+
left: $("#%(divid)s .clearfix").offset().left
119+
});
120+
}
121+
$("#%(divid)s_runb").one("click", function(){
122+
$({})
123+
.queue(function (next) {
124+
if ($(window).width() > 975){
125+
$("#%(divid)s_code_div").animate({
126+
left: 40
127+
}, 500, next);
128128
if (! Sk.TurtleGraphics ) {
129129
Sk.TurtleGraphics = {};
130130
}
131131
Sk.TurtleGraphics.height = 320;
132132
Sk.TurtleGraphics.width = 320;
133-
}
134-
else{
135-
next();
136-
}
137-
})
138-
.queue(function (next) {
139-
$("#%(divid)s_runb").parent().siblings(".ac_output").show();
140-
runit('%(divid)s',this, %(include)s);
141-
$("#%(divid)s_runb").on("click", function(){
142-
runit('%(divid)s',this, %(include)s);
143-
});
144-
})
145-
146-
});
133+
}
134+
else{
135+
next();
136+
}
137+
})
138+
.queue(function (next) {
139+
$("#%(divid)s_runb").parent().siblings(".ac_output").show();
140+
runit('%(divid)s',this, %(include)s);
141+
$("#%(divid)s_runb").on("click", function(){
142+
runit('%(divid)s',this, %(include)s);
143+
});
144+
})
145+
146+
});
147147
}
148148
else{
149-
$("#%(divid)s_code_div").css({float : "none", marginLeft : "auto", marginRight : "auto"});
150-
$("#%(divid)s_runb").parent().siblings(".ac_output").show().css({float : "none", right : "0px"});
151-
$("#%(divid)s_runb").on("click", function(){
152-
runit('%(divid)s',this, %(include)s);
153-
});
149+
$("#%(divid)s_code_div").css({float : "none", marginLeft : "auto", marginRight : "auto"});
150+
$("#%(divid)s_runb").parent().siblings(".ac_output").show().css({float : "none", right : "0px"});
151+
$("#%(divid)s_runb").on("click", function(){
152+
runit('%(divid)s',this, %(include)s);
153+
});
154154
}
155155
</script>
156156
'''

runestone/animation/animationrefactor.js

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ DataItem = function(pos, h, col)
77

88
DataItem.prototype.clone=function()
99
{
10-
var newitem = new DataItem(this.position,this.height,this.color) //make a copy
11-
return newitem
10+
var newitem = new DataItem(this.position,this.height,this.color) //make a copy
11+
return newitem
1212
}
1313

1414
DataItem.prototype.getHeight=function()
@@ -47,61 +47,61 @@ SortModel = function() //construct the model
4747

4848
SortModel.prototype.init = function(ctl)
4949
{
50-
this.mycontroller = ctl
50+
this.mycontroller = ctl
5151

52-
this.valuelist = new Array()
53-
var howmany = 50
52+
this.valuelist = new Array()
53+
var howmany = 50
5454

55-
for (var i=0; i<howmany; i++)
56-
{
57-
var min = 5
58-
var max = 300
59-
var y = Math.floor(Math.random() * (max - min + 1)) + min
55+
for (var i=0; i<howmany; i++)
56+
{
57+
var min = 5
58+
var max = 300
59+
var y = Math.floor(Math.random() * (max - min + 1)) + min
6060

61-
var item = new DataItem(i,y,"black")
62-
this.valuelist.push(item)
63-
}
64-
65-
this.script = new Array()
66-
this.script.push(this.makescene())
67-
68-
for (var passnum=this.valuelist.length-1; passnum>0; passnum = passnum-1)
69-
{
70-
for (var i=0; i<passnum; i=i+1)
71-
{
72-
this.valuelist[i].setColor("red")
73-
this.valuelist[i+1].setColor("red")
74-
75-
this.script.push(this.makescene())
76-
77-
if (this.valuelist[i].getHeight() > this.valuelist[i+1].getHeight())
78-
{
79-
80-
var temp = this.valuelist[i]
81-
this.valuelist[i] = this.valuelist[i+1]
82-
this.valuelist[i+1] = temp
83-
84-
this.script.push(this.makescene())
85-
86-
}
87-
88-
this.valuelist[i].setColor("black")
89-
this.valuelist[i+1].setColor("black")
90-
91-
this.script.push(this.makescene())
92-
}
93-
}
94-
95-
return this.script
61+
var item = new DataItem(i,y,"black")
62+
this.valuelist.push(item)
63+
}
64+
65+
this.script = new Array()
66+
this.script.push(this.makescene())
67+
68+
for (var passnum=this.valuelist.length-1; passnum>0; passnum = passnum-1)
69+
{
70+
for (var i=0; i<passnum; i=i+1)
71+
{
72+
this.valuelist[i].setColor("red")
73+
this.valuelist[i+1].setColor("red")
74+
75+
this.script.push(this.makescene())
76+
77+
if (this.valuelist[i].getHeight() > this.valuelist[i+1].getHeight())
78+
{
79+
80+
var temp = this.valuelist[i]
81+
this.valuelist[i] = this.valuelist[i+1]
82+
this.valuelist[i+1] = temp
83+
84+
this.script.push(this.makescene())
85+
86+
}
87+
88+
this.valuelist[i].setColor("black")
89+
this.valuelist[i+1].setColor("black")
90+
91+
this.script.push(this.makescene())
92+
}
93+
}
94+
95+
return this.script
9696
}
9797

9898
SortModel.prototype.makescene = function()
9999
{
100100
var newscene = new Array()
101101
for (var idx=0; idx<this.valuelist.length; idx++)
102102
{
103-
var item = this.valuelist[idx].clone() //make a copy
104-
newscene.push(item)
103+
var item = this.valuelist[idx].clone() //make a copy
104+
newscene.push(item)
105105
}
106106

107107
return newscene
@@ -122,14 +122,14 @@ BarViewer.prototype.init = function(c)
122122

123123
BarViewer.prototype.render = function(ascene)
124124
{
125-
for (var p=0; p<ascene.length; p++)
126-
{
125+
for (var p=0; p<ascene.length; p++)
126+
{
127127
this.ctx.fillStyle=ascene[p].color
128128
this.ctx.fillRect(p*7 + 2,
129129
this.ctx.canvas.height-ascene[p].height,
130130
3,
131131
ascene[p].height)
132-
}
132+
}
133133
}
134134

135135
ListViewer = function() //contruct a list of numbers view
@@ -143,12 +143,12 @@ ListViewer.prototype.init = function(c)
143143

144144
ListViewer.prototype.render = function(ascene)
145145
{
146-
for (var p=0; p<ascene.length; p++)
147-
{
146+
for (var p=0; p<ascene.length; p++)
147+
{
148148
this.ctx.fillStyle=ascene[p].color
149149
this.ctx.fillText(ascene[p].height, p*7 + 2,
150150
this.ctx.canvas.height-ascene[p].height)
151-
}
151+
}
152152
}
153153

154154

runestone/animation/searchmodels.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ DataItem = function(pos, h, col)
77

88
DataItem.prototype.clone=function()
99
{
10-
var newitem = new DataItem(this.position,this.value,this.color) //make a copy
11-
return newitem
10+
var newitem = new DataItem(this.position,this.value,this.color) //make a copy
11+
return newitem
1212
}
1313

1414
DataItem.prototype.getValue=function()
@@ -47,19 +47,19 @@ BinarySearchModel = function() //construct the model
4747

4848
BinarySearchModel.prototype.init = function(ctl)
4949
{
50-
this.mycontroller = ctl
50+
this.mycontroller = ctl
5151

52-
this.valuelist = new Array()
53-
var howmany = 25
52+
this.valuelist = new Array()
53+
var howmany = 25
5454
var initvalues=[25,30,46,55,60,78,90,95,101,110,122,134,145,150,166,175,187,200,205,213,240,255,267,299]
55-
for (var i=0; i<howmany; i++)
56-
{
57-
var item = new DataItem(i,initvalues[i],"black")
58-
this.valuelist.push(item)
59-
}
60-
61-
this.script = new Array()
62-
//this.script.push(this.makescene(this.valuelist))
55+
for (var i=0; i<howmany; i++)
56+
{
57+
var item = new DataItem(i,initvalues[i],"black")
58+
this.valuelist.push(item)
59+
}
60+
61+
this.script = new Array()
62+
//this.script.push(this.makescene(this.valuelist))
6363

6464
this.binarySearch(this.valuelist,200)
6565

@@ -129,8 +129,8 @@ BinarySearchModel.prototype.makescene = function(somearray)
129129
var newscene = new Array()
130130
for (var idx=0; idx<somearray.length; idx++)
131131
{
132-
var item = somearray[idx].clone() //make a copy
133-
newscene.push(item)
132+
var item = somearray[idx].clone() //make a copy
133+
newscene.push(item)
134134
}
135135

136136
return newscene

runestone/animation/sortingdemo.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ BarList.prototype.size = function()
2121

2222
BarList.prototype.show = function(c)
2323
{
24-
for (var idx=0; idx<this.howmany; idx++)
25-
{
26-
this.bars[idx].show(this.c)
27-
}
24+
for (var idx=0; idx<this.howmany; idx++)
25+
{
26+
this.bars[idx].show(this.c)
27+
}
2828
}
2929

3030

@@ -38,10 +38,10 @@ Bar = function(pos, h, col)
3838

3939
Bar.prototype.clone=function()
4040
{
41-
var newbar = new Bar() //make a copy
42-
newbar.setHeight(this.getHeight())
43-
newbar.setPosition(this.getPosition())
44-
newbar.setColor(this.getColor())
41+
var newbar = new Bar() //make a copy
42+
newbar.setHeight(this.getHeight())
43+
newbar.setPosition(this.getPosition())
44+
newbar.setColor(this.getColor())
4545
return newbar
4646
}
4747

@@ -193,10 +193,10 @@ SortingAnimation.prototype.render = function(framenum)
193193
var currentframe = this.framelist[framenum]
194194
this.sc.width = this.sc.width
195195

196-
for (var idx=0; idx<currentframe.length; idx++)
197-
{
198-
currentframe[idx].show(this.ctx,idx)
199-
}
196+
for (var idx=0; idx<currentframe.length; idx++)
197+
{
198+
currentframe[idx].show(this.ctx,idx)
199+
}
200200

201201
}
202202

@@ -205,12 +205,12 @@ SortingAnimation.prototype.snapshot = function()
205205
var newframe = new Array()
206206
for (var idx=0; idx<this.barlist.bars.length; idx++)
207207
{
208-
var newbar = new Bar() //make a copy
209-
newbar.setHeight(this.barlist.bars[idx].getHeight())
210-
newbar.setPosition(this.barlist.bars[idx].getPosition())
211-
newbar.setColor(this.barlist.bars[idx].getColor())
212-
213-
newframe.push(newbar)
208+
var newbar = new Bar() //make a copy
209+
newbar.setHeight(this.barlist.bars[idx].getHeight())
210+
newbar.setPosition(this.barlist.bars[idx].getPosition())
211+
newbar.setColor(this.barlist.bars[idx].getColor())
212+
213+
newframe.push(newbar)
214214
}
215215

216216
this.framelist.push(newframe)

0 commit comments

Comments
 (0)