From 1542a74d2ba649e24bb0d06be437c6e9a4c182a2 Mon Sep 17 00:00:00 2001 From: Valera Rozuvan Date: Fri, 20 Dec 2013 12:43:44 +0200 Subject: [PATCH] Removed logme module. Using console.log() instead. Removing "logme" from comments. BLD-608 --- common/lib/xmodule/xmodule/gst_module.py | 1 - .../js/src/graphical_slider_tool/el_output.js | 14 +- .../g_label_el_output.js | 12 +- .../js/src/graphical_slider_tool/graph.js | 132 +++++++++--------- .../js/src/graphical_slider_tool/gst_main.js | 20 +-- .../js/src/graphical_slider_tool/inputs.js | 4 +- .../js/src/graphical_slider_tool/logme.js | 54 ------- .../js/src/graphical_slider_tool/sliders.js | 14 +- .../js/src/graphical_slider_tool/state.js | 38 ++--- .../lib/xmodule/xmodule/js/src/poll/logme.js | 54 ------- .../xmodule/xmodule/js/src/poll/poll_main.js | 10 +- .../xmodule/js/src/word_cloud/logme.js | 54 ------- .../js/src/word_cloud/word_cloud_main.js | 10 +- common/lib/xmodule/xmodule/poll_module.py | 3 +- .../lib/xmodule/xmodule/word_cloud_module.py | 3 +- .../js/capa/drag_and_drop/base_image.js | 6 +- .../js/capa/drag_and_drop/config_parser.js | 38 ++--- .../static/js/capa/drag_and_drop/container.js | 4 +- .../js/capa/drag_and_drop/draggable_events.js | 4 +- .../js/capa/drag_and_drop/draggable_logic.js | 4 +- .../js/capa/drag_and_drop/draggables.js | 4 +- common/static/js/capa/drag_and_drop/logme.js | 26 ---- common/static/js/capa/drag_and_drop/main.js | 12 +- .../static/js/capa/drag_and_drop/scroller.js | 4 +- .../static/js/capa/drag_and_drop/targets.js | 4 +- .../js/capa/drag_and_drop/update_input.js | 10 +- 26 files changed, 173 insertions(+), 366 deletions(-) delete mode 100644 common/lib/xmodule/xmodule/js/src/graphical_slider_tool/logme.js delete mode 100644 common/lib/xmodule/xmodule/js/src/poll/logme.js delete mode 100644 common/lib/xmodule/xmodule/js/src/word_cloud/logme.js delete mode 100644 common/static/js/capa/drag_and_drop/logme.js diff --git a/common/lib/xmodule/xmodule/gst_module.py b/common/lib/xmodule/xmodule/gst_module.py index 57f95a17dc..fc8e27858e 100644 --- a/common/lib/xmodule/xmodule/gst_module.py +++ b/common/lib/xmodule/xmodule/gst_module.py @@ -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'), diff --git a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/el_output.js b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/el_output.js index 2af55fc83e..f81cdc000b 100644 --- a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/el_output.js +++ b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/el_output.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('
' + 'ERROR IN XML: Could not create a function from string "' + funcString + '".' + '
'); @@ -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.' ); diff --git a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/g_label_el_output.js b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/g_label_el_output.js index 83c6df607d..3ad264d9eb 100644 --- a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/g_label_el_output.js +++ b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/g_label_el_output.js @@ -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('
' + 'ERROR IN XML: Could not create a function from string "' + funcString + '".' + '
'); diff --git a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/graph.js b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/graph.js index 7c2f792258..cc221490eb 100644 --- a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/graph.js +++ b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/graph.js @@ -2,7 +2,7 @@ // define() functions from Require JS available inside the anonymous function. (function (requirejs, require, define) { -define('Graph', ['logme'], function (logme) { +define('Graph', [], function () { return Graph; @@ -19,7 +19,7 @@ define('Graph', ['logme'], function (logme) { // proceed. plotDiv = $('#' + gstId + '_plot'); if (plotDiv.length === 0) { - logme('ERROR: Could not find the plot DIV with ID "' + gstId + '_plot".'); + console.log('ERROR: Could not find the plot DIV with ID "' + gstId + '_plot".'); return; } @@ -40,13 +40,13 @@ define('Graph', ['logme'], function (logme) { // Configure some settings for the graph. if (setGraphXRange() === false) { - logme('ERROR: Could not configure the xrange. Will not continue.'); + console.log('ERROR: Could not configure the xrange. Will not continue.'); return; } if (setGraphAxes() === false) { - logme('ERROR: Could not process configuration for the axes.'); + console.log('ERROR: Could not process configuration for the axes.'); return; } @@ -62,7 +62,7 @@ define('Graph', ['logme'], function (logme) { createFunctions(); if (functions.length === 0) { - logme('ERROR: No functions were specified, or something went wrong.'); + console.log('ERROR: No functions were specified, or something went wrong.'); return; } @@ -91,13 +91,13 @@ define('Graph', ['logme'], function (logme) { } if (typeof config.plot.bar_width !== 'string') { - logme('ERROR: The parameter config.plot.bar_width must be a string.'); + console.log('ERROR: The parameter config.plot.bar_width must be a string.'); return; } if (isFinite(graphBarWidth = parseFloat(config.plot.bar_width)) === false) { - logme('ERROR: The parameter config.plot.bar_width is not a valid floating number.'); + console.log('ERROR: The parameter config.plot.bar_width is not a valid floating number.'); graphBarWidth = 1; return; @@ -112,7 +112,7 @@ define('Graph', ['logme'], function (logme) { } if (typeof config.plot.bar_align !== 'string') { - logme('ERROR: The parameter config.plot.bar_align must be a string.'); + console.log('ERROR: The parameter config.plot.bar_align must be a string.'); return; } @@ -121,7 +121,7 @@ define('Graph', ['logme'], function (logme) { (config.plot.bar_align.toLowerCase() !== 'left') && (config.plot.bar_align.toLowerCase() !== 'center') ) { - logme('ERROR: Property config.plot.bar_align can be one of "left", or "center".'); + console.log('ERROR: Property config.plot.bar_align can be one of "left", or "center".'); return; } @@ -159,24 +159,24 @@ define('Graph', ['logme'], function (logme) { fontWeight, fontColor; if (obj.hasOwnProperty('@text') === false) { - logme('ERROR: You did not define a "text" attribute for the moving_label.'); + console.log('ERROR: You did not define a "text" attribute for the moving_label.'); return false; } if (typeof obj['@text'] !== 'string') { - logme('ERROR: "text" attribute is not a string.'); + console.log('ERROR: "text" attribute is not a string.'); return false; } labelText = obj['@text']; if (obj.hasOwnProperty('#text') === false) { - logme('ERROR: moving_label is missing function declaration.'); + console.log('ERROR: moving_label is missing function declaration.'); return false; } if (typeof obj['#text'] !== 'string') { - logme('ERROR: Function declaration is not a string.'); + console.log('ERROR: Function declaration is not a string.'); return false; } @@ -201,7 +201,7 @@ define('Graph', ['logme'], function (logme) { ) { fontWeight = obj['@weight']; } else { - logme('ERROR: Moving label can have a weight property of "normal" or "bold".'); + console.log('ERROR: Moving label can have a weight property of "normal" or "bold".'); } } @@ -221,7 +221,7 @@ define('Graph', ['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.' @@ -235,12 +235,12 @@ define('Graph', ['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('
' + 'ERROR IN XML: Could not create a function from the string "' + funcString + '".' + '
'); @@ -317,12 +317,12 @@ define('Graph', ['logme'], function (logme) { } else if (asyObj['@type'].toLowerCase() === 'y') { newAsyObj.type = 'y'; } else { - logme('ERROR: Attribute "type" for asymptote can be "x" or "y".'); + console.log('ERROR: Attribute "type" for asymptote can be "x" or "y".'); return false; } } else { - logme('ERROR: Attribute "type" for asymptote is not specified.'); + console.log('ERROR: Attribute "type" for asymptote is not specified.'); return false; } @@ -330,7 +330,7 @@ define('Graph', ['logme'], function (logme) { if (typeof asyObj['#text'] === 'string') { funcString = asyObj['#text']; } else { - logme('ERROR: Function body for asymptote is not specified.'); + console.log('ERROR: Function body for asymptote is not specified.'); return false; } @@ -363,7 +363,7 @@ define('Graph', ['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.' @@ -376,8 +376,8 @@ define('Graph', ['logme'], function (logme) { try { func = Function.apply(null, paramNames); } catch (err) { - logme('ERROR: Asymptote function body could not be converted to function object.'); - logme('Error message: "".' + err.message); + console.log('ERROR: Asymptote function body could not be converted to function object.'); + console.log('Error message: "".' + err.message); return false; } @@ -398,12 +398,12 @@ define('Graph', ['logme'], function (logme) { if (typeof config.plot['xticks'] === 'string') { if (processTicks(config.plot['xticks'], xaxis, 'xunits') === false) { - logme('ERROR: Could not process the ticks for x-axis.'); + console.log('ERROR: Could not process the ticks for x-axis.'); return false; } } else { - // logme('MESSAGE: "xticks" were not specified. Using defaults.'); + // console.log('MESSAGE: "xticks" were not specified. Using defaults.'); return false; } @@ -413,12 +413,12 @@ define('Graph', ['logme'], function (logme) { }; if (typeof config.plot['yticks'] === 'string') { if (processTicks(config.plot['yticks'], yaxis, 'yunits') === false) { - logme('ERROR: Could not process the ticks for y-axis.'); + console.log('ERROR: Could not process the ticks for y-axis.'); return false; } } else { - // logme('MESSAGE: "yticks" were not specified. Using defaults.'); + // console.log('MESSAGE: "yticks" were not specified. Using defaults.'); return false; } @@ -466,7 +466,7 @@ define('Graph', ['logme'], function (logme) { try { tmpObj = JSON.parse(config.plot[axisName + 'ticks_names']); } catch (err) { - logme( + console.log( 'ERROR: plot.' + axisName + 'ticks_names is not a valid JSON string.', 'Error message: "' + err.message + '".' ); @@ -494,7 +494,7 @@ define('Graph', ['logme'], function (logme) { ticksBlobs = ticksStr.split(','); if (ticksBlobs.length !== 3) { - logme('ERROR: Did not get 3 blobs from ticksStr = "' + ticksStr + '".'); + console.log('ERROR: Did not get 3 blobs from ticksStr = "' + ticksStr + '".'); return false; } @@ -503,7 +503,7 @@ define('Graph', ['logme'], function (logme) { if (isNaN(tempFloat) === false) { ticksObj.min = tempFloat; } else { - logme('ERROR: Invalid "min". ticksBlobs[0] = ', ticksBlobs[0]); + console.log('ERROR: Invalid "min". ticksBlobs[0] = ', ticksBlobs[0]); return false; } @@ -512,7 +512,7 @@ define('Graph', ['logme'], function (logme) { if (isNaN(tempFloat) === false) { ticksObj.tickSize = tempFloat; } else { - logme('ERROR: Invalid "tickSize". ticksBlobs[1] = ', ticksBlobs[1]); + console.log('ERROR: Invalid "tickSize". ticksBlobs[1] = ', ticksBlobs[1]); return false; } @@ -521,7 +521,7 @@ define('Graph', ['logme'], function (logme) { if (isNaN(tempFloat) === false) { ticksObj.max = tempFloat; } else { - logme('ERROR: Invalid "max". ticksBlobs[2] = ', ticksBlobs[2]); + console.log('ERROR: Invalid "max". ticksBlobs[2] = ', ticksBlobs[2]); return false; } @@ -529,7 +529,7 @@ define('Graph', ['logme'], function (logme) { // Is the starting tick to the left of the ending tick (on the // x-axis)? If not, set default starting and ending tick. if (ticksObj.min >= ticksObj.max) { - logme('ERROR: Ticks min >= max.'); + console.log('ERROR: Ticks min >= max.'); return false; } @@ -538,7 +538,7 @@ define('Graph', ['logme'], function (logme) { // least 3 ticks. If not, set a tickSize which will produce // 11 ticks. tickSize is the spacing between the ticks. if (ticksObj.tickSize > ticksObj.max - ticksObj.min) { - logme('ERROR: tickSize > max - min.'); + console.log('ERROR: tickSize > max - min.'); return false; } @@ -633,17 +633,17 @@ define('Graph', ['logme'], function (logme) { xrange = {}; if ($.isPlainObject(config.plot.xrange) === false) { - logme( + console.log( 'ERROR: Expected config.plot.xrange to be an object. ' + 'It is not.' ); - logme('config.plot.xrange = ', config.plot.xrange); + console.log('config.plot.xrange = ', config.plot.xrange); return false; } if (config.plot.xrange.hasOwnProperty('min') === false) { - logme( + console.log( 'ERROR: Expected config.plot.xrange.min to be ' + 'present. It is not.' ); @@ -675,7 +675,7 @@ define('Graph', ['logme'], function (logme) { disableAutoReturn = true; } } else { - logme( + console.log( 'ERROR: Could not get a function definition for ' + 'xrange.min property.' ); @@ -691,7 +691,7 @@ define('Graph', ['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.' @@ -705,11 +705,11 @@ define('Graph', ['logme'], function (logme) { try { xrange.min = Function.apply(null, allParamNames); } catch (err) { - logme( + console.log( 'ERROR: could not create a function from the string "' + funcString + '" for xrange.min.' ); - logme('Error message: "' + err.message + '"'); + console.log('Error message: "' + err.message + '"'); if (state.showDebugInfo) { $('#' + gstId).html( @@ -728,7 +728,7 @@ define('Graph', ['logme'], function (logme) { allParamNames.pop(); if (config.plot.xrange.hasOwnProperty('max') === false) { - logme( + console.log( 'ERROR: Expected config.plot.xrange.max to be ' + 'present. It is not.' ); @@ -760,7 +760,7 @@ define('Graph', ['logme'], function (logme) { disableAutoReturn = true; } } else { - logme( + console.log( 'ERROR: Could not get a function definition for ' + 'xrange.max property.' ); @@ -776,7 +776,7 @@ define('Graph', ['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.' @@ -788,11 +788,11 @@ define('Graph', ['logme'], function (logme) { try { xrange.max = Function.apply(null, allParamNames); } catch (err) { - logme( + console.log( 'ERROR: could not create a function from the string "' + funcString + '" for xrange.max.' ); - logme('Error message: "' + err.message + '"'); + console.log('Error message: "' + err.message + '"'); if (state.showDebugInfo) { $('#' + gstId).html( @@ -819,11 +819,11 @@ define('Graph', ['logme'], function (logme) { (tempNum < 2) && (tempNum > 1000) ) { - logme( + console.log( 'ERROR: Number of points is outside the allowed range ' + '[2, 1000]' ); - logme('config.plot.num_points = ' + tempNum); + console.log('config.plot.num_points = ' + tempNum); return false; } @@ -839,7 +839,7 @@ define('Graph', ['logme'], function (logme) { functions = []; if (typeof config.functions === 'undefined') { - logme('ERROR: config.functions is undefined.'); + console.log('ERROR: config.functions is undefined.'); return; } @@ -875,7 +875,7 @@ define('Graph', ['logme'], function (logme) { } } } else { - logme('ERROR: config.functions.function is of an unsupported type.'); + console.log('ERROR: config.functions.function is of an unsupported type.'); return; } @@ -909,7 +909,7 @@ define('Graph', ['logme'], function (logme) { // 'plot_label', or 'graph'. However, if the '@output' // attribute is omitted, we will not have reached this. else if (obj['@output'].toLowerCase() !== 'graph') { - logme( + console.log( 'ERROR: Function "output" attribute can be ' + 'either "element", "plot_label", "none" or "graph".' ); @@ -967,7 +967,7 @@ define('Graph', ['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.' @@ -1005,12 +1005,12 @@ define('Graph', ['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('
' + 'ERROR IN XML: Could not create a function from the string "' + funcString + '".' + '
'); @@ -1080,8 +1080,8 @@ define('Graph', ['logme'], function (logme) { } else if (fillArea.toLowerCase() === 'false') { newFunctionObject['fillArea'] = false; } else { - logme('ERROR: The attribute fill_area should be either "true" or "false".'); - logme('fill_area = "' + fillArea + '".'); + console.log('ERROR: The attribute fill_area should be either "true" or "false".'); + console.log('fill_area = "' + fillArea + '".'); return; } @@ -1138,8 +1138,8 @@ define('Graph', ['logme'], function (logme) { try { start = xrange.min.apply(window, paramValues); } catch (err) { - logme('ERROR: Could not determine xrange start.'); - logme('Error message: "' + err.message + '".'); + console.log('ERROR: Could not determine xrange start.'); + console.log('Error message: "' + err.message + '".'); if (state.showDebugInfo) { $('#' + gstId).html('
' + 'ERROR IN XML: Could not determine xrange start from defined function.' + '
'); @@ -1151,8 +1151,8 @@ define('Graph', ['logme'], function (logme) { try { end = xrange.max.apply(window, paramValues); } catch (err) { - logme('ERROR: Could not determine xrange end.'); - logme('Error message: "' + err.message + '".'); + console.log('ERROR: Could not determine xrange end.'); + console.log('Error message: "' + err.message + '".'); if (state.showDebugInfo) { $('#' + gstId).html('
' + 'ERROR IN XML: Could not determine xrange end from defined function.' + '
'); @@ -1184,8 +1184,8 @@ define('Graph', ['logme'], function (logme) { try { y = functionObj.func.apply(window, paramValues); } catch (err) { - logme('ERROR: Could not generate data.'); - logme('Error message: "' + err.message + '".'); + console.log('ERROR: Could not generate data.'); + console.log('Error message: "' + err.message + '".'); if (state.showDebugInfo) { $('#' + gstId).html('
' + 'ERROR IN XML: Could not generate data from defined function.' + '
'); @@ -1215,8 +1215,8 @@ define('Graph', ['logme'], function (logme) { try { y = functionObj.func.apply(window, paramValues); } catch (err) { - logme('ERROR: Could not generate data.'); - logme('Error message: "' + err.message + '".'); + console.log('ERROR: Could not generate data.'); + console.log('Error message: "' + err.message + '".'); if (state.showDebugInfo) { $('#' + gstId).html('
' + 'ERROR IN XML: Could not generate data from function.' + '
'); @@ -1453,8 +1453,8 @@ define('Graph', ['logme'], function (logme) { try { val = asymptote.func.apply(window, paramValues); } catch (err) { - logme('ERROR: Could not generate value from asymptote function.'); - logme('Error message: ', err.message); + console.log('ERROR: Could not generate value from asymptote function.'); + console.log('Error message: ', err.message); continue; } diff --git a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/gst_main.js b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/gst_main.js index e1d1211f6a..733e570333 100644 --- a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/gst_main.js +++ b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/gst_main.js @@ -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; } diff --git a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/inputs.js b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/inputs.js index a04ed113ec..531a939aec 100644 --- a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/inputs.js +++ b/common/lib/xmodule/xmodule/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('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; } diff --git a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/logme.js b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/logme.js deleted file mode 100644 index c045757044..0000000000 --- a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/logme.js +++ /dev/null @@ -1,54 +0,0 @@ -// 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) diff --git a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/sliders.js b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/sliders.js index e73ca1c57e..12b444cc94 100644 --- a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/sliders.js +++ b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/sliders.js @@ -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 + '".'); } } } diff --git a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/state.js b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/state.js index 91a78f62ff..2a4536a8f9 100644 --- a/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/state.js +++ b/common/lib/xmodule/xmodule/js/src/graphical_slider_tool/state.js @@ -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; } diff --git a/common/lib/xmodule/xmodule/js/src/poll/logme.js b/common/lib/xmodule/xmodule/js/src/poll/logme.js deleted file mode 100644 index c045757044..0000000000 --- a/common/lib/xmodule/xmodule/js/src/poll/logme.js +++ /dev/null @@ -1,54 +0,0 @@ -// 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) diff --git a/common/lib/xmodule/xmodule/js/src/poll/poll_main.js b/common/lib/xmodule/xmodule/js/src/poll/poll_main.js index 74f2a488d7..e72d6844a5 100644 --- a/common/lib/xmodule/xmodule/js/src/poll/poll_main.js +++ b/common/lib/xmodule/xmodule/js/src/poll/poll_main.js @@ -1,5 +1,5 @@ (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)); diff --git a/common/lib/xmodule/xmodule/js/src/word_cloud/logme.js b/common/lib/xmodule/xmodule/js/src/word_cloud/logme.js deleted file mode 100644 index c045757044..0000000000 --- a/common/lib/xmodule/xmodule/js/src/word_cloud/logme.js +++ /dev/null @@ -1,54 +0,0 @@ -// 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) diff --git a/common/lib/xmodule/xmodule/js/src/word_cloud/word_cloud_main.js b/common/lib/xmodule/xmodule/js/src/word_cloud/word_cloud_main.js index 9a49cc5cab..c6569cc7f1 100644 --- a/common/lib/xmodule/xmodule/js/src/word_cloud/word_cloud_main.js +++ b/common/lib/xmodule/xmodule/js/src/word_cloud/word_cloud_main.js @@ -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) { diff --git a/common/lib/xmodule/xmodule/poll_module.py b/common/lib/xmodule/xmodule/poll_module.py index 86852cd698..f7e7676000 100644 --- a/common/lib/xmodule/xmodule/poll_module.py +++ b/common/lib/xmodule/xmodule/poll_module.py @@ -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')]} diff --git a/common/lib/xmodule/xmodule/word_cloud_module.py b/common/lib/xmodule/xmodule/word_cloud_module.py index 9595eb6ef9..6f2abe7e79 100644 --- a/common/lib/xmodule/xmodule/word_cloud_module.py +++ b/common/lib/xmodule/xmodule/word_cloud_module.py @@ -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')] diff --git a/common/static/js/capa/drag_and_drop/base_image.js b/common/static/js/capa/drag_and_drop/base_image.js index fa7266f2aa..eec64e230b 100644 --- a/common/static/js/capa/drag_and_drop/base_image.js +++ b/common/static/js/capa/drag_and_drop/base_image.js @@ -1,5 +1,5 @@ (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( '' + '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) { diff --git a/common/static/js/capa/drag_and_drop/config_parser.js b/common/static/js/capa/drag_and_drop/config_parser.js index 3fb82e91bf..804f0019a9 100644 --- a/common/static/js/capa/drag_and_drop/config_parser.js +++ b/common/static/js/capa/drag_and_drop/config_parser.js @@ -1,5 +1,5 @@ (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) { diff --git a/common/static/js/capa/drag_and_drop/container.js b/common/static/js/capa/drag_and_drop/container.js index 8f550dc475..a6e7e45b4a 100644 --- a/common/static/js/capa/drag_and_drop/container.js +++ b/common/static/js/capa/drag_and_drop/container.js @@ -1,5 +1,5 @@ (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) { diff --git a/common/static/js/capa/drag_and_drop/draggable_events.js b/common/static/js/capa/drag_and_drop/draggable_events.js index 0fc74bc3fc..c35531a493 100644 --- a/common/static/js/capa/drag_and_drop/draggable_events.js +++ b/common/static/js/capa/drag_and_drop/draggable_events.js @@ -1,5 +1,5 @@ (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) { diff --git a/common/static/js/capa/drag_and_drop/draggable_logic.js b/common/static/js/capa/drag_and_drop/draggable_logic.js index 25ccc1a587..a850595c77 100644 --- a/common/static/js/capa/drag_and_drop/draggable_logic.js +++ b/common/static/js/capa/drag_and_drop/draggable_logic.js @@ -1,5 +1,5 @@ (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) { diff --git a/common/static/js/capa/drag_and_drop/draggables.js b/common/static/js/capa/drag_and_drop/draggables.js index f26ebd3cdf..9c2222dc47 100644 --- a/common/static/js/capa/drag_and_drop/draggables.js +++ b/common/static/js/capa/drag_and_drop/draggables.js @@ -1,5 +1,5 @@ (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) { diff --git a/common/static/js/capa/drag_and_drop/logme.js b/common/static/js/capa/drag_and_drop/logme.js deleted file mode 100644 index 5a6c5385a6..0000000000 --- a/common/static/js/capa/drag_and_drop/logme.js +++ /dev/null @@ -1,26 +0,0 @@ -(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) { diff --git a/common/static/js/capa/drag_and_drop/main.js b/common/static/js/capa/drag_and_drop/main.js index 9ad7f1bef9..6f9f0c9760 100644 --- a/common/static/js/capa/drag_and_drop/main.js +++ b/common/static/js/capa/drag_and_drop/main.js @@ -1,11 +1,11 @@ (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; } diff --git a/common/static/js/capa/drag_and_drop/scroller.js b/common/static/js/capa/drag_and_drop/scroller.js index 88cba9d429..fe7018baab 100644 --- a/common/static/js/capa/drag_and_drop/scroller.js +++ b/common/static/js/capa/drag_and_drop/scroller.js @@ -1,5 +1,5 @@ (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) { diff --git a/common/static/js/capa/drag_and_drop/targets.js b/common/static/js/capa/drag_and_drop/targets.js index 6262aa20ff..dbfc5d50ef 100644 --- a/common/static/js/capa/drag_and_drop/targets.js +++ b/common/static/js/capa/drag_and_drop/targets.js @@ -1,5 +1,5 @@ (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) { diff --git a/common/static/js/capa/drag_and_drop/update_input.js b/common/static/js/capa/drag_and_drop/update_input.js index 05992f59e9..05be16ac84 100644 --- a/common/static/js/capa/drag_and_drop/update_input.js +++ b/common/static/js/capa/drag_and_drop/update_input.js @@ -1,5 +1,5 @@ (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) {