Pride: Blogger Hack Primer
The extended entry contains the promised primer on the 2 Blogger hacks I have made. Inline Trackbacks and Extended Entry sections.
Toggle Haxorz
<!-- Place this javascript code block in your template header (<head></head>) section -->
<script language="javascript" type="text/javascript">
// This includes an external javascript source
// I find it easier than building the string every time
function include(script_filename) {
document.write('<' + 'script');
document.write(' language="javascript"');
document.write(' type="text/javascript"');
document.write(' src="' + script_filename + '">');
document.write('</' + 'script' + '>');
}
// This function toggles the visiablity of the passed element
function hider(elementName) {
var control;
control = document.getElementById(elementName);
if(control.style.display == 'none' || control.style.display == "")
{
control.style.display = 'inline';
}
else
{
control.style.display = 'none';
}
}
// This counts the number of trackbacks in post "id"
// Shamelessly ripped from Basil's tutorial
function TBCount(id){
var hs_search = new RegExp('\\W','gi');
var hs_id = id.replace(hs_search,"_");
id = hs_id;
var rtrnVal=0;
if (hstb[id]) {
var rtrnVal=hstb[id];
}
return rtrnVal;
}
</script>
<!-- Place this in your template's style section. (inside the head section) -->
<!-- If you don't have a style section, use the style tags as shown -->
<style>
<MainOrArchivePage>
span.fullpost {display:none;}
</MainOrArchivePage>
<ItemPage>
span.fullpost {display:inline;}
</ItemPage>
</style>
</head>
<body>
<!-- Your Blogger template. Inside the post code -->
<!-- This puts a direct pointer to the trackback ping location in your post -->
<!-- This is totally optional and can easily be modifed. -->
<!-- Put it in the post code where you want it to appear -->
<a href="http://haloscan.com/tb/sinsblog/<$BlogItemNumber$>">Trackback URI</a>
<!-- Place this javascript in your template where you want trackbacks to appear -->
<script type="text/javascript">
<!--
// This shows the trackbacks if there are any to show
// it uses a service to translate XML (RSS) to javascript
// The service main page can be found here: http://itde.vccs.edu/rss2js
id="<$BlogItemNumber$>";
var TBNum=TBCount(id);
if (TBNum) {
document.write("Trackbacks:<br>");
document.write("<ul>");
include("http://itde.vccs.edu/rss2js/feed2js.php?src=http://haloscan.com/tb/sinsblog/<$BlogItemNumber$>?__mode=rss&chan=n&num=0&desc=0&date=n&targ=y");
document.write("</ul>");
}
// -->
</script>
<!-- This is an example of how to make an extended entry -->
<!-- The "hider" javascript function must be defined -->
<!-- the stuff you want initially hidden is in the "span" tag -->
<!-- IMPORTANT: Use a different "id" for every entry or they will be toggled together -->
<!-- Put this in your POST, not your TEMPLATE -->
<a href="javascript:hider('extEntry');">Toggle Extended Entry</a>
<span id="extEntry" class="fullpost">
Here is the extended entry text.
This will be hidden on the main page or archive pages and shown
on individual item pages by default due to the style "fullpost"
The link will toggle visibility.
</span>
<!-- FIN -->
If you rather download an HTML file instead of cut-n-paste, Click Here.
If you use this, please trackback to this post. If you have problems, please use the comments on this post so everyone can benefit.
Update: It turns out there is a small bug in the process. Here is the explaination from the guy who found it.
Turns out if someone trackbacks with accents over theThanks Mark! I hope to figure out a fix, but until then maybe this will help someone not pull their remaining hair from their skull.
letters, say for a foreign language, it screws up the
feed.
I manually edited the haloscan entry and it works now.
You might want to pass that along on your blog in case
some get foreign language readers.