Commit d928b22155525d8610fb58f2f596dfec784b2ce6
show the current location when switching tabs
Dominic Tarr committed on 7/6/2016, 10:03:08 AMParent: 32011eddea31a79f8eee8156ba03dd32623a2578
Files changed
modules/tabs.js | changed |
modules/tabs.js | ||
---|---|---|
@@ -31,12 +31,15 @@ | ||
31 | 31 | |
32 | 32 | exports.message_render = [] |
33 | 33 | |
34 | 34 | exports.app = function () { |
35 | - var tabs = Tabs() | |
35 | + var search | |
36 | + var tabs = Tabs(function (name) { | |
37 | + search.value = name | |
38 | + }) | |
36 | 39 | tabs.classList.add('screen') |
37 | 40 | |
38 | - var search = search_box(function (path, change) { | |
41 | + search = search_box(function (path, change) { | |
39 | 42 | if(tabs.has(path)) { |
40 | 43 | tabs.select(path) |
41 | 44 | return true |
42 | 45 | } |
@@ -47,8 +50,9 @@ | ||
47 | 50 | localStorage.openTabs = JSON.stringify(tabs.tabs) |
48 | 51 | return change |
49 | 52 | } |
50 | 53 | }) |
54 | + | |
51 | 55 | tabs.insertBefore(search, tabs.querySelector('.hypertabs__content')) |
52 | 56 | |
53 | 57 | var saved = [] |
54 | 58 | try { saved = JSON.parse(localStorage.openTabs) } |
@@ -70,10 +74,10 @@ | ||
70 | 74 | var link = ancestor(ev.target) |
71 | 75 | if(!link) return |
72 | 76 | var path = link.hash.substring(1) |
73 | 77 | |
78 | + ev.stopPropagation() | |
74 | 79 | ev.preventDefault() |
75 | - ev.stopPropagation() | |
76 | 80 | |
77 | 81 | //open external links. |
78 | 82 | //this ought to be made into something more runcible |
79 | 83 | if(/^https?/.test(link.href)) return openExternal(link.href) |
@@ -159,9 +163,4 @@ | ||
159 | 163 | return tabs |
160 | 164 | } |
161 | 165 | |
162 | 166 | |
163 | - | |
164 | - | |
165 | - | |
166 | - | |
167 | - |
Built with git-ssb-web