Skip to content

Commit d0c76c3

Browse files
author
Jack Toole
committed
Replace jQuery isType functions with _.isType functions
Test Plan: none Auditors: alex
1 parent e556e3a commit d0c76c3

9 files changed

+24
-24
lines changed

exercises/conditional_statements_2.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
var makeDisplay = function(str) {
1717
var color = 0;
18-
if ($.isArray(str)) {
18+
if (_.isArray(str)) {
1919
color = str[1];
2020
str = str[0];
2121
}
@@ -39,7 +39,7 @@
3939
}
4040

4141
var makeStatement = function(str) {
42-
if ($.isArray(str)) {
42+
if (_.isArray(str)) {
4343
var color = str[1];
4444
str = str[0];
4545

history.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ function renderReadOnlyProblem(event, args) {
314314
};
315315

316316
if (framework === "khan-exercises") {
317-
if (thisSlide.data("guess") !== undefined && $.isFunction(answerData.showCustomGuess)) {
317+
if (thisSlide.data("guess") !== undefined && _.isFunction(answerData.showCustomGuess)) {
318318
KhanUtil.currentGraph = $(realWorkArea).find(".graphie").data("graphie");
319319
answerData.showCustomGuess(thisSlide.data("guess"));
320320
MathJax.Hub.Queue(recordState);

utils/algebra-intuition.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ KhanUtil.scale = {
173173
KhanUtil.scale.graphie.scalePoint([0, 0])[1]);
174174
}
175175
});
176-
if ($.isFunction(this.onChange)) {
176+
if (_.isFunction(this.onChange)) {
177177
this.onChange(this.leftCoef, this.leftConst,
178178
this.rightCoef, this.rightConst);
179179
}

utils/answer-types.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ Khan.answerTypes = $.extend(Khan.answerTypes, {
10721072
// Iterate through each of the answerDatas, and show the
10731073
// cooresponding custom guess for each if it exists
10741074
$.each(answerDataArray, function(i, answerData) {
1075-
if (!$.isFunction(answerData.showCustomGuess)) {
1075+
if (!_.isFunction(answerData.showCustomGuess)) {
10761076
return;
10771077
}
10781078
if (guess !== undefined) {

utils/graphie.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@
628628
var result;
629629

630630
// The last argument is probably trying to change the style
631-
if (typeof last === "object" && !$.isArray(last)) {
631+
if (typeof last === "object" && !_.isArray(last)) {
632632
currentStyle = $.extend({}, currentStyle, processAttributes(last));
633633

634634
var rest = [].slice.call(arguments, 0, arguments.length - 1);
@@ -729,7 +729,7 @@
729729
range[1][1] + (range[1][1] < 0 ? 1 : 0)]
730730
];
731731

732-
if (!$.isArray(unityLabels)) {
732+
if (!_.isArray(unityLabels)) {
733733
unityLabels = [unityLabels, unityLabels];
734734
}
735735

utils/interactive.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -912,12 +912,12 @@ $.extend(KhanUtil.Graphie.prototype, {
912912
// By returning false from onMove(), the move can be vetoed,
913913
// providing custom constraints on where the point can be moved.
914914
// By returning array [x, y], the move can be overridden
915-
if ($.isFunction(movablePoint.onMove)) {
915+
if (_.isFunction(movablePoint.onMove)) {
916916
var result = movablePoint.onMove(coordX, coordY);
917917
if (result === false) {
918918
doMove = false;
919919
}
920-
if ($.isArray(result)) {
920+
if (_.isArray(result)) {
921921
coordX = result[0];
922922
coordY = result[1];
923923
}
@@ -942,9 +942,9 @@ $.extend(KhanUtil.Graphie.prototype, {
942942
$(document).unbind("vmousemove vmouseup");
943943
movablePoint.dragging = false;
944944
KhanUtil.dragging = false;
945-
if ($.isFunction(movablePoint.onMoveEnd)) {
945+
if (_.isFunction(movablePoint.onMoveEnd)) {
946946
var result = movablePoint.onMoveEnd(coordX, coordY);
947-
if ($.isArray(result)) {
947+
if (_.isArray(result)) {
948948
coordX = result[0];
949949
coordY = result[1];
950950
mouseX = (coordX - graph.range[0][0]) * graph.scale[0];
@@ -1005,7 +1005,7 @@ $.extend(KhanUtil.Graphie.prototype, {
10051005
this.mouseTarget.animate(end, time);
10061006
}
10071007
this.coord = [coordX, coordY];
1008-
if ($.isFunction(this.onMove)) {
1008+
if (_.isFunction(this.onMove)) {
10091009
this.onMove(coordX, coordY);
10101010
}
10111011
};
@@ -1200,7 +1200,7 @@ $.extend(KhanUtil.Graphie.prototype, {
12001200
coordY = fn(closestX);
12011201

12021202
// If the caller wants to be notified when the user points to the function
1203-
if ($.isFunction(interactiveFn.onMove)) {
1203+
if (_.isFunction(interactiveFn.onMove)) {
12041204
interactiveFn.onMove(coordX, coordY);
12051205
}
12061206

@@ -1212,7 +1212,7 @@ $.extend(KhanUtil.Graphie.prototype, {
12121212
interactiveFn.highlight = false;
12131213
interactiveFn.cursorPoint.animate({ opacity: 0.0 }, 50);
12141214
// If the caller wants to be notified when the user stops pointing to the function
1215-
if ($.isFunction(interactiveFn.onLeave)) {
1215+
if (_.isFunction(interactiveFn.onLeave)) {
12161216
interactiveFn.onLeave(coordX, coordY);
12171217
}
12181218
}
@@ -1534,7 +1534,7 @@ $.extend(KhanUtil.Graphie.prototype, {
15341534
}
15351535
}
15361536

1537-
if ($.isFunction(lineSegment.onMove)) {
1537+
if (_.isFunction(lineSegment.onMove)) {
15381538
lineSegment.onMove(dX, dY);
15391539
}
15401540

@@ -1545,7 +1545,7 @@ $.extend(KhanUtil.Graphie.prototype, {
15451545
if (!lineSegment.highlight) {
15461546
lineSegment.visibleLine.animate(lineSegment.normalStyle, 50);
15471547
}
1548-
if ($.isFunction(lineSegment.onMoveEnd)) {
1548+
if (_.isFunction(lineSegment.onMoveEnd)) {
15491549
lineSegment.onMoveEnd();
15501550
}
15511551

@@ -1895,11 +1895,11 @@ $.extend(KhanUtil.Graphie.prototype, {
18951895
// moved. By returning array [dX, dY], the move can
18961896
// be overridden.
18971897
var doMove = true;
1898-
if ($.isFunction(polygon.onMove)) {
1898+
if (_.isFunction(polygon.onMove)) {
18991899
var onMoveResult = polygon.onMove(dX, dY);
19001900
if (onMoveResult === false) {
19011901
doMove = false;
1902-
} else if ($.isArray(onMoveResult)) {
1902+
} else if (_.isArray(onMoveResult)) {
19031903
dX = onMoveResult[0];
19041904
dY = onMoveResult[1];
19051905
}
@@ -1943,7 +1943,7 @@ $.extend(KhanUtil.Graphie.prototype, {
19431943
point.visibleShape.animate(point.normalStyle, 50);
19441944
});
19451945
}
1946-
if ($.isFunction(polygon.onMoveEnd)) {
1946+
if (_.isFunction(polygon.onMoveEnd)) {
19471947
polygon.onMoveEnd();
19481948
}
19491949
}

utils/mean-and-median.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ $.extend(KhanUtil, {
129129
$.each(points, function() {
130130
if (this !== point) {
131131
var pos = Math.round(this.coord[0] * 2) / 2;
132-
if (!$.isArray(positions[pos])) {
132+
if (!_.isArray(positions[pos])) {
133133
positions[pos] = [];
134134
}
135135
positions[pos].push(this);
136136
}
137137
});
138138

139-
if ($.isFunction(updateFunction)) {
139+
if (_.isFunction(updateFunction)) {
140140
updateFunction();
141141
}
142142

utils/polynomials.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ $.extend(KhanUtil, {
2424
if (typeof expr === "number") {
2525
coef = expr;
2626
degree = 0;
27-
} else if ($.isArray(expr) && !$.isArray(expr[2])) {
27+
} else if (_.isArray(expr) && !_.isArray(expr[2])) {
2828
coef = expr[1];
2929
degree = 1;
30-
} else if ($.isArray(expr) && $.isArray(expr[2])) {
30+
} else if (_.isArray(expr) && _.isArray(expr[2])) {
3131
coef = expr[1];
3232
degree = expr[2][2];
3333
}

utils/word-problems.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ $.extend(KhanUtil, {
3232

3333
toSentenceTex: function(array, highlight, highlightClass) {
3434
var wrapped = $.map(array, function(elem) {
35-
if (($.isFunction(highlight) && highlight(elem)) || (highlight !== undefined && elem === highlight)) {
35+
if ((_.isFunction(highlight) && highlight(elem)) || (highlight !== undefined && elem === highlight)) {
3636
return "<code class='" + highlightClass + "'>" + elem + "</code>";
3737
}
3838
return "<code>" + elem + "</code>";

0 commit comments

Comments
 (0)