Skip to content

Commit 6ad978a

Browse files
committed
fix all eslint errors along with base64encode error
1 parent 59df238 commit 6ad978a

File tree

1 file changed

+62
-61
lines changed

1 file changed

+62
-61
lines changed

js/turtles.js

Lines changed: 62 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-undef */
12
/**
23
* @file This contains the prototype of the Turtles component.
34
* @author Walter Bender
@@ -791,16 +792,16 @@ Turtles.TurtlesView = class {
791792
container.onmouseover = () => {
792793
if (!activity.loading) {
793794
document.body.style.cursor = "pointer";
794-
container.style.transition = '0.1s ease-out';
795-
container.style.transform = 'scale(1.15)';
795+
container.style.transition = "0.1s ease-out";
796+
container.style.transform = "scale(1.15)";
796797
}
797798
};
798799

799800
container.onmouseout = () => {
800801
if (!activity.loading) {
801802
document.body.style.cursor = "default";
802-
container.style.transition = '0.15s ease-out';
803-
container.style.transform = 'scale(1)';
803+
container.style.transition = "0.15s ease-out";
804+
container.style.transform = "scale(1)";
804805
}
805806
};
806807
const img = new Image();
@@ -877,10 +878,10 @@ Turtles.TurtlesView = class {
877878
const __makeGridButton = () => {
878879
this.gridButton = _makeButton(
879880
CARTESIANBUTTON,
880-
{
881-
"name":"Grid",
882-
"label":_("Grid")
883-
},
881+
{
882+
"name":"Grid",
883+
"label":_("Grid")
884+
},
884885
this._w - 10 - 3 * 55,
885886
70 + LEADING + 6
886887
);
@@ -898,44 +899,44 @@ Turtles.TurtlesView = class {
898899
this._clearButton = _makeButton(
899900
CLEARBUTTON,
900901
{
901-
"name":"Clean",
902-
"label":_("Clean")
902+
"name":"Clean",
903+
"label":_("Clean")
903904
},
904905
this._w - 5 - 2 * 55,
905906
70 + LEADING + 6
906907
);
907908

908909
this._clearButton.onclick = () => {
909-
let clearBox = document.getElementById("ClearButton");
910-
let clearContent = document.getElementById("ClearContent");
910+
const clearBox = document.getElementById("ClearButton");
911+
const clearContent = document.getElementById("ClearContent");
911912
clearContent.innerHTML = _("Confirm");
912913
clearBox.style.visibility="visible";
913-
let auxToolbar = docById("aux-toolbar");
914-
let clearBtnPosition = auxToolbar.style.display === "block" ? "183px" : "125px";
914+
const auxToolbar = docById("aux-toolbar");
915+
const clearBtnPosition = auxToolbar.style.display === "block" ? "183px" : "125px";
915916
clearBox.style.top = clearBtnPosition;
916-
let func = this.activity._allClear;
917-
clearBox.addEventListener('click', function(event) {
917+
const func = this.activity._allClear;
918+
clearBox.addEventListener("click", function(event) {
918919
if(event.target.id == "clearClose"){
919920
this.style.visibility = "hidden";
920921
}
921922
else{
922-
func();
923-
clearBox.style.visibility = "hidden";
924-
if (auxToolbar.style.display === "block") {
925-
setTimeout(() => {
926-
docById("Grid").style.top = "136px";
927-
docById("Expand").style.top = "136px";
928-
docById("Collapse").style.top = "136px";
929-
docById("Clean").style.top = "136px";
930-
}, 0);
931-
} else {
932-
docById("Grid").style.top = "76px";
933-
docById("Expand").style.top = "76px";
934-
docById("Collapse").style.top = "76px";
935-
docById("Clean").style.top = "76px";
923+
func();
924+
clearBox.style.visibility = "hidden";
925+
if (auxToolbar.style.display === "block") {
926+
setTimeout(() => {
927+
docById("Grid").style.top = "136px";
928+
docById("Expand").style.top = "136px";
929+
docById("Collapse").style.top = "136px";
930+
docById("Clean").style.top = "136px";
931+
}, 0);
932+
} else {
933+
docById("Grid").style.top = "76px";
934+
docById("Expand").style.top = "76px";
935+
docById("Collapse").style.top = "76px";
936+
docById("Clean").style.top = "76px";
937+
}
936938
}
937-
}
938-
});
939+
});
939940
};
940941

941942
if (doCollapse) {
@@ -951,8 +952,8 @@ Turtles.TurtlesView = class {
951952
this._collapseButton = _makeButton(
952953
COLLAPSEBUTTON,
953954
{
954-
"name":"Collapse",
955-
"label":_("Collapse")
955+
"name":"Collapse",
956+
"label":_("Collapse")
956957
},
957958
this._w - 55,
958959
70 + LEADING + 6
@@ -978,7 +979,7 @@ Turtles.TurtlesView = class {
978979
} else if (ele.label === "Grid") {
979980
ele.display = false;
980981
}
981-
})
982+
});
982983
__collapse();
983984
};
984985
};
@@ -1003,14 +1004,14 @@ Turtles.TurtlesView = class {
10031004
} else if (ele.label === "Grid") {
10041005
ele.display = false;
10051006
}
1006-
})
1007+
});
10071008
__collapse();
10081009

10091010
if (docById("helpfulWheelDiv").style.display !== "none") {
10101011
docById("helpfulWheelDiv").style.display = "none";
10111012
this.activity.__tick();
10121013
}
1013-
}
1014+
};
10141015

10151016
/**
10161017
* Makes expand button by initailising 'EXPANDBUTTON' SVG.
@@ -1053,7 +1054,7 @@ Turtles.TurtlesView = class {
10531054
} else if (ele.label === "Grid") {
10541055
ele.display = true;
10551056
}
1056-
})
1057+
});
10571058
this._collapsedBoundary.visible = false;
10581059
turtlesStage.removeAllEventListeners("pressmove");
10591060
turtlesStage.removeAllEventListeners("mousedown");
@@ -1111,7 +1112,7 @@ Turtles.TurtlesView = class {
11111112
} else if (ele.label === "Grid") {
11121113
ele.display = true;
11131114
}
1114-
})
1115+
});
11151116
this._collapsedBoundary.visible = false;
11161117
turtlesStage.removeAllEventListeners("pressmove");
11171118
turtlesStage.removeAllEventListeners("mousedown");
@@ -1147,7 +1148,7 @@ Turtles.TurtlesView = class {
11471148
docById("helpfulWheelDiv").style.display = "none";
11481149
this.activity.__tick();
11491150
}
1150-
}
1151+
};
11511152

11521153
/**
11531154
* initializes all Buttons.
@@ -1218,17 +1219,17 @@ Turtles.TurtlesView = class {
12181219
"data:image/svg+xml;base64," +
12191220
window.btoa(
12201221
base64Encode(
1221-
MBOUNDARY.replace("HEIGHT", this._h)
1222-
.replace("WIDTH", this._w)
1223-
.replace("Y", 10)
1224-
.replace("X", 10)
1225-
.replace("DY", dy)
1226-
.replace("DX", dx)
1227-
.replace("stroke_color", platformColor.ruleColor)
1228-
.replace("fill_color", this._backgroundColor)
1229-
.replace("STROKE", 20)
1230-
)
1231-
);
1222+
MBOUNDARY.replace("HEIGHT", this._h)
1223+
.replace("WIDTH", this._w)
1224+
.replace("Y", 10)
1225+
.replace("X", 10)
1226+
.replace("DY", dy)
1227+
.replace("DX", dx)
1228+
.replace("stroke_color", platformColor.ruleColor)
1229+
.replace("fill_color", this._backgroundColor)
1230+
.replace("STROKE", 20)
1231+
)
1232+
);
12321233
__makeAllButtons();
12331234
};
12341235
// Call the __makeBoundary2 function once the document is loaded
@@ -1257,16 +1258,16 @@ Turtles.TurtlesView = class {
12571258
"data:image/svg+xml;base64," +
12581259
window.btoa(
12591260
base64Encode(
1260-
MBOUNDARY.replace("HEIGHT", this._h)
1261-
.replace("WIDTH", this._w)
1262-
.replace("Y", 10 / CONTAINERSCALEFACTOR)
1263-
.replace("X", 10 / CONTAINERSCALEFACTOR)
1264-
.replace("DY", dy)
1265-
.replace("DX", dx)
1266-
.replace("stroke_color", platformColor.ruleColor)
1267-
.replace("fill_color", this._backgroundColor)
1268-
.replace("STROKE", 20 / CONTAINERSCALEFACTOR)
1269-
)
1261+
MBOUNDARY.replace("HEIGHT", this._h)
1262+
.replace("WIDTH", this._w)
1263+
.replace("Y", 10 / CONTAINERSCALEFACTOR)
1264+
.replace("X", 10 / CONTAINERSCALEFACTOR)
1265+
.replace("DY", dy)
1266+
.replace("DX", dx)
1267+
.replace("stroke_color", platformColor.ruleColor)
1268+
.replace("fill_color", this._backgroundColor)
1269+
.replace("STROKE", 20 / CONTAINERSCALEFACTOR)
1270+
)
12701271
);
12711272
};
12721273

0 commit comments

Comments
 (0)