Wednesday, October 5th, 2005


Last update for tonight:

<a class='button' onclick='javascript:document.getElementById("the_id").rows+=10;'> Make Text Box Bigger </a>

And similar for Make Text Boxes Smaller.

It’s working on my comment box as we speak. Try it out.

(Thanks to Dunstan).

View Comments (0)   RSS Feed for Comments on this Post

Following on from the previous post, I’ve also shamelessly poached another idea from Dunstan: human-readable timestamps.

Just pop this into your post.html file, where you want the ‘time’ to appear.
(more…)

View Comments (5)   RSS Feed for Comments on this Post

I had noticed lots of blogs had a nice little Posted x hours, y minutes after the fact tag attached to Comments. I thought this was pretty cool, and had a very short attempt at this some time ago.

Then, over on Binary Bonsai, Michael mentioned how the plugin was broken, and how it needs fixing.

Well, I didn’t fix the PHP version, but I did write a pure Smarty version!
(more…)

View Comments (2)   RSS Feed for Comments on this Post

I recalled at some stage there was a Smarty Modifier called escape. I think it was when I was looking for one called rot13.

Anyways, you can use this and the JavaScript function unescape() to obfuscate the email address.

You’ll need this code early in your template: I stick it at the start just after <html>

<script type="text/javascript"
    src="http://schinckel.blogsome.com/images/md5.jpg">
</script>

This fragment will insert the Gravatar Image:

{capture name=reader}{comment_author_email}{/capture}
<script type="text/javascript">
document.write(’<div class="right">’);
document.write(’<img src="http://www.gravatar.com/avatar.php?gravatar_id=’);
document.write(hex_md5(unescape("{$smarty.capture.reader|escape:"hex"}")));
document.write(’&size=40" alt="" />’);
document.write(’</div>’);
</script>

This seems to more reliably display the Gravatars, so I’d suggest you use it instead. Either that, or Gravatar just fixed up their servers…

View Comments (2)   RSS Feed for Comments on this Post

There’s a little one-liner I’ve just learned for showing or hiding the contents of a particular <div> tag. (May also work for other types of tag).

The stuff you want to show or hide needs to have an id attribute. I use it to hide some stuff if there are no Comments or Trackbacks, since I’ve seperated them, and this was the best way to hide the title.
(more…)

View Comments (0)   RSS Feed for Comments on this Post

I wrote my own script to convert the selection (or whole front document) in Script Editor to XHTML. It uses the same CSS tags as Jonathon’s program, but does not add the style data in, unless a property is set.

I’ve also got the Source Code for his program, so it will be interesting to see similarities.
(more…)

View Comments (0)   RSS Feed for Comments on this Post

Got this one from Boing Boing:

View Comments (2)   RSS Feed for Comments on this Post

Since I need to replace all ” in the generated XHTML with ‘, I use the replace function from the previous post.

(*
Bugs:

Does not like no selection: no real way to get the selection from SEE anyway.
Sometimes does not execute if called from Script Menu.  Intermittant.
*)

– If called from Script Menu, need to do this.

tell application "SubEthaEdit"
	activate
	tell application "System Events" to keystroke "C" using {command down}
end tell

set theStart to (the clipboard)

set the clipboard to (my replace(theStart, "\"", "’"))

beep Another way of the Replace Function being called: set the clipboard to (replaceText from theStart to "’" instead of "\"")

on replace(theText, find, replace)
	set OldDelims to AppleScript’s text item delimiters
	set AppleScript’s text item delimiters to find
	set newText to text items of theText
	set AppleScript’s text item delimiters to replace
	set theResult to newText as text
	set AppleScript’s text item delimiters to OldDelims
	return theResult
end replace Alternate version of replace()

to replaceText from theText to replace instead of find
	set OldDelims to AppleScript’s text item delimiters
	set AppleScript’s text item delimiters to find
	set theText to text items of theText
	set AppleScript’s text item delimiters to replace
	set theText to theText as text
	set AppleScript’s text item delimiters to OldDelims
	theText
end replaceText

View Comment (1)   RSS Feed for Comments on this Post

I like to present styled code for my readers, but I’m not totally happy with my methods of getting it: SubEthaEdit’s Export as XHTML is very cool, but I still have to tweak it so it looks nice. And I’ve got a great program for getting the XHTML version of the code Script Editor (AppleScript) is currently displaying.

But, I’d like more flexibility. I want the code to be tagged with classes, like it’s possible to do with the Script Editor add-on, rather than using inline styles. I’ve already done this for the Script Editor code, but I just need to remember to remove the inline stylesheet from the start of the generated code. Unfortunately the Script has been saved as a Run Only.

I’d love to know a way to decompile one of these Scripts…apparently there isn’t. I’ll have to write my own. Or see if Jon is nice enough to give the Source Code.

As for the SubEthaEdit part: I should be able to do it. I’ve learned a couple of tricks that will help.

View Comments (0)   RSS Feed for Comments on this Post

I used to use ecto to paste all of my entries on my blog, but with Blogsome’s XMLRPC issue, I have to use a browser. But it would be nice to automatically get the name and information about my currently playing iTunes track, just like ecto used to do.

I wrote an AppleScript that does this, and, inserts the data in at the insertion point for you.

Because it’s intended to be run from the Script Menu, and everything run from there runs as “System Events”, I had to hard code in the browser name. If you use another browser, just replace the second line with whatever your browser is called.
(more…)

View Comments (0)   RSS Feed for Comments on this Post