1 2 3function translate(string) { 4 return string; 5} 6 7function appalert(string) { 8 alert(string); 9} 10 11function apperror(error) { 12 if (error !== undefined){ 13 return error; 14 } 15 return translate("ÐÑоизоÑла оÑибка. ÐÑовеÑÑÑе Ñоединение Ñ Ð¸Ð½ÑеÑнеÑом или ÑвÑжиÑеÑÑ Ñ Ð°Ð´Ð¼Ð¸Ð½Ð¸ÑÑÑаÑией ÑайÑа."); 16} 17 18function fixHeaderHandler(){ 19 var header = $('.main-header'); 20 if (header != null) { 21 if (window.scrollY > 20) { 22 header.addClass("header__active"); 23 }else{ 24 header.removeClass("header__active"); 25 } 26 } 27} 28 29 30var check_notifications_timeout = ''; 31var check_notifications_max_time = 5000; 32var check_notifications_min_time = 2000; 33 34function checkNotifications(){ 35 $.ajax({ 36 type : 'post', 37 url : '/app-actions', 38 data : {"action": 'check_notification'}, 39 dataType : "json", 40 success: function(data){ 41 if (data.result == 'ok'){ 42 $('#notifications-container').html(data.html); 43 if (data.count > 0){ 44 $('#notifications-marker').addClass('active'); 45 }else{ 46 $('#notifications-marker').removeClass('active'); 47 } 48 check_notifications_timeout = setTimeout(function() { checkNotifications(); }, check_notifications_max_time); 49 }else{ 50 check_notifications_timeout = setTimeout(function() { checkNotifications(); }, check_notifications_min_time); 51 } 52 }, 53 error: function(data){ 54 check_notifications_timeout = setTimeout(function() { checkNotifications(); }, check_notifications_min_time); 55 } 56 }); 57} 58 59function readNotification(id, el){ 60 el.remove(); 61 reinintNotificationsContainerState(); 62 $.ajax({
63 type : 'post', 64 url : '/app-actions', 65 data : {"action": 'read_notification', 'notification_id': id}, 66 dataType : "json", 67 success: function(data){ 68 if (data.result == 'ok'){ 69 70 }else{ 71 } 72 }, 73 error: function(data){ 74 } 75 }); 76 77} 78 79function reinintNotificationsContainerState(){ 80 var count = $('.notification-item').length; 81 if (count > 0){ 82 $('#notifications-marker').addClass('active'); 83 }else{ 84 $('#notifications-marker').removeClass('active'); 85 $('#notifications-container').removeClass('active'); 86 } 87} 88 89$(document).ready(function () { 90 $(document).on('click', '.delete-work', function () { 91 if (confirm(translate('ÐÑ Ð´ÐµÐ¹ÑÑвиÑелÑно Ñ Ð¾ÑиÑе ÑдалиÑÑ ÑабоÑÑ?'))){ 92 return true; 93 } 94 return false; 95 }); 96 97 $(document).on('click', '.notification-item', function (e) { 98 e.preventDefault(); 99 var id = $(this).attr('data-id'); 100 readNotification(id, $(this)); 101 return false; 102 }); 103 104 if ($('#notifications-container').length > 0){ 105 check_notifications_timeout = setTimeout(function() { checkNotifications(); }, check_notifications_max_time); 106 } 107 108 $(document).on('click', '.send-new-sms-code', function () { 109 var loaderContainer = $(this).closest('.loader-container'); 110 loaderContainer.addClass('loading'); 111 var t = $(this); 112 var action = t.data('action'); 113 var params = t.data('params'); 114 $.ajax({
115 type : 'post', 116 url : '/app-actions', 117 data : {"action" : 'new_sms_code', "codeAction": action, 'params': params}, 118 dataType : "json", 119 success: function(data){ 120 if (data.result == 'ok'){ 121 appalert(translate('ÐовÑй код ÑÑпеÑно оÑпÑавлен!')) 122 }else{ 123 appalert(apperror(data.error)); 124 } 125 loaderContainer.removeClass('loading'); 126 }, 127 error: function(data){ 128 apperror(); 129 loaderContainer.removeClass('loading'); 130 } 131 }); 132 133 }); 134 135 136 $(document).on('submit', '#header-login-form', function (e) { 137 e.preventDefault(); 138 var loaderContainer = $(this).find('.loader-container'); 139 loaderContainer.addClass('loading'); 140 var data = $(this).serialize(); 141 $.ajax({ 142 type : 'post', 143 url : '/login', 144 data : {'data': data}, 145 dataType : "json", 146 success: function(data){ 147 if (data.result == 'ok'){ 148 $('#header').html(data.html); 149 $('#loginModal').modal('toggle'); 150 }else{ 151 $('#user-login-form-wrap').html(data.html); 152 } 153 loaderContainer.removeClass('loading'); 154 }, 155 error: function(data){ 156 apperror(); 157 loaderContainer.removeClass('loading'); 158 } 159 }); 160 return false; 161 }); 162 163 $(document).on('click', '.page-header__user-block', function (e) { 164 $(this).toggleClass("active"); 165 }); 166 167 $(document).on('click', '.page-header__icon--notification', function (e) { 168 $('.page-header__dropdown').toggleClass("active"); 169 }); 170 171 $(document).on('click', '.header__toggle', function (e) { 172 $(this).toggleClass("menu__open"); 173 }); 174 175 $('select.work-select').selectize({ 176 sortfield: 'text', 177 create:function (input){ 178 var text = ''; 179 if (!input){ 180 text = input; 181 }else{ 182 text = input[0].toUpperCase() + input.slice(1); 183 } 184 return {value:text, text: text}; 185 }, 186 render: { 187 option_create: function(data, escape) { 188 return '<div class="create">СоздаÑÑ <strong>' + escape(data.input) + '</strong>…</div>'; 189 } 190 }, 191 }); 192 193 $('select.work-search-select').selectize({ 194 }); 195 196 $(document).on('click', '.icon-button--search', function () { 197 $('.search').addClass('active'); 198 }); 199 200 $(document).mouseup(function (e){ 201 var selector = $(".search"); 202 if (!selector.is(e.target) && selector.has(e.target).length === 0) { 203 selector.removeClass('active'); 204 } 205 206 selector = $(".page-header__icon--notification"); 207 if (!selector.is(e.target) && selector.has(e.target).length === 0) { 208 $('.page-header__dropdown').removeClass("active"); 209 } 210 211 selector = $(".page-header__user-block"); 212 if (!selector.is(e.target) && selector.has(e.target).length === 0) { 213 selector.removeClass('active'); 214 } 215 }); 216 217 $(window).on('scroll', function () { 218 fixHeaderHandler(); 219 }); 220 221 $(document).on('change', '.work-search-select', function () { 222 var url = work_search_url(); 223 location.href = url; 224 return true; 225 }); 226 227 $(document).on('submit', '.main-work-search-form', function (e) { 228 e.preventDefault(); 229 var url = work_search_url(); 230 location.href = url; 231 return false; 232 }); 233 234 $(document).on('change', '.select-payment-method', function () { 235 var val = $(this).val(); 236 var id = '#payment-method-' + val; 237 $('#payment-account-data').html($(id).html()); 238 initPaymentFormValidation(parseInt(val)); 239 });
240 241}); 242 243function initPaymentFormValidation(method_id){ 244 jQuery('#payment-method-form').yiiActiveForm('destroy'); 245 switch (method_id) { 246 case 1: 247 initYandex(); 248 break; 249 case 2: 250 initQiwi(); 251 break; 252 case 3: 253 initCard(); 254 break; 255 case 4: 256 initCardOther(); 257 break; 258 default: 259 initYandex(); 260 break; 261 } 262} 263 264function initQiwi() { 265 jQuery('#payment-method-form').yiiActiveForm([{"id":"paymentaccount-method_id","name":"method_id","container":".field-paymentaccount-method_id","input":"#paymentaccount-method_id","validate":function (attribute, value, messages, deferred, $form) {yii.validation.number(value, messages, {"pattern":/^\s*[+-]?\d+\s*$/,"message":"ÐнаÑение «СпоÑоб оплаÑÑ» должно бÑÑÑ ÑелÑм ÑиÑлом.","skipOnEmpty":1});yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«Ð¡Ð¿Ð¾Ñоб оплаÑÑ»."});}},{"id":"paymentaccount-account","name":"account","container":".field-payment-method-info-2","input":"#payment-method-info-2","validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«Account»."});yii.validation.string(value, messages, {"message":"ÐнаÑение «Account» должно бÑÑÑ ÑÑÑокой.","skipOnEmpty":1});}}], []); 266} 267 268function initYandex() { 269 jQuery('#payment-method-form').yiiActiveForm([{"id":"paymentaccount-method_id","name":"method_id","container":".field-paymentaccount-method_id","input":"#paymentaccount-method_id","validate":function (attribute, value, messages, deferred, $form) {yii.validation.number(value, messages, {"pattern":/^\s*[+-]?\d+\s*$/,"message":"ÐнаÑение «СпоÑоб оплаÑÑ» должно бÑÑÑ ÑелÑм ÑиÑлом.","skipOnEmpty":1});yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«Ð¡Ð¿Ð¾Ñоб оплаÑÑ»."});}},{"id":"paymentaccount-account","name":"account","container":".field-payment-method-info-1","input":"#payment-method-info-1","validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«Account»."});yii.validation.string(value, messages, {"message":"ÐнаÑение «Account» должно бÑÑÑ ÑÑÑокой.","skipOnEmpty":1});}}], []); 270} 271 272function initCard() { 273 jQuery('#payment-method-form').yiiActiveForm([{"id":"paymentaccount-method_id","name":"method_id","container":".field-paymentaccount-method_id","input":"#paymentaccount-method_id","validate":function (attribute, value, messages, deferred, $form) {yii.validation.number(value, messages, {"pattern":/^\s*[+-]?\d+\s*$/,"message":"ÐнаÑение «СпоÑоб оплаÑÑ» должно бÑÑÑ ÑелÑм ÑиÑлом.","skipOnEmpty":1});yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«Ð¡Ð¿Ð¾Ñоб оплаÑÑ»."});}},{"id":"cardinfo-number","name":"number","container":".field-payment-method-info-3","input":"#payment-method-info-3","validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«ÐÐ¾Ð¼ÐµÑ ÐºÐ°ÑÑÑ»."});yii.validation.string(value, messages, {"message":"ÐнаÑение «ÐÐ¾Ð¼ÐµÑ ÐºÐ°ÑÑÑ» должно бÑÑÑ ÑÑÑокой.","min":16,"tooShort":"ÐнаÑение «ÐÐ¾Ð¼ÐµÑ ÐºÐ°ÑÑÑ» должно ÑодеÑжаÑÑ Ð¼Ð¸Ð½Ð¸Ð¼Ñм 16 Ñимвола.","max":16,"tooLong":"ÐнаÑение «ÐÐ¾Ð¼ÐµÑ ÐºÐ°ÑÑÑ» должно ÑодеÑжаÑÑ Ð¼Ð°ÐºÑимÑм 16 Ñимвола.","skipOnEmpty":1});yii.validation.number(value, messages, {"pattern":/^\s*[+-]?\d+\s*$/,"message":"ÐнаÑение «ÐÐ¾Ð¼ÐµÑ ÐºÐ°ÑÑÑ» должно ÑодеÑжаÑÑ ÑолÑко ÑиÑÑÑ.","skipOnEmpty":1});}},{"id":"cardinfo-month","name":"month","container":".field-cardinfo-month","input":"#cardinfo-month","validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«ÐеÑÑÑ»."});yii.validation.number(value, messages, {"pattern":/^\s*[+-]?\d+\s*$/,"message":"ÐнаÑение «ÐеÑÑÑ» должно бÑÑÑ ÑелÑм ÑиÑлом.","min":1,"tooSmall":"ÐнаÑение «ÐеÑÑÑ» должно бÑÑÑ Ð½Ðµ менÑÑе 1.","max":12,"tooBig":"ÐнаÑение «ÐеÑÑÑ» не должно пÑевÑÑаÑÑ 12.","skipOnEmpty":1});}},{"id":"cardinfo-year","name":"year","container":".field-cardinfo-year","input":"#cardinfo-year","validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«Ðод»."});yii.validation.number(value, messages, {"pattern":/^\s*[+-]?\d+\s*$/,"message":"ÐнаÑение «Ðод» должно бÑÑÑ ÑелÑм ÑиÑлом.","min":2020,"tooSmall":"ÐнаÑение «Ðод» должно бÑÑÑ Ð½Ðµ менÑÑе 2020.","max":2030,"tooBig":"ÐнаÑение «Ðод» не должно пÑевÑÑаÑÑ 2030.","skipOnEmpty":1});}}], []); 274} 275 276function initCardOther() { 277 console.log('other'); 278 jQuery('#payment-method-form').yiiActiveForm([{"id":"paymentaccount-method_id","name":"method_id","container":".field-paymentaccount-method_id","input":"#paymentaccount-method_id","validate":function (attribute, value, messages, deferred, $form) {yii.validation.number(value, messages, {"pattern":/^\s*[+-]?\d+\s*$/,"message":"ÐнаÑение «СпоÑоб оплаÑÑ» должно бÑÑÑ ÑелÑм ÑиÑлом.","skipOnEmpty":1});yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«Ð¡Ð¿Ð¾Ñоб оплаÑÑ»."});}},{"id":"cardinfoother-number","name":"number","container":".field-payment-method-info-4","input":"#payment-method-info-4","validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«ÐÐ¾Ð¼ÐµÑ ÐºÐ°ÑÑÑ»."});yii.validation.string(value, messages, {"message":"ÐнаÑение «ÐÐ¾Ð¼ÐµÑ ÐºÐ°ÑÑÑ» должно бÑÑÑ ÑÑÑокой.","min":16,"tooShort":"ÐнаÑение «ÐÐ¾Ð¼ÐµÑ ÐºÐ°ÑÑÑ» должно ÑодеÑжаÑÑ Ð¼Ð¸Ð½Ð¸Ð¼Ñм 16 Ñимвола.","max":16,"tooLong":"ÐнаÑение «ÐÐ¾Ð¼ÐµÑ ÐºÐ°ÑÑÑ» должно ÑодеÑжаÑÑ Ð¼Ð°ÐºÑимÑм 16 Ñимвола.","skipOnEmpty":1});yii.validation.number(value, messages, {"pattern":/^\s*[+-]?\d+\s*$/,"message":"ÐнаÑение «ÐÐ¾Ð¼ÐµÑ ÐºÐ°ÑÑÑ» должно ÑодеÑжаÑÑ ÑолÑко ÑиÑÑÑ.","skipOnEmpty":1});}},{"id":"cardinfoother-month","name":"month","container":".field-cardinfoother-month","input":"#cardinfoother-month","validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«ÐеÑÑÑ»."});yii.validation.number(value, messages, {"pattern":/^\s*[+-]?\d+\s*$/,"message":"ÐнаÑение «ÐеÑÑÑ» должно бÑÑÑ ÑелÑм ÑиÑлом.","min":1,"tooSmall":"ÐнаÑение «ÐеÑÑÑ» должно бÑÑÑ Ð½Ðµ менÑÑе 1.","max":12,"tooBig":"ÐнаÑение «ÐеÑÑÑ» не должно пÑевÑÑаÑÑ 12.","skipOnEmpty":1});}},{"id":"cardinfoother-year","name":"year","container":".field-cardinfoother-year","input":"#cardinfoother-year","validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«Ðод»."});yii.validation.number(value, messages, {"pattern":/^\s*[+-]?\d+\s*$/,"message":"ÐнаÑение «Ðод» должно бÑÑÑ ÑелÑм ÑиÑлом.","min":2020,"tooSmall":"ÐнаÑение «Ðод» должно бÑÑÑ Ð½Ðµ менÑÑе 2020.","max":2030,"tooBig":"ÐнаÑение «Ðод» не должно пÑевÑÑаÑÑ 2030.","skipOnEmpty":1});}},{"id":"cardinfoother-fio","name":"fio","container":".field-payment-method-info-4","input":"#payment-method-info-4","validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«Ð¤Ðл."});}},{"id":"cardinfoother-country","name":"country","container":".field-cardinfoother-country","input":"#cardinfoother-country","validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«Ð¡ÑÑана»."});}},{"id":"cardinfoother-city","name":"city","container":".field-cardinfoother-city","input":"#cardinfoother-city","validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«ÐоÑод»."});}},{"id":"cardinfoother-zip","name":"zip","container":".field-cardinfoother-zip","input":"#cardinfoother-zip","validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«ÐоÑÑовÑй индекÑ»."});}},{"id":"cardinfoother-address","name":"address","container":".field-cardinfoother-address","input":"#cardinfoother-address","validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ Â«ÐдÑеÑ»."});}}], []); 279} 280 281 282function work_search_url(){ 283 var url = $('#work-search-container').data('baseurl'); 284 285 var values =[]; 286 $('.work-search-select').each(function () { 287 if ($(this).val() != ''){ 288 values[$(this).data('searchorder')] = $(this).val(); 289 } 290 });
291 292 if (values.length > 0){ 293 for (var i = 0; i < values.length; i++){ 294 if (values[i] != undefined){ 295 url += '/' + values[i]; 296 } 297 } 298 } 299 300 if ($('#worksearch-text').val() != ''){ 301 url += '?WorkSearch[text]=' + $('#worksearch-text').val(); 302 } 303 return url; 304}
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.