Permalink
Browse files

Make global variables explicit.

Other fixes suggested by jsLint.
  • Loading branch information...
1 parent 4cc1739 commit 6598646d2d547c148b37fd49c35ccded68d1688d @bvds committed Dec 31, 2013
View
@@ -1,6 +1,6 @@
dojo.provide("andes.Combo");
-andes.Combo = dojox.drawing.util.oo.declare(
+window.andes.Combo = dojox.drawing.util.oo.declare(
// summary:
// A special object used to combine an Andes Stencil
// (Vector, Rect, Ellipse)
@@ -35,7 +35,7 @@ andes.Combo = dojox.drawing.util.oo.declare(
var s = this.statement;
var m = this.master;
- console.warn("combo statement:", this.statement)
+ console.warn("combo statement:", this.statement);
this.statement.connectMult([
[this.statement, "onChangeData", this, "textPositionEdit"],
@@ -90,7 +90,7 @@ andes.Combo = dojox.drawing.util.oo.declare(
// split in two parts. First is textEdit which triggers
// onChangeData for final text changes. TextPositionEdit handles
// position changes.
- var label = andes.variablename.parse(value);
+ var label = window.andes.variablename.parse(value);
var ol = this.master.getLabel();
if(label){
console.log("textEdit: LABEL=", label," text=",value);
@@ -136,7 +136,7 @@ andes.Combo = dojox.drawing.util.oo.declare(
},
onDelete: function(value){ // value or 'this' ?
- console.log("combo delete ", value)
+ console.log("combo delete ", value);
// summary:
// Stub - fires when master or an item is deleted
// (which makes this _Connection worthless and it
@@ -201,9 +201,9 @@ andes.Combo = dojox.drawing.util.oo.declare(
dojo.forEach(handles, dojo.disconnect, dojo);
}
}
-)
+);
-andes.buttonCombo = dojox.drawing.util.oo.declare(
+window.andes.buttonCombo = dojox.drawing.util.oo.declare(
// summary:
// A special object used to combine a Button and a Statement.
//
@@ -237,4 +237,4 @@ andes.buttonCombo = dojox.drawing.util.oo.declare(
}
}
-)
+);
@@ -8,9 +8,9 @@ dojo.provide("andes.PreferenceRegistry");
// server to update values that register here.
// Example api:
// andes.api.recordAction({type:"set-preference", name: "display-timer", value: true});
- _prefs = {};
+ var _prefs = {};
- andes.preferenceRegistry = {
+ window.andes.preferenceRegistry = {
// Prefs are name value pairs with scope so that the server
// can update them.
registerPref: function(/*String*/pref, /*function*/setter, scope){
@@ -28,7 +28,7 @@ dojo.provide("andes.PreferenceRegistry");
}else{
if(_prefs[pref].value != value){
// This is user changed
- andes.api.recordAction({type:"set-preference", name:pref, value:value });
+ window.andes.api.recordAction({type:"set-preference", name:pref, value:value });
}
return true;
}
@@ -51,5 +51,5 @@ dojo.provide("andes.PreferenceRegistry");
return false;
}
}
- }
-})();
+ };
+})();
View
@@ -31,7 +31,7 @@ dojo.declare("andes.WordTip", null, {
console.log("andes.WordTip.textMonitor this=",this);
var tx = dojo.trim(this.conEdit.innerHTML);//this.statement.cleanText(conEdit.innerHTML);
tx = this.removeBreaks(tx);
- var symbol = andes.variablename.parse(tx);
+ var symbol = window.andes.variablename.parse(tx);
console.log("---Text for word-suggest----> ", tx,symbol);
this.sendToServer(tx,symbol);
};
@@ -41,7 +41,7 @@ dojo.declare("andes.WordTip", null, {
var cn = dojo.connect(document,"mouseup",this, function(evt){
dojo.disconnect(cn);
dijit.hideTooltip(this.conEdit);
- })
+ });
},
removeBreaks: function(txt){
@@ -54,7 +54,7 @@ dojo.declare("andes.WordTip", null, {
sendToServer: function(text,symbol){
console.assert(this.theDrawing,"WordTip needs drawing initialized");
var current;
- var andesTypes = andes.convert.andesTypes;
+ var andesTypes = window.andes.convert.andesTypes;
// The most recent stencil will either be the last selected or the last
// tool. Thus find out the id, if it matches the last selected that's
@@ -79,7 +79,7 @@ dojo.declare("andes.WordTip", null, {
};
// console.log("current: ",current);
if(current && this.hasTip[current]){
- andes.api.suggestWord({type: current, text: text, symbol:symbol});
+ window.andes.api.suggestWord({type: current, text: text, symbol:symbol});
}
},
@@ -105,4 +105,4 @@ dojo.declare("andes.WordTip", null, {
};
},this);
}
-});
+});
View
@@ -17,12 +17,12 @@ dojo.require("andes.timer");
// AOP-style function replacement that performs before-advice
// to add to the headers on all XHR requests. See dojox/rpc/Client.js
(function(){
- console.info("api set headers", andes.sessionId)
- andes._originalXhr = dojo.xhr;
+ console.info("api set headers", window.andes.sessionId);
+ window.andes._originalXhr = dojo.xhr;
dojo.xhr = function(method,args){
var headers = args.headers = args.headers || {};
- headers["Client-Id"] = andes.sessionId;
- return andes._originalXhr.apply(dojo,arguments);
+ headers["Client-Id"] = window.andes.sessionId;
+ return window.andes._originalXhr.apply(dojo,arguments);
};
})();
@@ -37,14 +37,14 @@ dojo.require("andes.timer");
var request = prepRequest(req.params);
requestInFlight = true;
req.startTime = (new Date()).getTime();
- andes.rpc[req.method](request).addCallbacks(
+ window.andes.rpc[req.method](request).addCallbacks(
function(result){
requestInFlight = false;
var dt=(new Date()).getTime()-req.startTime;
// log any server latency larger than cutoff in ms.
// Should match Andes server timeout.
if(dt>15000){
- andes.errorLog({
+ window.andes.errorLog({
title: "latency",
message: dt + " ms for " + req.method
});
@@ -61,16 +61,16 @@ dojo.require("andes.timer");
// the RPC action to open-problemo
//
req.dfd.errback(error);
- var mo = andes.messages.server();
+ var mo = window.andes.messages.server();
var msg = "<p>"+mo.message+"</p><div class='errMsg'>" + error.name + ": " + error.message;
if(error._rpcErrorObject.code){
msg += "\n(code " + error._rpcErrorObject.code + ")";
}
msg += "</div><div class='action'>"+mo.action+"</div>";
- andes.error({
+ window.andes.error({
title: mo.title,
message: msg,
- errorType: andes.error.OK
+ errorType: window.andes.error.OK
});
}else{
//
@@ -79,18 +79,18 @@ dojo.require("andes.timer");
// Can be generated by changing the SMD URL
//
if(++tries <= MAX_RETRIES){
- setTimeout(function(){
+ window.setTimeout(function(){
sendRequest(req);
}, RETRY_TIMEOUT);
}else{
req.dfd.errback(error);
console.error(error);
- var mo = andes.messages.connection(MAX_RETRIES);
- console.dir(mo)
- andes.error({
+ var mo = window.andes.messages.connection(MAX_RETRIES);
+ console.dir(mo);
+ window.andes.error({
title: mo.title,
message: mo.message+"<div class='action'>"+mo.action+"</div>",
- dialogType: andes.error.OK
+ dialogType: window.andes.error.OK
});
}
}
@@ -120,17 +120,17 @@ dojo.require("andes.timer");
return dfd;
}
- andes.api = {
+ window.andes.api = {
open: function(params){
//console.info("andes.api.open", params);
startTime = (new Date()).getTime();
- andes.timer = new andes.timer(startTime);
+ window.andes.timer = new window.andes.timer(startTime);
var dfd = queueRequest("open-problem", params);
dfd.addCallback(function(result){
// look for help embedded in the returned result, so we can
// queue it up in case the user opens the Tutor pane
- andes.help.processStep(result);
+ window.andes.help.processStep(result);
});
return dfd;
},
@@ -141,7 +141,7 @@ dojo.require("andes.timer");
dfd.addCallback(function(result){
// look for help embedded in the returned result, so we can
// queue it up in case the user opens the Tutor pane
- andes.help.processStep(result);
+ window.andes.help.processStep(result);
});
return dfd;
},
@@ -155,7 +155,7 @@ dojo.require("andes.timer");
//console.info("andes.api.suggestWord", params);
var dfd = queueRequest("suggest-word", params);
dfd.addCallback(function(result){
- andes.WordTip.processResults(result);
+ window.andes.WordTip.processResults(result);
});
return dfd;
},
Oops, something went wrong.

0 comments on commit 6598646

Please sign in to comment.