Created
September 5, 2008 16:47
-
-
Save hayamiz/8988 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Ubiquity plugin | |
// Latest earth quake information by tenki.jp | |
CmdUtils.CreateCommand({ | |
name: "quake", | |
author: {name: "Y. Hayamizu", email: "[email protected]"}, | |
description: "Check latest earthquake information in Japan.", | |
preview: function(pblock){ | |
jQuery.ajax({ | |
url: "http://tenki.jp/earthquake/", | |
dataType: "html", | |
type: "GET", | |
success: function(html){ | |
var htmlstr = html.toString(); | |
var start = htmlstr.search(/<body>/); | |
var end = htmlstr.search(/<\/body>/) + "</body>".length; | |
var bodystr = htmlstr.substring(start, end); | |
var tempElement = CmdUtils.getHiddenWindow().document.createElementNS("http://www.w3.org/1999/xhtml", "div"); | |
tempElement.innerHTML = bodystr; | |
var imgdom = jQuery(jQuery(tempElement).find("div.earthquakeWrap")[0]).find("img")[0]; | |
pblock.innerHTML = '<img src="' + imgdom.src + '" width="480" />'; | |
} | |
}); | |
}, | |
execute: function(){ | |
Utils.openUrlInBrowser("http://tenki.jp/earthquake/"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment