Skip to content

Instantly share code, notes, and snippets.

@morozowski morozowski/lyrics.js
Created Feb 17, 2009

What would you like to do?
Ubiquity Command "lyrics" or "letra(s)"
name: "lyrics",
description: "Searches lyrics at (powered by Google).",
url: "{QUERY}",
icon: "",
homepage: "",
author: { name: "Morozowski", email: "morozowski+ubiquity [at] gmail [dot] com"},
license: "GPL",
synonyms: ["letra", "letras"],
preview: function(pblock, directObject) {
var searchTerm = directObject.text;
if(searchTerm.length < 1) {
pblock.innerHTML = "Searches lyrics at";
var url = "";
var params = { v: "1.0", q: " " + searchTerm };
CmdUtils.previewGet( pblock, url, params, function(data) {
var numToDisplay = 10;
var results = data.responseData.results;
var html = '';
for(var i=0;i<results.length && i<numToDisplay;i++){
html += "<p>"+(i+1)+": <u><a href=\""+results[i].url+"\" accesskey=\""+(i+1)+"\">"+results[i].title+"</a></u></p>";
html += "<small>Tip: You can go to any result in this preview by using its number as an access key. (Linux and Windows: alt-number, Mac: control-number)</small>\n";
pblock.innerHTML = html;
}, "json");
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.