HTMLv 0.71 network should work. Maked quickly, not tested pretty good, so... you understand... If I'll have muse tomorrow, I'll will bring to mind this fix.

git-svn-id: svn://kolibrios.org@2368 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2012-02-21 22:22:44 +00:00
parent 24dfe231b8
commit 6a006901a5

View File

@ -2,9 +2,7 @@
//Web-component, Leency & Veliant 2007-2009
//lev
//èäåÿ - ëåâûå ôàéëû îòêðûâàòü ñîîòâåòñòâóþùèìè ïðîãàìè
//wintodos(buf); -> â ïàðñå õòìë êàê è âñå êîäèðîâêè
//ol - öèôåðêè
int downloader_id;
@ -18,7 +16,7 @@ dword j,
char download_path[]="/rd/1/.download";
//char search_path[]="http://nova.rambler.ru/search?words=";
char search_path[]="http://nigma.ru/index.php?s=";
char version[]=" Text-based Browser 23.70";
char version[]=" Text-based Browser 23.71";
struct TWebBrowser {
@ -58,7 +56,7 @@ char line[330],
#include "include\unicode_tags.h--"
void TWebBrowser::Scan(dword id) {
IF (id > 399)
if (id > 399)
{
j = 0;
FOR(i = 0; i <= id - 401; i++) {
@ -67,6 +65,19 @@ void TWebBrowser::Scan(dword id) {
}
page_links[j] = 0x00;
copystr(#page_links[find_symbol(#page_links, '|')], #URL);
//Lee 21.02 {
IF (URL[0] == '#') { //ìû íå óìååì ïåðåõîäèòü ïî ññûëêå âíóòðè äîêóìåíòà. Ïîêà ÷òî...
copystr(#editURL, #URL);
return;
}
URL[find_symbol(#URL, '#')-1] = 0x00; //çàãëóøêà, ëó÷øå, ÷åì íè÷åãî (õàáð, íàïðèìåð, áóäåò ðàáîòàòü)
GetNewUrl();
if (!strcmp(get_URL_part(5),"http:"))) HttpLoad();
//Lee 21.02 }
Load(#URL);
Draw_Window();
return;
@ -110,6 +121,7 @@ void TWebBrowser::Scan(dword id) {
case GOTOURL:
case 0x0D: //enter
copystr(#editURL, #URL);
if (!strcmp(get_URL_part(5),"http:"))) HttpLoad();
Load(#URL);
return;
case 173: //ctrl+enter
@ -151,29 +163,6 @@ void TWebBrowser::Scan(dword id) {
ParseHTML(buf, filesize);
}
//ñêðîëë
void TWebBrowser::DrawScroller() {
dword on_y;
DrawBar(left + width - 15, top + 17, 1, height - 34, 0x94AECE); //ëèíèÿ ñëåâà îò ïðîêðóòêè
DrawFlatButton(left + width - 15, top + height - 17, 16, 16, ID2, 0xE4DFE1, "\x19");
DrawFlatButton(left + width - 15, top, 16, 16, ID1, 0xE4DFE1, "\x18");
IF(count <= max_kolvo_strok) {
DrawBar(left + width - 14, top + 17, 16, height - 34, 0xCED0D0);
return;
}
scroll_size = height - 16 * max_kolvo_strok / count - 3;
IF(scroll_size < 10) scroll_size = 10;
IF(za_kadrom + max_kolvo_strok >= count) on_y = height - scroll_size + top - 17;
ELSE on_y = height - 32 * za_kadrom / count + top + 16;
DrawFlatButton(left + width - 15, on_y, 16, scroll_size, 0, 0xE4DFE1, ""); //ïîëçóíîê
IF(on_y > top + 17) DrawBar(left + width - 14, top + 17, 16, on_y - top - 17, 0xCED0D0); //ïîëå äî ïîëçóíêà
IF(height - scroll_size + top - 17 > on_y)
DrawBar(left + width - 14, on_y + scroll_size + 1, 16, height - scroll_size - on_y + top - 18, 0xCED0D0); //ïîëå ïîñëå ïîëçóíêà
}
void GetNewUrl(){
IF (!strcmp(get_URL_part(2),"./")) copystr(#URL+1,#URL);
//IF (!strcmp(get_URL_part(3),"../"))
@ -202,20 +191,8 @@ void HttpLoad()
IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]='';
downloader_id = RunProgram("/sys/network/downloader", #URL);
IF (downloader_id<0) RunProgram("@notify", "Error running Downloader. Internet unavilable.");
RunProgram("/sys/network/downloader", #URL);
}
/* if (!strcmp(get_URL_part(5),"http:")))
{
IF (DO_LOAD) && (!WindowRePaint)
{
HttpLoad();
//RETURN;
}
file_size stdcall (#download_path);
}
ELSE file_size stdcall (#URL);
*/
void ReadHtml()
{
@ -228,21 +205,15 @@ void ReadHtml()
if (!filesize) /*{Pause(200); ReadHtml();}*/ return; //Lee 22.09
mem_Free(buf);
buf = mem_Alloc(filesize);
ReadFile(0, filesize, buf, #URL);
if (!strcmp(get_URL_part(5),"http:")))
ReadFile(0, filesize, buf, #download_path);
else
ReadFile(0, filesize, buf, #URL);
}
void TWebBrowser::Load(dword adress) {
IF (URL[0] == '#') { //ìû íå óìååì ïåðåõîäèòü ïî ññûëêå âíóòðè äîêóìåíòà. Ïîêà ÷òî...
copystr(#editURL, #URL);
return;
}
URL[find_symbol(#URL, '#')-1] = 0x00; //çàãëóøêà, ëó÷øå, ÷åì íè÷åãî (õàáð, íàïðèìåð, áóäåò ðàáîòàòü)
GetNewUrl();
max_kolvo_stolbcov = width - 30 / 6;
max_kolvo_strok = height - 3 / 10 - 2;
copystr(#version, #header);
@ -758,4 +729,27 @@ void TextGoDown(int left1, top1, width1) {
ELSE stolbec = 0;
IF(li_text == 1) stolbec = li_tab * 5;
IF(stroka >= 0) && (stroka - 2 < max_kolvo_strok) DrawBar(left1 - 5, top1 + 10, width1 + 5, 10, 0xFFFFFF);
}
//ñêðîëë
void TWebBrowser::DrawScroller() {
dword on_y;
DrawBar(left + width - 15, top + 17, 1, height - 34, 0x94AECE); //ëèíèÿ ñëåâà îò ïðîêðóòêè
DrawFlatButton(left + width - 15, top + height - 17, 16, 16, ID2, 0xE4DFE1, "\x19");
DrawFlatButton(left + width - 15, top, 16, 16, ID1, 0xE4DFE1, "\x18");
IF(count <= max_kolvo_strok) {
DrawBar(left + width - 14, top + 17, 16, height - 34, 0xCED0D0);
return;
}
scroll_size = height - 16 * max_kolvo_strok / count - 3;
IF(scroll_size < 10) scroll_size = 10;
IF(za_kadrom + max_kolvo_strok >= count) on_y = height - scroll_size + top - 17;
ELSE on_y = height - 32 * za_kadrom / count + top + 16;
DrawFlatButton(left + width - 15, on_y, 16, scroll_size, 0, 0xE4DFE1, ""); //ïîëçóíîê
IF(on_y > top + 17) DrawBar(left + width - 14, top + 17, 16, on_y - top - 17, 0xCED0D0); //ïîëå äî ïîëçóíêà
IF(height - scroll_size + top - 17 > on_y)
DrawBar(left + width - 14, on_y + scroll_size + 1, 16, height - scroll_size - on_y + top - 18, 0xCED0D0); //ïîëå ïîñëå ïîëçóíêà
}