distil 0.14.4 → 0.14.5.a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. data/VERSION +1 -1
  2. data/bin/distil +10 -0
  3. data/lib/distil/project.rb +10 -7
  4. data/lib/distil/source-file.rb +1 -1
  5. metadata +28 -164
  6. data/Buildfile +0 -33
  7. data/distil.gemspec +0 -783
  8. data/lib/distil/javascript-documentation-generator.rb +0 -49
  9. data/vendor/pdoc/LICENSE +0 -16
  10. data/vendor/pdoc/PDoc.tmbundle/Commands/Continue PDoc Comment.tmCommand +0 -39
  11. data/vendor/pdoc/PDoc.tmbundle/Macros/Collapse PDoc Blocks.tmMacro +0 -4084
  12. data/vendor/pdoc/PDoc.tmbundle/Macros/Expand PDoc Blocks.tmMacro +0 -1388
  13. data/vendor/pdoc/PDoc.tmbundle/Preferences/PDoc.tmPreferences +0 -50
  14. data/vendor/pdoc/PDoc.tmbundle/Snippets/class.tmSnippet +0 -24
  15. data/vendor/pdoc/PDoc.tmbundle/Snippets/constant.tmSnippet +0 -22
  16. data/vendor/pdoc/PDoc.tmbundle/Snippets/event.tmSnippet +0 -16
  17. data/vendor/pdoc/PDoc.tmbundle/Snippets/method.tmSnippet +0 -22
  18. data/vendor/pdoc/PDoc.tmbundle/Snippets/mixin.tmSnippet +0 -23
  19. data/vendor/pdoc/PDoc.tmbundle/Snippets/namespace.tmSnippet +0 -24
  20. data/vendor/pdoc/PDoc.tmbundle/Snippets/param.tmSnippet +0 -16
  21. data/vendor/pdoc/PDoc.tmbundle/Snippets/property.tmSnippet +0 -22
  22. data/vendor/pdoc/PDoc.tmbundle/Snippets/section.tmSnippet +0 -23
  23. data/vendor/pdoc/PDoc.tmbundle/Syntaxes/PDoc.tmLanguage +0 -33
  24. data/vendor/pdoc/PDoc.tmbundle/info.plist +0 -22
  25. data/vendor/pdoc/README.markdown +0 -34
  26. data/vendor/pdoc/Rakefile +0 -46
  27. data/vendor/pdoc/bin/pdoc +0 -58
  28. data/vendor/pdoc/lib/pdoc.rb +0 -32
  29. data/vendor/pdoc/lib/pdoc/error.rb +0 -4
  30. data/vendor/pdoc/lib/pdoc/generators.rb +0 -6
  31. data/vendor/pdoc/lib/pdoc/generators/abstract_generator.rb +0 -16
  32. data/vendor/pdoc/lib/pdoc/generators/html.rb +0 -8
  33. data/vendor/pdoc/lib/pdoc/generators/html/helpers.rb +0 -256
  34. data/vendor/pdoc/lib/pdoc/generators/html/page.rb +0 -71
  35. data/vendor/pdoc/lib/pdoc/generators/html/syntax_highlighter.rb +0 -41
  36. data/vendor/pdoc/lib/pdoc/generators/html/template.rb +0 -37
  37. data/vendor/pdoc/lib/pdoc/generators/html/website.rb +0 -194
  38. data/vendor/pdoc/lib/pdoc/generators/json.rb +0 -15
  39. data/vendor/pdoc/lib/pdoc/generators/pythonesque.rb +0 -105
  40. data/vendor/pdoc/lib/pdoc/models.rb +0 -47
  41. data/vendor/pdoc/lib/pdoc/models/argument.rb +0 -37
  42. data/vendor/pdoc/lib/pdoc/models/base.rb +0 -107
  43. data/vendor/pdoc/lib/pdoc/models/callable.rb +0 -19
  44. data/vendor/pdoc/lib/pdoc/models/class.rb +0 -28
  45. data/vendor/pdoc/lib/pdoc/models/class_method.rb +0 -18
  46. data/vendor/pdoc/lib/pdoc/models/class_property.rb +0 -9
  47. data/vendor/pdoc/lib/pdoc/models/constant.rb +0 -9
  48. data/vendor/pdoc/lib/pdoc/models/constructor.rb +0 -14
  49. data/vendor/pdoc/lib/pdoc/models/container.rb +0 -114
  50. data/vendor/pdoc/lib/pdoc/models/entity.rb +0 -54
  51. data/vendor/pdoc/lib/pdoc/models/instance_method.rb +0 -18
  52. data/vendor/pdoc/lib/pdoc/models/instance_property.rb +0 -9
  53. data/vendor/pdoc/lib/pdoc/models/mixin.rb +0 -10
  54. data/vendor/pdoc/lib/pdoc/models/namespace.rb +0 -10
  55. data/vendor/pdoc/lib/pdoc/models/root.rb +0 -27
  56. data/vendor/pdoc/lib/pdoc/models/section.rb +0 -19
  57. data/vendor/pdoc/lib/pdoc/models/signature.rb +0 -27
  58. data/vendor/pdoc/lib/pdoc/models/utility.rb +0 -11
  59. data/vendor/pdoc/lib/pdoc/parser.rb +0 -109
  60. data/vendor/pdoc/lib/pdoc/parser/argument_description_nodes.rb +0 -21
  61. data/vendor/pdoc/lib/pdoc/parser/basic_nodes.rb +0 -31
  62. data/vendor/pdoc/lib/pdoc/parser/description_nodes.rb +0 -42
  63. data/vendor/pdoc/lib/pdoc/parser/documentation_nodes.rb +0 -483
  64. data/vendor/pdoc/lib/pdoc/parser/ebnf_arguments_nodes.rb +0 -58
  65. data/vendor/pdoc/lib/pdoc/parser/ebnf_expression_nodes.rb +0 -227
  66. data/vendor/pdoc/lib/pdoc/parser/fragment.rb +0 -55
  67. data/vendor/pdoc/lib/pdoc/parser/section_content_nodes.rb +0 -19
  68. data/vendor/pdoc/lib/pdoc/parser/tags_nodes.rb +0 -14
  69. data/vendor/pdoc/lib/pdoc/parser/treetop_files/argument_description.treetop +0 -31
  70. data/vendor/pdoc/lib/pdoc/parser/treetop_files/basic.treetop +0 -41
  71. data/vendor/pdoc/lib/pdoc/parser/treetop_files/description.treetop +0 -7
  72. data/vendor/pdoc/lib/pdoc/parser/treetop_files/documentation.treetop +0 -75
  73. data/vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_arguments.treetop +0 -33
  74. data/vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_expression.treetop +0 -70
  75. data/vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_javascript.treetop +0 -54
  76. data/vendor/pdoc/lib/pdoc/parser/treetop_files/events.treetop +0 -17
  77. data/vendor/pdoc/lib/pdoc/parser/treetop_files/section_content.treetop +0 -8
  78. data/vendor/pdoc/lib/pdoc/parser/treetop_files/tags.treetop +0 -31
  79. data/vendor/pdoc/lib/pdoc/runner.rb +0 -110
  80. data/vendor/pdoc/lib/pdoc/treemaker.rb +0 -94
  81. data/vendor/pdoc/pdoc.gemspec +0 -31
  82. data/vendor/pdoc/templates/html/assets/images/pdoc/alias.png +0 -0
  83. data/vendor/pdoc/templates/html/assets/images/pdoc/class.png +0 -0
  84. data/vendor/pdoc/templates/html/assets/images/pdoc/class_deprecated.png +0 -0
  85. data/vendor/pdoc/templates/html/assets/images/pdoc/class_method.png +0 -0
  86. data/vendor/pdoc/templates/html/assets/images/pdoc/class_property.png +0 -0
  87. data/vendor/pdoc/templates/html/assets/images/pdoc/constant.png +0 -0
  88. data/vendor/pdoc/templates/html/assets/images/pdoc/constructor.png +0 -0
  89. data/vendor/pdoc/templates/html/assets/images/pdoc/deprecated.png +0 -0
  90. data/vendor/pdoc/templates/html/assets/images/pdoc/description.png +0 -0
  91. data/vendor/pdoc/templates/html/assets/images/pdoc/information.png +0 -0
  92. data/vendor/pdoc/templates/html/assets/images/pdoc/instance_method.png +0 -0
  93. data/vendor/pdoc/templates/html/assets/images/pdoc/instance_property.png +0 -0
  94. data/vendor/pdoc/templates/html/assets/images/pdoc/method.png +0 -0
  95. data/vendor/pdoc/templates/html/assets/images/pdoc/method_deprecated.png +0 -0
  96. data/vendor/pdoc/templates/html/assets/images/pdoc/mixin.png +0 -0
  97. data/vendor/pdoc/templates/html/assets/images/pdoc/namespace.png +0 -0
  98. data/vendor/pdoc/templates/html/assets/images/pdoc/property.png +0 -0
  99. data/vendor/pdoc/templates/html/assets/images/pdoc/related_to.png +0 -0
  100. data/vendor/pdoc/templates/html/assets/images/pdoc/search-background.png +0 -0
  101. data/vendor/pdoc/templates/html/assets/images/pdoc/section-background.png +0 -0
  102. data/vendor/pdoc/templates/html/assets/images/pdoc/section.png +0 -0
  103. data/vendor/pdoc/templates/html/assets/images/pdoc/selected-section-background.png +0 -0
  104. data/vendor/pdoc/templates/html/assets/images/pdoc/subclass.png +0 -0
  105. data/vendor/pdoc/templates/html/assets/images/pdoc/superclass.png +0 -0
  106. data/vendor/pdoc/templates/html/assets/images/pdoc/utility.png +0 -0
  107. data/vendor/pdoc/templates/html/assets/javascripts/pdoc/application.js +0 -478
  108. data/vendor/pdoc/templates/html/assets/javascripts/pdoc/prototype.js +0 -4874
  109. data/vendor/pdoc/templates/html/assets/javascripts/pdoc/tabs.js +0 -506
  110. data/vendor/pdoc/templates/html/assets/stylesheets/pdoc/api.css +0 -677
  111. data/vendor/pdoc/templates/html/assets/stylesheets/pdoc/pygments.css +0 -62
  112. data/vendor/pdoc/templates/html/helpers.rb +0 -35
  113. data/vendor/pdoc/templates/html/index.erb +0 -18
  114. data/vendor/pdoc/templates/html/item_index.js.erb +0 -6
  115. data/vendor/pdoc/templates/html/layout.erb +0 -67
  116. data/vendor/pdoc/templates/html/leaf.erb +0 -22
  117. data/vendor/pdoc/templates/html/node.erb +0 -30
  118. data/vendor/pdoc/templates/html/partials/class_relationships.erb +0 -19
  119. data/vendor/pdoc/templates/html/partials/classes.erb +0 -7
  120. data/vendor/pdoc/templates/html/partials/constructor.erb +0 -5
  121. data/vendor/pdoc/templates/html/partials/description.erb +0 -5
  122. data/vendor/pdoc/templates/html/partials/link_list.erb +0 -1
  123. data/vendor/pdoc/templates/html/partials/method_signatures.erb +0 -14
  124. data/vendor/pdoc/templates/html/partials/methodized_note.erb +0 -9
  125. data/vendor/pdoc/templates/html/partials/mixins.erb +0 -7
  126. data/vendor/pdoc/templates/html/partials/namespaces.erb +0 -7
  127. data/vendor/pdoc/templates/html/partials/related_utilities.erb +0 -5
  128. data/vendor/pdoc/templates/html/partials/relationships.erb +0 -11
  129. data/vendor/pdoc/templates/html/partials/short_description_list.erb +0 -7
  130. data/vendor/pdoc/templates/html/partials/title.erb +0 -22
  131. data/vendor/pdoc/templates/html/section.erb +0 -18
  132. data/vendor/pdoc/test/fixtures/ajax.js +0 -809
  133. data/vendor/pdoc/test/fixtures/prototype.js +0 -5789
  134. data/vendor/pdoc/test/fixtures/test.txt +0 -1
  135. data/vendor/pdoc/test/fixtures/text.txt +0 -13
  136. data/vendor/pdoc/test/unit/parser/argument_description_test.rb +0 -40
  137. data/vendor/pdoc/test/unit/parser/basic_test.rb +0 -55
  138. data/vendor/pdoc/test/unit/parser/description_test.rb +0 -34
  139. data/vendor/pdoc/test/unit/parser/documentation_test.rb +0 -520
  140. data/vendor/pdoc/test/unit/parser/ebnf_arguments_test.rb +0 -81
  141. data/vendor/pdoc/test/unit/parser/ebnf_expression_test.rb +0 -382
  142. data/vendor/pdoc/test/unit/parser/ebnf_javascript_test.rb +0 -37
  143. data/vendor/pdoc/test/unit/parser/events_test.rb +0 -27
  144. data/vendor/pdoc/test/unit/parser/section_content_test.rb +0 -44
  145. data/vendor/pdoc/test/unit/parser/tags_test.rb +0 -39
  146. data/vendor/pdoc/test/unit/parser/test_fragment.rb +0 -80
  147. data/vendor/pdoc/test/unit/parser_test_helper.rb +0 -62
  148. data/vendor/pdoc/test/unit/runner/basic_test.rb +0 -14
  149. data/vendor/pdoc/test/unit/templates/html_helpers_test.rb +0 -25
  150. data/vendor/pdoc/vendor/albino.rb +0 -122
  151. data/vendor/pdoc/website/html/documentation.html +0 -280
  152. data/vendor/pdoc/website/html/images/pdoc.jpg +0 -0
  153. data/vendor/pdoc/website/html/index.html +0 -84
  154. data/vendor/pdoc/website/html/stylesheets/main.css +0 -73
  155. data/vendor/pdoc/website/html/stylesheets/reset.css +0 -18
  156. data/vendor/pdoc/website/markdown/syntax.markdown +0 -226
  157. data/yuicompressor-2.4.6.zip +0 -0
@@ -1,506 +0,0 @@
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);