PageSourceSearch

http://barlette.ru/tpl/js/ajax.js?update=20130428

js barlette.ru collected 2026-10-02 20:08:33 UTC 8,370 bytes, 260 lines download raw bytes

1var fombj = null;
2var parr = 0;
3var ajax_post = 0;
4
5// Функция которая делаеи соединение со скриптом
6function GetXmlHttpObject(){
7    var objXMLHttp=null
8    if (window.XMLHttpRequest){
9        objXMLHttp=new XMLHttpRequest()
10    }
11    else if (window.ActiveXObject){
12        objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
13    }
14    return objXMLHttp
15}
16
17function init_ajax(){
18    xmlHttp=GetXmlHttpObject()
19    if (xmlHttp==null){
20        alert ("Your browser does not support AJAX.")
21        return false
22    }
23    return true
24}
25
26function ajax_send(req){
27    xmlHttp.open("GET",req,true);
28    xmlHttp.send(null);
29}
30
31function ajax_send_post(req,par){
32    xmlHttp.open("POST", req, true);
33    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
34    xmlHttp.send(par);
35}
36
37function collect_data(){
38    parr = new Array();
39    if (fombj!=null)    obj = fombj;
40    else                obj = document.getElementById("sub_form");
41    for (i=0; i<obj.length; i++){
42        if (obj.elements[i].type == 'select-one'){
43            parr[i] = obj.elements[i].name+'='+obj.elements[i].value;
44        };
45        if (obj.elements[i].type == 'radio'){
46            if (obj.elements[i].checked){
47                parr[i] = obj.elements[i].name+'='+obj.elements[i].value;
48            };
49        };
50        if (obj.elements[i].type == 'hidden'){
51            parr[i] = obj.elements[i].name+'='+encodeURIComponent(obj.elements[i].value);
52        };
53        if (obj.elements[i].type == 'text'){
54            parr[i] = obj.elements[i].name+'='+encodeURIComponent(obj.elements[i].value);
55        };
56        if (obj.elements[i].type == 'password'){
57            parr[i] = obj.elements[i].name+'='+encodeURIComponent(obj.elements[i].value);
58        };
59        if (obj.elements[i].type == 'textarea'){
60            parr[i] = obj.elements[i].name+'='+encodeURIComponent(obj.elements[i].value);
61            //alert(obj.elements[i].value);
62            //alert(encodeURIComponent(obj.elements[i].value));
63        };
64        if (obj.elements[i].type == 'checkbox'){
65            if (obj.elements[i].checked){
66                parr[i] = obj.elements[i].name+'='+obj.elements[i].value;
67            } else {
68                parr[i] = obj.elements[i].name+'=off';
69            };
70        };
71    };
72    parr = parr.join('&');
73    return parr;
74}
75
76function update_pic(act){
77    rnd = Math.floor(Math.random() * 10000000000);
78    document.getElementById("seccode").src='/sources/seccode/genimage.php?id='+rnd;
79}
80
81
82function load_files_changeval(n,c) {
83    fombj.fstr.value = n;
84    fombj.vlcount.value = c;
85}
86
87function setCookie (name, value, expires, path, domain, secure) {
88    document.cookie = name + "=" + escape(value) +
89    ((expires) ? "; expires=" + expires : "") +
90    ((path) ? "; path=" + path : "") +
91    ((domain) ? "; domain=" + domain : "") +
92    ((secure) ? "; secure" : "");
93}
94
95function getCookie(name) {
96    var cookie = " " + document.cookie;
97    var search = " " + name + "=";
98    var setStr = null;
99    var offset = 0;
100    var end = 0;
101    if (cookie.length > 0) {
102        offset = cookie.indexOf(search);
103        if (offset != -1) {
104            offset += search.length;
105            end = cookie.indexOf(";", offset)
106            if (end == -1) {
107                end = cookie.length;
108            }
109            setStr = unescape(cookie.substring(offset, end));
110        }
111    }
112    return(setStr);
113}
114
115function str_replace(search, replace, subject) {
116    return subject.split(search).join(replace);
117}
118
119function f_clientWidth() {
120    return f_filterResults (
121        window.innerWidth ? window.innerWidth : 0,
122        document.documentElement ? document.documentElement.clientWidth : 0,
123        document.body ? document.body.clientWidth : 0
124    );
125}
126
127function f_clientHeight() {
128    return f_filterResults (
129        window.innerHeight ? window.innerHeight : 0,
130        document.documentElement ? document.documentElement.clientHeight : 0,
131        document.body ? document.body.clientHeight : 0
132    );
133}
134
135function getClientWidth()
136{
137  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
138}
139
140function getDocumentHeight(){
141return (document.body.scrollHeight > document.body.offsetHeight)? document.body.scrollHeight: document.body.offsetHeight;
142}
143
144function getImageX(imgElem) {
145  xPos = eval(imgElem).offsetLeft;
146  tempEl = eval(imgElem).offsetParent;
147    while (tempEl != null) {
148     xPos += tempEl.offsetLeft;
149     tempEl = tempEl.offsetParent;
150    }
151  return xPos;
152}
153
154/*
155Функция для вставки HTML-кода, содержащего javascript
156el - элемент DOM, в который нужно вставить HTML
157html - собственно, сам HTML, который надо вставить
158*/
159function InsertHTML(el, html)
160{
161    el.innerHTML=html;
162    scripts = el.getElementsByTagName("script");
163    head = document.getElementsByTagName('head')[0];
164    for(i=0 ; i<scripts.length ; i++)
165    {
166        eval (scripts[i].innerHTML);
167        var script = document.createElement('script');
168        script.src = scripts[i].src;
169        head.appendChild(script);
170    }
171}
172
173function HighLight(obj){
174    var len = 800;
175    var bg = '#656248';
176    //var obj = 'input:text[name='+el+']';
177    var bg_save = $(obj).css('background-color');
178    $(obj).css({'background-color':bg});
179    $(obj).animate({
180        'backgroundColor': bg_save,
181    }, len );
182}
183
184function ajax_form_hide(){
185    $('#ajax_popup').hide('fast');
186}
187
188function ajax_form_show(){
189    var t = getDocumentHeight()+'px';
190    $('#wrapper').css('height',t);
191    $('#ajax_popup').show('fast');//'fast'
192    $('#ajax_popup .popup').css({'top':'160px'});
193}
194
195
196function formatMBT() {
197    var out_str = $('#cat_bas_phone').val().replace(new RegExp('\\D+', 'g'), '');
198    var p1 = out_str.substr(1, 3);
199    var p2 = out_str.substr(4, 3);
200    var p3 = out_str.substr(7, 2);
201    var p4 = out_str.substr(9, 2);
202    if (p4.length > 0) {
203        out_str = '+7 (' + p1 + ') ' + p2 + '-' + p3 + '-' + p4;
204    } else if (p3.length > 0) {
205        out_str = '+7 (' + p1 + ') ' + p2 + '-' + p3;
206    } else if (p2.length > 0) {
207        out_str = '+7 (' + p1 + ') ' + p2;
208    } else if (p1.length > 0) {
209        out_str = '+7 (' + p1;
210    } else {
211        out_str = '+7';
212    }
213    //alert(5);
214    $('#cat_bas_phone').val(out_str);
215    //alert(6);
216}
217
218function cms_ajax_post(ident){
219    var url = '/sources/'+ident+'/'+ident+'_ajax.php';
220    if (init_ajax()==false) return;
221    // Адрес скрипта обрабатывающего запросы
222    fombj = document.getElementById( ident+'_form' );
223    var parr = collect_data();
224    $('#'+ident+'_add_result').slideUp('fast',function(){
225        $('#'+ident+'_dbut').fadeOut('fast',function(){
226            $('#'+ident+'_loader').fadeIn('slow',function(){
227                var geturl;
228                geturl = $.ajax({
229                    type: 'POST',
230                    url: url,
231                    data: parr,
232                    dataType: 'html',
233                    success: function(msg){
234                        var status = geturl.getResponseHeader('status');
235                        // Заполняем подчиненый селект
236                        if (status=='success'){
237                            $('#'+ident+'_div_add').html(msg);
238                        }
239                        else{
240                            cms_ajax_post_resshow(ident,msg);
241                        }
242                    },
243                    error: function(){
244                            cms_ajax_post_resshow(ident,'Error while sending AJAX request / Во время AJAX запроса произошла ошибка');
245                    }
246                });
247            });
248        });
249    });
250    return
251}
252
253function cms_ajax_post_resshow(ident,msg){
254    $('#'+ident+'_add_result').html(msg);
255    $('#'+ident+'_add_result').slideDown('slow',function(){
256        $('#'+ident+'_loader').fadeOut('fast',function(){
257            $('#'+ident+'_dbut').fadeIn('fast');
258        });
259    });
260}

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.