jax 0.0.0.7 → 0.0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/CHANGELOG +21 -0
  2. data/Rakefile +13 -1
  3. data/builtin/shaders/functions/noise.ejs +780 -7
  4. data/guides/partials/_top_nav.html.erb +17 -0
  5. data/guides/source/index.html.erb +7 -0
  6. data/guides/source/layout.html.erb +1 -12
  7. data/lib/jax/generators/app/templates/public/javascripts/jax.js +4 -1
  8. data/lib/jax/version.rb +1 -1
  9. data/spec/example_app/app/controllers/lighting_controller.js +0 -2
  10. data/spec/javascripts/shaders/preprocessor_spec.js +19 -4
  11. data/src/constants.yml +1 -1
  12. data/src/jax/anim_frame.js +1 -1
  13. data/src/jax/core/util.js +5 -0
  14. data/src/jax/webgl/shader.js +2 -0
  15. data/vendor/pdoc_template/html/assets/images/pdoc/alias.png +0 -0
  16. data/vendor/pdoc_template/html/assets/images/pdoc/class.png +0 -0
  17. data/vendor/pdoc_template/html/assets/images/pdoc/class_deprecated.png +0 -0
  18. data/vendor/pdoc_template/html/assets/images/pdoc/class_method.png +0 -0
  19. data/vendor/pdoc_template/html/assets/images/pdoc/class_property.png +0 -0
  20. data/vendor/pdoc_template/html/assets/images/pdoc/constant.png +0 -0
  21. data/vendor/pdoc_template/html/assets/images/pdoc/constructor.png +0 -0
  22. data/vendor/pdoc_template/html/assets/images/pdoc/deprecated.png +0 -0
  23. data/vendor/pdoc_template/html/assets/images/pdoc/description.png +0 -0
  24. data/vendor/pdoc_template/html/assets/images/pdoc/information.png +0 -0
  25. data/vendor/pdoc_template/html/assets/images/pdoc/instance_method.png +0 -0
  26. data/vendor/pdoc_template/html/assets/images/pdoc/instance_property.png +0 -0
  27. data/vendor/pdoc_template/html/assets/images/pdoc/method.png +0 -0
  28. data/vendor/pdoc_template/html/assets/images/pdoc/method_deprecated.png +0 -0
  29. data/vendor/pdoc_template/html/assets/images/pdoc/mixin.png +0 -0
  30. data/vendor/pdoc_template/html/assets/images/pdoc/namespace.png +0 -0
  31. data/vendor/pdoc_template/html/assets/images/pdoc/property.png +0 -0
  32. data/vendor/pdoc_template/html/assets/images/pdoc/related_to.png +0 -0
  33. data/vendor/pdoc_template/html/assets/images/pdoc/search-background.png +0 -0
  34. data/vendor/pdoc_template/html/assets/images/pdoc/section-background.png +0 -0
  35. data/vendor/pdoc_template/html/assets/images/pdoc/section.png +0 -0
  36. data/vendor/pdoc_template/html/assets/images/pdoc/selected-section-background.png +0 -0
  37. data/vendor/pdoc_template/html/assets/images/pdoc/subclass.png +0 -0
  38. data/vendor/pdoc_template/html/assets/images/pdoc/superclass.png +0 -0
  39. data/vendor/pdoc_template/html/assets/images/pdoc/utility.png +0 -0
  40. data/vendor/pdoc_template/html/assets/javascripts/pdoc/application.js +478 -0
  41. data/vendor/pdoc_template/html/assets/javascripts/pdoc/prototype.js +4874 -0
  42. data/vendor/pdoc_template/html/assets/javascripts/pdoc/tabs.js +506 -0
  43. data/vendor/pdoc_template/html/assets/stylesheets/jax.css +30 -0
  44. data/vendor/pdoc_template/html/assets/stylesheets/pdoc/api.css +681 -0
  45. data/vendor/pdoc_template/html/assets/stylesheets/pdoc/pygments.css +62 -0
  46. data/vendor/pdoc_template/html/helpers.rb +35 -0
  47. data/vendor/pdoc_template/html/index.erb +18 -0
  48. data/vendor/pdoc_template/html/item_index.js.erb +6 -0
  49. data/vendor/pdoc_template/html/layout.erb +67 -0
  50. data/vendor/pdoc_template/html/leaf.erb +22 -0
  51. data/vendor/pdoc_template/html/node.erb +30 -0
  52. data/vendor/pdoc_template/html/partials/class_relationships.erb +19 -0
  53. data/vendor/pdoc_template/html/partials/classes.erb +7 -0
  54. data/vendor/pdoc_template/html/partials/constructor.erb +5 -0
  55. data/vendor/pdoc_template/html/partials/description.erb +5 -0
  56. data/vendor/pdoc_template/html/partials/link_list.erb +1 -0
  57. data/vendor/pdoc_template/html/partials/method_signatures.erb +14 -0
  58. data/vendor/pdoc_template/html/partials/methodized_note.erb +9 -0
  59. data/vendor/pdoc_template/html/partials/mixins.erb +7 -0
  60. data/vendor/pdoc_template/html/partials/namespaces.erb +7 -0
  61. data/vendor/pdoc_template/html/partials/related_utilities.erb +5 -0
  62. data/vendor/pdoc_template/html/partials/relationships.erb +11 -0
  63. data/vendor/pdoc_template/html/partials/short_description_list.erb +7 -0
  64. data/vendor/pdoc_template/html/partials/title.erb +24 -0
  65. data/vendor/pdoc_template/html/section.erb +18 -0
  66. metadata +56 -4
