46 lines
1.3 KiB
JavaScript
Executable File
46 lines
1.3 KiB
JavaScript
Executable File
// Generated by CoffeeScript 1.3.3
|
|
(function() {
|
|
|
|
jQuery.postWithPrefix = function(url, data, callback, type) {
|
|
return $.post("" + Courseware.prefix + url, data, callback, type);
|
|
};
|
|
|
|
jQuery.getWithPrefix = function(url, data, callback, type) {
|
|
return $.get("" + Courseware.prefix + url, data, callback, type);
|
|
};
|
|
|
|
$(function() {
|
|
$.ajaxSetup({
|
|
headers: {
|
|
'X-CSRFToken': $.cookie('csrftoken')
|
|
},
|
|
dataType: 'json'
|
|
});
|
|
window.onTouchBasedDevice = function() {
|
|
return navigator.userAgent.match(/iPhone|iPod|iPad/i);
|
|
};
|
|
$("a[rel*=leanModal]").leanModal();
|
|
$('#csrfmiddlewaretoken').attr('value', $.cookie('csrftoken'));
|
|
if ($('body').hasClass('courseware')) {
|
|
Courseware.start();
|
|
}
|
|
window.submit_circuit = function(circuit_id) {
|
|
$("input.schematic").each(function(index, element) {
|
|
return element.schematic.update_value();
|
|
});
|
|
schematic_value($("#schematic_" + circuit_id).attr("value"));
|
|
return $.postWithPrefix("/save_circuit/" + circuit_id, {
|
|
schematic: schematic_value
|
|
}, function(data) {
|
|
if (data.results === 'success') {
|
|
return alert('Saved');
|
|
}
|
|
});
|
|
};
|
|
return window.postJSON = function(url, data, callback) {
|
|
return $.postWithPrefix(url, data, callback);
|
|
};
|
|
});
|
|
|
|
}).call(this);
|