diff --git a/index.js b/index.js index 44e80ac..36e5f1e 100644 --- a/index.js +++ b/index.js @@ -108,9 +108,8 @@ class Tab { this.setIcon(this.iconURL); this.setButtons(); - tab.addEventListener("click", this.activate.bind(this), false); + tab.addEventListener("click", this.tabClickHandler.bind(this), false); this.tabGroup.tabContainer.appendChild(this.tab); - // TODO: handle middle click } initWebview () { @@ -158,6 +157,14 @@ class Tab { } } + tabClickHandler (e) { + if (e.which === 1) { + this.activate(); + } else if (e.which === 2) { + this.close(); + } + } + activate () { let activeTab = this.tabGroup.getActiveTab(); if (activeTab) {