aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMisko Hevery2010-01-24 19:12:01 -0800
committerMisko Hevery2010-01-24 19:12:01 -0800
commita5c446441fee005975a82885771e8d931e7a4e7a (patch)
tree5f998901d0abd1be01dd2dd656619b7b051d2cc3 /src
parentefad9ec5be8da442af5fb3dffc08510f7a71e10f (diff)
downloadangular.js-a5c446441fee005975a82885771e8d931e7a4e7a.tar.bz2
fix closure compiler incompatibilities
Diffstat (limited to 'src')
-rw-r--r--src/Angular.js4
-rw-r--r--src/ControlBar.js23
-rw-r--r--src/Users.js6
-rw-r--r--src/Widgets.js48
4 files changed, 41 insertions, 40 deletions
diff --git a/src/Angular.js b/src/Angular.js
index cadef4d0..bfbe8ee9 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -269,10 +269,10 @@ function exposeMethods(obj, methods){
function wireAngular(element, config) {
var widgetFactory = new WidgetFactory(config['server'], config['database']);
var binder = new Binder(element[0], widgetFactory, datastore, config['location'], config);
- var controlBar = new ControlBar(element.find('body'), config.server);
+ var controlBar = new ControlBar(element.find('body'), config['server']);
var onUpdate = function(){binder.updateView();};
var server = config['database'] =="$MEMORY" ?
- new FrameServer(this.window) :
+ new FrameServer(window) :
new Server(config['server'], jQuery['getScript']);
server = new VisualServer(server, new Status(jQuery(element.body)), onUpdate);
var users = new Users(server, controlBar);
diff --git a/src/ControlBar.js b/src/ControlBar.js
index a50b8854..6fe5b42d 100644
--- a/src/ControlBar.js
+++ b/src/ControlBar.js
@@ -1,7 +1,7 @@
function ControlBar(document, serverUrl) {
- this.document = document;
+ this._document = document;
this.serverUrl = serverUrl;
- this.window = window;
+ this._window = window;
this.callbacks = [];
};
@@ -39,25 +39,24 @@ ControlBar.prototype = {
},
urlWithoutAnchor: function (path) {
- return this.window.location.href.split("#")[0];
+ return this._window['location']['href'].split("#")[0];
},
doTemplate: function (path) {
var self = this;
var id = new Date().getTime();
- var url = this.urlWithoutAnchor();
- url += "#$iframe_notify=" + id;
+ var url = this.urlWithoutAnchor() + "#$iframe_notify=" + id;
var iframeHeight = 330;
var loginView = jQuery('<div style="overflow:hidden; padding:2px 0 0 0;"><iframe name="'+ url +'" src="'+this.serverUrl + path + '" width="500" height="'+ iframeHeight +'"/></div>');
- this.document.append(loginView);
- loginView.dialog({
- height:iframeHeight + 33, width:500,
- resizable: false, modal:true,
- title: 'Authentication: <a href="http://www.getangular.com"><tt>&lt;angular/&gt;</tt></a>'
+ this._document.append(loginView);
+ loginView['dialog']({
+ 'height':iframeHeight + 33, 'width':500,
+ 'resizable': false, 'modal':true,
+ 'title': 'Authentication: <a href="http://www.getangular.com"><tt>&lt;angular/&gt;</tt></a>'
});
angularCallbacks["_iframe_notify_" + id] = function() {
- loginView.dialog("destroy");
- loginView.remove();
+ loginView['dialog']("destroy");
+ loginView['remove']();
foreach(self.callbacks, function(callback){
callback();
});
diff --git a/src/Users.js b/src/Users.js
index 79ed3129..f81507f4 100644
--- a/src/Users.js
+++ b/src/Users.js
@@ -3,7 +3,7 @@ function Users(server, controlBar) {
this.controlBar = controlBar;
};
-Users.prototype = {
+extend(Users.prototype, {
'fetchCurrentUser':function(callback) {
var self = this;
this.server.request("GET", "/account.json", {}, function(code, response){
@@ -23,7 +23,7 @@ Users.prototype = {
'login': function(callback) {
var self = this;
this.controlBar.login(function(){
- self.fetchCurrentUser(function(){
+ self['fetchCurrentUser'](function(){
(callback||noop)();
});
});
@@ -32,4 +32,4 @@ Users.prototype = {
'notAuthorized': function(){
this.controlBar.notAuthorized();
}
-};
+});
diff --git a/src/Widgets.js b/src/Widgets.js
index a012adf3..cf8c5d99 100644
--- a/src/Widgets.js
+++ b/src/Widgets.js
@@ -2,8 +2,8 @@ function WidgetFactory(serverUrl, database) {
this.nextUploadId = 0;
this.serverUrl = serverUrl;
this.database = database;
- if (window.swfobject) {
- this.createSWF = swfobject.createSWF;
+ if (window['swfobject']) {
+ this.createSWF = window['swfobject']['createSWF'];
} else {
this.createSWF = function(){
alert("ERROR: swfobject not loaded!");
@@ -62,12 +62,12 @@ WidgetFactory.prototype = {
var view = FileController.template(uploadId);
fileInput.after(view);
var att = {
- data:this.serverUrl + "/admin/ServerAPI.swf",
- width:"95", height:"20", align:"top",
- wmode:"transparent"};
+ 'data':this.serverUrl + "/admin/ServerAPI.swf",
+ 'width':"95", 'height':"20", 'align':"top",
+ 'wmode':"transparent"};
var par = {
- flashvars:"uploadWidgetId=" + uploadId,
- allowScriptAccess:"always"};
+ 'flashvars':"uploadWidgetId=" + uploadId,
+ 'allowScriptAccess':"always"};
var swfNode = this.createSWF(att, par, uploadId);
fileInput.remove();
var cntl = new FileController(view, fileInput[0].name, swfNode, this.serverUrl + "/data/" + this.database);
@@ -88,10 +88,12 @@ function FileController(view, scopeName, uploader, databaseUrl) {
this.lastValue = undefined;
};
-FileController.dispatchEvent = function(id, event, args) {
+angularCallbacks['flashEvent'] = function(id, event, args) {
var object = document.getElementById(id);
- var controller = jQuery(object).data("controller");
- FileController.prototype['_on_' + event].apply(controller, args);
+ var jobject = jQuery(object);
+ var controller = jobject.data("controller");
+ FileController.prototype[event].apply(controller, args);
+ jobject.scope().get('$updateView')();
};
FileController.template = function(id) {
@@ -103,23 +105,23 @@ FileController.template = function(id) {
'</span>');
};
-FileController.prototype = {
- '_on_cancel': noop,
- '_on_complete': noop,
- '_on_httpStatus': function(status) {
+extend(FileController.prototype, {
+ 'cancel': noop,
+ 'complete': noop,
+ 'httpStatus': function(status) {
alert("httpStatus:" + this.scopeName + " status:" + status);
},
- '_on_ioError': function() {
+ 'ioError': function() {
alert("ioError:" + this.scopeName);
},
- '_on_open': function() {
+ 'open': function() {
alert("open:" + this.scopeName);
},
- '_on_progress':noop,
- '_on_securityError': function() {
+ 'progress':noop,
+ 'securityError': function() {
alert("securityError:" + this.scopeName);
},
- '_on_uploadCompleteData': function(data) {
+ 'uploadCompleteData': function(data) {
var value = fromJson(data);
value.url = this.attachmentsPath + '/' + value.id + '/' + value.text;
this.view.find("input").attr('checked', true);
@@ -129,7 +131,7 @@ FileController.prototype = {
this.value = null;
scope.get('$binder').updateView();
},
- '_on_select': function(name, size, type) {
+ 'select': function(name, size, type) {
this.name = name;
this.view.find("a").text(name).attr('href', name);
this.view.find("span").text(angular['filter']['bytes'](size));
@@ -161,10 +163,10 @@ FileController.prototype = {
upload: function() {
if (this.name) {
- this.uploader.uploadFile(this.attachmentsPath);
+ this.uploader['uploadFile'](this.attachmentsPath);
}
}
-};
+});
///////////////////////
// NullController
@@ -532,7 +534,7 @@ BindAttrUpdater.prototype = {
}
var attrValue = attrValues.length ? attrValues.join('') : null;
if(isImage && attrName == 'src' && !attrValue)
- attrValue = scope.get('config.server') + '/images/blank.gif';
+ attrValue = scope.get('$config.blankImage');
jNode.attr(attrName, attrValue);
}
}