Nov 12

OneRiot has entered your Google

Search, Tech with tags: , 11 Comments »

Tobias Peggs told me about the rebranding of Me.dium to OneRiot to show the change in direction from a “social browsing” company to a real-time search solution.

As a little experiment, to coincide with their launch today, I whipped up a little bit of Greasemonkey goodness in the form of OneRiot in your Google.

The premise is simple, and you have probably seen it before. When you do a Google search, this userscript will head over to OneRiot to do the search there. The top result will then pop-in to the results.

I always tend to do something like this when a new search engine comes out. I am not mentally going to switch from using Google, so bring the mountain to Mohamed and plug in the top result to Google itself. This way, if it shows me something truly new (read: not the same as what Google gives me and still useful) then I will maybe pay more attention to it in the future.

Most of the work itself is infrastructure crud to get around loading up jQuery. Oh for a better way to load standard libraries!

// ==UserScript==
// @name          OneRiot in your Google
// @namespace
// @description   Add a riot to your Google
// @include       http://**
// ==/UserScript==
(function() {
	// Add jQuery
	var $;
	var query = parseQuery();
	var oneriotURL = '' + query;
	var script = document.createElement('script');
	script.src = '';
	script.type = 'text/javascript';
	// Check if jQuery's loaded
	function jQueryCheck() {
		if (typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(jQueryCheck, 100); }
		else { $ = unsafeWindow.jQuery; jQueryReady(); }
	// The Real Work
	function jQueryReady() {
		    method: 'GET',
		    url: oneriotURL,
		    onload: function(response) { // Get the first result from OneRiot
				var resulttitle = response.responseText.match(/(\<a class="result_title".*?\<\/a\>)/)[0];
				if (resulttitle) {
					var title = $(resulttitle);
					var url = title.attr('href');
					var text = title[0].textContent;
					var result = '<div id="oneriot" style="padding: 2px;"><a href="" title="Visit"><img src="" border="0" style="margin-right: 4px;"/></a> <a href="' + url + '" title="View the OneRiot result">' + text + '</a> <a href="' + oneriotURL + '" style="color: #3399FF; padding: 0 8px;" title="See more results for this query on the website">more oneriot results</a></div>';
					$('#ssb').after(result); // Add it to the Google DOM at the top
	// Get the Google query from the query string
	function parseQuery() {
		var result =\&q=(.*?)\&/);
		if (result && result.length > 0) {
			return result[1];

OneRiot at Google

OneRiot seems to do well for certain queries. This example does a good job at showing it off. In the Obama search, instead of just getting, it shows recent news. That is why it is a nice complement to traditional search engines.

Kudos to the OneRiot team on the launch!