git ssb

0+

mixmix / patchbay-mix



forked from Dominic / patchbay

Commit 234c41db32bb0bf918889f82ffac076f85332636

Merge branch 'hypertabs2'

Dominic Tarr committed on 9/4/2016, 8:26:41 PM
Parent: 11fc4a4c131af561b454a3251544add67c283036
Parent: db8d88fd5413a68147052d27c02367929d7d8bf9

Files changed

modules/feed.jschanged
modules/tabs.jschanged
package.jsonchanged
modules/feed.jsView
@@ -8,8 +8,9 @@
88 var plugs = require('../plugs')
99 var sbot_user_feed = plugs.first(exports.sbot_user_feed = [])
1010 var message_render = plugs.first(exports.message_render = [])
1111 var avatar_profile = plugs.first(exports.avatar_profile = [])
12+var signifier = plugs.first(exports.signifier = [])
1213
1314 exports.screen_view = function (id) {
1415 //TODO: header of user info, avatars, names, follows.
1516
@@ -23,8 +24,13 @@
2324 content
2425 )
2526 )
2627
28+ signifier(id, function (_, names) {
29+ if(names.length) div.title = names[0].name
30+ })
31+
32+
2733 pull(
2834 sbot_user_feed({id: id, old: false, live: true}),
2935 Scroller(div, content, message_render, true, false)
3036 )
@@ -47,6 +53,4 @@
4753
4854
4955
5056
51-
52-
modules/tabs.jsView
@@ -20,13 +20,20 @@
2020 exports.screen_view = function (path) {
2121 if(path !== 'tabs')
2222 return
2323
24+ function setSelected (indexes) {
25+ var ids = indexes.map(function (index) {
26+ return tabs.get(index).id
27+ })
28+ if(ids.length > 1)
29+ search.value = 'split('+ids.join(',')+')'
30+ else
31+ search.value = ids[0]
32+ }
33+
2434 var search
25- var tabs = Tabs(function (name) {
26- search.value = name
27-// sessionStorage.selectedTab = tabs.selected
28- })
35+ var tabs = Tabs(setSelected)
2936 // tabs.classList.add('screen')
3037
3138 search = search_box(function (path, change) {
3239 if(tabs.has(path)) {
@@ -35,9 +42,9 @@
3542 }
3643 var el = screen_view(path)
3744 if(el) {
3845 el.scroll = keyscroll(el.querySelector('.scroller__content'))
39- tabs.add(path, el, change)
46+ tabs.add(el, change)
4047 // localStorage.openTabs = JSON.stringify(tabs.tabs)
4148 return change
4249 }
4350 })
@@ -52,16 +59,17 @@
5259 saved = ['/public', '/private', '/notifications']
5360
5461 saved.forEach(function (path) {
5562 var el = screen_view(path)
63+ el.id = el.id || path
5664 if (!el) return
5765 el.scroll = keyscroll(el.querySelector('.scroller__content'))
58- if(el) tabs.add(path, el, false)
66+ if(el) tabs.add(el, false, false)
5967 })
6068
61-// tabs.select(sessionStorage.selectedTab || saved[0] || '/public')
62- tabs.select('/public')
69+ tabs.select(0)
6370
71+ //handle link clicks
6472 window.onclick = function (ev) {
6573 var link = ancestor(ev.target)
6674 if(!link) return
6775 var path = link.hash.substring(1)
@@ -72,14 +80,16 @@
7280 //open external links.
7381 //this ought to be made into something more runcible
7482 if(open.isExternal(link.href)) return open(link.href)
7583
76- if(tabs.has(path)) return tabs.select(path)
77-
84+ if(tabs.has(path))
85+ return tabs.select(path, !ev.ctrlKey, !!ev.shiftKey)
86+
7887 var el = screen_view(path)
7988 if(el) {
89+ el.id = el.id || path
8090 el.scroll = keyscroll(el.querySelector('.scroller__content'))
81- tabs.add(path, el, !ev.ctrlKey)
91+ tabs.add(el, !ev.ctrlKey, !!ev.shiftKey)
8292 // localStorage.openTabs = JSON.stringify(tabs.tabs)
8393 }
8494
8595 return false
@@ -97,19 +107,19 @@
97107 return tabs.selectRelative(1)
98108
99109 // scroll through messages
100110 case 74: // j
101- return tabs.selectedTab.scroll(1)
111+ return tabs.get(tabs.selected[0]).scroll(1)
102112 case 75: // k
103- return tabs.selectedTab.scroll(-1)
113+ return tabs.get(tabs.selected[0]).scroll(-1)
104114
105115 // close a tab
106116 case 88: // x
107- if (tabs.selected/* && tabs.selected[0] !== '/'*/) {
117+ if (tabs.selected) {
108118 var sel = tabs.selected
109- tabs.selectRelative(-1)
119+ var i = sel.reduce(function (a, b) { return Math.min(a, b) })
110120 tabs.remove(sel)
111-// localStorage.openTabs = JSON.stringify(tabs.tabs)
121+ tabs.select(Math.max(i-1, 0))
112122 }
113123 return
114124
115125 // activate the search field
@@ -154,4 +164,5 @@
154164 })
155165
156166 return tabs
157167 }
168+
package.jsonView
@@ -18,9 +18,9 @@
1818 "hyperfile": "^1.1.0",
1919 "hyperlightbox": "^0.1.3",
2020 "hyperprogress": "0.1.0",
2121 "hyperscript": "^1.4.7",
22- "hypertabs": "^1.2.0",
22+ "hypertabs": "^2.1.0",
2323 "is-visible": "^2.0.4",
2424 "map-filter-reduce": "^3.0.1",
2525 "mime-types": "^2.1.11",
2626 "moment": "^2.13.0",

Built with git-ssb-web