Skip to content

Instantly share code, notes, and snippets.

@sorah
Created July 14, 2012 00:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorah/3108546 to your computer and use it in GitHub Desktop.
Save sorah/3108546 to your computer and use it in GitHub Desktop.
userscript for kget.jp: remove flash, and javascript will retrieve lyric for you; own your risk
// ==UserScript==
// @name kget_noflash
// @namespace http://sorah.jp/
// @description remove flash, and javascript will retrieve lyric for you; own your risk
// @include http://lyric.kget.jp/*
// ==/UserScript==
// License: Public Domain
window.addEventListener("load", function() {
var embed = document.querySelector(".pane noscript");
var sn = embed.innerHTML.match(/<param name="movie" value="http:\/\/lyric\.kget\.jp\/iframe\/lyric\.swf\?(sn=.+?)"/)[1];
var lyric_url = "http://lyric.kget.jp/iframe/sendlyric.aspx?" + sn;
var pane = embed.parentElement;
pane.innerHTML = "";
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(e) {
if (xhr.readyState == 4) {
var lyric_element = document.createElement("div");
lyric_element.innerHTML = xhr.responseText.replace(/^lyric=/,'').replace(/\r?\n/g,'<br>');
pane.appendChild(lyric_element);
}
};
xhr.open("GET", lyric_url)
xhr.send();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment