KISS

Keep It Simple Stupid

A tiny userjs (for Yandex's search page)

| comments

Hi again!

Updated on 2011-06-11!

My primary search engine is Yandex, but I often click to the “Google” link at the bottom of a Yandex’s search page. Google’s interface is English, but when I click the link, it enables Russian one. It happens due to “hl=ru” parameter of that link.

It’s a bit inconvenient, so I made it to write a little userjs for the Opera browser. Here is the source:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// ==Userscript==
// @name YandexToGoogle
// @description Removes the 'hl=ru' parameter in Yandex's links to Google at the bottom of a search page
// @version 1.1 (2011-06-11)
// @author pluton <pluton.od at gmail.com>
// @include http://yandex.ua/yandsearch*
// @include http://yandex.ru/yandsearch*
// ==/Userscript==

(function() {
    window.opera.addEventListener('BeforeEvent.DOMContentLoaded', function(ev) {
        // find our Google link
        var elem = document.getElementsByClassName('b-summary__item')[1];
        // and remove the parameter
        elem.search = elem.search.replace("hl=ru&", "sourceid=opera&");
    }, true);
})();

Now, how to install it. Go to “opera:about” address, and find the folder name opposite the “User JavaScript folder” label (in my case, it is “/home/user/.opera/userjs”). Then just save the script’s code to “yandex_to_google.js” file. Works in Opera 10.63+.

That’s all for today. Leave your comments.

Comments