Commit 1542a74d by Valera Rozuvan

Removed logme module. Using console.log() instead.

Removing "logme" from comments.

BLD-608
parent f58e788b
...@@ -79,7 +79,6 @@ class GraphicalSliderToolModule(GraphicalSliderToolFields, XModule): ...@@ -79,7 +79,6 @@ class GraphicalSliderToolModule(GraphicalSliderToolFields, XModule):
# TODO - where to store them - outside xmodule? # TODO - where to store them - outside xmodule?
resource_string(__name__, 'js/src/graphical_slider_tool/gst_main.js'), resource_string(__name__, 'js/src/graphical_slider_tool/gst_main.js'),
resource_string(__name__, 'js/src/graphical_slider_tool/state.js'), resource_string(__name__, 'js/src/graphical_slider_tool/state.js'),
resource_string(__name__, 'js/src/graphical_slider_tool/logme.js'),
resource_string(__name__, 'js/src/graphical_slider_tool/general_methods.js'), resource_string(__name__, 'js/src/graphical_slider_tool/general_methods.js'),
resource_string(__name__, 'js/src/graphical_slider_tool/sliders.js'), resource_string(__name__, 'js/src/graphical_slider_tool/sliders.js'),
resource_string(__name__, 'js/src/graphical_slider_tool/inputs.js'), resource_string(__name__, 'js/src/graphical_slider_tool/inputs.js'),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// define() functions from Require JS available inside the anonymous function. // define() functions from Require JS available inside the anonymous function.
(function (requirejs, require, define) { (function (requirejs, require, define) {
define('ElOutput', ['logme'], function (logme) { define('ElOutput', [], function () {
return ElOutput; return ElOutput;
...@@ -37,13 +37,13 @@ define('ElOutput', ['logme'], function (logme) { ...@@ -37,13 +37,13 @@ define('ElOutput', ['logme'], function (logme) {
} }
if (typeof obj['@el_id'] !== 'string') { if (typeof obj['@el_id'] !== 'string') {
logme('ERROR: You specified "output" as "element", but did not spify "el_id".'); console.log('ERROR: You specified "output" as "element", but did not spify "el_id".');
return; return;
} }
if (typeof obj['#text'] !== 'string') { if (typeof obj['#text'] !== 'string') {
logme('ERROR: Function body is not defined.'); console.log('ERROR: Function body is not defined.');
return; return;
} }
...@@ -73,7 +73,7 @@ define('ElOutput', ['logme'], function (logme) { ...@@ -73,7 +73,7 @@ define('ElOutput', ['logme'], function (logme) {
} }
} else { } else {
if (funcString.search(/return/i) === -1) { if (funcString.search(/return/i) === -1) {
logme( console.log(
'ERROR: You have specified a JavaScript ' + 'ERROR: You have specified a JavaScript ' +
'function without a "return" statemnt. Your ' + 'function without a "return" statemnt. Your ' +
'function will return "undefined" by default.' 'function will return "undefined" by default.'
...@@ -91,12 +91,12 @@ define('ElOutput', ['logme'], function (logme) { ...@@ -91,12 +91,12 @@ define('ElOutput', ['logme'], function (logme) {
try { try {
func = Function.apply(null, paramNames); func = Function.apply(null, paramNames);
} catch (err) { } catch (err) {
logme( console.log(
'ERROR: The function body "' + 'ERROR: The function body "' +
funcString + funcString +
'" was not converted by the Function constructor.' '" was not converted by the Function constructor.'
); );
logme('Error message: "' + err.message + '".'); console.log('Error message: "' + err.message + '".');
if (state.showDebugInfo) { if (state.showDebugInfo) {
$('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not create a function from string "' + funcString + '".' + '</div>'); $('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not create a function from string "' + funcString + '".' + '</div>');
...@@ -114,7 +114,7 @@ define('ElOutput', ['logme'], function (logme) { ...@@ -114,7 +114,7 @@ define('ElOutput', ['logme'], function (logme) {
el = $('#' + obj['@el_id']); el = $('#' + obj['@el_id']);
if (el.length !== 1) { if (el.length !== 1) {
logme( console.log(
'ERROR: DOM element with ID "' + obj['@el_id'] + '" ' + 'ERROR: DOM element with ID "' + obj['@el_id'] + '" ' +
'not found. Dynamic element not created.' 'not found. Dynamic element not created.'
); );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// define() functions from Require JS available inside the anonymous function. // define() functions from Require JS available inside the anonymous function.
(function (requirejs, require, define) { (function (requirejs, require, define) {
define('GLabelElOutput', ['logme'], function (logme) { define('GLabelElOutput', [], function () {
return GLabelElOutput; return GLabelElOutput;
function GLabelElOutput(config, state) { function GLabelElOutput(config, state) {
...@@ -35,13 +35,13 @@ define('GLabelElOutput', ['logme'], function (logme) { ...@@ -35,13 +35,13 @@ define('GLabelElOutput', ['logme'], function (logme) {
} }
if (typeof obj['@el_id'] !== 'string') { if (typeof obj['@el_id'] !== 'string') {
logme('ERROR: You specified "output" as "plot_label", but did not spify "el_id".'); console.log('ERROR: You specified "output" as "plot_label", but did not spify "el_id".');
return; return;
} }
if (typeof obj['#text'] !== 'string') { if (typeof obj['#text'] !== 'string') {
logme('ERROR: Function body is not defined.'); console.log('ERROR: Function body is not defined.');
return; return;
} }
...@@ -62,7 +62,7 @@ define('GLabelElOutput', ['logme'], function (logme) { ...@@ -62,7 +62,7 @@ define('GLabelElOutput', ['logme'], function (logme) {
} }
} else { } else {
if (funcString.search(/return/i) === -1) { if (funcString.search(/return/i) === -1) {
logme( console.log(
'ERROR: You have specified a JavaScript ' + 'ERROR: You have specified a JavaScript ' +
'function without a "return" statemnt. Your ' + 'function without a "return" statemnt. Your ' +
'function will return "undefined" by default.' 'function will return "undefined" by default.'
...@@ -80,12 +80,12 @@ define('GLabelElOutput', ['logme'], function (logme) { ...@@ -80,12 +80,12 @@ define('GLabelElOutput', ['logme'], function (logme) {
try { try {
func = Function.apply(null, paramNames); func = Function.apply(null, paramNames);
} catch (err) { } catch (err) {
logme( console.log(
'ERROR: The function body "' + 'ERROR: The function body "' +
funcString + funcString +
'" was not converted by the Function constructor.' '" was not converted by the Function constructor.'
); );
logme('Error message: "' + err.message + '".'); console.log('Error message: "' + err.message + '".');
if (state.showDebugInfo) { if (state.showDebugInfo) {
$('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not create a function from string "' + funcString + '".' + '</div>'); $('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not create a function from string "' + funcString + '".' + '</div>');
......
...@@ -8,8 +8,8 @@ define( ...@@ -8,8 +8,8 @@ define(
// Even though it is not explicitly in this module, we have to specify // Even though it is not explicitly in this module, we have to specify
// 'GeneralMethods' as a dependency. It expands some of the core JS objects // 'GeneralMethods' as a dependency. It expands some of the core JS objects
// with additional useful methods that are used in other modules. // with additional useful methods that are used in other modules.
['State', 'GeneralMethods', 'Sliders', 'Inputs', 'Graph', 'ElOutput', 'GLabelElOutput', 'logme'], ['State', 'GeneralMethods', 'Sliders', 'Inputs', 'Graph', 'ElOutput', 'GLabelElOutput'],
function (State, GeneralMethods, Sliders, Inputs, Graph, ElOutput, GLabelElOutput, logme) { function (State, GeneralMethods, Sliders, Inputs, Graph, ElOutput, GLabelElOutput) {
return GstMain; return GstMain;
...@@ -19,7 +19,7 @@ define( ...@@ -19,7 +19,7 @@ define(
if ($('#' + gstId).attr('data-processed') !== 'processed') { if ($('#' + gstId).attr('data-processed') !== 'processed') {
$('#' + gstId).attr('data-processed', 'processed'); $('#' + gstId).attr('data-processed', 'processed');
} else { } else {
// logme('MESSAGE: Already processed GST with ID ' + gstId + '. Skipping.'); // console.log('MESSAGE: Already processed GST with ID ' + gstId + '. Skipping.');
return; return;
} }
...@@ -28,10 +28,10 @@ define( ...@@ -28,10 +28,10 @@ define(
try { try {
config = JSON.parse($('#' + gstId + '_json').html()).root; config = JSON.parse($('#' + gstId + '_json').html()).root;
} catch (err) { } catch (err) {
logme('ERROR: could not parse config JSON.'); console.log('ERROR: could not parse config JSON.');
logme('$("#" + gstId + "_json").html() = ', $('#' + gstId + '_json').html()); console.log('$("#" + gstId + "_json").html() = ', $('#' + gstId + '_json').html());
logme('JSON.parse(...) = ', JSON.parse($('#' + gstId + '_json').html())); console.log('JSON.parse(...) = ', JSON.parse($('#' + gstId + '_json').html()));
logme('config = ', config); console.log('config = ', config);
return; return;
} }
...@@ -40,8 +40,8 @@ define( ...@@ -40,8 +40,8 @@ define(
// name that is based on the class name of the GST. For example, inputs // name that is based on the class name of the GST. For example, inputs
// are assigned a class name '{GST class name}_input'. // are assigned a class name '{GST class name}_input'.
if (typeof config['@class'] !== 'string') { if (typeof config['@class'] !== 'string') {
logme('ERROR: Could not get the class name of GST.'); console.log('ERROR: Could not get the class name of GST.');
logme('config["@class"] = ', config['@class']); console.log('config["@class"] = ', config['@class']);
return; return;
} }
...@@ -56,7 +56,7 @@ define( ...@@ -56,7 +56,7 @@ define(
// It is possible that something goes wrong while extracting parameters // It is possible that something goes wrong while extracting parameters
// from the JSON config object. In this case, we will not continue. // from the JSON config object. In this case, we will not continue.
if (state === undefined) { if (state === undefined) {
logme('ERROR: The state object was not initialized properly.'); console.log('ERROR: The state object was not initialized properly.');
return; return;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// define() functions from Require JS available inside the anonymous function. // define() functions from Require JS available inside the anonymous function.
(function (requirejs, require, define) { (function (requirejs, require, define) {
define('Inputs', ['logme'], function (logme) { define('Inputs', [], function () {
return Inputs; return Inputs;
function Inputs(gstId, gstClass, state) { function Inputs(gstId, gstClass, state) {
...@@ -32,7 +32,7 @@ define('Inputs', ['logme'], function (logme) { ...@@ -32,7 +32,7 @@ define('Inputs', ['logme'], function (logme) {
// Check that the retrieval went OK. // Check that the retrieval went OK.
if (paramObj === undefined) { if (paramObj === undefined) {
logme('ERROR: Could not get a paramObj for parameter "' + paramName + '".'); console.log('ERROR: Could not get a paramObj for parameter "' + paramName + '".');
return; return;
} }
......
// Wrapper for RequireJS. It will make the standard requirejs(), require(), and
// define() functions from Require JS available inside the anonymous function.
(function (requirejs, require, define) {
define('logme', [], function () {
var debugMode;
// debugMode can be one of the following:
//
// true - All messages passed to logme will be written to the internal
// browser console.
// false - Suppress all output to the internal browser console.
//
// Obviously, if anywhere there is a direct console.log() call, we can't do
// anything about it. That's why use logme() - it will allow to turn off
// the output of debug information with a single change to a variable.
debugMode = true;
return logme;
/*
* function: logme
*
* A helper function that provides logging facilities. We don't want
* to call console.log() directly, because sometimes it is not supported
* by the browser. Also when everything is routed through this function.
* the logging output can be easily turned off.
*
* logme() supports multiple parameters. Each parameter will be passed to
* console.log() function separately.
*
*/
function logme() {
var i;
if (
(typeof debugMode === 'undefined') ||
(debugMode !== true) ||
(typeof window.console === 'undefined')
) {
return;
}
for (i = 0; i < arguments.length; i++) {
window.console.log(arguments[i]);
}
} // End-of: function logme
});
// End of wrapper for RequireJS. As you can see, we are passing
// namespaced Require JS variables to an anonymous function. Within
// it, you can use the standard requirejs(), require(), and define()
// functions as if they were in the global namespace.
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define)
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// define() functions from Require JS available inside the anonymous function. // define() functions from Require JS available inside the anonymous function.
(function (requirejs, require, define) { (function (requirejs, require, define) {
define('Sliders', ['logme'], function (logme) { define('Sliders', [], function () {
return Sliders; return Sliders;
function Sliders(gstId, state) { function Sliders(gstId, state) {
...@@ -18,10 +18,10 @@ define('Sliders', ['logme'], function (logme) { ...@@ -18,10 +18,10 @@ define('Sliders', ['logme'], function (logme) {
if (sliderDiv.length === 1) { if (sliderDiv.length === 1) {
createSlider(sliderDiv, paramName); createSlider(sliderDiv, paramName);
} else if (sliderDiv.length > 1) { } else if (sliderDiv.length > 1) {
logme('ERROR: Found more than one slider for the parameter "' + paramName + '".'); console.log('ERROR: Found more than one slider for the parameter "' + paramName + '".');
logme('sliderDiv.length = ', sliderDiv.length); console.log('sliderDiv.length = ', sliderDiv.length);
} // else { } // else {
// logme('MESSAGE: Did not find a slider for the parameter "' + paramName + '".'); // console.log('MESSAGE: Did not find a slider for the parameter "' + paramName + '".');
// } // }
} }
...@@ -32,7 +32,7 @@ define('Sliders', ['logme'], function (logme) { ...@@ -32,7 +32,7 @@ define('Sliders', ['logme'], function (logme) {
// Check that the retrieval went OK. // Check that the retrieval went OK.
if (paramObj === undefined) { if (paramObj === undefined) {
logme('ERROR: Could not get a paramObj for parameter "' + paramName + '".'); console.log('ERROR: Could not get a paramObj for parameter "' + paramName + '".');
return; return;
} }
...@@ -69,13 +69,13 @@ define('Sliders', ['logme'], function (logme) { ...@@ -69,13 +69,13 @@ define('Sliders', ['logme'], function (logme) {
// change the our value back in the case when the new value is // change the our value back in the case when the new value is
// invalid for some reason. // invalid for some reason.
if (state.setParameterValue(paramName, ui.value, sliderDiv, true, 'slide') === undefined) { if (state.setParameterValue(paramName, ui.value, sliderDiv, true, 'slide') === undefined) {
logme('ERROR: Could not update the parameter named "' + paramName + '" with the value "' + ui.value + '".'); console.log('ERROR: Could not update the parameter named "' + paramName + '" with the value "' + ui.value + '".');
} }
} }
function sliderOnChange(event, ui) { function sliderOnChange(event, ui) {
if (state.setParameterValue(paramName, ui.value, sliderDiv, true, 'change') === undefined) { if (state.setParameterValue(paramName, ui.value, sliderDiv, true, 'change') === undefined) {
logme('ERROR: Could not update the parameter named "' + paramName + '" with the value "' + ui.value + '".'); console.log('ERROR: Could not update the parameter named "' + paramName + '" with the value "' + ui.value + '".');
} }
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// define() functions from Require JS available inside the anonymous function. // define() functions from Require JS available inside the anonymous function.
(function (requirejs, require, define) { (function (requirejs, require, define) {
define('State', ['logme'], function (logme) { define('State', [], function () {
var stateInst; var stateInst;
// Since there will be (can be) multiple GST on a page, and each will have // Since there will be (can be) multiple GST on a page, and each will have
...@@ -24,7 +24,7 @@ define('State', ['logme'], function (logme) { ...@@ -24,7 +24,7 @@ define('State', ['logme'], function (logme) {
dynamicElByElId = {}; dynamicElByElId = {};
stateInst += 1; stateInst += 1;
// logme('MESSAGE: Creating state instance # ' + stateInst + '.'); // console.log('MESSAGE: Creating state instance # ' + stateInst + '.');
// Initially, there are no parameters to track. So, we will instantiate // Initially, there are no parameters to track. So, we will instantiate
// an empty object. // an empty object.
...@@ -39,8 +39,8 @@ define('State', ['logme'], function (logme) { ...@@ -39,8 +39,8 @@ define('State', ['logme'], function (logme) {
// Check that the required parameters config object is available. // Check that the required parameters config object is available.
if ($.isPlainObject(config.parameters) === false) { if ($.isPlainObject(config.parameters) === false) {
logme('ERROR: Expected config.parameters to be an object. It is not.'); console.log('ERROR: Expected config.parameters to be an object. It is not.');
logme('config.parameters = ', config.parameters); console.log('config.parameters = ', config.parameters);
return; return;
} }
...@@ -65,8 +65,8 @@ define('State', ['logme'], function (logme) { ...@@ -65,8 +65,8 @@ define('State', ['logme'], function (logme) {
// If config.parameters.param is some other type, report an error and // If config.parameters.param is some other type, report an error and
// do not continue. // do not continue.
else { else {
logme('ERROR: config.parameters.param is of an unsupported type.'); console.log('ERROR: config.parameters.param is of an unsupported type.');
logme('config.parameters.param = ', config.parameters.param); console.log('config.parameters.param = ', config.parameters.param);
return; return;
} }
...@@ -112,7 +112,7 @@ define('State', ['logme'], function (logme) { ...@@ -112,7 +112,7 @@ define('State', ['logme'], function (logme) {
function getParamObj(paramName) { function getParamObj(paramName) {
if (parameters.hasOwnProperty(paramName) === false) { if (parameters.hasOwnProperty(paramName) === false) {
logme('ERROR: Object parameters does not have a property named "' + paramName + '".'); console.log('ERROR: Object parameters does not have a property named "' + paramName + '".');
return; return;
} }
...@@ -137,7 +137,7 @@ define('State', ['logme'], function (logme) { ...@@ -137,7 +137,7 @@ define('State', ['logme'], function (logme) {
}); });
if (typeof dynamicElByElId[elId] !== 'undefined') { if (typeof dynamicElByElId[elId] !== 'undefined') {
logme( console.log(
'ERROR: Duplicate dynamic element ID "' + elId + '" found.' 'ERROR: Duplicate dynamic element ID "' + elId + '" found.'
); );
} else { } else {
...@@ -150,7 +150,7 @@ define('State', ['logme'], function (logme) { ...@@ -150,7 +150,7 @@ define('State', ['logme'], function (logme) {
// If the name of the constant is not tracked by state, return an // If the name of the constant is not tracked by state, return an
// 'undefined' value. // 'undefined' value.
if (parameters.hasOwnProperty(paramName) === false) { if (parameters.hasOwnProperty(paramName) === false) {
logme('ERROR: Object parameters does not have a property named "' + paramName + '".'); console.log('ERROR: Object parameters does not have a property named "' + paramName + '".');
return; return;
} }
...@@ -197,7 +197,7 @@ define('State', ['logme'], function (logme) { ...@@ -197,7 +197,7 @@ define('State', ['logme'], function (logme) {
// If a parameter with the name specified by the 'paramName' // If a parameter with the name specified by the 'paramName'
// parameter is not tracked by state, do not do anything. // parameter is not tracked by state, do not do anything.
if (parameters.hasOwnProperty(paramName) === false) { if (parameters.hasOwnProperty(paramName) === false) {
logme('ERROR: Object parameters does not have a property named "' + paramName + '".'); console.log('ERROR: Object parameters does not have a property named "' + paramName + '".');
return; return;
} }
...@@ -209,8 +209,8 @@ define('State', ['logme'], function (logme) { ...@@ -209,8 +209,8 @@ define('State', ['logme'], function (logme) {
// We are interested only in valid float values. NaN, -INF, // We are interested only in valid float values. NaN, -INF,
// +INF we will disregard. // +INF we will disregard.
if (isFinite(paramValueNum) === false) { if (isFinite(paramValueNum) === false) {
logme('ERROR: New parameter value is not a floating-point number.'); console.log('ERROR: New parameter value is not a floating-point number.');
logme('paramValue = ', paramValue); console.log('paramValue = ', paramValue);
return; return;
} }
...@@ -299,8 +299,8 @@ define('State', ['logme'], function (logme) { ...@@ -299,8 +299,8 @@ define('State', ['logme'], function (logme) {
var paramName, newParamObj; var paramName, newParamObj;
if (typeof obj['@var'] !== 'string') { if (typeof obj['@var'] !== 'string') {
logme('ERROR: Expected obj["@var"] to be a string. It is not.'); console.log('ERROR: Expected obj["@var"] to be a string. It is not.');
logme('obj["@var"] = ', obj['@var']); console.log('obj["@var"] = ', obj['@var']);
return; return;
} }
...@@ -314,7 +314,7 @@ define('State', ['logme'], function (logme) { ...@@ -314,7 +314,7 @@ define('State', ['logme'], function (logme) {
(processFloat('@step', 'step') === false) || (processFloat('@step', 'step') === false) ||
(processFloat('@initial', 'value') === false) (processFloat('@initial', 'value') === false)
) { ) {
logme('ERROR: A required property is missing. Not creating parameter "' + paramName + '"'); console.log('ERROR: A required property is missing. Not creating parameter "' + paramName + '"');
return; return;
} }
...@@ -335,16 +335,16 @@ define('State', ['logme'], function (logme) { ...@@ -335,16 +335,16 @@ define('State', ['logme'], function (logme) {
var attrValue; var attrValue;
if (typeof obj[attrName] !== 'string') { if (typeof obj[attrName] !== 'string') {
logme('ERROR: Expected obj["' + attrName + '"] to be a string. It is not.'); console.log('ERROR: Expected obj["' + attrName + '"] to be a string. It is not.');
logme('obj["' + attrName + '"] = ', obj[attrName]); console.log('obj["' + attrName + '"] = ', obj[attrName]);
return false; return false;
} else { } else {
attrValue = parseFloat(obj[attrName]); attrValue = parseFloat(obj[attrName]);
if (isFinite(attrValue) === false) { if (isFinite(attrValue) === false) {
logme('ERROR: Expected obj["' + attrName + '"] to be a valid floating-point number. It is not.'); console.log('ERROR: Expected obj["' + attrName + '"] to be a valid floating-point number. It is not.');
logme('obj["' + attrName + '"] = ', obj[attrName]); console.log('obj["' + attrName + '"] = ', obj[attrName]);
return false; return false;
} }
......
// Wrapper for RequireJS. It will make the standard requirejs(), require(), and
// define() functions from Require JS available inside the anonymous function.
(function (requirejs, require, define) {
define('logme', [], function () {
var debugMode;
// debugMode can be one of the following:
//
// true - All messages passed to logme will be written to the internal
// browser console.
// false - Suppress all output to the internal browser console.
//
// Obviously, if anywhere there is a direct console.log() call, we can't do
// anything about it. That's why use logme() - it will allow to turn off
// the output of debug information with a single change to a variable.
debugMode = true;
return logme;
/*
* function: logme
*
* A helper function that provides logging facilities. We don't want
* to call console.log() directly, because sometimes it is not supported
* by the browser. Also when everything is routed through this function.
* the logging output can be easily turned off.
*
* logme() supports multiple parameters. Each parameter will be passed to
* console.log() function separately.
*
*/
function logme() {
var i;
if (
(typeof debugMode === 'undefined') ||
(debugMode !== true) ||
(typeof window.console === 'undefined')
) {
return;
}
for (i = 0; i < arguments.length; i++) {
window.console.log(arguments[i]);
}
} // End-of: function logme
});
// End of wrapper for RequireJS. As you can see, we are passing
// namespaced Require JS variables to an anonymous function. Within
// it, you can use the standard requirejs(), require(), and define()
// functions as if they were in the global namespace.
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define)
(function (requirejs, require, define) { (function (requirejs, require, define) {
define('PollMain', ['logme'], function (logme) { define('PollMain', [], function () {
PollMain.prototype = { PollMain.prototype = {
...@@ -240,7 +240,7 @@ function PollMain(el) { ...@@ -240,7 +240,7 @@ function PollMain(el) {
this.questionEl = $(el).find('.poll_question'); this.questionEl = $(el).find('.poll_question');
if (this.questionEl.length !== 1) { if (this.questionEl.length !== 1) {
// We require one question DOM element. // We require one question DOM element.
logme('ERROR: PollMain constructor requires one question DOM element.'); console.log('ERROR: PollMain constructor requires one question DOM element.');
return; return;
} }
...@@ -248,7 +248,7 @@ function PollMain(el) { ...@@ -248,7 +248,7 @@ function PollMain(el) {
// Just a safety precussion. If we run this code more than once, multiple 'click' callback handlers will be // Just a safety precussion. If we run this code more than once, multiple 'click' callback handlers will be
// attached to the same DOM elements. We don't want this to happen. // attached to the same DOM elements. We don't want this to happen.
if (this.questionEl.attr('poll_main_processed') === 'true') { if (this.questionEl.attr('poll_main_processed') === 'true') {
logme( console.log(
'ERROR: PolMain JS constructor was called on a DOM element that has already been processed once.' 'ERROR: PolMain JS constructor was called on a DOM element that has already been processed once.'
); );
...@@ -308,7 +308,7 @@ function PollMain(el) { ...@@ -308,7 +308,7 @@ function PollMain(el) {
return; return;
} catch (err) { } catch (err) {
logme( console.log(
'ERROR: Invalid JSON config for poll ID "' + this.id + '".', 'ERROR: Invalid JSON config for poll ID "' + this.id + '".',
'Error messsage: "' + err.message + '".' 'Error messsage: "' + err.message + '".'
); );
...@@ -317,7 +317,7 @@ function PollMain(el) { ...@@ -317,7 +317,7 @@ function PollMain(el) {
} }
} // End-of: function PollMain(el) { } // End-of: function PollMain(el) {
}); // End-of: define('PollMain', ['logme'], function (logme) { }); // End-of: define('PollMain', [], function () {
// End-of: (function (requirejs, require, define) { // End-of: (function (requirejs, require, define) {
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); }(RequireJS.requirejs, RequireJS.require, RequireJS.define));
// Wrapper for RequireJS. It will make the standard requirejs(), require(), and
// define() functions from Require JS available inside the anonymous function.
(function (requirejs, require, define) {
define('logme', [], function () {
var debugMode;
// debugMode can be one of the following:
//
// true - All messages passed to logme will be written to the internal
// browser console.
// false - Suppress all output to the internal browser console.
//
// Obviously, if anywhere there is a direct console.log() call, we can't do
// anything about it. That's why use logme() - it will allow to turn off
// the output of debug information with a single change to a variable.
debugMode = true;
return logme;
/*
* function: logme
*
* A helper function that provides logging facilities. We don't want
* to call console.log() directly, because sometimes it is not supported
* by the browser. Also when everything is routed through this function.
* the logging output can be easily turned off.
*
* logme() supports multiple parameters. Each parameter will be passed to
* console.log() function separately.
*
*/
function logme() {
var i;
if (
(typeof debugMode === 'undefined') ||
(debugMode !== true) ||
(typeof window.console === 'undefined')
) {
return;
}
for (i = 0; i < arguments.length; i++) {
window.console.log(arguments[i]);
}
} // End-of: function logme
});
// End of wrapper for RequireJS. As you can see, we are passing
// namespaced Require JS variables to an anonymous function. Within
// it, you can use the standard requirejs(), require(), and define()
// functions as if they were in the global namespace.
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define)
...@@ -8,13 +8,11 @@ ...@@ -8,13 +8,11 @@
* *
* @exports WordCloudMain * @exports WordCloudMain
* *
* @requires logme
*
* @external d3, $, RequireJS * @external d3, $, RequireJS
*/ */
(function (requirejs, require, define) { (function (requirejs, require, define) {
define('WordCloudMain', ['logme'], function (logme) { define('WordCloudMain', [], function () {
/** /**
* @function WordCloudMain * @function WordCloudMain
...@@ -50,7 +48,7 @@ define('WordCloudMain', ['logme'], function (logme) { ...@@ -50,7 +48,7 @@ define('WordCloudMain', ['logme'], function (logme) {
_this.ajax_url + '/' + 'get_state', null, _this.ajax_url + '/' + 'get_state', null,
function (response) { function (response) {
if (response.status !== 'success') { if (response.status !== 'success') {
logme('ERROR: ' + response.error); console.log('ERROR: ' + response.error);
return; return;
} }
...@@ -96,7 +94,7 @@ define('WordCloudMain', ['logme'], function (logme) { ...@@ -96,7 +94,7 @@ define('WordCloudMain', ['logme'], function (logme) {
_this.ajax_url + '/' + 'submit', $.param(data), _this.ajax_url + '/' + 'submit', $.param(data),
function (response) { function (response) {
if (response.status !== 'success') { if (response.status !== 'success') {
logme('ERROR: ' + response.error); console.log('ERROR: ' + response.error);
return; return;
} }
...@@ -290,5 +288,5 @@ define('WordCloudMain', ['logme'], function (logme) { ...@@ -290,5 +288,5 @@ define('WordCloudMain', ['logme'], function (logme) {
return WordCloudMain; return WordCloudMain;
}); // End-of: define('WordCloudMain', ['logme'], function (logme) { }); // End-of: define('WordCloudMain', [], function () {
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) { }(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) {
...@@ -40,8 +40,7 @@ class PollModule(PollFields, XModule): ...@@ -40,8 +40,7 @@ class PollModule(PollFields, XModule):
"""Poll Module""" """Poll Module"""
js = { js = {
'coffee': [resource_string(__name__, 'js/src/javascript_loader.coffee')], 'coffee': [resource_string(__name__, 'js/src/javascript_loader.coffee')],
'js': [resource_string(__name__, 'js/src/poll/logme.js'), 'js': [resource_string(__name__, 'js/src/poll/poll.js'),
resource_string(__name__, 'js/src/poll/poll.js'),
resource_string(__name__, 'js/src/poll/poll_main.js')] resource_string(__name__, 'js/src/poll/poll_main.js')]
} }
css = {'scss': [resource_string(__name__, 'css/poll/display.scss')]} css = {'scss': [resource_string(__name__, 'css/poll/display.scss')]}
......
...@@ -83,8 +83,7 @@ class WordCloudModule(WordCloudFields, XModule): ...@@ -83,8 +83,7 @@ class WordCloudModule(WordCloudFields, XModule):
"""WordCloud Xmodule""" """WordCloud Xmodule"""
js = { js = {
'coffee': [resource_string(__name__, 'js/src/javascript_loader.coffee')], 'coffee': [resource_string(__name__, 'js/src/javascript_loader.coffee')],
'js': [resource_string(__name__, 'js/src/word_cloud/logme.js'), 'js': [resource_string(__name__, 'js/src/word_cloud/d3.min.js'),
resource_string(__name__, 'js/src/word_cloud/d3.min.js'),
resource_string(__name__, 'js/src/word_cloud/d3.layout.cloud.js'), resource_string(__name__, 'js/src/word_cloud/d3.layout.cloud.js'),
resource_string(__name__, 'js/src/word_cloud/word_cloud.js'), resource_string(__name__, 'js/src/word_cloud/word_cloud.js'),
resource_string(__name__, 'js/src/word_cloud/word_cloud_main.js')] resource_string(__name__, 'js/src/word_cloud/word_cloud_main.js')]
......
(function (requirejs, require, define) { (function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme'], function (logme) { define([], function () {
return BaseImage; return BaseImage;
function BaseImage(state) { function BaseImage(state) {
...@@ -36,7 +36,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -36,7 +36,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
state.baseImageLoaded = true; state.baseImageLoaded = true;
}); });
state.baseImageEl.error(function () { state.baseImageEl.error(function () {
logme('ERROR: Image "' + state.config.baseImage + '" was not found!'); console.log('ERROR: Image "' + state.config.baseImage + '" was not found!');
baseImageElContainer.html( baseImageElContainer.html(
'<span style="color: red;">' + '<span style="color: red;">' +
'ERROR: Image "' + state.config.baseImage + '" was not found!' + 'ERROR: Image "' + state.config.baseImage + '" was not found!' +
...@@ -45,5 +45,5 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -45,5 +45,5 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
baseImageElContainer.appendTo(state.containerEl); baseImageElContainer.appendTo(state.containerEl);
}); });
} }
}); // End-of: define(['logme'], function (logme) { }); // End-of: define([], function () {
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) { }(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) {
(function (requirejs, require, define) { (function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme'], function (logme) { define([], function () {
return configParser; return configParser;
function configParser(state, config) { function configParser(state, config) {
...@@ -32,7 +32,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -32,7 +32,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
function getDraggables(state, config) { function getDraggables(state, config) {
if (config.hasOwnProperty('draggables') === false) { if (config.hasOwnProperty('draggables') === false) {
logme('ERROR: "config" does not have a property "draggables".'); console.log('ERROR: "config" does not have a property "draggables".');
state.config.foundErrors = true; state.config.foundErrors = true;
} else if ($.isArray(config.draggables) === true) { } else if ($.isArray(config.draggables) === true) {
config.draggables.every(function (draggable) { config.draggables.every(function (draggable) {
...@@ -47,19 +47,19 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -47,19 +47,19 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
return true; return true;
}); });
} else { } else {
logme('ERROR: The type of config.draggables is no supported.'); console.log('ERROR: The type of config.draggables is no supported.');
state.config.foundErrors = true; state.config.foundErrors = true;
} }
} }
function getBaseImage(state, config) { function getBaseImage(state, config) {
if (config.hasOwnProperty('base_image') === false) { if (config.hasOwnProperty('base_image') === false) {
logme('ERROR: "config" does not have a property "base_image".'); console.log('ERROR: "config" does not have a property "base_image".');
state.config.foundErrors = true; state.config.foundErrors = true;
} else if (typeof config.base_image === 'string') { } else if (typeof config.base_image === 'string') {
state.config.baseImage = config.base_image; state.config.baseImage = config.base_image;
} else { } else {
logme('ERROR: Property config.base_image is not of type "string".'); console.log('ERROR: Property config.base_image is not of type "string".');
state.config.foundErrors = true; state.config.foundErrors = true;
} }
} }
...@@ -83,14 +83,14 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -83,14 +83,14 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
return true; return true;
}); });
} else { } else {
logme('ERROR: Property config.targets is not of a supported type.'); console.log('ERROR: Property config.targets is not of a supported type.');
state.config.foundErrors = true; state.config.foundErrors = true;
} }
} }
function getOnePerTarget(state, config) { function getOnePerTarget(state, config) {
if (config.hasOwnProperty('one_per_target') === false) { if (config.hasOwnProperty('one_per_target') === false) {
logme('ERROR: "config" does not have a property "one_per_target".'); console.log('ERROR: "config" does not have a property "one_per_target".');
state.config.foundErrors = true; state.config.foundErrors = true;
} else if (typeof config.one_per_target === 'string') { } else if (typeof config.one_per_target === 'string') {
if (config.one_per_target.toLowerCase() === 'true') { if (config.one_per_target.toLowerCase() === 'true') {
...@@ -98,11 +98,11 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -98,11 +98,11 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
} else if (config.one_per_target.toLowerCase() === 'false') { } else if (config.one_per_target.toLowerCase() === 'false') {
state.config.onePerTarget = false; state.config.onePerTarget = false;
} else { } else {
logme('ERROR: Property config.one_per_target can either be "true", or "false".'); console.log('ERROR: Property config.one_per_target can either be "true", or "false".');
state.config.foundErrors = true; state.config.foundErrors = true;
} }
} else { } else {
logme('ERROR: Property config.one_per_target is not of a supported type.'); console.log('ERROR: Property config.one_per_target is not of a supported type.');
state.config.foundErrors = true; state.config.foundErrors = true;
} }
} }
...@@ -118,11 +118,11 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -118,11 +118,11 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
} else if (config.target_outline.toLowerCase() === 'false') { } else if (config.target_outline.toLowerCase() === 'false') {
state.config.targetOutline = false; state.config.targetOutline = false;
} else { } else {
logme('ERROR: Property config.target_outline can either be "true", or "false".'); console.log('ERROR: Property config.target_outline can either be "true", or "false".');
state.config.foundErrors = true; state.config.foundErrors = true;
} }
} else { } else {
logme('ERROR: Property config.target_outline is not of a supported type.'); console.log('ERROR: Property config.target_outline is not of a supported type.');
state.config.foundErrors = true; state.config.foundErrors = true;
} }
} }
...@@ -136,7 +136,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -136,7 +136,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
if (typeof config.label_bg_color === 'string') { if (typeof config.label_bg_color === 'string') {
state.config.labelBgColor = config.label_bg_color; state.config.labelBgColor = config.label_bg_color;
} else { } else {
logme('ERROR: Property config.label_bg_color is not of a supported type.'); console.log('ERROR: Property config.label_bg_color is not of a supported type.');
} }
} }
} }
...@@ -206,11 +206,11 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -206,11 +206,11 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
function attrIsString(obj, attr) { function attrIsString(obj, attr) {
if (obj.hasOwnProperty(attr) === false) { if (obj.hasOwnProperty(attr) === false) {
logme('ERROR: Attribute "obj.' + attr + '" is not present.'); console.log('ERROR: Attribute "obj.' + attr + '" is not present.');
return false; return false;
} else if (typeof obj[attr] !== 'string') { } else if (typeof obj[attr] !== 'string') {
logme('ERROR: Attribute "obj.' + attr + '" is not a string.'); console.log('ERROR: Attribute "obj.' + attr + '" is not a string.');
return false; return false;
} }
...@@ -222,7 +222,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -222,7 +222,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
var tempInt; var tempInt;
if (obj.hasOwnProperty(attr) === false) { if (obj.hasOwnProperty(attr) === false) {
logme('ERROR: Attribute "obj.' + attr + '" is not present.'); console.log('ERROR: Attribute "obj.' + attr + '" is not present.');
return false; return false;
} }
...@@ -230,7 +230,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -230,7 +230,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
tempInt = parseInt(obj[attr], 10); tempInt = parseInt(obj[attr], 10);
if (isFinite(tempInt) === false) { if (isFinite(tempInt) === false) {
logme('ERROR: Attribute "obj.' + attr + '" is not an integer.'); console.log('ERROR: Attribute "obj.' + attr + '" is not an integer.');
return false; return false;
} }
...@@ -243,7 +243,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -243,7 +243,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
function attrIsBoolean(obj, attr, defaultVal) { function attrIsBoolean(obj, attr, defaultVal) {
if (obj.hasOwnProperty(attr) === false) { if (obj.hasOwnProperty(attr) === false) {
if (defaultVal === undefined) { if (defaultVal === undefined) {
logme('ERROR: Attribute "obj.' + attr + '" is not present.'); console.log('ERROR: Attribute "obj.' + attr + '" is not present.');
return false; return false;
} else { } else {
...@@ -260,12 +260,12 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -260,12 +260,12 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
} else if ((obj[attr] === 'true') || (obj[attr] === true)) { } else if ((obj[attr] === 'true') || (obj[attr] === true)) {
obj[attr] = true; obj[attr] = true;
} else { } else {
logme('ERROR: Attribute "obj.' + attr + '" is not a boolean.'); console.log('ERROR: Attribute "obj.' + attr + '" is not a boolean.');
return false; return false;
} }
return true; return true;
} }
}); // End-of: define(['logme'], function (logme) { }); // End-of: define([], function () {
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) { }(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) {
(function (requirejs, require, define) { (function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme'], function (logme) { define([], function () {
return Container; return Container;
function Container(state) { function Container(state) {
...@@ -16,5 +16,5 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -16,5 +16,5 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
$('#inputtype_' + state.problemId).before(state.containerEl); $('#inputtype_' + state.problemId).before(state.containerEl);
} }
}); // End-of: define(['logme'], function (logme) { }); // End-of: define([], function () {
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) { }(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) {
(function (requirejs, require, define) { (function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme'], function (logme) { define([], function () {
return { return {
'attachMouseEventsTo': function (element) { 'attachMouseEventsTo': function (element) {
var self; var self;
...@@ -127,5 +127,5 @@ return { ...@@ -127,5 +127,5 @@ return {
} }
} }
}; // End-of: return { }; // End-of: return {
}); // End-of: define(['logme'], function (logme) { }); // End-of: define([], function () {
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) { }(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) {
(function (requirejs, require, define) { (function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme', 'js/capa/drag_and_drop/update_input', 'js/capa/drag_and_drop/targets'], function (logme, updateInput, Targets) { define(['js/capa/drag_and_drop/update_input', 'js/capa/drag_and_drop/targets'], function (updateInput, Targets) {
return { return {
'moveDraggableTo': function (moveType, target, funcCallback) { 'moveDraggableTo': function (moveType, target, funcCallback) {
var self, offset; var self, offset;
...@@ -383,5 +383,5 @@ return { ...@@ -383,5 +383,5 @@ return {
this.inContainer = true; this.inContainer = true;
} }
}; // End-of: return { }; // End-of: return {
}); // End-of: define(['logme', 'update_input', 'targets'], function (logme, updateInput, Targets) { }); // End-of: define(['update_input', 'targets'], function (updateInput, Targets) {
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) { }(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) {
(function (requirejs, require, define) { (function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme', 'js/capa/drag_and_drop/draggable_events', 'js/capa/drag_and_drop/draggable_logic'], function (logme, draggableEvents, draggableLogic) { define(['js/capa/drag_and_drop/draggable_events', 'js/capa/drag_and_drop/draggable_logic'], function (draggableEvents, draggableLogic) {
return { return {
'init': init 'init': init
}; };
...@@ -307,5 +307,5 @@ define(['js/capa/drag_and_drop/logme', 'js/capa/drag_and_drop/draggable_events', ...@@ -307,5 +307,5 @@ define(['js/capa/drag_and_drop/logme', 'js/capa/drag_and_drop/draggable_events',
state.numDraggablesInSlider += 1; state.numDraggablesInSlider += 1;
draggableObj.stateDraggablesIndex = state.draggables.push(draggableObj) - 1; draggableObj.stateDraggablesIndex = state.draggables.push(draggableObj) - 1;
} }
}); // End-of: define(['logme', 'draggable_events', 'draggable_logic'], function (logme, draggableEvents, draggableLogic) { }); // End-of: define(['draggable_events', 'draggable_logic'], function (draggableEvents, draggableLogic) {
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) { }(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) {
(function (requirejs, require, define) {
define([], function () {
var debugMode;
debugMode = true;
return logme;
function logme() {
var i;
if (
(debugMode !== true) ||
(typeof window.console === 'undefined')
) {
return;
}
i = 0;
while (i < arguments.length) {
window.console.log(arguments[i]);
i += 1;
}
}
}); // End-of: define([], function () {
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) {
(function (requirejs, require, define) { (function (requirejs, require, define) {
define( define(
['js/capa/drag_and_drop/logme', 'js/capa/drag_and_drop/state', ['js/capa/drag_and_drop/state',
'js/capa/drag_and_drop/config_parser', 'js/capa/drag_and_drop/container', 'js/capa/drag_and_drop/config_parser', 'js/capa/drag_and_drop/container',
'js/capa/drag_and_drop/base_image', 'js/capa/drag_and_drop/scroller', 'js/capa/drag_and_drop/base_image', 'js/capa/drag_and_drop/scroller',
'js/capa/drag_and_drop/draggables', 'js/capa/drag_and_drop/targets', 'js/capa/drag_and_drop/draggables', 'js/capa/drag_and_drop/targets',
'js/capa/drag_and_drop/update_input'], 'js/capa/drag_and_drop/update_input'],
function (logme, State, configParser, Container, BaseImage, Scroller, Draggables, Targets, updateInput) { function (State, configParser, Container, BaseImage, Scroller, Draggables, Targets, updateInput) {
return Main; return Main;
function Main() { function Main() {
...@@ -57,7 +57,7 @@ define( ...@@ -57,7 +57,7 @@ define(
problemId = $(value).attr('data-plain-id'); problemId = $(value).attr('data-plain-id');
if (typeof problemId !== 'string') { if (typeof problemId !== 'string') {
logme('ERROR: Could not find the ID of the problem DOM element.'); console.log('ERROR: Could not find the ID of the problem DOM element.');
return; return;
} }
...@@ -65,8 +65,8 @@ define( ...@@ -65,8 +65,8 @@ define(
try { try {
config = JSON.parse($('#drag_and_drop_json_' + problemId).html()); config = JSON.parse($('#drag_and_drop_json_' + problemId).html());
} catch (err) { } catch (err) {
logme('ERROR: Could not parse the JSON configuration options.'); console.log('ERROR: Could not parse the JSON configuration options.');
logme('Error message: "' + err.message + '".'); console.log('Error message: "' + err.message + '".');
return; return;
} }
...@@ -74,7 +74,7 @@ define( ...@@ -74,7 +74,7 @@ define(
state = State(problemId); state = State(problemId);
if (configParser(state, config) !== true) { if (configParser(state, config) !== true) {
logme('ERROR: Could not make sense of the JSON configuration options.'); console.log('ERROR: Could not make sense of the JSON configuration options.');
return; return;
} }
......
(function (requirejs, require, define) { (function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme'], function (logme) { define([], function () {
return Scroller; return Scroller;
function Scroller(state) { function Scroller(state) {
...@@ -201,5 +201,5 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -201,5 +201,5 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
} }
} }
} // End-of: function Scroller(state) } // End-of: function Scroller(state)
}); // End-of: define(['logme'], function (logme) { }); // End-of: define([], function () {
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) { }(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) {
(function (requirejs, require, define) { (function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme'], function (logme) { define([], function () {
return { return {
'initializeBaseTargets': initializeBaseTargets, 'initializeBaseTargets': initializeBaseTargets,
'initializeTargetField': initializeTargetField, 'initializeTargetField': initializeTargetField,
...@@ -268,5 +268,5 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -268,5 +268,5 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
this.numTextEl.html(this.draggableList.length); this.numTextEl.html(this.draggableList.length);
} }
} }
}); // End-of: define(['logme'], function (logme) { }); // End-of: define([], function () {
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) { }(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) {
(function (requirejs, require, define) { (function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme'], function (logme) { define([], function () {
return { return {
'check': check, 'check': check,
'update': update 'update': update
...@@ -187,7 +187,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -187,7 +187,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
if ((draggable = getById(state, 'draggables', draggableId)) === null) { if ((draggable = getById(state, 'draggables', draggableId)) === null) {
if (reportError !== false) { if (reportError !== false) {
logme( console.log(
'ERROR: In answer there exists a ' + 'ERROR: In answer there exists a ' +
'draggable ID "' + draggableId + '". No ' + 'draggable ID "' + draggableId + '". No ' +
'draggable with this ID could be found.' 'draggable with this ID could be found.'
...@@ -199,7 +199,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -199,7 +199,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
if ((target = getById(state, 'targets', targetId)) === null) { if ((target = getById(state, 'targets', targetId)) === null) {
if (reportError !== false) { if (reportError !== false) {
logme( console.log(
'ERROR: In answer there exists a target ' + 'ERROR: In answer there exists a target ' +
'ID "' + targetId + '". No target with this ' + 'ID "' + targetId + '". No target with this ' +
'ID could be found.' 'ID could be found.'
...@@ -225,7 +225,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -225,7 +225,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
} }
if ((draggable = getById(state, 'draggables', draggableId)) === null) { if ((draggable = getById(state, 'draggables', draggableId)) === null) {
logme( console.log(
'ERROR: In answer there exists a ' + 'ERROR: In answer there exists a ' +
'draggable ID "' + draggableId + '". No ' + 'draggable ID "' + draggableId + '". No ' +
'draggable with this ID could be found.' 'draggable with this ID could be found.'
...@@ -359,5 +359,5 @@ define(['js/capa/drag_and_drop/logme'], function (logme) { ...@@ -359,5 +359,5 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
return null; return null;
}(0)); }(0));
} }
}); // End-of: define(['logme'], function (logme) { }); // End-of: define([], function () {
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) { }(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment