1 // Make all tables striped by default.
2 $("table").addClass("table table-striped");
5 // Handle foldable challenges and solutions (on click and at start).
6 $(".challenge,.discussion,.solution").click(function(event) {
7 var trigger = $(event.target).has(".fold-unfold").size() > 0
8 || $(event.target).filter(".fold-unfold").size() > 0;
10 $(">*:not(h2)", this).toggle(400);
11 $(">h2>span.fold-unfold", this).toggleClass("glyphicon-collapse-down glyphicon-collapse-up");
12 event.stopPropagation();
15 $(".challenge,.discussion,.solution").each(function() {
16 $(">*:not(h2)", this).toggle();
17 var h2 = $("h2:first", this);
18 h2.append("<span class='fold-unfold glyphicon glyphicon-collapse-down'></span>");
23 // Relies on document having 'meta' element with name 'search-domain'.
24 function google_search() {
25 var query = document.getElementById("google-search").value;
26 var domain = $("meta[name=search-domain]").attr("value");
27 window.open("https://www.google.com/search?q=" + query + "+site:" + domain);