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.
- data/VERSION +1 -1
- data/bin/distil +10 -0
- data/lib/distil/project.rb +10 -7
- data/lib/distil/source-file.rb +1 -1
- metadata +28 -164
- data/Buildfile +0 -33
- data/distil.gemspec +0 -783
- data/lib/distil/javascript-documentation-generator.rb +0 -49
- data/vendor/pdoc/LICENSE +0 -16
- data/vendor/pdoc/PDoc.tmbundle/Commands/Continue PDoc Comment.tmCommand +0 -39
- data/vendor/pdoc/PDoc.tmbundle/Macros/Collapse PDoc Blocks.tmMacro +0 -4084
- data/vendor/pdoc/PDoc.tmbundle/Macros/Expand PDoc Blocks.tmMacro +0 -1388
- data/vendor/pdoc/PDoc.tmbundle/Preferences/PDoc.tmPreferences +0 -50
- data/vendor/pdoc/PDoc.tmbundle/Snippets/class.tmSnippet +0 -24
- data/vendor/pdoc/PDoc.tmbundle/Snippets/constant.tmSnippet +0 -22
- data/vendor/pdoc/PDoc.tmbundle/Snippets/event.tmSnippet +0 -16
- data/vendor/pdoc/PDoc.tmbundle/Snippets/method.tmSnippet +0 -22
- data/vendor/pdoc/PDoc.tmbundle/Snippets/mixin.tmSnippet +0 -23
- data/vendor/pdoc/PDoc.tmbundle/Snippets/namespace.tmSnippet +0 -24
- data/vendor/pdoc/PDoc.tmbundle/Snippets/param.tmSnippet +0 -16
- data/vendor/pdoc/PDoc.tmbundle/Snippets/property.tmSnippet +0 -22
- data/vendor/pdoc/PDoc.tmbundle/Snippets/section.tmSnippet +0 -23
- data/vendor/pdoc/PDoc.tmbundle/Syntaxes/PDoc.tmLanguage +0 -33
- data/vendor/pdoc/PDoc.tmbundle/info.plist +0 -22
- data/vendor/pdoc/README.markdown +0 -34
- data/vendor/pdoc/Rakefile +0 -46
- data/vendor/pdoc/bin/pdoc +0 -58
- data/vendor/pdoc/lib/pdoc.rb +0 -32
- data/vendor/pdoc/lib/pdoc/error.rb +0 -4
- data/vendor/pdoc/lib/pdoc/generators.rb +0 -6
- data/vendor/pdoc/lib/pdoc/generators/abstract_generator.rb +0 -16
- data/vendor/pdoc/lib/pdoc/generators/html.rb +0 -8
- data/vendor/pdoc/lib/pdoc/generators/html/helpers.rb +0 -256
- data/vendor/pdoc/lib/pdoc/generators/html/page.rb +0 -71
- data/vendor/pdoc/lib/pdoc/generators/html/syntax_highlighter.rb +0 -41
- data/vendor/pdoc/lib/pdoc/generators/html/template.rb +0 -37
- data/vendor/pdoc/lib/pdoc/generators/html/website.rb +0 -194
- data/vendor/pdoc/lib/pdoc/generators/json.rb +0 -15
- data/vendor/pdoc/lib/pdoc/generators/pythonesque.rb +0 -105
- data/vendor/pdoc/lib/pdoc/models.rb +0 -47
- data/vendor/pdoc/lib/pdoc/models/argument.rb +0 -37
- data/vendor/pdoc/lib/pdoc/models/base.rb +0 -107
- data/vendor/pdoc/lib/pdoc/models/callable.rb +0 -19
- data/vendor/pdoc/lib/pdoc/models/class.rb +0 -28
- data/vendor/pdoc/lib/pdoc/models/class_method.rb +0 -18
- data/vendor/pdoc/lib/pdoc/models/class_property.rb +0 -9
- data/vendor/pdoc/lib/pdoc/models/constant.rb +0 -9
- data/vendor/pdoc/lib/pdoc/models/constructor.rb +0 -14
- data/vendor/pdoc/lib/pdoc/models/container.rb +0 -114
- data/vendor/pdoc/lib/pdoc/models/entity.rb +0 -54
- data/vendor/pdoc/lib/pdoc/models/instance_method.rb +0 -18
- data/vendor/pdoc/lib/pdoc/models/instance_property.rb +0 -9
- data/vendor/pdoc/lib/pdoc/models/mixin.rb +0 -10
- data/vendor/pdoc/lib/pdoc/models/namespace.rb +0 -10
- data/vendor/pdoc/lib/pdoc/models/root.rb +0 -27
- data/vendor/pdoc/lib/pdoc/models/section.rb +0 -19
- data/vendor/pdoc/lib/pdoc/models/signature.rb +0 -27
- data/vendor/pdoc/lib/pdoc/models/utility.rb +0 -11
- data/vendor/pdoc/lib/pdoc/parser.rb +0 -109
- data/vendor/pdoc/lib/pdoc/parser/argument_description_nodes.rb +0 -21
- data/vendor/pdoc/lib/pdoc/parser/basic_nodes.rb +0 -31
- data/vendor/pdoc/lib/pdoc/parser/description_nodes.rb +0 -42
- data/vendor/pdoc/lib/pdoc/parser/documentation_nodes.rb +0 -483
- data/vendor/pdoc/lib/pdoc/parser/ebnf_arguments_nodes.rb +0 -58
- data/vendor/pdoc/lib/pdoc/parser/ebnf_expression_nodes.rb +0 -227
- data/vendor/pdoc/lib/pdoc/parser/fragment.rb +0 -55
- data/vendor/pdoc/lib/pdoc/parser/section_content_nodes.rb +0 -19
- data/vendor/pdoc/lib/pdoc/parser/tags_nodes.rb +0 -14
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/argument_description.treetop +0 -31
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/basic.treetop +0 -41
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/description.treetop +0 -7
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/documentation.treetop +0 -75
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_arguments.treetop +0 -33
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_expression.treetop +0 -70
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/ebnf_javascript.treetop +0 -54
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/events.treetop +0 -17
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/section_content.treetop +0 -8
- data/vendor/pdoc/lib/pdoc/parser/treetop_files/tags.treetop +0 -31
- data/vendor/pdoc/lib/pdoc/runner.rb +0 -110
- data/vendor/pdoc/lib/pdoc/treemaker.rb +0 -94
- data/vendor/pdoc/pdoc.gemspec +0 -31
- data/vendor/pdoc/templates/html/assets/images/pdoc/alias.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/class.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/class_deprecated.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/class_method.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/class_property.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/constant.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/constructor.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/deprecated.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/description.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/information.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/instance_method.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/instance_property.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/method.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/method_deprecated.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/mixin.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/namespace.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/property.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/related_to.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/search-background.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/section-background.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/section.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/selected-section-background.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/subclass.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/superclass.png +0 -0
- data/vendor/pdoc/templates/html/assets/images/pdoc/utility.png +0 -0
- data/vendor/pdoc/templates/html/assets/javascripts/pdoc/application.js +0 -478
- data/vendor/pdoc/templates/html/assets/javascripts/pdoc/prototype.js +0 -4874
- data/vendor/pdoc/templates/html/assets/javascripts/pdoc/tabs.js +0 -506
- data/vendor/pdoc/templates/html/assets/stylesheets/pdoc/api.css +0 -677
- data/vendor/pdoc/templates/html/assets/stylesheets/pdoc/pygments.css +0 -62
- data/vendor/pdoc/templates/html/helpers.rb +0 -35
- data/vendor/pdoc/templates/html/index.erb +0 -18
- data/vendor/pdoc/templates/html/item_index.js.erb +0 -6
- data/vendor/pdoc/templates/html/layout.erb +0 -67
- data/vendor/pdoc/templates/html/leaf.erb +0 -22
- data/vendor/pdoc/templates/html/node.erb +0 -30
- data/vendor/pdoc/templates/html/partials/class_relationships.erb +0 -19
- data/vendor/pdoc/templates/html/partials/classes.erb +0 -7
- data/vendor/pdoc/templates/html/partials/constructor.erb +0 -5
- data/vendor/pdoc/templates/html/partials/description.erb +0 -5
- data/vendor/pdoc/templates/html/partials/link_list.erb +0 -1
- data/vendor/pdoc/templates/html/partials/method_signatures.erb +0 -14
- data/vendor/pdoc/templates/html/partials/methodized_note.erb +0 -9
- data/vendor/pdoc/templates/html/partials/mixins.erb +0 -7
- data/vendor/pdoc/templates/html/partials/namespaces.erb +0 -7
- data/vendor/pdoc/templates/html/partials/related_utilities.erb +0 -5
- data/vendor/pdoc/templates/html/partials/relationships.erb +0 -11
- data/vendor/pdoc/templates/html/partials/short_description_list.erb +0 -7
- data/vendor/pdoc/templates/html/partials/title.erb +0 -22
- data/vendor/pdoc/templates/html/section.erb +0 -18
- data/vendor/pdoc/test/fixtures/ajax.js +0 -809
- data/vendor/pdoc/test/fixtures/prototype.js +0 -5789
- data/vendor/pdoc/test/fixtures/test.txt +0 -1
- data/vendor/pdoc/test/fixtures/text.txt +0 -13
- data/vendor/pdoc/test/unit/parser/argument_description_test.rb +0 -40
- data/vendor/pdoc/test/unit/parser/basic_test.rb +0 -55
- data/vendor/pdoc/test/unit/parser/description_test.rb +0 -34
- data/vendor/pdoc/test/unit/parser/documentation_test.rb +0 -520
- data/vendor/pdoc/test/unit/parser/ebnf_arguments_test.rb +0 -81
- data/vendor/pdoc/test/unit/parser/ebnf_expression_test.rb +0 -382
- data/vendor/pdoc/test/unit/parser/ebnf_javascript_test.rb +0 -37
- data/vendor/pdoc/test/unit/parser/events_test.rb +0 -27
- data/vendor/pdoc/test/unit/parser/section_content_test.rb +0 -44
- data/vendor/pdoc/test/unit/parser/tags_test.rb +0 -39
- data/vendor/pdoc/test/unit/parser/test_fragment.rb +0 -80
- data/vendor/pdoc/test/unit/parser_test_helper.rb +0 -62
- data/vendor/pdoc/test/unit/runner/basic_test.rb +0 -14
- data/vendor/pdoc/test/unit/templates/html_helpers_test.rb +0 -25
- data/vendor/pdoc/vendor/albino.rb +0 -122
- data/vendor/pdoc/website/html/documentation.html +0 -280
- data/vendor/pdoc/website/html/images/pdoc.jpg +0 -0
- data/vendor/pdoc/website/html/index.html +0 -84
- data/vendor/pdoc/website/html/stylesheets/main.css +0 -73
- data/vendor/pdoc/website/html/stylesheets/reset.css +0 -18
- data/vendor/pdoc/website/markdown/syntax.markdown +0 -226
- data/yuicompressor-2.4.6.zip +0 -0
data/vendor/pdoc/pdoc.gemspec
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name = "pdoc"
|
3
|
-
s.version = "0.2.0"
|
4
|
-
s.date = "2008-11-17"
|
5
|
-
s.summary = "Inline comment parser and JavaScript documentation generator"
|
6
|
-
s.email = "tobie.langel@gmail.com"
|
7
|
-
s.homepage = "http://pdoc.org/"
|
8
|
-
s.description = "PDoc is an inline comment parser and JavaScript documentation generator written in Ruby. It is designed for documenting Prototype and Prototype-based libraries."
|
9
|
-
s.has_rdoc = true
|
10
|
-
s.authors = ["Tobie Langel"]
|
11
|
-
s.files = [
|
12
|
-
"README.markdown",
|
13
|
-
"Rakefile",
|
14
|
-
"pdoc.gemspec"] +
|
15
|
-
Dir['lib/**/*'] +
|
16
|
-
Dir['templates/**/*']
|
17
|
-
|
18
|
-
s.autorequire = "lib/pdoc.rb"
|
19
|
-
|
20
|
-
s.bindir = "bin"
|
21
|
-
s.executables = ["pdoc"]
|
22
|
-
s.default_executable = "pdoc"
|
23
|
-
|
24
|
-
s.test_files = Dir['test/**/*.rb']
|
25
|
-
s.rdoc_options = ["--main", "README.markdown"]
|
26
|
-
s.extra_rdoc_files = ["README.markdown"]
|
27
|
-
s.add_dependency("BlueCloth", ["> 0.0.0"])
|
28
|
-
s.add_dependency("treetop", ["> 0.0.0"])
|
29
|
-
s.add_dependency("oyster", ["> 0.0.0"])
|
30
|
-
end
|
31
|
-
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,478 +0,0 @@
|
|
1
|
-
//= require <prototype>
|
2
|
-
|
3
|
-
if (!Prototype || Prototype.Version.indexOf('1.6') !== 0) {
|
4
|
-
throw "This script requires Prototype >= 1.6.";
|
5
|
-
}
|
6
|
-
|
7
|
-
Object.isDate = function(object) {
|
8
|
-
return object instanceof Date;
|
9
|
-
};
|
10
|
-
|
11
|
-
/**
|
12
|
-
* class Cookie
|
13
|
-
* Creates a cookie.
|
14
|
-
**/
|
15
|
-
var Cookie = Class.create({
|
16
|
-
/**
|
17
|
-
* new Cookie(name, value[, expires])
|
18
|
-
*
|
19
|
-
* - name (String): The name of the cookie.
|
20
|
-
* - value (String): The value of the cookie.
|
21
|
-
* - expires (Number | Date): Exact date (or number of days from now) that
|
22
|
-
* the cookie will expire.
|
23
|
-
**/
|
24
|
-
initialize: function(name, value, expires) {
|
25
|
-
expires = expires || "";
|
26
|
-
if (Object.isNumber(expires)) {
|
27
|
-
var days = expires;
|
28
|
-
expires = new Date();
|
29
|
-
expires.setTime(expires.getTime() + (days * 24 * 60 * 60 * 1000));
|
30
|
-
}
|
31
|
-
|
32
|
-
if (Object.isDate(expires))
|
33
|
-
expires = expires.toGMTString();
|
34
|
-
|
35
|
-
if (!Object.isUndefined(expires) && expires !== "")
|
36
|
-
expires = "; expires=" + expires;
|
37
|
-
|
38
|
-
this.name = name;
|
39
|
-
this.value = value;
|
40
|
-
this.expires = expires;
|
41
|
-
|
42
|
-
document.cookie = name + "=" + value + expires + "; path=/";
|
43
|
-
},
|
44
|
-
|
45
|
-
toString: function() {
|
46
|
-
return this.value;
|
47
|
-
},
|
48
|
-
|
49
|
-
inspect: function() {
|
50
|
-
return "#<Cookie #{name}:#{value}>".interpolate(this);
|
51
|
-
}
|
52
|
-
});
|
53
|
-
|
54
|
-
/**
|
55
|
-
* Cookie
|
56
|
-
**/
|
57
|
-
Object.extend(Cookie, {
|
58
|
-
/**
|
59
|
-
* Cookie.set(name, value, expires)
|
60
|
-
*
|
61
|
-
* Alias of [[Cookie#initialize]].
|
62
|
-
**/
|
63
|
-
set: function(name, value, expires) {
|
64
|
-
return new Cookie(name, value, expires);
|
65
|
-
},
|
66
|
-
|
67
|
-
/**
|
68
|
-
* Cookie.get(name)
|
69
|
-
*
|
70
|
-
* Returns the value of the cookie with the given name.
|
71
|
-
* - name (String): The name of the cookie to retrieve.
|
72
|
-
**/
|
73
|
-
get: function(name) {
|
74
|
-
var c = document.cookie.split(';');
|
75
|
-
|
76
|
-
for (var i = 0, cookie; i < c.length; i++) {
|
77
|
-
cookie = c[i].split('=');
|
78
|
-
if (cookie[0].strip() === name)
|
79
|
-
return cookie[1].strip();
|
80
|
-
}
|
81
|
-
|
82
|
-
return null;
|
83
|
-
},
|
84
|
-
|
85
|
-
/**
|
86
|
-
* Cookie.unset(name)
|
87
|
-
*
|
88
|
-
* Deletes a cookie.
|
89
|
-
* - name (String): The name of the cookie to delete.
|
90
|
-
*
|
91
|
-
**/
|
92
|
-
unset: function(name) {
|
93
|
-
return Cookie.set(name, "", -1);
|
94
|
-
}
|
95
|
-
});
|
96
|
-
|
97
|
-
Cookie.erase = Cookie.unset;
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
if (typeof PDoc === 'undefined') {
|
102
|
-
window.PDoc = {
|
103
|
-
Sidebar: {}
|
104
|
-
};
|
105
|
-
}
|
106
|
-
|
107
|
-
// HISTORY MANAGER (sort of)
|
108
|
-
// Polls for changes to the hash.
|
109
|
-
|
110
|
-
(function() {
|
111
|
-
var PREVIOUS_HASH = null;
|
112
|
-
|
113
|
-
function poll() {
|
114
|
-
var hash = window.location.hash;
|
115
|
-
if (hash && hash !== PREVIOUS_HASH) {
|
116
|
-
document.fire('hash:changed', {
|
117
|
-
previous: PREVIOUS_HASH, current: hash
|
118
|
-
});
|
119
|
-
}
|
120
|
-
PREVIOUS_HASH = hash;
|
121
|
-
window.setTimeout(arguments.callee, 100);
|
122
|
-
}
|
123
|
-
|
124
|
-
Event.observe(window, 'load', poll);
|
125
|
-
})();
|
126
|
-
|
127
|
-
Object.extend(PDoc.Sidebar, {
|
128
|
-
getActiveTab: function() {
|
129
|
-
var activeTab = $('sidebar_tabs').down('.active');
|
130
|
-
if (!activeTab) return null;
|
131
|
-
|
132
|
-
var href = activeTab.readAttribute('href');
|
133
|
-
return href.endsWith('menu_pane') ? 'menu_pane' : 'search_pane';
|
134
|
-
},
|
135
|
-
|
136
|
-
// Remember the state of the sidebar so it can be restored on the next page.
|
137
|
-
serialize: function() {
|
138
|
-
var state = $H({
|
139
|
-
activeTab: PDoc.Sidebar.getActiveTab(),
|
140
|
-
menuScrollOffset: $('menu_pane').scrollTop,
|
141
|
-
searchScrollOffset: $('search_results').scrollTop,
|
142
|
-
searchValue: $('search').getValue()
|
143
|
-
});
|
144
|
-
|
145
|
-
return escape(state.toJSON());
|
146
|
-
},
|
147
|
-
|
148
|
-
// Restore the tree to a certain point based on a cookie.
|
149
|
-
restore: function(state) {
|
150
|
-
try {
|
151
|
-
state = unescape(state).evalJSON();
|
152
|
-
var filterer = $('search').retrieve('filterer');
|
153
|
-
filterer.setSearchValue(state.searchValue);
|
154
|
-
|
155
|
-
(function() {
|
156
|
-
$('menu_pane').scrollTop = state.menuScrollOffset;
|
157
|
-
$('search_results').scrollTop = state.searchScrollOffset;
|
158
|
-
}).defer();
|
159
|
-
} catch(error) {
|
160
|
-
console.log(error);
|
161
|
-
if (!(error instanceof SyntaxError)) throw error;
|
162
|
-
}
|
163
|
-
}
|
164
|
-
});
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
// Live API search.
|
169
|
-
PDoc.Sidebar.Filterer = Class.create({
|
170
|
-
initialize: function(element, options) {
|
171
|
-
this.element = $(element);
|
172
|
-
this.options = Object.extend(
|
173
|
-
Object.clone(PDoc.Sidebar.Filterer.DEFAULT_OPTIONS),
|
174
|
-
options || {}
|
175
|
-
);
|
176
|
-
|
177
|
-
// The browser's "helpful" auto-complete gets in the way.
|
178
|
-
this.element.writeAttribute("autocomplete", "off");
|
179
|
-
this.element.setValue('');
|
180
|
-
|
181
|
-
// Hitting "enter" should do nothing.
|
182
|
-
this.element.up('form').observe("submit", Event.stop);
|
183
|
-
|
184
|
-
this.menu = this.options.menu;
|
185
|
-
this.links = this.menu.select('a');
|
186
|
-
|
187
|
-
this.resultsElement = this.options.resultsElement;
|
188
|
-
|
189
|
-
this.observers = {
|
190
|
-
filter: this.filter.bind(this),
|
191
|
-
keydown: this.keydown.bind(this),
|
192
|
-
keyup: this.keyup.bind(this)
|
193
|
-
};
|
194
|
-
|
195
|
-
this.menu.setStyle({ opacity: 0.9 });
|
196
|
-
this.addObservers();
|
197
|
-
},
|
198
|
-
|
199
|
-
addObservers: function() {
|
200
|
-
this.element.observe('keyup', this.observers.filter);
|
201
|
-
},
|
202
|
-
|
203
|
-
// Called whenever the list of results needs to update as a result of a
|
204
|
-
// changed search key.
|
205
|
-
filter: function(event) {
|
206
|
-
// Clear the text box on ESC.
|
207
|
-
if (event.keyCode && event.keyCode === Event.KEY_ESC) {
|
208
|
-
this.element.setValue('');
|
209
|
-
}
|
210
|
-
|
211
|
-
if (PDoc.Sidebar.Filterer.INTERCEPT_KEYS.include(event.keyCode))
|
212
|
-
return;
|
213
|
-
|
214
|
-
// If there's nothing in the text box, clear the results list.
|
215
|
-
var value = $F(this.element).strip().toLowerCase();
|
216
|
-
if (value === '') {
|
217
|
-
this.emptyResults();
|
218
|
-
this.hideResults();
|
219
|
-
return;
|
220
|
-
}
|
221
|
-
|
222
|
-
var urls = this.findURLs(value);
|
223
|
-
this.buildResults(urls);
|
224
|
-
},
|
225
|
-
|
226
|
-
setSearchValue: function(value) {
|
227
|
-
this.element.setValue(value);
|
228
|
-
if (value.strip() === "") {
|
229
|
-
PDoc.Sidebar.Tabs.setActiveTab(0);
|
230
|
-
return;
|
231
|
-
}
|
232
|
-
this.buildResults(this.findURLs(value));
|
233
|
-
},
|
234
|
-
|
235
|
-
// Given a key, finds all the PDoc objects that match.
|
236
|
-
findURLs: function(str) {
|
237
|
-
var results = [];
|
238
|
-
for (var name in PDoc.elements) {
|
239
|
-
if (name.toLowerCase().include(str.toLowerCase()))
|
240
|
-
results.push(PDoc.elements[name]);
|
241
|
-
}
|
242
|
-
return results;
|
243
|
-
},
|
244
|
-
|
245
|
-
buildResults: function(results) {
|
246
|
-
this.emptyResults();
|
247
|
-
|
248
|
-
results.each( function(result) {
|
249
|
-
var li = this._buildResult(result);
|
250
|
-
this.resultsElement.appendChild(li);
|
251
|
-
}, this);
|
252
|
-
this.showResults();
|
253
|
-
},
|
254
|
-
|
255
|
-
_buildResult: function(obj) {
|
256
|
-
var li = new Element('li', { 'class': 'menu-item' });
|
257
|
-
var a = new Element('a', {
|
258
|
-
'class': obj.type.gsub(/\s/, '-'),
|
259
|
-
'href': PDoc.pathPrefix + obj.path
|
260
|
-
}).update(obj.name);
|
261
|
-
|
262
|
-
li.appendChild(a);
|
263
|
-
return li;
|
264
|
-
},
|
265
|
-
|
266
|
-
emptyResults: function() {
|
267
|
-
this.resultsElement.update();
|
268
|
-
},
|
269
|
-
|
270
|
-
hideResults: function() {
|
271
|
-
PDoc.Sidebar.Tabs.setActiveTab(0);
|
272
|
-
//this.resultsElement.hide();
|
273
|
-
document.stopObserving('keydown', this.observers.keydown);
|
274
|
-
document.stopObserving('keyup', this.observers.keyup);
|
275
|
-
},
|
276
|
-
|
277
|
-
showResults: function() {
|
278
|
-
PDoc.Sidebar.Tabs.setActiveTab(1);
|
279
|
-
//this.resultsElement.show();
|
280
|
-
document.stopObserving('keydown', this.observers.keydown);
|
281
|
-
this.element.stopObserving('keyup', this.observers.keyup);
|
282
|
-
this.element.observe('keydown', this.observers.keydown);
|
283
|
-
document.observe('keyup', this.observers.keyup);
|
284
|
-
},
|
285
|
-
|
286
|
-
keydown: function(event) {
|
287
|
-
if (!PDoc.Sidebar.Filterer.INTERCEPT_KEYS.include(event.keyCode))
|
288
|
-
return;
|
289
|
-
|
290
|
-
// Also ignore if any modifier keys are present.
|
291
|
-
if (event.shiftKey || event.ctrlKey || event.altKey || event.metaKey)
|
292
|
-
return;
|
293
|
-
|
294
|
-
event.stop();
|
295
|
-
|
296
|
-
if (event.keyCode === Event.KEY_RETURN) {
|
297
|
-
// Follow the highlighted item, unless there is none.
|
298
|
-
if (!this.highlighted) return;
|
299
|
-
var a = this.highlighted.down('a');
|
300
|
-
if (a) {
|
301
|
-
window.location.href = a.href;
|
302
|
-
}
|
303
|
-
} else if ([Event.KEY_UP, Event.KEY_DOWN].include(event.keyCode)) {
|
304
|
-
// Is an arrow key.
|
305
|
-
var direction = (Event.KEY_DOWN === event.keyCode) ? 1 : -1;
|
306
|
-
this.highlighted = this.moveHighlight(direction);
|
307
|
-
|
308
|
-
if (!Prototype.Browser.WebKit) {
|
309
|
-
// If up/down key is held down, list should keep scrolling.
|
310
|
-
// WebKit does this automatically because it fires the keydown
|
311
|
-
// event over and over.
|
312
|
-
this._scrollTimer = window.setTimeout(
|
313
|
-
this.scrollList.bind(this, direction), 1000);
|
314
|
-
}
|
315
|
-
}
|
316
|
-
},
|
317
|
-
|
318
|
-
keyup: function(event) {
|
319
|
-
if (this._scrollTimer) {
|
320
|
-
window.clearTimeout(this._scrollTimer);
|
321
|
-
}
|
322
|
-
},
|
323
|
-
|
324
|
-
moveHighlight: function(direction) {
|
325
|
-
if (!this.highlighted) {
|
326
|
-
// If there is none, highlight the first result.
|
327
|
-
this.highlighted =
|
328
|
-
this.resultsElement.down('li').addClassName('highlighted');
|
329
|
-
} else {
|
330
|
-
var method = (direction === 1) ? 'next' : 'previous';
|
331
|
-
this.highlighted.removeClassName('highlighted');
|
332
|
-
var adjacent = this.highlighted[method]('li');
|
333
|
-
// If there isn't an adjacent one, we're at the top or bottom
|
334
|
-
// of the list. Flip it.
|
335
|
-
if (!adjacent) {
|
336
|
-
adjacent = method == 'next' ? this.resultsElement.down('li') :
|
337
|
-
this.resultsElement.down('li:last-of-type');
|
338
|
-
}
|
339
|
-
adjacent.addClassName('highlighted');
|
340
|
-
this.highlighted = adjacent;
|
341
|
-
}
|
342
|
-
|
343
|
-
var h = this.highlighted, r = this.resultsElement;
|
344
|
-
|
345
|
-
var distanceToBottom = h.offsetTop + h.offsetHeight;
|
346
|
-
if (distanceToBottom > (r.offsetHeight + r.scrollTop)) {
|
347
|
-
// Item is below the visible frame.
|
348
|
-
r.scrollTop = distanceToBottom - r.offsetHeight;
|
349
|
-
} else if (h.offsetTop < r.scrollTop) {
|
350
|
-
// Item is above the visible frame.
|
351
|
-
r.scrollTop = h.offsetTop;
|
352
|
-
}
|
353
|
-
|
354
|
-
return this.highlighted;
|
355
|
-
},
|
356
|
-
|
357
|
-
scrollList: function(direction) {
|
358
|
-
this.moveHighlight(direction);
|
359
|
-
this._scrollTimer = window.setTimeout(
|
360
|
-
this.scrollList.bind(this, direction), 100);
|
361
|
-
}
|
362
|
-
});
|
363
|
-
|
364
|
-
Object.extend(PDoc.Sidebar.Filterer, {
|
365
|
-
INTERCEPT_KEYS: [Event.KEY_UP, Event.KEY_DOWN, Event.KEY_RETURN],
|
366
|
-
DEFAULT_OPTIONS: {
|
367
|
-
interval: 0.1,
|
368
|
-
resultsElement: '.search-results'
|
369
|
-
}
|
370
|
-
});
|
371
|
-
|
372
|
-
|
373
|
-
Form.GhostedField = Class.create({
|
374
|
-
initialize: function(element, title, options) {
|
375
|
-
options = options || {};
|
376
|
-
|
377
|
-
this.element = $(element);
|
378
|
-
this.title = title;
|
379
|
-
|
380
|
-
this.isGhosted = true;
|
381
|
-
|
382
|
-
if (options.cloak) {
|
383
|
-
|
384
|
-
// Wrap the native getValue function so that it never returns the
|
385
|
-
// ghosted value. This is optional because it presumes the ghosted
|
386
|
-
// value isn't valid input for the field.
|
387
|
-
this.element.getValue = this.element.getValue.wrap(this.wrappedGetValue.bind(this));
|
388
|
-
}
|
389
|
-
|
390
|
-
this.addObservers();
|
391
|
-
|
392
|
-
this.onBlur();
|
393
|
-
},
|
394
|
-
|
395
|
-
wrappedGetValue: function($proceed) {
|
396
|
-
var value = $proceed();
|
397
|
-
return value === this.title ? "" : value;
|
398
|
-
},
|
399
|
-
|
400
|
-
addObservers: function() {
|
401
|
-
this.element.observe('focus', this.onFocus.bind(this));
|
402
|
-
this.element.observe('blur', this.onBlur.bind(this));
|
403
|
-
|
404
|
-
var form = this.element.up('form');
|
405
|
-
if (form) {
|
406
|
-
form.observe('submit', this.onSubmit.bind(this));
|
407
|
-
}
|
408
|
-
|
409
|
-
// Firefox's bfcache means that form fields need to be re-initialized
|
410
|
-
// when you hit the "back" button to return to the page.
|
411
|
-
if (Prototype.Browser.Gecko) {
|
412
|
-
window.addEventListener('pageshow', this.onBlur.bind(this), false);
|
413
|
-
}
|
414
|
-
},
|
415
|
-
|
416
|
-
onFocus: function() {
|
417
|
-
if (this.isGhosted) {
|
418
|
-
this.element.setValue('');
|
419
|
-
this.setGhosted(false);
|
420
|
-
}
|
421
|
-
},
|
422
|
-
|
423
|
-
onBlur: function() {
|
424
|
-
var value = this.element.getValue();
|
425
|
-
if (value.blank() || value == this.title) {
|
426
|
-
this.setGhosted(true);
|
427
|
-
} else {
|
428
|
-
this.setGhosted(false);
|
429
|
-
}
|
430
|
-
},
|
431
|
-
|
432
|
-
setGhosted: function(isGhosted) {
|
433
|
-
this.isGhosted = isGhosted;
|
434
|
-
this.element[isGhosted ? 'addClassName' : 'removeClassName']('ghosted');
|
435
|
-
if (isGhosted) {
|
436
|
-
this.element.setValue(this.title);
|
437
|
-
}
|
438
|
-
},
|
439
|
-
|
440
|
-
// Hook into the enclosing form's `onsubmit` event so that we clear any
|
441
|
-
// ghosted text before the form is sent.
|
442
|
-
onSubmit: function() {
|
443
|
-
if (this.isGhosted) {
|
444
|
-
this.element.setValue('');
|
445
|
-
}
|
446
|
-
}
|
447
|
-
});
|
448
|
-
|
449
|
-
document.observe('dom:loaded', function() {
|
450
|
-
PDoc.Sidebar.Tabs = new Control.Tabs($('sidebar_tabs'));
|
451
|
-
|
452
|
-
var searchField = $('search');
|
453
|
-
|
454
|
-
if (searchField) {
|
455
|
-
var filterer = new PDoc.Sidebar.Filterer(searchField, {
|
456
|
-
menu: $('api_menu'),
|
457
|
-
resultsElement: $('search_results')
|
458
|
-
});
|
459
|
-
searchField.store('filterer', filterer);
|
460
|
-
}
|
461
|
-
|
462
|
-
// Prevent horizontal scrolling in scrollable sidebar areas.
|
463
|
-
$$('.scrollable').invoke('observe', 'scroll', function() {
|
464
|
-
this.scrollLeft = 0;
|
465
|
-
});
|
466
|
-
|
467
|
-
var sidebarState = Cookie.get('sidebar_state');
|
468
|
-
if (sidebarState) {
|
469
|
-
PDoc.Sidebar.restore(sidebarState);
|
470
|
-
}
|
471
|
-
|
472
|
-
new Form.GhostedField(searchField, searchField.getAttribute('title'),
|
473
|
-
{ cloak: true });
|
474
|
-
});
|
475
|
-
|
476
|
-
Event.observe(window, 'unload', function() {
|
477
|
-
Cookie.set('sidebar_state', PDoc.Sidebar.serialize());
|
478
|
-
});
|