strongdm 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/doc/LICENSE.html +3 -6
  3. data/doc/Object.html +16 -16
  4. data/doc/README_md.html +3 -6
  5. data/doc/SDM.html +3 -6
  6. data/doc/SDM/AKS.html +5 -8
  7. data/doc/SDM/AKSBasicAuth.html +5 -8
  8. data/doc/SDM/AKSServiceAccount.html +5 -8
  9. data/doc/SDM/AccountAttachment.html +3 -6
  10. data/doc/SDM/AccountAttachmentCreateOptions.html +3 -6
  11. data/doc/SDM/AccountAttachmentCreateResponse.html +3 -6
  12. data/doc/SDM/AccountAttachmentDeleteResponse.html +3 -6
  13. data/doc/SDM/AccountAttachmentGetResponse.html +3 -6
  14. data/doc/SDM/AccountAttachments.html +3 -6
  15. data/doc/SDM/AccountCreateResponse.html +3 -6
  16. data/doc/SDM/AccountDeleteResponse.html +3 -6
  17. data/doc/SDM/AccountGetResponse.html +3 -6
  18. data/doc/SDM/AccountGrant.html +3 -6
  19. data/doc/SDM/AccountGrantCreateResponse.html +3 -6
  20. data/doc/SDM/AccountGrantDeleteResponse.html +3 -6
  21. data/doc/SDM/AccountGrantGetResponse.html +3 -6
  22. data/doc/SDM/AccountGrants.html +3 -6
  23. data/doc/SDM/AccountUpdateResponse.html +3 -6
  24. data/doc/SDM/Accounts.html +3 -6
  25. data/doc/SDM/AlreadyExistsError.html +3 -6
  26. data/doc/SDM/AmazonEKS.html +24 -9
  27. data/doc/SDM/AmazonES.html +3 -6
  28. data/doc/SDM/Athena.html +3 -6
  29. data/doc/SDM/AuroraMysql.html +5 -8
  30. data/doc/SDM/AuroraPostgres.html +5 -8
  31. data/doc/SDM/AuthenticationError.html +3 -6
  32. data/doc/SDM/BadRequestError.html +3 -6
  33. data/doc/SDM/BigQuery.html +3 -6
  34. data/doc/SDM/Cassandra.html +3 -6
  35. data/doc/SDM/Client.html +3 -6
  36. data/doc/SDM/Clustrix.html +5 -8
  37. data/doc/SDM/Cockroach.html +5 -8
  38. data/doc/SDM/CreateResponseMetadata.html +3 -6
  39. data/doc/SDM/DeadlineExceededError.html +3 -6
  40. data/doc/SDM/DeleteResponseMetadata.html +3 -6
  41. data/doc/SDM/Druid.html +3 -6
  42. data/doc/SDM/DynamoDB.html +3 -6
  43. data/doc/SDM/Elastic.html +3 -6
  44. data/doc/SDM/ElasticacheRedis.html +5 -8
  45. data/doc/SDM/Gateway.html +5 -8
  46. data/doc/SDM/GetResponseMetadata.html +3 -6
  47. data/doc/SDM/GoogleGKE.html +5 -8
  48. data/doc/SDM/Greenplum.html +5 -8
  49. data/doc/SDM/HTTPAuth.html +3 -6
  50. data/doc/SDM/HTTPBasicAuth.html +3 -6
  51. data/doc/SDM/HTTPNoAuth.html +3 -6
  52. data/doc/SDM/InternalError.html +3 -6
  53. data/doc/SDM/Kubernetes.html +3 -6
  54. data/doc/SDM/KubernetesBasicAuth.html +3 -6
  55. data/doc/SDM/KubernetesServiceAccount.html +3 -6
  56. data/doc/SDM/Maria.html +5 -8
  57. data/doc/SDM/Memcached.html +5 -8
  58. data/doc/SDM/Memsql.html +5 -8
  59. data/doc/SDM/MongoHost.html +5 -8
  60. data/doc/SDM/MongoLegacyHost.html +5 -8
  61. data/doc/SDM/MongoLegacyReplicaset.html +5 -8
  62. data/doc/SDM/MongoReplicaSet.html +5 -8
  63. data/doc/SDM/Mysql.html +5 -8
  64. data/doc/SDM/NodeCreateResponse.html +5 -8
  65. data/doc/SDM/NodeDeleteResponse.html +5 -8
  66. data/doc/SDM/NodeGetResponse.html +5 -8
  67. data/doc/SDM/NodeUpdateResponse.html +5 -8
  68. data/doc/SDM/Nodes.html +3 -6
  69. data/doc/SDM/NotFoundError.html +3 -6
  70. data/doc/SDM/Oracle.html +5 -8
  71. data/doc/SDM/PermissionError.html +3 -6
  72. data/doc/SDM/Plumbing.html +225 -226
  73. data/doc/SDM/Postgres.html +5 -8
  74. data/doc/SDM/Presto.html +5 -8
  75. data/doc/SDM/RDP.html +5 -8
  76. data/doc/SDM/RPCError.html +3 -6
  77. data/doc/SDM/RateLimitError.html +3 -6
  78. data/doc/SDM/RateLimitMetadata.html +3 -6
  79. data/doc/SDM/Redis.html +5 -8
  80. data/doc/SDM/Redshift.html +5 -8
  81. data/doc/SDM/Relay.html +5 -8
  82. data/doc/SDM/ResourceCreateResponse.html +5 -8
  83. data/doc/SDM/ResourceDeleteResponse.html +5 -8
  84. data/doc/SDM/ResourceGetResponse.html +5 -8
  85. data/doc/SDM/ResourceUpdateResponse.html +5 -8
  86. data/doc/SDM/Resources.html +3 -6
  87. data/doc/SDM/Role.html +5 -8
  88. data/doc/SDM/RoleAttachment.html +5 -8
  89. data/doc/SDM/RoleAttachmentCreateResponse.html +5 -8
  90. data/doc/SDM/RoleAttachmentDeleteResponse.html +5 -8
  91. data/doc/SDM/RoleAttachmentGetResponse.html +5 -8
  92. data/doc/SDM/RoleAttachments.html +3 -6
  93. data/doc/SDM/RoleCreateResponse.html +5 -8
  94. data/doc/SDM/RoleDeleteResponse.html +5 -8
  95. data/doc/SDM/RoleGetResponse.html +5 -8
  96. data/doc/SDM/RoleGrant.html +5 -8
  97. data/doc/SDM/RoleGrantCreateResponse.html +5 -8
  98. data/doc/SDM/RoleGrantDeleteResponse.html +5 -8
  99. data/doc/SDM/RoleGrantGetResponse.html +5 -8
  100. data/doc/SDM/RoleGrants.html +3 -6
  101. data/doc/SDM/RoleUpdateResponse.html +5 -8
  102. data/doc/SDM/Roles.html +3 -6
  103. data/doc/SDM/SQLServer.html +5 -8
  104. data/doc/SDM/SSH.html +5 -8
  105. data/doc/SDM/Service.html +3 -6
  106. data/doc/SDM/Snowflake.html +5 -8
  107. data/doc/SDM/Sybase.html +5 -8
  108. data/doc/SDM/SybaseIQ.html +5 -8
  109. data/doc/SDM/Teradata.html +5 -8
  110. data/doc/SDM/UpdateResponseMetadata.html +3 -6
  111. data/doc/SDM/User.html +3 -6
  112. data/doc/V1.html +3 -6
  113. data/doc/V1/AccountAttachments.html +3 -6
  114. data/doc/V1/AccountAttachments/Service.html +3 -6
  115. data/doc/V1/AccountGrants.html +3 -6
  116. data/doc/V1/AccountGrants/Service.html +3 -6
  117. data/doc/V1/Accounts.html +3 -6
  118. data/doc/V1/Accounts/Service.html +3 -6
  119. data/doc/V1/Nodes.html +3 -6
  120. data/doc/V1/Nodes/Service.html +3 -6
  121. data/doc/V1/Resources.html +3 -6
  122. data/doc/V1/Resources/Service.html +3 -6
  123. data/doc/V1/RoleAttachments.html +3 -6
  124. data/doc/V1/RoleAttachments/Service.html +3 -6
  125. data/doc/V1/RoleGrants.html +3 -6
  126. data/doc/V1/RoleGrants/Service.html +3 -6
  127. data/doc/V1/Roles.html +3 -6
  128. data/doc/V1/Roles/Service.html +3 -6
  129. data/doc/created.rid +41 -41
  130. data/doc/css/rdoc.css +1 -22
  131. data/doc/examples/Gemfile.html +3 -6
  132. data/doc/examples/Gemfile_lock.html +3 -6
  133. data/doc/examples/README_md.html +3 -6
  134. data/doc/examples/okta-sync/Gemfile.html +3 -6
  135. data/doc/examples/okta-sync/Gemfile_lock.html +3 -6
  136. data/doc/index.html +3 -6
  137. data/doc/js/darkfish.js +99 -22
  138. data/doc/js/navigation.js +40 -4
  139. data/doc/js/navigation.js.gz +0 -0
  140. data/doc/js/search.js +31 -32
  141. data/doc/js/search_index.js +1 -1
  142. data/doc/js/search_index.js.gz +0 -0
  143. data/doc/js/searcher.js +6 -6
  144. data/doc/js/searcher.js.gz +0 -0
  145. data/doc/lib/version.html +3 -6
  146. data/doc/strongdm_gemspec.html +3 -6
  147. data/doc/table_of_contents.html +3 -6
  148. data/examples/okta-sync/oktaSync.rb +55 -13
  149. data/examples/panicButton.rb +42 -0
  150. data/lib/grpc/drivers_pb.rb +1 -0
  151. data/lib/grpc/plumbing.rb +2 -0
  152. data/lib/models/porcelain.rb +7 -1
  153. data/lib/version.rb +1 -1
  154. metadata +2 -2
