Created
January 20, 2009 16:15
-
-
Save snaka/49538 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
/* appjet:version 0.1 */ | |
// Vimperator document localization project | |
var projectUrl = "http://wiki.livedoor.jp/shin_yan/d/vimperator%202%2e0%20%a5%d8%a5%eb%a5%d7%cb%dd%cc%f5%a5%d7%a5%ed%a5%b8%a5%a7%a5%af%a5%c8?wiki_id=67820" | |
var wiki = wget(projectUrl); | |
function wash(str) { | |
if(!str) return ''; | |
str = str.replace(/<[^>]+>/g, ''); | |
str = str.replace(/%/g, ''); | |
return str; | |
} | |
wiki = wiki.replace(/[\n\r ]/g, ''); | |
var tbl = wiki.match(/<table>(.*)<\/table>/)[0]; | |
var rows = tbl.split(/<\/tr>/); | |
var count = 0; | |
var sum = 0; | |
rows.forEach(function(row) { | |
var cols = row.split(/<\/td>/); | |
if (wash(cols[0]) == '') return; | |
sum += parseInt(wash(cols[1])); | |
++count; | |
}); | |
var done = Math.floor(sum / count); | |
var remain = 100 - done; | |
var imageUrl = "http://chart.apis.google.com/chart?chs=500x200&chd=t:"+done+","+remain+"&cht=p3&chl=done("+ done +"\%)|remain(" + remain + "\%)"; | |
if (request.path == '/image' || request.path == '/chart.png') { | |
response.redirect(imageUrl); | |
} | |
else { | |
print(H1("Vimperatorヘルプ翻訳プロジェクト進捗")); | |
print(DIV(IMG({src: imageUrl}))); | |
print(link(projectUrl, "プロジェクトページへ")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment