Quick and dirty hack to add new users and tags
authorChip Black <bytex64@bytex64.net>
Thu, 13 Jan 2011 12:11:03 +0000 (04:11 -0800)
committerChip Black <bytex64@bytex64.net>
Mon, 17 Jan 2011 09:36:13 +0000 (01:36 -0800)
www/index.html
www/js/blerg.js

index cd0bfc3..20dc6e0 100644 (file)
   </div>
 
   <div id="welcome">
+
+  <div style="float: right; width: 25%; margin: 0 0 8pt 8pt">
+  <h2>Quick and dirty hack to show recent tags</h2>
+  <div id="newtags"></div>
+
+  <h2>And here are some users with recent activity</h2>
+  <div id="newusers"></div>
+  </div>
+
   <h2>I am 12 and what is this</h2>
 
   <p>BlĂ«rg is a microblogging platform.  Or maybe a miniblogging
index 4d56790..205c5a9 100644 (file)
@@ -79,6 +79,7 @@ LoginStatus.prototype.update = function() {
     if (this.loggedIn) {
         $('userlink').href = '/#' + this.username;
         $('userlink').update('@' + this.username);
+        $('reflink').href = '/#ref/' + this.username;
         $('login').hide();
         $('logout').show();
     } else {
@@ -202,7 +203,6 @@ User.prototype.show = function() {
     $$('[name=section]').each(function(v) { v.update(' @' + this.username) }.bind(this));
     $('welcome').hide();
     items.show();
-    $('reflink').href = '/#ref/' + this.username;
     $('rss').show();
     $('rsslink').href = '/rss/' + this.username;
 }
@@ -402,6 +402,32 @@ function resizePostContent() {
     }, 150);
 }
 
+function loadNewThings() {
+    new Ajax.Request(baseURL + '/newtags.json', {
+        onSuccess: function(r) {
+            $('newtags').update();
+            r.responseText.evalJSON().each(function(v) {
+                var a = new Element('a', {href: '/#tag/' + v});
+                a.insert('#' + v);
+                $('newtags').insert(a);
+                $('newtags').insert(new Element('br'));
+            });
+        }
+    });
+
+    new Ajax.Request(baseURL + '/newusers.json', {
+        onSuccess: function(r) {
+            $('newusers').update();
+            r.responseText.evalJSON().each(function(v) {
+                var a = new Element('a', {href: '/#' + v});
+                a.insert('@' + v);
+                $('newusers').insert(a);
+                $('newusers').insert(new Element('br'));
+            });
+        }
+    });
+}
+
 function hashSwitch() {
     var m;
     if (m = location.search.match(/^\?post\/([^/]+)\/(.+)/)) {
@@ -437,6 +463,7 @@ function hashSwitch() {
         $('older_link').hide();
         $('welcome').show();
         $('rss').hide();
+        loadNewThings();
     }
 }