PageSourceSearch

https://xn-----dlccfbfdksbbn6ccdrcazo.xn--p1ai/bitrix/cache/js/s1/…35cb8c279aac5c7aa40ae_v1.js?178707697114747

js xn-----dlccfbfdksbbn6ccdrcazo.xn--p1ai collected 2026-10-04 23:53:29 UTC 14,747 bytes, 302 lines download raw bytes

1
2; /* Start:"a:4:{s:4:"full";s:67:"/bitrix/components/bitrix/search.title/script.min.js?17022020136443";s:6:"source";s:48:"/bitrix/components/bitrix/search.title/script.js";s:3:"min";s:52:"/bitrix/components/bitrix/search.title/script.min.js";s:3:"map";s:52:"/bitrix/components/bitrix/search.title/script.map.js";}"*/
3function JCTitleSearch(t){var e=this;this.arParams={AJAX_PAGE:t.AJAX_PAGE,CONTAINER_ID:t.CONTAINER_ID,INPUT_ID:t.INPUT_ID,MIN_QUERY_LEN:parseInt(t.MIN_QUERY_LEN)};if(t.WAIT_IMAGE)this.arParams.WAIT_IMAGE=t.WAIT_IMAGE;if(t.MIN_QUERY_LEN<=0)t.MIN_QUERY_LEN=1;this.cache=[];this.cache_key=null;this.startText="";this.running=false;this.runningCall=false;this.currentRow=-1;this.RESULT=null;this.CONTAINER=null;this.INPUT=null;this.WAIT=null;this.ShowResult=function(t){if(BX.type.isString(t)){e.RESULT.innerHTML=t}e.RESULT.style.display=e.RESULT.innerHTML!==""?"block":"none";var s=e.adjustResultNode();var i;var n;var l=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},true);if(l){n=BX.findChild(l,{tag:"th"},true)}if(n){var r=BX.pos(l);r.width=r.right-r.left;var a=BX.pos(n);a.width=a.right-a.left;n.style.width=a.width+"px";e.RESULT.style.width=s.width+a.width+"px";e.RESULT.style.left=s.left-a.width-1+"px";if(r.width-a.width>s.width)e.RESULT.style.width=s.width+a.width-1+"px";r=BX.pos(l);i=BX.pos(e.RESULT);if(i.right>r.right){e.RESULT.style.width=r.right-r.left+"px"}}var o;if(l)o=BX.findChild(e.RESULT,{class:"title-search-fader"},true);if(o&&n){i=BX.pos(e.RESULT);o.style.left=i.right-i.left-18+"px";o.style.width=18+"px";o.style.top=0+"px";o.style.height=i.bottom-i.top+"px";o.style.display="block"}};this.onKeyPress=function(t){var s=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},true);if(!s)return false;var i;var n=s.rows.length;switch(t){case 27:e.RESULT.style.display="none";e.currentRow=-1;e.UnSelectAll();return true;case 40:if(e.RESULT.style.display=="none")e.RESULT.style.display="block";var l=-1;for(i=0;i<n;i++){if(!BX.findChild(s.rows[i],{class:"title-search-separator"},true)){if(l==-1)l=i;if(e.currentRow<i){e.currentRow=i;break}else if(s.rows[i].className=="title-search-selected"){s.rows[i].className=""}}}if(i==n&&e.currentRow!=i)e.currentRow=l;s.rows[e.currentRow].className="title-search-selected";return true;case 38:if(e.RESULT.style.display=="none")e.RESULT.style.display="block";var r=-1;for(i=n-1;i>=0;i--){if(!BX.findChild(s.rows[i],{class:"title-search-separator"},true)){if(r==-1)r=i;if(e.currentRow>i){e.currentRow=i;break}else if(s.rows[i].className=="title-search-selected"){s.rows[i].className=""}}}if(i<0&&e.currentRow!=i)e.currentRow=r;s.rows[e.currentRow].className="title-search-selected";return true;case 13:if(e.RESULT.style.display=="block"){for(i=0;i<n;i++){if(e.currentRow==i){if(!BX.findChild(s.rows[i],{class:"title-search-separator"},true)){var a=BX.findChild(s.rows[i],{tag:"a"},true);if(a){window.location=a.href;return true}}}}}return false}return false};this.onTimeout=function(){e.onChange(function(){setTimeout(e.onTimeout,500)})};this.onChange=function(t){if(e.running){e.runningCall=true;return}e.running=true;if(e.INPUT.value!=e.oldValue&&e.INPUT.value!=e.startText){e.oldValue=e.INPUT.value;if(e.INPUT.value.length>=e.arParams.MIN_QUERY_LEN){e.cache_key=e.arParams.INPUT_ID+"|"+e.INPUT.value;if(e.cache[e.cache_key]==null){if(e.WAIT){var s=BX.pos(e.INPUT);var i=s.bottom-s.top-2;e.WAIT.style.top=s.top+1+"px";e.WAIT.style.height=i+"px";e.WAIT.style.width=i+"px";e.WAIT.style.left=s.right-i+2+"px";e.WAIT.style.display="block"}BX.ajax.post(e.arParams.AJAX_PAGE,{ajax_call:"y",INPUT_ID:e.arParam
3s.INPUT_ID,q:e.INPUT.value,l:e.arParams.MIN_QUERY_LEN},function(s){e.cache[e.cache_key]=s;e.ShowResult(s);e.currentRow=-1;e.EnableMouseEvents();if(e.WAIT)e.WAIT.style.display="none";if(!!t)t();e.running=false;if(e.runningCall){e.runningCall=false;e.onChange()}});return}else{e.ShowResult(e.cache[e.cache_key]);e.currentRow=-1;e.EnableMouseEvents()}}else{e.RESULT.style.display="none";e.currentRow=-1;e.UnSelectAll()}}if(!!t)t();e.running=false};this.onScroll=function(){if(BX.type.isElementNode(e.RESULT)&&e.RESULT.style.display!=="none"&&e.RESULT.innerHTML!==""){e.adjustResultNode()}};this.UnSelectAll=function(){var t=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},true);if(t){var s=t.rows.length;for(var i=0;i<s;i++)t.rows[i].className=""}};this.EnableMouseEvents=function(){var t=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},true);if(t){var s=t.rows.length;for(var i=0;i<s;i++)if(!BX.findChild(t.rows[i],{class:"title-search-separator"},true)){t.rows[i].id="row_"+i;t.rows[i].onmouseover=function(t){if(e.currentRow!=this.id.substr(4)){e.UnSelectAll();this.className="title-search-selected";e.currentRow=this.id.substr(4)}};t.rows[i].onmouseout=function(t){this.className="";e.currentRow=-1}}}};this.onFocusLost=function(t){setTimeout(function(){e.RESULT.style.display="none"},250)};this.onFocusGain=function(){if(e.RESULT.innerHTML.length)e.ShowResult()};this.onKeyDown=function(t){if(!t)t=window.event;if(e.RESULT.style.display=="block"){if(e.onKeyPress(t.keyCode))return BX.PreventDefault(t)}};this.adjustResultNode=function(){if(!(BX.type.isElementNode(e.RESULT)&&BX.type.isElementNode(e.CONTAINER))){return{top:0,right:0,bottom:0,left:0,width:0,height:0}}var t=BX.pos(e.CONTAINER);e.RESULT.style.position="absolute";e.RESULT.style.top=t.bottom+2+"px";e.RESULT.style.left=t.left+"px";e.RESULT.style.width=t.width+"px";return t};this._onContainerLayoutChange=function(){if(BX.type.isElementNode(e.RESULT)&&e.RESULT.style.display!=="none"&&e.RESULT.innerHTML!==""){e.adjustResultNode()}};this.Init=function(){this.CONTAINER=document.getElementById(this.arParams.CONTAINER_ID);BX.addCustomEvent(this.CONTAINER,"OnNodeLayoutChange",this._onContainerLayoutChange);this.RESULT=document.body.appendChild(document.createElement("DIV"));this.RESULT.className="title-search-result";this.INPUT=document.getElementById(this.arParams.INPUT_ID);this.startText=this.oldValue=this.INPUT.value;BX.bind(this.INPUT,"focus",function(){e.onFocusGain()});BX.bind(this.INPUT,"blur",function(){e.onFocusLost()});this.INPUT.onkeydown=this.onKeyDown;if(this.arParams.WAIT_IMAGE){this.WAIT=document.body.appendChild(document.createElement("DIV"));this.WAIT.style.backgroundImage="url('"+this.arParams.WAIT_IMAGE+"')";if(!BX.browser.IsIE())this.WAIT.style.backgroundRepeat="none";this.WAIT.style.display="none";this.WAIT.style.position="absolute";this.WAIT.style.zIndex="1100"}BX.bind(this.INPUT,"bxchange",function(){e.onChange()});var t=BX.findParent(this.CONTAINER,BX.is_fixed);if(BX.type.isElementNode(t)){BX.bind(window,"scroll",BX.throttle(this.onScroll,100,this))}};BX.ready(function(){e.Init(t)})}
4/* End */
5;
6; /* Start:"a:4:{s:4:"full";s:59:"/local/components/project/webform/webform.js?17858987467585";s:6:"source";s:44:"/local/components/project/webform/webform.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
7if(!window.Project)
8    window.Project = {};
9
10window.Project.Ajax = function(component, method, data)
11{
12    let params = {
13        mode: 'class',
14        data: {post: data}
15    };
16    let bx_promise = BX.ajax.runComponentAction(component, method, params);
17    return new Promise(function(resolve, reject){
18        bx_promise.then(function(response) {
19            if (response.status === 'success')
20            {
21                resolve(response);
22            }
23            else
24            {
25                reject();
26            }
27        });
28    });
29}
30
31window.Project.Validity = {
32    email: function(email) {
33        let re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
34        return re.test(email);
35    },
36    input: function(input)
37    {
38        if(input.required && !input.value) return "Это поле должно быть заполнено";
39        if(input.type === 'email' && !window.Project.Validity.email(input.value)) return "Некорректный email";
40        if(input.type === 'checkbox' && input.classList.contains('visually-hidden') && !input.checked) return "Необходимо согласиться с условиями оферты";
41
42        if(input.pattern)
43        {
44            const pa = new RegExp(".{18,18}")
45            if(!pa.test(input.value)) return "Это поле заполненно некорректно";
46        }
47
48        console.log("[validity]", input);
49
50        return false;
51    }
52};
53
54window.Project.Webform = function(form_name, arParams)
55{
56    this.form_name = form_name;
57    this.arParams = arParams;
58    let self = this;
59    this.ajax = function(data)
60    {
61        return window.Project.Ajax('project:webform', 'send', {
62            fields: data,
63            arParams: self.arParams
64        })
65    }
66}
67
68window.Project.Webform.prototype = {
69    constructor: window.Project.Webform,
70    find: function(selector)
71    {
72        return this.findContainer().querySelector(selector)
73    },
74
75    findAll: function(selector)
76    {
77        return this.findContainer().querySelectorAll(selector)
78    },
79
80    findInputs: function()
81    {
82        return this.findAll('input, select, textarea');
83    },
84
85    findContainer: function()
86    {
87        return document.forms[this.form_name];
88    },
89
90    findSubmiters: function()
91    {
92        return this.findAll('button.btn');
93    },
94
95
96    bind: function()
97    {
98        let self = this;
99        this.findSubmiters().forEach(function(btn){
100            btn.addEventListener('click', self.submit.bind(self, btn));
101        });
102        this.findAll('input[type=file]').forEach(function(file_input){
103            let hidden = self.find("[name="+file_input.dataset.name+"]");
104            if(hidden)
105            {
106                self.bindFile(new window.Project.WebformFile(file_input, hidden));
107            }
108        })
109
110        this.bindCustom();
111    },
112
113    bindFile: function(webform_file)
114    {
115
116    },
117
118    bindCustom: function()
119    {
120
121    },
122
123    //////////////////////////////
124
125    createHint(is_error, msg)
126    {
127        let hint = document.createElement('p');
128        if(is_error)
129        {
130            hint.classList.add('form_error');
131            hint.style.color = '#f00';
132        }
133        else
134        {
135            hint.classList.add('form_success');
136            hint.style.color = 'rgb(5 154 5)';
137        }
138
139        hint.innerText = msg;
140        return hint;
141    },
142
143
144
145    clearHints: function()
146    {
147        this.findAll('.form_error').forEach(function(ep){
148            ep.parentNode.removeChild(ep);
149        })
150
151        this.findAll('.form_success').forEach(function(ep){
152            ep.parentNode.removeChild(ep);
153        })
154    },
155
156    attachHint(target, hint)
157    {
158        target.after(hint);
159    },
160
161    /////////////////////////
162
163    collectAll: function()
164    {
165        let collect = {form: {}, js: []};
166        this.findInputs().forEach(function(input){
167            if(input.type === 'checkbox' || input.type === 'radio')
168            {
169                if(input.checked)collect.form[input.name] = input.value;
170            }
171            else
172            {
173                collect.form[input.name] = input.value;
174            }
175            collect.js.push(input);
176        });
177
178        return collect;
179    },
180
181    checkState: function()
182    {
183        let success = true;
184        let self = this;
185
186        this.collectAll().js.forEach(function(input){
187            let error = window.Project.Validity.input(input);
188            if(error) {
189                self.attachHint(input, self.createHint(true, error));
190                success = false;
191            }
192        });
193
194        return success;
195    },
196
197    submit: function(btn, e)
198    {
199        e.preventDefault();
200        this.clearHints();
201        if(this.checkState())
202        {
203            let self = this;
204            this.ajax(this.collectAll().form).then(function(response){
205                if(response.data.status)
206                {
207                    document.dispatchEvent(new CustomEvent('project:webform:success', {
208                        detail: {
209                            form: self.findContainer(),
210                            button: btn,
211                            formCode: self.arParams && self.arParams.CODE ? self.arParams.CODE : ''
212                        }
213                    }));
214                    self.OnSuccess(btn);
215                }
216                else
217                {
218                    for (let i in response.data.errors)
219                    {
220                        let error = response.data.errors[i];
221                        self.attachHint(btn, self.createHint(true, error));
222                    }
223                }
224            })
225        }
226    },
227
228    OnSuccess: function(btn)
229    {
230        this.attachHint(btn, this.createHint(false, 'Форма успешно отправлена'));
231        this.findContainer().reset();
232    }
233};
234
235
236window.Project.WebformFile = function(input, hidden)
237{
238    this.input = input;
239    this.hidden = hidden;
240    this.proxy = new window.Project.Proxy();
241
242    this.bind();
243}
244
245window.Project.WebformFile.prototype = {
246    constructor: window.Project.WebformFile,
247    bind: function()
248    {
249        this.input.addEventListener('change', this.update.bind(this));
250    },
251
252    update: function()
253    {
254        console.log("[file] update", this.input.files[0])
255        let self = this;
256        if(this.input.files && this.input.files[0])
257        {
258            let file = this.input.files[0];
259            let reader = new FileReader();
260            reader.onload = function(e)
261            {
262                self.hidden.value = JSON.stringify({
263                    name: file.name,
264                    value: btoa(e.target.result)
265                });
266
267                self.proxy.release(file.name);
268            }
269
270            reader.readAsBinaryString(file);
271        }
272        else
273        {
274            self.hidden.value = '';
275        }
276    },
277}
278
279window.Project.Proxy = function()
280{
281    this.handlers = [];
282}
283
284window.Project.Proxy.prototype = {
285    assign: function(callback)
286    {
287        this.handlers.push(callback);
288    },
289
290    release: function(value)
291    {
292        this.handlers.forEach(function(handler){
293            handler(value);
294        })
295    }
296}
297
298/* End */
299;; /* /bitrix/components/bitrix/search.title/script.min.js?17022020136443*/
300; /* /local/components/project/webform/webform.js?17858987467585*/
301
302//# sourceMappingURL=template_6031fefc21b35cb8c279aac5c7aa40ae.map.js

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.