Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
חיפוש באתרים ישראליים
CmdUtils.CreateAlias({names: ["עםםעךק", "גוגל"], verb: "Google"});
CmdUtils.CreateAlias({names: ["םפקמ", "פתח"], verb: "open"});
CmdUtils.CreateAlias({names: ["ךןדא", "רשימת-פקודות"], verb: "list"});
CmdUtils.CreateAlias({names: ["עםאם-ורך"], verb: "goto-url"});
CmdUtils.CreateAlias({names: ["כקקךןמע-ךובלט"], verb: "feeling-lucky"});
CmdUtils.CreateAlias({names: ["א'קקא", "טוויט"], verb: "tweet"});
CmdUtils.CreateAlias({names: ["אפ", "א'קקא-פשעק", "טוויט-דף"], verb: "tweet-page"});
function previewSearch(pblock, args, domain){
var txt = jQuery.trim( args.object.text );
var jsonURL = "http://ajax.googleapis.com/ajax/services/search/web?q=site:" + domain +" " + txt + "&v=1.0&rsz=large&callback=?";
pblock.innerHTML = "Searching for " + txt + ' on <a title="' + domain + '" target="_blank" href="' + domain+ '/">' + domain + '...</a>';
jQuery.getJSON(jsonURL,
function (data) {
if (data.responseData.results &&
data.responseData.results.length > 0) {
var results = data.responseData.results;
var text = "";
for (var i=0; i < results.length; i++) {
text += '<h3>' + (i+1) + '. ' + '<a href="' + results[i].unescapedUrl + '">' + results[i].titleNoFormatting + '</a></h3>';
text += results[i].content + '<br>';
text += '<a class="hand" href="#' + i + '">Insert URL in page</a><br>';
}
pblock.innerHTML = text;
function insertURL(ev) {
var _url = results[this.hash.slice(1)].unescapedUrl;
var _title = results[this.hash.slice(1)].titleNoFormatting;
CmdUtils.setSelection('<a href="' + _url + '">' + _title + '<a>');
}
for each (let a in Array.slice(pblock.querySelectorAll(".hand"))){
a.addEventListener("click", insertURL, false);
}
}
})
}
CmdUtils.CreateCommand({
names: ["seret", "google-search-seret", "???"],
arguments: [
{role: "object", label: 'what', nountype: noun_arb_text}
],
description: "seret.co.il ??? ??? ????",
icon: "http://www.seret.co.il/favicon.ico",
homepage: "http://sites.google.com/site/ubiquityisrael",
author: { name: "Asaf David", email: "asafd1@gmail.com"},
license: "GPL",
domain : "seret.co.il",
execute: function( args ){
args.object.text = "site:" + this.domain + " " + args.object.text;
CmdUtils.executeCommand("Google", args)
return true;
},
preview: function(pblock, args) {
previewSearch(pblock, args, this.domain);
}
});
CmdUtils.CreateCommand({
names: ["torec", "google-search-torec", "???????"],
arguments: [
{role: "object", label: 'what', nountype: noun_arb_text}
],
description: "torec.net ??? ??? ????",
icon: "http://www.torec.net/favicon.ico",
homepage: "http://sites.google.com/site/ubiquityisrael",
author: { name: "Asaf David", email: "asafd1@gmail.com"},
license: "GPL",
domain : "torec.net",
execute: function( args ){
args.object.text = "site:" + this.domain + " " + args.object.text;
CmdUtils.executeCommand("Google", args)
return true;
},
preview: function(pblock, args) {
previewSearch(pblock, args, this.domain);
}
});
CmdUtils.CreateCommand({
names: ["rest", "google-search-rest", "??????"],
arguments: [
{role: "object", label: 'what', nountype: noun_arb_text}
],
description: "rest.co.il ??? ??? ????",
icon: "http://www.rest.co.il/favicon.ico",
homepage: "http://sites.google.com/site/ubiquityisrael",
author: { name: "Asaf David", email: "asafd1@gmail.com"},
license: "GPL",
domain : "rest.co.il",
execute: function( args ){
args.object.text = "site:" + this.domain + " " + args.object.text;
CmdUtils.executeCommand("Google", args)
return true;
},
preview: function(pblock, args) {
previewSearch(pblock, args, this.domain);
}
});
CmdUtils.CreateCommand({
names: ["zap", "google-search-zap", "???"],
arguments: [
{role: "object", label: 'what', nountype: noun_arb_text}
],
description: "zap.co.il ??? ??? ????",
icon: "http://www.zap.co.il/favicon.ico",
homepage: "http://sites.google.com/site/ubiquityisrael",
author: { name: "Asaf David", email: "asafd1@gmail.com"},
license: "GPL",
domain : "zap.co.il",
execute: function( args ){
args.object.text = "site:" + this.domain + " " + args.object.text;
CmdUtils.executeCommand("Google", args)
return true;
},
preview: function(pblock, args) {
previewSearch(pblock, args, this.domain);
}
});
CmdUtils.CreateCommand({
names: ["ויקיפדיה"],
arguments: [
{role: "object", label: 'what', nountype: noun_arb_text}
],
description: "חיפוש בויקיפדיה העברית",
icon: "http://he.wikipedia.org/favicon.ico",
homepage: "http://sites.google.com/site/ubiquityisrael",
author: { name: "Asaf David", email: "asafd1@gmail.com"},
license: "GPL",
domain : "he.wikipedia.org",
execute: function( args ){
args.object.text = "site:" + this.domain + " " + args.object.text;
CmdUtils.executeCommand("Google", args)
return true;
},
preview: function(pblock, args) {
previewSearch(pblock, args, this.domain);
}
});
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.