forked from KolibriOS/kolibrios
HTMLv 23.70
git-svn-id: svn://kolibrios.org@2228 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
f20c948791
commit
db9a61710d
@ -24,7 +24,7 @@ dword max_kolvo_strok,
|
||||
max_kolvo_stolbcov,
|
||||
kolichestvo;
|
||||
|
||||
int za_kadrom,
|
||||
int za_kadrom,
|
||||
razm_scrl,
|
||||
mouse_dd;
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
22.09.11 -- v0.70 -- 11.3 Кб
|
||||
- улучшен и оптимизирован код обработки юникодовских тегов (&), исправлен
|
||||
и дополнен их список;
|
||||
- устранён вылет программы при нажатии клавиши CapsLock (спасибо Mario);
|
||||
- заглушка на вылет программы при загрузке страниц из и-нэта (спасибо Mario).
|
||||
|
||||
13.09.11 -- v0.69 -- 11.2 Кб
|
||||
- нормальная прокрутка изображений;
|
||||
- работа с файлами любого размера;
|
||||
|
@ -18,7 +18,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.69";
|
||||
char version[]=" Text-based Browser 23.70";
|
||||
|
||||
|
||||
struct TWebBrowser {
|
||||
@ -37,6 +37,7 @@ TWebBrowser WB1;
|
||||
|
||||
#include "include\history.h--"
|
||||
#include "include\colors.h--"
|
||||
#include "include\unicode_tags.h--"
|
||||
|
||||
void TWebBrowser::Scan(dword id) {
|
||||
IF (id > 399) {
|
||||
@ -57,7 +58,6 @@ void TWebBrowser::Scan(dword id) {
|
||||
} //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè
|
||||
switch (id) {
|
||||
case 011:
|
||||
case 004:
|
||||
ReadHtml();
|
||||
break;
|
||||
case BACK:
|
||||
@ -185,6 +185,7 @@ void ReadHtml(byte DO_LOAD)
|
||||
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);
|
||||
RETURN;
|
||||
}
|
||||
file_size stdcall (#download_path);
|
||||
@ -192,6 +193,7 @@ void ReadHtml(byte DO_LOAD)
|
||||
ELSE file_size stdcall (#URL);
|
||||
|
||||
filesize = EBX;
|
||||
IF (!filesize) return; //Lee 22.09
|
||||
mem_Free(buf);
|
||||
buf = mem_Alloc(filesize);
|
||||
ReadFile(0, filesize, buf, #URL);
|
||||
@ -221,6 +223,9 @@ void TWebBrowser::Load(dword adress) {
|
||||
edit_box_draw stdcall(#edit1); //ðèñóåì ñòðîêó àäðåñà
|
||||
|
||||
ReadHtml(LETS_LOAD);
|
||||
|
||||
IF (!filesize) return; //Lee 22.09
|
||||
|
||||
wintodos(buf);
|
||||
ParseHTML(buf, filesize);
|
||||
IF(!strlen(buf)) {
|
||||
@ -266,6 +271,7 @@ void TWebBrowser::ParseHTML(dword bword, fsize){
|
||||
line = '';
|
||||
copystr("|", #page_links);
|
||||
IF(!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1; //çà÷¸òíîå îòîáðàæåíèå òåêñòà
|
||||
//IF(!strcmp(#URL + strlen(#URL) - 4, ".rtf")) pre_text = 1;
|
||||
IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1;
|
||||
IF(za_kadrom == 0) || (WindowRePaint) DrawBar(left, top, width - 15, 15, 0xFFFFFF); //çàêðàøèâàåì ïåðâóþ ñòðîêó
|
||||
for (; buf + fsize > bword; bword++;) {
|
||||
@ -338,44 +344,80 @@ void TWebBrowser::ParseHTML(dword bword, fsize){
|
||||
|
||||
bukva=Hex2Symb(#temp);
|
||||
IF (bukva) goto DEFAULT_MARK;
|
||||
break;
|
||||
case '&':
|
||||
break;
|
||||
/*case '\\': //ïîääåğæêà rtf
|
||||
IF(strcmp(#URL + strlen(#URL) - 4, ".rtf")<>0) goto DEFAULT_MARK;
|
||||
|
||||
bword++;
|
||||
IF (ESBYTE[bword] =='\'')
|
||||
{
|
||||
bword++;
|
||||
bukva=ESBYTE[bword];
|
||||
copystr(#bukva, #temp);
|
||||
|
||||
bword++;
|
||||
bukva=ESBYTE[bword];
|
||||
copystr(#bukva, #temp + strlen(#temp));
|
||||
|
||||
bukva=Hex2Symb(#temp);
|
||||
IF (bukva) goto DEFAULT_MARK;
|
||||
}
|
||||
else
|
||||
{
|
||||
FOR (j=0; (ESBYTE[bword] <>'\\') && (buf + fsize < bword); j++; bword++;)
|
||||
{
|
||||
bukva = ESBYTE[bword];
|
||||
copystr(#bukva, #tag + strlen(#tag));
|
||||
}
|
||||
IF ((!strcmp(#tag, "par\0x0a")) || (!strcmp(#tag, "par\0x0b"))) stroka++;
|
||||
tag='';
|
||||
bword--;
|
||||
}
|
||||
break;*/
|
||||
|
||||
case '&': //îáğàáîòêà òåãîâ òèïà
|
||||
IF(ignor_text) break;
|
||||
bword++;
|
||||
j = 0;
|
||||
WHILE(ESBYTE[bword] <>';') && (j < 7) {
|
||||
tag='';
|
||||
FOR (j=0; (ESBYTE[bword] <>';') && (j < 7); j++; bword++;)
|
||||
{
|
||||
bukva = ESBYTE[bword];
|
||||
copystr(#bukva, #tag + strlen(#tag));
|
||||
bword++;
|
||||
j++;
|
||||
}
|
||||
bukva = ''; //âñş ıòó õğåíü íàäî çàëàáàòü ÷åğåç ìàñèâ
|
||||
IF(!strcmp("nbsp", #tag)) copystr(" ", #line + strlen(#line));
|
||||
IF(!strcmp("copy", #tag)) || (!strcmp("#169", #tag)) copystr("(c)", #line + strlen(#line));
|
||||
IF(!strcmp("reg", #tag)) || (!strcmp("#174", #tag)) copystr("(r)", #line + strlen(#line));
|
||||
|
||||
FOR (j=0; unicode_tags[j]!=0; j+=2;)
|
||||
{
|
||||
IF(!strcmp(#tag, unicode_tags[j]))
|
||||
{
|
||||
copystr(unicode_tags[j+1], #line + strlen(#line));
|
||||
break 1;
|
||||
}
|
||||
}
|
||||
|
||||
rez = StrToInt(#tag + 1) - 1040;
|
||||
IF(tag[1] == '1') && (strlen(#tag) == 5) bukva = utf100tmmv_mas[rez];
|
||||
IF(!strcmp("bdquo", #tag)) copystr(",,", #line + strlen(#line));
|
||||
IF(!strcmp("amp", #tag)) || (!strcmp("#38", #tag)) bukva = '&';
|
||||
IF(!strcmp("lt", #tag)) || (!strcmp("#60", #tag)) bukva = '<';
|
||||
IF(!strcmp("gt", #tag)) || (!strcmp("#62", #tag)) bukva = '>';
|
||||
IF(!strcmp("minus", #tag)) || (!strcmp("#8722", #tag)) bukva = '-';
|
||||
IF(!strcmp("#151", #tag)) || (!strcmp("#149", #tag)) || (!strcmp("ndash", #tag)) bukva = '-';
|
||||
IF(!strcmp("#39", #tag)) || (!strcmp("#96", #tag)) bukva = '\'';
|
||||
IF(!strcmp("quot", #tag)) || (!strcmp("#34", #tag)) || (!strcmp("ldquo", #tag)) || (!strcmp("rdquo", #tag)) bukva = '"';
|
||||
tag = '';
|
||||
//break;
|
||||
IF(tag[1] == '1') && (rez>1040) && (rez<1118) && (strlen(#tag) == 5)
|
||||
{
|
||||
bukva = utf100tmmv_mas[rez];
|
||||
copystr(#bukva, #line + strlen(#line));
|
||||
break;
|
||||
}
|
||||
|
||||
WriteDebug("Unknown tag");
|
||||
WriteDebug(#tag);
|
||||
copystr(#tag, #line + strlen(#line)); //âûâîäèì íà ıêğàí íåîáğàáîòàííûé òåã, òàê áğàóçåğû çà÷åì-òî äåëàşò
|
||||
break;
|
||||
default:
|
||||
DEFAULT_MARK:
|
||||
IF(ignor_text) break;
|
||||
IF(pre_text == 0) && (bukva == ' ') && (strcmp(#line + strlen(#line) - 1, " ") == 0) continue;
|
||||
//
|
||||
if (stolbec + strlen(#line) > max_kolvo_stolbcov) && (w_title == 0) {
|
||||
if (stolbec + strlen(#line) > max_kolvo_stolbcov) && (w_title == 0)
|
||||
{
|
||||
copystr(#line + find_symbol(#line, ' '), #temp); //ïåðåíîñ ïî ñëîâàì
|
||||
line[find_symbol(#line, ' ')] = 0x00;
|
||||
NEXT_MARK: IF(stroka - 1 > max_kolvo_strok) && (za_kadrom <>0) break 1; //óõîäèì...
|
||||
WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); //âûâîä ñòðîêè
|
||||
TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //çàêğàøèâàåì ñòğîêó âêîíöå
|
||||
TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //çàêğàøèâàåì ñëåäóùóş ñòğîêó
|
||||
copystr(#temp, #line);
|
||||
}
|
||||
IF(pre_text == 0) && (bukva == ' ') && (stolbec == 0) && (strlen(#line) == 0) CONTINUE;
|
||||
|
80
programs/network/htmlv/browser/include/acid=1.htm
Normal file
80
programs/network/htmlv/browser/include/acid=1.htm
Normal file
@ -0,0 +1,80 @@
|
||||
<!--doctype html public "-//w3c//dtd html 4.0 transitional//ru"-->
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
|
||||
<title>Çàãîëîâîê ýòîãî äîêóìåíòà</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#000000" text="#FFFFFF">
|
||||
|
||||
<b>Ýòî òåñòîâàÿ ñòðàíèöà äëÿ ïðîâåðêè HTML Viewer</b><br />
|
||||
<br />
|
||||
Ýòà ïðîãðàììà ïîääåðæèâàåò êîäèðîâêó cp1251(Win), koi-8 (Linux, *BSD, àäåïòû Ñâÿòîãî Ïàòðèêà),
|
||||
cp866 (DOS) è åù¸ äâå Þíèêîäîâñêèõ.<br><br>
|
||||
|
||||
<b>
|
||||
<font color="#FF0000">C</font>
|
||||
<font color="#FFC005">r</font>
|
||||
<font color="#F6F574">e</font>
|
||||
<font color="#9EFC36">a</font>
|
||||
<font color="#29FDFD">t</font>
|
||||
<font color="#36A8FC">e</font>
|
||||
<font color="#C911FF">d </font>
|
||||
<font color="#C911FF">b</font>
|
||||
<font color= #C911FF >y </font>
|
||||
<font color="#C911FF">L</font>
|
||||
<font color="#36A8FC">e</font>
|
||||
<font color="#29FDFD">e</font>
|
||||
<font color="#9EFC36">n</font>
|
||||
<font color="#FFC005">c</font>
|
||||
<font color="#FF0000">y</font><br>
|
||||
</b>
|
||||
Æèòîìèð 2008
|
||||
|
||||
<p>
|
||||
Íåáîëüøîé ñïèñîê:<ol>
|
||||
<li><q>Ýòîò òåêñò â êàâû÷êàõ</q></li>
|
||||
<li><u>Ýòî ïîä÷åðêíóòûé òåêñò</u></li>
|
||||
<li><s>Ýòî ïåðå÷åðêíóòûé òåêñò</s></li>
|
||||
<li><i>Ýòî íàêëîííûé òåêñò</i></li>
|
||||
<li><strong>Ýòî òåêñò ñ óñèëåííûì âûäåëåíèåì</strong></li>
|
||||
<li><b><u><s><font color="#6495ED">Êó÷à òåãîâ</font></s></u></b></ol>
|
||||
</p>
|
||||
<br>
|
||||
|
||||
<pre>
|
||||
Àòü!
|
||||
Äâà!
|
||||
Òðè!
|
||||
|
||||
Àâòîð ñåãî òâîðåíèÿ íå èçâåñòåí...
|
||||
|
||||
</pre>
|
||||
<!--ýòîãî òåêñòà çäåñü <íåò>-->
|
||||
<hr color="#758999">
|
||||
 ýòîì òåêñòå åñòü ïåðåõîä íà ñëåäóþùóþ ñòðîêó, íî áðàóçåð
|
||||
åãî äîëæåí ïðîèãíîðèðîâàòü. Åùå ìíîãî ïðîáåëîâ. À òóò åñòü
|
||||
òàáû. Êîå-êàêèå ñèìâîëû: " & < > • © ® „ “ — ¯æà÷îê ³íøîãî áîêó ð. ªâôðàò ç'¿â ´ðóíò òà ºâðåéñüêèé ´åðáàëàéô.
|
||||
|
||||
<p><a href='index.htm'>Íà ãëàâíóþ ñòðàíèöó</a></p>
|
||||
<p><a href="index.htm" id="#end">×òåíèå íå ïîñëåäíåãî òåãà</a></p>
|
||||
<p><a href="img_mv.files/logo.jpg" id="#end">Ïîñìîòðèòå íÿøíîå èçîáðàæåíèå</a></p>
|
||||
|
||||
|
||||
1 '
|
||||
2 "
|
||||
3 ↑
|
||||
4 &uarr
|
||||
5 ↓
|
||||
6 «
|
||||
7 »
|
||||
8 >
|
||||
9 −
|
||||
10 <
|
||||
11 >
|
||||
12 –
|
||||
13 ’
|
||||
14 “
|
||||
|
||||
</body>
|
||||
</html>
|
@ -17,8 +17,6 @@
|
||||
#define DONT_LOAD 0
|
||||
#define LETS_LOAD 1
|
||||
|
||||
byte utf100tmmv_mas[77] = "€亗儎厗噲墛媽崕彁憭摂晼棙櫄洔潪煚、¥ウЖ┆<D096><E29486><EFBFBD>徕沅彐玷殛腱眍镳駂<E995B3>i\244j";
|
||||
|
||||
|
||||
dword get_URL_part(byte len) {
|
||||
char temp1[1000];
|
||||
|
73
programs/network/htmlv/browser/include/unicode_tags.h--
Normal file
73
programs/network/htmlv/browser/include/unicode_tags.h--
Normal file
@ -0,0 +1,73 @@
|
||||
|
||||
|
||||
byte utf100tmmv_mas[77] = "€<>‚ƒ„…†‡ˆ‰Š‹Œ<E280B9>Ž<EFBFBD><C5BD>‘’“”•–—˜™š›œ<E280BA>žŸ ¡¢£¤¥¦§¨©ª«¬®¯àáâãäåæçèéêëìíîïðñh£\243i\105\244\0";
|
||||
|
||||
/* IF (BL==178) ESBYTE[ESI] = 73; //I
|
||||
IF (BL==179) ESBYTE[ESI] = 105; //i
|
||||
IF (BL==175) ESBYTE[ESI] = 244; //J
|
||||
IF (BL==191) ESBYTE[ESI] = 245; //j
|
||||
IF (BL==170) ESBYTE[ESI] = 242; //E
|
||||
IF (BL==186) ESBYTE[ESI] = 243; //e
|
||||
IF (BL==168) ESBYTE[ESI] = 240; //à
|
||||
IF (BL==184) ESBYTE[ESI] = 'e'; //e
|
||||
IF (BL==180) ESBYTE[ESI] = 254; //£
|
||||
IF ((BL==147) || (BL==148) || (BL==171) || (BL==187)) ESBYTE[ESI] = 34;
|
||||
IF ((BL==150) || (BL==151)) ESBYTE[ESI] = 45;
|
||||
*/
|
||||
|
||||
char *unicode_tags[]={
|
||||
"nbsp", " ",
|
||||
"#38", " ",
|
||||
|
||||
"copy", "(c)",
|
||||
"#169", "(c)",
|
||||
|
||||
"reg", "(r)",
|
||||
"#174", "(r)",
|
||||
|
||||
"bdquo", ",,",
|
||||
|
||||
"amp", "&",
|
||||
"#38", "&",
|
||||
|
||||
"lt", "<",
|
||||
"#60", "<",
|
||||
|
||||
"gt", ">",
|
||||
"#62", ">",
|
||||
|
||||
"minus", "-",
|
||||
"ndash", "-",
|
||||
"#8722", "-",
|
||||
"#8211", "-",
|
||||
"#151", "-",
|
||||
"#149", "-",
|
||||
|
||||
"rsquo", "'",
|
||||
"#39", "'",
|
||||
"#96", "'",
|
||||
"#8217", "'",
|
||||
|
||||
"quot", "\"",
|
||||
"#34", "\"",
|
||||
"ldquo", "\"",
|
||||
"rdquo", "\"",
|
||||
"#8222","\"",
|
||||
"#8221", "\"",
|
||||
|
||||
"laquo", "<<",
|
||||
"raquo", ">>",
|
||||
|
||||
"uarr", "\24",
|
||||
"darr", "\25",
|
||||
"rarr", "\26",
|
||||
"larr", "\27",
|
||||
|
||||
"#1028","\242",
|
||||
"#1030","I",
|
||||
"#1031","\244",
|
||||
|
||||
"#8470","N",
|
||||
"percnt","%",
|
||||
|
||||
0};
|
Loading…
Reference in New Issue
Block a user