Tag Archives: greasemonkey

wordpress.tv Download Link Script

Scripts No Comments

I’ve been watching a lot of videos from WordPress TV lately. There is some absolutely cracking content on there! However, I really wanted to be able to download videos. There wasn’t a download link, so I wrote this Greasemonkey script to add one.

Download

This script can be downloaded from Userscripts.org

Why Download Vidoes From WordPress.tv?

I mostly consume WordPress.tv content from my Android phone.

I don’t want to watch it over my 3G connection. These videos are often 400MB! It seems there’s a lower bandwidth version when you visit on a mobile device, but it’s still around 80MB in the one I did test. That’s still going to chew through my data plan far too quickly.

Sure, I could watch when connected via WiFi, but these videos are long enough that I may want to stop halfway through and pick it up later (when I may be on my 3G connection). If I leave the page open, then the video should play without needing to download anything later – but that’s a big if. Having the raw mp4 file on my SD card gives me more flexibility.

Also, although there are some basic controls built into the player (pause, move around the timeline), it doesn’t compare with the native player on my phone. It can even be viewed in full screen, but it’s fiddly to activate that control.

So all in all, it’s more convenient to be able to download the video file and have it on my device, rather than watch it through the website.

The Code

As with most of my Greasemonkey Scripts, I’ve embedded jQuery in it. This makes it so much quicker to write. It ends up being only a few lines:

$(document).ready(function($){
        // add contents of noscript into the HTML so we can access it via the DOM, hide it, then extract the URL and add Download link
        $('noscript').before('<div style="display:none" id="wp-tv-download">'+$('noscript').eq(0).text()+'</div>');
        var url = $('div#wp-tv-download a').attr('href');
        $('div#wpl-likebox').after('<div style="text-align:left !important" class="sd-block"><h3 class="sd-title">Download:</h3><div class="sd-content"><a href="'+url+'">'+url+'</a></div></div>');
});

Line 3: We grab the contents of the noscript element, which includes the download link, and add it in a hidden div before the noscript element. We have to do this so we can manipulate the content of the noscript element, as we can’t access it via the DOM.

Line 4: We then extract the URL from the hidden div we created (which is now in the DOM) and store it in a variable.

Line 5: We then add the download link after the #wpl-likebox div. Note that we use the wordpress.tv classes, such as sd-block, sd-title and sd-content, which makes the result look like the rest of the site.

License

This script is dual licensed under the MIT and GPL licenses.

The John O’Nolan Twitter Redesign Script

| Created: October 7th, 2010
Scripts No Comments

A week or so ago, John O’Nolan tweeted a link to a Photoshop redesign of Twitter, making it look less cluttered. Like a bit of a nerd, I turned it into a Greasemonkey script.

Really it was just a bit of fun. Once I start thinking about how to do something, I may as well just go and do it. So it was just a once off – I won’t be updating the script in future, etc.

Continue reading

markItUp! For Greasemonkey

| Created: February 24th, 2010
Scripts 6 Comments

The other day a great comment was left on this site. When I went to answer, I realized that I wanted to be able to select part of what the commentator said and automatically turn it into a quote in my comment.

Copy and paste are too mundane for me, so I wrote a Greasemonkey script that adds the markItUp! Editor to any textarea on a page. I then extended markItUp! by adding a ‘quote’ button that wraps the currently selected text (from anywhere on the page) in blockquote tags.

Continue reading

2009 On More Than Scratch The Surface

About 6 Comments

Happy New Year to all! A year ago, after looking at my Google Analytics stats for the year, I wrote a post reviewing 2008. I figure I may as well do it again for 2009 and also take the opportunity to explain the direction of this site.

Continue reading

New Script To Number Google SERPs

| Created: September 9th, 2009
Script News No Comments

I’d like to announce the release of my second Greasemonkey script: Google Numbered Search Results; which numbers the SERP entries delivered by the Google search engine. Continue reading

Google Numbered Search Results

| Created: September 8th, 2009
Scripts 6 Comments

Description

Google Numbered Search Results is a Greasemonkey script that numbers the search results pages on the Google search engine.

There are other scripts out there which do the same thing, but none of them work with the new AJAX powered search results being introduced by Google. This script does – well actually it doesn’t, it just forces the old search to be used, but the user won’t notice any problem, it will just work for them.

Details

Current version: 1.1 (18 May 2010)
Download: from Userscripts.org
License: Dual licensed under the MIT and GPL licenses

Credits

The Google Numbered Search Results script uses jQuery created by John Resig (embedded in the script). Thanks to John and the jQuery team.

New Script To Number Bing Search Results

| Created: June 3rd, 2009
Script News 11 Comments

Earlier today, I released my first Greasemonkey script, Bing Numbered Search Results. As the name suggests, it numbers the SERP entries delivered by Microsoft’s new Bing search engine. Continue reading

Bing Numbered Search Results

| Created: June 3rd, 2009
Scripts 2 Comments

Description

Bing Numbered Search Results is a Greasemonkey script that numbers the search results pages on the Bing search engine.
Continue reading

2008 On More Than Scratch The Surface

About 20 Comments

Happy New Year to all! A new year, a new start, but before I start churning out new posts, I want to have a quick look at 2008 on More Than Scratch The Surface. I’m not normally given to writing review posts, but I was looking at my Google Analytics stats for 2008 and felt moved to write a review of 2008.

Continue reading

Christmas Update – Greasemonkey, WordPress 2.7, Plugins And More!

| Created: December 23rd, 2008
General 29 Comments

First let me wish you all a very Merry Christmas and a Happy New Year! I hope you all accept my best wishes, even if you don’t celebrate Christmas.

December has been a very busy month for me and I haven’t had much time for posting. I may not get another post out this year, so I thought I’d take the opportunity to update you on some of the projects I’m working on.

Continue reading