hookapp 2.0.7 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHORS.md +4 -0
  3. data/CHANGELOG.md +5 -0
  4. data/LICENSE +21 -0
  5. data/README.md +31 -21
  6. data/bin/hook +57 -67
  7. data/hook.rdoc +15 -10
  8. data/html/App.html +107 -0
  9. data/html/GLI/Commands/Doc.html +91 -0
  10. data/html/GLI/Commands/MarkdownDocumentListener.html +521 -0
  11. data/html/GLI/Commands.html +91 -0
  12. data/html/GLI.html +91 -0
  13. data/html/Hook.html +100 -0
  14. data/html/HookApp.html +1002 -0
  15. data/html/Hooker.html +141 -0
  16. data/html/README_rdoc.html +354 -0
  17. data/html/String.html +335 -0
  18. data/html/created.rid +9 -0
  19. data/html/css/fonts.css +167 -0
  20. data/html/css/rdoc.css +639 -0
  21. data/html/fonts/Lato-Light.ttf +0 -0
  22. data/html/fonts/Lato-LightItalic.ttf +0 -0
  23. data/html/fonts/Lato-Regular.ttf +0 -0
  24. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  25. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  26. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  27. data/html/images/add.png +0 -0
  28. data/html/images/arrow_up.png +0 -0
  29. data/html/images/brick.png +0 -0
  30. data/html/images/brick_link.png +0 -0
  31. data/html/images/bug.png +0 -0
  32. data/html/images/bullet_black.png +0 -0
  33. data/html/images/bullet_toggle_minus.png +0 -0
  34. data/html/images/bullet_toggle_plus.png +0 -0
  35. data/html/images/date.png +0 -0
  36. data/html/images/delete.png +0 -0
  37. data/html/images/find.png +0 -0
  38. data/html/images/loadingAnimation.gif +0 -0
  39. data/html/images/macFFBgHack.png +0 -0
  40. data/html/images/package.png +0 -0
  41. data/html/images/page_green.png +0 -0
  42. data/html/images/page_white_text.png +0 -0
  43. data/html/images/page_white_width.png +0 -0
  44. data/html/images/plugin.png +0 -0
  45. data/html/images/ruby.png +0 -0
  46. data/html/images/tag_blue.png +0 -0
  47. data/html/images/tag_green.png +0 -0
  48. data/html/images/transparent.png +0 -0
  49. data/html/images/wrench.png +0 -0
  50. data/html/images/wrench_orange.png +0 -0
  51. data/html/images/zoom.png +0 -0
  52. data/html/index.html +317 -0
  53. data/html/js/darkfish.js +84 -0
  54. data/html/js/navigation.js +105 -0
  55. data/html/js/navigation.js.gz +0 -0
  56. data/html/js/search.js +110 -0
  57. data/html/js/search_index.js +1 -0
  58. data/html/js/search_index.js.gz +0 -0
  59. data/html/js/searcher.js +229 -0
  60. data/html/js/searcher.js.gz +0 -0
  61. data/html/table_of_contents.html +365 -0
  62. data/lib/hook/hookapp.rb +9 -10
  63. data/lib/hook/markdown_document_listener.rb +12 -2
  64. data/lib/hook/version.rb +1 -1
  65. data/test/hook_scripts_test.rb +1 -1
  66. metadata +58 -2
