//#INFO 気象情報
//#VER 9
//#AUTH UK-taniyama
//#MAIL QVE00513@nifty.com
//#COPY (c)2003, UK-taniyama.
//#BRD tenki.jp tenki 気象情報
//#HLP tenki.jpの情報を取得して表示します。
//#HLP 無限にたまるので,適当なところで削除してください。
//#HLP 固定フォントにした。
//#HLP 注意報・警報・天気予報詳細対応(v0.2.9.19以降)
//////////////////////////////////////////////////////////////////////////////
rootURL = "tenki.jp";
function issupport(host,bbs)
{
return host==rootURL && bbs=="tenki";
}
function isnews(){ return 0;}
function iseuc(){ return 1;}
function isnumlink(){return 0;}
function isfixedfont(){ return 1;}
function board_url(host,bbs)
{
return host+"/index.html";;
}
function board_read()
{
var result;
var num = 0;
thread_add( "注意報・警報:"+my_get( "tyu", 0), "??tyu");
thread_add( "天気予報詳細:"+my_get( "yoh", 0), "??yoh");
while( html_go( HTML_START_TAG, "option")){
var value = html_attr( "value");
if( value=="-") continue;
if( left( value, 6)!="/yoh/y") continue;
if( html_next()==HTML_TEXT){
thread_add( html_text(), mid( value, 6, 2), 9999);
}
}
return 0;
}
function thread_url(host,bbs,key)
{
return host+"/yoh/y"+key+".html";
}
function thread_read()
{
if( !html_go( HTML_COMMENT, "-- area,date --")) return;
var title = html_pull( HTML_COMMENT, "-- /area,date --");
"\[([^ ]+)%title%.*\] 気象庁(.+)%date%" = title;
if( date==my_get( key())) return;
my_set( key(), date);
if( !html_go( HTML_COMMENT, "-- tenki1 --")) return;
if( !html_go( HTML_START_TAG, "table")) return;
if( !html_go( HTML_START_TAG, "table")) return;
var row = 0;
var col = 0;
var data[];
for( i=0; i<8; ++i){
data[i] = "";
}
var sentaku = "";
while( 1){
var type = html_next();
var text = 0;
if( type==HTML_START_TAG){
tag = html_tag();
if( tag=="table"){
if( !html_go( HTML_COMMENT, "-- sentaku_shisu --")) break;
sentaku = RegReplace( " ", "",
html_pull( HTML_COMMENT, "-- /sentaku_shisu --")
);
if( !html_go( HTML_COMMENT, "-- tenki2 --")) break;
if( !html_go( HTML_START_TAG, "table")) break;
if( !html_go( HTML_START_TAG, "table")) break;
row = 9;
col = 0;
}
else
if( tag=="tr"){ row++; col = 0;}
else
if( tag=="td" || tag=="th"){ col++;}
else
if( tag=="img"){ text = html_attr( "alt");}
}
else if( type==HTML_END_TAG){
tag = html_tag();
if( tag=="td" || tag=="th"){ col++;}
}
else if( type==HTML_TEXT){
text = html_text();
}
if( text==0 || text==""){
continue;
}
if( col%2==0) continue;
var n = col/2;
if( row<9){ // tenki1
if( row==3 || row==5){
n = n-2;
}
else{
n = n-1;
}
if( n<0) continue;
}
else{ // tenki2
if( row==13){
n = n;
}
else{
n = n+1;
}
if( n<=1) continue;
}
if( row==1 || row==11){
if( len( text)==7){
text = "0"+text;
}
if( InStr( text, "日")!=-1){
text = "%text%";
}
else if( InStr( text, "土")!=-1){
text = "%text%";
}
}
if( row==3 || row==4 || row==13 || row==14){
l = len( text);
if( l==1){
text = "- ";
}
else if( l==3){
text = " %text%";
}
}
if( row==2 || row==12){
text = RegReplace( "くもり", "曇", RegReplace( "晴れ", "晴", text));
var l = len( text);
if( l==2) text = " %text% ";
else
if( l==9) text = " %text% ";
else
if( l==10) text = " %text% ";
else
if( l==12) text = " %text% ";
}
var sep = "";
if( row==4 || row==6 || row==7 || row==8 || row==14){
sep = "/";
}
else if( row!=1 && row!=11){
sep = " ";
}
data[n] = data[n]+sep+text;
}
var message = " 日付 天気 気温 降水確率
";
for( i=0; i<8; ++i){
if( left( data[i], 1)=="-") continue;
message = message+data[i]+"
";
}
date =
RegReplace( "(", "(",
RegReplace( ")", ")",
RegReplace( " ", "",
date
)));
message =
RegReplace( "[%℃]", "",
"%message%
%sentaku%"
);
if( my_get( "tyu", 0)) message+= "
"+http_GET( "/tyu/"+key()+"t.html", "read_sub");
if( my_get( "yoh", 0)) message+= http_GET( "/yoh/"+key()+".html", "read_sub");
message =
RegReplace( "(", "(",
RegReplace( ")", ")",
message
));
message_add( title, 0, date, message, title);
}
function read_sub()
{
if( !html_go( HTML_COMMENT, "-- /TitleHeader --")) return;
if( !html_go( HTML_START_TAG, "table")) return;
return html_pull( HTML_END_TAG, "table");
}