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

Removing "logme" from comments.

BLD-608
This commit is contained in:
Valera Rozuvan
2013-12-20 12:43:44 +02:00
parent f58e788b83
commit 1542a74d2b
26 changed files with 173 additions and 366 deletions

View File

@@ -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(
'<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) {

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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) {