PageSourceSearch

https://patandrub.eu/skins/user/rwd_shoper_19/js/user.js?sci=68

js patandrub.eu collected 2026-09-30 15:14:56 UTC 20,378 bytes, 343 lines download raw bytes

vendor: 4,115 bytes, lines 1-2
1//USER.JS MOVED TO FOOTER.TPL SO THERE IS NO NEED TO WAIT FOR DOM READINESS
2if (!('IntersectionObserver' in window) || !('IntersectionObserverEntry' in window) || !('intersectionRatio' in window.IntersectionObserverEntry.prototype)){$('[loading="lazy"]').each(function (){$(this).attr("src", $(this).attr("data-src"));});}else{/*! lazysizes - v5.2.2 */ $('[loading="lazy"]').addClass('lazyload'); !function (e){var t=function (u, D, f){"use strict"; var k, H; if (function (){var e; var t={lazyClass: "lazyload", loadedClass: "lazyloaded", loadingClass: "lazyloading", preloadClass: "lazypreload", errorClass: "lazyerror", autosizesClass: "lazyautosizes", srcAttr: "data-src", srcsetAttr: "data-srcset", sizesAttr: "data-sizes", minSize: 40, customMedia:{}, init: true, expFactor: 1.5, hFac: .8, loadMode: 2, loadHidden: true, ricTimeout: 0, throttleDelay: 125}; H=u.lazySizesConfig || u.lazysizesConfig ||{}; for (e in t){if (!(e in H)){H[e]=t[e]}}}(), !D || !D.getElementsByClassName){return{init: function (){}, cfg: H, noSupport: true}}var O=D.documentElement, a=u.HTMLPictureElement, P="addEventListener", $="getAttribute", q=u[P].bind(u), I=u.setTimeout, U=u.requestAnimationFrame || I, l=u.requestIdleCallback, j=/^picture$/i, r=["load", "error", "lazyincluded", "_lazyloaded"], i={}, G=Array.prototype.forEach, J=function (e, t){if (!i[t]){i[t]=new RegExp("(\\s|^)" + t + "(\\s|$)")}return i[t].test(e[$]("class") || "") && i[t]}, K=function (e, t){if (!J(e, t)){e.setAttribute("class", (e[$]("class") || "").trim() + " " + t)}}, Q=function (e, t){var i; if (i=J(e, t)){e.setAttribute("class", (e[$]("class") || "").replace(i, " "))}}, V=function (t, i, e){var a=e ? P : "removeEventListener"; if (e){V(t, i)}r.forEach(function (e){t[a](e, i)})}, X=function (e, t, i, a, r){var n=D.createEvent("Event"); if (!i){i={}}i.instance=k; n.initEvent(t, !a, !r); n.detail=i; e.dispatchEvent(n); return n}, Y=function (e, t){var i; if (!a && (i=u.picturefill || H.pf)){if (t && t.src && !e[$]("srcset")){e.setAttribute("srcset", t.src)}i({reevaluate: true, elements: [e]})}else if (t && t.src){e.src=t.src}}, Z=function (e, t){return (getComputedStyle(e, null) ||{})[t]}, s=function (e, t, i){i=i || e.offsetWidth; while (i < H.minSize && t && !e._lazysizesWidth){i=t.offsetWidth; t=t.parentNode}return i}, ee=function (){var i, a; var t=[]; var r=[]; var n=t; var s=function (){var e=n; n=t.length ? r : t; i=true; a=false; while (e.length){e.shift()()}i=false}; var e=function (e, t){if (i && !t){e.apply(this, arguments)}else{n.push(e); if (!a){a=true; (D.hidden ? I : U)(s)}}}; e._lsFlush=s; return e}(), te=function (i, e){return e ? function (){ee(i)}: function (){var e=this; var t=arguments; ee(function (){i.apply(e, t)})}}, ie=function (e){var i; var a=0; var r=H.throttleDelay; var n=H.ricTimeout; var t=function (){i=false; a=f.now(); e()}; var s=l && n > 49 ? function (){l(t,{timeout: n}); if (n !==H.ricTimeout){n=H.ricTimeout}}: te(function (){I(t)}, true); return function (e){var t; if (e=e===true){n=33}if (i){return}i=true; t=r - (f.now() - a); if (t < 0){t=0}if (e || t < 9){s()}else{I(s, t)}}}, ae=function (e){var t, i; var a=99; var r=function (){t=null; e()}; var n=function (){var e=f.now() - i; if (e < a){I(n, a - e)}else{(l || r)(r)}}; return function (){i=f.now(); if (!t){t=I(n, a)}}}, e=function (){var v, m, c, h, e; var y, z, g, p, C, b, A; var n=/^img$/i; var d=/^iframe$/i; var E="onscroll" in u && !/(gle|ing)bot/.test(navigator.userAgent); var _=0; var w=0; var N=0; var M=-1; var x=function (e){N--; if (!e || N < 0 || !e.target){N=0}}; var W=function (e){if (A==null){A=Z(D.body, "visibility")=="hidden"}return A || !(Z(e.parentNode, "visibility")=="hidden" && Z(e, "visibility")=="hidden")}; var S=function (e, t){var i; var a=e; var r=W(e); g -=t; b +=t; p -=t; C +=t; while (r && (a=a.offsetParent) && a !=D.body && a !=O){r=(Z(a, "opacity") || 1) > 0; if (r && Z(a, "overflow") !="visible"){i=a.getBoundingClientRect(); r=C > i.left && p < i.right && b > i.top - 1 && g < i.bottom + 1}}return r}; var t=function (){var e, t, i, a, r, n, s, l, o, u, f, c; var d=k.elements;
vendor: 6,775 bytes, lines 2-73
2 if ((h=H.loadMode) && N < 8 && (e=d.length)){t=0; M++; for (; t < e; t++){if (!d[t] || d[t]._lazyRace){continue}if (!E || k.prematureUnveil && k.prematureUnveil(d[t])){R(d[t]); continue}if (!(l=d[t][$]("data-expand")) || !(n=l * 1)){n=w}if (!u){u=!H.expand || H.expand < 1 ? O.clientHeight > 500 && O.clientWidth > 500 ? 500 : 370 : H.expand; k._defEx=u; f=u * H.expFactor; c=H.hFac; A=null; if (w < f && N < 1 && M > 2 && h > 2 && !D.hidden){w=f; M=0}else if (h > 1 && M > 1 && N < 6){w=u}else{w=_}}if (o !==n){y=innerWidth + n * c; z=innerHeight + n; s=n * -1; o=n}i=d[t].getBoundingClientRect(); if ((b=i.bottom) >=s && (g=i.top) <=z && (C=i.right) >=s * c && (p=i.left) <=y && (b || C || p || g) && (H.loadHidden || W(d[t])) && (m && N < 3 && !l && (h < 3 || M < 4) || S(d[t], n))){R(d[t]); r=true; if (N > 9){break}}else if (!r && m && !a && N < 4 && M < 4 && h > 2 && (v[0] || H.preloadAfterLoad) && (v[0] || !l && (b || C || p || g || d[t][$](H.sizesAttr) !="auto"))){a=v[0] || d[t]}}if (a && !r){R(a)}}}; var i=ie(t); var B=function (e){var t=e.target; if (t._lazyCache){delete t._lazyCache; return}x(e); K(t, H.loadedClass); Q(t, H.loadingClass); V(t, L); X(t, "lazyloaded")}; var a=te(B); var L=function (e){a({target: e.target})}; var T=function (t, i){try{t.contentWindow.location.replace(i)}catch (e){t.src=i}}; var F=function (e){var t; var i=e[$](H.srcsetAttr); if (t=H.customMedia[e[$]("data-media") || e[$]("media")]){e.setAttribute("media", t)}if (i){e.setAttribute("srcset", i)}}; var s=te(function (t, e, i, a, r){var n, s, l, o, u, f; if (!(u=X(t, "lazybeforeunveil", e)).defaultPrevented){if (a){if (i){K(t, H.autosizesClass)}else{t.setAttribute("sizes", a)}}s=t[$](H.srcsetAttr); n=t[$](H.srcAttr); if (r){l=t.parentNode; o=l && j.test(l.nodeName || "")}f=e.firesLoad || "src" in t && (s || n || o); u={target: t}; K(t, H.loadingClass); if (f){clearTimeout(c); c=I(x, 2500); V(t, L, true)}if (o){G.call(l.getElementsByTagName("source"), F)}if (s){t.setAttribute("srcset", s)}else if (n && !o){if (d.test(t.nodeName)){T(t, n)}else{t.src=n}}if (r && (s || o)){Y(t,{src: n})}}if (t._lazyRace){delete t._lazyRace}Q(t, H.lazyClass); ee(function (){var e=t.complete && t.naturalWidth > 1; if (!f || e){if (e){K(t, "ls-is-cached")}B(u); t._lazyCache=true; I(function (){if ("_lazyCache" in t){delete t._lazyCache}}, 9)}if (t.loading=="lazy"){N--}}, true)}); var R=function (e){if (e._lazyRace){return}var t; var i=n.test(e.nodeName); var a=i && (e[$](H.sizesAttr) || e[$]("sizes")); var r=a=="auto"; if ((r || !m) && i && (e[$]("src") || e.srcset) && !e.complete && !J(e, H.errorClass) && J(e, H.lazyClass)){return}t=X(e, "lazyunveilread").detail; if (r){re.updateElem(e, true, e.offsetWidth)}e._lazyRace=true; N++; s(e, t, r, a, i)}; var r=ae(function (){H.loadMode=3; i()}); var l=function (){if (H.loadMode==3){H.loadMode=2}r()}; var o=function (){if (m){return}if (f.now() - e < 999){I(o, 999); return}m=true; H.loadMode=3; i(); q("scroll", l, true)}; return{_: function (){e=f.now(); k.elements=D.getElementsByClassName(H.lazyClass); v=D.getElementsByClassName(H.lazyClass + " " + H.preloadClass); q("scroll", i, true); q("resize", i, true); q("pageshow", function (e){if (e.persisted){var t=D.querySelectorAll("." + H.loadingClass); if (t.length && t.forEach){U(function (){t.forEach(function (e){if (e.complete){R(e)}})})}}}); if (u.MutationObserver){new MutationObserver(i).observe(O,{childList: true, subtree: true, attributes: true})}else{O[P]("DOMNodeInserted", i, true); O[P]("DOMAttrModified", i, true); setInterval(i, 999)}q("hashchange", i, true); ["focus", "mouseover", "click", "load", "transitionend", "animationend"].forEach(function (e){D[P](e, i, true)}); if (/d$|^c/.test(D.readyState)){o()}else{q("load", o); D[P]("DOMContentLoaded", i); I(o, 2e4)}if (k.elements.length){t(); ee._lsFlush()}else{i()}}, checkElems: i, unveil: R, _aLSL: l}}(), re=function (){var i; var n=te(function (e, t, i, a){var r, n, s; e._lazysizesWidth=a; a +="px"; e.setAttribute("sizes", a); if (j.test(t.nodeName || "")){r=t.getElementsByTagName("source"); for (n=0, s=r.length; n < s; n++){r[n].setAttribute("sizes", a)}}if (!i.detail.dataAttr){Y(e, i.detail)}}); var a=function (e, t, i){var a; var r=e.parentNode; if (r){i=s(e, r, i); a=X(e, "lazybeforesizes",{width: i, dataAttr: !!t}); if (!a.defaultPrevented){i=a.detail.width; if (i && i !==e._lazysizesWidth){n(e, r, a, i)}}}}; var e=function (){var e; var t=i.length; if (t){e=0; for (; e < t; e++){a(i[e])}}}; var t=ae(e); return{_: function (){i=D.getElementsByClassName(H.autosizesClass); q("resize", t)}, checkElems: t, updateElem: a}}(), t=function (){if (!t.i && D.getElementsByClassName){t.i=true; re._(); e._()}}; return I(function (){H.init && t()}), k={cfg: H, autoSizer: re, loader: e, init: t, uP: Y, aC: K, rC: Q, hC: J, fire: X, gW: s, rAF: ee}}(e, e.document, Date); e.lazySizes=t, "object"==typeof module && module.exports && (module.exports=t)}("undefined" !=typeof window ? window :{});}
3
4
5
6
7
8function additionalFieldsInPanel(){
9	var self = this;
10	this.fields_id = [7,8,10,11];
11	this.customTxtFields = {10:9, 85:41}; //tekstowe ID 10 pobiera wartości z SELECTA ID 9
12	this.field_date_map = {7:13, 8:14, 10:15, 11:16};
13	this.select_radio = [8];
14	this.select_select = [7];
15	this.txt_date = [11];
16	this.dataZmianyId = 12;
17	this.data = [];
18	this.saveBl;
19	this.firstSave = 0;
20	this.checkboxOptions = ["Naczynka", "Przebarwienia", "Rozszerzone pory", "Tendencja do wyprysków", "Trądzik", "Zaskórniki"];
21	this.userData = {
22		firstname: '',
23		lastname: '',
24		email: '',
25	}
26
27	this.currentDataValues = {};
28
29	this.init = function(){
30		self.block = $("<div/>", {
31			class: 'additional_panel_items'
32		}).prependTo($("#box_panel .innerbox"));
33
34		$("<h3/>", {
35			class: 'o-tobie',
36			text: 'O Tobie'
37		}).appendTo(self.block);
38
39        frontAPI.getAFUserAccount(function (additionalFields) {
40            console.log(additionalFields);
41            loadScripts(function(){
42                self.data = additionalFields.list;
43				for(var i=0; i<self.data.length; i++){
44					var currentItem = self.data[i];
45					if(self.fields_id.indexOf(currentItem.field_id) > -1) {
46						var object = $("<div/>", {
47							class: 'item',
48							id: "item_"+currentItem.field_id
49						}).appendTo(self.block);
50						$("<h4/>" ,{
51							text: currentItem.translation.name
52						}).appendTo(object);
53
54
55						handleOptions(object, currentItem);
56					}
57				}
58    	        //appendSubmitButton(self.block);
59				loadCurrentData(function(){
60                    appendSubmitButton(self.block);
61
62                    self.saveBl = $("<div/>",{
63                        class: "saveinfo",
64                        text: "Zapisano pomyślnie"
65                    }).appendTo(self.block);
66
67				});
68
69
70
71
72            })
73        }, {
74        	urlParams: '?limit=49'
75        });
76	}
77
78	function loadCurrentData(callback){
79        frontAPI.getUser(function (user) {
80            self.userData.firstname = user.firstname;
81            self.userData.lastname = user.lastname;
82            self.userData.email = user.email;
83            handleAdditionalFields(user.additional_fields);
84            handleDateFields();
85            callback()
86        }, {
87        });
88
89	}
90
91	function handleDateFields(){
92		$(".additional_panel_items .item").each(function(){
93			var itemId =  $(this).attr("id").split("_")[1];
94			var dateFieldId = self.field_date_map[itemId];
95			var date = self.currentDataValues[dateFieldId];
96
97			if(date) {
98                $(this).find("h4").after(
99                $("<div/>", {
100                    class: 'date',
101                    text: "data aktualizacji: " + date
102                }))
103            }
104		})
105
106	}
107
108	function handleAdditionalFields(fields){
109
110		for(var k=0; k<fields.length; k++) {
111			var field = fields[k];
112           // console.log("here", self.select_select, field.field_id)
113            self.currentDataValues[field.field_id] = field.field_value;
114           // console.log(self.currentDataValues);
115            if(Object.keys(self.customTxtFields).indexOf(""+field.field_id) > -1){
116            	var checkedOptions = field.field_value.split(";");
117				var sourceOptions = self.customTxtFields[field.field_id];
118                var options = self.checkboxOptions;
119
120                self.currentDataValues[field.field_id] = field.field_value;
121
122            	for(var i=0; i<checkedOptions.length; i++) {
123                    for(var j=0; j<options.length; j++) {
124                    	if(checkedOptions[i] == options[j]){
125                            $("#" +field.field_id + "_" + j).attr("checked", "true");
126						}
127					}
128				}
129			} else if(self.select_select.indexOf(field.field_id) > -1){
130            	$("#select_" + field.field_id).val(field.field_value).change();
131			} else if(self.select_radio.indexOf(field.field_id) > -1) {
132                $("#item_" + field.field_id + " input[value='" + field.field_value + "']").click();
133            } else if(self.txt_date.indexOf(field.field_id) > -1){
134                $("#year_" + field.field_id).val(field.field_value).text(field.field_value);
135			}
136		}
137	}
138
139	function appendSubmitButton(bl) {
140		var c = $("<div/>", {
141			class: 'button-container none'
142		}).appendTo(bl)
143		$("<button/>", {
144			class: 'btn btn-red',
145			text: 'zapisz'
146		}).appendTo(c).on("click", function(){
147			saveUserData($(this));
148		});
149	}
150
151	function saveUserData(fieldId){
152
153        fieldId = fieldId || false;
154
155		//$(button).text("trwa zapis...");
156
157		var dateNew = new Date().toLocaleString();
158		if(fieldId)
159			self.currentDataValues[self.field_date_map[fieldId]] = dateNew
160
161		self.userData["additional_fields"] = self.currentDataValues;
162
163            frontAPI.editUser(function (editUser) {
164                $(self.saveBl).slideDown(100);
165
166                setTimeout(function () {
167                    $(self.saveBl).slideUp();
168                }, 800)
169
170                var date_block = $("#item_"+ fieldId).find(".date");
171                if(date_block.length){
172                	date_block.text("data aktualizacji: " + dateNew)
173				} else {
174                    $("#item_"+ fieldId).find("h4").after(
175                        $("<div/>", {
176                            class: 'date',
177                            text: "data aktualizacji: " + dateNew
178                        }))
179				}
180
181            }, {
182                data: self.userData
183            });
184
185
186	}
187
188	function loadScripts(callback){
189        var js2 = $.getScript("https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.js");
190        var css = $.get("https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.css");
191        var css2 = $.get("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css");
192
193
194        $.when( css, css2, js2).done(function(){
195            $("head").append("<script src=\"https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.js\"></script>")
196            //$("head").append(" <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\">")
197            $("head").append(" <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker-standalone.css\">")
198            $("head").append(" <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.css\">")
199
200            var js = $.getScript("https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js");
201            $.when(js).done(function(){
202                $("head").append("<script src=\"https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js\"></script>")
203				callback();
204			})
205        })
206
207	}
208
209
210	function handleOptions(obj, item){
211		var id = item.field_id;
212		//console.log(id, Object.keys(self.customTxtFields).indexOf(""+id))
213		if(Object.keys(self.customTxtFields).indexOf(""+id) > -1){
214			//wyswietl wartosci jako chechboxy z id
215			var idOptions = self.customTxtFields[id];
216			//console.log(self.data);
217			// var options = self.data.filter(function(obj){
218			// 	return obj.field_id == idOptions;
219			// })[0].translation.options;
220			var options = self.checkboxOptions;
221			for(var j=0; j<options.length; j++) {
222				var lab = $("<label/>",{
223
224				}).appendTo(obj);
225                $("<input/>", {
226                    type: 'checkbox',
227                    value: options[j],
228					id: id + "_" + j
229					//id: id + "_" + options[j].option_id
230                }).on("change", function(){
231                	var inp = $(this).parent().parent().find("input");
232                	var value = "";
233                	for(var i=0; i<inp.length; i++){
234                		if($(inp[i]).is(":checked")){
235                			value += $(inp[i]).val() + ";";
236						}
237					}
238                	self.currentDataValues[id] = value;
239                    saveUserData(id);
240                	//console.log("currVal:", self.currentDataValues);
241
242				}).prependTo(lab);
243
244                $("<span/>", {
245                    class: 'sp',
246                }).appendTo(lab);
247                $("<span/>", {
248                    class: 'sptext',
249                    text: options[j]
250                }).appendTo(lab);
251
252            }
253		} else if(self.select_radio.indexOf(id) > -1){
254			var options = item.translation.options;
255
256            for(var j=0; j<options.length; j++) {
257                var lab = $("<label/>",{
258
259                }).appendTo(obj);
260                $("<input/>", {
261                    type: 'radio',
262                    value: options[j].option_id,
263					name: "radio_"+id
264                }).on("change", function(){
265                    //console.log("change radio", $(this).attr("value"), $(this).is(":checked"));
266                    self.currentDataValues[id] = $(this).attr("value");
267                   //console.log("radio changed", self.firstSave)
268                    if(self.firstSave >= 2) {
269                    //	console.log("radio", self.firstSave)
270                        saveUserData(id);
271                    }
272
273                    self.firstSave++;
274                    //console.log("currVal:", self.currentDataValues);
275                }).prependTo(lab);
276                $("<span/>", {
277                	class: 'sp',
278					text: options[j].value
279				}).appendTo(lab);
280            }
281
282		} else if(self.select_select.indexOf(id) > -1){
283            var options = item.translation.options;
284			var select = $("<select/>", {
285				class: '',
286				id: "select_"+id
287			}).on("change", function(){
288                //console.log("change select", $(this).val());
289                self.currentDataValues[id] = $(this).val();
290               // console.log("select changed", self.firstSave)
291                if(self.firstSave >= 2) {
292                    console.log("select", self.firstSave)
293                    saveUserData(id);
294
295                }
296                self.firstSave++;
297               // console.log("currVal:", self.currentDataValues);
298            }).appendTo(obj);
299
300            for(var j=0; j<options.length; j++) {
301                $("<option/>", {
302                    value: options[j].option_id,
303					text: options[j].value
304                }).prependTo(select);
305            }
306        } else if(self.txt_date.indexOf(id) > -1){
307            var input = $("<input/>", {
308                class: '',
309                id: "year_"+id
310            }).datetimepicker({
311                format      :   "YYYY",
312                viewMode    :   "years",
313            }).appendTo(obj);
314
315            input.on("dp.change", function(){
316               // console.log("change select date", $(this).val());
317				//console.log("chenage");
318				if($(this).val() != self.currentDataValues[id]) {
319                    self.currentDataValues[id] = $(this).val();
320                    saveUserData(id);
321                }
322            })
323            // for(var j=1900; j<new Date().getFullYear(); j++) {
324             //    $("<option/>", {
325             //        value: j,
326             //        text: j
327             //    }).appendTo(select);
328			// }
329        }
330	}
331}
332
333
334
335
336	if($("#box_panel").length){
337		var addFIP = new additionalFieldsInPanel();
338		addFIP.init();
339	}
340
341 	if ($('.availability.row').find('.second').text() == ' &nbsp'){
342		$('.availability.row').remove(); 
343	}

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.