// ==UserScript==
// @name           SVTGet
// @namespace      http://tapiren.se/category/userscripts
// @description    Ett script som lägger till en knapp för att ladda ner en video via SVT Get.
// @version        1.0
// @include        http://svtplay.se/*
// ==/UserScript==


// Load the jQuery script and append it to <body>
function addJQuery(callback)
{
	var script = document.createElement("script");
	script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
	script.addEventListener('load', function() {
	var script = document.createElement("script");
		script.textContent = "(" + callback.toString() + ")();";
		document.body.appendChild(script);
	}, false);
	document.body.appendChild(script);
}

function main()
{
	var url = document.location.href.split("?");
	url = url[0].replace("svtplay.se", "svtget.se");

	$('li.referer').after("<li><a href=\""+url+"\">Ladda ner</a></li>")
}
	

// Load jQuery and execute the main function
addJQuery(main);

