PageSourceSearch

http://prodinfo.by/proj/prodinfo/js/scr.js

js prodinfo.by collected 2026-10-02 12:11:36 UTC 8,690 bytes, 347 lines download raw bytes

1var jsCallendar = {
2	day: 		new Array(),
3	month: 		new Array(),
4	year: 		new Array(),
5	weekFormat: null,
6	monthNames:	new Array(),
7	weekDays:	new Array(),
8	links:		new Array(),
9	onclicks:	new Array(),
10	forArchive:	null,
11	dateDump:	new Array(),
12	currDate:	new Array(),
13
14	isLeapYear: function (year)
15	{
16		if (year % 4 == 0)
17		{
18			return true;
19		}
20		else
21		{
22			return false;
23		}
24	},
25
26	getDays: function (month, year)
27	{
28		 var ar = new Array(13);
29		 ar[0] = 31 ;
30		 ar[1] = (this.isLeapYear(year)) ? 29 : 28;
31		 ar[2] = 31 ;
32		 ar[3] = 30 ;
33		 ar[4] = 31 ;
34		 ar[5] = 30 ;
35		 ar[6] = 31;
36		 ar[7] = 31 ;
37		 ar[8] = 30 ;
38		 ar[9] = 31 ;
39		 ar[10] = 30 ;
40		 ar[11] = 31 ;
41
42		 return ar[month];
43	},
44
45	Print: function(callId)
46	{
47		var container = document.getElementById('callendar_container_'+callId);
48		container.innerHTML = '';
49		var displDate = new Date();
50
51		this.setCurDate(callId);
52
53		displDate.setFullYear(this.year[callId]);
54		displDate.setMonth(this.month[callId]);
55		displDate.setDate(1);
56
57		var dayInWeek = displDate.getDay();
58
59		if(this.weekFormat == 'ru') var dayOffset = dayInWeek == 0 ? 6 : dayInWeek - 1;
60			else var dayOffset = dayInWeek;
61
62		var dayInMonth = this.getDays(this.month[callId], this.year[callId]);
63
64		var monYear = document.createElement('div');
65		var table = document.createElement('table');
66		var body = document.createElement('tbody');
67
68		this.generateHead(monYear, body, callId);
69		this.generateBody(body, dayInMonth, dayOffset, callId);
70
71		container.appendChild(monYear);
72		table.appendChild(body);
73		container.appendChild(table);
74	},
75
76	setCurDate: function(callId)
77	{
78		if(typeof(this.dateDump[callId]) == 'undefined')
79		{
80			this.dateDump[callId] = new Array();
81
82			this.dateDump[callId]['day'] = this.day[callId];
83			this.dateDump[callId]['month'] = this.month[callId];
84			this.dateDump[callId]['year'] = this.year[callId];
85		}
86
87		if(typeof(this.currDate[callId]) == 'undefined')
88		{
89			this.currDate[callId] = new Array();
90			var dt = new Date();
91
92			this.currDate[callId]['day'] = dt.getDate();
93			this.currDate[callId]['month'] = dt.getMonth();
94			this.currDate[callId]['year'] = isIE ? parseInt(dt.getYear()) : 1900 + parseInt(dt.getYear());
95		}
96	},
97
98	generateBody: function(body, dayInMonth, dayOffset, callId)
99	{
100		var link = this.links[callId];
101		var onclick = this.onclicks[callId];
102
103		var dayCounter = 1;
104		var tr = document.createElement('tr');
105		tr.className = 'row';
106
107		for(var i = -dayOffset; i < dayInMonth + 7; i++)
108		{
109
110			if(dayCounter % 8 == 0) body.appendChild(tr);
111
112			if(dayCounter % 8 == 0)
113			{
114				var tr = document.createElement('tr');
115				tr.className = 'row';
116				dayCounter = 1;
117			}
118
119			var td = document.createElement('td');
120
121			if(i >= 0 && i < dayInMonth)
122			{
123				var d = i + 1;
124				var m = this.month[callId];
125				var y = this.year[callId];
126
127				if(this.forArchive == 'yes')
128				{
129					if((d <= this.currDate[callId]['day'] && m == this.currDate[callId]['month'] && y == this.currDate[callId]['year'])
130					|| (m < this.currDate[callId]['month'] || y < this.currDate[callId]['year']))
131					{
132						var subTd = document.createElement('a');
133						this.setDayClass(subTd, dayCounter, 'we_day_p', 'smpl_day_p');
134
135						if(d == this.dateDump[callId]['day'] && m == this.dateDump[callId]['month'] && y == this.dateDump[callId]['year'])
136						{
137							td.className = "selected";
138						}
139
140						if(d == this.currDate[callId]['day'] && m == this.currDate[callId]['month'] && y == this.currDate[callId]['year'])
141						{
142							td.className = td.className == '' ? "current" : td.className+" current";
143						}
144
145						subTd.setAttribute('href', onclick + y + '/' + (parseInt(m) + 1) + '/' + d + '.html' + link);
146					}
147					else
148					{
149						var subTd = document.createElement('span');
150						this.setDayClass(subTd, dayCounter, 'we_day_p', 'smpl_day_p');
151					}
152				}
153				else
154				{
155					if(d == this.dateDump[callId]['day'] && m == this.dateDump[callId]['month'] && y == this.dateDump[callId]['year'])
156					{
157						td.className = "selected";
158					}
159
160					if(d == this.currDate[callId]['day'] && m == this.currDate[callId]['month'] && y == this.currDate[callId]['year'])
161					{
162						td.className = td.className == '' ? "current" : td.className+" current";
163					}
164
165					var subTd = document.createElement('a');
166					this.setDayClass(subTd, dayCounter, 'we_day_p', 'smpl_day_p');
167
168					if(link.indexOf("?") != -1) subTd.setAttribute('href', link + '&day=' + d + '&month=' + (parseInt(m) + 1) + '&year=' + y);
169						else subTd.setAttribute('href', link + '?day=' + d + '&month=' + (parseInt(m) + 1) + '&year=' + y);
170				}
171
172				subTd.appendChild(document.createTextNode(d));
173			}
174			else
175			{
176				var subTd = document.createTextNode('');
177			}
178
179			td.appendChild(subTd);
180			tr.appendChild(td);
181			dayCounter++;
182		}
183	},
184
185	setDayClass: function(element, dnum, wks, sds)
186	{
187		if(this.weekFormat == 'ru')
188		{
189			if(dnum % 7 == 0 || (dnum + 1) % 7 == 0) element.className = wks;
190				else element.className = sds;
191		}
192		else
193		{
194			if(dnum == 1 || dnum == 7 ) element.className = wks;
195				else element.className = sds;
196		}
197	},
198
199	generateHead: function(monYear, body, callId)
200	{
201		monYear.className = 'top-cal';
202		var aPrev = document.createElement('a');
203		aPrev.className = 'arch_prev_mon';
204
205		if(isIE)	aPrev.onclick = function(){jsCallendar.Prev(callId)};
206			else aPrev.setAttribute('onclick', 'jsCallendar.Prev(\''+callId+'\'); return false;');
207
208		aPrev.appendChild(document.createTextNode('«'));
209		var aNext = document.createElement('a');
210		aNext.className = 'arch_next_mon';
211
212		if(isIE) aNext.onclick = function(){jsCallendar.Next(callId)};
213			else aNext.setAttribute('onclick', 'jsCallendar.Next(\''+callId+'\'); return false;');
214
215		aNext.appendChild(document.createTextNode('»'));
216
217		monYear.appendChild(aPrev);
218		monYear.appendChild(document.createTextNode(' ' + this.monthNames[this.month[callId]] + ' ' + this.year[callId] + ' '));
219		monYear.appendChild(aNext);
220
221		var row = document.createElement('tr');
222		row.className = 'arch_head';
223
224		for(var i = 0; i < this.weekDays.length; i++)
225		{
226			var th = document.createElement('th');
227			this.setDayClass(th, i + 1, 'h_we_day', 'h_smpl_day');
228			th.appendChild(document.createTextNode(this.weekDays[i]));
229			row.appendChild(th);
230		}
231
232		body.appendChild(row);
233	},
234
235	Prev: function(callId)
236	{
237
238		if (this.month[callId] == 0)
239		{
240			this.month[callId] = 11
241			this.year[callId]--;
242		}
243		else
244		{
245			this.month[callId]--;
246		}
247
248		this.Print(callId);
249	},
250
251	Next: function(callId)
252	{
253		if (this.month[callId] == 11)
254		{
255			this.month[callId] = 0;
256			this.year[callId]++;
257		}
258		else
259		{
260			this.month[callId]++;
261		}
262
263		this.Print(callId);
264	},
265
266	Reset: function(callId)
267	{
268		this.day[callId]		= document.getElementById('callendar_c_day_'+callId).value;
269		this.month[callId]		= document.getElementById('callendar_c_month_'+callId).value;
270		this.year[callId]		= document.getElementById('callendar_c_year_'+callId).value;
271		this.month_name[callId] 	= this._month[this.month[callId]];
272
273		this.Print(callId);
274	},
275
276	Set: function(callId, curr_day)
277	{
278		var _day		= document.getElementById('callendar_day_'+callId);
279		var _month		= document.getElementById('callendar_month_'+callId);
280		var _year		= document.getElementById('callendar_year_'+callId);
281
282		_day.value		= curr_day;
283		_month.value	= this.month[callId];
284		_year.value		= this.year[callId];
285
286//		SetClasses();
287	}
288}
289
290function checkvalue(obj, str)
291{
292	if (obj.value == str) {obj.value=''}
293}
294
295function setSearchGroups(obj)
296{
297	var items = obj.getElementsByTagName('item');
298	var el = document.getElementById('catalogue_group_select');
299	el.options.length = 0;
300
301	var c=0;
302	for (c = 0; c!=items.length; c++)
303	{
304		var opt = document.createElement('option');
305		opt.value = items[c].getAttribute('id');
306		opt.text = items[c].getAttribute('title');
307		el.options.add(opt);
308	}
309}
310
311function hintShow_my()
312{
313	if (!isBlocked)
314	{
315		var hint = document.getElementById('drop_down');
316
317		var hintHeight = hint.clientHeight;
318
319		if (isIE) {mouseX = window.event.x + hint.clientWidth + 30; /*- document.body.scrollLeft*/}
320		if (isIE) {mouseY = window.event.y;}
321
322		var limit = document.body.clientHeight + window.pageYOffset;
323		var bottom = hintHeight + mouseY + oY;
324
325		var hint = document.getElementById('drop_down');
326		hint.style.left = (oX + mouseX) + 'px';
327
328		if ((bottom)<limit) hint.style.top = (oY + mouseY) + 'px';
329			else hint.style.top = (mouseY) + 'px';
330	}
331}
332
333var currentInf = new Array();
334
335function hide_inf(grp)
336{
337	var inf = document.getElementById('informer_one_' + currentInf[grp]);
338
339	inf.className = 'hide';
340}
341
342function show_inf(grp, index)
343{
344	var inf = document.getElementById('informer_one_' + index);
345	inf.className = 'show';
346	currentInf[grp] = index;
347}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.