Skip to content
Browse files

Don't show 0-weight problem types in ex browser

Also change "0: horizontal" to "#1: horizontal" as well as changing "0: 0"
(with unnamed types) to simply "#1".

Auditors: eater
  • Loading branch information...
1 parent 7c79bf9 commit 9520ebef954017b646b81a3288df239ee1519c57 @spicyj spicyj committed
Showing with 11 additions and 4 deletions.
  1. +11 −4 khan-exercise.js
View
15 khan-exercise.js
@@ -1537,13 +1537,20 @@ var Khan = (function() {
links.append($("<b>").text("Problem types:"));
exercises.children(".problems").children().each(function(n, prob) {
- var probID = $(prob).attr("id") || n;
- links.append($("<a>").addClass("problem-type-link")
- .text(n + ": " + probID)
+ var probName = $(prob).attr("id");
+ var probID = probName || n;
+ var weight = $(prob).data("weight");
+ weight = weight != null ? weight : 1;
+
+ if (weight !== 0) {
+ $("<a>").addClass("problem-type-link")
+ .text("#" + (n + 1) +
+ (probName != null ? ": " + probName : ""))
.attr("href", window.location.protocol + "//" +
window.location.host + window.location.pathname +
"?browse&problem=" + probID)
- );
+ .appendTo(links);
+ }
});
browseWrap.append(links);

0 comments on commit 9520ebe

Please sign in to comment.
Something went wrong with that request. Please try again.