Large

Hype Machine download links

By tonyskn Last update Sep 9, 2011 — Installed 30,240 times.

Greasekit/Safari doesn't work, so I fixed it

in
Subscribe to Greasekit/Safari doesn't work, so I fixed it 4 posts, 4 voices



das05r User
SafariMacintosh

Hi,

Firstly, thanks for this script, it works really well for me.

I wanted it to work in Safari with Greasekit, but it doesn't work. I read a method to getting it working on here:
http://henrik.nyh.se/2009/07/jquery-in-greasekit

I implemented this in the script, and it now works great!

Code is below if you're interested.

// ==UserScript==
// @name Hype Machine direct download links (new!)
// @author tonyskn_at_gmail.com
// @description Add download links next to tracks on The Hype Machine.
// @include http://hypem.com/*
// ==/UserScript==

var icon_html = '';

function jQueryIsReady($) {

$("[id*='track_name']").each(function() {
var index = $(this).attr('id').substring(11);
var trackId = unsafeWindow.trackList[document.location.href][index]["id"];
var trackKey = unsafeWindow.trackList[document.location.href][index]["key"];
// GM_log(index+' '+trackId+' '+ trackKey);
$('').html('?'+icon_html).attr('href', '/serve/play/'+trackId+'/'+trackKey).appendTo(this);
})


}

// ----------------------------------------------------------------------
// Greasemonkey/GreaseKit compatibility
// ----------------------------------------------------------------------

if (typeof(unsafeWindow) === 'undefined') {
unsafeWindow = window;
}

// Based on http://userscripts.org/topics/1912
if (typeof(GM_addStyle) === "undefined") {
GM_addStyle = function(styles) {
var oStyle = document.createElement("style");
oStyle.setAttribute("type", "text/css");
oStyle.appendChild(document.createTextNode(styles));
document.getElementsByTagName("head")[0].appendChild(oStyle);
}
}

// ----------------------------------------------------------------------
// jQuery
// ----------------------------------------------------------------------

var script = document.createElement('script');
script.src = 'http://jquery.com/src/jquery-latest.js';
script.type = 'text/javascript';
script.addEventListener("load", function() {
jQueryIsReady(unsafeWindow.jQuery);
}, false);
document.getElementsByTagName('head')[0].appendChild(script);

 
dz0ny Scriptwright
ChromeWindows

Repalce script.src = 'http://jquery.com/src/jquery-latest.js';
with
script.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.3...;

For faster loading!!

 
electblake User
FirefoxMacintosh

NICE. I was very excited about greasekit and then very sad when this userscript didn't work. I'll check this off of reasons why I can't move from FF :)

 
buggyG User
SafariMacintosh

Running GreaseKit 1.7 through SIMBL in safari 4.03 64bit mode renders hypem pages blank when trying to use das05r modified script..

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel