7c3339 | 2001-09-27 | Martin Nilsson | |
|
6be57a | 2001-08-15 | Per Hedbor | | #include <roxen.h>
#define _(X,Y) _DEF_LOCALE("roxen_config",X,Y)
constant box = "large";
constant box_initial = 0;
|
9dd83d | 2022-09-14 | Henrik Grubbström (Grubba) | | constant box_position = 4;
|
2ecde2 | 2003-01-15 | Henrik Grubbström (Grubba) | | LocaleString box_name = _(398,"Todays MegaTokyo comic");
LocaleString box_doc = _(399,"Todays comic from MegaTokyo");
|
6be57a | 2001-08-15 | Per Hedbor | |
string parse( RequestID id )
{
string data;
string contents = "";
if( !(data = .Box.get_http_data("www.megatokyo.com",80,"GET / HTTP/1.0" ) ))
contents = "Fetching data from megatokyo...";
else
{
string img;
|
378c75 | 2001-10-08 | Per Hedbor | | string status;
|
6be57a | 2001-08-15 | Per Hedbor | |
|
1c66ec | 2001-10-03 | Per Hedbor | | sscanf( data, "%*sstrips/%s.gif", img );
|
6be57a | 2001-08-15 | Per Hedbor | | sscanf( data, "%*s<!--%*sstuff you%*s - start -->%s<!--", status );
|
378c75 | 2001-10-08 | Per Hedbor | | if( !img )
|
a72e50 | 2001-10-04 | Per Hedbor | | return ("<box type='"+box+"' title='"+box_name+"'>"+data+"</box>");
|
378c75 | 2001-10-08 | Per Hedbor | | if( !status )
status = "";
|
890db2 | 2001-08-15 | Per Hedbor | | array st = status/"<br>";
string tmp;
status = "<font size=-1>";
if( sizeof( st ) > 4 )
{
sscanf( st[0], "%*s>\n%s", tmp );
status += tmp +"<br />due "+ st[1]+ " (";
sscanf( st[2], "%*s%[0-9]%% done", tmp );
status += tmp+"% done)<br />\n";
status += "<i>"+st[3]+"</i><br />";
for( int i = 4; i<sizeof(st); i++ )
status += (st[i]/"</font")[0]+"<br />";
status = "<cimg format=png src='/internal-roxen-pixel-orange' "
" scale='"+(int)(2.8*(int)tmp)+",12'/>"
"<cimg format=png src='/internal-roxen-pixel-black' "
" scale='"+(int)(280-(2.5*(int)tmp))+",12' />"
"<br />"+status;
}
status += "</font>";
|
6be57a | 2001-08-15 | Per Hedbor | | contents =
"<a href='http://www.megatokyo.com/'>"
|
890db2 | 2001-08-15 | Per Hedbor | | "<center><cimg format=png border=0 max-width=390 "
"src='http://www.megatokyo.com/strips/"+img+".gif' /></center>"
"</a><br /><b>Next strip:</b>"+status;
|
6be57a | 2001-08-15 | Per Hedbor | |
}
return ("<box type='"+box+"' title='"+box_name+"'>"+contents+"</box>");
}
|