9,15 → 9,18 |
|
char download_path[]="/rd/1/.download"; |
char search_path[]="http://nigma.ru/index.php?s="; |
char version[]=" Text-based Browser 0.92"; |
char version[]=" Text-based Browser 0.93"; |
|
char tinypad_path[]="/sys/tinypad"; |
char t_edit_path[]="/sys/develop/t_edit"; |
|
|
struct TWebBrowser { |
int left, top, width, height; |
void DrawScroller(); |
void ShowPage(); |
void ParseHTML(dword, dword); |
void Scan(dword); |
void Scan(int); |
void WhatTextStyle(int left1, top1, width1); |
}; |
|
26,7 → 29,7 |
byte rez, b_text, i_text, u_text, s_text, pre_text, blq_text, li_text, link, ignor_text, li_tab, body_present; |
|
|
dword text_colors[10], |
dword text_colors[30], |
text_color_index, |
link_color, |
bg_color; |
41,7 → 44,10 |
parametr[1200], |
options[1000]; |
|
char anchor[256]; |
int anchor_line_num; |
|
|
#include "include\history.h" |
#include "include\colors.h" |
#include "include\unicode_tags.h" |
48,19 → 54,30 |
#include "include\some_code.h" |
|
|
void TWebBrowser::Scan(dword id) { |
void TWebBrowser::Scan(int id) { |
if (id > 399) |
{ |
GetURLfromPageLinks(id); |
//ýòó âñþ õðåíü íóæíî â GetNewUrl() ïåðåìåñòèòü |
if (URL[0] == '#') { //ìû íå óìååì ïåðåõîäèòü ïî ññûëêå âíóòðè äîêóìåíòà. Ïîêà ÷òî... |
copystr(BrowserHistory.CurrentUrl(), #editURL); |
copystr(#URL, #editURL + strlen(#editURL)); |
|
//#1 |
if (URL[0] == '#') |
{ |
copystr(#URL+find_symbol(#URL, '#'), #anchor); |
|
copystr(BrowserHistory.CurrentUrl(), #URL); |
//copystr(#editURL, #URL + strlen(#URL)); |
//copystr(#URL, #editURL); |
|
za_kadrom=count-max_kolvo_strok; |
ShowPage(#URL); |
return; |
} |
URL[find_symbol(#URL, '#')-1] = 0x00; //çàãëóøêà, íî ýòî íå ñîâñåì ïðàâèëüíî - â åäèòóðë äîëæíî îñòàâàòüñÿ |
//liner.ru#1 |
if (find_symbol(#URL, '#')<>-1) |
{ |
copystr(#URL+find_symbol(#URL, '#'), #anchor); |
URL[find_symbol(#URL, '#')-1] = 0x00; //çàãëóøêà |
} |
|
GetNewUrl(); |
|
117,8 → 134,12 |
return; |
case 052: //Íàæàòà F3 |
IF(edit1.flags <> 66) |
IF (strcmp(get_URL_part(5),"http:")<>0) RunProgram("tinypad", #URL); ELSE RunProgram("tinypad", #download_path); |
IF (!strcmp(get_URL_part(5),"http:")) RunProgram(#tinypad_path, #download_path); ELSE RunProgram(#tinypad_path, #URL); |
return; |
case 053: //Íàæàòà F4 |
IF(edit1.flags <> 66) |
IF (!strcmp(get_URL_part(5),"http:")) RunProgram(#t_edit_path, #download_path); ELSE RunProgram(#t_edit_path, #URL); |
return; |
|
case HOME: |
copystr("http://kolibri-os.narod.ru", #editURL); |
349,6 → 370,7 |
WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); //îáðàáîòêà òåãîâ |
|
line = tag = parametr = tagparam = ignor_param = 0; //âñ¸ îáíóëÿåì |
|
break; |
case '=': //ïîääåðæêà øàéòàíñêîé êîäèðîâêè ñòðàíèö, ñîõðàí¸ííûõ ÷åðåç ÈÅ7 |
IF(strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK; |
420,6 → 442,14 |
if (stroka * 10 + 15 <= height) |
DrawBar(left, stroka * 10 + top + 15, width - 15, -stroka * 10 + height - 15, bg_color); //çàêðàøèâàåì âñ¸ äî êîíöà |
if (za_kadrom == 0) count = stroka; |
|
if (anchor) |
{ |
anchor[0]=''; |
za_kadrom=anchor_line_num; |
ParseHTML(buf, filesize); |
} |
|
DrawScroller(); //ðèñóåì ñêðîëë |
} |
|
522,6 → 552,14 |
IF(!tag) return; |
stolbec += strlen(#line); |
|
if (anchor) && (!strcmp(#parametr, "id=")) //î÷åíü ïëîõî!!! ïîòîìó ÷òî åñëè íå ïîñëåäíèé òåã, ðàáîòàòü íå áóäåò |
{ |
if (!strcmp(#anchor, #options)) |
{ |
anchor_line_num=za_kadrom+stroka; |
} |
} |
|
if (!chTag("body")) |
{ |
BODY_MARK: |
550,11 → 588,15 |
return; |
} |
////////////////////////// |
if (!chTag("a")) { |
IF (stroka - 1 > max_kolvo_strok) || (stroka < -2) return; |
if (rez) { |
HREF: IF(strcmp(#parametr, "href=") == 0) { |
IF(link == 1) text_color_index--; //åñëè êàêîé-òî äîëáî¸á íå çàêðûë òýã |
if (!chTag("a")) |
{ |
if (rez) |
{ |
_A_MARK: |
if (!strcmp(#parametr, "href=")) |
{ |
if (stroka - 1 > max_kolvo_strok) || (stroka < -2) return; |
if (link == 1) text_color_index--; //åñëè êàêîé-òî äîëáî¸á íå çàêðûë òýã |
link = 1; |
blink++; |
text_color_index++; |
562,9 → 604,17 |
copystr(#options, #page_links + strlen(#page_links)); |
copystr("|", #page_links + strlen(#page_links)); |
} |
IF(tagparam) { |
if (anchor) && (!strcmp(#parametr, "name=")) |
{ |
if (!strcmp(#anchor, #options)) |
{ |
anchor_line_num=za_kadrom+stroka; |
} |
} |
if (tagparam) |
{ |
GetNextParam(); |
GOTO HREF; |
GOTO _A_MARK; |
} |
} |
ELSE { |