Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

Tuesday, November 03, 2009

Making Vimperator 2.2+ work with Delicious keywords

This blog post echos the same information as issue 138, which describes a tiny plugin delicious_addon_kw_hack.js that can be used to restore compatibility with the Delicious add-on.
As discussed in issue 120, as of changeset da9c0a1a532d of Vimperator v2.2b1, Vimperator's ":open" will stop recognizing keywords imported from Delicious bookmarks via the the Delicious Firefox add-on.

A simple way to fix the problem is to drop the following code:
bookmarks.getSearchURL = function(text, useDefsearch) {
let url = null;
let postData = {};
let searchString =
(useDefsearch ? options["defsearch"] + " " : "")
+ text;

this.getSearchEngines();

url = window.getShortcutOrURI(searchString, postData);

if (url == searchString)
return null;

if (postData && postData.value)
return [url, postData.value];

return [url, null]; // can be null
}
into a file like delicious_addon_kw_hack.js into your ~/.vimperator/plugin/ directory (or the equivalent directory under Windows; see :help plugins for more details).

Friday, April 10, 2009

Copying lyrics from Pandora to your clipboard

You may have noticed that Pandora gives you (everyone? just subscribers?) the ability to view the lyrics of songs. For example, when I view "Not Going Anywhere" by Keren Ann, it gives me the full lyrics for the song (note: not every song has its lyrics in the Pandora database).

Pandora has been clever about how they display the lyrics. They actually don't come down with the page. The page uses AJAX to download the lyrics after you download the page. It then populates the correct place on the page with the lyrics. It also changes the mouseover properties so that you cannot use your browser to highlight those lyrics. Because the lyrics are populated dynamically, saving the page doesn't work either.

Well, I thought that was lousy. If the lyrics are displayed in plaintext on my browser, I should be able to at least highlight them. If they really wanted to prevent me from doing that, they'd build a GIF/JPG/PNG on their end and send me the lyrics in that, right?

So I figured out that I could use Firebug, the Firefox add-on, to do what Pandora didn't want me to do.
  1. Start Firebug.
  2. Start the "Console."
  3. Use the pull-down menu on the "Console" tab to "enable" the Console.
  4. Issue the JavaScript command
    alert(fullLyrics.innerHTML)
    on the console.
  5. A dialog box should pop up with the lyrics. Use your mouse to copy them to your clipboard.
  6. You can then disable the Firebug console using that same pull-down menu.
That worked for me. It should work until they change the names within the JavaScript.