@@ -0,0 +1,506 @@
1
+ /**
2
+ * @author Ryan Johnson <http://syntacticx.com/>
3
+ * @copyright 2008 PersonalGrid Corporation <http://personalgrid.com/>
4
+ * @package LivePipe UI
5
+ * @license MIT
6
+ * @url http://livepipe.net/core
7
+ * @require prototype.js
8
+ */
9
+
10
+ if(typeof(Control) == 'undefined')
11
+ Control = {};
12
+
13
+ var $proc = function(proc){
14
+ return typeof(proc) == 'function' ? proc : function(){return proc};
15
+ };
16
+
17
+ var $value = function(value){
18
+ return typeof(value) == 'function' ? value() : value;
19
+ };
20
+
21
+ Object.Event = {
22
+ extend: function(object){
23
+ object._objectEventSetup = function(event_name){
24
+ this._observers = this._observers || {};
25
+ this._observers[event_name] = this._observers[event_name] || [];
26
+ };
27
+ object.observe = function(event_name,observer){
28
+ if(typeof(event_name) == 'string' && typeof(observer) != 'undefined'){
29
+ this._objectEventSetup(event_name);
30
+ if(!this._observers[event_name].include(observer))
31
+ this._observers[event_name].push(observer);
32
+ }else
33
+ for(var e in event_name)
34
+ this.observe(e,event_name[e]);
35
+ };
36
+ object.stopObserving = function(event_name,observer){
37
+ this._objectEventSetup(event_name);
38
+ if(event_name && observer)
39
+ this._observers[event_name] = this._observers[event_name].without(observer);
40
+ else if(event_name)
41
+ this._observers[event_name] = [];
42
+ else
43
+ this._observers = {};
44
+ };
45
+ object.observeOnce = function(event_name,outer_observer){
46
+ var inner_observer = function(){
47
+ outer_observer.apply(this,arguments);
48
+ this.stopObserving(event_name,inner_observer);
49
+ }.bind(this);
50
+ this._objectEventSetup(event_name);
51
+ this._observers[event_name].push(inner_observer);
52
+ };
53
+ object.notify = function(event_name){
54
+ this._objectEventSetup(event_name);
55
+ var collected_return_values = [];
56
+ var args = $A(arguments).slice(1);
57
+ try{
58
+ for(var i = 0; i < this._observers[event_name].length; ++i)
59
+ collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args) || null);
60
+ }catch(e){
61
+ if(e == $break)
62
+ return false;
63
+ else
64
+ throw e;
65
+ }
66
+ return collected_return_values;
67
+ };
68
+ if(object.prototype){
69
+ object.prototype._objectEventSetup = object._objectEventSetup;
70
+ object.prototype.observe = object.observe;
71
+ object.prototype.stopObserving = object.stopObserving;
72
+ object.prototype.observeOnce = object.observeOnce;
73
+ object.prototype.notify = function(event_name){
74
+ if(object.notify){
75
+ var args = $A(arguments).slice(1);
76
+ args.unshift(this);
77
+ args.unshift(event_name);
78
+ object.notify.apply(object,args);
79
+ }
80
+ this._objectEventSetup(event_name);
81
+ var args = $A(arguments).slice(1);
82
+ var collected_return_values = [];
83
+ try{
84
+ if(this.options && this.options[event_name] && typeof(this.options[event_name]) == 'function')
85
+ collected_return_values.push(this.options[event_name].apply(this,args) || null);
86
+ for(var i = 0; i < this._observers[event_name].length; ++i)
87
+ collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args) || null);
88
+ }catch(e){
89
+ if(e == $break)
90
+ return false;
91
+ else
92
+ throw e;
93
+ }
94
+ return collected_return_values;
95
+ };
96
+ }
97
+ }
98
+ };
99
+
100
+ /* Begin Core Extensions */
101
+
102
+ //Element.observeOnce
103
+ Element.addMethods({
104
+ observeOnce: function(element,event_name,outer_callback){
105
+ var inner_callback = function(){
106
+ outer_callback.apply(this,arguments);
107
+ Element.stopObserving(element,event_name,inner_callback);
108
+ };
109
+ Element.observe(element,event_name,inner_callback);
110
+ }
111
+ });
112
+
113
+ //mouseenter, mouseleave
114
+ //from http://dev.rubyonrails.org/attachment/ticket/8354/event_mouseenter_106rc1.patch
115
+ Object.extend(Event, (function() {
116
+ var cache = Event.cache;
117
+
118
+ function getEventID(element) {
119
+ if (element._prototypeEventID) return element._prototypeEventID[0];
120
+ arguments.callee.id = arguments.callee.id || 1;
121
+ return element._prototypeEventID = [++arguments.callee.id];
122
+ }
123
+
124
+ function getDOMEventName(eventName) {
125
+ if (eventName && eventName.include(':')) return "dataavailable";
126
+ //begin extension
127
+ if(!Prototype.Browser.IE){
128
+ eventName = {
129
+ mouseenter: 'mouseover',
130
+ mouseleave: 'mouseout'
131
+ }[eventName] || eventName;
132
+ }
133
+ //end extension
134
+ return eventName;
135
+ }
136
+
137
+ function getCacheForID(id) {
138
+ return cache[id] = cache[id] || { };
139
+ }
140
+
141
+ function getWrappersForEventName(id, eventName) {
142
+ var c = getCacheForID(id);
143
+ return c[eventName] = c[eventName] || [];
144
+ }
145
+
146
+ function createWrapper(element, eventName, handler) {
147
+ var id = getEventID(element);
148
+ var c = getWrappersForEventName(id, eventName);
149
+ if (c.pluck("handler").include(handler)) return false;
150
+
151
+ var wrapper = function(event) {
152
+ if (!Event || !Event.extend ||
153
+ (event.eventName && event.eventName != eventName))
154
+ return false;
155
+
156
+ Event.extend(event);
157
+ handler.call(element, event);
158
+ };
159
+
160
+ //begin extension
161
+ if(!(Prototype.Browser.IE) && ['mouseenter','mouseleave'].include(eventName)){
162
+ wrapper = wrapper.wrap(function(proceed,event) {
163
+ var rel = event.relatedTarget;
164
+ var cur = event.currentTarget;
165
+ if(rel && rel.nodeType == Node.TEXT_NODE)
166
+ rel = rel.parentNode;
167
+ if(rel && rel != cur && !rel.descendantOf(cur))
168
+ return proceed(event);
169
+ });
170
+ }
171
+ //end extension
172
+
173
+ wrapper.handler = handler;
174
+ c.push(wrapper);
175
+ return wrapper;
176
+ }
177
+
178
+ function findWrapper(id, eventName, handler) {
179
+ var c = getWrappersForEventName(id, eventName);
180
+ return c.find(function(wrapper) { return wrapper.handler == handler });
181
+ }
182
+
183
+ function destroyWrapper(id, eventName, handler) {
184
+ var c = getCacheForID(id);
185
+ if (!c[eventName]) return false;
186
+ c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
187
+ }
188
+
189
+ function destroyCache() {
190
+ for (var id in cache)
191
+ for (var eventName in cache[id])
192
+ cache[id][eventName] = null;
193
+ }
194
+
195
+ if (window.attachEvent) {
196
+ window.attachEvent("onunload", destroyCache);
197
+ }
198
+
199
+ return {
200
+ observe: function(element, eventName, handler) {
201
+ element = $(element);
202
+ var name = getDOMEventName(eventName);
203
+
204
+ var wrapper = createWrapper(element, eventName, handler);
205
+ if (!wrapper) return element;
206
+
207
+ if (element.addEventListener) {
208
+ element.addEventListener(name, wrapper, false);
209
+ } else {
210
+ element.attachEvent("on" + name, wrapper);
211
+ }
212
+
213
+ return element;
214
+ },
215
+
216
+ stopObserving: function(element, eventName, handler) {
217
+ element = $(element);
218
+ var id = getEventID(element), name = getDOMEventName(eventName);
219
+
220
+ if (!handler && eventName) {
221
+ getWrappersForEventName(id, eventName).each(function(wrapper) {
222
+ element.stopObserving(eventName, wrapper.handler);
223
+ });
224
+ return element;
225
+
226
+ } else if (!eventName) {
227
+ Object.keys(getCacheForID(id)).each(function(eventName) {
228
+ element.stopObserving(eventName);
229
+ });
230
+ return element;
231
+ }
232
+
233
+ var wrapper = findWrapper(id, eventName, handler);
234
+ if (!wrapper) return element;
235
+
236
+ if (element.removeEventListener) {
237
+ element.removeEventListener(name, wrapper, false);
238
+ } else {
239
+ element.detachEvent("on" + name, wrapper);
240
+ }
241
+
242
+ destroyWrapper(id, eventName, handler);
243
+
244
+ return element;
245
+ },
246
+
247
+ fire: function(element, eventName, memo) {
248
+ element = $(element);
249
+ if (element == document && document.createEvent && !element.dispatchEvent)
250
+ element = document.documentElement;
251
+
252
+ var event;
253
+ if (document.createEvent) {
254
+ event = document.createEvent("HTMLEvents");
255
+ event.initEvent("dataavailable", true, true);
256
+ } else {
257
+ event = document.createEventObject();
258
+ event.eventType = "ondataavailable";
259
+ }
260
+
261
+ event.eventName = eventName;
262
+ event.memo = memo || { };
263
+
264
+ if (document.createEvent) {
265
+ element.dispatchEvent(event);
266
+ } else {
267
+ element.fireEvent(event.eventType, event);
268
+ }
269
+
270
+ return Event.extend(event);
271
+ }
272
+ };
273
+ })());
274
+
275
+ Object.extend(Event, Event.Methods);
276
+
277
+ Element.addMethods({
278
+ fire: Event.fire,
279
+ observe: Event.observe,
280
+ stopObserving: Event.stopObserving
281
+ });
282
+
283
+ Object.extend(document, {
284
+ fire: Element.Methods.fire.methodize(),
285
+ observe: Element.Methods.observe.methodize(),
286
+ stopObserving: Element.Methods.stopObserving.methodize()
287
+ });
288
+
289
+ //mouse:wheel
290
+ (function(){
291
+ function wheel(event){
292
+ var delta;
293
+ // normalize the delta
294
+ if(event.wheelDelta) // IE & Opera
295
+ delta = event.wheelDelta / 120;
296
+ else if (event.detail) // W3C
297
+ delta =- event.detail / 3;
298
+ if(!delta)
299
+ return;
300
+ var custom_event = Event.element(event).fire('mouse:wheel',{
301
+ delta: delta
302
+ });
303
+ if(custom_event.stopped){
304
+ Event.stop(event);
305
+ return false;
306
+ }
307
+ }
308
+ document.observe('mousewheel',wheel);
309
+ document.observe('DOMMouseScroll',wheel);
310
+ })();
311
+
312
+ /* End Core Extensions */
313
+
314
+ //from PrototypeUI
315
+ var IframeShim = Class.create({
316
+ initialize: function() {
317
+ this.element = new Element('iframe',{
318
+ style: 'position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none',
319
+ src: 'javascript:void(0);',
320
+ frameborder: 0
321
+ });
322
+ $(document.body).insert(this.element);
323
+ },
324
+ hide: function() {
325
+ this.element.hide();
326
+ return this;
327
+ },
328
+ show: function() {
329
+ this.element.show();
330
+ return this;
331
+ },
332
+ positionUnder: function(element) {
333
+ var element = $(element);
334
+ var offset = element.cumulativeOffset();
335
+ var dimensions = element.getDimensions();
336
+ this.element.setStyle({
337
+ left: offset[0] + 'px',
338
+ top: offset[1] + 'px',
339
+ width: dimensions.width + 'px',
340
+ height: dimensions.height + 'px',
341
+ zIndex: element.getStyle('zIndex') - 1
342
+ }).show();
343
+ return this;
344
+ },
345
+ setBounds: function(bounds) {
346
+ for(prop in bounds)
347
+ bounds[prop] += 'px';
348
+ this.element.setStyle(bounds);
349
+ return this;
350
+ },
351
+ destroy: function() {
352
+ if(this.element)
353
+ this.element.remove();
354
+ return this;
355
+ }
356
+ });
357
+
358
+ /**
359
+ * @author Ryan Johnson <http://syntacticx.com/>
360
+ * @copyright 2008 PersonalGrid Corporation <http://personalgrid.com/>
361
+ * @package LivePipe UI
362
+ * @license MIT
363
+ * @url http://livepipe.net/control/tabs
364
+ * @require prototype.js, livepipe.js
365
+ */
366
+
367
+ /*global window, document, Prototype, $, $A, $H, $break, Class, Element, Event, Control */
368
+
369
+ if(typeof(Prototype) == "undefined") {
370
+ throw "Control.Tabs requires Prototype to be loaded."; }
371
+ if(typeof(Object.Event) == "undefined") {
372
+ throw "Control.Tabs requires Object.Event to be loaded."; }
373
+
374
+ Control.Tabs = Class.create({
375
+ initialize: function(tab_list_container,options){
376
+ if(!$(tab_list_container)) {
377
+ throw "Control.Tabs could not find the element: " + tab_list_container; }
378
+ this.activeContainer = false;
379
+ this.activeLink = false;
380
+ this.containers = $H({});
381
+ this.links = [];
382
+ Control.Tabs.instances.push(this);
383
+ this.options = {
384
+ beforeChange: Prototype.emptyFunction,
385
+ afterChange: Prototype.emptyFunction,
386
+ hover: false,
387
+ linkSelector: 'li a',
388
+ setClassOnContainer: false,
389
+ activeClassName: 'active',
390
+ defaultTab: 'first',
391
+ autoLinkExternal: true,
392
+ targetRegExp: /#(.+)$/,
393
+ showFunction: Element.show,
394
+ hideFunction: Element.hide
395
+ };
396
+ Object.extend(this.options,options || {});
397
+ (typeof(this.options.linkSelector == 'string') ?
398
+ $(tab_list_container).select(this.options.linkSelector) :
399
+ this.options.linkSelector($(tab_list_container))
400
+ ).findAll(function(link){
401
+ return (/^#/).exec((Prototype.Browser.WebKit ? decodeURIComponent(link.href) : link.href).replace(window.location.href.split('#')[0],''));
402
+ }).each(function(link){
403
+ this.addTab(link);
404
+ }.bind(this));
405
+ this.containers.values().each(Element.hide);
406
+ if(this.options.defaultTab == 'first') {
407
+ this.setActiveTab(this.links.first());
408
+ } else if(this.options.defaultTab == 'last') {
409
+ this.setActiveTab(this.links.last());
410
+ } else {
411
+ this.setActiveTab(this.options.defaultTab); }
412
+ var targets = this.options.targetRegExp.exec(window.location);
413
+ if(targets && targets[1]){
414
+ targets[1].split(',').each(function(target){
415
+ this.setActiveTab(this.links.find(function(link){
416
+ return link.key == target;
417
+ }));
418
+ }.bind(this));
419
+ }
420
+ if(this.options.autoLinkExternal){
421
+ $A(document.getElementsByTagName('a')).each(function(a){
422
+ if(!this.links.include(a)){
423
+ var clean_href = a.href.replace(window.location.href.split('#')[0],'');
424
+ if(clean_href.substring(0,1) == '#'){
425
+ if(this.containers.keys().include(clean_href.substring(1))){
426
+ $(a).observe('click',function(event,clean_href){
427
+ this.setActiveTab(clean_href.substring(1));
428
+ }.bindAsEventListener(this,clean_href));
429
+ }
430
+ }
431
+ }
432
+ }.bind(this));
433
+ }
434
+ },
435
+ addTab: function(link){
436
+ this.links.push(link);
437
+ link.key = link.getAttribute('href').replace(window.location.href.split('#')[0],'').split('#').last().replace(/#/,'');
438
+ var container = $(link.key);
439
+ if(!container) {
440
+ throw "Control.Tabs: #" + link.key + " was not found on the page."; }
441
+ this.containers.set(link.key,container);
442
+ link[this.options.hover ? 'onmouseover' : 'onclick'] = function(link){
443
+ if(window.event) {
444
+ Event.stop(window.event); }
445
+ this.setActiveTab(link);
446
+ return false;
447
+ }.bind(this,link);
448
+ },
449
+ setActiveTab: function(link){
450
+ if(!link && typeof(link) == 'undefined') {
451
+ return; }
452
+ if(typeof(link) == 'string'){
453
+ this.setActiveTab(this.links.find(function(_link){
454
+ return _link.key == link;
455
+ }));
456
+ }else if(typeof(link) == 'number'){
457
+ this.setActiveTab(this.links[link]);
458
+ }else{
459
+ if(this.notify('beforeChange',this.activeContainer,this.containers.get(link.key)) === false) {
460
+ return; }
461
+ if(this.activeContainer) {
462
+ this.options.hideFunction(this.activeContainer); }
463
+ this.links.each(function(item){
464
+ (this.options.setClassOnContainer ? $(item.parentNode) : item).removeClassName(this.options.activeClassName);
465
+ }.bind(this));
466
+ (this.options.setClassOnContainer ? $(link.parentNode) : link).addClassName(this.options.activeClassName);
467
+ this.activeContainer = this.containers.get(link.key);
468
+ this.activeLink = link;
469
+ this.options.showFunction(this.containers.get(link.key));
470
+ this.notify('afterChange',this.containers.get(link.key));
471
+ }
472
+ },
473
+ next: function(){
474
+ this.links.each(function(link,i){
475
+ if(this.activeLink == link && this.links[i + 1]){
476
+ this.setActiveTab(this.links[i + 1]);
477
+ throw $break;
478
+ }
479
+ }.bind(this));
480
+ },
481
+ previous: function(){
482
+ this.links.each(function(link,i){
483
+ if(this.activeLink == link && this.links[i - 1]){
484
+ this.setActiveTab(this.links[i - 1]);
485
+ throw $break;
486
+ }
487
+ }.bind(this));
488
+ },
489
+ first: function(){
490
+ this.setActiveTab(this.links.first());
491
+ },
492
+ last: function(){
493
+ this.setActiveTab(this.links.last());
494
+ }
495
+ });
496
+ Object.extend(Control.Tabs,{
497
+ instances: [],
498
+ findByTabId: function(id){
499
+ return Control.Tabs.instances.find(function(tab){
500
+ return tab.links.find(function(link){
501
+ return link.key == id;
502
+ });
503
+ });
504
+ }
505
+ });
506
+ Object.Event.extend(Control.Tabs);