Skip to content

Instantly share code, notes, and snippets.

@kzsg
Created September 28, 2008 08:55
Show Gist options
  • Save kzsg/13428 to your computer and use it in GitHub Desktop.
Save kzsg/13428 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
service: "http://",
name: "scuttle",
homepage: "http://gist.github.com/13428",
author: {name: "kzsg", homepage: "http://kzsg.kurosemi.com"},
description: "search the bookmark from your Scuttle.",
takes: {"query": noun_arb_text},
preview: function( pblock, query) {
pblock.innerHTML = "Will get bookmarks from " + this.service;
if (query.text == undefined || query.text == "") return;
var baseUrl = this.service + "/rss.php/all/" + query.text;
jQuery.get( baseUrl, function( answer ) {
var result = "";
jQuery(answer.getElementsByTagName("item")).each(
function () {
var item = jQuery(this);
var title = item.find("title").text();
var link = item.find("link").text();
var description = item.find("description").text();
var url = "<a href=\"" + link + "\">" + title + "</a>";
result = result +
"<span style=\"color: lightgreen; font-size: small\">" + url + "</span>" + "<br>" +
"<span style=\"font-size: small\">" + description + "</span>" +
"<hr>";
}
);
pblock.innerHTML = result;
});
},
execute: function( query ) {
var baseUrl = this.service + "/search.php/all/" + query.text;
Utils.openUrlInBrowser(baseUrl);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment