1// define objects if not exists 2if (!window.uCoz) window.uCoz = {} 3if (!window.uCoz.sh_goods) window.uCoz.sh_goods = {} 4 5function payFromBalance(obj){ 6 if(confirm(obj.confirm.value)){ 7 new _uWnd('win-'+obj.id,obj.rem.value,-340,-120,{autosize:0,modal:1,closeonesc:1,resize:0},{form:obj.id,url:obj.action}); 8 9 }else{ 10 if(typeof window.shop_redirect != 'undefined'){ 11 location.href = window.shop_redirect; 12 window.shop_redirect = null; 13 } 14 } 15 16 return false; 17} 18 19function shopSelectPeriod(obj){ 20 var tmp = obj.options[obj.selectedIndex].value.split('|'); 21 var prefix = ( (obj.id=='scdate') ? 'c' : '' ); 22 23 $('#'+prefix+'date1').val(tmp[0]); 24 $('#'+prefix+'date2').val(tmp[1]); 25} 26 27function getDigitalGoods(i){ 28 if(digital_goods[i][0] == 1) 29 location.href = digital_goods[i][2]; 30 31 else if(digital_goods[i][0] == 2) 32 new _uWnd('getDigitalGoods'+i, digital_goods[i][1], 350, 60, {autosize:1, closeonesc:1, align:'center', icon:'/.s/img/icon/fm.png'}, digital_goods[i][2]); 33 34 return false; 35} 36 37function price2Basket() { 38 if (_shopLockButtons()) return false; 39 40 _uPostForm('', { 41 type: 'POST', 42 data: $('#shop-price-form').serializeArray().filter(function (item) { 43 var res = 0; 44 var id = item['name'].split('_'); 45 if (id[0] == 'oval') { 46 var item_elem = $('#shop-price-form [name=cnt_' + id[1] + ']'); 47 if (item_elem.attr('type') == 'checkbox') { 48 res = ( item_elem.attr("checked") ? 1 : 0); 49 } else { 50 res = ( item_elem.val() > 0 ? 1 : 0); 51 } 52 } else { 53 res = item['value'] != 0; 54 } 55 return res; 56 }), 57 url: '/shop/basket' 58 } 59 ); 60 61 $('input.pinput').attr('disabled', 'disabled'); 62 63 return false; 64} 65 66function hideGoods(id, ssid, pref){ 67 if(_shopLockButtons()) return false; 68 69 $('#'+pref+'-hib'+id).attr('src', '/.s/img/fr/EmnAjax.gif'); 70 _uPostForm('',{type:'POST',url:'/shop/' + id + '/edit',data:{'mode':'edit', 'method':'hide', 'id':id, 'pref':pref, 'ssid':ssid}}); 71 72 return false; 73} 74 75function upGoods(id, ssid, pref){ 76 if(_shopLockButtons()) return false; 77 78 $('#'+pref+'-qub'+id).attr('src', '/.s/img/fr/EmnAjax.gif'); 79 _uPostForm('',{type:'POST',url:'/shop/' + id + '/edit',data:{'mode':'edit', 'method':'quickup', 'id':id, 'pref':pref, 'ssid':ssid}}); 80 81 return false; 82} 83 84function deleteGoods(id, ssid, pref){ 85 if(_shopLockButtons()) return false; 86 87 $('#'+pref+'-dib'+id).attr('src', '/.s/img/fr/EmnAjax.gif'); 88 _uPostForm('',{type:'POST',url:'/shop/' + id + '/edit',data:{'mode':'edit', 'method':'delete', 'id':id, 'pref':pref, 'ssid':ssid}}); 89 90 return false; 91} 92 93function shopCatBlocks(obj, cname, c1, c2){ 94 var id = -1; 95 var ti = 0; 96 var hb = $('.cat-blocks ul:visible'); 97 98 if(hb.length){ 99 ti = $(hb).prev().attr('id').split('blocks-rt-')[1]; 100 } 101 102 if(obj !== undefined){ 103 id = $(obj).attr('id').split('blocks-rt-')[1]; 104 //ÑкÑÑваем оÑобÑаженнÑй блок подкаÑегоÑий 105 if(hb.length){ 106 $(hb).animate({height:'hide'}, 200).prev().addClass(c1).removeClass(c2); 107 } 108 //показÑваем, еÑли ÑкÑÑÑ Ð½ÑжнÑй блок подкаÑегоÑий 109 if(ti != id ){ 110 $('#blocks-ch-'+id).animate({height:'show'}, 200); 111 $('#blocks-rt-'+id).removeClass(c1).addClass(c2); 112 } 113 } 114 115 var page = parseInt($('#cid-p-0').val()); 116 var cval = '0=1|'+page; 117 118 $('.cid-p').each(function(){ 119 var el_id = $(this).attr('id').replace('cid-p-', '') 120 page = $(this).val(); 121 122 if((el_id == id && ti != id) || (obj == undefined && el_id == ti)){ 123 cval += ','+el_id+'=1|'+page; 124 }else{ 125 if(page > 1){ 126 cval += ','+el_id+'=0|'+page; 127 } 128 } 129 }); 130
131 uSetCookie(cname, cval, 3600*24*30, '/'); 132} 133 134function shopCatExpand(obj, cname){ 135 $(obj).toggleClass('plus').toggleClass('minus').parent().children('ul').toggle(); 136 137 return _shopTreeStore(cname); 138} 139 140function categoryFilter(field, val, fromURL){ 141 if(_shopLockButtons()) return false; 142 143 var res = decodeURIComponent(document.location.href); 144 145 if(!fromURL){ 146 _shopFadeControl('goods_cont'); 147 res = res.replace(/\;(?:[0-9]+)/, ''); 148 //_uPostForm('',{type:'POST',url:location.href,data:{'mode':'filter', 'field':field, 'value':(field != 'f_status' ? shop_filter_vals[val] : val)}}); 149 _uPostForm('', {type:'POST', url:res, data:{'mode':'filter', 'field':field, 'value':shop_filter_vals[val]}}); 150 151 }else{ 152 if(field == 'f_status') { 153 res = res.replace(/\;f_status\=[0-9]/g, ''); 154 res += (val ? ';f_status='+val : ''); 155 156 }else{ 157 var reg = new RegExp("\;f\_"+field+"=(?:[0-9a-zA-Z-_]+)?", "g"); 158 res = res.replace(reg, ''); 159 res += (shop_filter_vals[val] ? ';f_'+field+'='+encodeURIComponent(shop_filter_vals[val]) : ''); 160 } 161 162 res = res.replace(/\;(?:[0-9]+)/, ''); 163 164 var res2 = /(all|wishlist)(?:\/?(.*))?$/.exec(res); 165 166 if (res2 && (res2[1] && (res2[1] == 'all' || res2[1] == 'wishlist')) && res2[2]) { 167 var fVal = /(?:(\;.*))/.exec(res2[2]); 168 if (fVal && fVal[1]) { 169 var reg = new RegExp('/' + res2[2] + '$', 'g'); 170 res = res.replace(reg, fVal[1]); 171 } 172 173 }else{ 174 res2 = /user(?:\/+([0-9]+)(?:\/+(goods)(?:\/?(.*))?)?)?$/.exec(res); 175 176 if (res2 && res2[3]) { 177 var fVal = /(?:(\;.*))/.exec(res2[3]); 178 179 if (fVal && fVal[1]) { 180 var reg = new RegExp('/' + res2[3] + '$', 'g'); 181 res = res.replace(reg, fVal[1]); 182 } 183 } 184 } 185 186 document.location.href = res; 187 } 188 189 return false; 190} 191 192var shop_page; 193var shop_num_pages; 194 195function shopPageMore(data) { 196 if ( _shopLockButtons() ) return false 197 198 $('#shop-page-more').addClass('wait').show(); 199 $('.shop-more-scroll').addClass('gTableTop'); 200 201/* // disabled feature 202 // get unique items 203 const pages = location.hash.replace('#', '').split(/,/).reduce( (acc, num) => ( acc[num] = true ) && acc, {} ) 204 205 // save loaded page to url hash 206 const separator = location.hash.includes('#') ? ',' : '#' 207 if ( !pages[ data.more ] ) location.hash += separator + data.more 208*/ 209 210 // drop url hash for request url 211 const url = new URL( document.location ) 212 url.hash = '' 213 214 _uPostForm('', { type:'POST', url:decodeURIComponent( url.toString() ), async:0, data }) 215 216 return 217} 218 219/* 220function shopPageMoreRestoreItems() { 221 if ( !location.hash || location.hash == '#' ) return 222 223 const pages = location.hash.replace('#', '').split(/,/) 224 const morePageParams = {} 225 226 // search page params update 227 try { Object.assign( morePageParams, shopSerachSerialize() ) } catch(e) {} 228 229 // loop of ajax load pages 230 pages.forEach( pageNum => shopPageMore( { ...morePageParams, more:pageNum } ) ) 231 232 return 233} 234 235document.addEventListener('DOMContentLoaded', shopPageMoreRestoreItems) 236*/ 237 238function shopPageScrollClose(obj){ 239 $(obj).parent().removeClass('gTableTop'); 240 241 return false; 242} 243 244function categorySort(colum, order){ 245 if(_shopLockButtons()) return false; 246 247 _shopFadeControl('goods_cont'); 248 _uPostForm('', {type:'POST', url:decodeURIComponent(document.location.href), data:{'mode':'sort', 'sort':colum, 'order':order}}); 249 250 return false; 251} 252 253function _shopTreeStore(cname){ 254 var cval = '0=0|'; 255 var p0 = $('#cid-p-0'); 256 257 if(p0.length > 0){ 258 cval += $('#cid-p-0').val(); 259 260 }else{ 261 cval += '1'; 262 } 263 264 $('li ul.cat-tree:visible').each(function(){ 265 var cat_id = $(this).parent().attr('id').split('cid-')[1]; 266 var page = $(this).parent().find('#cid-p-'+cat_id).val(); 267 cval += ',' + cat_id + '=1|'+page; 268 }); 269
270 uSetCookie(cname, cval, 3600*24*30, '/'); 271 272 return false; 273} 274 275var lock_categories = 0; 276/* 277полÑÑение набоÑа каÑегоÑий 278pid - id ÑодиÑелÑÑкой каÑегоÑии, Ð´Ð»Ñ ÐºÐ¾ÑоÑой нÑжно полÑÑиÑÑ Ð½Ð°Ð±Ð¾Ñ 279cname - кÑка Ñ ÐºÐ¾ÑоÑой нÑжно взÑÑÑ ÑпиÑок ÑаÑкÑÑÑÑÑ ÐºÐ°ÑегоÑий 280el_id - id ÑлеменÑа в DOM-деÑеве, поÑле коÑоÑого нÑжно вÑÑавиÑÑ Ð¿Ð¾Ð»ÑÑеннÑй Ð½Ð°Ð±Ð¾Ñ 281el_more - ÐµÐ»ÐµÐ¼ÐµÐ½Ñ ÑÑÑлка "ÐоказаÑÑ ÐµÑе" 282*/ 283function shopCatShowMore(pid, ssid, cname, el_id, el_more, sh_g){ 284 if(lock_categories == 1){ 285 return false; 286 } 287 288 lock_categories = 1; 289 290 var pageEl = $('#cid-p-'+pid); 291 pageEl.val(parseInt(pageEl.val())+1); 292 293 if(el_id.search(/blocks-rt-/) != -1 || el_id.search(/blocks-ch-/) != -1){ 294 shopCatBlocks(undefined, cname, '', ''); 295 }else{ 296 _shopTreeStore(cname); 297 } 298 299 el_more.html($('<div class="myWinLoad" style="margin:5px; height: 31px !important;"></div>')); 300 301 _uPostForm( 302 '', 303 { 304 type:'POST', 305 url:'/shop/catalog', 306 data:{ 307 cat_pid: pid, 308 el_id: el_id, 309 mode: 'cat_subblock', 310 cname: cname, 311 sh_g: sh_g, 312 ssid: ssid 313 } 314 } 315 ); 316 317 $(el_more).addClass('need_remove'); 318} 319 320var lock_cats_catalog = 0; 321 322function shopCatsCatalogShowMore(colums, childs, show_goods_count, parent, ssid, el_more) { 323 if (lock_cats_catalog == 1) { 324 return false; 325 } 326 327 lock_cats_catalog = 1; 328 329 var pageEl = $('#cats_catalog_cid-p-0'); 330 pageEl.val(parseInt(pageEl.val()) + 1); 331 332 el_more.html($('<div class="myWinLoad" style="margin:5px; height: 31px !important;"></div>')); 333 334 _uPostForm( 335 '', 336 { 337 type: 'POST', 338 url: '/shop/catalog', 339 data: { 340 colums: colums, 341 childs: childs, 342 show_goods_count: show_goods_count, 343 parent: parent, 344 page: pageEl.val(), 345 mode: 'cats_catalog_subblock', 346 ssid: ssid 347 } 348 } 349 ); 350 351 $("#show_cats_more_block").parent().addClass('show_cats_more_block_need_remove'); 352} 353 354var lock_buttons = 0; 355 356function _shopLockButtons(){ 357 if(lock_buttons) return true; 358 359 lock_buttons = 1; 360 361 return false; 362} 363 364function _dynform(values, url){ 365 if(url==undefined) url = ''; 366 367 var fd = ''; 368 369 for(i in values){ 370 fd += '<input type="hidden" name="'+i+'" value="'+values[i]+'">'; 371 } 372 373 var obj = $('#dyn-post'); 374 375 if(obj.length){ 376 $(obj).html(fd).attr('action', url); 377 378 }else{ 379 $('body').append('<form id="dyn-post" action="'+url+'" method="post">'+fd+'</form>'); 380 } 381} 382 383function uSetCookie (name,value,expir,path,domain,secure) { 384 var today = new Date(); 385 var expires = new Date(); 386 387 expires.setTime(today.getTime() + 1000*expir); 388 389 document.cookie = name + "=" + escape (value) + 390 ((expires) ? "; expires=" + expires.toGMTString() : "") + 391 ((path) ? "; path=" + path : "/") + 392 ((domain) ? "; domain=" + domain : "") + 393 ((secure) ? "; secure" : ""); 394} 395 396function editOrderFieldCancel(oid, fid, value) { 397 $('.o'+oid+'-field-value-'+fid+'-wrapper').html(value); 398 lock_buttons=0; 399 curr_send = false; 400} 401 402function editOrderField(oid, field_id, field_name, field_type, field_values_list, field_value, update) { 403 for(key in _uWnd.all){ 404 if(_uWnd.all[key] != null && _uWnd.all[key].name.search(/inv\_wnd\_(.+)/)!=-1) inv_wnd_opened = true; 405 } 406 407 if(inv_wnd_opened && update!='popup') return; 408 if(_shopLockButtons() || curr_send) return; 409 410 var inv_wnd_opened = false; 411 412 curr_send = oid+'_'+field_id; 413 414 switch(field_type) { 415 case 'phone': 416 case 'email': 417 case 'text': 418 case 'textarea': 419 case 'promo': 420 // case 'gmaps': 421 new _uWnd( 422 'wnd_'+field_id, 423 field_name, 424 550, 425 350, 426 { 427 autosize:1, 428 resize:0, 429 modal:0, 430 closeonesc:1, 431 icon:'/.s/img/icon/pent.png', 432 onclose:function(){lock_buttons=0; curr_send=false;} 433 }, 434 { 435 url:'/shop/checkout', 436 type:'POST', 437 data:{ 438 'id':oid, 439 'mode':'inv_chfld', 440 'fid':field_id, 441 'ftype':field_type, 442 'fval':field_value, 443 'ssid':ssid, 444 'update':update 445 }, 446 cache:1 447 } 448 ); 449 break; 450 case 'checkbox': 451 editOrderFieldSend(oid, field_id, field_value, update); 452 break; 453 case 'radio': 454 case 'select': 455 _uPostForm('', {url:'/shop/checkout', type:'POST', data:{ 456 mode:'inv_chfld', 457 id:oid, 458 fid:field_id, 459 ftype:field_type, 460 update:update, 461 ssid:ssid 462 }}); 463 var load_img = '/img/sh/wait.gif'; 464 if(update == 'order') load_img = '/img/ma/m/i3.gif'; 465 $('.o'+oid+'-field-value-'+field_id+'-wrapper') 466 .attr('old_val', $('.'+oid+'-field-value-'+field_id+'-wrapper').html()) 467 .html('<img alt="" id="inote-'+oid+'-wait" src="/.s'+load_img+'">'); 468 break; 469 default: 470 //console.log("DEFAULT IN AJAX"); 471 curr_send = false;
472 lock_buttons = 0; 473 break; 474 }; 475 476 return false; 477} 478 479function editOrderFieldSend(id, field_id, field_value, update) { 480 //if(curr_send != id+'_'+field_id){ 481 //_uButtonEn('inote-form-'+id,1); 482 //}else{ 483 var formid = (field_value !== undefined ? '' : 'order-field-'+field_id); 484 485 if( update == 'order' ) 486 $('.o'+id+'-field-value-'+field_id+'-wrapper') 487 .hide() 488 .after('<img alt="" id="inote-'+id+'-wait" src="/.s/img/ma/m/i3.gif">'); 489 else 490 $('.o'+id+'-field-value-'+field_id+'-wrapper') 491 .hide() 492 .after('<img alt="" id="inote-'+id+'-wait" src="/.s/img/sh/wait.gif">'); 493 494 field_value = (field_value ? field_value : document.getElementById('fval').value); 495 496 _uPostForm(formid, {type:'POST', url:'/shop/checkout', data:{ 497 mode:'inv_chfld_save', 498 update:update, 499 id:id, 500 fid:field_id, 501 fval:field_value, 502 ssid:ssid 503 }}); 504 _uWnd.close('wnd_'+field_id); 505 curr_send = false; 506 //} 507 508 return false; 509} 510 511// Maps 512// function create_map(id, type, lat, lng, z){ 513// if(type == undefined || type == '' || type == null){ 514// plog('Type of maps undefined', 'MAPS'); 515// return false; 516// }; 517// 518// $('#'+id+'-canvas').attr('style', 'height:450px;overflow:hidden;').next('div').removeAttr('style'); 519// 520// switch(type){ 521// case 'gmap': create_gmap(id, lat, lng, z);break; 522// case 'ymap': create_ymap(id, lat, lng, z);break; 523// } 524// 525// return 1; 526// } 527// 528// function create_gmap(id, lat, lng, z){ 529// plog('GMAP START', 'MAPS'); 530// 531// var myOptions = { 532// zoom: parseInt(z), 533// mapTypeId: google.maps.MapTypeId.ROADMAP 534// }; 535// 536// gmaps[id].map = new google.maps.Map(document.getElementById(id+'-canvas'), myOptions); 537// 538// if(gmaps[id].options == undefined) gmaps[id].options = {}; 539// if(gmaps[id].options.is_editable == undefined) gmaps[id].options.is_editable = false; 540// 541// if(gmaps[id].options.placemarks == undefined){ 542// gmaps[id].latlng = new google.maps.LatLng(lat, lng); 543// gmaps[id].placemark = new google.maps.Marker({ 544// position: gmaps[id].latlng, 545// map: gmaps[id].map, 546// draggable: gmaps[id].options.is_editable ? true : false 547// }); 548// gmaps[id].map.setCenter(gmaps[id].latlng); 549// gmaps[id].placemark.inner_id = id; 550// 551// if(gmaps[id].options.is_editable) { 552// google.maps.event.addListener(gmaps[id].placemark, 'dragstart', function() { 553// if(gmaps[this.inner_id].placemark_info != undefined) 554// gmaps[this.inner_id].placemark_info.close(); 555// }); 556// 557// google.maps.event.addListener(gmaps[id].placemark, 'dragend', function() { 558// gmap_set_data(this.inner_id); 559// gmap_get_address(this.inner_id); 560// }); 561// } 562// 563// gmap_get_address(id); 564// 565// google.maps.event.addListener(gmaps[id].placemark, 'click', function() { 566// gmaps[this.inner_id].placemark_info = new google.maps.InfoWindow({content:$('#'+this.inner_id+'-addr').val()}); 567// gmaps[this.inner_id].placemark_info.open(gmaps[this.inner_id].map, gmaps[this.inner_id].placemark); 568// }); 569// 570// }else{ 571// gmaps[id].placemarks = {}; 572// gmaps[id].geopoints = []; 573// gmaps[id].bounds = new google.maps.LatLngBounds(); 574// 575// for(key in gmaps[id].options.placemarks){ 576// var point = new google.maps.LatLng(gmaps[id].options.placemarks[key].lat, gmaps[id].options.placemarks[key].lng); 577// gmaps[id].bounds.extend(point); 578// gmaps[id].geopoints.push(point); 579// gmaps[id].placemarks[key] = new google.maps.Marker({ 580// position: point, 581// map: gmaps[id].map 582// }); 583// gmaps[id].placemarks[key].inner_key = key; 584// gmaps[id].placemarks[key].inner_id = id; 585// google.maps.event.addListener(gmaps[id].placemarks[key], 'click', function() { 586// gmaps[this.inner_id].placemarks[this.inner_key].description = new google.maps.InfoWindow({content:gmaps[this.inner_id].options.placemarks[this.inner_key].balloon}); 587// gmaps[this.inner_id].placemarks[this.inner_key].description.open(gmaps[this.inner_id].map, gmaps[this.inner_id].placemarks[this.inner_key]); 588// }); 589// }; 590// 591// gmaps[id].rect = new google.maps.Rectangle({ 592// map:gmaps[id].map, 593// bounds:gmaps[id].bounds, 594// strokeColor: "#FF0000", 595// strokeOpacity: 0.8, 596// strokeWeight: 3, 597// fillColor: "#FF0000", 598// fillOpacity: 0.35 599// }); 600// 601// //gmaps[id].map.setCenter(gmaps[id].bounds.getCenter()); 602// gmaps[id].map.fitBounds(gmaps[id].bounds); 603// } 604// } 605// 606// function gmap_set_data(id) { 607// $('#'+id+'-lat').val(gmaps[id].placemark.getPosition().lat()); 608// $('#'+id+'-lng').val(gmaps[id].placemark.getPosition().lng()); 609// } 610// 611// function gmap_get_address(id) { 612// var geocoder = new google.maps.Geocoder(); 613// var latlng = gmaps[id].placemark.getPosition(); 614// 615// geocoder.geocode({'latLng': latlng}, function (results, status) { 616// if (status != google.maps.GeocoderStatus.OK && (results[1] == undefined || results[1] == null)) { 617// _uWnd.alert("Error while geolocating. Status Code:" + status); 618// } else { 619// gmaps[id].map_addr = results[1].formatted_address;
620// $('#'+id+'-addr').val(results[1].formatted_address).trigger('onchange');; 621// } 622// }); 623// } 624// 625// function create_ymap(id, lat, lng, z){ 626// plog('YANDEXMAP START', 'MAPS'); 627// 628// YMaps.jQuery(function () { 629// ymaps[id].map = new YMaps.Map(YMaps.jQuery("#"+id+"-canvas")[0]); 630// ymaps[id].map.enableScrollZoom(); 631// ymaps[id].map.addControl(new YMaps.TypeControl()); 632// ymaps[id].map.addControl(new YMaps.ToolBar()); 633// ymaps[id].map.addControl(new YMaps.Zoom()); 634// ymaps[id].map.addControl(new YMaps.MiniMap()); 635// ymaps[id].map.addControl(new YMaps.ScaleLine()); 636// 637// if(ymaps[id].options == undefined) ymaps[id].options = {}; 638// if(ymaps[id].options.is_editable == undefined) ymaps[id].options.is_editable = false; 639// 640// if(ymaps[id].options.placemarks == undefined){ 641// ymaps[id].geopoint = new YMaps.GeoPoint(lng, lat); 642// ymaps[id].map.setCenter(ymaps[id].geopoint, z); 643// ymaps[id].placemark = new YMaps.Placemark(ymaps[id].geopoint, {draggable: ymaps[id].options.is_editable}); 644// 645// if(ymaps[id].options.is_editable){ 646// YMaps.Events.observe( 647// ymaps[id].placemark, 648// ymaps[id].placemark.Events.DragEnd, 649// function (placemark) { 650// ymap_get_adress(id); 651// ymap_set_data(id); 652// } 653// ); 654// } 655// ymap_get_adress(id); 656// ymaps[id].map.addOverlay(ymaps[id].placemark); 657// 658// }else{ 659// ymaps[id].placemarks = {}; 660// ymaps[id].geopoints = []; 661// 662// for(key in ymaps[id].options.placemarks){ 663// var point = new YMaps.GeoPoint(ymaps[id].options.placemarks[key].lng, ymaps[id].options.placemarks[key].lat); 664// ymaps[id].geopoints.push(point); 665// ymaps[id].placemarks[key] = new YMaps.Placemark(point); 666// ymaps[id].placemarks[key].description = ymaps[id].options.placemarks[key].balloon; 667// ymaps[id].map.addOverlay(ymaps[id].placemarks[key]); 668// }; 669// 670// bounds = new YMaps.GeoCollectionBounds(ymaps[id].geopoints); 671// 672// var style = new YMaps.Style(); 673// 674// style.polygonStyle = new YMaps.PolygonStyle(); 675// style.polygonStyle.fill = 1; 676// style.polygonStyle.outline = 1; 677// style.polygonStyle.strokeWidth = 10; 678// style.polygonStyle.strokeColor = "ffff0088"; 679// style.polygonStyle.fillColor = "ff000055"; 680// var polygon = new YMaps.Polygon([bounds.getLeftTop(), bounds.getRightTop(), bounds.getRightBottom(), bounds.getLeftBottom()], {style:style}); 681// ymaps[id].map.setBounds(bounds); 682// ymaps[id].map.addOverlay(polygon); 683// } 684// }) 685// } 686// 687// function ymap_set_data(id) { 688// $('#'+id+'-lat').val(ymaps[id].placemark.getGeoPoint().getY()).trigger('onchange'); 689// $('#'+id+'-lng').val(ymaps[id].placemark.getGeoPoint().getX()).trigger('onchange'); 690// } 691// 692// function ymap_get_adress(id) { 693// var geocoder = new YMaps.Geocoder(ymaps[id].placemark.getGeoPoint(), {results: 1}); 694// 695// YMaps.Events.observe(geocoder, geocoder.Events.Load, function () { 696// if (this.length()) { 697// ymaps[id].placemark.setBalloonContent(this.get(0).text); 698// 699// if(ymaps[id].options.is_editable){ 700// $('#'+id+'-addr').val(this.get(0).text).trigger('onchange'); 701// } 702// 703// return true; 704// 705// }else{ 706// plog('Place not found', 'MAPS-GEOCODER'); 707// 708// return false; 709// } 710// }); 711// } 712 713// ImageList 714 715var image_list={ 716 ajaxloadingmsg: '<div style="background:url(/.s/img/ma/m/i3.gif) no-repeat center bottom; height:50px;" ></div>', 717 defaultbuttonsfade:0.3, // fade degree for disabled nav buttons (0=completely transparent, 1=completely opaque) 718 configholder: {}, 719 720 getCSSValue:function(val){ //Returns either 0 (if val contains 'auto') or val as an integer 721 return (val=="auto")? 0 : parseInt(val) 722 }, 723 724 getoffset:function(what, offsettype){ 725 return (what.offsetParent)? what[offsettype]+this.getoffset(what.offsetParent, offsettype) : what[offsettype] 726 }, 727 728 fadebuttons:function(config, currentpanel){ 729 config.$leftnavbutton.fadeTo('fast', currentpanel==0? this.defaultbuttonsfade : 1) 730 config.$rightnavbutton.fadeTo('fast', currentpanel==config.lastvisiblepanel? this.defaultbuttonsfade : 1) 731 }, 732 733 addnavbuttons:function(config, currentpanel){ 734 $('#image-lnav').remove(); 735 $('#image-rnav').remove(); 736
737 config.$leftnavbutton=$('<img id="image-lnav" src="'+config.defaultbuttons.leftnav[0]+'">').css({zIndex:50, position:'absolute', left:/* config.offsets.left+ */config.defaultbuttons.leftnav[1]+'px', top:/* config.offsets.top+ */config.defaultbuttons.leftnav[2]+'px', cursor:'hand', cursor:'pointer'}).appendTo('#image-list-cont') 738 config.$rightnavbutton=$('<img id="image-rnav" src="'+config.defaultbuttons.rightnav[0]+'">').css({zIndex:50, position:'absolute', right:/* left:config.offsets.left+config.$gallery.get(0).offsetWidth+ */config.defaultbuttons.rightnav[1]+'px', top:/* config.offsets.top+ */config.defaultbuttons.rightnav[2]+'px', cursor:'hand', cursor:'pointer'}).appendTo('#image-list-cont') 739 config.$leftnavbutton.on('click', function(){ //assign nav button event handlers 740 image_list.stepBy(config.galleryid, -config.defaultbuttons.moveby) 741 }) 742 config.$rightnavbutton.on('click', function(){ //assign nav button event handlers 743 image_list.stepBy(config.galleryid, config.defaultbuttons.moveby) 744 }) 745 746 if (config.panelbehavior.wraparound==false){ //if carousel viewer should stop at first or last panel (instead of wrap back or forth) 747 this.fadebuttons(config, currentpanel) 748 } 749 750 return config.$leftnavbutton.add(config.$rightnavbutton) 751 }, 752 753 alignpanels:function(config){ 754 var paneloffset=0 755 756 config.paneloffsets=[paneloffset] //array to store upper left offset of each panel (1st element=0) 757 config.panelwidths=[] //array to store widths of each panel 758 759 config.$panels.each(function(index){ //loop through panels 760 var $currentpanel=$(this) 761 $currentpanel.css({float: 'none', position: 'absolute', left: paneloffset+'px'}) //position panel 762 $currentpanel.on('click', function(e){return config.onpanelclick(e.target)}) //bind onpanelclick() to onclick event 763 paneloffset+=image_list.getCSSValue($currentpanel.css('marginRight')) + parseInt($currentpanel.get(0).offsetWidth || $currentpanel.css('width')) //calculate next panel offset 764 config.paneloffsets.push(paneloffset) //remember this offset 765 config.panelwidths.push(paneloffset-config.paneloffsets[config.paneloffsets.length-2]) //remember panel width 766 }) 767 768 config.paneloffsets.pop() //delete last offset (redundant) 769 var addpanelwidths=0 770 var lastpanelindex=config.$panels.length-1 771 config.lastvisiblepanel=lastpanelindex 772 773 for (var i=config.$panels.length-1; i>=0; i--){ 774 addpanelwidths+=(i==lastpanelindex? config.panelwidths[lastpanelindex] : config.paneloffsets[i+1]-config.paneloffsets[i]) 775 if (config.gallerywidth>addpanelwidths){ 776 config.lastvisiblepanel=i //calculate index of panel that when in 1st position reveals the very last panel all at once based on gallery width 777 } 778 } 779 780 //alert(paneloffset+' - '+config.currentpanel); 781 config.$belt.css({width: paneloffset+'px'}) //Set Belt DIV to total panels' widths 782 config.currentpanel=(typeof config.currentpanel=="number" && config.currentpanel<config.$panels.length)? config.currentpanel : 0 783 784 if (config.currentpanel!=0){ 785 var endpoint=config.paneloffsets[config.currentpanel]+(config.currentpanel==0? 0 : config.beltoffset) 786 config.$belt.css({left: -endpoint+'px'}) 787 } 788 789 if (config.defaultbuttons.enable==true){ //if enable default back/forth nav buttons 790 var $navbuttons=this.addnavbuttons(config, config.currentpanel) 791 $(window).on("load resize", function(){ //refresh position of nav buttons when page loads/resizes, in case offsets weren't available document.oncontentload 792 config.offsets={left:image_list.getoffset(config.$gallery.get(0), "offsetLeft"), top:image_list.getoffset(config.$gallery.get(0), "offsetTop")} 793 config.$leftnavbutton.css({left:/* config.offsets.left+ */config.defaultbuttons.leftnav[1]+'px', top:/* config.offsets.top+ */config.defaultbuttons.leftnav[2]+'px'}) 794 config.$rightnavbutton.css({right:/* left:config.offsets.left+config.$gallery.get(0).offsetWidth+ */config.defaultbuttons.rightnav[1]+'px', top:/* config.offsets.top+ */config.defaultbuttons.rightnav[2]+'px'}) 795 }) 796 } 797 798 this.statusreport(config.galleryid) 799 config.oninit() 800 config.onslideaction(this) 801 }, 802 803 stepTo:function(galleryid, pindex){ /*User entered pindex starts at 1 for intuitiveness. Internally pindex still starts at 0 */ 804 var config=image_list.configholder[galleryid] 805 806 if (typeof config=="undefined"){ 807 alert("There's an error with your set up of Carousel Viewer \""+galleryid+ "\"!") 808 return 809 } 810 811 var pindex=Math.min(pindex-1, config.paneloffsets.length-1) 812 var endpoint=config.paneloffsets[pindex]+(pindex==0? 0 : config.beltoffset) 813 814 if (config.panelbehavior.wraparound==false && config.defaultbuttons.enable==true){ //if carousel viewer should stop at first or last panel (instead of wrap back or forth) 815 this.fadebuttons(config, pindex) 816 } 817 818 config.$belt.animate({left: -endpoint+'px'}, config.panelbehavior.speed, function(){config.onslideaction(this)}) 819 config.currentpanel=pindex 820 this.statusreport(galleryid) 821 },
822 823 stepBy:function(galleryid, steps){ //isauto if defined indicates stepBy() is being called automatically 824 var config=image_list.configholder[galleryid] 825 if (typeof config=="undefined"){ 826 alert("There's an error with your set up of Carousel Viewer \""+galleryid+ "\"!") 827 return 828 } 829 //alert(config.currentpanel); 830 var direction=(steps>0)? 'forward' : 'back' //If "steps" is negative, that means backwards 831 var pindex=config.currentpanel+steps //index of panel to stop at 832 if (config.panelbehavior.wraparound==false){ //if carousel viewer should stop at first or last panel (instead of wrap back or forth) 833 pindex=(direction=="back" && pindex<=0)? 0 : (direction=="forward")? Math.min(pindex, config.lastvisiblepanel) : pindex 834 if (config.defaultbuttons.enable==true){ //if default nav buttons are enabled, fade them in and out depending on if at start or end of carousel 835 image_list.fadebuttons(config, pindex) 836 } 837 } 838 else{ //else, for normal stepBy behavior 839 if (pindex>config.lastvisiblepanel && direction=="forward"){ 840 //if destination pindex is greater than last visible panel, yet we're currently not at the end of the carousel yet 841 pindex=(config.currentpanel<config.lastvisiblepanel)? config.lastvisiblepanel : 0 842 } 843 else if (pindex<0 && direction=="back"){ 844 //if destination pindex is less than 0, yet we're currently not at the beginning of the carousel yet 845 pindex=(config.currentpanel>0)? 0 : config.lastvisiblepanel /*wrap around left*/ 846 } 847 } 848 var endpoint=config.paneloffsets[pindex]+(pindex==0? 0 : config.beltoffset) //left distance for Belt DIV to travel to 849 if (pindex==0 && direction=='forward' || config.currentpanel==0 && direction=='back' && config.panelbehavior.wraparound==true){ //decide whether to apply "push pull" effect 850 config.$belt.animate({left: -config.paneloffsets[config.currentpanel]-(direction=='forward'? 100 : -30)+'px'}, 'normal', function(){ 851 config.$belt.animate({left: -endpoint+'px'}, config.panelbehavior.speed, function(){config.onslideaction(this)}) 852 }) 853 } 854 else 855 config.$belt.animate({left: -endpoint+'px'}, config.panelbehavior.speed, function(){config.onslideaction(this)}) 856 config.currentpanel=pindex 857 this.statusreport(galleryid) 858 },
859 860 statusreport:function(galleryid){ 861 var config=image_list.configholder[galleryid] 862 var startpoint=config.currentpanel //index of first visible panel 863 var visiblewidth=0 864 for (var endpoint=startpoint; endpoint<config.paneloffsets.length; endpoint++){ //index (endpoint) of last visible panel 865 visiblewidth+=config.panelwidths[endpoint] 866 if (visiblewidth>config.gallerywidth){ 867 break 868 } 869 } 870 startpoint+=1 //format startpoint for user friendiness 871 endpoint=(endpoint+1==startpoint)? startpoint : endpoint //If only one image visible on the screen and partially hidden, set endpoint to startpoint 872 var valuearray=[startpoint, endpoint, config.panelwidths.length] 873 for (var i=0; i<config.statusvars.length; i++){ 874 window[config.statusvars[i]]=valuearray[i] //Define variable (with user specified name) and set to one of the status values 875 config.$statusobjs[i].text(valuearray[i]+" ") //Populate element on page with ID="user specified name" with one of the status values 876 } 877 }, 878 879 setup:function(config){ 880 //Disable Step Gallery scrollbars ASAP dynamically (enabled for sake of users with JS disabled)
881 document.write('<style type="text/css">\n#'+config.galleryid+'{overflow: hidden;}\n</style>') 882 jQuery(document).ready(function($){ 883 config.$gallery=$('#'+config.galleryid) 884 config.gallerywidth=config.$gallery.width() 885 config.offsets={left:image_list.getoffset(config.$gallery.get(0), "offsetLeft"), top:image_list.getoffset(config.$gallery.get(0), "offsetTop")} 886 config.$belt=config.$gallery.find('.'+config.beltclass) //Find Belt DIV that contains all the panels 887 config.$panels=config.$gallery.find('.'+config.panelclass) //Find Panel DIVs that each contain a slide 888 config.panelbehavior.wraparound=config.panelbehavior.wraparound //if auto step enabled, set "wraparound" to true 889 config.onpanelclick=(typeof config.onpanelclick=="undefined")? function(target){} : config.onpanelclick //attach custom "onpanelclick" event handler 890 config.onslideaction=(typeof config.onslide=="undefined")? function(){} : function(beltobj){$(beltobj).stop(); config.onslide()} //attach custom "onslide" event handler 891 config.oninit=(typeof config.oninit=="undefined")? function(){} : config.oninit //attach custom "oninit" event handler 892 config.beltoffset=image_list.getCSSValue(config.$belt.css('marginLeft')) //Find length of Belt DIV's left margin 893 config.statusvars=config.statusvars || [] //get variable names that will hold "start", "end", and "total" slides info 894 config.$statusobjs=[$('#'+config.statusvars[0]), $('#'+config.statusvars[1]), $('#'+config.statusvars[2])] 895 config.currentpanel=0 896 image_list.configholder[config.galleryid]=config //store config parameter as a variable 897 image_list.alignpanels(config) //align panels and initialize gallery 898 }) //end document.ready 899 jQuery(window).on('unload', function(){ //clean up 900 jQuery.each(config, function(ai, oi){ 901 oi=null 902 }) 903 config=null 904 }) 905 } 906} 907 908/////////////////////////////////////////////////////////////////////////////////////////////////// 909 910function plog(msg, module){ 911 //if(console != undefined) console.log((module == undefined ? '' : module+' - ')+msg); 912 return; 913} 914 915function checkPromo(id, clear_code){ 916 $('#res'+id).show(); 917 918 var formData = formToObj(document.forms["checkout-form"]); 919 formData['mode'] = 'apply-promo'; 920 formData['fid'] = id; 921 if(typeof clear_code != 'undefined'){ 922 formData['clear_code'] = 1; 923 formData['code'] = 1; 924 }else{ 925 formData['code'] = $('[name=fld'+id+']').val().toUpperCase(); 926 } 927 delete formData['fld'+id]; 928 929 //_uPostForm('', {type: 'POST', url: location.href, data:{'mode': 'apply-promo', 'code': $('[name=fld'+id+']').val(), 'fid': id, 'ssid':$('input[name=ssid]').val()}}); 930 _uPostForm('', {type:'POST', url:decodeURIComponent('/shop/checkout'), data:formData}); 931} 932 933function verifyEmail(id){ 934 var email = $('[name=fld'+id+']').val(); 935 _uPostForm('', {type:'POST', url:'/shop/checkout', data: {'mode': 'verify_email', 't': 'verify', 'email': email, 'field': id, 'ssid':$('input[name=ssid]').val()}}); 936} 937 938function checkVerifyEmail(id){ 939 var code = $('[name=fld'+id+'code]').val(); 940 _uPostForm('', {type:'POST', url:'/shop/checkout', data: {'mode': 'verify_email', 't': 'check', 'code': code, 'field': id, 'ssid':$('input[name=ssid]').val()}}); 941} 942 943/* 944* ÐÑвод инÑоÑмаÑионнÑÑ ÑообÑÐµÐ½Ð¸Ñ Ð¿Ð¾Ð»ÑзоваÑелÑм. 945* ÐÐ°Ð½Ð½Ð°Ñ ÑÑнкÑÐ¸Ñ Ð¿ÑÐ¸Ð½Ð¸Ð¼Ð°ÐµÑ ÑледÑÑÑий Ð½Ð°Ð±Ð¾Ñ Ð¿Ð°ÑамеÑÑов: 946* wnd_msgs - ÑообÑение, коÑоÑое бÑÐ´ÐµÑ Ð²Ñведено полÑзоваÑелÑ. СообÑение Ð¼Ð¾Ð¶ÐµÑ ÑодеÑжаÑÑ HTML-Ñеги ÑоÑмаÑиÑованиÑ. 947* wnd_title - заголовок окна ÑообÑениÑ, оÑобÑажаÑÑегоÑÑ Ð² Ñапке. 948* wnd_type - Ñип ÑообÑениÑ. ÐÐ¾Ð¶ÐµÑ Ð±ÑÑÑ: «error» - оÑибка, «warning» - пÑедÑпÑеждение, «info» - инÑоÑмаÑионное ÑообÑение. ÐÑли Ñип не Ñказан или Ñказан Ñип, оÑлиÑнÑй Ð¾Ñ Ð¿ÐµÑеÑиÑленнÑÑ , Ñо ÑÑиÑаеÑÑÑ, ÑÑо ÑообÑение обÑее, а не какого-Ñо Ñипа. 949* wnd_w - ÑиÑина окна.
950* wnd_h - вÑÑоÑа окна. 951* wnd_opt - дополниÑелÑнÑе паÑамеÑÑÑ Ð¾ÐºÐ½Ð° ÑообÑениÑ. ÐолнÑй ÑпиÑок паÑамеÑÑов аналогиÑен ÑпиÑÐºÑ Ð¿Ð°ÑамеÑÑов, пÑинимаемÑÑ _uWnd() (http://helper.ucoz.ru/publ/coding/ujs/2-1-0-4). 952* wnd_name - ÑникалÑное Ð¸Ð¼Ñ Ð¾ÐºÐ½Ð°. Ðигде не оÑобÑажаеÑÑÑ. ÐÑполÑзÑеÑÑÑ Ð´Ð»Ñ Ð´Ð°Ð»ÑнейÑей ÑабоÑÑ Ñ Ð¸Ð½ÑоÑмаÑионнÑм окном Ñ Ð¿Ð¾Ð¼Ð¾ÑÑÑ ÑÑнкÑий _uWnd. 953* */ 954function shop_alert(wnd_msgs, wnd_title, wnd_type, wnd_w, wnd_h, wnd_opt, wnd_name){ 955 var wnd_content = ''; 956 957 if(wnd_type == 'error'){ 958 wnd_content += '<div id="shop_wnd_error"></div><div id="shop_wnd_text">'; 959 }else{ 960 if(wnd_type == 'warning'){ 961 wnd_content += '<div id="shop_wnd_warning"></div><div id="shop_wnd_text">'; 962 }else{ 963 if(wnd_type == 'info'){ 964 wnd_content += '<div id="shop_wnd_info"></div><div id="shop_wnd_text">'; 965 }else{ 966 wnd_content += '<div>'; 967 } 968 } 969 } 970 971 if(typeof wnd_name != 'string' || wnd_name == ''){ 972 wnd_name = 'shop_alert_window'; 973 } 974 975 if(typeof wnd_msgs == 'string'){ 976 wnd_content += wnd_msgs; 977 }else{ 978 if(typeof wnd_msgs == 'object'){ 979 wnd_content += '<ul>'; 980 for(msg in wnd_msgs) { 981 wnd_content += '<li>'+wnd_msgs[msg]+'</li>'; 982 } 983 wnd_content += '</ul>'; 984 }else{ 985 return; 986 } 987 } 988 989 wnd_content += '</div>'; 990 991 wnd_opt = $.extend({ 992 align: 'left', //вÑÑавнивание 993 shadow: 1, //ÑÐµÐ½Ñ 994 header: 1, //оÑобÑажаÑÑ Ð»Ð¸ ÑÐ°Ð¿ÐºÑ 995 close: 1, //оÑобÑажаÑÑ Ð»Ð¸ ÐºÐ½Ð¾Ð¿ÐºÑ Close (закÑÑÑÑ). 996 modal: 1, //модалÑное окно 997 popup: 1, //закÑÑваÑÑ Ð»Ð¸ окно пÑи клике на пÑоÑÑÑанÑÑве вне окна. 998 resize: 0, //ÑазÑеÑиÑÑ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ðµ ÑазмеÑов окна полÑзоваÑелем 999 fixed: 0, //ÑазÑеÑиÑÑ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ðµ ÑазмеÑов окна полÑзоваÑелем 1000 closeonesc: 1, //ÑазÑеÑиÑÑ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ðµ ÑазмеÑов окна полÑзоваÑелем 1001 close: 1, 1002 icon: '', 1003 tm: 0, 1004 align: 'left' 1005 }, wnd_opt || {}); 1006 1007 var l = new _uWnd( 1008 wnd_name, 1009 wnd_title, 1010 wnd_w, 1011 wnd_h, 1012 wnd_opt, 1013 wnd_content 1014 ); 1015 1016 if (wnd_opt.tm > 0) { 1017 setTimeout("var w=_uWnd.all[" + l.idx + "];if(w)w.close();", wnd_opt.tm); 1018 } 1019 1020 return l; 1021} 1022 1023function formToObj(form) { 1024 var els = form ? form.elements : '', map = {}, el, i = 0; 1025 while (el = els[i++]){ 1026 if (el.name != '' && !el.disabled){ // ÐлеменÑÑ Ð±ÐµÐ· имени и disabled не successful-controls 1027 switch (el.type.toLowerCase()) { 1028 case 'checkbox': 1029 case 'radio': // ТолÑко вÑбÑаннÑе (checked) checkbox'Ñ Ð¸ 1030 if (el.checked) map[el.name] = el.value; // radio-ÑлеменÑÑ ÑÑиÑаÑÑÑÑ successful-controls 1031 break; 1032 case 'select-multiple': 1033 var opt = el.options, lst = [], j = 0, o; 1034 while (o = opt[j++]) 1035 if (o.selected) // ТолÑко вÑбÑаннÑе (selected) опÑии (options) 1036 lst[lst.length] = o.value || o.text; // ÑÑиÑаÑÑÑÑ successful-controls 1037 if (lst.length) // ÐобавлÑем маÑÑÑив знаÑений опÑии еÑли он не пÑÑÑой 1038 map[el.name] = lst; 1039 break; 1040 case 'select-one': // select-one добавлÑем ÑкалÑÑом (не в маÑÑÑив) 1041 if (!el.value) break; 1042 default: 1043 map[el.name] = el.value; 1044 case 'reset': // reset не оÑпÑавлÑеÑÑÑ Ð´Ð°Ð¶Ðµ еÑли Ð¸Ð¼ÐµÐµÑ name 1045 break; 1046 } 1047 } 1048 } 1049 1050 return map; 1051} 1052 1053function priceFilter(f, v){ 1054 if(_shopLockButtons()) return false; 1055 _shopFadeControl('goods_cont'); 1056 _uPostForm('', {type:'POST', url:decodeURIComponent(document.location.href), data:{'mode':'filter', 'field':f, 'value':v}}); 1057 return false; 1058} 1059 1060 1061/** 1062 * Ðа ÑÑÑаниÑе ÑпиÑка заказов, поÑле загÑÑзки ÑÑÑаниÑÑ, 1063 * еÑли в ÑÑÑлке еÑÑÑ Ð¿Ð°ÑамеÑÑ show_invoice=ХХХХ, оÑкÑÑваем 1064 * попап Ñ Ð´Ð°Ð½Ð½Ñми заказа. 1065 * ÐÑполÑзÑеÑÑÑ Ð² виджеÑе поÑÐ»ÐµÐ´Ð½Ð¸Ñ Ð·Ð°ÐºÐ°Ð·Ð¾Ð² в новой ÐУ. 1066 */ 1067$(document).ready(function() {
1068 if (location.pathname !== '/shop/invoices') { 1069 return; 1070 } 1071 1072 var invoiceIdPair = location.search 1073 .substr(1) 1074 .split('&') 1075 .filter(function(pair) { 1076 return pair.indexOf('show_invoice=') === 0; 1077 })[0] 1078 ; 1079 1080 if (!invoiceIdPair) { 1081 return; 1082 } 1083 1084 var invoiceId = invoiceIdPair.split('=')[1]; 1085 1086 if (!invoiceId) { 1087 return; 1088 } 1089 1090 setTimeout(function() { 1091 window.invoiceShow(invoiceId); 1092 }, 100); 1093});
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.