Subversion Repositories Kolibri OS

Rev

Rev 3060 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3060 Rev 3061
Line 279... Line 279...
279
	if (!strcmp(get_URL_part(5),"http:")))
279
	if (!strcmp(get_URL_part(5),"http:")))
280
	{
280
	{
281
		KillProcess(downloader_id); //óáèâàåì ñòàðûé ïðîöåññ
281
		KillProcess(downloader_id); //óáèâàåì ñòàðûé ïðîöåññ
282
		DeleteFile(#download_path);
282
		DeleteFile(#download_path);
283
		IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]='';
283
		IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]=NULL;
284
		downloader_id = RunProgram("/sys/network/downloader", #URL);
284
		downloader_id = RunProgram("/sys/network/downloader", #URL);
285
		//Browser Hack v2.0
285
		//Browser Hack v2.0
286
		Pause(60);
286
		Pause(60);
287
		if (GetProcessSlot(downloader_id)<>0)
287
		if (GetProcessSlot(downloader_id)<>0)
288
		{
288
		{
289
			debug("Browser Hack v2.0: Killing downloader and trying to run it one more!");
289
			debug("Browser Hack v2.0: Killing downloader and trying to run it one more!");
Line 342... Line 342...
342
	b_text = i_text = u_text = s_text = blq_text = first_line_drawed =
342
	b_text = i_text = u_text = s_text = blq_text = first_line_drawed =
343
	li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = 0; //îáíóëÿåì òåãè
343
	li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = 0; //îáíóëÿåì òåãè
344
	link_color = 0x0000FF;
344
	link_color = 0x0000FF;
345
	bg_color = 0xFFFFFF;
345
	bg_color = 0xFFFFFF;
346
	line = '';
346
	line = NULL;
347
	strcpy(#page_links,"|");
347
	strcpy(#page_links,"|");
348
	strcpy(#header, #version);
348
	strcpy(#header, #version);
Line 349... Line 349...
349
 
349
 
350
	if (pre_text<>2)
350
	if (pre_text<>2)
Line 362... Line 362...
362
		{
362
		{
363
		case 0x0a:
363
		case 0x0a:
364
			if (pre_text)
364
			if (pre_text)
365
			{
365
			{
366
				bukva = temp = '';
366
				bukva = temp = NULL;
367
				goto NEXT_MARK;
367
				goto NEXT_MARK;
368
			}
368
			}
369
		case '\9':
369
		case '\9':
370
			if (pre_text) //èíà÷å èä¸ì íà 0x0d	
370
			if (pre_text) //èíà÷å èä¸ì íà 0x0d	
371
			{
371
			{
372
				tab_len=strlen(#line)/8;
372
				tab_len=strlen(#line)/8;
Line 400... Line 400...
400
				bukva = ESBYTE[bword];
400
				bukva = ESBYTE[bword];
401
				strcat(#tag, #bukva);
401
				strcat(#tag, #bukva);
402
			}
402
			}
403
			
403
			
Line 404... Line -...
404
			for (j=0; unicode_tags[j]!=0; j+=2;) 
-
 
405
			{
-
 
406
				if (!strcmp(#tag, unicode_tags[j]))
-
 
407
				{
-
 
408
					strcat(#line, unicode_tags[j+1]);
-
 
409
					break 1;
-
 
410
				}
-
 
411
			}
-
 
412
			
-
 
413
			rez = atoi(#tag + 1) - 1040;
-
 
414
			if (tag[1] == '1') && (rez>=0) && (rez<=72) && (strlen(#tag) == 5)
-
 
415
			{
-
 
416
				bukva = unicode_chars[rez];
404
			bukva = GetUnicodeSymbol();
417
				//GOTO DEFAULT_MARK; //îáðàáàòûâàåì áóêâó ëó÷øå íàâåðíî strcat(#line, unicode_tags[j+1]); è break 1; 
-
 
418
				strcat(#line, #bukva);
405
			if (bukva) goto DEFAULT_MARK;
419
				break; 
-
 
420
			}
-
 
421
			
-
 
422
			strcat(#line,#tag); //âûâîäèì íà ýêðàí íåîáðàáîòàííûé òåã, òàê áðàóçåðû çà÷åì-òî äåëàþò
-
 
423
			break;
406
			break;
424
		case '<':
407
		case '<':
425
			bword++; //ïðîìîòàåì ñèìâîë <
408
			bword++; //ïðîìîòàåì ñèìâîë <
426
			tag = parametr = tagparam = ignor_param = NULL;
409
			tag = parametr = tagparam = ignor_param = NULL;
427
			if (ESBYTE[bword] == '!') //ôèëüòðàöèÿ âíóòðè , äåðçêî
410
			if (ESBYTE[bword] == '!') //ôèëüòðàöèÿ âíóòðè , äåðçêî
Line 514... Line 497...
514
	if (lines.first == 0) lines.all = stroka;
497
	if (lines.first == 0) lines.all = stroka;
515
	if (anchor)
498
	if (anchor)
516
	{
499
	{
517
		//åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë
500
		//åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë
518
		anchor='';
501
		anchor=NULL;
519
		lines.first=anchor_line_num;
502
		lines.first=anchor_line_num;
520
		ParseHTML(buf);
503
		ParseHTML(buf);
521
	}
504
	}
522
 
505
 
Line 523... Line 506...
523
	DrawScroller();
506
	DrawScroller();
Line 595... Line 578...
595
	{
578
	{
596
		rez = 0;
579
		 rez = 0;
597
		strcpy(#tag, #tag+1);
580
		 strcpy(#tag, #tag+1);
598
	}
581
	}
599
	else
582
	else rez = 1;
600
		rez = 1;
-
 
601
		
583
		
Line 602... Line 584...
602
	if (!chTag("html")) {
584
	if (!chTag("html"))
-
 
585
	{
603
		IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (rez==0) ignor_text = 1; ELSE ignor_text = 0;
586
		IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (rez==0) ignor_text = 1; ELSE ignor_text = 0;
604
		return;
587
		return;
605
	}
588
	}
Line 606... Line 589...
606
 
589
 
Line 607... Line 590...
607
	if (!chTag("script")) || (!chTag("style")) || (!chTag("binary")) ignor_text = rez;
590
	if (!chTag("script")) || (!chTag("style")) || (!chTag("binary")) ignor_text = rez;
608
 
591
 
609
	if(!chTag("title"))
-
 
610
	{
-
 
611
		if (rez)
592
	if(!chTag("title"))
612
		{
-
 
613
			header=0;
593
	{
614
		}
-
 
615
		else //òåã çàêðûëñÿ - âûâåëè ñòðîêó
-
 
616
		{
-
 
617
			if (stroka==0) DrawTitle(#header);
594
		if (rez) header=NULL;
618
		}
595
		else if (!stroka) DrawTitle(#header); //òåã çàêðûëñÿ - âûâåëè ñòðîêó
Line 619... Line 596...
619
		return;
596
		return;
Line 628... Line 605...
628
 
605
 
Line 629... Line 606...
629
 
606
 
630
	if (anchor) && (!strcmp(#parametr, "id=")) //î÷åíü ïëîõî!!! ïîòîìó ÷òî åñëè íå ïîñëåäíèé òåã, ðàáîòàòü íå áóäåò
607
	if (anchor) && (!strcmp(#parametr, "id=")) //î÷åíü ïëîõî!!! ïîòîìó ÷òî åñëè íå ïîñëåäíèé òåã, ðàáîòàòü íå áóäåò
631
	{
-
 
632
		if (!strcmp(#anchor, #options))
-
 
633
		{
608
	{
634
			anchor_line_num=lines.first+stroka;
-
 
635
		}
609
		if (!strcmp(#anchor, #options))	anchor_line_num=lines.first+stroka;
Line 636... Line 610...
636
	}
610
	}
637
	
611
	
638
	if (!chTag("body"))
612
	if (!chTag("body"))
639
	{
-
 
640
		BODY_MARK:
-
 
641
		
613
	{
642
		if (!strcmp(#parametr, "link="))
-
 
643
			link_color = GetColor(#options);
-
 
644
		
614
		do{
645
		if (!strcmp(#parametr, "text="))
-
 
646
			text_colors[0]=GetColor(#options);
615
			if (!strcmp(#parametr, "link=")) link_color = GetColor(#options);
647
		
-
 
648
		if (!strcmp(#parametr, "bgcolor="))
-
 
649
			bg_color=GetColor(#options);
-
 
650
		
-
 
651
		IF(tagparam)
616
			if (!strcmp(#parametr, "text=")) text_colors[0]=GetColor(#options);
652
		{
-
 
653
			GetNextParam();
-
 
Line 654... Line 617...
654
			GOTO BODY_MARK;
617
			if (!strcmp(#parametr, "bgcolor=")) bg_color=GetColor(#options);
655
		}
618
		} while(GetNextParam());
Line 656... Line 619...
656
		
619
		
657
		return;
620
		return;
658
	}
621
	}
659
 
622
 
660
	if (!chTag("a"))
-
 
661
	{
623
	if (!chTag("a"))
Line 662... Line 624...
662
		if (rez)
624
	{
663
		{
625
		if (rez)
664
			 
626
		{
665
			if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à íå áûë çàêðûò
627
			if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à íå áûë çàêðûò
Line 666... Line 628...
666
 
628
 
Line 684... Line 646...
684
				{
646
					{
685
					anchor_line_num=lines.first+stroka;
647
						anchor_line_num=lines.first+stroka;
686
				}
648
					}
687
			}
649
				}
688
			if (tagparam)
650
			} while(GetNextParam());
689
			{
-
 
690
				GetNextParam();
-
 
691
				GOTO _A_MARK;
651
		}
692
			}
-
 
693
		}
-
 
694
		else {
652
		else {
695
			link = 0;
653
			link = 0;
696
			IF(text_color_index > 0) text_color_index--;
654
			IF(text_color_index > 0) text_color_index--;
697
		}
655
		}
698
		return;
656
		return;
Line 705... Line 663...
705
		{
663
		{
706
			text_color_index++;
664
			text_color_index++;
707
			text_colors[text_color_index] = text_colors[text_color_index-1];
665
			text_colors[text_color_index] = text_colors[text_color_index-1];
708
		
666
		
Line 709... Line 667...
709
			COL_MARK:
667
			do{
710
			if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#')
668
				if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#')
711
			{
669
				{
712
				text_colors[text_color_index] = GetColor(#options);
670
					text_colors[text_color_index] = GetColor(#options);
713
			}
671
				}
714
			IF(tagparam) {
-
 
715
				GetNextParam();
672
			} while(GetNextParam());
716
				GOTO COL_MARK;
-
 
717
			}
-
 
718
		}
673
		}
719
		else
674
		else
720
			if (text_color_index > 0) text_color_index--;
675
			if (text_color_index > 0) text_color_index--;
721
		return;
676
		return;
722
	}
677
	}
Line 743... Line 698...
743
		strcpy(#oldtag, #tag);
698
		strcpy(#oldtag, #tag);
744
		return;
699
		return;
745
	}
700
	}
746
	else
701
	else
747
		oldtag='';
702
		oldtag=NULL;
748
		
703
		
Line 749... Line 704...
749
	if (!chTag("b")) || (!chTag("strong")) || (!chTag("big")) {
704
	if (!chTag("b")) || (!chTag("strong")) || (!chTag("big")) {
750
		b_text = rez;
705
		b_text = rez;
751
		return;
706
		return;
752
	}
707
	}
Line 793... Line 748...
793
 
748
 
Line 794... Line 749...
794
	if (!chTag("img"))
749
	if (!chTag("img"))
795
	{
750
	{
796
		if (GetFileInfo(libimg)<>0) return;  //åñëè áèáëèîòåêè íåò
751
		if (GetFileInfo(libimg)<>0) return;  //åñëè áèáëèîòåêè íåò
797
		IMG_TAG:
752
		do{
798
			if (!strcmp(#parametr,"src="))   //íàäî îáúåäèíèòü ñ GetNewUrl()
753
			if (!strcmp(#parametr,"src="))   //íàäî îáúåäèíèòü ñ GetNewUrl()
799
			{
754
			{
800
				if (downloader_id) strcpy(#temp, #history_list[history_current-1].Item);
755
				if (downloader_id) strcpy(#temp, #history_list[history_current-1].Item);
801
					else strcpy(#temp, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
756
					else strcpy(#temp, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
802
				if (strcmpn(#temp, "http:", 5)!=0) || (strcmpn(#options, "http:", 5)!=0)
757
				if (strcmpn(#temp, "http:", 5)!=0) || (strcmpn(#options, "http:", 5)!=0)
Line 814... Line 769...
814
				strcat(#alt, #options);
769
				strcat(#alt, #options);
815
				strcat(#alt, "]");
770
				strcat(#alt, "]");
816
			}
771
			}
817
 
772
 
Line 818... Line -...
818
		IF(tagparam)
-
 
819
		{
-
 
820
			GetNextParam();
773
		} while(GetNextParam());
821
			GOTO IMG_TAG;
-
 
822
		}
-
 
Line 823... Line 774...
823
		
774
		
824
		if (!image) 
775
		if (!image) 
825
		{
776
		{
826
			if (alt) && (link) strcat(#line, #alt);
777
			if (alt) && (link) strcat(#line, #alt);
Line 853... Line 804...
853
	}
804
	}
854
 
805
 
Line 855... Line 806...
855
	if (!chTag("meta")) || (!chTag("?xml"))
806
	if (!chTag("meta")) || (!chTag("?xml"))
856
	{
807
	{
857
		META:
808
		do{
858
		if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content=")) || (!strcmp(#parametr, "encoding="))
809
			if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content=")) || (!strcmp(#parametr, "encoding="))
859
		{
810
			{
860
			strcpy(#options, #options[strrchr(#options, '=')]); //ïîèñê â content=
811
				strcpy(#options, #options[strrchr(#options, '=')]); //ïîèñê â content=
Line 861... Line 812...
861
 
812
 
862
			if (!strcmp(#options,"utf-8"))   || (!strcmp(#options,"utf8"))      ReadHtml(_UTF);
813
				if (!strcmp(#options,"utf-8"))   || (!strcmp(#options,"utf8"))      ReadHtml(_UTF);
863
			if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u"))   ReadHtml(_KOI);
814
				if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u"))   ReadHtml(_KOI);
864
			if (!strcmp(#options, "dos"))    || (!strcmp(#options, "cp-866"))   ReadHtml(_DOS);
815
				if (!strcmp(#options, "dos"))    || (!strcmp(#options, "cp-866"))   ReadHtml(_DOS);
865
		}
-
 
866
		if (tagparam)
-
 
867
		{
816
			}
868
			GetNextParam();
-
 
869
			goto META;
-
 
870
		}
817
		} while(GetNextParam());
871
		return;
818
		return;
872
	}
819
	}