X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=app.js;h=9e6bdd9a12d813efec730f25613701cb41a45389;hb=554fc76d750ef6a3516a2f1141ba575fb2563a19;hp=36508abb694ef108fc0ecbfd552f3cda62a71f81;hpb=6eba37a370cdd3c0275d49fa693ab189d8ab8ff2;p=github%2Fbastienwirtz%2Fhomer.git diff --git a/app.js b/app.js index 36508ab..9e6bdd9 100644 --- a/app.js +++ b/app.js @@ -21,7 +21,7 @@ const app = new Vue({ this.checkOffline(); try { this.config = await this.getConfig(); - document.title = this.config.title + ' | Homer'; + document.title = this.config.title + ' | ' + this.config.subtitle; } catch (error) { this.offline = true; } @@ -84,6 +84,26 @@ const app = new Vue({ }, toggleMenu: function() { this.showMenu = !this.showMenu; + }, + matchesFilter: function(item) { + return (item.name.toLowerCase().includes(this.filter.toLowerCase()) + || (item.tag && item.tag.toLowerCase().includes(this.filter.toLowerCase()))) + }, + firstMatchingService: function() { + for (group of this.config.services) { + for (item of group.items) { + if (this.matchesFilter(item)) { + return item; + } + } + } + return null; + }, + navigateToFirstService: function(target) { + service = this.firstMatchingService(); + if (service) { + window.open(service.url, target || service.target || '_self'); + } } }, mounted() {