ymdp 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/bin/ymdp +51 -0
- data/lib/new_application/.base +11 -0
- data/lib/new_application/Gemfile +12 -0
- data/lib/new_application/Rakefile +3 -0
- data/lib/new_application/app/.gitignore +1 -0
- data/lib/new_application/app/assets/images/lightbox/lightbox_bg.png +0 -0
- data/lib/new_application/app/assets/javascripts/OpenMailIntl.js +291 -0
- data/lib/new_application/app/assets/javascripts/controls.js +965 -0
- data/lib/new_application/app/assets/javascripts/date.js +104 -0
- data/lib/new_application/app/assets/javascripts/dragdrop.js +974 -0
- data/lib/new_application/app/assets/javascripts/effects.js +1123 -0
- data/lib/new_application/app/assets/javascripts/lowpro.js +320 -0
- data/lib/new_application/app/assets/javascripts/prototype.js +4874 -0
- data/lib/new_application/app/assets/javascripts/scriptaculous.js +68 -0
- data/lib/new_application/app/assets/yrb/en-US/application_en-US.pres +7 -0
- data/lib/new_application/app/helpers/application_helper.rb +3 -0
- data/lib/new_application/app/javascripts/application.js +580 -0
- data/lib/new_application/app/javascripts/debug.js +138 -0
- data/lib/new_application/app/javascripts/flash.js +96 -0
- data/lib/new_application/app/javascripts/header.js +13 -0
- data/lib/new_application/app/javascripts/help.js +76 -0
- data/lib/new_application/app/javascripts/i18n.js +235 -0
- data/lib/new_application/app/javascripts/launcher.js +159 -0
- data/lib/new_application/app/javascripts/logger.js +61 -0
- data/lib/new_application/app/javascripts/tag_helper.js +178 -0
- data/lib/new_application/app/stylesheets/application.css +0 -0
- data/lib/new_application/app/stylesheets/ie.css +0 -0
- data/lib/new_application/app/stylesheets/ie6.css +0 -0
- data/lib/new_application/app/stylesheets/ie7.css +0 -0
- data/lib/new_application/app/stylesheets/ie8.css +0 -0
- data/lib/new_application/app/stylesheets/lightbox.css +30 -0
- data/lib/new_application/app/stylesheets/non_ie.css +0 -0
- data/lib/new_application/app/views/layouts/application.html.haml +35 -0
- data/lib/new_application/app/views/shared/_error.html.haml +8 -0
- data/lib/new_application/app/views/shared/_flash.html.haml +2 -0
- data/lib/new_application/app/views/shared/_javascripts.html.haml +22 -0
- data/lib/new_application/app/views/shared/_loading.html.haml +13 -0
- data/lib/new_application/app/views/shared/_stylesheets.html.haml +23 -0
- data/lib/new_application/config/categories.yml +6 -0
- data/lib/new_application/config/config.yml.example +30 -0
- data/lib/new_application/config/constants.rb +54 -0
- data/lib/new_application/config/servers.yml.example +9 -0
- data/lib/new_application/lib/init.rb +13 -0
- data/lib/new_application/lib/tasks/environment.rake +4 -0
- data/lib/new_application/lib/tasks/keys.rake +235 -0
- data/lib/new_application/lib/tasks/setup.rake +13 -0
- data/lib/new_application/lib/tasks/ymdp.rake +718 -0
- data/lib/new_application/script/build +9 -0
- data/lib/new_application/script/config +13 -0
- data/lib/new_application/script/destroy +18 -0
- data/lib/new_application/script/generate +4 -0
- data/lib/new_application/script/gitrm +17 -0
- data/lib/new_application/script/growl +6 -0
- data/lib/new_application/script/images +48 -0
- data/lib/new_application/script/jslint.js +5072 -0
- data/lib/new_application/script/langs +31 -0
- data/lib/new_application/script/translate +5 -0
- data/lib/new_application/script/ymdt +1895 -0
- data/lib/new_application/script/ymdt.old +1890 -0
- data/lib/new_application/script/yuicompressor-2.4.2.jar +0 -0
- data/lib/new_application/ymdp +8 -0
- data/ymdp.gemspec +64 -1
- metadata +65 -4
@@ -0,0 +1,320 @@
|
|
1
|
+
LowPro = {};
|
2
|
+
LowPro.Version = '0.5';
|
3
|
+
LowPro.CompatibleWithPrototype = '1.6';
|
4
|
+
|
5
|
+
// if (Prototype.Version.indexOf(LowPro.CompatibleWithPrototype) == 0 && console && console.warn)
|
6
|
+
// console.warn("This version of Low Pro is tested with Prototype " + LowPro.CompatibleWithPrototype +
|
7
|
+
// " it may not work as expected with this version (" + Prototype.Version + ")");
|
8
|
+
|
9
|
+
if (!Element.addMethods)
|
10
|
+
Element.addMethods = function(o) { Object.extend(Element.Methods, o) };
|
11
|
+
|
12
|
+
// Simple utility methods for working with the DOM
|
13
|
+
DOM = {};
|
14
|
+
|
15
|
+
// DOMBuilder for prototype
|
16
|
+
DOM.Builder = {
|
17
|
+
tagFunc : function(tag) {
|
18
|
+
return function() {
|
19
|
+
var attrs, children;
|
20
|
+
if (arguments.length>0) {
|
21
|
+
if (arguments[0].nodeName ||
|
22
|
+
typeof arguments[0] == "string")
|
23
|
+
children = arguments;
|
24
|
+
else {
|
25
|
+
attrs = arguments[0];
|
26
|
+
children = Array.prototype.slice.call(arguments, 1);
|
27
|
+
};
|
28
|
+
}
|
29
|
+
return DOM.Builder.create(tag, attrs, children);
|
30
|
+
};
|
31
|
+
},
|
32
|
+
create : function(tag, attrs, children) {
|
33
|
+
attrs = attrs || {}; children = children || []; tag = tag.toLowerCase();
|
34
|
+
var el = new Element(tag, attrs);
|
35
|
+
|
36
|
+
for (var i=0; i<children.length; i++) {
|
37
|
+
if (typeof children[i] == 'string')
|
38
|
+
children[i] = document.createTextNode(children[i]);
|
39
|
+
el.appendChild(children[i]);
|
40
|
+
}
|
41
|
+
return $(el);
|
42
|
+
}
|
43
|
+
};
|
44
|
+
|
45
|
+
// Automatically create node builders as $tagName.
|
46
|
+
(function() {
|
47
|
+
var els = ("p|div|span|strong|em|img|table|tr|td|th|thead|tbody|tfoot|pre|code|" +
|
48
|
+
"h1|h2|h3|h4|h5|h6|ul|ol|li|form|input|textarea|legend|fieldset|" +
|
49
|
+
"select|option|blockquote|cite|br|hr|dd|dl|dt|address|a|button|abbr|acronym|" +
|
50
|
+
"script|link|style|bdo|ins|del|object|param|col|colgroup|optgroup|caption|" +
|
51
|
+
"label|dfn|kbd|samp|var").split("|");
|
52
|
+
var el, i=0;
|
53
|
+
while (el = els[i++])
|
54
|
+
window['$' + el] = DOM.Builder.tagFunc(el);
|
55
|
+
})();
|
56
|
+
|
57
|
+
DOM.Builder.fromHTML = function(html) {
|
58
|
+
var root;
|
59
|
+
if (!(root = arguments.callee._root))
|
60
|
+
root = arguments.callee._root = document.createElement('div');
|
61
|
+
root.innerHTML = html;
|
62
|
+
return root.childNodes[0];
|
63
|
+
};
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
// Wraps the 1.6 contentloaded event for backwards compatibility
|
68
|
+
//
|
69
|
+
// Usage:
|
70
|
+
//
|
71
|
+
// Event.onReady(callbackFunction);
|
72
|
+
Object.extend(Event, {
|
73
|
+
onReady : function(f) {
|
74
|
+
if (document.body) f();
|
75
|
+
else document.observe('dom:loaded', f);
|
76
|
+
}
|
77
|
+
});
|
78
|
+
|
79
|
+
// Based on event:Selectors by Justin Palmer
|
80
|
+
// http://encytemedia.com/event-selectors/
|
81
|
+
//
|
82
|
+
// Usage:
|
83
|
+
//
|
84
|
+
// Event.addBehavior({
|
85
|
+
// "selector:event" : function(event) { /* event handler. this refers to the element. */ },
|
86
|
+
// "selector" : function() { /* runs function on dom ready. this refers to the element. */ }
|
87
|
+
// ...
|
88
|
+
// });
|
89
|
+
//
|
90
|
+
// Multiple calls will add to exisiting rules. Event.addBehavior.reassignAfterAjax and
|
91
|
+
// Event.addBehavior.autoTrigger can be adjusted to needs.
|
92
|
+
Event.addBehavior = function(rules) {
|
93
|
+
var ab = this.addBehavior;
|
94
|
+
Object.extend(ab.rules, rules);
|
95
|
+
|
96
|
+
if (!ab.responderApplied) {
|
97
|
+
Ajax.Responders.register({
|
98
|
+
onComplete : function() {
|
99
|
+
if (Event.addBehavior.reassignAfterAjax)
|
100
|
+
setTimeout(function() { ab.reload() }, 10);
|
101
|
+
}
|
102
|
+
});
|
103
|
+
ab.responderApplied = true;
|
104
|
+
}
|
105
|
+
|
106
|
+
if (ab.autoTrigger) {
|
107
|
+
this.onReady(ab.load.bind(ab, rules));
|
108
|
+
}
|
109
|
+
|
110
|
+
};
|
111
|
+
|
112
|
+
Object.extend(Event.addBehavior, {
|
113
|
+
rules : {}, cache : [],
|
114
|
+
reassignAfterAjax : false,
|
115
|
+
autoTrigger : true,
|
116
|
+
|
117
|
+
load : function(rules) {
|
118
|
+
for (var selector in rules) {
|
119
|
+
var observer = rules[selector];
|
120
|
+
var sels = selector.split(',');
|
121
|
+
sels.each(function(sel) {
|
122
|
+
var parts = sel.split(/:(?=[a-z]+$)/), css = parts[0], event = parts[1];
|
123
|
+
$$(css).each(function(element) {
|
124
|
+
if (event) {
|
125
|
+
observer = Event.addBehavior._wrapObserver(observer);
|
126
|
+
$(element).observe(event, observer);
|
127
|
+
Event.addBehavior.cache.push([element, event, observer]);
|
128
|
+
} else {
|
129
|
+
if (!element.$$assigned || !element.$$assigned.include(observer)) {
|
130
|
+
if (observer.attach) observer.attach(element);
|
131
|
+
|
132
|
+
else observer.call($(element));
|
133
|
+
element.$$assigned = element.$$assigned || [];
|
134
|
+
element.$$assigned.push(observer);
|
135
|
+
}
|
136
|
+
}
|
137
|
+
});
|
138
|
+
});
|
139
|
+
}
|
140
|
+
},
|
141
|
+
|
142
|
+
unload : function() {
|
143
|
+
this.cache.each(function(c) {
|
144
|
+
Event.stopObserving.apply(Event, c);
|
145
|
+
});
|
146
|
+
this.cache = [];
|
147
|
+
},
|
148
|
+
|
149
|
+
reload: function() {
|
150
|
+
var ab = Event.addBehavior;
|
151
|
+
ab.unload();
|
152
|
+
ab.load(ab.rules);
|
153
|
+
},
|
154
|
+
|
155
|
+
_wrapObserver: function(observer) {
|
156
|
+
return function(event) {
|
157
|
+
if (observer.call(this, event) === false) event.stop();
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
});
|
162
|
+
|
163
|
+
Event.observe(window, 'unload', Event.addBehavior.unload.bind(Event.addBehavior));
|
164
|
+
|
165
|
+
// A silly Prototype style shortcut for the reckless
|
166
|
+
$$$ = Event.addBehavior.bind(Event);
|
167
|
+
|
168
|
+
// Behaviors can be bound to elements to provide an object orientated way of controlling elements
|
169
|
+
// and their behavior. Use Behavior.create() to make a new behavior class then use attach() to
|
170
|
+
// glue it to an element. Each element then gets it's own instance of the behavior and any
|
171
|
+
// methods called onxxx are bound to the relevent event.
|
172
|
+
//
|
173
|
+
// Usage:
|
174
|
+
//
|
175
|
+
// var MyBehavior = Behavior.create({
|
176
|
+
// onmouseover : function() { this.element.addClassName('bong') }
|
177
|
+
// });
|
178
|
+
//
|
179
|
+
// Event.addBehavior({ 'a.rollover' : MyBehavior });
|
180
|
+
//
|
181
|
+
// If you need to pass additional values to initialize use:
|
182
|
+
//
|
183
|
+
// Event.addBehavior({ 'a.rollover' : MyBehavior(10, { thing : 15 }) })
|
184
|
+
//
|
185
|
+
// You can also use the attach() method. If you specify extra arguments to attach they get passed to initialize.
|
186
|
+
//
|
187
|
+
// MyBehavior.attach(el, values, to, init);
|
188
|
+
//
|
189
|
+
// Finally, the rawest method is using the new constructor normally:
|
190
|
+
// var draggable = new Draggable(element, init, vals);
|
191
|
+
//
|
192
|
+
// Each behaviour has a collection of all its instances in Behavior.instances
|
193
|
+
//
|
194
|
+
var Behavior = {
|
195
|
+
create: function() {
|
196
|
+
var parent = null, properties = $A(arguments);
|
197
|
+
if (Object.isFunction(properties[0]))
|
198
|
+
parent = properties.shift();
|
199
|
+
|
200
|
+
var behavior = function() {
|
201
|
+
var behavior = arguments.callee;
|
202
|
+
if (!this.initialize) {
|
203
|
+
var args = $A(arguments);
|
204
|
+
|
205
|
+
return function() {
|
206
|
+
var initArgs = [this].concat(args);
|
207
|
+
behavior.attach.apply(behavior, initArgs);
|
208
|
+
};
|
209
|
+
} else {
|
210
|
+
var args = (arguments.length == 2 && arguments[1] instanceof Array) ?
|
211
|
+
arguments[1] : Array.prototype.slice.call(arguments, 1);
|
212
|
+
|
213
|
+
this.element = $(arguments[0]);
|
214
|
+
this.initialize.apply(this, args);
|
215
|
+
behavior._bindEvents(this);
|
216
|
+
behavior.instances.push(this);
|
217
|
+
}
|
218
|
+
};
|
219
|
+
|
220
|
+
Object.extend(behavior, Class.Methods);
|
221
|
+
Object.extend(behavior, Behavior.Methods);
|
222
|
+
behavior.superclass = parent;
|
223
|
+
behavior.subclasses = [];
|
224
|
+
behavior.instances = [];
|
225
|
+
|
226
|
+
if (parent) {
|
227
|
+
var subclass = function() { };
|
228
|
+
subclass.prototype = parent.prototype;
|
229
|
+
behavior.prototype = new subclass;
|
230
|
+
parent.subclasses.push(behavior);
|
231
|
+
}
|
232
|
+
|
233
|
+
for (var i = 0; i < properties.length; i++)
|
234
|
+
behavior.addMethods(properties[i]);
|
235
|
+
|
236
|
+
if (!behavior.prototype.initialize)
|
237
|
+
behavior.prototype.initialize = Prototype.emptyFunction;
|
238
|
+
|
239
|
+
behavior.prototype.constructor = behavior;
|
240
|
+
|
241
|
+
return behavior;
|
242
|
+
},
|
243
|
+
Methods : {
|
244
|
+
attach : function(element) {
|
245
|
+
return new this(element, Array.prototype.slice.call(arguments, 1));
|
246
|
+
},
|
247
|
+
_bindEvents : function(bound) {
|
248
|
+
for (var member in bound)
|
249
|
+
if (member.match(/^on(.+)/) && typeof bound[member] == 'function')
|
250
|
+
bound.element.observe(RegExp.$1, Event.addBehavior._wrapObserver(bound[member].bindAsEventListener(bound)));
|
251
|
+
}
|
252
|
+
}
|
253
|
+
};
|
254
|
+
|
255
|
+
Remote = Behavior.create({
|
256
|
+
initialize: function(options) {
|
257
|
+
if (this.element.nodeName == 'FORM') new Remote.Form(this.element, options);
|
258
|
+
else new Remote.Link(this.element, options);
|
259
|
+
}
|
260
|
+
});
|
261
|
+
|
262
|
+
Remote.Base = {
|
263
|
+
initialize : function(options) {
|
264
|
+
this.options = Object.extend({
|
265
|
+
evaluateScripts : true
|
266
|
+
}, options || {});
|
267
|
+
},
|
268
|
+
_makeRequest : function(options) {
|
269
|
+
if (options.update) new Ajax.Updater(options.update, options.url, options);
|
270
|
+
else new Ajax.Request(options.url, options);
|
271
|
+
return false;
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
275
|
+
Remote.Link = Behavior.create(Remote.Base, {
|
276
|
+
onclick : function() {
|
277
|
+
var options = Object.extend({ url : this.element.href, method : 'get' }, this.options);
|
278
|
+
return this._makeRequest(options);
|
279
|
+
}
|
280
|
+
});
|
281
|
+
|
282
|
+
|
283
|
+
Remote.Form = Behavior.create(Remote.Base, {
|
284
|
+
onclick : function(e) {
|
285
|
+
var sourceElement = e.element();
|
286
|
+
|
287
|
+
if (['input', 'button'].include(sourceElement.nodeName.toLowerCase()) &&
|
288
|
+
sourceElement.type == 'submit')
|
289
|
+
this._submitButton = sourceElement;
|
290
|
+
},
|
291
|
+
onsubmit : function() {
|
292
|
+
var options = Object.extend({
|
293
|
+
url : this.element.action,
|
294
|
+
method : this.element.method || 'get',
|
295
|
+
parameters : this.element.serialize({ submit: this._submitButton.name })
|
296
|
+
}, this.options);
|
297
|
+
this._submitButton = null;
|
298
|
+
return this._makeRequest(options);
|
299
|
+
}
|
300
|
+
});
|
301
|
+
|
302
|
+
Observed = Behavior.create({
|
303
|
+
initialize : function(callback, options) {
|
304
|
+
this.callback = callback.bind(this);
|
305
|
+
this.options = options || {};
|
306
|
+
this.observer = (this.element.nodeName == 'FORM') ? this._observeForm() : this._observeField();
|
307
|
+
},
|
308
|
+
stop: function() {
|
309
|
+
this.observer.stop();
|
310
|
+
},
|
311
|
+
_observeForm: function() {
|
312
|
+
return (this.options.frequency) ? new Form.Observer(this.element, this.options.frequency, this.callback) :
|
313
|
+
new Form.EventObserver(this.element, this.callback);
|
314
|
+
},
|
315
|
+
_observeField: function() {
|
316
|
+
return (this.options.frequency) ? new Form.Element.Observer(this.element, this.options.frequency, this.callback) :
|
317
|
+
new Form.Element.EventObserver(this.element, this.callback);
|
318
|
+
}
|
319
|
+
});
|
320
|
+
|