Singpolyma

Archive of "Comment"

Archive for the "Comment" Category

Content Publishing Protocol

Posted on

Since APP (understand here) is mainlined in WordPress, it makes sense to use it in DiSo efforts.  I doubt that my OAuth plugin will work here, but it’s worth testing.  It may mean using headers, but with comment and discovery support we should be able to build a distributed commenting system, at least for WordPress.

I’ve thought about other APIs that would be useful for DiSo.  For example, adding friends or groups.  APP does not fit this, but the general concepts do.  Perhaps APP can be abstracted into more of a CPP.

GET on main endpoint to list items (ATOM can always be the main wrapper here).

POST to main endpoint to create new items.

PUT to node to edit.

DELETE to node to delete.

Authentication unspecified (HTTP Basic or OAuth work well).

If the content of your POST and PUT requests is ATOM, you have AtomPub.  The same basics can easily work with other content.  (The other content types could be encapsulated in ATOM entry bodies on the GET list, or XOXO).

For example, a POST body of XFN+hCard could add a friend.  A PUT body of hCard could edit a profile (ie, to add groups).

I would also like to suggest that POST on a node could be used to add comments (create new content on a content node).

New Comment Photo Hack (Blogger)

Posted on

By demand, I have added a maxheight option to this hack as well, it works the same way as maxwidth 🙂

Some people have really liked my comment photos and highlighting hack. Many have hated it. Especially since the move to the new Blogger, the hack is just unstable and difficult to implement or understand. Even my own implementation (before the move) was doing odd things.

So I decided that a complete rewrite was in order. The old scripts are still intact, but this new hack uses none of the old code. This hack does only comment author photos (highlighting is better handled other ways in the new Blogger).

This hack is 100% compatible with the newest version of my asynchronous peek-a-boo comments.

Without further ado, the instructions:

  1. Go to ‘Edit HTML’ under Template and check the ‘Expand Widget Templates’ box.
  2. Find the following code:

    <dl id='comments-block'>
    <b:loop values='data:post.comments' var='comment'>

    and insert the following code directly after it:

    <div style="clear:both">
    <dt style="float:left;margin-right:5px;clear:both;" expr:id='"commentphoto" + data:comment.id'></dt>
    <script type="text/javascript">if(typeof(commentPhotoIds) == 'undefined') var commentPhotoIds = []; commentPhotoIds.push({'id':'commentphoto<data:comment.id 'url':'<data:comment.authorUrl/>'});</script>
  3. If you go down a very small ways from where you were in the previous step you will see a </dl>. Directly before it insert the code: </div>
  4. Directly before the </body> code in your template add this code:

    <script type='text/javascript'>
    //<![CDATA[
    function commentPhotoDo() {
    var tag;
    for(var i in commentPhotoIds) {
    tag = document.createElement('script');
    tag.type = 'text/javascript';
    tag.src = 'http://scrape.singpolyma.net/avatar.php?maxwidth=70&url='+encodeURIComponent(commentPhotoIds[i].url)+'&id='+encodeURIComponent(commentPhotoIds[i].id)+'&defaultimage='+encodeURIComponent('http://img139.imageshack.us/img139/1011/defaultavatarad7.png');
    document.body.appendChild(tag);
    }//end for var i in commentPhotoIds
    }//end function commentPhotoDo
    commentPhotoDo();
    //]]>
    </script>
  5. Save your template

My fellow hackers will not like the way I did the second-to-last step. I should be using window.onload. I am not simply because in the tests I did on a certain much-hacked template, this worked and the other didn’t. I am not prepared to say why the other didn’t, only that it didn’t and that disturbed me. So for this hack I’m doing it like this. It works.

This hack causes direct hits to my singpolyma.net hosting server every time a page loads. If your blog gets a significant amount of viewers (>300 subscribers or thereabouts) I would ask that you contact me before installing this hack so that we can work out whether it will be a bandwidth issue or not. Thank you for understanding.

For New Blogger : Blogger del.icio.us categorising, pinging, and trackback helper

Posted on

JoongSeob Vito Kim has created a version of this script that works with the new blogger post editor.

I have made some minor bug fixes to this script, as well as made it so that it saves the trackback URLs when you save a draft. I took time to fix it, but now my website silverringthing.org.uk is back to normal.

Some time ago I married Johan’s del.icio.us and pinging script with my own trackback script into one new script. That script does not work on the new version of Blogger, and the trackback feature has been glitchy for some time. Outgoing trackback is still something we need on the new version of Blogger, and the pinging services provided by this script might even be useful on other blogging services. Del.icio.us posting? Now that we have labels? Well, Freshtags, my calendar widget, and just tag management in general, will work better if you use del.icio.us. If you disagree, this part of the script is optional.

This script does not overwrite the old script. Running both simultaneously will look dumb on the Blogger Classic interface (there will be duplication), but will not break anything. If you only run on the new Blogger, please remove the old script (if you have it installed).

Install the new script

Userscripts.org entry

Peek-a-boo Update

Posted on

My peek-a-boo comments for BETA hack has been updated to use the new native JSONP. It should run faster now and the IE bug some were reporting should be gone.