Skip to content

Commit 826a5f1

Browse files
committed
🛀 reformat (spaces -> tabs, mandatory braces, etc.)
1 parent dee2f7d commit 826a5f1

29 files changed

+12438
-11897
lines changed

ext/update_helper/prototype_update_helper.js

Lines changed: 416 additions & 393 deletions
Large diffs are not rendered by default.

ext/update_helper/update_helper.js

Lines changed: 84 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,97 @@
11
/* Update Helper (c) 2008-2009 Tobie Langel
2-
*
2+
*
33
* Requires Prototype >= 1.6.0
4-
*
4+
*
55
* Update Helper is distributable under the same terms as Prototype
66
* (MIT-style license). For details, see the Prototype web site:
77
* http://www.prototypejs.org/
8-
*
8+
*
99
*--------------------------------------------------------------------------*/
1010

1111
var UpdateHelper = Class.create({
12-
logLevel: 0,
13-
MessageTemplate: new Template('Update Helper: #{message}\n#{stack}'),
14-
Regexp: new RegExp("@" + window.location.protocol + ".*?\\d+\\n", "g"),
15-
16-
initialize: function(deprecatedMethods) {
17-
var notify = function(message, type) {
18-
this.notify(message, type);
19-
}.bind(this); // Late binding to simplify testing.
20-
21-
deprecatedMethods.each(function(d) {
22-
var condition = d.condition,
23-
type = d.type || 'info',
24-
message = d.message,
25-
namespace = d.namespace,
26-
method = d.methodName;
27-
28-
namespace[method] = (namespace[method] || function() {}).wrap(function(proceed) {
29-
var args = $A(arguments).splice(1);
30-
if (!condition || condition.apply(this, args)) notify(message, type);
31-
return proceed.apply(proceed, args);
32-
});
33-
});
34-
Element.addMethods();
35-
},
36-
37-
notify: function(message, type) {
38-
switch(type) {
39-
case 'info':
40-
if (this.logLevel > UpdateHelper.Info) return false;
41-
case 'warn':
42-
if (this.logLevel > UpdateHelper.Warn) return false;
43-
default:
44-
if (this.logLevel > UpdateHelper.Error) return false;
45-
}
46-
this.log(this.MessageTemplate.evaluate({
47-
message: message,
48-
stack: this.getStack()
49-
}), type);
50-
return true;
51-
},
52-
53-
getStack: function() {
54-
try {
55-
throw new Error("stack");
56-
} catch(e) {
57-
var match = (e.stack || '').match(this.Regexp);
58-
if (match) {
59-
return match.reject(function(path) {
60-
return (/(prototype|unittest|update_helper)\.js/).test(path);
61-
}).join("\n");
62-
} else { return ''; }
63-
}
64-
},
65-
66-
log: function(message, type) {
67-
if (type == 'error') console.error(message);
68-
else if (type == 'warn') console.warn(message);
69-
else console.log(message);
70-
}
12+
logLevel : 0,
13+
MessageTemplate: new Template('Update Helper: #{message}\n#{stack}'),
14+
Regexp : new RegExp('@' + window.location.protocol + '.*?\\d+\\n', 'g'),
15+
16+
initialize: function(deprecatedMethods){
17+
var notify = function(message, type){
18+
this.notify(message, type);
19+
}.bind(this); // Late binding to simplify testing.
20+
21+
deprecatedMethods.each(function(d){
22+
var condition = d.condition,
23+
type = d.type || 'info',
24+
message = d.message,
25+
namespace = d.namespace,
26+
method = d.methodName;
27+
28+
namespace[method] = (namespace[method] || function(){
29+
}).wrap(function(proceed){
30+
var args = $A(arguments).splice(1);
31+
if(!condition || condition.apply(this, args)){
32+
notify(message, type);
33+
}
34+
return proceed.apply(proceed, args);
35+
});
36+
});
37+
Element.addMethods();
38+
},
39+
40+
notify: function(message, type){
41+
switch(type){
42+
case 'info':
43+
if(this.logLevel > UpdateHelper.Info){
44+
return false;
45+
}
46+
case 'warn':
47+
if(this.logLevel > UpdateHelper.Warn){
48+
return false;
49+
}
50+
default:
51+
if(this.logLevel > UpdateHelper.Error){
52+
return false;
53+
}
54+
}
55+
this.log(this.MessageTemplate.evaluate({
56+
message: message,
57+
stack : this.getStack(),
58+
}), type);
59+
return true;
60+
},
61+
62+
getStack: function(){
63+
try{
64+
throw new Error('stack');
65+
}
66+
catch(e){
67+
var match = (e.stack || '').match(this.Regexp);
68+
if(match){
69+
return match.reject(function(path){
70+
return (/(prototype|unittest|update_helper)\.js/).test(path);
71+
}).join('\n');
72+
}
73+
else{
74+
return '';
75+
}
76+
}
77+
},
78+
79+
log: function(message, type){
80+
if(type == 'error'){
81+
console.error(message);
82+
}
83+
else if(type == 'warn'){
84+
console.warn(message);
85+
}
86+
else{
87+
console.log(message);
88+
}
89+
},
7190
});
7291

7392
Object.extend(UpdateHelper, {
74-
Info: 0,
75-
Warn: 1,
76-
Error: 2
93+
Info : 0,
94+
Warn : 1,
95+
Error: 2
7796
});
7897

src/prototype/ajax/ajax.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/** section: Ajax
22
* Ajax
3-
**/
3+
**/
44

55
var Ajax = {
6-
getTransport: function() {
7-
return new XMLHttpRequest();
8-
},
6+
getTransport: function(){
7+
return new XMLHttpRequest();
8+
},
99

10-
/**
11-
* Ajax.activeRequestCount -> Number
12-
*
13-
* Represents the number of active XHR requests triggered through
14-
* [[Ajax.Request]], [[Ajax.Updater]], or [[Ajax.PeriodicalUpdater]].
15-
**/
16-
activeRequestCount: 0
10+
/**
11+
* Ajax.activeRequestCount -> Number
12+
*
13+
* Represents the number of active XHR requests triggered through
14+
* [[Ajax.Request]], [[Ajax.Updater]], or [[Ajax.PeriodicalUpdater]].
15+
**/
16+
activeRequestCount: 0,
1717
};

src/prototype/ajax/base.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
// Abstract class; does not need documentation.
22
Ajax.Base = Class.create({
3-
initialize: function(options) {
4-
this.options = {
5-
method: 'post',
6-
asynchronous: true,
7-
contentType: 'application/x-www-form-urlencoded',
8-
encoding: 'UTF-8',
9-
parameters: '',
10-
evalJSON: true,
11-
evalJS: true,
12-
onException: function (request, error) {
13-
throw error;
14-
}
15-
};
16-
Object.extend(this.options, options || { });
3+
initialize: function(options){
4+
this.options = {
5+
method : 'post',
6+
asynchronous: true,
7+
contentType : 'application/x-www-form-urlencoded',
8+
encoding : 'UTF-8',
9+
parameters : '',
10+
evalJSON : true,
11+
evalJS : true,
12+
onException : function(request, error){
13+
throw error;
14+
},
15+
};
16+
Object.extend(this.options, options || {});
1717

18-
this.options.method = this.options.method.toLowerCase();
18+
this.options.method = this.options.method.toLowerCase();
1919

20-
if (Object.isHash(this.options.parameters))
21-
this.options.parameters = this.options.parameters.toObject();
22-
}
20+
if(Object.isHash(this.options.parameters)){
21+
this.options.parameters = this.options.parameters.toObject();
22+
}
23+
}
2324
});

0 commit comments

Comments
 (0)