git ssb

16+

Dominic / patchbay



Commit c9b2708a2c9961e39c5c2370d526d929215013df

Factor keyscroll usage out of feeds into tabs

Charles Lehner committed on 6/27/2016, 6:37:03 PM
Parent: 437facf41d277081453b193b5e9cc808704399ef

Files changed

keyscroll.jschanged
modules/feed.jschanged
modules/private.jschanged
modules/public.jschanged
modules/tabs.jschanged
modules/thread.jschanged
keyscroll.jsView
@@ -1,7 +1,10 @@
11 module.exports = function (container) {
22 var curMsgEl
33
4+ if (!container)
5+ return function() {}
6+
47 container.addEventListener('click', onActivateChild, false)
58 container.addEventListener('focus', onActivateChild, true)
69
710 function onActivateChild(ev) {
modules/feed.jsView
@@ -3,9 +3,8 @@
33 var Scroller = require('pull-scroll')
44 var h = require('hyperscript')
55 var pull = require('pull-stream')
66 var u = require('../util')
7-var keyscroll = require('../keyscroll')
87
98 var plugs = require('../plugs')
109 var sbot_user_feed = plugs.first(exports.sbot_user_feed = [])
1110 var message_render = plugs.first(exports.message_render = [])
@@ -39,10 +38,8 @@
3938 }, ['value', 'sequence']),
4039 Scroller(div, content, message_render, false, false)
4140 )
4241
43- div.scroll = keyscroll(content)
44-
4542 return div
4643
4744 }
4845 }
modules/private.jsView
@@ -2,9 +2,8 @@
22 var ui = require('../ui')
33 var u = require('../util')
44 var pull = require('pull-stream')
55 var Scroller = require('pull-scroll')
6-var keyscroll = require('../keyscroll')
76 var ref = require('ssb-ref')
87
98 var plugs = require('../plugs')
109
@@ -63,10 +62,8 @@
6362 if(err) throw err
6463 })
6564 )
6665
67- div.scroll = keyscroll(content)
68-
6966 return div
7067 }
7168 }
7269
modules/public.jsView
@@ -2,9 +2,8 @@
22 var ui = require('../ui')
33 var u = require('../util')
44 var pull = require('pull-stream')
55 var Scroller = require('pull-scroll')
6-var keyscroll = require('../keyscroll')
76
87 var plugs = require('../plugs')
98 var message_render = plugs.first(exports.message_render = [])
109 var message_compose = plugs.first(exports.message_compose = [])
@@ -31,10 +30,8 @@
3130 u.next(sbot_log, {reverse: true, limit: 100, live: false}),
3231 Scroller(div, content, message_render, false, false)
3332 )
3433
35- div.scroll = keyscroll(content)
36-
3734 return div
3835 }
3936 }
4037
modules/tabs.jsView
@@ -1,8 +1,9 @@
11 var Tabs = require('hypertabs')
22 var h = require('hyperscript')
33 var pull = require('pull-stream')
44 var u = require('../util')
5+var keyscroll = require('../keyscroll')
56
67 function ancestor (el) {
78 if(!el) return
89 if(el.tagName !== 'A') return ancestor(el.parentElement)
@@ -38,8 +39,9 @@
3839 catch (_) { saved = ['/public', '/private'] }
3940
4041 saved.forEach(function (path) {
4142 var el = screen_view(path)
43+ el.scroll = keyscroll(el.querySelector('.scroller__content'))
4244 if(el) tabs.add(path, el, true)
4345 })
4446
4547 tabs.select(saved[0] || '/public')
@@ -59,8 +61,9 @@
5961 if(tabs.has(path)) return tabs.select(path)
6062
6163 var el = screen_view(path)
6264 if(el) {
65+ el.scroll = keyscroll(el.querySelector('.scroller__content'))
6366 tabs.add(path, el, !ev.ctrlKey)
6467 localStorage.openTabs = JSON.stringify(tabs.tabs)
6568 }
6669 }
modules/thread.jsView
@@ -5,9 +5,8 @@
55 var ref = require('ssb-ref')
66 var h = require('hyperscript')
77 var u = require('../util')
88 var Scroller = require('pull-scroll')
9-var keyscroll = require('../keyscroll')
109
1110 function once (cont) {
1211 var ended = false
1312 return function (abort, cb) {
@@ -104,9 +103,8 @@
104103 })
105104 }
106105
107106 loadThread()
108- div.scroll = keyscroll(content)
109107 return div
110108 }
111109 }
112110

Built with git-ssb-web