StatusNet Querycards

Tags:

Inspired by the Hovercards feature part of the StatusNet JavaScript API plugin, I wrote a small jQuery plugin that does a very similar thing.

There are two main reasons I wanted to write this:

  1. It's standalone (as long as you include jQuery on your page, of course).
    You don't need to install a StatusNet plugin on your instance, fiddle with OAuth, etc.
  2. It works with Remote Users
    Currently, the hovercards part of the JavaScript API only appear for users on the instance the plugin is installed on.

To use it, you need a link that has an @-mention as text. Then, target it or its container with jQuery:

1
2
3
4
5
6
<div class="hovercard">
  <a href="http://identi.ca/x11r5">@x11r5</a>
</div>
<script>
  $('.hovercard').SnHoverCard();
</script>

Will result in (hover your mouse over the link):

Now the next step is to tweak the code generated by EmbedNotice so that it works with Querycards.

In the meantime, you can always manually modify the HTML so that the mentions are in the proper format: <a href="http://example.com/username">@username</a>.

@cwebber Do they run on a dishwasher

As always, code's on Github.

Character Count for SN Instances with ‘any length’ Notices

Tags:

I have my StatusNet instance setup to allow notices of any length. Most of the time, however, I do try to limit my own notices to 140 characters or less (I tend to ramble needlessly otherwise).

One problem with this setup is that the web interface doesn't show the character count when there is no limit on length. This makes sense since the character count is intended to show the remaining number of characters allowed before truncation. This is suboptimal in my situation because I have to open up an external editor to view if I'm over 140 characters or not.

So I fixed it (well okay, it's more of a quick hack than a real fix, but still...). The following changes makes the textbox show the number of characters typed (instead of remaining number of characters) when there is no limit.

In /js/util.js, change this:

150
151
152
153
154
155
            if (MaxLength <= 0) {
                return;
            }
 
            var remaining = MaxLength - SN.U.CharacterCount(form);
            var counter = form.find('.count');

To this:

150
151
152
153
154
155
            var remaining = MaxLength - SN.U.CharacterCount(form);
            var counter = form.find('.count');
 
            if (MaxLength <= 0) {
                remaining = Math.abs(remaining);
            }

Then, run "make" in the "js" folder to minify the changes.
Alternatively, you can get the minified file here.

In /lib/noticeform.php change this:

218
219
220
221
222
            if ($contentLimit > 0) {
                 $this->out->element('span',
                                     array('class' => 'count'),
                                     $contentLimit);
            }

To this:

218
219
220
221
222
//            if ($contentLimit > 0) {
                 $this->out->element('span',
                                     array('class' => 'count'),
                                     $contentLimit);
//            }

You should have character count back in the notice forms. \o/ !

EmbedNotice

Tags: ,

I started working on a simple StatusNet plugin tonight that adds an icon to each notice. Clicking the icon allows visitors to get the necessary HTML to embed a notice on a webpage.

The code is on Github but I pretty much just started and not it's very polished. You have been warned ;)

Here's the extra icon on the timeline:

Timeline

Timeline

Here's the dialog with the HTML code to copy/paste:

Dialog

Dialog

Here's the result when pasted on this blog:

huh? It's only 21:00? Time for !coffee

Later!

Collapse StatusNet Threads

Tags:

A couple of days ago, I saw this:
Identica notice by laroquod saying: What I wouldn't give for a "collapse all threads in the Home timeline" command… I thought this:
challenge accepted And wrote this:

Bookmarklet

Drag this to your bookmark bar: Collapse threads

This is the human readable code for the above:

1
2
3
4
5
6
7
8
9
10
11
var elems = document.getElementsByClassName('threaded-replies');
for (var i=0; i<elems.length; i++) {
    var notices = elems[i].getElementsByClassName('notice');
    for (var j=0; j<notices.length; j++) {
        notices[j].style.display = 'none';
    }
    notices = elems[i].getElementsByClassName('notice-repeats');
    for (j=0; j<notices.length; j++) {
        notices[j].style.display = 'none';
    }
}

Username likes this

The ReverseFavs plugin for StatusNet has been updated to show who favored each notice ("$user and $user like this"):

The plugin now shows who favored each notice

The plugin now shows who favored each notice

Yay!

ReverseFavs

Very similar to BookmarkList plugin, this one, "ReverseFavs", adds a "Reverse Favs" link in the left-nav of your StatusNet profile. Clicking it will bring you to a page that displays which one of your notices were favored by others.

TODO: I need to add "$user and $user like this" after each notice to show who favored what.

BookmarkList Update

The BookmarkList plugin has been updated to match the behavior of other types of timelines/streams (ex: "favorites" stream):

  • On multi-user instances, the URL is now "username/bookmarks"
    (The URL remains unchanged for single-user instances: "/bookmarks")
  • You can now view another user's bookmarks by visiting their bookmark stream with the above URL
  • You no longer need to be logged in to view a bookmark stream

List your StatusNet Bookmarks

Ever noticed how your StatusNet Bookmarks seem to disappear in the land of /dev/null after a while? Well no more! With this tiny plugin, you'll be able to retrieve them in a comprehensive list simply by visiting "/bookmarks" on your SN instance (see instructions in the README).

Note: This is currently a quick hack. I need fix and add a few things (like pagination) but it works...

2012/07/15 Update: The plugin now uses a "real" stream, which prints out navigation and other goodies (reply, fav, etc.).

TwitterBridge

Tags:

I've enabled the TwitterBridge plugin on my StatusNet instance a couple of days ago and following the instructions in the README got my notices pushed over to Twitter, but importing my Twitter-friends tweets into my StatusNet timeline didn't work.

When running 'scripts/startdaemons.sh', I would get:

Fatal error: Uncaught PEAR_Exception: DB Error: no database selected in unknown on line unknown DB_Error: DB Error: no database selected in unknown on line unknown

Searching around, I found a couple of threads suggesting to change "mysqli.reconnect = Off" to "mysqli.reconnect = On" in the "php.ini" file used by PHP but that wasn't working for me. What seemed to work was changing $config['db']['database'] from 'mysqli://[...]' to 'mysql://[...]' in StatusNet's "config.php" as suggested here.

I'm not exactly sure what this changes in the backend, but everything seems to be working okay.

2012/04/15 Update: I've also applied these two patches by @jbafvre