1var js_mecrics = false; 2 3$(document).ready(function () { 4 jQuery.validator.addMethod("noSpace", function (value, element) { 5 return $.trim(value); 6 }, "No space please and don't leave it empty"); 7 $.validator.methods.email = function (value, element) { 8 return this.optional(element) || /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(value); 9 }; 10 var current_form = $("#" + current_form_id); 11 var current_form_submit = $(current_form).find('button[type=submit]'); 12 var current_form_id_fields = $("#" + current_form_id + " :input"); 13 var userPersonalData = $('#userPersonalData'); 14 var userPersonalData2 = $('#userPersonalData2'); 15 var rules = {}; 16 var messages = {}; 17 var tomorrow = new Date(); 18 tomorrow.setDate(tomorrow.getDate() + 1); 19 $('.js-datepicker').datepicker({ 20 autohide: true, 21 format: 'dd-mm-yy', 22 daysMin: ['ÐÑ', 'Ðн', 'ÐÑ', 'СÑ', 'ЧÑ', 'ÐÑ', 'Сб'], 23 monthsShort: ['ЯнваÑÑ', 'ФевÑалÑ', 'ÐаÑÑ', 'ÐпÑелÑ', 'Ðай', 'ÐÑнÑ', 'ÐÑлÑ', 'ÐвгÑÑÑ', 'СенÑÑбÑÑ', 'ÐкÑÑбÑÑ', 'ÐоÑбÑÑ', 'ÐекабÑÑ'], 24 weekStart: 1, 25 startDate: tomorrow, 26 }); 27 $(current_form_id_fields).each(function (index, el) { 28 if ($(el).attr('data-params')) { 29 var element = {}; 30 element.name = $(el).attr('name'); 31 element.params = $(el).attr('data-params').split(';'); 32 if ($(el).attr('data-required') === 'i-required') { 33 rules[element.name] = {required: true, noSpace: true}; 34 } 35 if (element.params[0] === 'email' && $(el).attr('data-required') === 'i-required') { 36 rules[element.name][element.params[0]] = true; 37 rules[element.name] = {required: true, email: true}; 38 } 39 if (element.params[0] === 'phone') { 40 $(el).mask("+7 (999) 999-99-99"); 41 42 } 43 if (element.params[0] === 'clubCart') { 44 $el = $(el); 45 val = $el.val(); 46 $.mask.definitions['Z'] = "[A-Za-z]"; 47 $.mask.definitions['Y'] = "[A-Za-z0-9]"; 48 $el.mask("ZY999999"); 49 $el.val(val); 50 } 51 if (element.params[0] === 'date') { 52 $(el).mask("99.99.9999"); 53 } 54 if (element.params[1]) { 55 messages[element.name] = element.params[1]; 56 } else { 57 messages[element.name] = 'ÐаполниÑе ÑÑо поле'; 58 } 59 } 60 }); 61 var validator = $(current_form).validate({ 62 submitHandler: function () { 63 //this.defaultShowErrors(); 64 if (checkPersData(userPersonalData, userPersonalData2)) { 65 //var formData = new FormData(); 66 var formData = {}; 67 68 $(current_form_id_fields).each(function (index, el) { 69 var trimmed_val = $(el).val(); 70 71 if (trimmed_val) { 72 trimmed_val = trimmed_val.replace(/[!\s]/g, ' '); 73 trimmed_val = trimmed_val.replace(/,/g, ' '); 74 } 75 76 if ($(el).is(':checkbox')) { 77 if (!$(el).prop('checked')) { 78 trimmed_val = ''; 79 } else { 80 trimmed_val = $(el).data('id'); 81 } 82 } 83 84 var out_row = [$(el).attr('name'), $(el).attr('data-question-id'), trimmed_val, $(el).attr('type')]; 85 86 if ($(el).attr('data-question-id') && ($(el).val() || $(el).data('id'))) { 87 if ($(el).attr('type') === 'radio') { 88 if ($(el).is(':checked')) { 89 formData[$(el).attr('name')] = out_row; 90 } 91 } 92 else if ($(el).attr('data-type') === 'DATE_TIME') { 93 var vall = $(current_form).find('select[data-type=' + $(el).attr('data-type') + ']').val(); 94 out_row[2] += ' ' + vall; 95 formData[$(el).attr('name')] = out_row; 96 } 97 else { 98 formData[$(el).attr('name')] = out_row; 99 } 100 } 101 }); 102 103 formData['BX_FORM_ID'] = current_form_bxid; 104 formData['PARAMS_ARRAY'] = 'Y'; 105 formData['smart-token'] = $(current_form).find('input[name=smart-token]').val(); 106 if (_FORM_SUBJECT !== 'N') 107 formData['_FORM_SUBJECT'] = _FORM_SUBJECT; 108 109 $.ajax({ 110 url: '/local/php_interface/include/handlers/standartFormHandler.php', 111 type: 'POST', 112 data: formData, 113 //cache: false, 114 //contentType: false, 115 //processData: false, 116 enctype: 'multipart/form-data', 117 beforeSend: function () { 118 $('#form_preloader').fadeIn('fast'); 119 $('button[type="submit"]').hide(); 120 }, 121 success: function (data) { 122 123 if (js_mecrics) { 124 if (js_mecrics.GA !== 'N' || !js_mecrics) { 125 126 // GA и ÐеÑÑика 127 if (typeof(current_form_id) !== 'undefined') { 128 129 if (current_form_id == "order-card-form") { 130 ga('send', 'event', 'main-site', 'send', 'zakaz_klubnoi_karti'); 131 yaCounter700945.reachGoal('zakaz_klubnoi_karti_main'); 132 } 133 134 135 } 136 } 137 138 //подклÑÑаем ÑÑнкÑионал поÑле оÑпÑавки ÑоÑÐ¼Ñ 139 if (typeof JSBeforeSend === "function") 140 JSBeforeSend(); 141 142 if (js_mecrics.SOLOWEI !== 'N' || !js_mecrics) { 143 //Соловей 144 (function (h) { 145 function k() { 146 var a = function (d, b) { 147 if (this instanceof AdriverCounter) d = a.items.length || 1, 148 a.items[d] = this, b.ph = d, 149 b.custom && (b.custom = a.toQueryString(b.custom, ";")), 150 a.request(a.toQueryString(b)); 151 else return a.items[d] 152 }; 153 a.httplize = function (a) { 154 return (/^\/\//.test(a) ? location.protocol : "") + a 155 }; 156 a.loadScript = function (a) { 157 try { 158 var b = g.getElementsByTagName("head")[0], 159 c = g.createElement("script"); 160 c.setAttribute("type", "text/javascript"); 161 c.setAttribute("charset", "windows-1251"); 162 c.setAttribute("src", a.split("![rnd]").join(Math.round(1E6 * Math.random()))); 163 c.onreadystatechange = function () { 164 /loaded|complete/.test(this.readyState) && (c.onload = null, b.removeChild(c)) 165 }; 166 c.onload = function () { 167 b.removeChild(c) 168 }; 169 b.insertBefore(c, b.firstChild) 170 } catch (f) { 171 } 172 }; 173 a.toQueryString = function (a, b, c) { 174 b = b || "&"; 175 c = c || "="; 176 var f = [], e; 177 for (e in a) a.hasOwnProperty(e) && f.push(e + c + escape(a[e])); 178 return f.join(b) 179 }; 180 a.request = function (d) { 181 var b = a.toQueryString(a.defaults); 182 a.loadScript(a.redirectHost + "/cgi-bin/erle.cgi?" + d + "&rnd=![rnd]" + (b ? "&" + b : "")) 183 }; 184 a.items = []; 185 a.defaults = {tail256: document.referrer || "unknown"}; 186 a.redirectHost = a.httplize("//ad.adriver.ru"); 187 return a 188 } 189 190 var g = document; 191 "undefined" === typeof AdriverCounter && (AdriverCounter = k()); 192 new AdriverCounter(0, h) 193 }) 194 ({ 195 "sid": 183532, 196 "sz": "actionlead", 197 "bt": 62,
198 "custom": {"150": "lead_id", "153": "user_id"} 199 }); 200 //ÐÐ¾Ð½ÐµÑ Ð¡Ð¾Ð»Ð¾Ð²ÑÑ 201 } 202 } 203 br_regex = /\D+/g; 204 if (typeof(current_form_bxid) !== 'undefined') { 205 var email = formData['FORM_RESULT[CLIENT_EMAIL]']; 206 if (typeof(email) === "undefined") { 207 email = ""; 208 } else { 209 email = email[2]; 210 } 211 if (parseInt(current_form_bxid) === 31) { 212 /* sendToMindbox({ 213 mobilePhone: formData['FORM_RESULT[CLIENT_NUMBER]'][2].replace(/\D+/g, ""), 214 email: email, 215 firstName: formData['FORM_RESULT[CLIENT_NAME]'][2], 216 lastName: formData['FORM_RESULT[CLIENT_SURNAME]'][2] 217 }, 'opBuyCard'); */ 218 } 219 if (parseInt(current_form_bxid) === 33) { 220 /* sendToMindbox({ 221 mobilePhone: formData['FORM_RESULT[CLIENT_NUMBER]'][2].replace(/\D+/g, ""), 222 email: email, 223 firstName: formData['FORM_RESULT[CLIENT_NAME]'][2], 224 lastName: formData['FORM_RESULT[CLIENT_SURNAME]'][2] 225 }, 'opClubTour'); */ 226 } 227 if (parseInt(current_form_bxid) === 29) { 228 if(formData['FORM_RESULT[CLIENT_NUMBER]']) { 229 /* sendToMindbox({ 230 mobilePhone: formData['FORM_RESULT[CLIENT_NUMBER]'][2].replace(/\D+/g, ""), 231 email: email, 232 firstName: formData['FORM_RESULT[CLIENT_NAME]'][2], 233 lastName: formData['FORM_RESULT[CLIENT_SURNAME]'] ? formData['FORM_RESULT[CLIENT_SURNAME]'][2] : '', 234 }, 'opFeedback'); */ 235 } 236 } 237 if (parseInt(current_form_bxid) === 83) { 238 /* sendToMindbox({ 239 mobilePhone: formData['FORM_RESULT[CLIENT_NUMBER]'][2].replace(/\D+/g, ""), 240 email: email, 241 firstName: formData['FORM_RESULT[CLIENT_NAME]'][2], 242 lastName: formData['FORM_RESULT[CLIENT_SURNAME]'][2] 243 }, 'opSpecialOffer'); */ 244 } 245 } 246 247 248 $('#form_preloader').fadeOut('fast'); 249 //console.log(data); 250 var thankYouText = $('.thankYou_block').html(); 251 $.magnificPopup.open({ 252 items: { 253 src: thankYouText, 254 type: 'inline' 255 }, 256 mainClass: 'modal' 257 }); 258 $(current_form_id_fields).not('input[type="hidden"]').val(""); 259 $('.filter-modal').on('click', '.i-button_red', function () { 260 $.magnificPopup.close(); 261 return false; 262 }) 263 $('button[type="submit"]').show(); 264 $(userPersonalData).removeAttr('checked'); 265 $(userPersonalData2).removeAttr('checked'); 266 $('#userPublication').removeAttr('checked'); 267 } 268 }); 269 } 270 }, 271 showErrors: function (errorMap, errorList) { 272 if (this.numberOfInvalids() === 0) { 273 this.defaultShowErrors(); 274 if ($(userPersonalData).is(':checked') && $(userPersonalData2).is(':checked')) { 275 $(current_form_submit).addClass('i-button_red'); 276 } else { 277 $(current_form_submit).removeClass('i-button_red'); 278 } 279 } else { 280 this.defaultShowErrors(); 281 $(current_form_submit).removeClass('i-button_red'); 282 } 283 284 }, 285 onsubmit: true, 286 debug: true, 287 errorClass: 'club_detail_form_error', 288 rules: rules, 289 messages: messages 290 }); 291 $(userPersonalData).click(function (event) { 292 validator.form(); 293 }); 294 $(userPersonalData2).click(function (event) { 295 validator.form(); 296 }); 297 $(current_form_submit).click(function (event) { 298 checkPersData(userPersonalData, userPersonalData2); 299 }); 300}); 301 302function checkPersData(userPersonalData, userPersonalData2) { 303 if ($(userPersonalData).is(':checked')) { 304 $('#userPersonalData-error').hide(); 305 } else { 306 $('#userPersonalData-error').show(); 307 } 308 309 if ($(userPersonalData2).is(':checked')) { 310 $('#userPersonalData-error').hide(); 311 } else { 312 $('#userPersonalData-error').show(); 313 } 314 315 if ($(userPersonalData).is(':checked') && $(userPersonalData2).is(':checked')) { 316 return true; 317 } else { 318 return false; 319 } 320} 321 322function contains(a, obj) { 323 var i = a.length; 324 while (i--) { 325 if (a[i] === obj) { 326 return true; 327 } 328 } 329 return false; 330} 331 332$(document).ready(function () { 333 var MEMBERSHIP_TYPES = $('#MEMBERSHIP_TYPES').text(); 334 var CURRENT_CLUB = $('select[data-question-id="CLUBS"] option:selected').text(); 335 MEMBERSHIP_TYPES = JSON.parse(MEMBERSHIP_TYPES); 336 $('select[data-question-id="CLUB_CARD_TYPE"] option').each(function () { 337 if (MEMBERSHIP_TYPES[CURRENT_CLUB] && !MEMBERSHIP_TYPES[CURRENT_CLUB][$(this).text()] == true) { 338 $(this).hide(); 339 } else { 340 $(this).show(); 341 } 342 }); 343 344 $('select[data-question-id="CLUBS"]').change(function () { 345 var MEMBERSHIP_TYPES = $('#MEMBERSHIP_TYPES').text(); 346 var CURRENT_CLUB = $(this).find("option:selected").text(); 347 MEMBERSHIP_TYPES = JSON.parse(MEMBERSHIP_TYPES); 348 $('select[data-question-id="CLUB_CARD_TYPE"] option').each(function () { 349 if (!MEMBERSHIP_TYPES[CURRENT_CLUB][$(this).text()] == true) { 350 $(this).hide(); 351 } else { 352 $(this).show(); 353 } 354 }); 355 }); 356 $('select[data-question-id="SUBJECT_MESSAGE"]').change(function () { 357 358 $('select[data-question-id="CLUBS"]').find('option').each(function () { 359 $(this).removeAttr('disabled'); 360 }); 361 362 var currentSbj = $('select[data-question-id="SUBJECT_MESSAGE"]').val(); 363 var currentSbjText = $('select[data-question-id="SUBJECT_MESSAGE"] option:selected').text(); 364 365 366 if (currentSbj == 329 || currentSbj == 269 || currentSbjText == "СÐÐ") { 367 368 var hasSpa = $('#CLUBS_HAS_SPA').text(); 369 hasSpa = JSON.parse(hasSpa); 370 371 $('select[data-question-id="CLUBS"]').find('option').each(function () { 372 var clubNAME = $(this).text(); 373 if (!contains(hasSpa, clubNAME)) { 374 $(this).attr('disabled', 'disabled'); 375 } 376 }); 377 } 378 379 380 }); 381});
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.