Singpolyma

Archive of "Greasemonkey"

Archive for the "Greasemonkey" Category

Free Youtube in any Browser

Posted on

Many people have used and loved, Free Youtube (or FYT), my Greasemonkey script that allows people to use Youtube (and other video sharing sites like Google Video, blip.tv, and others) wthout having a Flash player installed. This is useful for the many people who are on hardware or OSs not supported by Adobe, or those who refuse to install the hideous thing on matters of strong principle.

Now, this freedom cane be taken outside of browsers like Firefox and Epiphany that have userscript functionality. Today, right here in this post, I am releasing a version of FYT as a bookmarklet! (Kudos to Christopher Vollick for having the idea.)

Updated to work better with Safari/Quicktime

Drag 5C.com%5C%2Fv%5C%2F%28%5B%5E%5C%26%5D%2B%29%2F%29%3B%0D%0A%09%09%09var%20vimeoid%20%3D%20data.match%28%2Fvimeo%5C.com%5C%2F%5B%5E%5C%3F%5D%2B%5C%3Fclip_id%3D%28%5B%5E%5C%26%5D%2B%29%2F%29%3B%0D%0A%09%09%09var%20blipid%20%3D%20data.match%28%2Fblip%5C.tv%5C%2Fplay%5C%2F.%2B%24%2F%29%3B%0D%0A%09%09%09var%20wpid%20%3D%20data.match%28%2Fv%5C.wordpress%5C.com%5C%2F%28%5B%5E%5C%2F%5C%26%3F%23%5D%2B%29%2F%29%3B%0D%0A%09%09%09var%20flowplayer%20%3D%20data.match%28%2Fflowplayer%2F%29%3B%0D%0A%09%09%09if%28objects%5Bi%5D.parentNode.nodeName%20%3D%3D%20%22OBJECT%22%29%0D%0A%09%09%09%09var%20o%20%3D%20objects%5Bi%5D.parentNode%3B%0D%0A%09%09%09else%0D%0A%09%09%09%09var%20o%20%3D%20objects%5Bi%5D%3B%0D%0A%09%09%09if%28ytid%20%26%26%20ytid%5B1%5D%29%20%7B%0D%0A%09%09%09%09ytid%20%3D%20ytid%5B1%5D%3B%0D%0A%09%09%09%09linkurl%20%3D%20%27http%3A%2F%2Fyoutube.com%2Fwatch%3Fv%3D%27%20%2B%20ytid%3B%0D%0A%09%09%09%7D%20else%20if%28vimeoid%20%26%26%20vimeoid%5B1%5D%29%20%7B%0D%0A%09%09%09%09vimeoid%20%3D%20vimeoid%5B1%5D%3B%0D%0A%09%09%09%09linkurl%20%3D%20%27http%3A%2F%2Fvimeo.com%2F%27%20%2B%20vimeoid%3B%0D%0A%09%09%09%7D%20else%20if%28blipid%29%20%7B%0D%0A%09%09%09%09GM_xmlhttpRequest%28%7B%0D%0A%09%09%09%09%09method%3A%20%27GET%27%2C%0D%0A%09%09%09%09%09url%3A%20objects%5Bi%5D.src%2C%0D%0A%09%09%09%09%09onload%3A%20function%28responseDetails%29%20%7B%0D%0A%09%09%09%09%09%09GM_xmlhttpRequest%28%7B%0D%0A%09%09%09%09%09%09%09method%3A%20%27GET%27%2C%0D%0A%09%09%09%09%09%09%09url%3A%20unescape%28responseDetails.finalUrl.match%28%2Ffile%3D%28%5B%5E%5C%26%5D%2B%29%5C%26%2F%29%5B1%5D%29%2C%0D%0A%09%09%09%09%09%09%09onload%3A%20function%28responseInner%29%20%7B%0D%0A%09%09%09%09%09%09%09%09linkurl%20%3D%20responseInner.responseText.match%28%2F%3Citem%3E%5B%5E%5Cf%5D%2B%3Clink%3E%28.%2B%29%3C%5C%2Flink%3E%2F%29%5B1%5D%3B%0D%0A%09%09%09%09%09%09%09%09embedLink%28o%2C%20linkurl%29%3B%0D%0A%09%09%09%09%09%09%09%09o.parentNode.removeChild%28o%29%3B%0D%0A%09%09%09%09%09%09%09%7D%0D%0A%09%09%09%09%09%09%7D%29%3B%0D%0A%09%09%09%09%09%7D%0D%0A%09%09%09%09%7D%29%3B%0D%0A%09%09%09%7D%20else%20if%28flowplayer%29%20%7B%0D%0A%09%09%09%09var%20config%20%3D%20eval%28%27%28%27%20%2B%20objects%5Bi%5D.getAttribute%28%27flashvars%27%29.match%28%2F%5Econfig%3D%28%5C%7B.%2B%5C%7D%29%24%2F%29%5B1%5D%20%2B%20%27%29%27%29%3B%0D%0A%09%09%09%09var%20div%20%3D%20document.createElement%28%27div%27%29%3B%0D%0A%09%09%09%09div.innerHTML%20%3D%20videoReplaceHTML%28config.playlist%5B1%5D.url%2C%20%27video%2Fmp4%27%29%3B%0D%0A%09%09%09%09o.parentNode.insertBefore%28div%2C%20o%29%3B%0D%0A%09%09%09%09toremove.push%28o%29%3B%0D%0A%09%09%09%7D%20else%20if%28wpid%29%20%7B%0D%0A%09%09%09%09GM_xmlhttpRequest%28%7B%0D%0A%09%09%09%09%09method%3A%20%27GET%27%2C%0D%0A%09%09%09%09%09url%3A%20%27http%3A%2F%2Fv.wordpress.com%2Fwp-content%2Fplugins%2Fvideo%2Fvideo-xml.php%3Fguid%3D%27%20%2B%20wpid%5B1%5D%2C%0D%0A%09%09%09%09%09onload%3A%20function%28responseDetails%29%20%7B%0D%0A%09%09%09%09%09%09var%20videourl%20%3D%20responseDetails.responseText.match%28%2Fmovie_file%3E%28%5B%5E%3C%5D%2B%29%3C%2F%29%5B1%5D%3B%0D%0A%09%09%09%09%09%09o.innerHTML%20%3D%20videoReplaceHTML%28videourl%29%3B%0D%0A%09%09%09%09%09%7D%0D%0A%09%09%09%09%7D%29%3B%0D%0A%09%09%09%7D%20else%20if%28o.getAttribute%28%27flashvars%27%29%29%20%7B%0D%0A%09%09%09%09var%20videourl%20%3D%20o.getAttribute%28%27flashvars%27%29.match%28%2Ffile%3D%28.%2B%29%2F%29%5B1%5D%3B%0D%0A%09%09%09%09if%28videourl%29%20%7B%0D%0A%09%09%09%09%09var%20div%20%3D%20document.createElement%28%27div%27%29%3B%0D%0A%09%09%09%09%09div.innerHTML%20%3D%20videoReplaceHTML%28videourl%29%3B%0D%0A%09%09%09%09%09o.parentNode.insertBefore%28div%2C%20o%29%3B%0D%0A%09%09%09%09%09toremove.push%28o%29%3B%0D%0A%09%09%09%09%7D%0D%0A%09%09%09%7D%0D%0A%09%09%09if%28linkurl%29%20%7B%0D%0A%09%09%09%09embedLink%28o%2C%20linkurl%29%3B%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%7D%0D%0Afunction%20init%28%29%20%7B%0D%0A%09if%28lock%29%20return%3B%0D%0A%09lock%20%3D%20true%3B%0D%0A%09%2F%2A%20YOUTUBE%20%2A%2F%0D%0A%09if%28window.location.href.match%28%2Fyoutube.com%5C%2Fwatch%2F%29%29%20%7B%0D%0A%09%09var%20videourl%20%3D%20%27http%3A%2F%2Fyoutube.com%2Fget_video.php%3F%27%3B%0D%0A%09%09unsafeWindow.swfArgs%5B%27vq%27%5D%20%3D%20%272%27%3B%20%2F%2A%20use%20higher%20quality%20%2A%2F%0D%0A%09%09unsafeWindow.swfArgs%5B%27fmt%27%5D%20%3D%20%28unsafeWindow.isHDAvailable%3F%2722%27%3A%2718%27%29%3B%20%2F%2A%20use%20higher%20quality%20%2A%2F%0D%0A%09%09for%28var%20i%20in%20%5B%27fmt%27%2C%27video_id%27%2C%27vq%27%2C%27t%27%5D%29%20%7B%0D%0A%09%09%09i%20%3D%20%5B%27fmt%27%2C%27video_id%27%2C%27vq%27%2C%27t%27%5D%5Bi%5D%3B%0D%0A%09%09%09videourl%20%2B%3D%20%27%26%27%20%2B%20i%20%2B%20%27%3D%27%20%2B%20unsafeWindow.swfArgs%5Bi%5D%3B%0D%0A%09%09%7D%0D%0A%09%09document.getElementById%28%27watch-player-div%27%29.innerHTML%20%3D%20videoReplaceHTML%28videourl%2C%20%27video%2Fmp4%27%29%3B%0D%0A%09%2F%2A%20GOOGLE%20VIDEO%20%2A%2F%0D%0A%09%7D%20else%20if%20%28window.location.href.match%28%2Fvideo.google.com%5C%2Fvideoplay%2F%29%29%20%7B%0D%0A%09%09var%20videourl%20%3D%20unescape%28document.getElementById%28%27VideoPlayback%27%29.src.match%28%2FvideoUrl%3D%28.%2B%29%24%2F%29%5B1%5D%29%3B%0D%0A%09%09document.getElementById%28%27player%27%29.innerHTML%20%3D%20videoReplaceHTML%28videourl%29%3B%0D%0A%09%2F%2A%20VIMEO%20%2A%2F%0D%0A%09%7D%20else%20if%20%28window.location.href.match%28%2Fvimeo.com%5C%2F%5Cd%2B%5C%2F%3F%24%2F%29%29%20%7B%0D%0A%09%09var%20vimeoid%20%3D%20window.location.href.match%28%2Fvimeo.com%5C%2F%28%5Cd%2B%29%5C%2F%3F%24%2F%29%5B1%5D%3B%0D%0A%09%09GM_xmlhttpRequest%28%7B%0D%0A%09%09%09method%3A%20%27GET%27%2C%0D%0A%09%09%09url%3A%20%27http%3A%2F%2Fwww.vimeo.com%2Fmoogaloop%2Fload%2Fclip%3A%27%20%2B%20vimeoid%2C%0D%0A%09%09%09onload%3A%20function%28responseDetails%29%20%7B%0D%0A%09%09%09%09var%20request_signature%20%3D%20responseDetails.responseText.match%28%2Frequest_signature%3E%28%5B%5E%3C%5D%2B%29%3C%2F%29%5B1%5D%3B%0D%0A%09%09%09%09var%20request_signature_expires%20%3D%20responseDetails.responseText.match%28%2Frequest_signature_expires%3E%28%5B%5E%3C%5D%2B%29%3C%2F%29%5B1%5D%3B%0D%0A%09%09%09%09var%20videourl%20%3D%20%27http%3A%2F%2Fwww.vimeo.com%2Fmoogaloop%2Fplay%2Fclip%3A%27%20%2B%20vimeoid%20%2B%20%27%2F%27%20%2B%20request_signature%20%2B%20%27%2F%27%20%2B%20request_signature_expires%20%2B%20%27%2F%3Fq%3Dsd%27%3B%0D%0A%09%09%09%09document.getElementById%28%27vimeo_player_%27%20%2B%20vimeoid%29.innerHTML%20%3D%20videoReplaceHTML%28videourl%29%3B%0D%0A%09%09%09%7D%0D%0A%09%09%7D%29%3B%0D%0A%09%2F%2A%20BLIP.TV%20%2A%2F%0D%0A%09%7D%20else%20if%28window.location.href.match%28%2Fblip%5C.tv%5C%2Ffile%5C%2F%5Cd%2B%5C%2F%3F%24%2F%29%29%20%7B%0D%0A%09%09var%20videourl%20%3D%20%27%27%3B%0D%0A%09%09for%28var%20i%20in%20unsafeWindow.ATOf%5B%27attributes%27%5D%29%20%7B%0D%0A%09%09%09if%28unsafeWindow.ATOf%5B%27attributes%27%5D%5Bi%5D%5B%27attribute%27%5D.match%28%2F%5C.flv%24%2F%29%29%20%7B%0D%0A%09%09%09%09videourl%20%3D%20unsafeWindow.ATOf%5B%27attributes%27%5D%5Bi%5D%5B%27attribute%27%5D%3B%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%09document.getElementById%28%27video_player%27%29.innerHTML%20%3D%20videoReplaceHTML%28videourl%29%3B%0D%0A%09%7D%20else%20if%28window.location.href.match%28%2Fviddler%5C.com%5C%2F.%2B%5C%2Fvideos%5C%2F%5Cd%2B%2F%29%29%20%7B%0D%0A%09%09var%20videourl%20%3D%20window.location.href.replace%28%2F%5C%2F%3F%24%2F%2C%27.flv%27%29%0D%0A%09%09document.getElementById%28%27flashcontent%27%29.innerHTML%20%3D%20videoReplaceHTML%28videourl%29%3B%0D%0A%09%2F%2A%20ACADEMICEARTH.COM%20%2A%2F%0D%0A%09%7D%20else%20if%28window.location.href.match%28%2Facademicearth.org%5C%2Flectures%5C%2F.%2A%24%2F%29%29%20%7B%0D%0A%09%09var%20videourl%20%3D%20unsafeWindow.flashVars.flvURL%3B%0D%0A%09%09var%20div%20%3D%20document.createElement%28%27div%27%29%3B%0D%0A%09%09div.innerHTML%20%3D%20videoReplaceHTML%28videourl%29%3B%0D%0A%09%09document.getElementById%28%27video-player%27%29.parentNode.insertBefore%28div%2C%20document.getElementById%28%27video-player%27%29%29%3B%0D%0A%09%09document.getElementById%28%27video-player%27%29.parentNode.removeChild%28document.getElementById%28%27video-player%27%29%29%3B%0D%0A%09%2F%2A%20LASTAMPA.IT%20%2A%2F%0D%0A%09%2F%2A%20Code%20by%20Iron%20Bishop%20%2A%2F%0D%0A%09%7D%20else%20if%20%28window.location.href.match%28%2Flastampa%5C.it%5C%2Fmultimedia%2F%29%29%20%7B%0D%0A%09%09var%20videourl%20%3D%20unescape%28document.getElementById%28%27VideoPlayer1%27%29.innerHTML.match%28%2F.%2Ax-mplayer2.%2Aurl%3D%28.%2B%29wmv%2F%29%5B1%5D%29%20%2B%20%22wmv%22%3B%0D%0A%09%09document.getElementById%28%27VideoPlayer1%27%29.innerHTML%20%3D%20videoReplaceHTML%28videourl%29%3B%0D%0A%09%2F%2A%20EMBED%20CODES%20%2A%2F%0D%0A%09%7D%20else%20%7B%0D%0A%09%09unsafeWindow.addEventListener%28%27DOMNodeInserted%27%2C%20init%2C%20false%29%3B%0D%0A%09%09embed_codes%28document.getElementsByTagName%28%27embed%27%29%29%3B%0D%0A%09%09embed_codes%28document.getElementsByTagName%28%27object%27%29%29%3B%0D%0A%09%09for%28var%20i%20in%20toremove%29%20%7B%0D%0A%09%09%09toremove%5Bi%5D.parentNode.removeChild%28toremove%5Bi%5D%29%3B%0D%0A%09%09%7D%0D%0A%09%09toremove%20%3D%20%5B%5D%3B%0D%0A%09%7D%0D%0A%09lock%20%3D%20false%3B%0D%0A%7D%0D%0Ainit%28%29%3B%0D%0AunsafeWindow.addEventListener%28%27load%27%2C%20init%2C%20false%29%3B%0D%0A})();">FYT to your bookmarks bar, or bookmark it in whatever way your browser prefers.

