diff options
-rw-r--r-- | docs/configuration.md | 3 | ||||
-rw-r--r-- | docs/customservices.md | 5 | ||||
-rw-r--r-- | src/App.vue | 6 | ||||
-rw-r--r-- | src/components/SearchInput.vue | 12 |
4 files changed, 21 insertions, 5 deletions
diff --git a/docs/configuration.md b/docs/configuration.md index 50b5bd5..e2b5506 100644 --- a/docs/configuration.md +++ b/docs/configuration.md | |||
@@ -19,6 +19,9 @@ logo: "assets/logo.png" | |||
19 | # icon: "fas fa-skull-crossbones" | 19 | # icon: "fas fa-skull-crossbones" |
20 | 20 | ||
21 | header: true # Set to false to hide the header | 21 | header: true # Set to false to hide the header |
22 | # Optional: Different hotkey for search, defaults to "/" | ||
23 | # hotkey: | ||
24 | # search: "Shift" | ||
22 | footer: '<p>Created with <span class="has-text-danger">❤️</span> with <a href="https://bulma.io/">bulma</a>, <a href="https://vuejs.org/">vuejs</a> & <a href="https://fontawesome.com/">font awesome</a> // Fork me on <a href="https://github.com/bastienwirtz/homer"><i class="fab fa-github-alt"></i></a></p>' # set false if you want to hide it. | 25 | footer: '<p>Created with <span class="has-text-danger">❤️</span> with <a href="https://bulma.io/">bulma</a>, <a href="https://vuejs.org/">vuejs</a> & <a href="https://fontawesome.com/">font awesome</a> // Fork me on <a href="https://github.com/bastienwirtz/homer"><i class="fab fa-github-alt"></i></a></p>' # set false if you want to hide it. |
23 | 26 | ||
24 | columns: "3" # "auto" or number (must be a factor of 12: 1, 2, 3, 4, 6, 12) | 27 | columns: "3" # "auto" or number (must be a factor of 12: 1, 2, 3, 4, 6, 12) |
diff --git a/docs/customservices.md b/docs/customservices.md index f55b739..3b3320d 100644 --- a/docs/customservices.md +++ b/docs/customservices.md | |||
@@ -97,8 +97,9 @@ For Ping you need to set the type to Ping and provide a url. | |||
97 | - name: "Awesome app" | 97 | - name: "Awesome app" |
98 | type: Ping | 98 | type: Ping |
99 | logo: "assets/tools/sample.png" | 99 | logo: "assets/tools/sample.png" |
100 | subtitle: "Bookmark example" tag: "app" | 100 | subtitle: "Bookmark example" |
101 | url: "https://www.reddit.com/r/selfhosted/" | 101 | tag: "app" |
102 | url: "https://www.reddit.com/r/selfhosted/" | ||
102 | ``` | 103 | ``` |
103 | 104 | ||
104 | ## Prometheus | 105 | ## Prometheus |
diff --git a/src/App.vue b/src/App.vue index c263c8a..5c62a7f 100644 --- a/src/App.vue +++ b/src/App.vue | |||
@@ -41,6 +41,7 @@ | |||
41 | 41 | ||
42 | <SearchInput | 42 | <SearchInput |
43 | class="navbar-item is-inline-block-mobile" | 43 | class="navbar-item is-inline-block-mobile" |
44 | :hotkey=searchHotkey() | ||
44 | @input="filterServices" | 45 | @input="filterServices" |
45 | @search-focus="showMenu = true" | 46 | @search-focus="showMenu = true" |
46 | @search-open="navigateToFirstService" | 47 | @search-open="navigateToFirstService" |
@@ -167,6 +168,11 @@ export default { | |||
167 | window.onhashchange = this.buildDashboard; | 168 | window.onhashchange = this.buildDashboard; |
168 | }, | 169 | }, |
169 | methods: { | 170 | methods: { |
171 | searchHotkey() { | ||
172 | if (this.config.hotkey && this.config.hotkey.search) { | ||
173 | return this.config.hotkey.search; | ||
174 | } | ||
175 | }, | ||
170 | buildDashboard: async function () { | 176 | buildDashboard: async function () { |
171 | const defaults = jsyaml.load(defaultConfig); | 177 | const defaults = jsyaml.load(defaultConfig); |
172 | let config; | 178 | let config; |
diff --git a/src/components/SearchInput.vue b/src/components/SearchInput.vue index 40c5a1d..586ff71 100644 --- a/src/components/SearchInput.vue +++ b/src/components/SearchInput.vue | |||
@@ -15,10 +15,16 @@ | |||
15 | <script> | 15 | <script> |
16 | export default { | 16 | export default { |
17 | name: "SearchInput", | 17 | name: "SearchInput", |
18 | props: ["value"], | 18 | props: { |
19 | value: String, | ||
20 | hotkey: { | ||
21 | type: String, | ||
22 | default: "/" | ||
23 | } | ||
24 | }, | ||
19 | mounted() { | 25 | mounted() { |
20 | this._keyListener = function (event) { | 26 | this._keyListener = function (event) { |
21 | if (event.key === "/") { | 27 | if (event.key === this.hotkey) { |
22 | event.preventDefault(); | 28 | event.preventDefault(); |
23 | this.focus(); | 29 | this.focus(); |
24 | } | 30 | } |
@@ -28,7 +34,7 @@ export default { | |||
28 | }; | 34 | }; |
29 | document.addEventListener("keydown", this._keyListener.bind(this)); | 35 | document.addEventListener("keydown", this._keyListener.bind(this)); |
30 | 36 | ||
31 | // fill seach from get parameter. | 37 | // fill search from get parameter. |
32 | const search = new URLSearchParams(window.location.search).get("search"); | 38 | const search = new URLSearchParams(window.location.search).get("search"); |
33 | if (search) { | 39 | if (search) { |
34 | this.$refs.search.value = search; | 40 | this.$refs.search.value = search; |