Singpolyma

New Inline Comments Form

Posted on

See this page for a similar hack for the new version of Blogger.

This hack does not work with Blogger BETA.

After considerable use and some feedback from both users and implementors I have redone my inline comments form hack. The new hack should be simpler, cleaner, and XHTML-valid. Previous implementors will have to remove the old hack before continuing.

You might also wish to check out the asynchronous version of this hack 🙂

This hack is now coComment-compatible.

  1. Word verification for comments must be turned off (to do this go to the ‘comments’ tab in your blog settings, scroll to ‘Show word verification for comments?’ and select ‘No’)
  2. Turn comment posting by anonymous users on (to do this go to the ‘comments’ tab in your blog settings, scroll to ‘Who Can Comment?’ and select ‘Anyone’)
  3. Insert the following code into the <head> section of your blog template :
    <script type=”text/javascript”>
    //<![CDATA[

    function toggleitem(postid,linkid,newtxt,displaytype) {
    if(!displaytype) {displaytype = ‘block’;}
    var whichpost = document.getElementById(postid);
    if (whichpost.style.display != “none”) {
    whichpost.style.display = “none”;
    } else {
    whichpost.style.display = displaytype;
    }
    if(linkid) {
    var lnk = document.getElementById(linkid);
    lnk.href = “javascript:toggleitem(‘”+postid+”‘,'”+linkid+”‘,'”+lnk.innerHTML+”‘);”;
    lnk.innerHTML = newtxt;
    }
    }

    //]]>
    </script>

  4. Replace the <$BlogItemCreate$> tag with the following code:
    <!– COMMENT FORM –>
    <ItemPage>
    <script type=”text/javascript”>

    var blogTool = “Blogger”;
    var blogURL = “<$BlogURL$>/”;
    var blogTitle = “<$BlogTitle$>”;
    var postURL = “<$BlogItemPermalinkUrl$>”;
    var postTitle = “<BlogItemTitle><$BlogItemTitle$></BlogItemTitle>”;
    var commentAuthorFieldName = “anonName”;
    var commentAuthorLoggedIn = “false”;
    var commentFormID = “cformtag<$BlogItemNumber$>”;
    var commentTextFieldName = “postBody”;
    var commentButtonName = “post”;
    var cocomment_force = false;

    </script>

    <script type=”text/javascript” src=”http://www.cocomment.com/js/cocomment.js </script>
    </ItemPage>
    <ItemPage><a href=”javascript:toggleitem(‘cform’);”>Post a Comment</a>
    <div style=”display:block;” id=”cform”></ItemPage>
    <MainOrArchivePage><a href=”javascript:toggleitem(‘cform<$BlogItemNumber$>’);”>Post a Comment</a>
    <div style=”display:none;” id=”cform<$BlogItemNumber$>”></MainOrArchivePage>
    <form action=”http://www.blogger.com/login-comment.do onsubmit=”isSubmit=true;” method=”post”><div>
    <input type=”hidden” name=”blogID” value=”<$BlogID$>” />
    <input type=”hidden” name=”postID” value=”<$BlogItemNumber$>” />
    <div>
    <h2 class=”sidebar-title form-title”><label class=”cbody”>Leave your comment </label></h2>
    <h2 class=”sidebar-title”> You can use some HTML tags, such as <b> &lt;b&gt;, &lt;i&gt;, &lt;a&gt; </b> </h2>
    <textarea name=”postBody” class=”comment” rows=”8″ cols=”40″></textarea>
    <h2 class=”sidebar-title identity”> Choose an identity </h2>
    <div>
    <div>
    <input type=”radio” name=”iden” value=”Blogger” checked=”checked” onchange=”toggleitem(‘cfo<$BlogItemNumber$>’);” />
    <label> Your Blogger display name </label>
    </div>
    <div>
    <input type=”radio” name=”iden” value=”Other” onchange=”toggleitem(‘cfo<$BlogItemNumber$>’);” />
    <label>Other</label>
    <div style=”display:none;” id=”cfo<$BlogItemNumber$>”>
    <table style=”margin-left: 4em;” cellpadding=”0″ cellspacing=”0″>
    <tr> <td colspan=”2″ style=”padding-top:.4em;position:relative;left:-4em;” align=”left”> These fields are optional, but I would appreciate it if you filled them out. </td></tr>
    <tr> <td> <label> Name </label> </td>
    <td> <div class=”errorbox-good”> <input type=”text” name=”anonName” value=”” maxlength=”100″ class=”text” /> </div> </td> </tr>
    <tr> <td> <label> Your web page </label> </td>
    <td> <div class=”errorbox-good”> <input type=”text” name=”anonURL” value=”” maxlength=”100″ class=”text” /> </div> </td> </tr>
    </table>
    </div>
    </div>
    <div class=”diff-user”> Or you can sign in <a href=”http://www.blogger.com/login.g?r=http%3A%2F%2Fwww.blogger.com%2Fcomment.g%3FblogID%3D;$BlogID$>%26postID%3D<$BlogItemNumber$>”> as a different user</a>.</div>
    </div>
    </div>
    <div class=”errorbox-good”> </div>
    <p class=”buttons”>
    <input style=”margin-right:.3em” name=”post” value=”Publish Your Comment” class=”publish” onclick=”isSubmit=true;” type=”submit” tabindex=”2″ />
    <input value=”Preview” type=”submit” name=”preview” onclick=”isSubmit=true;” tabindex=”3″ />
    </p>
    </div></form>
    </div>
    <!– END COMMENT FORM –>

  5. Save your template and republish your blog

