Unverified Commit f9bc80b1 authored by Aral Balkan's avatar Aral Balkan
Browse files

Now smoothly scrolling to added message in Public timeline.

parent 790b3a0c
......@@ -7,6 +7,30 @@ window.addEventListener('load', function(){
// Listen for mutations on messages so that we can intelligently respond to them.
// e.g., scroll to show a message when one arrives.
var mutationObserver = new MutationObserver(function(mutations){
if(mutation.type == "childList") {
var addedNodes = mutation.addedNodes;
var forEach = Array.prototype.forEach;
forEach.call(addedNodes, function(node){
// Scroll the added node into view.
zenscroll.intoView(node, 750);
// Currently, we only care when the child list changes.
var mutationObserverOptions = {childList: true};
mutationObserver.observe(messages, mutationObserverOptions);
// console.log("Polling server for new public posts…")
......@@ -7,6 +7,7 @@
<link rel='stylesheet' href='/css/styles.css'>
<script type='text/javascript' src='/js/superagent.js'></script>
<script type='text/javascript' src='/js/moment.js'></script>
<script type='text/javascript' src='/js/zenscroll.min.js'></script>
<script type='text/javascript' src='/js/set.js'></script>
<script type='text/javascript' src='/js/public.js'></script>
<script type='text/javascript' data-set-text='meta'></script>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment