Subversion Repositories Kolibri OS

Rev

Rev 5981 | Rev 5985 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3067 leency 1
//HTML Viewer in C--
3987 leency 2
//Copyright 2007-2013 by Veliant & Leency
3107 leency 3
//Asper, lev, Lrz, Barsuk, Nable...
3067 leency 4
//home icon - rachel fu, GPL licence
5
 
4085 leency 6
#ifndef AUTOBUILD
7
	#include "lang.h--"
8
#endif
9
 
3107 leency 10
//libraries
5981 leency 11
#define MEMSIZE 1060000
5499 leency 12
#include "..\lib\gui.h"
4508 leency 13
#include "..\lib\draw_buf.h"
14
#include "..\lib\list_box.h"
15
#include "..\lib\cursor.h"
5978 leency 16
#include "..\lib\collection.h"
5981 leency 17
#include "..\lib\font.h"
18
 
3107 leency 19
//*.obj libraries
5499 leency 20
#include "..\lib\obj\box_lib.h"
21
#include "..\lib\obj\libio_lib.h"
22
#include "..\lib\obj\libimg_lib.h"
23
#include "..\lib\obj\http.h"
5690 leency 24
#include "..\lib\obj\iconv.h"
5408 leency 25
//useful patterns
26
#include "..\lib\patterns\libimg_load_skin.h"
5978 leency 27
#include "..\lib\patterns\history.h"
5408 leency 28
 
5493 leency 29
char homepage[] = FROM "html\\homepage.htm";
4677 leency 30
 
4026 leency 31
#ifdef LANG_RUS
5811 leency 32
	char version[]=" Текстовый браузер 1.40";
4416 leency 33
	?define IMAGES_CACHE_CLEARED "Кэш картинок очищен"
4417 leency 34
	?define T_LAST_SLIDE "Это последний слайд"
4550 leency 35
	char loading[] = "Загрузка страницы...
";
4677 leency 36
	char page_not_found[] = FROM "html\page_not_found_ru.htm";
4649 leency 37
	char accept_language[]= "Accept-Language: ru\n";
4026 leency 38
#else
5811 leency 39
	char version[]=" Text-based Browser 1.40";
4026 leency 40
	?define IMAGES_CACHE_CLEARED "Images cache cleared"
4417 leency 41
	?define T_LAST_SLIDE "This slide is the last"
4550 leency 42
	char loading[] = "Loading...
";
4677 leency 43
	char page_not_found[] = FROM "html\page_not_found_en.htm";
4649 leency 44
	char accept_language[]= "Accept-Language: en\n";
4026 leency 45
#endif
46
 
5773 leency 47
#define URL_SERVICE_HISTORY "WebView://history"
48
#define URL_SERVICE_HOME "WebView://home"
49
#define URL_SERVICE_SOURCE "WebView://source:"
5631 pavelyakov 50
 
3067 leency 51
proc_info Form;
52
 
5772 leency 53
//char search_path[]="http://nigma.ru/index.php?s=";
4558 hidnplayr 54
int redirected = 0;
3067 leency 55
 
4074 leency 56
char stak[4096];
5640 pavelyakov 57
 
4026 leency 58
int action_buf;
59
 
4565 leency 60
dword http_transfer = 0;
4537 leency 61
dword http_buffer;
4534 leency 62
 
5772 leency 63
dword TOOLBAR_H = 33;
5519 leency 64
dword STATUSBAR_H = 15;
4718 leency 65
dword col_bg;
66
dword panel_color;
67
dword border_color;
4677 leency 68
 
5718 leency 69
progress_bar wv_progress_bar;
4718 leency 70
byte souce_mode = false;
4677 leency 71
 
5718 leency 72
enum {
73
	BACK_BUTTON=1000,
74
	FORWARD_BUTTON,
75
	REFRESH_BUTTON,
76
	GOTOURL_BUTTON,
77
	SANDWICH_BUTTON
78
};
79
 
80
enum {
5768 leency 81
	VIEW_SOURCE=1100,
5718 leency 82
	EDIT_SOURCE,
83
	VIEW_HISTORY,
84
	FREE_IMG_CACHE,
85
	DOWNLOAD_MANAGER
86
};
87
 
4411 leency 88
#include "..\TWB\TWB.c"
5768 leency 89
#include "menu.h"
4636 leency 90
#include "history.h"
4718 leency 91
#include "show_src.h"
5685 leency 92
#include "network_get.h"
5493 leency 93
#include "downloader.h"
3067 leency 94
 
4534 leency 95
char editURL[sizeof(URL)];
96
int	mouse_twb;
5772 leency 97
edit_box address_box = {250,56,34,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(URL),#editURL,#mouse_twb,2,19,19};
4534 leency 98
 
99
 
3067 leency 100
void main()
101
{
5711 leency 102
	dword btn;
3067 leency 103
	int half_scroll_size;
4026 leency 104
	int scroll_used=0, show_menu;
4536 leency 105
	CursorPointer.Load(#CursorFile);
5626 leency 106
	load_dll(boxlib, #box_lib_init,0);
107
	load_dll(libio, #libio_init,1);
108
	load_dll(libimg, #libimg_init,1);
109
	load_dll(libHTTP, #http_lib_init,1);
5690 leency 110
	load_dll(iconv_lib, #iconv_open,0);
5718 leency 111
	//load_dll(kmenu, #akmenu_init,0);
5408 leency 112
	Libimg_LoadImage(#skin, abspath("wv_skin.png"));
113
	SetSkinColors();
5772 leency 114
	CreateDir("/tmp0/1/downloads");
115
	if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME);
5678 leency 116
	WB1.DrawBuf.zoom = 1;
5712 leency 117
	WB1.list.SetFont(8, 14, 10111000b);
5779 leency 118
	WB1.list.no_selection = true;
5981 leency 119
	//font init
120
	font.no_bg_copy = true;
121
	font.bg_color   = 0xFFFFFF;
122
	font.load(DEFAULT_FONT);
123
	if (!font.data) {
124
		notify("'Error: Font is not loaded.' -E");
125
		ExitProcess();
126
	}
127
	//
4536 leency 128
	SetEventMask(0xa7);
5631 pavelyakov 129
	BEGIN_LOOP_APPLICATION:
3067 leency 130
		WaitEventTimeout(2);
131
		switch(EAX & 0xFF)
132
		{
133
			CASE evMouse:
4081 leency 134
				if (!CheckActiveProcess(Form.ID)) break;
3466 leency 135
				edit_box_mouse stdcall (#address_box);
5640 pavelyakov 136
				mouse.get();
5772 leency 137
				if (WB1.list.MouseOver(mouse.x, mouse.y))
3067 leency 138
				{
5825 leency 139
					PageLinks.Hover(mouse.x, WB1.list.first*WB1.list.item_h + mouse.y, link_color_inactive, link_color_active, bg_color);
5772 leency 140
					if (bufsize) && (mouse.pkm) && (mouse.up) { CreateThread(#menu_rmb,#stak+4092); break; }
141
					if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
3067 leency 142
				}
5782 leency 143
				scrollbar_v_mouse (#scroll_wv);
144
				if (WB1.list.first != scroll_wv.position)
3067 leency 145
				{
5782 leency 146
					WB1.list.first = scroll_wv.position;
147
					WB1.DrawPage();
148
					break;
3067 leency 149
				}
150
				break;
5711 leency 151
 
3067 leency 152
			case evButton:
153
				btn=GetButtonID();
4636 leency 154
				if (btn==1)	ExitProcess();
155
				Scan(btn);
3067 leency 156
				break;
5711 leency 157
 
3067 leency 158
			case evKey:
5711 leency 159
				GetKeys();
5531 leency 160
				if (address_box.flags & 0b10)
5530 leency 161
				{
5711 leency 162
					if (key_ascii == ASCII_KEY_ENTER) Scan(key_scancode); else
163
					if (key_ascii != 0x0d) && (key_ascii != 183) && (key_ascii != 184) {EAX = key_ascii << 8; edit_box_key stdcall(#address_box);}
5530 leency 164
				}
5711 leency 165
				else
166
				{
167
					Scan(key_scancode);
168
				}
5530 leency 169
				break;
3067 leency 170
 
171
			case evReDraw:
4636 leency 172
				if (action_buf) Scan(action_buf);
5773 leency 173
				DefineAndDrawWindow(GetScreenWidth()-800/2,GetScreenHeight()-600/2,800,600,0x73,col_bg,0,0);
4725 leency 174
				GetProcessInfo(#Form, SelfInfo);
4727 leency 175
				if (Form.status_window>2) { DrawTitle(#header); break; }
5811 leency 176
				if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; }
177
				if (Form.width<280) { MoveSize(OLD,OLD,280,OLD); break; }
3067 leency 178
				Draw_Window();
179
				break;
4540 leency 180
 
4536 leency 181
			case evNetwork:
4540 leency 182
				if (http_transfer > 0) {
5534 hidnplayr 183
					http_receive stdcall (http_transfer);
4677 leency 184
					$push EAX
185
					ESI = http_transfer;
5519 leency 186
					wv_progress_bar.max = ESI.http_msg.content_length;
187
					if (wv_progress_bar.value != ESI.http_msg.content_received)
4686 leency 188
					{
5519 leency 189
						wv_progress_bar.value = ESI.http_msg.content_received;
4686 leency 190
						DrawProgress();
191
					}
4677 leency 192
					$pop EAX
193
					if (EAX == 0) {
4558 hidnplayr 194
						ESI = http_transfer;
195
						// Handle redirects
4563 leency 196
						if (ESI.http_msg.status >= 300) && (ESI.http_msg.status < 400)
197
						{
4558 hidnplayr 198
							redirected++;
4563 leency 199
							if (redirected<=5)
200
							{
5773 leency 201
								http_find_header_field stdcall (http_transfer, "location\0");
4558 hidnplayr 202
								if (EAX!=0) {
203
									ESI = EAX;
204
									EDI = #URL;
205
									do {
206
										$lodsb;
207
										$stosb;
208
									} while (AL != 0) && (AL != 13) && (AL != 10));
209
									DSBYTE[EDI-1]='\0';
210
								}
4563 leency 211
							}
212
							else
213
							{
5772 leency 214
								notify("Too many redirects");
215
								StopLoading();
216
								break;
4558 hidnplayr 217
							}
4563 leency 218
						}
219
						else
220
						{
4558 hidnplayr 221
							redirected = 0;
222
						}
4554 leency 223
						// Loading the page is complete, free resources
4563 leency 224
						if (redirected>0)
225
						{
4643 leency 226
							http_free stdcall (http_transfer);
227
							http_transfer=0;
4686 leency 228
							PageLinks.GetAbsoluteURL(#URL);
5978 leency 229
							History.back();
4558 hidnplayr 230
							strcpy(#editURL, #URL);
5718 leency 231
							DrawEditBox();
4558 hidnplayr 232
							OpenPage();
4563 leency 233
						}
234
						else
235
						{
5978 leency 236
							History.add(#URL);
4643 leency 237
							ESI = http_transfer;
238
							bufpointer = ESI.http_msg.content_ptr;
239
							bufsize = ESI.http_msg.content_received;
240
							http_free stdcall (http_transfer);
241
							http_transfer=0;
4645 leency 242
							SetPageDefaults();
5772 leency 243
							ShowPage();
4558 hidnplayr 244
						}
4536 leency 245
					}
246
				}
3067 leency 247
		}
5631 pavelyakov 248
	goto BEGIN_LOOP_APPLICATION;
3067 leency 249
}
250
 
251
void SetElementSizes()
252
{
5772 leency 253
	address_box.top = TOOLBAR_H/2-7;
4677 leency 254
	address_box.width = Form.cwidth - address_box.left - 25 - 22;
5678 leency 255
	WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x / WB1.DrawBuf.zoom,
5711 leency 256
		Form.cheight - TOOLBAR_H - STATUSBAR_H, WB1.list.font_h + WB1.DrawBuf.zoom + WB1.DrawBuf.zoom * WB1.DrawBuf.zoom);
5749 leency 257
	WB1.list.wheel_size = 7;
5710 leency 258
	WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
5825 leency 259
	WB1.list.visible = WB1.list.h - 5 / WB1.list.item_h;
5773 leency 260
	if (WB1.list.w!=WB1.DrawBuf.bufw) WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h * 30);
3067 leency 261
}
262
 
5981 leency 263
 
5982 leency 264
 
3067 leency 265
void Draw_Window()
266
{
5982 leency 267
	int list__w;
5772 leency 268
	DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, panel_color);
5718 leency 269
	DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3);
4677 leency 270
	DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
3067 leency 271
	SetElementSizes();
5772 leency 272
	DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+5, 20,border_color);
273
	DefineButton(address_box.left-50, address_box.top-2, 23, skin.h-2, BACK_BUTTON+BT_HIDE, 0);
274
	DefineButton(address_box.left-26, address_box.top-2, 23, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0);
275
	img_draw stdcall(skin.image, address_box.left-51, address_box.top-3, 48, skin.h, 3, 0);
5718 leency 276
	DefineButton(address_box.left+address_box.width+1, address_box.top-3, 16, skin.h-1, REFRESH_BUTTON+BT_HIDE+BT_NOFRAME, 0);
277
	DefineButton(Form.cwidth-24, address_box.top-3, 19, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0);
278
	img_draw stdcall(skin.image, Form.cwidth-22, address_box.top-3, 16, skin.h, 85, 0);
4677 leency 279
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
280
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
5772 leency 281
	if (!header) OpenPage(); else { WB1.DrawPage(); DrawEditBox(); }
4692 leency 282
	DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
4693 leency 283
	DrawProgress();
5981 leency 284
 
5982 leency 285
	/*
5981 leency 286
	list__w = 200;
287
	font.buffer_size = 0;
288
	font.size.height = 200;
289
	font.color = 0;
290
	font.size.text = 11;
291
	font.prepare_buf(10,10,list__w,font.size.height, "Hello World!");
292
	font.color = 0xFF00FF;
293
	font.size.text = 12;
294
	font.prepare_buf(10,23,list__w,font.size.height, "How are you?");
295
	font.color = 0x2E74BB;
296
	font.size.text = 15;
297
	font.prepare_buf(11,40,list__w,font.size.height, "Fine");
298
	SmoothFont(font.buffer, font.size.width, font.size.height);
299
	_PutImage(0,0,list__w,font.size.height,font.buffer);
5982 leency 300
	*/
3067 leency 301
}
302
 
303
 
5711 leency 304
void Scan(dword id__)
4413 leency 305
{
4636 leency 306
	action_buf=0;
5781 leency 307
	if (WB1.list.ProcessKey(id__)) WB1.DrawPage();
5779 leency 308
	else switch (id__)
4413 leency 309
	{
5711 leency 310
		case SCAN_CODE_BS:
5718 leency 311
		case BACK_BUTTON:
5978 leency 312
			if (History.back()) {
313
				strcpy(#URL, History.current());
314
				OpenPage();
315
			}
5711 leency 316
			return;
5718 leency 317
		case FORWARD_BUTTON:
5978 leency 318
			if (History.forward()) {
319
				strcpy(#URL, History.current());
320
				OpenPage();
321
			}
5711 leency 322
			return;
5718 leency 323
		case GOTOURL_BUTTON:
5772 leency 324
		case SCAN_CODE_ENTER:
325
			if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/') || (!strncmp(#editURL,"WebView:",9))
326
			{
327
				strcpy(#URL, #editURL);
328
			}
5711 leency 329
			else
5772 leency 330
			{
5803 leency 331
				strlcpy(#URL,"http://",7);
5772 leency 332
				strcat(#URL, #editURL);
333
			}
5711 leency 334
			OpenPage();
335
			return;
5718 leency 336
		case 063: //F5
337
			IF(address_box.flags & 0b10) return;
338
		case REFRESH_BUTTON:
5713 leency 339
			if (http_transfer > 0)
340
			{
341
				StopLoading();
342
				Draw_Window();
343
			}
344
			else OpenPage();
345
			return;
5718 leency 346
		case SANDWICH_BUTTON:
347
			mouse.y = TOOLBAR_H-6;
348
			mouse.x = Form.cwidth - 167;
349
			CreateThread(#menu_rmb,#stak+4092);
4415 leency 350
			return;
5718 leency 351
		case VIEW_SOURCE:
352
			WB1.list.first = 0;
353
			ShowSource();
5773 leency 354
			WB1.LoadInternalPage(bufpointer, bufsize);
5718 leency 355
			break;
356
		case EDIT_SOURCE:
357
			if (!strncmp(#URL,"http:",5))
358
			{
359
				WriteFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
360
				if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
361
			}
362
			else RunProgram("/rd/1/tinypad", #URL);
4415 leency 363
			return;
5718 leency 364
		case FREE_IMG_CACHE:
4491 leency 365
			ImgCache.Free();
4416 leency 366
			notify(IMAGES_CACHE_CLEARED);
5766 leency 367
			WB1.DrawPage();
4415 leency 368
			return;
5718 leency 369
		case VIEW_HISTORY:
4677 leency 370
			strcpy(#URL, URL_SERVICE_HISTORY);
4544 leency 371
			OpenPage();
372
			return;
5718 leency 373
		case DOWNLOAD_MANAGER:
5519 leency 374
			if (!downloader_opened) {
5803 leency 375
				strlcpy(#DL_URL, "http://",7);
5519 leency 376
				CreateThread(#Downloader,#downloader_stak+4092);
377
			}
4413 leency 378
			return;
379
	}
380
}
381
 
382
 
4636 leency 383
void StopLoading()
384
{
5631 pavelyakov 385
	if (http_transfer)
4647 leency 386
	{
387
		EAX = http_transfer;
388
		EAX = EAX.http_msg.content_ptr;		// get pointer to data
389
		$push	EAX							// save it on the stack
390
		http_free stdcall (http_transfer);	// abort connection
391
		$pop	EAX
5631 pavelyakov 392
		free(EAX);						// free data
4647 leency 393
		http_transfer=0;
394
		bufsize = 0;
5631 pavelyakov 395
		bufpointer = free(bufpointer);
4647 leency 396
	}
5519 leency 397
	wv_progress_bar.value = 0;
5718 leency 398
	img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 52, 0);
4645 leency 399
}
400
 
401
void SetPageDefaults()
402
{
403
	strcpy(#header, #version);
404
	WB1.list.count = WB1.list.first = 0;
405
	stroka = 0;
5704 leency 406
	cur_encoding = CH_NULL;
4645 leency 407
	if (o_bufpointer) o_bufpointer = free(o_bufpointer);
4636 leency 408
	anchor_line_num=WB1.list.first;
409
	anchor[0]='|';
410
}
411
 
4416 leency 412
void OpenPage()
413
{
4636 leency 414
	StopLoading();
4718 leency 415
	souce_mode = false;
4416 leency 416
	strcpy(#editURL, #URL);
5978 leency 417
	History.add(#URL);
5631 pavelyakov 418
	if (!strncmp(#URL,"WebView:",8))
4692 leency 419
	{
420
		SetPageDefaults();
5747 leency 421
		if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
5631 pavelyakov 422
		else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
5772 leency 423
		DrawEditBox();
4692 leency 424
		return;
425
	}
5631 pavelyakov 426
	if (!strncmp(#URL,"http:",5))
4416 leency 427
	{
5718 leency 428
		img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 131, 0);
5534 hidnplayr 429
		http_get stdcall (#URL, 0, 0, #accept_language);
4636 leency 430
		http_transfer = EAX;
5631 pavelyakov 431
		if (!http_transfer)
4646 leency 432
		{
433
			StopLoading();
434
			bufsize = 0;
5631 pavelyakov 435
			bufpointer = free(bufpointer);
4646 leency 436
			ShowPage();
437
			return;
438
		}
4416 leency 439
	}
4636 leency 440
	else
441
	{
442
		file_size stdcall (#URL);
443
		bufsize = EBX;
4650 leency 444
		if (bufsize)
445
		{
5631 pavelyakov 446
			free(bufpointer);
447
			bufpointer = malloc(bufsize);
4650 leency 448
			SetPageDefaults();
4718 leency 449
			ReadFile(0, bufsize, bufpointer, #URL);
4650 leency 450
		}
4645 leency 451
		ShowPage();
4636 leency 452
	}
4416 leency 453
}
4415 leency 454
 
4718 leency 455
DrawEditBox()
4508 leency 456
{
5772 leency 457
	DrawWideRectangle(address_box.left-2, address_box.top-2, address_box.width+3, 19, 2, address_box.color);
4718 leency 458
	address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
459
	address_box.offset = 0;
4508 leency 460
	edit_box_draw stdcall(#address_box);
5772 leency 461
	if (http_transfer > 0) EAX = 131; else EAX = 52;
462
	img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, EAX, 0);
4718 leency 463
}
4415 leency 464
 
4718 leency 465
 
466
void ShowPage()
467
{
468
	DrawEditBox();
4540 leency 469
	if (!bufsize)
4508 leency 470
	{
5773 leency 471
		if (http_transfer) WB1.LoadInternalPage(#loading, sizeof(loading));
472
		else WB1.LoadInternalPage(#page_not_found, sizeof(page_not_found));
4508 leency 473
	}
474
	else
5768 leency 475
	{
5766 leency 476
		WB1.Prepare();
5768 leency 477
	}
5773 leency 478
	//if (!header) strcpy(#header, #version);
4508 leency 479
	if (!strcmp(#version, #header)) DrawTitle(#header);
480
}
481
 
5493 leency 482
byte UrlExtIs(dword ext)
483
{
5631 pavelyakov 484
	if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true;
485
	return false;
5493 leency 486
}
4508 leency 487
 
5772 leency 488
int SetSkinColors()
489
{
490
	dword image_data;
491
	image_data = DSDWORD[skin.image+24];
492
	col_bg = DSDWORD[image_data];
493
	panel_color  = DSDWORD[skin.w*4*4 + image_data];
494
	border_color = DSDWORD[skin.w*4*7 + image_data];
495
	wv_progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data];
496
	$and col_bg, 0x00ffffff
497
	$and panel_color, 0x00ffffff
498
	$and border_color, 0x00ffffff
499
	$and wv_progress_bar.progress_color, 0x00ffffff
500
}
4544 leency 501
 
5772 leency 502
void DrawProgress()
503
{
504
	unsigned long btn;
505
	if (http_transfer == 0) return;
506
	if (wv_progress_bar.max) btn = address_box.width*wv_progress_bar.value/wv_progress_bar.max; else btn = 30;
507
	DrawBar(address_box.left-2, address_box.top+15, btn, 2, wv_progress_bar.progress_color);
508
}
5746 leency 509
 
5774 leency 510
void ClickLink()
511
{
512
	if (http_transfer > 0)
513
	{
514
		StopLoading();
5978 leency 515
		History.back();
5774 leency 516
	}
5772 leency 517
 
5774 leency 518
	strcpy(#URL, PageLinks.GetURL(PageLinks.active));
519
	//#1
520
	if (URL[0] == '#')
521
	{
522
		strcpy(#anchor, #URL+strrchr(#URL, '#'));
5978 leency 523
		strcpy(#URL, History.current());
5774 leency 524
		WB1.list.first=WB1.list.count-WB1.list.visible;
525
		ShowPage();
526
		return;
527
	}
528
	//liner.ru#1
529
	if (strrchr(#URL, '#')!=-1)
530
	{
531
		strcpy(#anchor, #URL+strrchr(#URL, '#'));
532
		URL[strrchr(#URL, '#')-1] = 0x00;
533
	}
534
 
535
	PageLinks.GetAbsoluteURL(#URL);
536
 
537
	if (UrlExtIs(".png")==1) || (UrlExtIs(".gif")==1) || (UrlExtIs(".jpg")==1) || (UrlExtIs(".zip")==1) || (UrlExtIs(".kex")==1)
538
	|| (UrlExtIs(".7z")==1) || (UrlExtIs("netcfg")==1)
539
	{
540
		//notify(#URL);
541
		if (!strncmp(#URL,"http://", 7))
542
		{
543
			strcpy(#DL_URL, #URL);
544
			CreateThread(#Downloader,#downloader_stak+4092);
545
		}
546
		else RunProgram("@open", #URL);
5978 leency 547
		strcpy(#editURL, History.current());
548
		strcpy(#URL, History.current());
5774 leency 549
		return;
550
	}
551
	if (!strncmp(#URL,"mailto:", 7))
552
	{
553
		notify(#URL);
5978 leency 554
		strcpy(#editURL, History.current());
555
		strcpy(#URL, History.current());
5774 leency 556
		return;
557
	}
558
	OpenPage();
559
	return;
560
}
561
 
562
 
5493 leency 563
char downloader_stak[4096];
5631 pavelyakov 564
stop: