Unfuck google search button order

Reorder Google search tabs to 'Images, Videos, News, Maps'.

2016-02-01 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Unfuck google search button order
// @namespace   Unfuck_google_search_button_order
// @description Reorder Google search tabs to 'Images, Videos, News, Maps'.
// @include     /^https?:\/\/www.google.[a-z.]{1,8}\/search*/
// @version     1
// @grant       none
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require     https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=19641
// ==/UserScript==

waitForKeyElements("q qs", meh());

function meh()
{
	var buttonInsides = document.getElementsByClassName("q qs");

	var buttons = new Array(4);
	var lang =
	[
		['Images','Képek'],
		['Videos','Videók'],
		['News','Hírek'],
		['Maps','Térkép']
	];

	for (var i = 0; i<buttonInsides.length; ++i)
	{
		var text = buttonInsides[i].innerHTML;

		for (var j = 0; j<lang.length; ++j)
		{
			if (lang[j].indexOf(text) != -1)
			{
				buttons[j] = buttonInsides[i].parentNode;
			}
		}
	}

	var more =  document.getElementById("hdtb-more");

	for (i = 0; i<buttons.length; ++i)
	{
		buttonInsides[0].parentNode.parentNode.insertBefore(buttons[i], more);
	}
}