Commit 96d0a60a7b7c41087f0c52c4ed0292f86ba7d4b1
renamed tabs to hypertabs
Dominic Tarr committed on 5/12/2016, 9:26:37 AMParent: 134d423c26820a78c6bbfbc506df577e0673b6b2
Files changed
modules/tabs.js | changed |
modules/tabs.js | ||
---|---|---|
@@ -1,5 +1,5 @@ | ||
1 | -var tabs = require('tabs') | |
1 | +var Tabs = require('hypertabs') | |
2 | 2 | var h = require('hyperscript') |
3 | 3 | var pull = require('pull-stream') |
4 | 4 | var u = require('../util') |
5 | 5 | |
@@ -16,24 +16,27 @@ | ||
16 | 16 | return fn(path, sbot) |
17 | 17 | }) |
18 | 18 | } |
19 | 19 | |
20 | - var t = tabs() | |
20 | + var tabs = Tabs() | |
21 | 21 | var main = screen('/') |
22 | - if(main) t.add('main', main, true) | |
22 | + if(main) tabs.add('main', main, true) | |
23 | 23 | |
24 | - t.onclick = function (ev) { | |
24 | + tabs.onclick = function (ev) { | |
25 | 25 | var link = ancestor(ev.target) |
26 | - EV = ev | |
27 | 26 | var path = link.hash.substring(1) |
28 | - var el = screen(path) | |
29 | - if(el) t.add(path, el, !ev.ctrlKey) | |
30 | 27 | |
31 | 28 | ev.preventDefault() |
32 | 29 | ev.stopPropagation() |
30 | + | |
31 | + if(tabs.has(path)) return tabs.select(path) | |
32 | + | |
33 | + var el = screen(path) | |
34 | + if(el) tabs.add(path, el, !ev.ctrlKey) | |
35 | + | |
33 | 36 | } |
34 | 37 | |
35 | - return t | |
38 | + return tabs | |
36 | 39 | } |
37 | 40 | |
38 | 41 | exports.message_render = [] |
39 | 42 | exports.screen_view = [] |
@@ -42,4 +45,6 @@ | ||
42 | 45 | |
43 | 46 | |
44 | 47 | |
45 | 48 | |
49 | + | |
50 | + |
Built with git-ssb-web