Subversion Repositories Kolibri OS

Rev

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