He who sings prays twice.
Saint Augustine

«— Not Porn: Chicago to Release Thirtieth Album
—» Hypocrisy

Writing Bookmarklets

Link to this post  

I recently installed a WordPress plugin that lets me look at my stats, and “writing bookmarklets” is pretty high on the list of search strings. In fact, I come up on the first page of a Google search. Crazy. “Better Living Through Bookmarklets” has some good information to get someone started. “Tips for Writing Bookmarklets” has some really good tips for writing bookmarklets once you’ve gotten a feel for it.

I highly recommend hacking the bookmarklets of others to see what makes them tick. Good targets are Jesse Ruderman’s bookmarklets and Tim Powell’s.

I saw one article in my Googling that advised using “ugly variable names,” ie, random alphanumeric strings, to avoid namespace interference. Ick. Encapsulate your bookmarklet in a function to restrict the scope of your variables. This is also a helpful trick to dispense with void().


Filed under: — Basil @ 1:24 am

«— Mutterings for October 31
—» Serbian Tragedy

Mass Delete Bookmarklet

Link to this post  

Over the last two days, I have been hit with over 200 hits of comment spam. (That’s what being number one for “spooky car ad” will get you.)

At one point, I had 133 bogus comments awaiting moderation in my queue, so I started working on a bookmarklet to mass select every delete button on the page. I didn’t get it working until after I had to select “delete” for each of those 133 comments by hand, but I did get it working.

Here it is: Mass Delete.

It will cause every “delete” button on the page to be selected, so use it with care. It has only been tested on Firefox 1.0PR; your mileage may vary.

If you are running your own server, may I also suggest Apache and mod_security?


Filed under: — Basil @ 12:32 am

«— Logical Necessity
—» Tweaking…

I Don’t Know Why…

Link to this post  

…I even try.


Filed under: — Basil @ 3:33 pm

«— “…But They Can Never Take Away Our Freedom!”
—» Logical Necessity

On Second Thought…

Link to this post  

Chris digs on the OCA bookmarklets Tim and I wrote, but he’d like one for searching the OCA website for a saint by name.

As you can see from my comments on his blog entry, I was a little conflicted about whether it was possible. Well, I’m still a little conflicted, but I decided to do something anyway. Find a Saint (by name, OCA). It’s not the best. It will return pages that only mention the saint once in passing (this is especially true of “big name saints” like Basil the Great, John Chrysostom, or Gregory the Theologian. It will also bring up pages that are not saints pages — for example, if a person by the same name is mentioned. (Tip: the synaxaria that the OCA site is using typically prefer the Greek forms of names in many cases — for example “Demetrios” gets results; “Dmitri” does not.)

I hope that helps, Chris. ;-)


Filed under: — Basil @ 4:29 pm

«— Commemorating the Saints
—» In More Moderation, All Things

Aargh

Link to this post  

Now he’s reading my mind and writing bookmarklets that I have ideas for before I can. It’s useless. There is no escape.

I think I’m going to learn LISP now.


Filed under: — Basil @ 5:17 am

«— The Default Choice
—» Aargh

Commemorating the Saints

Link to this post  

Updated!

You know, there is nothing quite like the feeling of having accomplished something yourself. Nor is there anything quite like wanting to accomplish something yourself, asking for help, and having your helper do it for you. Especially when he has nothing whatsoever to prove.

A bookmarklet for your browsing satisfaction. It will take today’s date, or one you provide, and retrieve the synaxarion from the Orthodox Church in America website. Saints of the Day. (As with all bookmarklets, right-click [or ctrl-click on Mac OS] and choose “Bookmark This Link” or “Add to Favorites” to use it, or just drag-n-drop.) That’s courtesy of Tim. I came up with a faster, if slightly less robust form, Today’s Saints. (Geek out: If you look at the code, you can see Tim killed me by using a regular expression, which made it possible to use a prompt and then separate the month and day out from the user data. Also, I copied his simplified assignment of the months to the array. My original used the long version — var foo = new Array(); foo[n]="bar"; — to do the assignment. Grossly inefficient. As I said, he really had nothing to prove.)

So, what exactly is a synaxarion? In Greek, the language in which the Christian Scriptures were written, the word synaxis means “assembly.” The Divine Liturgy, the service normally served on Sundays and holy days, is a synaxis or assembly of the people of God. The synaxarion, then, tells us who we commemorate on each day of the year and why.

In the beginning, almost all Christians were martyrs — martyria means “witness” — the martyr’s death was the ultimate witness to the lordship of Christ. It became customary to mark their martyrdom with a feast or a celebration, since the day of their martyrdom was the day of their entrance into the presence of God. After martyrdom became less common, thanks to St. Constantine, it remained customary to mark the death of especially virtuous Christians as a day of rejoicing. As you can imagine, after 2000 years, there are a lot of holy men and women to remember!


Filed under: — Basil @ 10:30 pm

«— Does Not Play Well with Others
—» True.

Need It Now

Link to this post  

Tim keeps talking about an IMDB bookmarklet. Yet, amazingly, I cannot find it anywhere on his site. You’d think maybe he’d put it on a page entitled, Bookmarklets. Nah, that would mean he had actually crafted such a thing. Which at this point I doubt.

Primarily because I need it now. Like, right this minute. I was just on a page where I highlighted a film name, and I went to click on a bookmarklet…. Oh, wait. It doesn’t exist yet. Maybe I’ll have to write one myself.


Filed under: — Basil @ 9:04 pm

«— WiFi? Here?
—» Keep Your Confederate Dollars, Boys!

Show Me the Money!

Link to this post  

At work, I’ve been looking for ways to make our broken intranet pages work with a browser that complies with web standards. Recently, Tim pointed out a bookmarklet that allows the user to toggle styles. It’s pretty groovy, and I was hoping it might allow me to use those unusable pages.

The problem is that these pages rely on the Microsoft Internet Explorer Event model, which conflicts with the DOM Level 2 Event specification published by the World Wide Web Consortium (W3C). They listen for a mouse click event in the wrong place, so in a standards-compliant browser the code to handle that event never gets called. (Forget that they’re hideous beyond repair as HTML.) This means that the content which is hidden, waiting for me to click, just stays in hiding. (Don’t ask me why they hid it. Maybe it was embarassing.) It looks sorta like this, except that I wrote that page to be a standards-compliant version.

Unfortunately, that toggle styles bookmarklet did not go far enough. What I needed was for it to toggle the display properties of the document’s div tags. At first I tried hacking the original bookmarklet, but I quickly realized that toggling the display property on every div leads to a lot of AWOL content. Clearly the Wrong Thing® to do. What I needed was something that set the display property on every div to block.

*** basil does the happy dance ***

Here it is: Show all DIVs. Enjoy.


Filed under: — Basil @ 7:56 pm

«— Erm… Not Quite
—» Flashy Usability

Bookmark This!

Link to this post  

Tim has a collection of bookmarklets. These things have become indispensable for me. My employer wants to force Internet Exploiter on me, but I just can’t do without my bookmarklets.


Filed under: — Basil @ 5:55 pm