Alltop: Topic Search and OPML

By ruiz Last update Sep 21, 2009 — Installed 321 times. Daily Installs: 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0

There are 3 previous versions of this script.

// ==UserScript==
// @name		Alltop: Topic Search and OPML
// @namespace	martin ruiz
// @description 	Alltop: Topic Search, OPML button, and OPML Auto-Discovery
// @include	http://*.alltop.com/*
// ==/UserScript==
var topDiv = document.body;
var cref = document.location.href+'opml';
var rss = document.location.href+'rss';

GM_addStyle('.atopml {color:#FFFFFF !important;font-size:11px;line-height:11px;text-transform:uppercase;display:inline;float:left;margin:0;padding:8px 4px 2px;}');
GM_addStyle('.atsearch {float:left}');

//Add <link> for OPML Auto-Discovery
var opmllink = document.createElement("link");
opmllink.setAttribute('rel','outline');
opmllink.setAttribute('type','text/x-opml');
opmllink.setAttribute('title',document.title+" | by Martin Ruiz");
opmllink.setAttribute('href',cref);
var heads = document.getElementsByTagName('head');
heads[0].appendChild(opmllink);

var buttons = document.getElementById('search');

//Add Search Box
var searchDiv = document.createElement("div");
searchDiv.id = "searchx";
//searchDiv.setAttribute('style',"position:relative;right:0;top:2px;width:980px;margin:0 auto;");
searchDiv.setAttribute('class',"atsearch");
searchDiv.innerHTML = '<div class="atsearch"><form name="cse" id="alltop_search" action="http://www.google.com/cse"><input type="hidden" name="cref" value="'+
cref+'" /><input type="hidden" name="ie" value="utf-8" /><input type="hidden" name="hl" value="" /><input name="q" type="text" /><!--<input type="submit" name="sa" value="Search" />--></form><script type="text/javascript" src="http://www.google.com/cse/tools/onthefly?form=alltop_search&lang="></script></div><script type="text/javascript">var x=document.getElementById("alltop_search"); x.firstChild.value="http://www.google.com/cse/tools/makecse?url='+encodeURIComponent(cref.replace(/http:\/\//, ''))+'";</script>';
//topDiv.parentNode.insertBefore(searchDiv,topDiv);

//Add OPML Button
var opmlButton = document.createElement('a');
opmlButton.id = "opml";
opmlButton.setAttribute('class','atopml');
opmlButton.setAttribute('href',cref);
opmlButton.setAttribute('type',"application/rss+xml");
opmlButton.textContent="opml";

//Add OPML Button
var rssButton = document.createElement('a');
rssButton.setAttribute('class','atopml');
rssButton.setAttribute('href',rss);
rssButton.setAttribute('type',"application/rss+xml");
rssButton.textContent="rss";


buttons.appendChild(opmlButton);
buttons.appendChild(rssButton);
buttons.appendChild(searchDiv);