And, for those of you who’s browsers don’t have a working bookmark system, or one that doesn’t support bookmarklets, just save this string somewhere:

Junt cut-n-paste it to your address bar and hit Enter and FYT will process the current page.

FBgmail v2 For GMail v2

Posted on

Most everyone knows by now that Google released a major update for GMail some time ago. This broke most Greasemonkey scripts for GMail including my FBgmail v1. Google however, in their brilliance, released an “API” specifically for Greasemonkey on the new GMail! I have harnessed this to create a version of FBgmail for the new GMail.

Facebook Nofitications in GMail

Posted on

This script now integrates properly with both GMail and Google Reader. Reinstall and enjoy 🙂

“What?” you say, “You don’t use Facebook, Stephen, you’re so cool and geeky!” Ah, but unfortunately not all of my friends are, and I have been drawn in to the service. Mind you, I don’t spend hours reading the profiles of people I don’t know 😉 I do use it, however.

There’s one thing I’ve always hated about Facebook — the notifications system. Many too many emails flooding my inbox about what is happening, either that or I have to check the site regularly. No RSS on the things you actually want notifications of. Worst of all messages, the one thing you REALLY need notification of, won’t even send you an email.

The ‘official’ solution is to install the Facebook toolbar. I tried it, it’s nice, but I don’t use the service enough to warrant that screen real-estate OR that memory usage.

