JavaScript


This is very cool. Better than Live Search. I might be able to implement this, and even include the abililty to get multiple pages worth of results.

And, it should be possible to do it so the search results appear in the sidebar, too. I’ll definitely look into this one.

(Thanks Kreaper!)

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

This is a cool idea - disable the Submit button via JavaScript when it’s pressed, so poeple can’t resubmit a comment multiple times. Not that it’s happened to me, but I like it anyway.

Shamelessly stolen from Submit only once!

Note to self: Implement this, or something like it.

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

I’ve already had resizable Textarea implemented in this blog - the two buttons that appear at the bottom of the comment box, next to Preview/Post Reply.

However, today over on MacGeekery, I came across something even better.  A resize widget, that can be dragged to resize the comment entry box.

Getting this to work wasn’t quite as simple as just cutting and pasting code, however.  Eventually, I rewrote the code from scratch, using some of my toolbox tools also.
(more…)

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

I’ve got a heap of stuff in the toolbox script that does nothing anymore - at least on my site - so I think I might streamline it a bit by removing a large number of the functions that are no longer required.

For instance, I don’t need to create Gravatars in JavaScript, since there’s a Smarty Plugin to do this - which also negates the need for the md5 stuff.

At the moment, the script is 56k, which is a little too bulky.

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

I’ve implemented a Floating Window in JavaScript. I’ve actually had it going for a while, I just hadn’t gotten around to finishing the writeup yet.

See it at Floater.

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

I’ve updated my toolbox.js script, so now it puts in a sidebar item called “Links in Current Post”. As described in the posts:

These links are really only here so you get to see it in action!

Whatever TomorrowDavid LanePut Me In A Taxi ★★★★½

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

Here’s a nice little bit of JavaScript that grabs the Trackback URI of the current post. I’m not quite sure how to use it yet. It would be nice to be able to automatically add this to the BlogThis link, but there’s no way to do so, since cross-site scripting is disabled.

document.body.innerHTML.split("trackback:ping=\"")[1].split("\"")[0];

The other thing that might be cool is to copy this to the clipboard, but I’m a bit loath to do things like that which are “invisible” to a user.

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

It’s amazing how much and how quickly one can change their attitude towards things.

Take the following comment (by me), posted on the Blogsome Forums on Sun Aug 07, 2005 10:28 am.

I try and avoid JavaScript where possible , and cannot tell you if that is valid code or not.

What I would suggest is that that code does not belong in the StyleSheet - put it in the Main page template, and see how that goes.

(more…)

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

I blogged earlier about creating a sidebar entry with all of the links in the current post. The following code snippet will do this:

function createPostLinksBox(){
    if (!getCurrentPost()) return "not a single post page";
    content = getByClass("post-content")[0];
    links = content.getElementsByTagName("A");
    if (!links.length) return "no links in post";
    var placeholder;
    if (!(placeholder=getPlaceholder("outlinks"))) return "no location for outlinks";
    var outlinks = document.createElement('h2');
    outlinks.innerHTML = "Links in this Post";
    var ul = document.createElement('ul');
    for (i=0;i<links.length;i++){
        li = document.createElement('li');
        li.appendChild(links[i].cloneNode(true));
        ul.appendChild(li);
    }
    replaceNode(outlinks,placeholder);
    outlinks.parentNode.insertAfter(ul,outlinks);
}

Note that this must be run after the DOM tree is finalised, and relies on a couple of other functions.

I’ve put <span id="outlinks"></span> into my template, so that this will appear wherever that is, if it’s a single post page with any links in it.

It will make it into the next update of my script.

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

I think I might rewrite all of this site’s scripting using a framework.

Probably Yahoo’s stuff, that looks very cool: YUI.

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

« Previous PageNext Page »