netlinx-compile 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/bin/netlinx-compile +0 -0
  3. data/doc/NetLinx.html +40 -40
  4. data/doc/NetLinx/Compile.html +38 -38
  5. data/doc/NetLinx/Compile/Extension.html +38 -38
  6. data/doc/NetLinx/Compile/Extension/AXS.html +49 -48
  7. data/doc/NetLinx/Compile/ExtensionDiscovery.html +56 -55
  8. data/doc/NetLinx/Compile/ExtensionHandler.html +60 -59
  9. data/doc/NetLinx/Compile/Script.html +51 -50
  10. data/doc/NetLinx/Compiler.html +52 -51
  11. data/doc/NetLinx/CompilerResult.html +72 -71
  12. data/doc/NetLinx/NoCompilerError.html +44 -43
  13. data/doc/NetLinx/Rake.html +115 -0
  14. data/doc/NetLinx/Rake/Compile.html +359 -0
  15. data/doc/NetLinx/SourceFile.html +58 -57
  16. data/doc/Test.html +147 -0
  17. data/doc/Test/NetLinx.html +147 -0
  18. data/doc/Test/NetLinx/Compilable.html +148 -0
  19. data/doc/Test/NetLinx/Compile.html +146 -0
  20. data/doc/Test/NetLinx/Compile/Discoverable.html +148 -0
  21. data/doc/Test/NetLinx/Compile/Invokable.html +149 -0
  22. data/doc/_index.html +50 -31
  23. data/doc/class_list.html +24 -31
  24. data/doc/created.rid +12 -0
  25. data/doc/css/full_list.css +32 -31
  26. data/doc/css/style.css +251 -91
  27. data/doc/file.README.html +28 -31
  28. data/doc/file.license.html +28 -31
  29. data/doc/file_list.html +29 -31
  30. data/doc/frames.html +7 -16
  31. data/doc/images/add.png +0 -0
  32. data/doc/images/arrow_up.png +0 -0
  33. data/doc/images/brick.png +0 -0
  34. data/doc/images/brick_link.png +0 -0
  35. data/doc/images/bug.png +0 -0
  36. data/doc/images/bullet_black.png +0 -0
  37. data/doc/images/bullet_toggle_minus.png +0 -0
  38. data/doc/images/bullet_toggle_plus.png +0 -0
  39. data/doc/images/date.png +0 -0
  40. data/doc/images/delete.png +0 -0
  41. data/doc/images/find.png +0 -0
  42. data/doc/images/loadingAnimation.gif +0 -0
  43. data/doc/images/macFFBgHack.png +0 -0
  44. data/doc/images/package.png +0 -0
  45. data/doc/images/page_green.png +0 -0
  46. data/doc/images/page_white_text.png +0 -0
  47. data/doc/images/page_white_width.png +0 -0
  48. data/doc/images/plugin.png +0 -0
  49. data/doc/images/ruby.png +0 -0
  50. data/doc/images/tag_blue.png +0 -0
  51. data/doc/images/tag_green.png +0 -0
  52. data/doc/images/transparent.png +0 -0
  53. data/doc/images/wrench.png +0 -0
  54. data/doc/images/wrench_orange.png +0 -0
  55. data/doc/images/zoom.png +0 -0
  56. data/doc/index.html +28 -31
  57. data/doc/js/app.js +106 -77
  58. data/doc/js/darkfish.js +155 -0
  59. data/doc/js/full_list.js +170 -135
  60. data/doc/js/navigation.js +142 -0
  61. data/doc/js/search.js +94 -0
  62. data/doc/js/search_index.js +1 -0
  63. data/doc/js/searcher.js +228 -0
  64. data/doc/method_list.html +209 -131
  65. data/doc/rdoc.css +595 -0
  66. data/doc/table_of_contents.html +138 -0
  67. data/doc/top-level-namespace.html +34 -36
  68. data/lib/netlinx/compiler.rb +1 -1
  69. data/lib/netlinx/rake/compile.rb +4 -0
  70. data/lib/netlinx/rake/compile/compile.rb +34 -0
  71. metadata +64 -15
