PageSourceSearch

https://mozyr360.by/modules/mod_djc2frontpage/js/djfrontpage.js

js mozyr360.by collected 2026-10-05 07:04:14 UTC 7,342 bytes, 247 lines download raw bytes

1/**
2 * @version 3.x
3 * @package DJ-Catalog2
4 * @copyright Copyright (C) 2013 DJ-Extensions.com, All rights reserved.
5 * @license DJ-Extensions.com Proprietary Use License
6 * @author url: http://dj-extensions.com
7 * @author email [email protected]
8 * @developer Michał Olczyk [email protected]
9 *
10 */
11
12(function($){
13var DJFrontpage = function (options) {
14	return this.initialize(options);
15};
16
17DJFrontpage.prototype = {
18	constructor: DJFrontpage,
19	settings: {
20		moduleId: 0,
21		pagstart:0,
22		baseurl: 'null',
23		url : '',
24		showcategorytitle: 0,
25		showtitle: 1,
26		linktitle: 1,
27		showproducer: 0,
28		showprice: 0,
29		showpagination: 0,
30		order: 0,
31		featured_only: 0,
32		featured_first: 0,
33		columns: 1,
34		rows: 3,
35		allcategories: 1,
36		categories: '',
37		mainimage: 'medium',
38		trunc: 0,
39		trunclimit: 0,
40		effectduration: 300,
41		showreadmore: 1,
42		modal: 1,
43		readmoretext: '',
44		largewidth: 400,
45		largeheight: 240,
46		largecrop: 1,
47		smallwidth: 90,
48		smallheight: 70,
49		smallcrop: 1,
50		limit: 0
51	},
52	
53	initialize: function(options) {
54		this.settings = $.extend({}, this.settings, options);
55		if (!this.settings.baseurl) return false;
56		this.buildUrl();
57		
58		this.modulewrapper = $('#djf_mod_' + this.settings.moduleId);
59		this.largeimgcontainer = ('#djfimg_' + this.settings.moduleId); 
60		this.textcontainer = ('#djftext_' + this.settings.moduleId); 
61		this.thumbscontainer = ('#djfgal_' + this.settings.moduleId); 
62		this.categorycontainer = ('#djfcat_' + this.settings.moduleId); 
63		this.paginationcontainer = ('#djfpag_' + this.settings.moduleId); 
64		this.loadPage(0);
65	},
66	
67	buildUrl: function() {
68		this.settings.url = this.settings.baseurl;
69		this.settings.post = 
70			  'moduleId='	+	this.settings.moduleId 
71			+ '&scattitle='	+	this.settings.showcategorytitle 
72			+ '&stitle='	+	this.settings.showtitle
73			+ '&sproducer='	+	this.settings.showproducer
74			+ '&sprice='	+	this.settings.showprice
75			+ '&ltitle='	+	this.settings.linktitle
76			+ '&spag='		+	this.settings.showpagination
77			+ '&orderby='	+	this.settings.order
78			+ '&orderdir='	+	this.settings.orderdir
79			+ '&featured_only='	+	this.settings.featured_only
80			+ '&featured_first='	+	this.settings.featured_first
81			+ '&cols='		+	this.settings.columns
82			+ '&rows='		+	this.settings.rows
83			+ '&catsw='		+	this.settings.allcategories
84			+ '&categories='+	this.settings.categories
85			+ '&trunc='		+	this.settings.trunc
86			+ '&trunclimit='+	this.settings.trunclimit
87			+ '&modal='+	this.settings.modal
88			+ '&showreadmore='+	this.settings.showreadmore
89			+ '&readmoretext='+	this.settings.readmoretext
90			+ '&pagstart='	+	this.settings.pagstart
91			+ '&largewidth='	+	this.settings.largewidth
92			+ '&largeheight='	+	this.settings.largeheight
93			+ '&largecrop='		+	this.settings.largecrop
94			+ '&smallwidth='	+	this.settings.smallwidth
95			+ '&smallheight='	+	this.settings.smallheight
96			+ '&smallcrop='		+	this.settings.smallcrop
97			;
98	},
99	
100	ajaxResponse: function(response) {
101		return this.loadPageContent(response);
102		
103		/*var xmltext = response;
104		var xmlobject = null;
105		try //Internet Explorer
106		{
107			xmlobject = new ActiveXObject("Microsoft.XMLDOM");
108			xmlobject.async = "false";
109			xmlobject.loadXML(xmltext);
110		} 
111		catch (e) {
112			try //Firefox, Mozilla, Opera, etc.
113			{
114				xmlobject = (new DOMParser()).parseFromString(xmltext, "text/xml");
115			} 
116			catch (e) {
117				alert(e.message);
118			}
119		}
120		
121		return this.loadPageContent(xmlobject);*/
122	},
123	
124	loadPage: function(page) {
125		this.settings.pagstart = (page) ? page : 0;
126		this.buildUrl();
127		
128		var self = this;
129		
130		if(self.ajax && self.ajax.readyState != 4){
131            self.ajax.abort();
132        }
133		
134		self.ajax = $.ajax({
135		    url: self.settings.url,
136		    method: 'post',
137		    dataType: 'xml',
138		    encoding: 'utf-8',
139		    data: self.settings.post
140		}).done(function(resp) {
141			self.ajaxResponse(resp);
142		});
143	},
144	
145	loadPageContent: function (xmlobject){
146		var self = this;
147		
148		xmlobject = $(xmlobject);
149		
150		var contents = xmlobject.find("contents")[0];
151		var content = $(contents).find("content");
152		var thumbs = $(contents).find("thumb");
153		if ($(contents).find("pagination").length) {
154			if ($(contents).find("pagination").first()&& this.settings.showpagination > 0) {
155				$(this.paginationcontainer).html($(contents).find("pagination").first().text());
156			}
157		}
158		
159		this.data = [];
160		for (var i = 0; i < content.length; i++) {
161			var data = $(content[i]);
162			this.data[i] = {};
163			this.data[i].text = data.find("text").first().text();
164			this.data[i].image = data.find("image").first().text();
165			this.data[i].src = data.find("src").first().text();
166			if (this.settings.showcategorytitle == 1) {
167				this.data[i].category = data.find("category").first().text();				
168			}
169		}
170		
171		this.thumbnails = [];
172		
173		$(self.thumbscontainer).animate({opacity: 0}, self.settings.effectduration);
174		setTimeout(function() {
175			for (var i = 0; i < self.settings.rows * self.settings.columns; i++) {
176			$('#djfptd_' + self.settings.moduleId + '_' + i).html('');
177			}
178			for (var i = 0; i < thumbs.length; i++) {
179				self.thumbnails[i] = $(thumbs[i]).text();
180				$('#djfptd_' + self.settings.moduleId + '_' + i).html(self.thumbnails[i]);
181			}
182			$(self.thumbscontainer).animate({opacity: 1}, self.settings.effectduration);
183		}, self.settings.effectduration);
184		
185		this.loadItem(0);
186	},
187	
188	loadItem: function(id) {
189		if (this.data[id]) {
190			this.hideItem(id);
191			this.showItem(id);
192		} else {
193			this.modulewrapper.css('display', 'none');
194		}
195	},
196	hideItem : function(id) {
197		var self = this;
198		self.modulewrapper.find('.djf_img').animate({opacity: 0}, self.settings.effectduration);
199		$(self.textcontainer).animate({opacity: 0}, self.settings.effectduration);
200		if (this.settings.showcategorytitle == 1) {
201			$(self.categorycontainer).animate({opacity: 0}, self.settings.effectduration);
202		}
203	},
204	
205	showItem : function(id) {
206		var image = new Image();
207		
208		var self = this;
209		
210		image.onload =  function(){
211			$(self.largeimgcontainer).html('');
212			$(self.largeimgcontainer).append(image);
213			$(self.largeimgcontainer).attr("href", self.data[id].src);
214			
215			self.modulewrapper.find('.djf_img').animate({opacity: 1}, self.settings.effectduration);
216			
217			$(self.textcontainer).html(self.data[id].text);
218			$(self.textcontainer).animate({opacity: 1}, self.settings.effectduration);
219			
220			if (self.settings.showcategorytitle == 1) {
221				$(self.categorycontainer).html(self.data[id].category);
222				$(self.categorycontainer).animate({opacity: 1}, self.settings.effectduration);
223			}
224			
225		};
226		
227		image.onerror =  function(){
228			$(self.largeimgcontainer).html('');
229			
230			$(self.textcontainer).html(self.data[id].text);
231			$(self.textcontainer).animate({opacity: 1}, self.settings.effectduration);
232			
233			if (self.settings.showcategorytitle == 1) {
234				$(self.categorycontainer).html(self.data[id].category);
235				$(self.categorycontainer).animate({opacity: 1}, self.settings.effectduration);
236			}
237		};
238		
239		setTimeout(function(){
240			image.src = self.data[id].image;
241		}, self.settings.effectduration);
242	}
243};
244
245window.DJFrontpage = DJFrontpage;
246
247})(jQuery);

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.