XOXO Developer’s Resources

Posted on

This is a collection of code resources and APIs for developers looking to work with XOXO in their scripts/applications. There isn’t much here yet, but the list will grow over time.

PHP
On some of these, the comments may state that attributes of the first node are considered to be metadata for the entire outline. This is actually up to the developer and the format of XOXO being parsed as there is nothing in the code to facilitate/enforce it.

  • Outline Classes [GPL] — A set of PHP4 and PHP5 comatible classes for both parseing and creating outline data, including XOXO, OPML, hAtom, JSON, and arbitrary XML.

The following, deprecated APIs, have been replaced by the Outline Classes

  • xoxo2array [GPL] — pass in any string containing XOXO data and it will return a nested array of the results. String indexes are considered attributes, numeric indexes are subnodes.
  • array2xoxo [GPL] — takes an array of the type returned by xoxo2array and returns an XOXO string of the data. It will also work with simple arrays.
  • There are also other APIs for working with this array type (for conversion purposes, etc)

Python

Java

  • XOXOWriter.java [Apache 2.0] — Contains two (overloaded) functions, makeXOXO and toXOXO, that create XOXO data from Lists and create XOXO documents from XOXO data, respectively
  • XOXOParser.java [Apache 2.0] — Contains a class definition for objects that parse XOXO data into themselves

! HAPPY NEW YEAR !

Posted on

How was your’n? Stayed up allll the night did we. The whole station (which now consists of Bromans, us, and Aunt Metchtild — hoyts coming in for a week starting today, crosses too) and the Ezels got together in the dorm for an all nighter. We had pizza and pizza and LOTS of pizza (don’t ask me how many pieces I ate, I lost count), then snacked for the rest of the night (food keeps you awake). We played UNO Attack for quite awhile (hours and many rounds). It’s just like UNO — only with different special cards and a card-launcher instead of a draw pile (the card launcher sometimes launches 5 instead of the normal drawing one — ouch!). Then we watch The Incredibles, which, incidentally, is an awesome movie 😀 I had watched it (it’s mine, got for Christmas) with my family last week, but the Bromans and Ezels hadn’t seen it. Emme Ezel is soooooo cute 😀 I love babies, hehe, luvluvluv 😀 hmmm…. not much else going on around here — although there might be when the Hoyts get here this afternoon, one never does know.

There was actually something else I was going to say… but I forget what it was… besides that Dan had to go to NDJ with dad today for dental work (cavity he) and won’t be back for a week… I know there was something else…. ah, well… until next time 🙂

XOXO Blog and Template

Posted on

I have started the XOXO Blog for the promotion of the XOXO microformat. (For those wondering what XOXO is, see my post What is XOXO?) The blog’s template is fully XOXO-paresable and I am working on changeing over my Blogger Comment Syndication service to parse XOXO formated compatible with this new concept, which is only slightly different from my original XOXO code, but is more compatible with other uses. All users of my service will have to switch to this new (hopefully better) code snippet, but I think it will ultimately be worth it. Blogs based off of an XOXO template (I’ll be publishing one and the specs soon. As you can see by looking at the XOXO Blog itself, I’m not much of a designer, but I’m proving the concept first. I’ll get other people to help me with looks later.) will be able to use the service directly with no added code.

Other benefits to the XOXO-template could include :

  • The ability to produce better post feeds by parseing the blog main page
  • The ability to parse the whole blog for backup/transfer to another service if needed

The XOXO blog itself will soon be populated with different tools, not only to go with XOXO templates, but to work with other uses for XOXO as well.

Tags:

What Is XOXO?

Posted on

XOXO is a microformat for the storage and transmission of outline data. Outline data is any nested list information, where you have nodes with subnodes. The specification is similar in purpose to OPML, but has many advantages over that format, including :

  • XOXO can be embedded completely within any XHTML document. Since XOXO is really a subset of XHTML, it is 100% XHTML-compatible. It can be stored as an independant document, but this is not a requirement as it is with OPML.
  • XOXO has predefined fields for common uses. Unlike OPML where all fields are optional/arbitrary and up to individual implementations, XOXO has standardized markup for TEXT, TITLE, HREF, REL, REV, TYPE, and CLASS attributes. One may argue that feed readers have standardized some OPML elements (xmlUrl, for example), however this is not even wholly true (some feed readers use the rssUrl element instead).
  • XOXO can be viewed directly in a webbrowser without any need for extra stylesheets
  • XOXO can be used to make up the actual content of web pages so that those pages are nice to view, but are also easily read by other applications/scripts

For conveniance, XOXO is still fully extendable, with the ability to contain any number of arbitrary fields.

For more information, see the official XOXO specification and the official XOXO-faq.