My solution is a Greasemonkey script. It integrates notifications of messages, group invites, event invites, and friend requests into the side of your GMail view. Install the script, go to GMail, click the Facebook logo and log in. For best results, check the ‘remember me’ checkbox (funny, you can’t have it remember you for logging in to the site, but for a third-party script you can…). Go back to your GMail and click the link that appeared where the Facebook logo used to be. Voila. If you checked the box, next time you go to GMail it should just display the notifications without intervention from yourself.

Die email notifications!

Userscripts.org entry

For New Blogger : Blogger del.icio.us categorising, pinging, and trackback helper

Posted on

JoongSeob Vito Kim has created a version of this script that works with the new blogger post editor.

I have made some minor bug fixes to this script, as well as made it so that it saves the trackback URLs when you save a draft.

Some time ago I married Johan’s del.icio.us and pinging script with my own trackback script into one new script. That script does not work on the new version of Blogger, and the trackback feature has been glitchy for some time. Outgoing trackback is still something we need on the new version of Blogger, and the pinging services provided by this script might even be useful on other blogging services. Del.icio.us posting? Now that we have labels? Well, Freshtags, my calendar widget, and just tag management in general, will work better if you use del.icio.us. If you disagree, this part of the script is optional.

This script does not overwrite the old script. Running both simultaneously will look dumb on the Blogger Classic interface (there will be duplication), but will not break anything. If you only run on the new Blogger, please remove the old script (if you have it installed).

