-
Notifications
You must be signed in to change notification settings - Fork 0
/
Browsing.pas
249 lines (229 loc) · 8.09 KB
/
Browsing.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
unit Browsing;
interface
uses
Windows, Forms, SysUtils, Messages, Classes, inifiles,
param, ComCtrls, Buttons, StdCtrls, ExtCtrls, SHDocVw, OleCtrls, Controls,
Menus;
type
TBrowse = class(TForm)
Panel1: TPanel;
WebBrowser1: TWebBrowser;
ProgressBar1: TProgressBar;
ComboBox1: TComboBox;
Timer1: TTimer;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
Button1: TSpeedButton;
procedure FormActivate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure SpeedButton1Click(Sender: TObject);
procedure ComboBox1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Browse: TBrowse;
Visited: TStringList;
VisitedI: smallint;
implementation
uses Main, Internet;
{$R *.dfm}
procedure TBrowse.FormActivate(Sender: TObject);
var
Sites: TSearchrec;
Result: smallint;
begin
MainForm.Timer1.Enabled:=false;
ComboBox1.Items.Clear;
VisitedI:=-1;
ProgressBar1.Position:=0;
Browse.Caption:=MainForm.Label131.Caption;
WebBrowser1.Navigate('about:blank');
Result:=FindFirst(dir+'\Sites\*', faDirectory, Sites);
while Result=0 do begin
if (Sites.Name<>'Browser') and (Sites.Name<>'System') and (Sites.Name<>'.') and (Sites.Name<>'..') then
ComboBox1.Items.Add('http://www.'+Sites.Name+'/');
Result:=FindNext(Sites);
end;
FindClose(Sites);
SpeedButton1.Glyph.LoadFromFile(dir+'\Sites\Browser\Backward.bmp');
SpeedButton2.Glyph.LoadFromFile(dir+'\Sites\Browser\Forward.bmp');
SpeedButton3.Glyph.LoadFromFile(dir+'\Sites\Browser\Stop.bmp');
Button1.Glyph.LoadFromFile(dir+'\Sites\Browser\Forward.bmp');
Visited:=TStringList.Create;
Timer1.Interval:=1025-(inetSpeed div 1000);
end;
procedure TBrowse.Timer1Timer(Sender: TObject);
var
Site:shortstring;
SiteConf:Tinifile;
i: integer;
begin
If ProgressBar1.Position<25 then
ProgressBar1.Position:=ProgressBar1.Position+1
else
begin
Site:=ComboBox1.Items.Strings[ComboBox1.ItemIndex];
ComboBox1.Items.Delete(ComboBox1.ItemIndex);
ComboBox1.Text:=site;
Site:=copy(Site,pos('.',Site)+1,255);
Site:=copy(Site,1,pos('/',Site)-1);
WebBrowser1.Cursor:=crDefault;
Timer1.Enabled:=false;
SpeedButton2.Enabled:=false;
SpeedButton3.Enabled:=false;
ComboBox1.Enabled:=true;
Button1.Enabled:=true;
If Site<>'' then begin
If Visited.Count>0 then
for i:=VisitedI+1 to Visited.Count-1 do
Visited.Delete(i);
inc(VisitedI);
Visited.Add(Combobox1.Text);
end;
If VisitedI>0 then
SpeedButton1.Enabled:=true
else
SpeedButton1.Enabled:=false;
If FileExists(dir+'\Sites\'+Site+'\page.ini') and FileExists(dir+'\Sites\'+Site+'\page.htm') then begin
if random(5)<>0 then begin
WebBrowser1.Navigate(dir+'\Sites\'+Site+'\page.htm');
SiteConf:=TInifile.Create(dir+'\Sites\'+Site+'\page.ini');
Browse.Caption:=SiteConf.ReadString('Options','Caption','Îïèñàíèå îòñóòñâóåò')+' - '+MainForm.Label131.Caption;
InetTraffic:=InetTraffic-SiteConf.ReadInteger('Options','Traffic',3);
if SiteConf.ReadString('Options','AddPoints','')='Mood' then begin
if SiteConf.ReadInteger('Options','Count',5)>0 then
Application.MessageBox('Þìîðíîé ñàéò! Ãû! Âàøå íàñòðîåíèå ðàñòåò!','Ïîìîùü!',MB_ICONINFORMATION)
else
Application.MessageBox('×åãî-òî íå íðàâèòñÿ ìíå ýòîò ñàéò. Ìîæåò ñâàëèòü îòñþäà?','Ïîìîùü!',MB_ICONINFORMATION);
Nastr:=Nastr+SiteConf.ReadInteger('Options','Count',5);
end;
if SiteConf.ReadString('Options','AddPoints','')='Rating' then begin
if SiteConf.ReadInteger('Options','Count',5)>0 then
Application.MessageBox('Íà ýòîì ñàéòå ìîæíî óçíàòü ìíîãî èíòåðåñíîãî î êîìïüþòåðàõ!','Ïîìîùü!',MB_ICONINFORMATION)
else
Application.MessageBox('×åãî-òî íå íðàâèòñÿ ìíå ýòîò ñàéò. Ìîæåò ñâàëèòü îòñþäà?','Ïîìîùü!',MB_ICONINFORMATION);
Rating:=Rating+SiteConf.ReadInteger('Options','Count',5);
end;
if SiteConf.ReadString('Options','AddPoints','')='Programming' then begin
Application.MessageBox('Çàíèìàòåëüíîå ÷òèâî! Îêàçûâàåòñÿ îíî ñïîñîáíî ïîìî÷ü â ïðîãðàììèðîâàíèè!','Ïîìîùü!',MB_ICONINFORMATION);
znania:=znania+SiteConf.ReadInteger('Options','Count',5);
end;
if SiteConf.ReadString('Options','AddPoints','')='Money' then begin
if SiteConf.ReadInteger('Options','Count',5)>0 then
Application.MessageBox('Òóò åùå îêàçûâàåòñÿ åùå è äåíüãè äàþò! Íàäî çàõîäèòü ñþäà ïî÷àùå.','Ïîìîùü!',MB_ICONINFORMATION)
else
Application.MessageBox('Òóò åùå îêàçûâàåòñÿ åùå íå òîëüêî äåíüãè äàþò, íî è îáøìàëÿòü ìîãóò!','Ïîìîùü!',MB_ICONINFORMATION);
Money:=Money+SiteConf.ReadInteger('Options','Count',5);
end;
end
else
begin
WebBrowser1.Navigate(dir+'\Sites\System\hacked.htm');
InetTraffic:=InetTraffic-2;
Browse.Caption:=MainForm.Label131.Caption;
Application.MessageBox('Îé! Ñòðàøíî ïî òàêèì ñàéòàì ëàçèòü. Ìîæåò âûéòè?','Ïîìîùü!',MB_ICONINFORMATION);
Nastr:=Nastr-2;
If random(7)=1 then begin
Application.MessageBox('Íà ýòîì ñàéòå îêàçàëñÿ ñòðàøíûé âèðóñ, êîòîðûé èñïîëüçóÿ áðåøü â âàøåì áðàóçåðå ñíåñ ê ÷åðòÿì ñîáà÷üèì âñå âàøè ïðîãðàììû!','Ïîìîùü!',MB_ICONSTOP);
Nastr:=Nastr-5;
MainForm.ClearPrograms(1,ActivePartition);
Inet.Close;
Browse.Close;
end;
end;
end
else
begin
WebBrowser1.Navigate(dir+'\Sites\System\404.htm');
InetTraffic:=InetTraffic-1;
Browse.Caption:=MainForm.Label131.Caption;
end;
end;
end;
procedure TBrowse.ComboBox1Change(Sender: TObject);
begin
if ComboBox1.Text='' then Button1.Enabled:=false else Button1.Enabled:=true;
end;
procedure TBrowse.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Timer1.Enabled:=false;
ProgressBar1.Position:=0;
Combobox1.Enabled:=true;
Combobox1.Text:='';
MainForm.Timer1.Enabled:=true;
SpeedButton1.Enabled:=false;
SpeedButton2.Enabled:=false;
SpeedButton3.Enabled:=false;
Button1.Enabled:=false;
end;
procedure TBrowse.SpeedButton1Click(Sender: TObject);
var
OpenURL: shortstring;
begin
dec(VisitedI);
OpenURL:=Visited.Strings[VisitedI];
OpenURL:=copy(OpenURL,pos('.',OpenURL)+1,255);
OpenURL:=copy(OpenURL,1,pos('/',OpenURL)-1);
WebBrowser1.Navigate(dir+'\Sites\'+OpenURL+'\page.htm');
ComboBox1.Text:=Visited.Strings[VisitedI];
SpeedButton2.Enabled:=true;
If VisitedI>0 then
SpeedButton1.Enabled:=true
else
SpeedButton1.Enabled:=false;
end;
procedure TBrowse.ComboBox1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=VK_return then
Button1.OnClick(self);
end;
procedure TBrowse.SpeedButton4Click(Sender: TObject);
begin
ProgressBar1.Position:=0;
SpeedButton3.Enabled:=true;
ComboBox1.Enabled:=false;
Button1.Enabled:=false;
Timer1.Enabled:=true;
end;
procedure TBrowse.SpeedButton3Click(Sender: TObject);
begin
Timer1.Enabled:=false;
ProgressBar1.Position:=0;
SpeedButton3.Enabled:=false;
Button1.Enabled:=true;
ComboBox1.Enabled:=true;
end;
procedure TBrowse.SpeedButton2Click(Sender: TObject);
var
OpenURL: shortstring;
begin
inc(VisitedI);
OpenURL:=Visited.Strings[VisitedI];
OpenURL:=copy(OpenURL,pos('.',OpenURL)+1,255);
OpenURL:=copy(OpenURL,1,pos('/',OpenURL)-1);
WebBrowser1.Navigate(dir+'\Sites\'+OpenURL+'\page.htm');
SpeedButton1.Enabled:=true;
ComboBox1.Text:=Visited.Strings[VisitedI];
If VisitedI=Visited.Count-1 then
SpeedButton2.Enabled:=false;
end;
procedure TBrowse.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
If (key=VK_ESCAPE) then
Close;
end;
end.