data/html/index.html ADDED
@@ -0,0 +1,317 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>hookapp</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "./";
11
+ var index_rel_prefix = "./";
12
+ </script>
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>
19
+
20
+ <link href="./css/fonts.css" rel="stylesheet">
21
+ <link href="./css/rdoc.css" rel="stylesheet">
22
+
23
+
24
+ <body id="top" role="document" class="file">
25
+ <nav role="navigation">
26
+ <div id="project-navigation">
27
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
28
+ <h2>
29
+ <a href="./index.html" rel="home">Home</a>
30
+ </h2>
31
+
32
+ <div id="table-of-contents-navigation">
33
+ <a href="./table_of_contents.html#pages">Pages</a>
34
+ <a href="./table_of_contents.html#classes">Classes</a>
35
+ <a href="./table_of_contents.html#methods">Methods</a>
36
+ </div>
37
+ </div>
38
+
39
+
40
+ <div id="search-section" role="search" class="project-section initially-hidden">
41
+ <form action="#" method="get" accept-charset="utf-8">
42
+ <div id="search-field-wrapper">
43
+ <input id="search-field" role="combobox" aria-label="Search"
44
+ aria-autocomplete="list" aria-controls="search-results"
45
+ type="text" name="search" placeholder="Search" spellcheck="false"
46
+ title="Type to search, Up and Down to navigate, Enter to load">
47
+ </div>
48
+
49
+ <ul id="search-results" aria-label="Search Results"
50
+ aria-busy="false" aria-expanded="false"
51
+ aria-atomic="false" class="initially-hidden"></ul>
52
+ </form>
53
+ </div>
54
+
55
+ </div>
56
+
57
+ <div id="project-metadata">
58
+
59
+ <div id="fileindex-section" class="nav-section">
60
+ <h3>Pages</h3>
61
+
62
+ <ul class="link-list">
63
+ <li><a href="./README_rdoc.html">README</a>
64
+ </ul>
65
+ </div>
66
+
67
+ <div id="classindex-section" class="nav-section">
68
+ <h3>Class and Module Index</h3>
69
+
70
+ <ul class="link-list">
71
+ <li><a href="./App.html">App</a>
72
+ <li><a href="./GLI.html">GLI</a>
73
+ <li><a href="./GLI/Commands.html">GLI::Commands</a>
74
+ <li><a href="./GLI/Commands/Doc.html">GLI::Commands::Doc</a>
75
+ <li><a href="./GLI/Commands/MarkdownDocumentListener.html">GLI::Commands::MarkdownDocumentListener</a>
76
+ <li><a href="./Hook.html">Hook</a>
77
+ <li><a href="./HookApp.html">HookApp</a>
78
+ <li><a href="./Hooker.html">Hooker</a>
79
+ <li><a href="./String.html">String</a>
80
+ </ul>
81
+ </div>
82
+
83
+ </div>
84
+ </nav>
85
+
86
+ <main role="main">
87
+
88
+
89
+ <h1 id="label-hookapp">hookapp<span><a href="#label-hookapp">&para;</a> <a href="#top">&uarr;</a></span></h1>
90
+
91
+ <p>A CLI for Hook.app on macOS.</p>
92
+
93
+ <h2 id="label-hook+-+CLI+interface+for+Hook.app+-28macOS-29">hook - CLI interface for Hook.app (macOS)<span><a href="#label-hook+-+CLI+interface+for+Hook.app+-28macOS-29">&para;</a> <a href="#top">&uarr;</a></span></h2>
94
+
95
+ <p>Hook.app is a productivity tool for macOS &lt;<a href="https://hookproductivity.com">hookproductivity.com</a>/&gt;.</p>
96
+
97
+ <p>This gem includes a `hook` binary that allows interaction with the features of Hook.app.</p>
98
+
99
+ <p>v2.0.7</p>
100
+
101
+ <h3 id="label-Global+Options">Global Options<span><a href="#label-Global+Options">&para;</a> <a href="#top">&uarr;</a></span></h3>
102
+
103
+ <h3 id="label--help">–help<span><a href="#label--help">&para;</a> <a href="#top">&uarr;</a></span></h3>
104
+
105
+ <p>Show this message</p>
106
+
107
+ <h3 id="label--version">–version<span><a href="#label--version">&para;</a> <a href="#top">&uarr;</a></span></h3>
108
+
109
+ <p>Display the program version</p>
110
+
111
+ <h3 id="label-Commands">Commands<span><a href="#label-Commands">&para;</a> <a href="#top">&uarr;</a></span></h3>
112
+
113
+ <h4 id="label-Command-3A+clip-7Ccp++FILE_OR_URL">Command: <code>clip|cp FILE_OR_URL</code><span><a href="#label-Command-3A+clip-7Ccp++FILE_OR_URL">&para;</a> <a href="#top">&uarr;</a></span></h4>
114
+
115
+ <p>Copy <a href="Hook.html"><code>Hook</code></a> URL for file/url to clipboard</p>
116
+
117
+ <p>Creates a bookmark for the specified file or URL and copies its <a href="Hook.html"><code>Hook</code></a> URL to the clipboard.</p>
118
+
119
+ <p>The copied <a href="Hook.html"><code>Hook</code></a> URL can be used to link to other files (use `hook link –paste FILE/URL`, or to paste into another app as a link. Use the -m flag to copy a full Markdown link.</p>
120
+
121
+ <h5 id="label-Options">Options<span><a href="#label-Options">&para;</a> <a href="#top">&uarr;</a></span></h5>
122
+
123
+ <h5 id="label-a-7C--app+APP_NAME">-a|–app APP_NAME<span><a href="#label-a-7C--app+APP_NAME">&para;</a> <a href="#top">&uarr;</a></span></h5>
124
+
125
+ <p>Copy from application</p>
126
+ <dl class="rdoc-list label-list"><dt>Default Value
127
+ <dd>
128
+ <p>None</p>
129
+ </dd></dl>
130
+
131
+ <h5 id="label-m-7C--markdown">-m|–markdown<span><a href="#label-m-7C--markdown">&para;</a> <a href="#top">&uarr;</a></span></h5>
132
+
133
+ <p>Copy as Markdown</p>
134
+
135
+ <h4 id="label-Command-3A+clone++SOURCE+TARGET">Command: <code>clone SOURCE TARGET</code><span><a href="#label-Command-3A+clone++SOURCE+TARGET">&para;</a> <a href="#top">&uarr;</a></span></h4>
136
+
137
+ <p>Clone all hooks from one file or url onto another</p>
138
+
139
+ <p>Copy all the files and urls that the first file is hooked to onto another file.</p>
140
+
141
+ <p>Exactly two arguments (SOURCE, TARGET) required.</p>
142
+
143
+ <h4 id="label-Command-3A+find-7Csearch++-5BSEARCH_STRING-5D">Command: <code>find|search [SEARCH_STRING]</code><span><a href="#label-Command-3A+find-7Csearch++-5BSEARCH_STRING-5D">&para;</a> <a href="#top">&uarr;</a></span></h4>
144
+
145
+ <p>Search bookmarks</p>
146
+
147
+ <p>Search bookmark urls and names for a string and output in specified format (default “paths”).</p>
148
+
149
+ <p>Run `hook find` with no search argument to list all bookmarks.</p>
150
+
151
+ <h5 id="label-Options">Options<span><a href="#label-Options">&para;</a> <a href="#top">&uarr;</a></span></h5>
152
+
153
+ <h5 id="label-o-7C--output_format+FORMAT">-o|–output_format FORMAT<span><a href="#label-o-7C--output_format+FORMAT">&para;</a> <a href="#top">&uarr;</a></span></h5>
154
+
155
+ <p>Output format [(h)ooks, (p)aths, (m)arkdown, (v)erbose]</p>
156
+ <dl class="rdoc-list label-list"><dt>Default Value
157
+ <dd>
158
+ <p>paths</p>
159
+ </dd></dl>
160
+
161
+ <h5 id="label-f-7C--files_only">-f|–files_only<span><a href="#label-f-7C--files_only">&para;</a> <a href="#top">&uarr;</a></span></h5>
162
+
163
+ <p>Output only bookmarks with file paths (exclude e.g. emails)</p>
164
+
165
+ <h5 id="label-n-7C--names_only">-n|–names_only<span><a href="#label-n-7C--names_only">&para;</a> <a href="#top">&uarr;</a></span></h5>
166
+
167
+ <p>Search only bookmark names</p>
168
+
169
+ <h5 id="label--null">–null<span><a href="#label--null">&para;</a> <a href="#top">&uarr;</a></span></h5>
170
+
171
+ <p>Separate results with NULL separator, only applies with “paths” output for single file argument</p>
172
+
173
+ <h4 id="label-Command-3A+from++APPLICATION_NAME">Command: <code>from APPLICATION_NAME</code><span><a href="#label-Command-3A+from++APPLICATION_NAME">&para;</a> <a href="#top">&uarr;</a></span></h4>
174
+
175
+ <p>Get a <a href="Hook.html"><code>Hook</code></a> URL for the frontmost window of an app</p>
176
+
177
+ <p>Specify an application by name (without &#39;.app&#39;) to bring that app to the foreground and create a bookmark for the active document, note, task, etc., returning a <a href="Hook.html"><code>Hook</code></a> URL.</p>
178
+
179
+ <p>Use -m to get the response as Markdown, and/or -c to copy the result directly to the clipboard.</p>
180
+
181
+ <h5 id="label-Options">Options<span><a href="#label-Options">&para;</a> <a href="#top">&uarr;</a></span></h5>
182
+
183
+ <h5 id="label-c-7C--copy">-c|–copy<span><a href="#label-c-7C--copy">&para;</a> <a href="#top">&uarr;</a></span></h5>
184
+
185
+ <p>Copy to clipboard</p>
186
+
187
+ <h5 id="label-m-7C--markdown">-m|–markdown<span><a href="#label-m-7C--markdown">&para;</a> <a href="#top">&uarr;</a></span></h5>
188
+
189
+ <p>Output as Markdown</p>
190
+
191
+ <h4 id="label-Command-3A+help++command">Command: <code>help command</code><span><a href="#label-Command-3A+help++command">&para;</a> <a href="#top">&uarr;</a></span></h4>
192
+
193
+ <p>Shows a list of commands or help for one command</p>
194
+
195
+ <p>Gets help for the application or its commands. Can also list the commands in a way helpful to creating a bash-style completion function</p>
196
+
197
+ <h5 id="label-Options">Options<span><a href="#label-Options">&para;</a> <a href="#top">&uarr;</a></span></h5>
198
+
199
+ <h5 id="label-c">-c<span><a href="#label-c">&para;</a> <a href="#top">&uarr;</a></span></h5>
200
+
201
+ <p>List commands one per line, to assist with shell completion</p>
202
+
203
+ <h4 id="label-Command-3A+link-7Cln++SOURCE...+TARGET">Command: <code>link|ln SOURCE... TARGET</code><span><a href="#label-Command-3A+link-7Cln++SOURCE...+TARGET">&para;</a> <a href="#top">&uarr;</a></span></h4>
204
+
205
+ <p>Create bidirectional hooks between two or more files/urls</p>
206
+
207
+ <p>If two files/urls are provided, links will be bi-directional. If three or more are provided, `link` defaults to creating bi-directional links between each file and the last file in the list. Use `-a` to create bi-directional links between every file in the list.</p>
208
+
209
+ <p>If using `–paste`, the URL/hook link in the clipboard will be used as one argument, to be combined with one or more file/url arguments.</p>
210
+
211
+ <h5 id="label-Options">Options<span><a href="#label-Options">&para;</a> <a href="#top">&uarr;</a></span></h5>
212
+
213
+ <h5 id="label-a-7C--all">-a|–all<span><a href="#label-a-7C--all">&para;</a> <a href="#top">&uarr;</a></span></h5>
214
+
215
+ <p>Link every listed file or url to every other</p>
216
+
217
+ <h5 id="label-p-7C--paste">-p|–paste<span><a href="#label-p-7C--paste">&para;</a> <a href="#top">&uarr;</a></span></h5>
218
+
219
+ <p>Paste URL from clipboard</p>
220
+
221
+ <h4 id="label-Command-3A+list-7Cls++-5BFILE_OR_URL-5D...">Command: <code>list|ls [FILE_OR_URL]...</code><span><a href="#label-Command-3A+list-7Cls++-5BFILE_OR_URL-5D...">&para;</a> <a href="#top">&uarr;</a></span></h4>
222
+
223
+ <p>List hooks on a file or url</p>
224
+
225
+ <p>Output a list of all hooks attached to given url(s) or file(s) in the specified format (default “paths”).</p>
226
+
227
+ <p>Run `hook list` with no file/url argument to list all bookmarks.</p>
228
+
229
+ <h5 id="label-Options">Options<span><a href="#label-Options">&para;</a> <a href="#top">&uarr;</a></span></h5>
230
+
231
+ <h5 id="label-o-7C--output_format+FORMAT">-o|–output_format FORMAT<span><a href="#label-o-7C--output_format+FORMAT">&para;</a> <a href="#top">&uarr;</a></span></h5>
232
+
233
+ <p>Output format [(h)ooks, (p)aths, (m)arkdown, (v)erbose]</p>
234
+ <dl class="rdoc-list label-list"><dt>Default Value
235
+ <dd>
236
+ <p>paths</p>
237
+ </dd></dl>
238
+
239
+ <h5 id="label-f-7C--files_only">-f|–files_only<span><a href="#label-f-7C--files_only">&para;</a> <a href="#top">&uarr;</a></span></h5>
240
+
241
+ <p>Output only bookmarks with file paths (exclude e.g. emails)</p>
242
+
243
+ <h5 id="label--null">–null<span><a href="#label--null">&para;</a> <a href="#top">&uarr;</a></span></h5>
244
+
245
+ <p>Separate results with NULL separator, only applies with “paths” output for single file argument</p>
246
+
247
+ <h5 id="label-s-7C--select">-<a href="no-">s|–</a>select<span><a href="#label-s-7C--select">&para;</a> <a href="#top">&uarr;</a></span></h5>
248
+
249
+ <p>Generate a menu to select hook(s) for opening</p>
250
+
251
+ <p>This option is a shortcut to `hook select` and overrides any other arguments.</p>
252
+
253
+ <h4 id="label-Command-3A+open-7Cgui++FILE_OR_URL">Command: <code>open|gui FILE_OR_URL</code><span><a href="#label-Command-3A+open-7Cgui++FILE_OR_URL">&para;</a> <a href="#top">&uarr;</a></span></h4>
254
+
255
+ <p>Open the specified file or url in <a href="Hook.html"><code>Hook</code></a> GUI</p>
256
+
257
+ <p>Opens Hook.app on the specified file/URL for browsing and performing actions.</p>
258
+
259
+ <p>Exactly one argument (File/URL) required.</p>
260
+
261
+ <h4 id="label-Command-3A+percent++STRING">Command: <code>percent STRING</code><span><a href="#label-Command-3A+percent++STRING">&para;</a> <a href="#top">&uarr;</a></span></h4>
262
+
263
+ <p>Percent encode/decode a string</p>
264
+
265
+ <p>Use encode or decode to apply Hook&#39;s url encoding to a string argument. Use &#39;-&#39; to read input from STDIN.</p>
266
+
267
+ <h5 id="label-Commands">Commands<span><a href="#label-Commands">&para;</a> <a href="#top">&uarr;</a></span></h5>
268
+
269
+ <h6 id="label-Command-3A+decode++STRING">Command: <code>decode STRING</code><span><a href="#label-Command-3A+decode++STRING">&para;</a> <a href="#top">&uarr;</a></span></h6>
270
+
271
+ <p>decode a percent-encoded string</p>
272
+
273
+ <h6 id="label-Command-3A+encode++STRING">Command: <code>encode STRING</code><span><a href="#label-Command-3A+encode++STRING">&para;</a> <a href="#top">&uarr;</a></span></h6>
274
+
275
+ <p>percent encode a string</p>
276
+
277
+ <h4 id="label-Command-3A+remove-7Crm++FILE_OR_URL...">Command: <code>remove|rm FILE_OR_URL...</code><span><a href="#label-Command-3A+remove-7Crm++FILE_OR_URL...">&para;</a> <a href="#top">&uarr;</a></span></h4>
278
+
279
+ <p>Remove a hook between two files/urls</p>
280
+
281
+ <p>Remove a hook between two files or URLs. If you use –all, all hooks on a given file will be removed.</p>
282
+
283
+ <p>If –all isn&#39;t specified, exactly two arguments (Files/URLs) are required.</p>
284
+
285
+ <h5 id="label-Options">Options<span><a href="#label-Options">&para;</a> <a href="#top">&uarr;</a></span></h5>
286
+
287
+ <h5 id="label-a-7C--all">-a|–all<span><a href="#label-a-7C--all">&para;</a> <a href="#top">&uarr;</a></span></h5>
288
+
289
+ <p>Remove ALL links on files, requires confirmation</p>
290
+
291
+ <h5 id="label-f-7C--force">-f|–force<span><a href="#label-f-7C--force">&para;</a> <a href="#top">&uarr;</a></span></h5>
292
+
293
+ <h4 id="label-Command-3A+scripts++SHELL">Command: <code>scripts SHELL</code><span><a href="#label-Command-3A+scripts++SHELL">&para;</a> <a href="#top">&uarr;</a></span></h4>
294
+
295
+ <p>Shell completion examples</p>
296
+
297
+ <p>Output completion script example for the specified shell (bash, zsh, fish)</p>
298
+
299
+ <h4 id="label-Command-3A+select++FILE_OR_URL">Command: <code>select FILE_OR_URL</code><span><a href="#label-Command-3A+select++FILE_OR_URL">&para;</a> <a href="#top">&uarr;</a></span></h4>
300
+
301
+ <p>Select from hooks on a file/url and open in default application</p>
302
+
303
+ <p>If the target file/URL has hooked items, a menu will be provided. Selecting one or more files from this menu will open the item(s) using the default application assigned to the filetype by macOS. Allows multiple selections with tab key, and type-ahead fuzzy filtering of results.</p>
304
+ <dl class="rdoc-list label-list"><dt>Default Command
305
+ <dd>
306
+ <p>help</p>
307
+ </dd></dl>
308
+
309
+ </main>
310
+
311
+
312
+ <footer id="validator-badges" role="contentinfo">
313
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
314
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.3.2.
315
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
316
+ </footer>
317
+
@@ -0,0 +1,84 @@
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
+ /*
12
+ if (!("console" in window) || !("firebug" in console)) {
13
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
14
+ "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
15
+
16
+ window.console = {};
17
+ for (var i = 0; i < names.length; ++i)
18
+ window.console[names[i]] = function() {};
19
+ };
20
+ */
21
+
22
+
23
+ function showSource( e ) {
24
+ 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
+ }
34
+ };
35
+
36
+ function hookSourceViews() {
37
+ document.querySelectorAll('.method-heading').forEach(function (codeObject) {
38
+ codeObject.addEventListener('click', showSource);
39
+ });
40
+ };
41
+
42
+ function hookSearch() {
43
+ var input = document.querySelector('#search-field');
44
+ var result = document.querySelector('#search-results');
45
+ result.classList.remove("initially-hidden");
46
+
47
+ var search_section = document.querySelector('#search-section');
48
+ search_section.classList.remove("initially-hidden");
49
+
50
+ var search = new Search(search_data, input, result);
51
+
52
+ search.renderItem = function(result) {
53
+ var li = document.createElement('li');
54
+ var html = '';
55
+
56
+ // TODO add relative path to <script> per-page
57
+ html += '<p class="search-match"><a href="' + index_rel_prefix + result.path + '">' + this.hlt(result.title);
58
+ if (result.params)
59
+ html += '<span class="params">' + result.params + '</span>';
60
+ html += '</a>';
61
+
62
+
63
+ if (result.namespace)
64
+ html += '<p class="search-namespace">' + this.hlt(result.namespace);
65
+
66
+ if (result.snippet)
67
+ html += '<div class="search-snippet">' + result.snippet + '</div>';
68
+
69
+ li.innerHTML = html;
70
+
71
+ return li;
72
+ }
73
+
74
+ search.select = function(result) {
75
+ window.location.href = result.firstChild.firstChild.href;
76
+ }
77
+
78
+ search.scrollIntoView = search.scrollInWindow;
79
+ };
80
+
81
+ document.addEventListener('DOMContentLoaded', function() {
82
+ hookSourceViews();
83
+ hookSearch();
84
+ });
@@ -0,0 +1,105 @@
1
+ /*
2
+ * Navigation allows movement using the arrow keys through the search results.
3
+ *
4
+ * When using this library you will need to set scrollIntoView to the
5
+ * appropriate function for your layout. Use scrollInWindow if the container
6
+ * is not scrollable and scrollInElement if the container is a separate
7
+ * scrolling region.
8
+ */
9
+ Navigation = new function() {
10
+ this.initNavigation = function() {
11
+ var _this = this;
12
+
13
+ document.addEventListener('keydown', function(e) {
14
+ _this.onkeydown(e);
15
+ });
16
+
17
+ this.navigationActive = true;
18
+ }
19
+
20
+ this.setNavigationActive = function(state) {
21
+ this.navigationActive = state;
22
+ }
23
+
24
+ this.onkeydown = function(e) {
25
+ if (!this.navigationActive) return;
26
+ switch(e.keyCode) {
27
+ case 37: //Event.KEY_LEFT:
28
+ if (this.moveLeft()) e.preventDefault();
29
+ break;
30
+ case 38: //Event.KEY_UP:
31
+ if (e.keyCode == 38 || e.ctrlKey) {
32
+ if (this.moveUp()) e.preventDefault();
33
+ }
34
+ break;
35
+ case 39: //Event.KEY_RIGHT:
36
+ if (this.moveRight()) e.preventDefault();
37
+ break;
38
+ case 40: //Event.KEY_DOWN:
39
+ if (e.keyCode == 40 || e.ctrlKey) {
40
+ if (this.moveDown()) e.preventDefault();
41
+ }
42
+ break;
43
+ case 13: //Event.KEY_RETURN:
44
+ if (this.current) e.preventDefault();
45
+ this.select(this.current);
46
+ break;
47
+ }
48
+ if (e.ctrlKey && e.shiftKey) this.select(this.current);
49
+ }
50
+
51
+ this.moveRight = function() {
52
+ }
53
+
54
+ this.moveLeft = function() {
55
+ }
56
+
57
+ this.move = function(isDown) {
58
+ }
59
+
60
+ this.moveUp = function() {
61
+ return this.move(false);
62
+ }
63
+
64
+ this.moveDown = function() {
65
+ return this.move(true);
66
+ }
67
+
68
+ /*
69
+ * Scrolls to the given element in the scrollable element view.
70
+ */
71
+ this.scrollInElement = function(element, view) {
72
+ var offset, viewHeight, viewScroll, height;
73
+ offset = element.offsetTop;
74
+ height = element.offsetHeight;
75
+ viewHeight = view.offsetHeight;
76
+ viewScroll = view.scrollTop;
77
+
78
+ if (offset - viewScroll + height > viewHeight) {
79
+ view.scrollTop = offset - viewHeight + height;
80
+ }
81
+ if (offset < viewScroll) {
82
+ view.scrollTop = offset;
83
+ }
84
+ }
85
+
86
+ /*
87
+ * Scrolls to the given element in the window. The second argument is
88
+ * ignored
89
+ */
90
+ this.scrollInWindow = function(element, ignored) {
91
+ var offset, viewHeight, viewScroll, height;
92
+ offset = element.offsetTop;
93
+ height = element.offsetHeight;
94
+ viewHeight = window.innerHeight;
95
+ viewScroll = window.scrollY;
96
+
97
+ if (offset - viewScroll + height > viewHeight) {
98
+ window.scrollTo(window.scrollX, offset - viewHeight + height);
99
+ }
100
+ if (offset < viewScroll) {
101
+ window.scrollTo(window.scrollX, offset);
102
+ }
103
+ }
104
+ }
105
+
Binary file
data/html/js/search.js ADDED
@@ -0,0 +1,110 @@
1
+ Search = function(data, input, result) {
2
+ this.data = data;
3
+ this.input = input;
4
+ this.result = result;
5
+
6
+ this.current = null;
7
+ this.view = this.result.parentNode;
8
+ this.searcher = new Searcher(data.index);
9
+ this.init();
10
+ }
11
+
12
+ Search.prototype = Object.assign({}, Navigation, new function() {
13
+ var suid = 1;
14
+
15
+ this.init = function() {
16
+ var _this = this;
17
+ var observer = function(e) {
18
+ switch(e.keyCode) {
19
+ case 38: // Event.KEY_UP
20
+ case 40: // Event.KEY_DOWN
21
+ return;
22
+ }
23
+ _this.search(_this.input.value);
24
+ };
25
+ this.input.addEventListener('keyup', observer);
26
+ this.input.addEventListener('click', observer); // mac's clear field
27
+
28
+ this.searcher.ready(function(results, isLast) {
29
+ _this.addResults(results, isLast);
30
+ })
31
+
32
+ this.initNavigation();
33
+ this.setNavigationActive(false);
34
+ }
35
+
36
+ this.search = function(value, selectFirstMatch) {
37
+ value = value.trim().toLowerCase();
38
+ if (value) {
39
+ this.setNavigationActive(true);
40
+ } else {
41
+ this.setNavigationActive(false);
42
+ }
43
+
44
+ if (value == '') {
45
+ this.lastQuery = value;
46
+ this.result.innerHTML = '';
47
+ this.result.setAttribute('aria-expanded', 'false');
48
+ this.setNavigationActive(false);
49
+ } else if (value != this.lastQuery) {
50
+ this.lastQuery = value;
51
+ this.result.setAttribute('aria-busy', 'true');
52
+ this.result.setAttribute('aria-expanded', 'true');
53
+ this.firstRun = true;
54
+ this.searcher.find(value);
55
+ }
56
+ }
57
+
58
+ this.addResults = function(results, isLast) {
59
+ var target = this.result;
60
+ if (this.firstRun && (results.length > 0 || isLast)) {
61
+ this.current = null;
62
+ this.result.innerHTML = '';
63
+ }
64
+
65
+ for (var i=0, l = results.length; i < l; i++) {
66
+ var item = this.renderItem.call(this, results[i]);
67
+ item.setAttribute('id', 'search-result-' + target.childElementCount);
68
+ target.appendChild(item);
69
+ };
70
+
71
+ if (this.firstRun && results.length > 0) {
72
+ this.firstRun = false;
73
+ this.current = target.firstChild;
74
+ this.current.classList.add('search-selected');
75
+ }
76
+ //TODO: ECMAScript
77
+ //if (jQuery.browser.msie) this.$element[0].className += '';
78
+
79
+ if (isLast) this.result.setAttribute('aria-busy', 'false');
80
+ }
81
+
82
+ 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();
93
+ }
94
+ return true;
95
+ }
96
+
97
+ this.hlt = function(html) {
98
+ return this.escapeHTML(html).
99
+ replace(/\u0001/g, '<em>').
100
+ replace(/\u0002/g, '</em>');
101
+ }
102
+
103
+ this.escapeHTML = function(html) {
104
+ return html.replace(/[&<>]/g, function(c) {
105
+ return '&#' + c.charCodeAt(0) + ';';
106
+ });
107
+ }
108
+
109
+ });
110
+
@@ -0,0 +1 @@
1
+ var search_data = {"index":{"searchIndex":["app","gli","commands","doc","markdowndocumentlistener","hook","hookapp","hooker","string","all_bookmarks()","beginning()","bookmark_for()","bookmark_from_app()","cap()","cap!()","clip()","clip_bookmark()","clone_hooks()","command()","commands()","copy_bookmark()","decode()","default_command()","delete_all_hooks()","delete_hooks()","encode()","end_command()","end_commands()","end_options()","ending()","escape_quotes()","flag()","format_regex()","get_hooks()","link_all()","link_files()","linked_bookmarks()","new()","new()","nil_if_missing()","open_gui()","open_linked()","options()","output_array()","program_desc()","program_long_desc()","search_bookmarks()","search_name()","search_path_or_address()","select_hook()","split_hook()","split_hooks()","switch()","valid_hook()","valid_hook!()","validate_format()","version()","readme"],"longSearchIndex":["app","gli","gli::commands","gli::commands::doc","gli::commands::markdowndocumentlistener","hook","hookapp","hooker","string","hookapp#all_bookmarks()","gli::commands::markdowndocumentlistener#beginning()","hookapp#bookmark_for()","hookapp#bookmark_from_app()","string#cap()","string#cap!()","string#clip()","hookapp#clip_bookmark()","hookapp#clone_hooks()","gli::commands::markdowndocumentlistener#command()","gli::commands::markdowndocumentlistener#commands()","hookapp#copy_bookmark()","hookapp#decode()","gli::commands::markdowndocumentlistener#default_command()","hookapp#delete_all_hooks()","hookapp#delete_hooks()","hookapp#encode()","gli::commands::markdowndocumentlistener#end_command()","gli::commands::markdowndocumentlistener#end_commands()","gli::commands::markdowndocumentlistener#end_options()","gli::commands::markdowndocumentlistener#ending()","string#escape_quotes()","gli::commands::markdowndocumentlistener#flag()","hookapp#format_regex()","hookapp#get_hooks()","hookapp#link_all()","hookapp#link_files()","hookapp#linked_bookmarks()","gli::commands::markdowndocumentlistener::new()","hooker::new()","string#nil_if_missing()","hookapp#open_gui()","hookapp#open_linked()","gli::commands::markdowndocumentlistener#options()","hookapp#output_array()","gli::commands::markdowndocumentlistener#program_desc()","gli::commands::markdowndocumentlistener#program_long_desc()","hookapp#search_bookmarks()","hookapp#search_name()","hookapp#search_path_or_address()","hookapp#select_hook()","string#split_hook()","string#split_hooks()","gli::commands::markdowndocumentlistener#switch()","string#valid_hook()","string#valid_hook!()","hookapp#validate_format()","gli::commands::markdowndocumentlistener#version()",""],"info":[["App","","App.html","","<p>Main class for GLI app\n"],["GLI","","GLI.html","",""],["GLI::Commands","","GLI/Commands.html","",""],["GLI::Commands::Doc","","GLI/Commands/Doc.html","",""],["GLI::Commands::MarkdownDocumentListener","","GLI/Commands/MarkdownDocumentListener.html","","<p>DocumentListener class for GLI documentation generator\n"],["Hook","","Hook.html","",""],["HookApp","","HookApp.html","","<p>Hook.app functions\n"],["Hooker","","Hooker.html","","<p>Hook.app CLI interface\n"],["String","","String.html","","<p>String helpers\n"],["all_bookmarks","HookApp","HookApp.html#method-i-all_bookmarks","()","<p>Get all known bookmarks. Return array of bookmark hashes.\n"],["beginning","GLI::Commands::MarkdownDocumentListener","GLI/Commands/MarkdownDocumentListener.html#method-i-beginning","()",""],["bookmark_for","HookApp","HookApp.html#method-i-bookmark_for","(url)","<p>Get a Hook bookmark for file or URL. Return bookmark hash.\n"],["bookmark_from_app","HookApp","HookApp.html#method-i-bookmark_from_app","(app, opts)","<p>Get a bookmark from the foreground document of specified app.\n"],["cap","String","String.html#method-i-cap","()","<p>Capitalize only if no uppercase\n"],["cap!","String","String.html#method-i-cap-21","()",""],["clip","String","String.html#method-i-clip","()",""],["clip_bookmark","HookApp","HookApp.html#method-i-clip_bookmark","(url, opts)","<p>Create a bookmark for specified file/url and copy to the clipboard.\n"],["clone_hooks","HookApp","HookApp.html#method-i-clone_hooks","(args)","<p>Copy all hooks from source file to target file\n"],["command","GLI::Commands::MarkdownDocumentListener","GLI/Commands/MarkdownDocumentListener.html#method-i-command","(name, aliases, desc, long_desc, arg_name, arg_options)","<p>Gives you a command in the current context and creates a new context of this command\n"],["commands","GLI::Commands::MarkdownDocumentListener","GLI/Commands/MarkdownDocumentListener.html#method-i-commands","()",""],["copy_bookmark","HookApp","HookApp.html#method-i-copy_bookmark","(title, url, opts)","<p>Create a bookmark from specified title and url and copy to the clipboard.\n"],["decode","HookApp","HookApp.html#method-i-decode","(string)",""],["default_command","GLI::Commands::MarkdownDocumentListener","GLI/Commands/MarkdownDocumentListener.html#method-i-default_command","(name)","<p>Gives you the name of the current command in the current context\n"],["delete_all_hooks","HookApp","HookApp.html#method-i-delete_all_hooks","(url, force: false)","<p>Delete all hooked files/urls from target file\n"],["delete_hooks","HookApp","HookApp.html#method-i-delete_hooks","(args, opts)","<p>Delete hooks between two files/urls\n"],["encode","HookApp","HookApp.html#method-i-encode","(string)",""],["end_command","GLI::Commands::MarkdownDocumentListener","GLI/Commands/MarkdownDocumentListener.html#method-i-end_command","(_name)","<p>Ends a command, and “pops” you back up one context\n"],["end_commands","GLI::Commands::MarkdownDocumentListener","GLI/Commands/MarkdownDocumentListener.html#method-i-end_commands","()",""],["end_options","GLI::Commands::MarkdownDocumentListener","GLI/Commands/MarkdownDocumentListener.html#method-i-end_options","()",""],["ending","GLI::Commands::MarkdownDocumentListener","GLI/Commands/MarkdownDocumentListener.html#method-i-ending","()","<p>Called when processing has completed\n"],["escape_quotes","String","String.html#method-i-escape_quotes","()",""],["flag","GLI::Commands::MarkdownDocumentListener","GLI/Commands/MarkdownDocumentListener.html#method-i-flag","(name, aliases, desc, long_desc, default_value, arg_name, must_match, _type)","<p>Gives you a flag in the current context\n"],["format_regex","HookApp","HookApp.html#method-i-format_regex","(options)","<p>Create a single regex for validation of an array by first char or full match.\n"],["get_hooks","HookApp","HookApp.html#method-i-get_hooks","(url)","<p>Get bookmarks hooked to file or URL. Return array of bookmark hashes.\n"],["link_all","HookApp","HookApp.html#method-i-link_all","(args)","<p>Create bi-directional links between every file/url in the list of arguments\n"],["link_files","HookApp","HookApp.html#method-i-link_files","(args)","<p>Link 2 or more files/urls with bi-directional hooks.\n"],["linked_bookmarks","HookApp","HookApp.html#method-i-linked_bookmarks","(args, opts)","<p>Get a list of all hooks on a file/url.\n"],["new","GLI::Commands::MarkdownDocumentListener","GLI/Commands/MarkdownDocumentListener.html#method-c-new","(_global_options, _options, _arguments, app)",""],["new","Hooker","Hooker.html#method-c-new","()",""],["nil_if_missing","String","String.html#method-i-nil_if_missing","()",""],["open_gui","HookApp","HookApp.html#method-i-open_gui","(url)","<p>Open the Hook GUI for browsing/performing actions on a file or url\n"],["open_linked","HookApp","HookApp.html#method-i-open_linked","(url)","<p>Select from a menu of available hooks and open using macOS `open`.\n"],["options","GLI::Commands::MarkdownDocumentListener","GLI/Commands/MarkdownDocumentListener.html#method-i-options","()",""],["output_array","HookApp","HookApp.html#method-i-output_array","(hooks_arr, opts)","<p>Output an array of hooks in the given format.\n"],["program_desc","GLI::Commands::MarkdownDocumentListener","GLI/Commands/MarkdownDocumentListener.html#method-i-program_desc","(desc)","<p>Gives you the program description\n"],["program_long_desc","GLI::Commands::MarkdownDocumentListener","GLI/Commands/MarkdownDocumentListener.html#method-i-program_long_desc","(desc)",""],["search_bookmarks","HookApp","HookApp.html#method-i-search_bookmarks","(search, opts)","<p>Search bookmarks, using both names and addresses unless options contain “:names_only”. Return …\n"],["search_name","HookApp","HookApp.html#method-i-search_name","(search)","<p>Search boomark names/titles. Return array of bookmark hashes.\n"],["search_path_or_address","HookApp","HookApp.html#method-i-search_path_or_address","(search)","<p>Search bookmark paths and addresses. Return array of bookmark hashes.\n"],["select_hook","HookApp","HookApp.html#method-i-select_hook","(marks)","<p>Generate a menu of available hooks for selecting one or more hooks to operate on. Revamped to use `fzf`, …\n"],["split_hook","String","String.html#method-i-split_hook","()",""],["split_hooks","String","String.html#method-i-split_hooks","()",""],["switch","GLI::Commands::MarkdownDocumentListener","GLI/Commands/MarkdownDocumentListener.html#method-i-switch","(name, aliases, desc, long_desc, negatable)","<p>Gives you a switch in the current context\n"],["valid_hook","String","String.html#method-i-valid_hook","()",""],["valid_hook!","String","String.html#method-i-valid_hook-21","()",""],["validate_format","HookApp","HookApp.html#method-i-validate_format","(fmt, options)","<p>Check if format fully matches or matches the first character of available options. Return full valid …\n"],["version","GLI::Commands::MarkdownDocumentListener","GLI/Commands/MarkdownDocumentListener.html#method-i-version","(version)","<p>Gives you the program version\n"],["README","","README_rdoc.html","","<p>hookapp\n<p>A CLI for Hook.app on macOS.\n<p>hook - CLI interface for Hook.app (macOS)\n"]]}}
Binary file