Install the new script

Userscripts.org entry

Blogger del.icio.us categorising, pinging, and trackback helper

Posted on

I have a version of this script for the new Blogger as well.

Many people have installed Johan Sundström’s del.icio.us Categoriser Script and reaped the benefits. Some have also used my trackback script to enable outbound trackback inside Blogger. Now the power of these two scripts comes together to benefit everyone!

With Johan’s full approval I have married the two scripts into one categoriser and trackback script. This script is set up in such a way that installing it should overwrite any previous installation of Johan’s script and keep your existing script settings. To find out more about the categorising and pinging functions of the script, please read Johan’s post.

The trackback features work slightly differently than they did in my previous script. On the post-create page there is now a ‘Trackback’ textarea, instead of a form on the ‘post complete’ page. Enter one or more trackback URLs (each on it’s own line in the textarea) to use the trackack feature. After publishing the post your trackbacks will be sent out automatically and the status will be displayed on the ‘post complete’ page. For more information on trackback, go to Wikipedia.

There are also a couple minor new features for the categorising in this release. One is the option to use the first 200 characters of the post body in the extended field on del.icio.us, instead of the datestamp. The ‘Tags:’ label that one clicks to change settings is now blue, and your cursor should change into a hand when hovering it. Also, when republishing your whole blog the link to del.icio.us from your last post will not be displayed.

Install the Greasemonkey Script