@@ -1,3 +1,9 @@
1
+ (function() {
2
+
3
+ var localStorage = {}, sessionStorage = {};
4
+ try { localStorage = window.localStorage; } catch (e) { }
5
+ try { sessionStorage = window.sessionStorage; } catch (e) { }
6
+
1
7
  function createSourceLinks() {
2
8
  $('.method_details_list .source_code').
3
9
  before("<span class='showSource'>[<a href='#' class='toggleSource'>View source</a>]</span>");
@@ -16,7 +22,7 @@ function createDefineLinks() {
16
22
  $('.defines').after(" <a href='#' class='toggleDefines'>more...</a>");
17
23
  $('.toggleDefines').toggle(function() {
18
24
  tHeight = $(this).parent().prev().height();
19
- $(this).prev().show();
25
+ $(this).prev().css('display', 'inline');
20
26
  $(this).parent().prev().height($(this).parent().height());
21
27
  $(this).text("(less)");
22
28
  },
@@ -42,29 +48,39 @@ function createFullTreeLinks() {
42
48
  });
43
49
  }
44
50
 
45
- function fixBoxInfoHeights() {
46
- $('dl.box dd.r1, dl.box dd.r2').each(function() {
47
- $(this).prev().height($(this).height());
48
- });
49
- }
50
-
51
- function searchFrameLinks() {
51
+ function searchFrameButtons() {
52
52
  $('.full_list_link').click(function() {
53
53
  toggleSearchFrame(this, $(this).attr('href'));
54
54
  return false;
55
55
  });
56
+ window.addEventListener('message', function(e) {
57
+ if (e.data === 'navEscape') {
58
+ $('#nav').slideUp(100);
59
+ $('#search a').removeClass('active inactive');
60
+ $(window).focus();
61
+ }
62
+ });
63
+
64
+ $(window).resize(function() {
65
+ if ($('#search:visible').length === 0) {
66
+ $('#nav').removeAttr('style');
67
+ $('#search a').removeClass('active inactive');
68
+ $(window).focus();
69
+ }
70
+ });
56
71
  }
57
72
 
58
73
  function toggleSearchFrame(id, link) {
59
- var frame = $('#search_frame');
74
+ var frame = $('#nav');
60
75
  $('#search a').removeClass('active').addClass('inactive');
61
- if (frame.attr('src') == link && frame.css('display') != "none") {
76
+ if (frame.attr('src') === link && frame.css('display') !== "none") {
62
77
  frame.slideUp(100);
63
78
  $('#search a').removeClass('active inactive');
64
79
  }
65
80
  else {
66
81
  $(id).addClass('active').removeClass('inactive');
67
- frame.attr('src', link).slideDown(100);
82
+ if (frame.attr('src') !== link) frame.attr('src', link);
83
+ frame.slideDown(100);
68
84
  }
69
85
  }
70
86
 
@@ -74,43 +90,10 @@ function linkSummaries() {
74
90
  });
75
91
  }
76
92
 
77
- function framesInit() {
78
- if (hasFrames) {
79
- document.body.className = 'frames';
80
- $('#menu .noframes a').attr('href', document.location);
81
- try {
82
- window.top.document.title = $('html head title').text();
83
- } catch(error) {
84
- // some browsers will not allow this when serving from file://
85
- // but we don't want to stop the world.
86
- }
87
- }
88
- else {
89
- $('#menu .noframes a').text('frames').attr('href', framesUrl);
90
- }
91
- }
92
-
93
- function keyboardShortcuts() {
94
- if (window.top.frames.main) return;
95
- $(document).keypress(function(evt) {
96
- if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) return;
97
- if (typeof evt.target !== "undefined" &&
98
- (evt.target.nodeName == "INPUT" ||
99
- evt.target.nodeName == "TEXTAREA")) return;
100
- switch (evt.charCode) {
101
- case 67: case 99: $('#class_list_link').click(); break; // 'c'
102
- case 77: case 109: $('#method_list_link').click(); break; // 'm'
103
- case 70: case 102: $('#file_list_link').click(); break; // 'f'
104
- default: break;
105
- }
106
- });
107
- }
108
-
109
93
  function summaryToggle() {
110
- $('.summary_toggle').click(function() {
111
- if (localStorage) {
112
- localStorage.summaryCollapsed = $(this).text();
113
- }
94
+ $('.summary_toggle').click(function(e) {
95
+ e.preventDefault();
96
+ localStorage.summaryCollapsed = $(this).text();
114
97
  $('.summary_toggle').each(function() {
115
98
  $(this).text($(this).text() == "collapse" ? "expand" : "collapse");
116
99
  var next = $(this).parent().parent().nextAll('ul.summary').first();
@@ -132,18 +115,9 @@ function summaryToggle() {
132
115
  });
133
116
  return false;
134
117
  });
135
- if (localStorage) {
136
- if (localStorage.summaryCollapsed == "collapse") {
137
- $('.summary_toggle').first().click();
138
- }
139
- else localStorage.summaryCollapsed = "expand";
140
- }
141
- }
142
-
143
- function fixOutsideWorldLinks() {
144
- $('a').each(function() {
145
- if (window.location.host != this.host) this.target = '_parent';
146
- });
118
+ if (localStorage.summaryCollapsed == "collapse") {
119
+ $('.summary_toggle').first().click();
120
+ } else { localStorage.summaryCollapsed = "expand"; }
147
121
  }
148
122
 
149
123
  function generateTOC() {
@@ -185,7 +159,7 @@ function generateTOC() {
185
159
  lastTag = thisTag;
186
160
  });
187
161
  if (!show) return;
188
- html = '<div id="toc"><p class="title"><a class="hide_toc" href="#"><strong>Table of Contents</strong></a> <small>(<a href="#" class="float_toc">left</a>)</small></p></div>';
162
+ html = '<div id="toc"><p class="title hide_toc"><a href="#"><strong>Table of Contents</strong></a></p></div>';
189
163
  $('#content').prepend(html);
190
164
  $('#toc').append(_toc);
191
165
  $('#toc .hide_toc').toggle(function() {
@@ -197,23 +171,78 @@ function generateTOC() {
197
171
  $('#toc').toggleClass('hidden');
198
172
  $('#toc .title small').toggle();
199
173
  });
200
- $('#toc .float_toc').toggle(function() {
201
- $(this).text('float');
202
- $('#toc').toggleClass('nofloat');
203
- }, function() {
204
- $(this).text('left');
205
- $('#toc').toggleClass('nofloat');
174
+ }
175
+
176
+ function navResizeFn(e) {
177
+ if (e.which !== 1) {
178
+ navResizeFnStop();
179
+ return;
180
+ }
181
+
182
+ sessionStorage.navWidth = e.pageX.toString();
183
+ $('.nav_wrap').css('width', e.pageX);
184
+ $('.nav_wrap').css('-ms-flex', 'inherit');
185
+ }
186
+
187
+ function navResizeFnStop() {
188
+ $(window).unbind('mousemove', navResizeFn);
189
+ window.removeEventListener('message', navMessageFn, false);
190
+ }
191
+
192
+ function navMessageFn(e) {
193
+ if (e.data.action === 'mousemove') navResizeFn(e.data.event);
194
+ if (e.data.action === 'mouseup') navResizeFnStop();
195
+ }
196
+
197
+ function navResizer() {
198
+ $('#resizer').mousedown(function(e) {
199
+ e.preventDefault();
200
+ $(window).mousemove(navResizeFn);
201
+ window.addEventListener('message', navMessageFn, false);
206
202
  });
203
+ $(window).mouseup(navResizeFnStop);
204
+
205
+ if (sessionStorage.navWidth) {
206
+ navResizeFn({which: 1, pageX: parseInt(sessionStorage.navWidth, 10)});
207
+ }
208
+ }
209
+
210
+ function navExpander() {
211
+ var done = false, timer = setTimeout(postMessage, 500);
212
+ function postMessage() {
213
+ if (done) return;
214
+ clearTimeout(timer);
215
+ var opts = { action: 'expand', path: pathId };
216
+ document.getElementById('nav').contentWindow.postMessage(opts, '*');
217
+ done = true;
218
+ }
219
+
220
+ window.addEventListener('message', function(event) {
221
+ if (event.data === 'navReady') postMessage();
222
+ return false;
223
+ }, false);
224
+ }
225
+
226
+ function mainFocus() {
227
+ var hash = window.location.hash;
228
+ if (hash !== '' && $(hash)[0]) {
229
+ $(hash)[0].scrollIntoView();
230
+ }
231
+
232
+ setTimeout(function() { $('#main').focus(); }, 10);
207
233
  }
208
234
 
209
- $(framesInit);
210
- $(createSourceLinks);
211
- $(createDefineLinks);
212
- $(createFullTreeLinks);
213
- $(fixBoxInfoHeights);
214
- $(searchFrameLinks);
215
- $(linkSummaries);
216
- $(keyboardShortcuts);
217
- $(summaryToggle);
218
- $(fixOutsideWorldLinks);
219
- $(generateTOC);
235
+ $(document).ready(function() {
236
+ navResizer();
237
+ navExpander();
238
+ createSourceLinks();
239
+ createDefineLinks();
240
+ createFullTreeLinks();
241
+ searchFrameButtons();
242
+ linkSummaries();
243
+ summaryToggle();
244
+ generateTOC();
245
+ mainFocus();
246
+ });
247
+
248
+ })();
@@ -0,0 +1,155 @@
1
+ /**
2
+ *
3
+ * Darkfish Page Functions
4
+ * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
5
+ *
6
+ * Author: Michael Granger <mgranger@laika.com>
7
+ *
8
+ */
9
+
10
+ /* Provide console simulation for firebug-less environments */
11
+ if (!("console" in window) || !("firebug" in console)) {
12
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
13
+ "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
14
+
15
+ window.console = {};
16
+ for (var i = 0; i < names.length; ++i)
17
+ window.console[names[i]] = function() {};
18
+ };
19
+
20
+
21
+ /**
22
+ * Unwrap the first element that matches the given @expr@ from the targets and return them.
23
+ */
24
+ $.fn.unwrap = function( expr ) {
25
+ return this.each( function() {
26
+ $(this).parents( expr ).eq( 0 ).after( this ).remove();
27
+ });
28
+ };
29
+
30
+
31
+ function showSource( e ) {
32
+ var target = e.target;
33
+ var codeSections = $(target).
34
+ parents('.method-detail').
35
+ find('.method-source-code');
36
+
37
+ $(target).
38
+ parents('.method-detail').
39
+ find('.method-source-code').
40
+ slideToggle();
41
+ };
42
+
43
+ function hookSourceViews() {
44
+ $('.method-heading').click( showSource );
45
+ };
46
+
47
+ function toggleDebuggingSection() {
48
+ $('.debugging-section').slideToggle();
49
+ };
50
+
51
+ function hookDebuggingToggle() {
52
+ $('#debugging-toggle img').click( toggleDebuggingSection );
53
+ };
54
+
55
+ function hookTableOfContentsToggle() {
56
+ $('.indexpage li .toc-toggle').each( function() {
57
+ $(this).click( function() {
58
+ $(this).toggleClass('open');
59
+ });
60
+
61
+ var section = $(this).next();
62
+
63
+ $(this).click( function() {
64
+ section.slideToggle();
65
+ });
66
+ });
67
+ }
68
+
69
+ function hookSearch() {
70
+ var input = $('#search-field').eq(0);
71
+ var result = $('#search-results').eq(0);
72
+ $(result).show();
73
+
74
+ var search_section = $('#search-section').get(0);
75
+ $(search_section).show();
76
+
77
+ var search = new Search(search_data, input, result);
78
+
79
+ search.renderItem = function(result) {
80
+ var li = document.createElement('li');
81
+ var html = '';
82
+
83
+ // TODO add relative path to <script> per-page
84
+ html += '<p class="search-match"><a href="' + rdoc_rel_prefix + result.path + '">' + this.hlt(result.title);
85
+ if (result.params)
86
+ html += '<span class="params">' + result.params + '</span>';
87
+ html += '</a>';
88
+
89
+
90
+ if (result.namespace)
91
+ html += '<p class="search-namespace">' + this.hlt(result.namespace);
92
+
93
+ if (result.snippet)
94
+ html += '<div class="search-snippet">' + result.snippet + '</div>';
95
+
96
+ li.innerHTML = html;
97
+
98
+ return li;
99
+ }
100
+
101
+ search.select = function(result) {
102
+ var result_element = result.get(0);
103
+ window.location.href = result_element.firstChild.firstChild.href;
104
+ }
105
+
106
+ search.scrollIntoView = search.scrollInWindow;
107
+ };
108
+
109
+ function highlightTarget( anchor ) {
110
+ console.debug( "Highlighting target '%s'.", anchor );
111
+
112
+ $("a[name]").each( function() {
113
+ if ( $(this).attr("name") == anchor ) {
114
+ if ( !$(this).parent().parent().hasClass('target-section') ) {
115
+ console.debug( "Wrapping the target-section" );
116
+ $('div.method-detail').unwrap( 'div.target-section' );
117
+ $(this).parent().wrap( '<div class="target-section"></div>' );
118
+ } else {
119
+ console.debug( "Already wrapped." );
120
+ }
121
+ }
122
+ });
123
+ };
124
+
125
+ function highlightLocationTarget() {
126
+ console.debug( "Location hash: %s", window.location.hash );
127
+ if ( ! window.location.hash || window.location.hash.length == 0 ) return;
128
+
129
+ var anchor = window.location.hash.substring(1);
130
+ console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
131
+
132
+ highlightTarget( anchor );
133
+ };
134
+
135
+ function highlightClickTarget( event ) {
136
+ console.debug( "Highlighting click target for event %o", event.target );
137
+ try {
138
+ var anchor = $(event.target).attr( 'href' ).substring(1);
139
+ console.debug( "Found target anchor: %s", anchor );
140
+ highlightTarget( anchor );
141
+ } catch ( err ) {
142
+ console.error( "Exception while highlighting: %o", err );
143
+ };
144
+ };
145
+
146
+
147
+ $(document).ready( function() {
148
+ hookSourceViews();
149
+ hookDebuggingToggle();
150
+ hookSearch();
151
+ highlightLocationTarget();
152
+ hookTableOfContentsToggle();
153
+
154
+ $('ul.link-list a').bind( "click", highlightClickTarget );
155
+ });
@@ -1,8 +1,8 @@
1
- var inSearch = null;
2
- var searchIndex = 0;
1
+ (function() {
2
+
3
+ var $clicked = $(null);
4
+ var searchTimeout = null;
3
5
  var searchCache = [];
4
- var searchString = '';
5
- var regexSearchString = '';
6
6
  var caseSensitiveMatch = false;
7
7
  var ignoreKeyCodeMin = 8;
8
8
  var ignoreKeyCodeMax = 46;
@@ -12,170 +12,205 @@ RegExp.escape = function(text) {
12
12
  return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
13
13
  }
14
14
 
15
- function fullListSearch() {
16
- // generate cache
17
- searchCache = [];
18
- $('#full_list li').each(function() {
19
- var link = $(this).find('.object_link a');
20
- if (link.length === 0) return;
21
- var fullName = link.attr('title').split(' ')[0];
22
- searchCache.push({name:link.text(), fullName:fullName, node:$(this), link:link});
15
+ function escapeShortcut() {
16
+ $(document).keydown(function(evt) {
17
+ if (evt.which == 27) {
18
+ window.parent.postMessage('navEscape', '*');
19
+ }
23
20
  });
21
+ }
24
22
 
25
- $('#search input').keyup(function(event) {
26
- if ((event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax)
27
- || event.keyCode == commandKey)
28
- return;
29
- searchString = this.value;
30
- caseSensitiveMatch = searchString.match(/[A-Z]/) != null;
31
- regexSearchString = RegExp.escape(searchString);
32
- if (caseSensitiveMatch) {
33
- regexSearchString += "|" +
34
- $.map(searchString.split(''), function(e) { return RegExp.escape(e); }).
35
- join('.+?');
36
- }
37
- if (searchString === "") {
38
- clearTimeout(inSearch);
39
- inSearch = null;
40
- $('ul .search_uncollapsed').removeClass('search_uncollapsed');
41
- $('#full_list, #content').removeClass('insearch');
42
- $('#full_list li').removeClass('found').each(function() {
43
-
44
- var link = $(this).find('.object_link a');
45
- if (link.length > 0) link.text(link.text());
23
+ function navResizer() {
24
+ $(window).mousemove(function(e) {
25
+ window.parent.postMessage({
26
+ action: 'mousemove', event: {pageX: e.pageX, which: e.which}
27
+ }, '*');
28
+ }).mouseup(function(e) {
29
+ window.parent.postMessage({action: 'mouseup'}, '*');
30
+ });
31
+ window.parent.postMessage("navReady", "*");
32
+ }
33
+
34
+ function clearSearchTimeout() {
35
+ clearTimeout(searchTimeout);
36
+ searchTimeout = null;
37
+ }
38
+
39
+ function enableLinks() {
40
+ // load the target page in the parent window
41
+ $('#full_list li').on('click', function(evt) {
42
+ $('#full_list li').removeClass('clicked');
43
+ $clicked = $(this);
44
+ $clicked.addClass('clicked');
45
+ evt.stopPropagation();
46
+
47
+ if (evt.target.tagName === 'A') return true;
48
+
49
+ var elem = $clicked.find('> .item .object_link a')[0];
50
+ var e = evt.originalEvent;
51
+ var newEvent = new MouseEvent(evt.originalEvent.type);
52
+ newEvent.initMouseEvent(e.type, e.canBubble, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget);
53
+ elem.dispatchEvent(newEvent);
54
+ evt.preventDefault();
55
+ return false;
56
+ });
57
+ }
58
+
59
+ function enableToggles() {
60
+ // show/hide nested classes on toggle click
61
+ $('#full_list a.toggle').on('click', function(evt) {
62
+ evt.stopPropagation();
63
+ evt.preventDefault();
64
+ $(this).parent().parent().toggleClass('collapsed');
65
+ highlight();
66
+ });
67
+ }
68
+
69
+ function populateSearchCache() {
70
+ $('#full_list li .item').each(function() {
71
+ var $node = $(this);
72
+ var $link = $node.find('.object_link a');
73
+ if ($link.length > 0) {
74
+ searchCache.push({
75
+ node: $node,
76
+ link: $link,
77
+ name: $link.text(),
78
+ fullName: $link.attr('title').split(' ')[0]
46
79
  });
47
- if (clicked) {
48
- clicked.parents('ul').each(function() {
49
- $(this).removeClass('collapsed').prev().removeClass('collapsed');
50
- });
51
- }
52
- highlight();
53
80
  }
54
- else {
55
- if (inSearch) clearTimeout(inSearch);
56
- searchIndex = 0;
57
- lastRowClass = '';
58
- $('#full_list, #content').addClass('insearch');
59
- $('#noresults').text('');
60
- searchItem();
81
+ });
82
+ }
83
+
84
+ function enableSearch() {
85
+ $('#search input').keyup(function(event) {
86
+ if (ignoredKeyPress(event)) return;
87
+ if (this.value === "") {
88
+ clearSearch();
89
+ } else {
90
+ performSearch(this.value);
61
91
  }
62
92
  });
63
93
 
64
- $('#search input').focus();
65
- $('#full_list').after("<div id='noresults'></div>");
94
+ $('#full_list').after("<div id='noresults' style='display:none'></div>");
95
+ }
96
+
97
+ function ignoredKeyPress(event) {
98
+ if (
99
+ (event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) ||
100
+ (event.keyCode == commandKey)
101
+ ) {
102
+ return true;
103
+ } else {
104
+ return false;
105
+ }
106
+ }
107
+
108
+ function clearSearch() {
109
+ clearSearchTimeout();
110
+ $('#full_list .found').removeClass('found').each(function() {
111
+ var $link = $(this).find('.object_link a');
112
+ $link.text($link.text());
113
+ });
114
+ $('#full_list, #content').removeClass('insearch');
115
+ $clicked.parents().removeClass('collapsed');
116
+ highlight();
117
+ }
118
+
119
+ function performSearch(searchString) {
120
+ clearSearchTimeout();
121
+ $('#full_list, #content').addClass('insearch');
122
+ $('#noresults').text('').hide();
123
+ partialSearch(searchString, 0);
66
124
  }
67
125
 
68
- var lastRowClass = '';
69
- function searchItem() {
70
- for (var i = 0; i < searchCache.length / 50; i++) {
71
- var item = searchCache[searchIndex];
126
+ function partialSearch(searchString, offset) {
127
+ var lastRowClass = '';
128
+ var i = null;
129
+ for (i = offset; i < Math.min(offset + 50, searchCache.length); i++) {
130
+ var item = searchCache[i];
72
131
  var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name);
73
- var matchString = regexSearchString;
132
+ var matchString = buildMatchString(searchString);
74
133
  var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i");
75
134
  if (searchName.match(matchRegexp) == null) {
76
135
  item.node.removeClass('found');
136
+ item.link.text(item.link.text());
77
137
  }
78
138
  else {
79
- item.node.css('padding-left', '10px').addClass('found');
80
- item.node.parents().addClass('search_uncollapsed');
139
+ item.node.addClass('found');
81
140
  item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1');
82
141
  lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2';
83
142
  item.link.html(item.name.replace(matchRegexp, "<strong>$&</strong>"));
84
143
  }
85
-
86
- if (searchCache.length === searchIndex + 1) {
87
- searchDone();
88
- return;
89
- }
90
- else {
91
- searchIndex++;
92
- }
93
144
  }
94
- inSearch = setTimeout('searchItem()', 0);
145
+ if(i == searchCache.length) {
146
+ searchDone();
147
+ } else {
148
+ searchTimeout = setTimeout(function() {
149
+ partialSearch(searchString, i);
150
+ }, 0);
151
+ }
95
152
  }
96
153
 
97
154
  function searchDone() {
98
- highlight(true);
155
+ searchTimeout = null;
156
+ highlight();
99
157
  if ($('#full_list li:visible').size() === 0) {
100
158
  $('#noresults').text('No results were found.').hide().fadeIn();
101
- }
102
- else {
103
- $('#noresults').text('');
159
+ } else {
160
+ $('#noresults').text('').hide();
104
161
  }
105
162
  $('#content').removeClass('insearch');
106
- clearTimeout(inSearch);
107
- inSearch = null;
108
- }
109
-
110
- clicked = null;
111
- function linkList() {
112
- $('#full_list li, #full_list li a:last').click(function(evt) {
113
- if ($(this).hasClass('toggle')) return true;
114
- if (this.tagName.toLowerCase() == "li") {
115
- if ($(this).find('.object_link a').length === 0) {
116
- $(this).children('a.toggle').click();
117
- return false;
118
- }
119
- var toggle = $(this).children('a.toggle');
120
- if (toggle.size() > 0 && evt.pageX < toggle.offset().left) {
121
- toggle.click();
122
- return false;
123
- }
124
- }
125
- if (clicked) clicked.removeClass('clicked');
126
- var win;
127
- try {
128
- win = window.top.frames.main ? window.top.frames.main : window.parent;
129
- } catch (e) { win = window.parent; }
130
- if (this.tagName.toLowerCase() == "a") {
131
- clicked = $(this).parents('li').addClass('clicked');
132
- win.location = this.href;
133
- }
134
- else {
135
- clicked = $(this).addClass('clicked');
136
- win.location = $(this).find('a:last').attr('href');
137
- }
138
- return false;
139
- });
140
163
  }
141
164
 
142
- function collapse() {
143
- if (!$('#full_list').hasClass('class')) return;
144
- $('#full_list.class a.toggle').click(function() {
145
- $(this).parent().toggleClass('collapsed').next().toggleClass('collapsed');
146
- highlight();
147
- return false;
148
- });
149
- $('#full_list.class ul').each(function() {
150
- $(this).addClass('collapsed').prev().addClass('collapsed');
151
- });
152
- $('#full_list.class').children().removeClass('collapsed');
153
- highlight();
165
+ function buildMatchString(searchString, event) {
166
+ caseSensitiveMatch = searchString.match(/[A-Z]/) != null;
167
+ var regexSearchString = RegExp.escape(searchString);
168
+ if (caseSensitiveMatch) {
169
+ regexSearchString += "|" +
170
+ $.map(searchString.split(''), function(e) { return RegExp.escape(e); }).
171
+ join('.+?');
172
+ }
173
+ return regexSearchString;
154
174
  }
155
175
 
156
- function highlight(no_padding) {
157
- var n = 1;
158
- $('#full_list li:visible').each(function() {
159
- var next = n == 1 ? 2 : 1;
160
- $(this).removeClass("r" + next).addClass("r" + n);
161
- if (!no_padding && $('#full_list').hasClass('class')) {
162
- $(this).css('padding-left', (10 + $(this).parents('ul').size() * 15) + 'px');
163
- }
164
- n = next;
176
+ function highlight() {
177
+ $('#full_list li:visible').each(function(n) {
178
+ $(this).removeClass('even odd').addClass(n % 2 == 0 ? 'odd' : 'even');
165
179
  });
166
180
  }
167
181
 
168
- function escapeShortcut() {
169
- $(document).keydown(function(evt) {
170
- if (evt.which == 27) {
171
- $('#search_frame', window.top.document).slideUp(100);
172
- $('#search a', window.top.document).removeClass('active inactive');
173
- $(window.top).focus();
174
- }
175
- });
182
+ /**
183
+ * Expands the tree to the target element and its immediate
184
+ * children.
185
+ */
186
+ function expandTo(path) {
187
+ var $target = $(document.getElementById('object_' + path));
188
+ $target.addClass('clicked');
189
+ $target.removeClass('collapsed');
190
+ $target.parentsUntil('#full_list', 'li').removeClass('collapsed');
191
+ if($target[0]) {
192
+ window.scrollTo(window.scrollX, $target.offset().top - 250);
193
+ highlight();
194
+ }
195
+ }
196
+
197
+ function windowEvents(event) {
198
+ var msg = event.data;
199
+ if (msg.action === "expand") {
200
+ expandTo(msg.path);
201
+ }
202
+ return false;
176
203
  }
177
204
 
178
- $(escapeShortcut);
179
- $(fullListSearch);
180
- $(linkList);
181
- $(collapse);
205
+ window.addEventListener("message", windowEvents, false);
206
+
207
+ $(document).ready(function() {
208
+ escapeShortcut();
209
+ navResizer();
210
+ enableLinks();
211
+ enableToggles();
212
+ populateSearchCache();
213
+ enableSearch();
214
+ });
215
+
216
+ })();