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):
# 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/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/sliders.js'),
resource_string(__name__, 'js/src/graphical_slider_tool/inputs.js'),
......
......@@ -2,7 +2,7 @@
// define() functions from Require JS available inside the anonymous function.
(function (requirejs, require, define) {
define('ElOutput', ['logme'], function (logme) {
define('ElOutput', [], function () {
return ElOutput;
......@@ -37,13 +37,13 @@ define('ElOutput', ['logme'], function (logme) {
}
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;
}
if (typeof obj['#text'] !== 'string') {
logme('ERROR: Function body is not defined.');
console.log('ERROR: Function body is not defined.');
return;
}
......@@ -73,7 +73,7 @@ define('ElOutput', ['logme'], function (logme) {
}
} else {
if (funcString.search(/return/i) === -1) {
logme(
console.log(
'ERROR: You have specified a JavaScript ' +
'function without a "return" statemnt. Your ' +
'function will return "undefined" by default.'
......@@ -91,12 +91,12 @@ define('ElOutput', ['logme'], function (logme) {
try {
func = Function.apply(null, paramNames);
} catch (err) {
logme(
console.log(
'ERROR: The function body "' +
funcString +
'" was not converted by the Function constructor.'
);
logme('Error message: "' + err.message + '".');
console.log('Error message: "' + err.message + '".');
if (state.showDebugInfo) {
$('#' + 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) {
el = $('#' + obj['@el_id']);
if (el.length !== 1) {
logme(
console.log(
'ERROR: DOM element with ID "' + obj['@el_id'] + '" ' +
'not found. Dynamic element not created.'
);
......
......@@ -2,7 +2,7 @@
// define() functions from Require JS available inside the anonymous function.
(function (requirejs, require, define) {
define('GLabelElOutput', ['logme'], function (logme) {
define('GLabelElOutput', [], function () {
return GLabelElOutput;
function GLabelElOutput(config, state) {
......@@ -35,13 +35,13 @@ define('GLabelElOutput', ['logme'], function (logme) {
}
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;
}
if (typeof obj['#text'] !== 'string') {
logme('ERROR: Function body is not defined.');
console.log('ERROR: Function body is not defined.');
return;
}
......@@ -62,7 +62,7 @@ define('GLabelElOutput', ['logme'], function (logme) {
}
} else {
if (funcString.search(/return/i) === -1) {
logme(
console.log(
'ERROR: You have specified a JavaScript ' +
'function without a "return" statemnt. Your ' +
'function will return "undefined" by default.'
......@@ -80,12 +80,12 @@ define('GLabelElOutput', ['logme'], function (logme) {
try {
func = Function.apply(null, paramNames);
} catch (err) {
logme(
console.log(
'ERROR: The function body "' +
funcString +
'" was not converted by the Function constructor.'
);
logme('Error message: "' + err.message + '".');
console.log('Error message: "' + err.message + '".');
if (state.showDebugInfo) {
$('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not create a function from string "' + funcString + '".' + '</div>');
......
......@@ -8,8 +8,8 @@ define(
// 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
// with additional useful methods that are used in other modules.
['State', 'GeneralMethods', 'Sliders', 'Inputs', 'Graph', 'ElOutput', 'GLabelElOutput', 'logme'],
function (State, GeneralMethods, Sliders, Inputs, Graph, ElOutput, GLabelElOutput, logme) {
['State', 'GeneralMethods', 'Sliders', 'Inputs', 'Graph', 'ElOutput', 'GLabelElOutput'],
function (State, GeneralMethods, Sliders, Inputs, Graph, ElOutput, GLabelElOutput) {
return GstMain;
......@@ -19,7 +19,7 @@ define(
if ($('#' + gstId).attr('data-processed') !== 'processed') {
$('#' + gstId).attr('data-processed', 'processed');
} else {
// logme('MESSAGE: Already processed GST with ID ' + gstId + '. Skipping.');
// console.log('MESSAGE: Already processed GST with ID ' + gstId + '. Skipping.');
return;
}
......@@ -28,10 +28,10 @@ define(
try {
config = JSON.parse($('#' + gstId + '_json').html()).root;
} catch (err) {
logme('ERROR: could not parse config JSON.');
logme('$("#" + gstId + "_json").html() = ', $('#' + gstId + '_json').html());
logme('JSON.parse(...) = ', JSON.parse($('#' + gstId + '_json').html()));
logme('config = ', config);
console.log('ERROR: could not parse config JSON.');
console.log('$("#" + gstId + "_json").html() = ', $('#' + gstId + '_json').html());
console.log('JSON.parse(...) = ', JSON.parse($('#' + gstId + '_json').html()));
console.log('config = ', config);
return;
}
......@@ -40,8 +40,8 @@ define(
// name that is based on the class name of the GST. For example, inputs
// are assigned a class name '{GST class name}_input'.
if (typeof config['@class'] !== 'string') {
logme('ERROR: Could not get the class name of GST.');
logme('config["@class"] = ', config['@class']);
console.log('ERROR: Could not get the class name of GST.');
console.log('config["@class"] = ', config['@class']);
return;
}
......@@ -56,7 +56,7 @@ define(
// It is possible that something goes wrong while extracting parameters
// from the JSON config object. In this case, we will not continue.
if (state === undefined) {
logme('ERROR: The state object was not initialized properly.');
console.log('ERROR: The state object was not initialized properly.');
return;
}
......
......@@ -2,7 +2,7 @@
// define() functions from Require JS available inside the anonymous function.
(function (requirejs, require, define) {
define('Inputs', ['logme'], function (logme) {
define('Inputs', [], function () {
return Inputs;
function Inputs(gstId, gstClass, state) {
......@@ -32,7 +32,7 @@ define('Inputs', ['logme'], function (logme) {
// Check that the retrieval went OK.
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;
}
......
// 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 @@
// define() functions from Require JS available inside the anonymous function.
(function (requirejs, require, define) {
define('Sliders', ['logme'], function (logme) {
define('Sliders', [], function () {
return Sliders;
function Sliders(gstId, state) {
......@@ -18,10 +18,10 @@ define('Sliders', ['logme'], function (logme) {
if (sliderDiv.length === 1) {
createSlider(sliderDiv, paramName);
} else if (sliderDiv.length > 1) {
logme('ERROR: Found more than one slider for the parameter "' + paramName + '".');
logme('sliderDiv.length = ', sliderDiv.length);
console.log('ERROR: Found more than one slider for the parameter "' + paramName + '".');
console.log('sliderDiv.length = ', sliderDiv.length);
} // 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) {
// Check that the retrieval went OK.
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;
}
......@@ -69,13 +69,13 @@ define('Sliders', ['logme'], function (logme) {
// change the our value back in the case when the new value is
// invalid for some reason.
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) {
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 @@
// define() functions from Require JS available inside the anonymous function.
(function (requirejs, require, define) {
define('State', ['logme'], function (logme) {
define('State', [], function () {
var stateInst;
// Since there will be (can be) multiple GST on a page, and each will have
......@@ -24,7 +24,7 @@ define('State', ['logme'], function (logme) {
dynamicElByElId = {};
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
// an empty object.
......@@ -39,8 +39,8 @@ define('State', ['logme'], function (logme) {
// Check that the required parameters config object is available.
if ($.isPlainObject(config.parameters) === false) {
logme('ERROR: Expected config.parameters to be an object. It is not.');
logme('config.parameters = ', config.parameters);
console.log('ERROR: Expected config.parameters to be an object. It is not.');
console.log('config.parameters = ', config.parameters);
return;
}
......@@ -65,8 +65,8 @@ define('State', ['logme'], function (logme) {
// If config.parameters.param is some other type, report an error and
// do not continue.
else {
logme('ERROR: config.parameters.param is of an unsupported type.');
logme('config.parameters.param = ', config.parameters.param);
console.log('ERROR: config.parameters.param is of an unsupported type.');
console.log('config.parameters.param = ', config.parameters.param);
return;
}
......@@ -112,7 +112,7 @@ define('State', ['logme'], function (logme) {
function getParamObj(paramName) {
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;
}
......@@ -137,7 +137,7 @@ define('State', ['logme'], function (logme) {
});
if (typeof dynamicElByElId[elId] !== 'undefined') {
logme(
console.log(
'ERROR: Duplicate dynamic element ID "' + elId + '" found.'
);
} else {
......@@ -150,7 +150,7 @@ define('State', ['logme'], function (logme) {
// If the name of the constant is not tracked by state, return an
// 'undefined' value.
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;
}
......@@ -197,7 +197,7 @@ define('State', ['logme'], function (logme) {
// If a parameter with the name specified by the 'paramName'
// parameter is not tracked by state, do not do anything.
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;
}
......@@ -209,8 +209,8 @@ define('State', ['logme'], function (logme) {
// We are interested only in valid float values. NaN, -INF,
// +INF we will disregard.
if (isFinite(paramValueNum) === false) {
logme('ERROR: New parameter value is not a floating-point number.');
logme('paramValue = ', paramValue);
console.log('ERROR: New parameter value is not a floating-point number.');
console.log('paramValue = ', paramValue);
return;
}
......@@ -299,8 +299,8 @@ define('State', ['logme'], function (logme) {
var paramName, newParamObj;
if (typeof obj['@var'] !== 'string') {
logme('ERROR: Expected obj["@var"] to be a string. It is not.');
logme('obj["@var"] = ', obj['@var']);
console.log('ERROR: Expected obj["@var"] to be a string. It is not.');
console.log('obj["@var"] = ', obj['@var']);
return;
}
......@@ -314,7 +314,7 @@ define('State', ['logme'], function (logme) {
(processFloat('@step', 'step') === 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;
}
......@@ -335,16 +335,16 @@ define('State', ['logme'], function (logme) {
var attrValue;
if (typeof obj[attrName] !== 'string') {
logme('ERROR: Expected obj["' + attrName + '"] to be a string. It is not.');
logme('obj["' + attrName + '"] = ', obj[attrName]);
console.log('ERROR: Expected obj["' + attrName + '"] to be a string. It is not.');
console.log('obj["' + attrName + '"] = ', obj[attrName]);
return false;
} else {
attrValue = parseFloat(obj[attrName]);
if (isFinite(attrValue) === false) {
logme('ERROR: Expected obj["' + attrName + '"] to be a valid floating-point number. It is not.');
logme('obj["' + attrName + '"] = ', obj[attrName]);
console.log('ERROR: Expected obj["' + attrName + '"] to be a valid floating-point number. It is not.');
console.log('obj["' + attrName + '"] = ', obj[attrName]);
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) {
define('PollMain', ['logme'], function (logme) {
define('PollMain', [], function () {
PollMain.prototype = {
......@@ -240,7 +240,7 @@ function PollMain(el) {
this.questionEl = $(el).find('.poll_question');
if (this.questionEl.length !== 1) {
// 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;
}
......@@ -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
// attached to the same DOM elements. We don't want this to happen.
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.'
);
......@@ -308,7 +308,7 @@ function PollMain(el) {
return;
} catch (err) {
logme(
console.log(
'ERROR: Invalid JSON config for poll ID "' + this.id + '".',
'Error messsage: "' + err.message + '".'
);
......@@ -317,7 +317,7 @@ 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) {
}(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 @@
*
* @exports WordCloudMain
*
* @requires logme
*
* @external d3, $, RequireJS
*/
(function (requirejs, require, define) {
define('WordCloudMain', ['logme'], function (logme) {
define('WordCloudMain', [], function () {
/**
* @function WordCloudMain
......@@ -50,7 +48,7 @@ define('WordCloudMain', ['logme'], function (logme) {
_this.ajax_url + '/' + 'get_state', null,
function (response) {
if (response.status !== 'success') {
logme('ERROR: ' + response.error);
console.log('ERROR: ' + response.error);
return;
}
......@@ -96,7 +94,7 @@ define('WordCloudMain', ['logme'], function (logme) {
_this.ajax_url + '/' + 'submit', $.param(data),
function (response) {
if (response.status !== 'success') {
logme('ERROR: ' + response.error);
console.log('ERROR: ' + response.error);
return;
}
......@@ -290,5 +288,5 @@ define('WordCloudMain', ['logme'], function (logme) {
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) {
......@@ -40,8 +40,7 @@ class PollModule(PollFields, XModule):
"""Poll Module"""
js = {
'coffee': [resource_string(__name__, 'js/src/javascript_loader.coffee')],
'js': [resource_string(__name__, 'js/src/poll/logme.js'),
resource_string(__name__, 'js/src/poll/poll.js'),
'js': [resource_string(__name__, 'js/src/poll/poll.js'),
resource_string(__name__, 'js/src/poll/poll_main.js')]
}
css = {'scss': [resource_string(__name__, 'css/poll/display.scss')]}
......
......@@ -83,8 +83,7 @@ class WordCloudModule(WordCloudFields, XModule):
"""WordCloud Xmodule"""
js = {
'coffee': [resource_string(__name__, 'js/src/javascript_loader.coffee')],
'js': [resource_string(__name__, 'js/src/word_cloud/logme.js'),
resource_string(__name__, 'js/src/word_cloud/d3.min.js'),
'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/word_cloud.js'),
resource_string(__name__, 'js/src/word_cloud/word_cloud_main.js')]
......
(function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme'], function (logme) {
define([], function () {
return BaseImage;
function BaseImage(state) {
......@@ -36,7 +36,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
state.baseImageLoaded = true;
});
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(
'<span style="color: red;">' +
'ERROR: Image "' + state.config.baseImage + '" was not found!' +
......@@ -45,5 +45,5 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
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) {
(function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme'], function (logme) {
define([], function () {
return configParser;
function configParser(state, config) {
......@@ -32,7 +32,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
function getDraggables(state, config) {
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;
} else if ($.isArray(config.draggables) === true) {
config.draggables.every(function (draggable) {
......@@ -47,19 +47,19 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
return true;
});
} 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;
}
}
function getBaseImage(state, config) {
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;
} else if (typeof config.base_image === 'string') {
state.config.baseImage = config.base_image;
} 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;
}
}
......@@ -83,14 +83,14 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
return true;
});
} 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;
}
}
function getOnePerTarget(state, config) {
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;
} else if (typeof config.one_per_target === 'string') {
if (config.one_per_target.toLowerCase() === 'true') {
......@@ -98,11 +98,11 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
} else if (config.one_per_target.toLowerCase() === 'false') {
state.config.onePerTarget = false;
} 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;
}
} 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;
}
}
......@@ -118,11 +118,11 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
} else if (config.target_outline.toLowerCase() === 'false') {
state.config.targetOutline = false;
} 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;
}
} 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;
}
}
......@@ -136,7 +136,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
if (typeof config.label_bg_color === 'string') {
state.config.labelBgColor = config.label_bg_color;
} 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) {
function attrIsString(obj, attr) {
if (obj.hasOwnProperty(attr) === false) {
logme('ERROR: Attribute "obj.' + attr + '" is not present.');
console.log('ERROR: Attribute "obj.' + attr + '" is not present.');
return false;
} 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;
}
......@@ -222,7 +222,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
var tempInt;
if (obj.hasOwnProperty(attr) === false) {
logme('ERROR: Attribute "obj.' + attr + '" is not present.');
console.log('ERROR: Attribute "obj.' + attr + '" is not present.');
return false;
}
......@@ -230,7 +230,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
tempInt = parseInt(obj[attr], 10);
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;
}
......@@ -243,7 +243,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
function attrIsBoolean(obj, attr, defaultVal) {
if (obj.hasOwnProperty(attr) === false) {
if (defaultVal === undefined) {
logme('ERROR: Attribute "obj.' + attr + '" is not present.');
console.log('ERROR: Attribute "obj.' + attr + '" is not present.');
return false;
} else {
......@@ -260,12 +260,12 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
} else if ((obj[attr] === 'true') || (obj[attr] === true)) {
obj[attr] = true;
} else {
logme('ERROR: Attribute "obj.' + attr + '" is not a boolean.');
console.log('ERROR: Attribute "obj.' + attr + '" is not a boolean.');
return false;
}
return true;
}
}); // End-of: define(['logme'], function (logme) {
}); // End-of: define([], function () {
}(RequireJS.requirejs, RequireJS.require, RequireJS.define)); // End-of: (function (requirejs, require, define) {
(function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme'], function (logme) {
define([], function () {
return Container;
function Container(state) {
......@@ -16,5 +16,5 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
$('#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) {
(function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme'], function (logme) {
define([], function () {
return {
'attachMouseEventsTo': function (element) {
var self;
......@@ -127,5 +127,5 @@ 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) {
(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 {
'moveDraggableTo': function (moveType, target, funcCallback) {
var self, offset;
......@@ -383,5 +383,5 @@ return {
this.inContainer = true;
}
}; // 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) {
(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 {
'init': init
};
......@@ -307,5 +307,5 @@ define(['js/capa/drag_and_drop/logme', 'js/capa/drag_and_drop/draggable_events',
state.numDraggablesInSlider += 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) {
(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) {
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/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/update_input'],
function (logme, State, configParser, Container, BaseImage, Scroller, Draggables, Targets, updateInput) {
function (State, configParser, Container, BaseImage, Scroller, Draggables, Targets, updateInput) {
return Main;
function Main() {
......@@ -57,7 +57,7 @@ define(
problemId = $(value).attr('data-plain-id');
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;
}
......@@ -65,8 +65,8 @@ define(
try {
config = JSON.parse($('#drag_and_drop_json_' + problemId).html());
} catch (err) {
logme('ERROR: Could not parse the JSON configuration options.');
logme('Error message: "' + err.message + '".');
console.log('ERROR: Could not parse the JSON configuration options.');
console.log('Error message: "' + err.message + '".');
return;
}
......@@ -74,7 +74,7 @@ define(
state = State(problemId);
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;
}
......
(function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme'], function (logme) {
define([], function () {
return Scroller;
function Scroller(state) {
......@@ -201,5 +201,5 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
}
}
} // 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) {
(function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme'], function (logme) {
define([], function () {
return {
'initializeBaseTargets': initializeBaseTargets,
'initializeTargetField': initializeTargetField,
......@@ -268,5 +268,5 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
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) {
(function (requirejs, require, define) {
define(['js/capa/drag_and_drop/logme'], function (logme) {
define([], function () {
return {
'check': check,
'update': update
......@@ -187,7 +187,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
if ((draggable = getById(state, 'draggables', draggableId)) === null) {
if (reportError !== false) {
logme(
console.log(
'ERROR: In answer there exists a ' +
'draggable ID "' + draggableId + '". No ' +
'draggable with this ID could be found.'
......@@ -199,7 +199,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
if ((target = getById(state, 'targets', targetId)) === null) {
if (reportError !== false) {
logme(
console.log(
'ERROR: In answer there exists a target ' +
'ID "' + targetId + '". No target with this ' +
'ID could be found.'
......@@ -225,7 +225,7 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
}
if ((draggable = getById(state, 'draggables', draggableId)) === null) {
logme(
console.log(
'ERROR: In answer there exists a ' +
'draggable ID "' + draggableId + '". No ' +
'draggable with this ID could be found.'
......@@ -359,5 +359,5 @@ define(['js/capa/drag_and_drop/logme'], function (logme) {
return null;
}(0));
}
}); // End-of: define(['logme'], function (logme) {
}); // End-of: define([], function () {
}(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