1(function (window) { 2 'use strict' 3 4 if (window.PWDSubscribe) 5 return; 6 7 window.PWDSubscribe = function (params) { 8 this.email = '' 9 this.agree = 'Y' 10 this.loading = false 11 12 this.visual = {} 13 this.errorCode = 1; 14 15 this.obEmailInput = null; 16 this.obSubmitButton = null; 17 18 this.errorBlock = $('.popup-subscribe .error-tooltip'); 19 20 if (typeof params === 'object') { 21 this.errorCode = 0; 22 } 23 24 if (this.errorCode === 0) { 25 this.email = params.email 26 this.visual = params.visual 27 28 BX.ready(BX.proxy(this.init, this)) 29 } 30 } 31 32 window.PWDSubscribe.prototype = { 33 init: function () { 34 this.obEmailInput = BX(this.visual.EMAIL_INPUT) 35 this.obEmailInput && BX.bind(this.obEmailInput, 'input', BX.proxy(this.setEmail, this)) 36 37 this.obSubmitButton = BX(this.visual.SUBMIT_BUTTON) 38 this.obSubmitButton && BX.bind(this.obSubmitButton, 'click', BX.proxy(this.submit, this)) 39 }, 40 41 setEmail: function (event) { 42 this.email = event.target.value 43 this.errorBlock.addClass('d-none') 44 }, 45 46 setLoading: function (value) { 47 this.loading = value 48 }, 49 50 submit: function () { 51 if (this.loading === true) return 52 53 let formData = new FormData() 54 55 this.errorBlock.addClass('d-none') 56 57 formData.set('sessid', BX.bitrix_sessid()) 58 formData.set('agree', this.agree) 59 formData.set('email', this.email) 60 61 62 BX.ajax.runAction('powderlife:core.subscribe.addemail', { 63 data: formData 64 }).then(response => { 65 popupsClose() 66 67 popupOpenMessage('СпаÑибо за заÑвкÑ!<br> ÐодпиÑка ÑÑпеÑно оÑоÑмлена') 68 69 setTimeout(function () { 70 popupsClose() 71 }, 3000) 72 73 this.setLoading(false) 74 75 }, response => { 76 let errors = response.errors 77 78 this.errorBlock.removeClass('d-none') 79 this.errorBlock.html(errors[0].message) 80 81 this.setLoading(false) 82 }) 83 84 } 85 } 86})(window)
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.