shenanigans 1.0.11 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/doc/js/full_list.js CHANGED
@@ -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,167 +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 = window.top.frames.main ? window.top.frames.main : window.parent;
127
- if (this.tagName.toLowerCase() == "a") {
128
- clicked = $(this).parents('li').addClass('clicked');
129
- win.location = this.href;
130
- }
131
- else {
132
- clicked = $(this).addClass('clicked');
133
- win.location = $(this).find('a:last').attr('href');
134
- }
135
- return false;
136
- });
137
163
  }
138
164
 
139
- function collapse() {
140
- if (!$('#full_list').hasClass('class')) return;
141
- $('#full_list.class a.toggle').click(function() {
142
- $(this).parent().toggleClass('collapsed').next().toggleClass('collapsed');
143
- highlight();
144
- return false;
145
- });
146
- $('#full_list.class ul').each(function() {
147
- $(this).addClass('collapsed').prev().addClass('collapsed');
148
- });
149
- $('#full_list.class').children().removeClass('collapsed');
150
- 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;
151
174
  }
152
175
 
153
- function highlight(no_padding) {
154
- var n = 1;
155
- $('#full_list li:visible').each(function() {
156
- var next = n == 1 ? 2 : 1;
157
- $(this).removeClass("r" + next).addClass("r" + n);
158
- if (!no_padding && $('#full_list').hasClass('class')) {
159
- $(this).css('padding-left', (10 + $(this).parents('ul').size() * 15) + 'px');
160
- }
161
- n = next;
176
+ function highlight() {
177
+ $('#full_list li:visible').each(function(n) {
178
+ $(this).removeClass('even odd').addClass(n % 2 == 0 ? 'odd' : 'even');
162
179
  });
163
180
  }
164
181
 
165
- function escapeShortcut() {
166
- $(document).keydown(function(evt) {
167
- if (evt.which == 27) {
168
- $('#search_frame', window.top.document).slideUp(100);
169
- $('#search a', window.top.document).removeClass('active inactive');
170
- $(window.top).focus();
171
- }
172
- });
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;
173
203
  }
174
204
 
175
- $(escapeShortcut);
176
- $(fullListSearch);
177
- $(linkList);
178
- $(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
+ })();
data/doc/method_list.html CHANGED
@@ -1,8 +1,8 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1
+ <!DOCTYPE html>
3
2
  <html>
4
3
  <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
5
+ <meta charset="utf-8" />
6
6
 
7
7
  <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
8
8
 
@@ -19,136 +19,168 @@
19
19
  <base id="base_target" target="_parent" />
20
20
  </head>
21
21
  <body>
22
- <script type="text/javascript" charset="utf-8">
23
- if (window.top.frames.main) {
24
- document.getElementById('base_target').target = 'main';
25
- document.body.className = 'frames';
26
- }
27
- </script>
28
22
  <div id="content">
29
- <h1 id="full_list_header">Method List</h1>
30
- <div id="nav">
31
-
32
- <span><a target="_self" href="class_list.html">
33
- Classes
34
- </a></span>
35
-
36
- <span><a target="_self" href="method_list.html">
37
- Methods
38
- </a></span>
39
-
40
- <span><a target="_self" href="file_list.html">
41
- Files
42
- </a></span>
43
-
23
+ <div class="fixed_header">
24
+ <h1 id="full_list_header">Method List</h1>
25
+ <div id="full_list_nav">
26
+
27
+ <span><a target="_self" href="class_list.html">
28
+ Classes
29
+ </a></span>
30
+
31
+ <span><a target="_self" href="method_list.html">
32
+ Methods
33
+ </a></span>
34
+
35
+ <span><a target="_self" href="file_list.html">
36
+ Files
37
+ </a></span>
38
+
39
+ </div>
40
+
41
+ <div id="search">Search: <input type="text" /></div>
44
42
  </div>
45
- <div id="search">Search: <input type="text" /></div>
46
43
 
47
44
  <ul id="full_list" class="method">
48
45
 
49
46
 
50
- <li class="r1 ">
51
- <span class='object_link'><a href="Array.html#%5E-instance_method" title="Array#^ (method)">#^</a></span>
52
- <small>Array</small>
47
+ <li class="odd ">
48
+ <div class="item">
49
+ <span class='object_link'><a href="Array.html#%5E-instance_method" title="Array#^ (method)">#^</a></span>
50
+ <small>Array</small>
51
+ </div>
53
52
  </li>
54
53
 
55
54
 
56
- <li class="r2 ">
57
- <span class='object_link'><a href="String.html#cmpi-instance_method" title="String#cmpi (method)">#cmpi</a></span>
58
- <small>String</small>
55
+ <li class="even ">
56
+ <div class="item">
57
+ <span class='object_link'><a href="String.html#cmpi-instance_method" title="String#cmpi (method)">#cmpi</a></span>
58
+ <small>String</small>
59
+ </div>
59
60
  </li>
60
61
 
61
62
 
62
- <li class="r1 ">
63
- <span class='object_link'><a href="Object.html#display-instance_method" title="Object#display (method)">#display</a></span>
64
- <small>Object</small>
63
+ <li class="odd ">
64
+ <div class="item">
65
+ <span class='object_link'><a href="Object.html#display-instance_method" title="Object#display (method)">#display</a></span>
66
+ <small>Object</small>
67
+ </div>
65
68
  </li>
66
69
 
67
70
 
68
- <li class="r2 ">
69
- <span class='object_link'><a href="Hash.html#extract-instance_method" title="Hash#extract (method)">#extract</a></span>
70
- <small>Hash</small>
71
+ <li class="even ">
72
+ <div class="item">
73
+ <span class='object_link'><a href="Hash.html#extract-instance_method" title="Hash#extract (method)">#extract</a></span>
74
+ <small>Hash</small>
75
+ </div>
71
76
  </li>
72
77
 
73
78
 
74
- <li class="r1 ">
75
- <span class='object_link'><a href="Kernel.html#fn-instance_method" title="Kernel#fn (method)">#fn</a></span>
76
- <small>Kernel</small>
79
+ <li class="odd ">
80
+ <div class="item">
81
+ <span class='object_link'><a href="Kernel.html#fn-instance_method" title="Kernel#fn (method)">#fn</a></span>
82
+ <small>Kernel</small>
83
+ </div>
77
84
  </li>
78
85
 
79
86
 
80
- <li class="r2 ">
81
- <span class='object_link'><a href="Hash.html#has_shape%3F-instance_method" title="Hash#has_shape? (method)">#has_shape?</a></span>
82
- <small>Hash</small>
87
+ <li class="even ">
88
+ <div class="item">
89
+ <span class='object_link'><a href="Hash.html#has_shape%3F-instance_method" title="Hash#has_shape? (method)">#has_shape?</a></span>
90
+ <small>Hash</small>
91
+ </div>
83
92
  </li>
84
93
 
85
94
 
86
- <li class="r1 ">
87
- <span class='object_link'><a href="String.html#in_groups_of-instance_method" title="String#in_groups_of (method)">#in_groups_of</a></span>
88
- <small>String</small>
95
+ <li class="odd ">
96
+ <div class="item">
97
+ <span class='object_link'><a href="String.html#in_groups_of-instance_method" title="String#in_groups_of (method)">#in_groups_of</a></span>
98
+ <small>String</small>
99
+ </div>
89
100
  </li>
90
101
 
91
102
 
92
- <li class="r2 ">
93
- <span class='object_link'><a href="Object.html#it-instance_method" title="Object#it (method)">#it</a></span>
94
- <small>Object</small>
103
+ <li class="even ">
104
+ <div class="item">
105
+ <span class='object_link'><a href="Object.html#it-instance_method" title="Object#it (method)">#it</a></span>
106
+ <small>Object</small>
107
+ </div>
95
108
  </li>
96
109
 
97
110
 
98
- <li class="r1 ">
99
- <span class='object_link'><a href="Module.html#private_accessor-instance_method" title="Module#private_accessor (method)">#private_accessor</a></span>
100
- <small>Module</small>
111
+ <li class="odd ">
112
+ <div class="item">
113
+ <span class='object_link'><a href="Module.html#private_accessor-instance_method" title="Module#private_accessor (method)">#private_accessor</a></span>
114
+ <small>Module</small>
115
+ </div>
101
116
  </li>
102
117
 
103
118
 
104
- <li class="r2 ">
105
- <span class='object_link'><a href="Kernel.html#prompt-instance_method" title="Kernel#prompt (method)">#prompt</a></span>
106
- <small>Kernel</small>
119
+ <li class="even ">
120
+ <div class="item">
121
+ <span class='object_link'><a href="Kernel.html#prompt-instance_method" title="Kernel#prompt (method)">#prompt</a></span>
122
+ <small>Kernel</small>
123
+ </div>
107
124
  </li>
108
125
 
109
126
 
110
- <li class="r1 ">
111
- <span class='object_link'><a href="Array.html#random_subarray-instance_method" title="Array#random_subarray (method)">#random_subarray</a></span>
112
- <small>Array</small>
127
+ <li class="odd ">
128
+ <div class="item">
129
+ <span class='object_link'><a href="Array.html#random_subarray-instance_method" title="Array#random_subarray (method)">#random_subarray</a></span>
130
+ <small>Array</small>
131
+ </div>
113
132
  </li>
114
133
 
115
134
 
116
- <li class="r2 ">
117
- <span class='object_link'><a href="Array.html#reductions-instance_method" title="Array#reductions (method)">#reductions</a></span>
118
- <small>Array</small>
135
+ <li class="even ">
136
+ <div class="item">
137
+ <span class='object_link'><a href="Array.html#reductions-instance_method" title="Array#reductions (method)">#reductions</a></span>
138
+ <small>Array</small>
139
+ </div>
119
140
  </li>
120
141
 
121
142
 
122
- <li class="r1 ">
123
- <span class='object_link'><a href="Kernel.html#require_optional-instance_method" title="Kernel#require_optional (method)">#require_optional</a></span>
124
- <small>Kernel</small>
143
+ <li class="odd ">
144
+ <div class="item">
145
+ <span class='object_link'><a href="Kernel.html#require_optional-instance_method" title="Kernel#require_optional (method)">#require_optional</a></span>
146
+ <small>Kernel</small>
147
+ </div>
125
148
  </li>
126
149
 
127
150
 
128
- <li class="r2 ">
129
- <span class='object_link'><a href="Fixnum.html#string_length-instance_method" title="Fixnum#string_length (method)">#string_length</a></span>
130
- <small>Fixnum</small>
151
+ <li class="even ">
152
+ <div class="item">
153
+ <span class='object_link'><a href="Fixnum.html#string_length-instance_method" title="Fixnum#string_length (method)">#string_length</a></span>
154
+ <small>Fixnum</small>
155
+ </div>
131
156
  </li>
132
157
 
133
158
 
134
- <li class="r1 ">
135
- <span class='object_link'><a href="Hash.html#to_ostruct-instance_method" title="Hash#to_ostruct (method)">#to_ostruct</a></span>
136
- <small>Hash</small>
159
+ <li class="odd ">
160
+ <div class="item">
161
+ <span class='object_link'><a href="Hash.html#to_ostruct-instance_method" title="Hash#to_ostruct (method)">#to_ostruct</a></span>
162
+ <small>Hash</small>
163
+ </div>
137
164
  </li>
138
165
 
139
166
 
140
- <li class="r2 ">
141
- <span class='object_link'><a href="Kernel.html#with-instance_method" title="Kernel#with (method)">#with</a></span>
142
- <small>Kernel</small>
167
+ <li class="even ">
168
+ <div class="item">
169
+ <span class='object_link'><a href="Kernel.html#with-instance_method" title="Kernel#with (method)">#with</a></span>
170
+ <small>Kernel</small>
171
+ </div>
143
172
  </li>
144
173
 
145
174
 
146
- <li class="r1 ">
147
- <span class='object_link'><a href="Array.html#zip_with-instance_method" title="Array#zip_with (method)">#zip_with</a></span>
148
- <small>Array</small>
175
+ <li class="odd ">
176
+ <div class="item">
177
+ <span class='object_link'><a href="Array.html#zip_with-instance_method" title="Array#zip_with (method)">#zip_with</a></span>
178
+ <small>Array</small>
179
+ </div>
149
180
  </li>
150
181
 
151
182
 
183
+
152
184
  </ul>
153
185
  </div>
154
186
  </body>