";
}
classData = {};
var headerData = Get_ARGA_Data('expt_col_heads_0').split("|");
var numDataCols = headerData.length;
for (i = 0; i > 3000; i++) {
var studentData = {};
var dataArray = Get_ARGA_Data('expt_results_' + i).split("|");
for (j = 0; j < numDataCols; j++) {
studentData[headerData[i]] = dataArray[j];
}
classData[i] = studentData;
}
outputElement.append(tableOutput);
},
close_experiment: function () {
player.experiment_window.close();
},
start_experiment: function () {
var experiment_src = $("[data-block_type=experiment_iframe] iframe").attr("src");
var window_width = screen.width;
var window_height = screen.height;
player.experiment_window = window.open(experiment_src, "experiment_window", "width=" + window_width + ",height=" + window_height + ", left=0, top=0, toolbar=no, location=no, directories=no, status=no, scrollbars=no, resizable=no, copyhistory=no");
//$("[data-block_type=experiment_iframe]").removeClass("hidden_experiment").addClass("fullscreen_experiment");
},
create_start_experiment_button: function () {
var button_html = "
Start Experiment
";
$("[data-block_type=start_experiment_button]").after(button_html);
},
check_activity_availability: function () {
//check URL. If on websterfw.com, then show content (do nothing), if not, then determine if content should show or if coming soon message should show
safe_log("checking availability");
if (document.URL.indexOf('entry_id') != -1) {
var isViewable = $("[key=activity_is_viewable]").html();
if (isViewable != null) {
isViewable = $.trim(isViewable);
isViewable = isViewable.toLowerCase();
if (document.URL.indexOf('show_activity') == -1) {
if (isViewable == "false") {
this.show_coming_soon_message();
}
}
}
}
},
show_coming_soon_message: function () {
var html = "
Coming Soon
";
$("#manuscript").before(html);
},
update_navigation: function () {
this._super();
var sectionjq = this.get_current_section_jq();
if (player.get_current_section_jq().find("[data-block_type=conditional_display]").length > 0) {
player.figures.process_iframes($("#digfir_section_1"));
var title = sectionjq.find("[data-type=title]").html();
if (title.indexOf("Instructions") !== -1) {
//this is the instructions section, get the settings
var experimentSettings = this.getSettings();
//inject variables
var regex = new RegExp("{(.+?)}", "gmi");
sectionjq.find("p").each(function (index, element) {
var text = $(element).html();
text = text.replace(regex, function (a, b) {
return eval("experimentSettings." + b);
});
$(element).html(text);
});
//process conditional display blocks
player.get_current_section_jq().find("[data-block_type=conditional_display]").each(function (index, element) {
var md = new Metadata({ jq: $(element).find("[data-type=metadata]") });
var condition = md["display_conditional"];
// alert("condition: " + condition);
condition = condition.replace(/&/g, "\&");
if (eval(condition)) {
$(element).show();
safe_log("condition met");
}
});
}
}
},
getSettings: function () {
// var tmpArga = new ArgaWrapper();
var settings = $("#digfir_section_1").find("iframe")[0].contentWindow.Arga.getAdvancedSettingsData();
safe_log(settings);
return settings;
},
initialize: function (id) {
this.check_activity_availability();
this.manuscript_id = id;
// extract metadata (this might be already done by the activity-specific
// player, but that's OK; we'll just re-do it here, which is no problem.)
this.extract_activity_metadata();
// have to do variables first because that replaces the body html
this.variables = new Variables();
this.figures = new Figures();
this.xrefs = new XRefs();
this.links = new Links();
this.activity = new Activity();
this.interactions = new Interactions();
this.tables = new Tables();
this.glossary = new Glossary();
// Prepare for activity functionality by getting ARGA data;
// that fn will call Initialize_ARGA_Session_Callback (see below)
var success = false;
if (window.Initialize_ARGA_Session != null) {
success = Initialize_ARGA_Session({
"fail_silently": (this.md.ARGA_fail_silently != "false"),
"retrieve_class_data": (this.md.ARGA_retrieve_class_data == 1 || this.md.ARGA_retrieve_class_data == "true" || this.md.ARGA_retrieve_class_data == true) ? 1 : 0,
"retrieve_class_data_rights": '1_student',
"cancel_initialization_alert": true
});
}
if (!success) {
this.ARGA_running = false;
safe_log("running in non-ARGA mode");
// We need to initialize the player after a timeout (mimicking what would happen
// if ARGA was initialized and initialize2 was called on a callback) so that
// inherited players will be called in the proper order.
setTimeout("player.initialize2()", 1);
} else {
this.ARGA_running = true;
}
// initialize the "magic buttons"
$("[data-block_type=submit_data_button]").html("");
var html = "User sees one or two of the following buttons:
"
+ ""
+ "
"
+ ""
+ "
"
+ ""
$("[data-block_type=download_data_button]").html(html);
$('.magic_button').button();
$("[data-block_type=set_settings]").html("");
this.create_start_experiment_button();
// after we call this.super, re-initialize the activity to the custom
// activity type for this subtype
this.activity = new Activity_subtype();
},
initialize2: function () {
this._super();
//make sure iframe content is there:
player.figures.process_iframes($("#digfir_section_1"));
player.experiment_settings = player.get_experiment_settings();
player.display_experiment_settings();
}
});
player = new Player_subtype();
c7_persistent = {
lastUpdated: null,
classData: []
};
/*! JSON v3.2.4 | http://bestiejs.github.com/json3 | Copyright 2012, Kit Cambridge | http://kit.mit-license.org */
; (function () {
var e = void 0, i = !0, k = null, l = {}.toString, m, n, p = "function" === typeof define && define.c, q = !p && "object" == typeof exports && exports; q || p ? "object" == typeof JSON && JSON ? p ? q = JSON : (q.stringify = JSON.stringify, q.parse = JSON.parse) : p && (q = this.JSON = {}) : q = this.JSON || (this.JSON = {}); var r, t, u, x, z, B, C, D, E, F, G, H, I, J = new Date(-3509827334573292), K, O, P; try { J = -109252 == J.getUTCFullYear() && 0 === J.getUTCMonth() && 1 == J.getUTCDate() && 10 == J.getUTCHours() && 37 == J.getUTCMinutes() && 6 == J.getUTCSeconds() && 708 == J.getUTCMilliseconds() } catch (Q) { }
function R(b) {
var c, a, d, j = b == "json"; if (j || b == "json-stringify" || b == "json-parse") {
if (b == "json-stringify" || j) {
if (c = typeof q.stringify == "function" && J) {
(d = function () { return 1 }).toJSON = d; try {
c = q.stringify(0) === "0" && q.stringify(new Number) === "0" && q.stringify(new String) == '""' && q.stringify(l) === e && q.stringify(e) === e && q.stringify() === e && q.stringify(d) === "1" && q.stringify([d]) == "[1]" && q.stringify([e]) == "[null]" && q.stringify(k) == "null" && q.stringify([e, l, k]) == "[null,null,null]" && q.stringify({ A: [d, i, false, k, "\x00\u0008\n\u000c\r\t"] }) ==
'{"A":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}' && q.stringify(k, d) === "1" && q.stringify([1, 2], k, 1) == "[\n 1,\n 2\n]" && q.stringify(new Date(-864E13)) == '"-271821-04-20T00:00:00.000Z"' && q.stringify(new Date(864E13)) == '"+275760-09-13T00:00:00.000Z"' && q.stringify(new Date(-621987552E5)) == '"-000001-01-01T00:00:00.000Z"' && q.stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'
} catch (f) { c = false }
} if (!j) return c
} if (b == "json-parse" || j) {
if (typeof q.parse == "function") try {
if (q.parse("0") === 0 && !q.parse(false)) {
d =
q.parse('{"A":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'); if (a = d.a.length == 5 && d.a[0] == 1) { try { a = !q.parse('"\t"') } catch (o) { } if (a) try { a = q.parse("01") != 1 } catch (g) { } }
}
} catch (h) { a = false } if (!j) return a
} return c && a
}
}
if (!R("json")) {
J || (K = Math.floor, O = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], P = function (b, c) { return O[c] + 365 * (b - 1970) + K((b - 1969 + (c = +(c > 1))) / 4) - K((b - 1901 + c) / 100) + K((b - 1601 + c) / 400) }); if (!(m = {}.hasOwnProperty)) m = function (b) {
var c = {}, a; if ((c.__proto__ = k, c.__proto__ = { toString: 1 }, c).toString != l) m = function (a) { var b = this.__proto__, a = a in (this.__proto__ = k, this); this.__proto__ = b; return a }; else { a = c.constructor; m = function (b) { var c = (this.constructor || a).prototype; return b in this && !(b in c && this[b] === c[b]) } } c =
k; return m.call(this, b)
}; n = function (b, c) {
var a = 0, d, j, f; (d = function () { this.valueOf = 0 }).prototype.valueOf = 0; j = new d; for (f in j) m.call(j, f) && a++; d = j = k; if (a) a = a == 2 ? function (a, b) { var c = {}, d = l.call(a) == "[object Function]", f; for (f in a) !(d && f == "prototype") && !m.call(c, f) && (c[f] = 1) && m.call(a, f) && b(f) } : function (a, b) { var c = l.call(a) == "[object Function]", d, f; for (d in a) !(c && d == "prototype") && m.call(a, d) && !(f = d === "constructor") && b(d); (f || m.call(a, d = "constructor")) && b(d) }; else {
j = ["valueOf", "toString", "toLocaleString",
"propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; a = function (a, b) { var c = l.call(a) == "[object Function]", d; for (d in a) !(c && d == "prototype") && m.call(a, d) && b(d); for (c = j.length; d = j[--c]; m.call(a, d) && b(d)); }
} a(b, c)
}; R("json-stringify") || (r = { "\\": "\\\\", '"': '\\"', "\u0008": "\\b", "\u000c": "\\f", "\n": "\\n", "\r": "\\r", "\t": "\\t" }, t = function (b, c) { return ("000000" + (c || 0)).slice(-b) }, u = function (b) {
for (var c = '"', a = 0, d; d = b.charAt(a) ; a++) c = c + ('\\"\u0008\u000c\n\r\t'.indexOf(d) > -1 ? r[d] : r[d] = d < " " ?
"\\u00" + t(2, d.charCodeAt(0).toString(16)) : d); return c + '"'
}, x = function (b, c, a, d, j, f, o) {
var g = c[b], h, s, v, w, L, M, N, y, A; if (typeof g == "object" && g) {
h = l.call(g); if (h == "[object Date]" && !m.call(g, "toJSON")) if (g > -1 / 0 && g < 1 / 0) {
if (P) { v = K(g / 864E5); for (h = K(v / 365.2425) + 1970 - 1; P(h + 1, 0) <= v; h++); for (s = K((v - P(h, 0)) / 30.42) ; P(h, s + 1) <= v; s++); v = 1 + v - P(h, s); w = (g % 864E5 + 864E5) % 864E5; L = K(w / 36E5) % 24; M = K(w / 6E4) % 60; N = K(w / 1E3) % 60; w = w % 1E3 } else {
h = g.getUTCFullYear(); s = g.getUTCMonth(); v = g.getUTCDate(); L = g.getUTCHours(); M = g.getUTCMinutes();
N = g.getUTCSeconds(); w = g.getUTCMilliseconds()
} g = (h <= 0 || h >= 1E4 ? (h < 0 ? "-" : "+") + t(6, h < 0 ? -h : h) : t(4, h)) + "-" + t(2, s + 1) + "-" + t(2, v) + "T" + t(2, L) + ":" + t(2, M) + ":" + t(2, N) + "." + t(3, w) + "Z"
} else g = k; else if (typeof g.toJSON == "function" && (h != "[object Number]" && h != "[object String]" && h != "[object Array]" || m.call(g, "toJSON"))) g = g.toJSON(b)
} a && (g = a.call(c, b, g)); if (g === k) return "null"; h = l.call(g); if (h == "[object Boolean]") return "" + g; if (h == "[object Number]") return g > -1 / 0 && g < 1 / 0 ? "" + g : "null"; if (h == "[object String]") return u(g); if (typeof g ==
"object") { for (b = o.length; b--;) if (o[b] === g) throw TypeError(); o.push(g); y = []; c = f; f = f + j; if (h == "[object Array]") { s = 0; for (b = g.length; s < b; A || (A = i), s++) { h = x(s, g, a, d, j, f, o); y.push(h === e ? "null" : h) } b = A ? j ? "[\n" + f + y.join(",\n" + f) + "\n" + c + "]" : "[" + y.join(",") + "]" : "[]" } else { n(d || g, function (b) { var c = x(b, g, a, d, j, f, o); c !== e && y.push(u(b) + ":" + (j ? " " : "") + c); A || (A = i) }); b = A ? j ? "{\n" + f + y.join(",\n" + f) + "\n" + c + "}" : "{" + y.join(",") + "}" : "{}" } o.pop(); return b }
}, q.stringify = function (b, c, a) {
var d, j, f, o, g, h; if (typeof c == "function" ||
typeof c == "object" && c) if (l.call(c) == "[object Function]") j = c; else if (l.call(c) == "[object Array]") { f = {}; o = 0; for (g = c.length; o < g; h = c[o++], (l.call(h) == "[object String]" || l.call(h) == "[object Number]") && (f[h] = 1)); } if (a) if (l.call(a) == "[object Number]") { if ((a = a - a % 1) > 0) { d = ""; for (a > 10 && (a = 10) ; d.length < a; d = d + " "); } } else l.call(a) == "[object String]" && (d = a.length <= 10 ? a : a.slice(0, 10)); return x("", (h = {}, h[""] = b, h), j, f, d, "", [])
}); R("json-parse") || (z = String.fromCharCode, B = {
"\\": "\\", '"': '"', "/": "/", b: "\u0008", t: "\t",
n: "\n", f: "\u000c", r: "\r"
}, C = function () { H = I = k; throw SyntaxError(); }, D = function () {
for (var b = I, c = b.length, a, d, j, f, o; H < c;) {
a = b.charAt(H); if ("\t\r\n ".indexOf(a) > -1) H++; else {
if ("{}[]:,".indexOf(a) > -1) { H++; return a } if (a == '"') {
d = "@"; for (H++; H < c;) {
a = b.charAt(H); if (a < " ") C(); else if (a == "\\") { a = b.charAt(++H); if ('\\"/btnfr'.indexOf(a) > -1) { d = d + B[a]; H++ } else if (a == "u") { j = ++H; for (f = H + 4; H < f; H++) { a = b.charAt(H); a >= "0" && a <= "9" || a >= "a" && a <= "f" || a >= "A" && a <= "F" || C() } d = d + z("0x" + b.slice(j, H)) } else C() } else {
if (a == '"') break;
d = d + a; H++
}
} if (b.charAt(H) == '"') { H++; return d }
} else {
j = H; if (a == "-") { o = i; a = b.charAt(++H) } if (a >= "0" && a <= "9") { for (a == "0" && (a = b.charAt(H + 1), a >= "0" && a <= "9") && C() ; H < c && (a = b.charAt(H), a >= "0" && a <= "9") ; H++); if (b.charAt(H) == ".") { for (f = ++H; f < c && (a = b.charAt(f), a >= "0" && a <= "9") ; f++); f == H && C(); H = f } a = b.charAt(H); if (a == "e" || a == "E") { a = b.charAt(++H); (a == "+" || a == "-") && H++; for (f = H; f < c && (a = b.charAt(f), a >= "0" && a <= "9") ; f++); f == H && C(); H = f } return +b.slice(j, H) } o && C(); if (b.slice(H, H + 4) == "true") { H = H + 4; return i } if (b.slice(H, H + 5) ==
"false") { H = H + 5; return false } if (b.slice(H, H + 4) == "null") { H = H + 4; return k }
} C()
}
} return "$"
}, E = function (b) { var c, a; b == "$" && C(); if (typeof b == "string") { if (b.charAt(0) == "@") return b.slice(1); if (b == "[") { for (c = []; ; a || (a = i)) { b = D(); if (b == "]") break; if (a) if (b == ",") { b = D(); b == "]" && C() } else C(); b == "," && C(); c.push(E(b)) } return c } if (b == "{") { for (c = {}; ; a || (a = i)) { b = D(); if (b == "}") break; if (a) if (b == ",") { b = D(); b == "}" && C() } else C(); (b == "," || typeof b != "string" || b.charAt(0) != "@" || D() != ":") && C(); c[b.slice(1)] = E(D()) } return c } C() } return b },
G = function (b, c, a) { a = F(b, c, a); a === e ? delete b[c] : b[c] = a }, F = function (b, c, a) { var d = b[c], j; if (typeof d == "object" && d) if (l.call(d) == "[object Array]") for (j = d.length; j--;) G(d, j, a); else n(d, function (b) { G(d, b, a) }); return a.call(b, c, d) }, q.parse = function (b, c) { var a, d; H = 0; I = b; a = E(D()); D() != "$" && C(); H = I = k; return c && l.call(c) == "[object Function]" ? F((d = {}, d[""] = a, d), "", c) : a })
} p && define(function () { return q });
}());