WebView 1.7: a lot of various fixes: parsing tag, parsing comment, displaying '<' and '>' symbols in source code view, do not allow multiple downloaders. Thanks hidnplayr for reporting.

git-svn-id: svn://kolibrios.org@6986 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2017-09-17 12:35:45 +00:00
parent 5286e836d2
commit 6c90f5d75e
4 changed files with 35 additions and 9 deletions

View File

@ -180,8 +180,13 @@ void TWebBrowser::Prepare(){
bufpos++; bufpos++;
if (!strncmp(bufpos,"!--",3)) if (!strncmp(bufpos,"!--",3))
{ {
if (!strncmp(bufpos,"-->",3)) || (bufpointer + bufsize <= bufpos) break; bufpos+=3;
bufpos++; while (strncmp(bufpos,"-->",3)!=0) && (bufpos < bufpointer + bufsize)
{
bufpos++;
}
bufpos+=3;
break;
} }
tag = attr = tagparam = ignor_param = NULL; tag = attr = tagparam = ignor_param = NULL;
while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû

View File

@ -14,7 +14,7 @@ unsigned int GetNextParam()
if (kavichki) if (kavichki)
{ {
i=strrchr(#tagparam, kavichki); i = strrchr(#tagparam, kavichki);
strlcpy(#val, #tagparam + i, sizeof(val)); strlcpy(#val, #tagparam + i, sizeof(val));
} }
else else
@ -24,6 +24,7 @@ unsigned int GetNextParam()
strlcpy(#val, #tagparam + i, sizeof(val)); strlcpy(#val, #tagparam + i, sizeof(val));
WHILE (val[0] == ' ') strcpy(#val, #val+1); WHILE (val[0] == ' ') strcpy(#val, #val+1);
ESBYTE[strchr(#val, ' ')] = NULL;
} }
tagparam[i] = 0x00; tagparam[i] = 0x00;

View File

@ -30,7 +30,7 @@
char homepage[] = FROM "html\\homepage.htm""\0"; char homepage[] = FROM "html\\homepage.htm""\0";
#ifdef LANG_RUS #ifdef LANG_RUS
char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.62"; char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.7";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­" ?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤" ?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤"
char loading[] = "‡ £à㧪  áâà ­¨æë...<br>"; char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
@ -43,7 +43,7 @@ char rmb_menu[] =
Žç¨áâ¨âì ªíè ª à⨭®ª Žç¨áâ¨âì ªíè ª à⨭®ª
Œ¥­¥¤¦¥à § £à㧮ª"; Œ¥­¥¤¦¥à § £à㧮ª";
#else #else
char version[]="Text-based Browser 1.62"; char version[]="Text-based Browser 1.7";
?define IMAGES_CACHE_CLEARED "Images cache cleared" ?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last" ?define T_LAST_SLIDE "This slide is the last"
char loading[] = "Loading...<br>"; char loading[] = "Loading...<br>";
@ -569,10 +569,13 @@ void ClickLink()
if (UrlExtIs(".png")==true) || (UrlExtIs(".gif")==true) || (UrlExtIs(".jpg")==true) if (UrlExtIs(".png")==true) || (UrlExtIs(".gif")==true) || (UrlExtIs(".jpg")==true)
|| (UrlExtIs(".zip")==true) || (UrlExtIs(".kex")==true) || (UrlExtIs(".pdf")==true) || (UrlExtIs(".zip")==true) || (UrlExtIs(".kex")==true) || (UrlExtIs(".pdf")==true)
|| (UrlExtIs(".7z")==true) { || (UrlExtIs(".7z")==true) {
strcpy(#downloader_edit, #URL); if (!downloader_opened) {
CreateThread(#Downloader,#downloader_stak+4092); strcpy(#downloader_edit, #URL);
strcpy(#editURL, history.current()); CreateThread(#Downloader,#downloader_stak+4092);
strcpy(#URL, history.current()); strcpy(#editURL, history.current());
strcpy(#URL, history.current());
}
else notify("'WebView\nPlease, start a new download only when previous ended.'Et");
return; return;
} }
} }

View File

@ -19,17 +19,25 @@ dword ShowSource()
switch (ww) switch (ww)
{ {
case '<': case '<':
if (mode == COMMENT)
{
strcpy(new_buf, "&lt;");
new_buf+=4;
break;
}
if (ESBYTE[i+1]=='!') && (ESBYTE[i+2]=='-') && (ESBYTE[i+3]=='-') if (ESBYTE[i+1]=='!') && (ESBYTE[i+2]=='-') && (ESBYTE[i+3]=='-')
{ {
strcpy(new_buf, "<font color=#bbb>&lt;"); strcpy(new_buf, "<font color=#bbb>&lt;");
new_buf+=21; new_buf+=21;
mode = COMMENT; mode = COMMENT;
break;
} }
if (mode != COMMENT) if (mode != COMMENT)
{ {
strcpy(new_buf, "<font color=#00f>&lt;"); strcpy(new_buf, "<font color=#00f>&lt;");
new_buf+=21; new_buf+=21;
mode = TAG; mode = TAG;
break;
} }
break; break;
case '>': case '>':
@ -38,18 +46,27 @@ dword ShowSource()
strcpy(new_buf, "&quot;</font>"); strcpy(new_buf, "&quot;</font>");
new_buf+=13; new_buf+=13;
mode = TAG; mode = TAG;
break;
} }
if (mode == COMMENT) && (ESBYTE[i-1]=='-') && (ESBYTE[i-2]=='-') if (mode == COMMENT) && (ESBYTE[i-1]=='-') && (ESBYTE[i-2]=='-')
{ {
strcpy(new_buf, "&gt;</font>"); strcpy(new_buf, "&gt;</font>");
new_buf+=11; new_buf+=11;
mode = TEXT; mode = TEXT;
break;
}
if (mode == COMMENT)
{
strcpy(new_buf, "&gt;");
new_buf+=4;
break;
} }
if (mode == TAG) if (mode == TAG)
{ {
strcpy(new_buf, "&gt;</font>"); strcpy(new_buf, "&gt;</font>");
new_buf+=11; new_buf+=11;
mode = TEXT; mode = TEXT;
break;
} }
break; break;
case '\"': case '\"':