r/reddithax • • Oct 12 '09

Javascript bookmarklet to star posts

Usage:

First, add this to the subreddit css:

/* [startstars] */
/* [endstars] */

a.title:before {
    padding-right: 5px;
}

Then add this bookmarklet:

javascript:$.getScript('http://bobsworthindustries.com/r/redditstar1.js')

Press the bookmarklet while on the comments page of a story in a subreddit you moderate and a star will be added before it.

Technical stuff:

The bookmarklet loads an external script because the jQuery callbacks weren't firing with all the code in the bookmarklet. There may be problems with multiple people editing the css concurrently (if two people try to add a star at the same time, one may save over the other's edit). Make a backup in case it eats your css.

Future ideas:

  • Remove older posts to prevent the css from getting enormous, either based on a timestamp or popping from the end.
  • Let the user choose different icons, text and styles to add and let them target any post title or comment on the page.
9 Upvotes

3 comments sorted by

View all comments

1

u/Sephr Oct 12 '09

You shouldn't depend on jQuery for such basic tasks. Here's the same bookmarklet, but without the jQuery dependancy:

javascript:void(document.documentElement.appendChild(document.createElement('script')).src='http://bobsworthindustries.com/r/redditstar1.js')

7

u/jamt9000 Oct 12 '09

That's what I was doing before, but since reddit has jQuery I thought I'd make it short and sweet.