@@ -9,8 +9,6 @@
9
9
  /* vim: ft=css et sw=2 ts=2 sts=2 */
10
10
  /* Base Green is: #6C8C22 */
11
11
 
12
- .hide { display: none !important; }
13
-
14
12
  * { padding: 0; margin: 0; }
15
13
 
16
14
  body {
@@ -50,16 +48,6 @@ h6:hover span {
50
48
  display: inline;
51
49
  }
52
50
 
53
- h1:target,
54
- h2:target,
55
- h3:target,
56
- h4:target,
57
- h5:target,
58
- h6:target {
59
- margin-left: -10px;
60
- border-left: 10px solid #f1edba;
61
- }
62
-
63
51
  :link,
64
52
  :visited {
65
53
  color: #6C8C22;
@@ -453,16 +441,7 @@ main header h3 {
453
441
  /* @group Method Details */
454
442
 
455
443
  main .method-source-code {
456
- max-height: 0;
457
- overflow: hidden;
458
- transition-duration: 200ms;
459
- transition-delay: 0ms;
460
- transition-property: all;
461
- transition-timing-function: ease-in-out;
462
- }
463
-
464
- main .method-source-code.active-menu {
465
- max-height: 100vh;
444
+ display: none;
466
445
  }
467
446
 
468
447
  main .method-description .method-calls-super {
@@ -11,11 +11,8 @@
11
11
  var index_rel_prefix = "../";
12
12
  </script>
13
13
 
14
- <script src="../js/navigation.js" defer></script>
15
- <script src="../js/search.js" defer></script>
16
- <script src="../js/search_index.js" defer></script>
17
- <script src="../js/searcher.js" defer></script>
18
- <script src="../js/darkfish.js" defer></script>
14
+ <script src="../js/jquery.js"></script>
15
+ <script src="../js/darkfish.js"></script>
19
16
 
20
17
  <link href="../css/fonts.css" rel="stylesheet">
21
18
  <link href="../css/rdoc.css" rel="stylesheet">
@@ -99,7 +96,7 @@
99
96
 
100
97
  <footer id="validator-badges" role="contentinfo">
101
98
  <p><a href="https://validator.w3.org/check/referer">Validate</a>
102
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.2.
99
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.0.
103
100
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
104
101
  </footer>
105
102
 
@@ -11,11 +11,8 @@
11
11
  var index_rel_prefix = "../";
12
12
  </script>
13
13
 
14
- <script src="../js/navigation.js" defer></script>
15
- <script src="../js/search.js" defer></script>
16
- <script src="../js/search_index.js" defer></script>
17
- <script src="../js/searcher.js" defer></script>
18
- <script src="../js/darkfish.js" defer></script>
14
+ <script src="../js/jquery.js"></script>
15
+ <script src="../js/darkfish.js"></script>
19
16
 
20
17
  <link href="../css/fonts.css" rel="stylesheet">
21
18
  <link href="../css/rdoc.css" rel="stylesheet">
@@ -116,7 +113,7 @@
116
113
 
117
114
  <footer id="validator-badges" role="contentinfo">
118
115
  <p><a href="https://validator.w3.org/check/referer">Validate</a>
119
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.2.
116
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.0.
120
117
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
121
118
  </footer>
122
119
 
@@ -11,11 +11,8 @@
11
11
  var index_rel_prefix = "../";
12
12
  </script>
13
13
 
14
- <script src="../js/navigation.js" defer></script>
15
- <script src="../js/search.js" defer></script>
16
- <script src="../js/search_index.js" defer></script>
17
- <script src="../js/searcher.js" defer></script>
18
- <script src="../js/darkfish.js" defer></script>
14
+ <script src="../js/jquery.js"></script>
15
+ <script src="../js/darkfish.js"></script>
19
16
 
20
17
  <link href="../css/fonts.css" rel="stylesheet">
21
18
  <link href="../css/rdoc.css" rel="stylesheet">
@@ -99,7 +96,7 @@
99
96
 
100
97
  <footer id="validator-badges" role="contentinfo">
101
98
  <p><a href="https://validator.w3.org/check/referer">Validate</a>
102
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.2.
99
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.0.
103
100
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
104
101
  </footer>
105
102
 
@@ -11,11 +11,8 @@
11
11
  var index_rel_prefix = "../../";
12
12
  </script>
13
13
 
14
- <script src="../../js/navigation.js" defer></script>
15
- <script src="../../js/search.js" defer></script>
16
- <script src="../../js/search_index.js" defer></script>
17
- <script src="../../js/searcher.js" defer></script>
18
- <script src="../../js/darkfish.js" defer></script>
14
+ <script src="../../js/jquery.js"></script>
15
+ <script src="../../js/darkfish.js"></script>
19
16
 
20
17
  <link href="../../css/fonts.css" rel="stylesheet">
21
18
  <link href="../../css/rdoc.css" rel="stylesheet">
@@ -99,7 +96,7 @@
99
96
 
100
97
  <footer id="validator-badges" role="contentinfo">
101
98
  <p><a href="https://validator.w3.org/check/referer">Validate</a>
102
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.2.
99
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.0.
103
100
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
104
101
  </footer>
105
102
 
@@ -11,11 +11,8 @@
11
11
  var index_rel_prefix = "../../";
12
12
  </script>
13
13
 
14
- <script src="../../js/navigation.js" defer></script>
15
- <script src="../../js/search.js" defer></script>
16
- <script src="../../js/search_index.js" defer></script>
17
- <script src="../../js/searcher.js" defer></script>
18
- <script src="../../js/darkfish.js" defer></script>
14
+ <script src="../../js/jquery.js"></script>
15
+ <script src="../../js/darkfish.js"></script>
19
16
 
20
17
  <link href="../../css/fonts.css" rel="stylesheet">
21
18
  <link href="../../css/rdoc.css" rel="stylesheet">
@@ -140,7 +137,7 @@ specs:
140
137
 
141
138
  <footer id="validator-badges" role="contentinfo">
142
139
  <p><a href="https://validator.w3.org/check/referer">Validate</a>
143
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.2.
140
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.0.
144
141
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
145
142
  </footer>
146
143
 
@@ -11,11 +11,8 @@
11
11
  var index_rel_prefix = "./";
12
12
  </script>
13
13
 
14
- <script src="./js/navigation.js" defer></script>
15
- <script src="./js/search.js" defer></script>
16
- <script src="./js/search_index.js" defer></script>
17
- <script src="./js/searcher.js" defer></script>
18
- <script src="./js/darkfish.js" defer></script>
14
+ <script src="./js/jquery.js"></script>
15
+ <script src="./js/darkfish.js"></script>
19
16
 
20
17
  <link href="./css/fonts.css" rel="stylesheet">
21
18
  <link href="./css/rdoc.css" rel="stylesheet">
@@ -354,7 +351,7 @@
354
351
 
355
352
  <footer id="validator-badges" role="contentinfo">
356
353
  <p><a href="https://validator.w3.org/check/referer">Validate</a>
357
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.2.
354
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.0.
358
355
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
359
356
  </footer>
360
357
 
@@ -8,7 +8,6 @@
8
8
  */
9
9
 
10
10
  /* Provide console simulation for firebug-less environments */
11
- /*
12
11
  if (!("console" in window) || !("firebug" in console)) {
13
12
  var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
14
13
  "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
@@ -17,35 +16,41 @@ if (!("console" in window) || !("firebug" in console)) {
17
16
  for (var i = 0; i < names.length; ++i)
18
17
  window.console[names[i]] = function() {};
19
18
  };
20
- */
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
+ };
21
29
 
22
30
 
23
31
  function showSource( e ) {
24
32
  var target = e.target;
25
- while (!target.classList.contains('method-detail')) {
26
- target = target.parentNode;
27
- }
28
- if (typeof target !== "undefined" && target !== null) {
29
- target = target.querySelector('.method-source-code');
30
- }
31
- if (typeof target !== "undefined" && target !== null) {
32
- target.classList.toggle('active-menu')
33
- }
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();
34
41
  };
35
42
 
36
43
  function hookSourceViews() {
37
- document.querySelectorAll('.method-heading').forEach(function (codeObject) {
38
- codeObject.addEventListener('click', showSource);
39
- });
44
+ $('.method-heading').click( showSource );
40
45
  };
41
46
 
42
47
  function hookSearch() {
43
- var input = document.querySelector('#search-field');
44
- var result = document.querySelector('#search-results');
45
- result.classList.remove("initially-hidden");
48
+ var input = $('#search-field').eq(0);
49
+ var result = $('#search-results').eq(0);
50
+ $(result).show();
46
51
 
47
- var search_section = document.querySelector('#search-section');
48
- search_section.classList.remove("initially-hidden");
52
+ var search_section = $('#search-section').get(0);
53
+ $(search_section).show();
49
54
 
50
55
  var search = new Search(search_data, input, result);
51
56
 
@@ -72,13 +77,85 @@ function hookSearch() {
72
77
  }
73
78
 
74
79
  search.select = function(result) {
75
- window.location.href = result.firstChild.firstChild.href;
80
+ var result_element = result.get(0);
81
+ window.location.href = result_element.firstChild.firstChild.href;
76
82
  }
77
83
 
78
84
  search.scrollIntoView = search.scrollInWindow;
79
85
  };
80
86
 
81
- document.addEventListener('DOMContentLoaded', function() {
87
+ function highlightTarget( anchor ) {
88
+ console.debug( "Highlighting target '%s'.", anchor );
89
+
90
+ $("a[name]").each( function() {
91
+ if ( $(this).attr("name") == anchor ) {
92
+ if ( !$(this).parent().parent().hasClass('target-section') ) {
93
+ console.debug( "Wrapping the target-section" );
94
+ $('div.method-detail').unwrap( 'div.target-section' );
95
+ $(this).parent().wrap( '<div class="target-section"></div>' );
96
+ } else {
97
+ console.debug( "Already wrapped." );
98
+ }
99
+ }
100
+ });
101
+ };
102
+
103
+ function highlightLocationTarget() {
104
+ console.debug( "Location hash: %s", window.location.hash );
105
+ if ( ! window.location.hash || window.location.hash.length == 0 ) return;
106
+
107
+ var anchor = window.location.hash.substring(1);
108
+ console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
109
+
110
+ highlightTarget( anchor );
111
+ };
112
+
113
+ function highlightClickTarget( event ) {
114
+ console.debug( "Highlighting click target for event %o", event.target );
115
+ try {
116
+ var anchor = $(event.target).attr( 'href' ).substring(1);
117
+ console.debug( "Found target anchor: %s", anchor );
118
+ highlightTarget( anchor );
119
+ } catch ( err ) {
120
+ console.error( "Exception while highlighting: %o", err );
121
+ };
122
+ };
123
+
124
+ function loadAsync(path, success, prefix) {
125
+ $.ajax({
126
+ url: prefix + path,
127
+ dataType: 'script',
128
+ success: success,
129
+ cache: true
130
+ });
131
+ };
132
+
133
+ $(document).ready( function() {
82
134
  hookSourceViews();
83
- hookSearch();
135
+ highlightLocationTarget();
136
+ $('ul.link-list a').bind( "click", highlightClickTarget );
137
+
138
+ var search_scripts_loaded = {
139
+ navigation_loaded: false,
140
+ search_loaded: false,
141
+ search_index_loaded: false,
142
+ searcher_loaded: false,
143
+ }
144
+
145
+ var search_success_function = function(variable) {
146
+ return (function (data, status, xhr) {
147
+ search_scripts_loaded[variable] = true;
148
+
149
+ if (search_scripts_loaded['navigation_loaded'] == true &&
150
+ search_scripts_loaded['search_loaded'] == true &&
151
+ search_scripts_loaded['search_index_loaded'] == true &&
152
+ search_scripts_loaded['searcher_loaded'] == true)
153
+ hookSearch();
154
+ });
155
+ }
156
+
157
+ loadAsync('js/navigation.js', search_success_function('navigation_loaded'), rdoc_rel_prefix);
158
+ loadAsync('js/search.js', search_success_function('search_loaded'), rdoc_rel_prefix);
159
+ loadAsync('js/search_index.js', search_success_function('search_index_loaded'), index_rel_prefix);
160
+ loadAsync('js/searcher.js', search_success_function('searcher_loaded'), rdoc_rel_prefix);
84
161
  });
@@ -10,8 +10,10 @@ Navigation = new function() {
10
10
  this.initNavigation = function() {
11
11
  var _this = this;
12
12
 
13
- document.addEventListener('keydown', function(e) {
13
+ $(document).keydown(function(e) {
14
14
  _this.onkeydown(e);
15
+ }).keyup(function(e) {
16
+ _this.onkeyup(e);
15
17
  });
16
18
 
17
19
  this.navigationActive = true;
@@ -19,6 +21,20 @@ Navigation = new function() {
19
21
 
20
22
  this.setNavigationActive = function(state) {
21
23
  this.navigationActive = state;
24
+ this.clearMoveTimeout();
25
+ }
26
+
27
+ this.onkeyup = function(e) {
28
+ if (!this.navigationActive) return;
29
+
30
+ switch(e.keyCode) {
31
+ case 37: //Event.KEY_LEFT:
32
+ case 38: //Event.KEY_UP:
33
+ case 39: //Event.KEY_RIGHT:
34
+ case 40: //Event.KEY_DOWN:
35
+ this.clearMoveTimeout();
36
+ break;
37
+ }
22
38
  }
23
39
 
24
40
  this.onkeydown = function(e) {
@@ -30,6 +46,7 @@ Navigation = new function() {
30
46
  case 38: //Event.KEY_UP:
31
47
  if (e.keyCode == 38 || e.ctrlKey) {
32
48
  if (this.moveUp()) e.preventDefault();
49
+ this.startMoveTimeout(false);
33
50
  }
34
51
  break;
35
52
  case 39: //Event.KEY_RIGHT:
@@ -38,14 +55,33 @@ Navigation = new function() {
38
55
  case 40: //Event.KEY_DOWN:
39
56
  if (e.keyCode == 40 || e.ctrlKey) {
40
57
  if (this.moveDown()) e.preventDefault();
58
+ this.startMoveTimeout(true);
41
59
  }
42
60
  break;
43
61
  case 13: //Event.KEY_RETURN:
44
- if (this.current) e.preventDefault();
45
- this.select(this.current);
62
+ if (this.$current) e.preventDefault();
63
+ this.select(this.$current);
46
64
  break;
47
65
  }
48
- if (e.ctrlKey && e.shiftKey) this.select(this.current);
66
+ if (e.ctrlKey && e.shiftKey) this.select(this.$current);
67
+ }
68
+
69
+ this.clearMoveTimeout = function() {
70
+ clearTimeout(this.moveTimeout);
71
+ this.moveTimeout = null;
72
+ }
73
+
74
+ this.startMoveTimeout = function(isDown) {
75
+ if (!$.browser.mozilla && !$.browser.opera) return;
76
+ if (this.moveTimeout) this.clearMoveTimeout();
77
+ var _this = this;
78
+
79
+ var go = function() {
80
+ if (!_this.moveTimeout) return;
81
+ _this[isDown ? 'moveDown' : 'moveUp']();
82
+ _this.moveTimeout = setTimeout(go, 100);
83
+ }
84
+ this.moveTimeout = setTimeout(go, 200);
49
85
  }
50
86
 
51
87
  this.moveRight = function() {
Binary file
@@ -1,29 +1,29 @@
1
1
  Search = function(data, input, result) {
2
2
  this.data = data;
3
- this.input = input;
4
- this.result = result;
3
+ this.$input = $(input);
4
+ this.$result = $(result);
5
5
 
6
- this.current = null;
7
- this.view = this.result.parentNode;
6
+ this.$current = null;
7
+ this.$view = this.$result.parent();
8
8
  this.searcher = new Searcher(data.index);
9
9
  this.init();
10
10
  }
11
11
 
12
- Search.prototype = Object.assign({}, Navigation, new function() {
12
+ Search.prototype = $.extend({}, Navigation, new function() {
13
13
  var suid = 1;
14
14
 
15
15
  this.init = function() {
16
16
  var _this = this;
17
17
  var observer = function(e) {
18
- switch(e.keyCode) {
18
+ switch(e.originalEvent.keyCode) {
19
19
  case 38: // Event.KEY_UP
20
20
  case 40: // Event.KEY_DOWN
21
21
  return;
22
22
  }
23
- _this.search(_this.input.value);
23
+ _this.search(_this.$input[0].value);
24
24
  };
25
- this.input.addEventListener('keyup', observer);
26
- this.input.addEventListener('click', observer); // mac's clear field
25
+ this.$input.keyup(observer);
26
+ this.$input.click(observer); // mac's clear field
27
27
 
28
28
  this.searcher.ready(function(results, isLast) {
29
29
  _this.addResults(results, isLast);
@@ -34,7 +34,7 @@ Search.prototype = Object.assign({}, Navigation, new function() {
34
34
  }
35
35
 
36
36
  this.search = function(value, selectFirstMatch) {
37
- value = value.trim().toLowerCase();
37
+ value = jQuery.trim(value).toLowerCase();
38
38
  if (value) {
39
39
  this.setNavigationActive(true);
40
40
  } else {
@@ -43,23 +43,23 @@ Search.prototype = Object.assign({}, Navigation, new function() {
43
43
 
44
44
  if (value == '') {
45
45
  this.lastQuery = value;
46
- this.result.innerHTML = '';
47
- this.result.setAttribute('aria-expanded', 'false');
46
+ this.$result.empty();
47
+ this.$result.attr('aria-expanded', 'false');
48
48
  this.setNavigationActive(false);
49
49
  } else if (value != this.lastQuery) {
50
50
  this.lastQuery = value;
51
- this.result.setAttribute('aria-busy', 'true');
52
- this.result.setAttribute('aria-expanded', 'true');
51
+ this.$result.attr('aria-busy', 'true');
52
+ this.$result.attr('aria-expanded', 'true');
53
53
  this.firstRun = true;
54
54
  this.searcher.find(value);
55
55
  }
56
56
  }
57
57
 
58
58
  this.addResults = function(results, isLast) {
59
- var target = this.result;
59
+ var target = this.$result.get(0);
60
60
  if (this.firstRun && (results.length > 0 || isLast)) {
61
- this.current = null;
62
- this.result.innerHTML = '';
61
+ this.$current = null;
62
+ this.$result.empty();
63
63
  }
64
64
 
65
65
  for (var i=0, l = results.length; i < l; i++) {
@@ -70,26 +70,25 @@ Search.prototype = Object.assign({}, Navigation, new function() {
70
70
 
71
71
  if (this.firstRun && results.length > 0) {
72
72
  this.firstRun = false;
73
- this.current = target.firstChild;
74
- this.current.classList.add('search-selected');
73
+ this.$current = $(target.firstChild);
74
+ this.$current.addClass('search-selected');
75
75
  }
76
- //TODO: ECMAScript
77
- //if (jQuery.browser.msie) this.$element[0].className += '';
76
+ if (jQuery.browser.msie) this.$element[0].className += '';
78
77
 
79
- if (isLast) this.result.setAttribute('aria-busy', 'false');
78
+ if (isLast) this.$result.attr('aria-busy', 'false');
80
79
  }
81
80
 
82
81
  this.move = function(isDown) {
83
- if (!this.current) return;
84
- var next = isDown ? this.current.nextElementSibling : this.current.previousElementSibling;
85
- if (next) {
86
- this.current.classList.remove('search-selected');
87
- next.classList.add('search-selected');
88
- this.input.setAttribute('aria-activedescendant', next.getAttribute('id'));
89
- this.scrollIntoView(next, this.view);
90
- this.current = next;
91
- this.input.value = next.firstChild.firstChild.text;
92
- this.input.select();
82
+ if (!this.$current) return;
83
+ var $next = this.$current[isDown ? 'next' : 'prev']();
84
+ if ($next.length) {
85
+ this.$current.removeClass('search-selected');
86
+ $next.addClass('search-selected');
87
+ this.$input.attr('aria-activedescendant', $next.attr('id'));
88
+ this.scrollIntoView($next[0], this.$view[0]);
89
+ this.$current = $next;
90
+ this.$input.val($next[0].firstChild.firstChild.text);
91
+ this.$input.select();
93
92
  }
94
93
  return true;
95
94
  }