Skip to content

Instantly share code, notes, and snippets.

@abbot abbot/x.js
Created Oct 28, 2009

Embed
What would you like to do?
CmdUtils.makeSearchCommand({
names: ["yandex"],
icon: "http://www.yandex.ru/favicon.ico",
description: "Поиск в Yandex",
author: {name: "Lev Shamardin", email: "shamardin@gmail.com"},
url: "http://yandex.ru/yandsearch?text={QUERY}&lr=1",
preview: function(pblock, {object}) {
var searchTerm = object.text;
var template = "Поиск в yandex: <b>${query}</b>";
var data = {query: searchTerm};
pblock.innerHTML = CmdUtils.renderTemplate(template, data);
var urlTemplate = "http://yandex.ru/msearch?query=${query}&lr=1";
var requestUrl = CmdUtils.renderTemplate(urlTemplate, data);
jQuery.get(requestUrl, {}, function(data) {
var temp = pblock.cloneNode(false);
temp.innerHTML = data;
results = jQuery(temp).find("ul.b-results");
jQuery(results).find("li").css("margin-bottom", "1em");
jQuery(results).find("a").css("font-size", "140%");
pblock.innerHTML = results.html();
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.