Subversion Repositories Kolibri OS

Rev

Rev 6001 | Rev 6045 | 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
6001 leency 32
	char version[]=" Текстовый браузер 1.42";
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
6001 leency 39
	char version[]=" Text-based Browser 1.42";
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"
6001 leency 92
#include "http_downloader.h"
93
#include "download_manager.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;
5987 leency 119
	label.init(DEFAULT_FONT);
4536 leency 120
	SetEventMask(0xa7);
5631 pavelyakov 121
	BEGIN_LOOP_APPLICATION:
3067 leency 122
		WaitEventTimeout(2);
123
		switch(EAX & 0xFF)
124
		{
125
			CASE evMouse:
4081 leency 126
				if (!CheckActiveProcess(Form.ID)) break;
3466 leency 127
				edit_box_mouse stdcall (#address_box);
5640 pavelyakov 128
				mouse.get();
5772 leency 129
				if (WB1.list.MouseOver(mouse.x, mouse.y))
3067 leency 130
				{
5825 leency 131
					PageLinks.Hover(mouse.x, WB1.list.first*WB1.list.item_h + mouse.y, link_color_inactive, link_color_active, bg_color);
5772 leency 132
					if (bufsize) && (mouse.pkm) && (mouse.up) { CreateThread(#menu_rmb,#stak+4092); break; }
133
					if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
3067 leency 134
				}
5782 leency 135
				scrollbar_v_mouse (#scroll_wv);
136
				if (WB1.list.first != scroll_wv.position)
3067 leency 137
				{
5782 leency 138
					WB1.list.first = scroll_wv.position;
139
					WB1.DrawPage();
140
					break;
3067 leency 141
				}
142
				break;
5711 leency 143
 
3067 leency 144
			case evButton:
145
				btn=GetButtonID();
4636 leency 146
				if (btn==1)	ExitProcess();
147
				Scan(btn);
3067 leency 148
				break;
5711 leency 149
 
3067 leency 150
			case evKey:
5711 leency 151
				GetKeys();
5531 leency 152
				if (address_box.flags & 0b10)
5530 leency 153
				{
5711 leency 154
					if (key_ascii == ASCII_KEY_ENTER) Scan(key_scancode); else
155
					if (key_ascii != 0x0d) && (key_ascii != 183) && (key_ascii != 184) {EAX = key_ascii << 8; edit_box_key stdcall(#address_box);}
5530 leency 156
				}
5711 leency 157
				else
158
				{
159
					Scan(key_scancode);
160
				}
5530 leency 161
				break;
3067 leency 162
 
163
			case evReDraw:
4636 leency 164
				if (action_buf) Scan(action_buf);
5773 leency 165
				DefineAndDrawWindow(GetScreenWidth()-800/2,GetScreenHeight()-600/2,800,600,0x73,col_bg,0,0);
4725 leency 166
				GetProcessInfo(#Form, SelfInfo);
4727 leency 167
				if (Form.status_window>2) { DrawTitle(#header); break; }
5811 leency 168
				if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; }
169
				if (Form.width<280) { MoveSize(OLD,OLD,280,OLD); break; }
3067 leency 170
				Draw_Window();
171
				break;
4540 leency 172
 
4536 leency 173
			case evNetwork:
4540 leency 174
				if (http_transfer > 0) {
5534 hidnplayr 175
					http_receive stdcall (http_transfer);
4677 leency 176
					$push EAX
177
					ESI = http_transfer;
5519 leency 178
					wv_progress_bar.max = ESI.http_msg.content_length;
179
					if (wv_progress_bar.value != ESI.http_msg.content_received)
4686 leency 180
					{
5519 leency 181
						wv_progress_bar.value = ESI.http_msg.content_received;
4686 leency 182
						DrawProgress();
183
					}
4677 leency 184
					$pop EAX
185
					if (EAX == 0) {
4558 hidnplayr 186
						ESI = http_transfer;
187
						// Handle redirects
4563 leency 188
						if (ESI.http_msg.status >= 300) && (ESI.http_msg.status < 400)
189
						{
4558 hidnplayr 190
							redirected++;
4563 leency 191
							if (redirected<=5)
192
							{
5773 leency 193
								http_find_header_field stdcall (http_transfer, "location\0");
4558 hidnplayr 194
								if (EAX!=0) {
195
									ESI = EAX;
196
									EDI = #URL;
197
									do {
198
										$lodsb;
199
										$stosb;
200
									} while (AL != 0) && (AL != 13) && (AL != 10));
201
									DSBYTE[EDI-1]='\0';
202
								}
4563 leency 203
							}
204
							else
205
							{
5772 leency 206
								notify("Too many redirects");
207
								StopLoading();
208
								break;
4558 hidnplayr 209
							}
4563 leency 210
						}
211
						else
212
						{
4558 hidnplayr 213
							redirected = 0;
214
						}
4554 leency 215
						// Loading the page is complete, free resources
4563 leency 216
						if (redirected>0)
217
						{
4643 leency 218
							http_free stdcall (http_transfer);
219
							http_transfer=0;
5990 leency 220
							GetAbsoluteURL(#URL);
6021 leency 221
							history.back();
4558 hidnplayr 222
							strcpy(#editURL, #URL);
5718 leency 223
							DrawEditBox();
4558 hidnplayr 224
							OpenPage();
4563 leency 225
						}
226
						else
227
						{
6021 leency 228
							history.add(#URL);
4643 leency 229
							ESI = http_transfer;
230
							bufpointer = ESI.http_msg.content_ptr;
231
							bufsize = ESI.http_msg.content_received;
232
							http_free stdcall (http_transfer);
233
							http_transfer=0;
4645 leency 234
							SetPageDefaults();
5772 leency 235
							ShowPage();
4558 hidnplayr 236
						}
4536 leency 237
					}
238
				}
3067 leency 239
		}
5631 pavelyakov 240
	goto BEGIN_LOOP_APPLICATION;
3067 leency 241
}
242
 
243
void SetElementSizes()
244
{
5772 leency 245
	address_box.top = TOOLBAR_H/2-7;
4677 leency 246
	address_box.width = Form.cwidth - address_box.left - 25 - 22;
5678 leency 247
	WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x / WB1.DrawBuf.zoom,
5711 leency 248
		Form.cheight - TOOLBAR_H - STATUSBAR_H, WB1.list.font_h + WB1.DrawBuf.zoom + WB1.DrawBuf.zoom * WB1.DrawBuf.zoom);
5749 leency 249
	WB1.list.wheel_size = 7;
5710 leency 250
	WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
5825 leency 251
	WB1.list.visible = WB1.list.h - 5 / WB1.list.item_h;
5773 leency 252
	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 253
}
254
 
5981 leency 255
 
5982 leency 256
 
3067 leency 257
void Draw_Window()
258
{
5987 leency 259
	int list__w, list__h;
5772 leency 260
	DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, panel_color);
5718 leency 261
	DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3);
4677 leency 262
	DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
3067 leency 263
	SetElementSizes();
5772 leency 264
	DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+5, 20,border_color);
265
	DefineButton(address_box.left-50, address_box.top-2, 23, skin.h-2, BACK_BUTTON+BT_HIDE, 0);
266
	DefineButton(address_box.left-26, address_box.top-2, 23, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0);
267
	img_draw stdcall(skin.image, address_box.left-51, address_box.top-3, 48, skin.h, 3, 0);
5718 leency 268
	DefineButton(address_box.left+address_box.width+1, address_box.top-3, 16, skin.h-1, REFRESH_BUTTON+BT_HIDE+BT_NOFRAME, 0);
269
	DefineButton(Form.cwidth-24, address_box.top-3, 19, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0);
270
	img_draw stdcall(skin.image, Form.cwidth-22, address_box.top-3, 16, skin.h, 85, 0);
4677 leency 271
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
272
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
5772 leency 273
	if (!header) OpenPage(); else { WB1.DrawPage(); DrawEditBox(); }
4692 leency 274
	DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
4693 leency 275
	DrawProgress();
5981 leency 276
 
5982 leency 277
	/*
5981 leency 278
	list__w = 200;
5987 leency 279
	list__h = 200;
280
	label.raw_size = 0;
281
	label.write_buf(10,10, list__w, list__h, 0xFFFFFF, 0, 11, "Hello World!");
282
	label.write_buf(10,23, list__w, list__h, 0xFFFFFF, 0xFF00FF, 12, "How are you?");
283
	label.write_buf(11,40, list__w, list__h, 0xFFFFFF, 0x2E74BB, 15, "Fine");
284
	label.apply_smooth();
285
	label.show_buf(0,0);
5982 leency 286
	*/
3067 leency 287
}
288
 
289
 
5711 leency 290
void Scan(dword id__)
4413 leency 291
{
4636 leency 292
	action_buf=0;
5781 leency 293
	if (WB1.list.ProcessKey(id__)) WB1.DrawPage();
5779 leency 294
	else switch (id__)
4413 leency 295
	{
5711 leency 296
		case SCAN_CODE_BS:
5718 leency 297
		case BACK_BUTTON:
6021 leency 298
			if (history.back()) {
299
				strcpy(#URL, history.current());
5978 leency 300
				OpenPage();
301
			}
5711 leency 302
			return;
5718 leency 303
		case FORWARD_BUTTON:
6021 leency 304
			if (history.forward()) {
305
				strcpy(#URL, history.current());
5978 leency 306
				OpenPage();
307
			}
5711 leency 308
			return;
5718 leency 309
		case GOTOURL_BUTTON:
5772 leency 310
		case SCAN_CODE_ENTER:
311
			if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/') || (!strncmp(#editURL,"WebView:",9))
312
			{
313
				strcpy(#URL, #editURL);
314
			}
5711 leency 315
			else
5772 leency 316
			{
5803 leency 317
				strlcpy(#URL,"http://",7);
5772 leency 318
				strcat(#URL, #editURL);
319
			}
5711 leency 320
			OpenPage();
321
			return;
5718 leency 322
		case 063: //F5
323
			IF(address_box.flags & 0b10) return;
324
		case REFRESH_BUTTON:
5713 leency 325
			if (http_transfer > 0)
326
			{
327
				StopLoading();
328
				Draw_Window();
329
			}
330
			else OpenPage();
331
			return;
5718 leency 332
		case SANDWICH_BUTTON:
333
			mouse.y = TOOLBAR_H-6;
334
			mouse.x = Form.cwidth - 167;
335
			CreateThread(#menu_rmb,#stak+4092);
4415 leency 336
			return;
5718 leency 337
		case VIEW_SOURCE:
338
			WB1.list.first = 0;
339
			ShowSource();
5773 leency 340
			WB1.LoadInternalPage(bufpointer, bufsize);
5718 leency 341
			break;
342
		case EDIT_SOURCE:
343
			if (!strncmp(#URL,"http:",5))
344
			{
345
				WriteFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
346
				if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
347
			}
348
			else RunProgram("/rd/1/tinypad", #URL);
4415 leency 349
			return;
5718 leency 350
		case FREE_IMG_CACHE:
4491 leency 351
			ImgCache.Free();
4416 leency 352
			notify(IMAGES_CACHE_CLEARED);
5766 leency 353
			WB1.DrawPage();
4415 leency 354
			return;
5718 leency 355
		case VIEW_HISTORY:
4677 leency 356
			strcpy(#URL, URL_SERVICE_HISTORY);
4544 leency 357
			OpenPage();
358
			return;
5718 leency 359
		case DOWNLOAD_MANAGER:
5519 leency 360
			if (!downloader_opened) {
6001 leency 361
				downloader_edit = NULL;
5519 leency 362
				CreateThread(#Downloader,#downloader_stak+4092);
363
			}
4413 leency 364
			return;
365
	}
366
}
367
 
368
 
4636 leency 369
void StopLoading()
370
{
5631 pavelyakov 371
	if (http_transfer)
4647 leency 372
	{
373
		EAX = http_transfer;
374
		EAX = EAX.http_msg.content_ptr;		// get pointer to data
375
		$push	EAX							// save it on the stack
376
		http_free stdcall (http_transfer);	// abort connection
377
		$pop	EAX
5631 pavelyakov 378
		free(EAX);						// free data
4647 leency 379
		http_transfer=0;
380
		bufsize = 0;
5631 pavelyakov 381
		bufpointer = free(bufpointer);
4647 leency 382
	}
5519 leency 383
	wv_progress_bar.value = 0;
5718 leency 384
	img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 52, 0);
4645 leency 385
}
386
 
387
void SetPageDefaults()
388
{
389
	strcpy(#header, #version);
390
	WB1.list.count = WB1.list.first = 0;
391
	stroka = 0;
5704 leency 392
	cur_encoding = CH_NULL;
4645 leency 393
	if (o_bufpointer) o_bufpointer = free(o_bufpointer);
4636 leency 394
	anchor_line_num=WB1.list.first;
395
	anchor[0]='|';
396
}
397
 
4416 leency 398
void OpenPage()
399
{
4636 leency 400
	StopLoading();
4718 leency 401
	souce_mode = false;
4416 leency 402
	strcpy(#editURL, #URL);
6021 leency 403
	history.add(#URL);
5631 pavelyakov 404
	if (!strncmp(#URL,"WebView:",8))
4692 leency 405
	{
406
		SetPageDefaults();
5747 leency 407
		if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
5631 pavelyakov 408
		else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
5772 leency 409
		DrawEditBox();
4692 leency 410
		return;
411
	}
5631 pavelyakov 412
	if (!strncmp(#URL,"http:",5))
4416 leency 413
	{
5718 leency 414
		img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 131, 0);
5534 hidnplayr 415
		http_get stdcall (#URL, 0, 0, #accept_language);
4636 leency 416
		http_transfer = EAX;
5631 pavelyakov 417
		if (!http_transfer)
4646 leency 418
		{
419
			StopLoading();
420
			bufsize = 0;
5631 pavelyakov 421
			bufpointer = free(bufpointer);
4646 leency 422
			ShowPage();
423
			return;
424
		}
4416 leency 425
	}
4636 leency 426
	else
427
	{
428
		file_size stdcall (#URL);
429
		bufsize = EBX;
4650 leency 430
		if (bufsize)
431
		{
5631 pavelyakov 432
			free(bufpointer);
433
			bufpointer = malloc(bufsize);
4650 leency 434
			SetPageDefaults();
4718 leency 435
			ReadFile(0, bufsize, bufpointer, #URL);
4650 leency 436
		}
4645 leency 437
		ShowPage();
4636 leency 438
	}
4416 leency 439
}
4415 leency 440
 
4718 leency 441
DrawEditBox()
4508 leency 442
{
5772 leency 443
	DrawWideRectangle(address_box.left-2, address_box.top-2, address_box.width+3, 19, 2, address_box.color);
4718 leency 444
	address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
445
	address_box.offset = 0;
4508 leency 446
	edit_box_draw stdcall(#address_box);
5772 leency 447
	if (http_transfer > 0) EAX = 131; else EAX = 52;
448
	img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, EAX, 0);
4718 leency 449
}
4415 leency 450
 
4718 leency 451
 
452
void ShowPage()
453
{
454
	DrawEditBox();
4540 leency 455
	if (!bufsize)
4508 leency 456
	{
5773 leency 457
		if (http_transfer) WB1.LoadInternalPage(#loading, sizeof(loading));
458
		else WB1.LoadInternalPage(#page_not_found, sizeof(page_not_found));
4508 leency 459
	}
460
	else
5768 leency 461
	{
5766 leency 462
		WB1.Prepare();
5768 leency 463
	}
5773 leency 464
	//if (!header) strcpy(#header, #version);
4508 leency 465
	if (!strcmp(#version, #header)) DrawTitle(#header);
466
}
467
 
5493 leency 468
byte UrlExtIs(dword ext)
469
{
5631 pavelyakov 470
	if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true;
471
	return false;
5493 leency 472
}
4508 leency 473
 
5772 leency 474
int SetSkinColors()
475
{
476
	dword image_data;
477
	image_data = DSDWORD[skin.image+24];
478
	col_bg = DSDWORD[image_data];
479
	panel_color  = DSDWORD[skin.w*4*4 + image_data];
480
	border_color = DSDWORD[skin.w*4*7 + image_data];
481
	wv_progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data];
482
	$and col_bg, 0x00ffffff
483
	$and panel_color, 0x00ffffff
484
	$and border_color, 0x00ffffff
485
	$and wv_progress_bar.progress_color, 0x00ffffff
486
}
4544 leency 487
 
5772 leency 488
void DrawProgress()
489
{
490
	unsigned long btn;
491
	if (http_transfer == 0) return;
492
	if (wv_progress_bar.max) btn = address_box.width*wv_progress_bar.value/wv_progress_bar.max; else btn = 30;
493
	DrawBar(address_box.left-2, address_box.top+15, btn, 2, wv_progress_bar.progress_color);
494
}
5746 leency 495
 
5774 leency 496
void ClickLink()
497
{
498
	if (http_transfer > 0)
499
	{
500
		StopLoading();
6021 leency 501
		history.back();
5774 leency 502
	}
5772 leency 503
 
5774 leency 504
	strcpy(#URL, PageLinks.GetURL(PageLinks.active));
505
	//#1
506
	if (URL[0] == '#')
507
	{
508
		strcpy(#anchor, #URL+strrchr(#URL, '#'));
6021 leency 509
		strcpy(#URL, history.current());
5774 leency 510
		WB1.list.first=WB1.list.count-WB1.list.visible;
511
		ShowPage();
512
		return;
513
	}
514
	//liner.ru#1
515
	if (strrchr(#URL, '#')!=-1)
516
	{
517
		strcpy(#anchor, #URL+strrchr(#URL, '#'));
518
		URL[strrchr(#URL, '#')-1] = 0x00;
519
	}
520
 
5990 leency 521
	GetAbsoluteURL(#URL);
5774 leency 522
 
523
	if (UrlExtIs(".png")==1) || (UrlExtIs(".gif")==1) || (UrlExtIs(".jpg")==1) || (UrlExtIs(".zip")==1) || (UrlExtIs(".kex")==1)
524
	|| (UrlExtIs(".7z")==1) || (UrlExtIs("netcfg")==1)
525
	{
526
		//notify(#URL);
527
		if (!strncmp(#URL,"http://", 7))
528
		{
6001 leency 529
			strcpy(#downloader_edit, #URL);
5774 leency 530
			CreateThread(#Downloader,#downloader_stak+4092);
531
		}
532
		else RunProgram("@open", #URL);
6021 leency 533
		strcpy(#editURL, history.current());
534
		strcpy(#URL, history.current());
5774 leency 535
		return;
536
	}
537
	if (!strncmp(#URL,"mailto:", 7))
538
	{
539
		notify(#URL);
6021 leency 540
		strcpy(#editURL, history.current());
541
		strcpy(#URL, history.current());
5774 leency 542
		return;
543
	}
544
	OpenPage();
545
	return;
546
}
547
 
548
 
5493 leency 549
char downloader_stak[4096];
5631 pavelyakov 550
stop: