Singpolyma

Archive of "Hack"

Archive for the "Hack" Category

Blogger BETA

Posted on

Blogger BETA has launched and with it comes many new features and challenges for us as hackers. I’m slow on the draw for this one. I was on a trip when the whole thing came down and am just now catching up. FreshBlog, as always, has the scoop extrordinaire. Much good stuff over there… I wish they had some sort of ‘blogger-beta’ tag for all of it (or tagged it all both blogger and beta) so I could link to the category list (hint, hint 😉 ).

I’m not going to give a rundown of all the new stuff, but instead am going to give a ‘so what’ as relates to my stuff.

Busted Hacks
I’m going to be creating a test Blogger BETA account soon and trying to fix up hacks that don’t work there. However, from what I’m hearing it seems that there is no HTML editing in the new template system, and I don’t want to spend work making the old hacks work on the old template system for the new Blogger (that’s a mouthful!). I’d rather wait until hacks can be implemented in their own right on the new system. More on this when something happens.

Blogger Recent Comments
Is dead. Full stop. No question there. Blogger BETA has comment feeds. I will keep the app running, however, for people who have not upgraded yet (like me!) and just for reference.

FreshTags
Both the main FreshTags and my version are far from dead. Just as FreshTags features are useful on WordPress, where there was already a category system, so they will continue to live on here on Blogger. Since it’s not my baby, I won’t say too much, but we are certainly discussing the best way to move forward in this area. For now, I have upgraded my version to support incoming ?labels= from other blogs, and also to use that locally (still supporting ?tags= from old FreshTags and FreshTags for WordPress). If you are on Blogger BETA and want to use FreshTags ‘as is’ (provided you can get the script to work…) the following code will use the proper label display page instead of the ‘fake post’ for post display:

<script type=”text/javascript”>var freshtags_tag_url = “/search”;</script>

Upgrades to the Greasemonkey script should also be forthcoming.

Update
Have created a BETA test blog and I have a mixed reaction. The new templates interface is nice, and as long as they get HTML editing working for it, it should be über cool. Some of the new button graphics are uglier, and the post published page doesn’t seem to have the details on it anymore (because of the dynamism), which will cause problems for the GM world… the JS/XHTML module funcitonality is nice though — hacks will make use of that! (perhaps even FT?)

Blogger del.icio.us categorising, pinging, and trackback helper

Posted on

I have a version of this script for the new Blogger as well.

Many people have installed Johan Sundström’s del.icio.us Categoriser Script and reaped the benefits. Some have also used my trackback script to enable outbound trackback inside Blogger. Now the power of these two scripts comes together to benefit everyone!

With Johan’s full approval I have married the two scripts into one categoriser and trackback script. This script is set up in such a way that installing it should overwrite any previous installation of Johan’s script and keep your existing script settings. To find out more about the categorising and pinging functions of the script, please read Johan’s post.

The trackback features work slightly differently than they did in my previous script. On the post-create page there is now a ‘Trackback’ textarea, instead of a form on the ‘post complete’ page. Enter one or more trackback URLs (each on it’s own line in the textarea) to use the trackack feature. After publishing the post your trackbacks will be sent out automatically and the status will be displayed on the ‘post complete’ page. For more information on trackback, go to Wikipedia.

There are also a couple minor new features for the categorising in this release. One is the option to use the first 200 characters of the post body in the extended field on del.icio.us, instead of the datestamp. The ‘Tags:’ label that one clicks to change settings is now blue, and your cursor should change into a hand when hovering it. Also, when republishing your whole blog the link to del.icio.us from your last post will not be displayed.

Install the Greasemonkey Script

Asynchronous FreshTags

Posted on

I have updated my version of FreshTags to include support for asynchronous loading of posts. Now if you add the following code to your template:

<script type=”text/javascript”>var freshtags_tag_format = “drop-add-async”;</script>

Instead of the drop-down box taking you over to the tags post page it will load the posts for the tag combination for you asynchronously in the sidebar.

A nice side-benefit of this is that you may now use all the other FreshTags tag-list types (except custom), including flat, flat-multi, list, list-multi, scroll, drop, and sub. Just put them in the above code where I have ‘drop-add-async’.

You will have to be using the jscripts.ning.com version of my FreshTags implementation for this to work, instead of the old one hosted on AWriterz. The code for the new include (which you can replace the old one with to upgrade) is:

<script type=”text/javascript” src=”http://jscripts.ning.com/get.php?xn_auth=no&amp;id=818185

Last Updated Posts

Posted on

Aditya of The Last Word has made a very useful discovery — the new Blogger RSS feeds are ordered by last update! This means that when you make an edit on an old post, that post is moved to the top of your RSS feed! The use for this immidiately becomes apparent : a widget for showing which posts have been updated recently!

Based off of a quick hack Aditya threw together I have developed some reuseable code to just this end. I have it running asynchronously in my sidebar under the ‘Previous Posts’ heading. When you first load the page (or if you have JavaScript turned off) the normal Blogger-generated ‘Previous Posts’ list is displayed. After the page has loaded, if you have JavaScript on, the list will update to a list of the most recently updated posts.

So, on to the code! There are two versions of this hack : synchronous and asynchronous. If you want it to run synchronously (that is, the page waits for the hack to finish before it continues to render) place the following code where you want the widget to appear:

<script type=”text/javascript” src=”http://jscripts.ning.com/get.php?xn_auth=no&amp;id=1317016;
<script type=”text/javascript”>
//<![CDATA[
do_updated_posts(‘<$BlogURL$>’,”,5);
//]]>
</script>

You can change the 5 to whatever number of posts you want in the list. Save and republish : you’re done!

If you want it to run asynchronously (the page loads before the hack does), insert the following code into your <head> section:

<script type=”text/javascript” src=”http://jscripts.ning.com/get.php?xn_auth=no&amp;id=1317016;
<script type=”text/javascript”>
//<![CDATA[
addLoadEvent(function(){do_updated_posts(‘<$BlogURL$>’,’last_updated_posts’,5);});
//]]>
</script>

Again, you can change the 5 to whatever number of posts you want in the list. Then, insert the following code where you want the list to display:

<div id=”last_updated_posts”><i>Loading…</i></div>

Save and republish. You’re done!

The whole way this works may just be a bug in the rss.xml generating engine. If it is, this hack will stop working when they fix it, since it is dependant on the order of items in rss.xml.

Asyncronous Archives

Posted on

This hack combines two popular archive hacks with a new functionality in the same script. The two popular hacks included are the displaying of archive post counts in the archive list, and the re-ordering of the archive list. These two can be applied using the script with or without the third, new, functionality with is asyncronous loading of archives into the sidebar. If you don’t know what that means, try it out in my sidebar. Select an archive from the drop-down and notice that instead of being taken to the archive page, the posts in that archive are listed for you right in the sidebar. The steps to implement either part of this hack follow:

  1. Edit your blog template and add the following code directly after the <body> tag:
    <ArchivePage>
    <!– START ARCHIVE XOXO –>
    <ul class=”xoxo posts” style=”display:none;”>
    <Blogger><li><a href=”<$BlogItemPermalinkUrl$>”><BlogItemTitle><$BlogItemTitle$></BlogItemTitle></a></li></Blogger>
    </ul>
    <!– END ARCHIVE XOXO –>
    </ArchivePage>

    Note: if you have your blog marked up using hAtom or the XOXO Blog Format this step is unnecessary.

  2. Add the following code into your sidebar where you want the archive list to display:
    <div id=”archive_list”><i>Loading Archives…</i></div>
    <div id=”archive_display”></div>
    <noscript>
    <ul class=”archive-list”><BloggerArchives>
    <li><a href=”<$BlogArchiveURL$>”><$BlogArchiveName$></a></li>
    </BloggerArchives></ul>
    </noscript>

    Note to advanced users. The noscript section is necessary. You can edit it, but only if you pass two additional parameters to the function in the next step containing the code starting the list and ending the list.

  3. Add the following code into your <head> section:
    <script type=”text/javascript” src=”http://jscripts.ning.com/get.php?xn_auth=no&amp;id=1286814;
    <script type=”text/javascript”>
    //<![CDATA[
    addLoadEvent(function(){get_archive_list(‘archive_list’,’archive_display’,’format‘,sort);});
    //]]>
    </script>

    Where format is drop if you want a drop-down archive list or list if you want the archives displayed in an unordered list. sort is true to sort the archive list oldest-to-newest and false to sort newest-to-oldest.

    If you want the archive list to link to the archive pages instead of loading in the sidebar then delete the archive_display text from the code above.

  4. Save your template and republish your blog.

Advanced users may be interested in the information on the scripts behind this.