Pandora Tuner Only [updated Aug. 2009]

By Steve McLenithan Last update Aug 7, 2009 — Installed 3,088 times. Daily Installs: 7, 1, 5, 1, 2, 1, 6, 12, 3, 0, 12, 5, 2, 7, 2, 2, 1, 5, 0, 9, 4, 6, 6, 5, 5, 1, 5, 16, 4, 7, 5, 1

There are 2 previous versions of this script.

// Copyright (c) Steve McLenithan 2006
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
//
// ==UserScript==
// @name          Pandora Tuner Only
// @namespace      http://userscripts.org/users/10789
// @description   Hide everything but the pandora tuner.
// @include       http://www.pandora.com/*
// ==/UserScript==

var tuner = document.getElementById('tuner').innerHTML;
var newBody = 
'<html>' +
'<head>' +
'<title>Pandora</title>' +
'</head>' +
'<body>' + tuner +
'</body>' +
'</html>';


window.addEventListener(
    'load', 
    function() { document.body.innerHTML = newBody; },
    true);

DisableStyles();


function DisableStyles()
{
	var stylesheets, all, element;
	
	// this disables all externally linked stylesheets
	stylesheets = document.styleSheets;
	for (var i = 0; i < stylesheets.length; i++) 
	{
		stylesheets[i].disabled = true;
	}
	all = document.getElementsByTagName('*');
	for (var i = 0; i < all.length; i++) 
	{
		element = all[i];
		if (element.nodeName == 'STYLE') 
		{
			// this removes <style> elements defined anywhere on the page
			element.parentNode.removeChild(element);
		}
	}
}