Created
September 28, 2008 08:55
-
-
Save kzsg/13428 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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