1var VOTE_MESSAGES= []; 2VOTE_MESSAGES["kandidats.1"]="Ðнимание! ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ вÑбÑаÑÑ"; 3//VOTE_MESSAGES["kandidats.2"]="кандидаÑов"; 4// todo kandidat-variant 5VOTE_MESSAGES["kandidats.2"]="ваÑианÑов"; 6VOTE_MESSAGES["error.tail"]="ÐÑобнÑÑ ÑаÑÑÑ Ð¼Ð¾Ð¶Ð½Ð¾ ÑолÑко за одного кандидаÑа, в ÑоÑмаÑе 1/2 ÐапÑимеÑ: 1 1/2"; 7VOTE_MESSAGES["error.badValue"]="ÐепÑавилÑно введено знаÑение. ТолÑко ÑиÑÑÑ Ð¸ знак \"/\""; 8VOTE_MESSAGES["error.question"]="СÑммаÑное ÑиÑло голоÑов пÑевÑÑÐ°ÐµÑ Ð´Ð¾Ð¿ÑÑÑимое знаÑение"; 9VOTE_MESSAGES["error.fileSize"]="ÐÑевÑÑен макÑималÑнÑй ÑÐ°Ð·Ð¼ÐµÑ Ñайла"; 10VOTE_MESSAGES["error.emptyQuestions"]="ÐÑÑалиÑÑ Ð²Ð¾Ð¿ÑоÑÑ Ð¿Ð¾Ð²ÐµÑÑки днÑ, по коÑоÑÑм ÐÑ Ð½Ðµ голоÑовали"; 11VOTE_MESSAGES["error.questionMax"]="ÐÑевÑÑено макÑималÑное колиÑеÑÑво голоÑов"; 12VOTE_MESSAGES["warning.complex"]="ÐÑÑалиÑÑ Ð½ÐµÑаÑпÑеделеннÑе голоÑа"; 13VOTE_MESSAGES["error.person"]="ÐÑевÑÑено колиÑеÑÑво вÑбÑаннÑÑ ÐºÐ°Ð½Ð´Ð¸Ð´Ð°Ñов"; 14VOTE_MESSAGES["error.emptyPerson"]="ÐÑÑалиÑÑ ÐºÐ°Ð½Ð´Ð¸Ð´Ð°ÑÑ, по коÑоÑÑм ÐÑ Ð½Ðµ голоÑовали"; 15VOTE_MESSAGES["opinion"]="ÐÑÑавиÑÑ Ð¾Ñобое мнение"; 16VOTE_MESSAGES["opinion.placeholder"]="ÐапиÑаÑÑ Ð¾Ñобое мнение"; 17 18 19(function ($, window, document) { 20 'use strict'; 21 22 var pluginName = "VTB", 23 defaults = { 24 voteRegExp: /^[\d\/\s]+$/g 25// ,voteErrFraction: 'ÐÑобнÑÑ ÑаÑÑÑ Ð¼Ð¾Ð¶Ð½Ð¾ ÑолÑко за одного кандидаÑа, в ÑоÑмаÑе 1/2 ÐапÑимеÑ: 1 1/2' 26// ,voteErrField: 'ÐепÑавилÑно введено знаÑение. ТолÑко ÑиÑÑÑ Ð¸ знак "/"' 27// ,voteErrTotal: 'СÑммаÑное ÑиÑло голоÑов пÑевÑÑÐ°ÐµÑ Ð´Ð¾Ð¿ÑÑÑимое знаÑение' 28 }; 29 30 // The plugin constructor 31 function Plugin(element, options) { 32 var that = this; 33 that.element = $(element); 34 that.options = $.extend({}, defaults, options); 35 36 that.init(); 37 that.groupBtns(); 38 that.voteCalc(); 39 } 40 41 Plugin.prototype = { 42 init: function () { 43 this.body = $(document.body); 44 this.fieldset = $('.fieldset'); 45 this.formGroup = this.fieldset.find('.form-group'); 46 this.$voteValidation = $('.vote-validation'); 47 this.$voteControl = $('.vote-control'); 48 this.$btnReset = $('.btn-reset'); 49 this.$btnEqually = $('.btn-equally'); 50 }, 51 52 groupBtns: function() { 53 var instance = this; 54 55 instance.formGroup.on('click', '.form-element', function(e) { 56 e.preventDefault(); 57 58 var self = $(this), 59 fields = self.closest('.fieldset').find('fieldset'); 60 /*ksv start*/ 61 var pe = self.parent().find('.proElement'); 62 var ce = self.parent().find('.contraElement'); 63 var ne = self.parent().find('.noneElement'); 64 pe.val(''); 65 ce.val(''); 66 ne.val(''); 67 var qt = self.parent().parent().find('.qty').val(); 68 if(!qt ) 69 qt = self.parent().parent().parent().find('.qty').val(); 70 var bOn = false; 71 /*ksv end*/ 72 73 if (self.find('.btn').hasClass('btn-active')){ 74 self.find('.btn') 75 .removeClass('btn-active btn-disabled'); 76 self.siblings().find('.btn') 77 .removeClass('btn-active btn-disabled'); 78 } else { 79 self.find('.btn') 80 .removeClass('btn-disabled'); 81 self.find('.btn') 82 .addClass('btn-active'); 83 self.siblings().find('.btn') 84 .removeClass('btn-active btn-disabled') 85 .addClass('btn-disabled'); 86 /*ksv start*/ 87 if(self.find('.btn').hasClass('btn-default-success')) 88 pe.val(qt); 89 else if(self.find('.btn').hasClass('btn-default-danger')) 90 ce.val(qt); 91 else if(self.find('.btn').hasClass('btn-default-warning')) 92 ne.val(qt); 93 bOn = true; 94 /*ksv end*/ 95 } 96 97 if (bOn && self.find('.btn').hasClass('btn-restrict')){ 98 fields.attr('disabled', 'disabled'); 99 100 instance.$btnReset.trigger('click'); 101 } else { 102 fields.removeAttr('disabled'); 103 } 104 }); 105 }, 106 107 voteCalc: function() { 108 var instance = this, 109 regEx = instance.options.voteRegExp; 110 var $allVotes = $('.all-votes'); 111 112 instance.$voteControl.on('input', function() { 113 var self = $(this); 114 self.closest('.fieldset').find(':radio').removeAttr('checked'); 115 }); 116 117 instance.$voteControl.on('blur', function() { 118 var self = $(this), 119 value = $.trim(self.val()), 120 splitter, 121 part1, 122 part2, 123 divider, 124 votSum = 0, 125 dividerEl; 126 127 if (value.match(regEx)) { 128 splitter = value.split(' '); 129
130 dividerEl = splitter.filter(function(i) { 131 return i.indexOf('/') > 0; 132 }); 133 part1 = splitter.filter(function(i) { 134 return i.indexOf('/') < 0; 135 }); 136 137 part2 = (dividerEl.length > 0) ? dividerEl[0] : ''; 138 divider = part2.split('/'); 139 140 instance.voteResetErrors(self); 141 142 if (divider.length > 1) { 143 if (divider[1].length === 0){ 144 instance.voteErrorField(self, VOTE_MESSAGES["error.badValue"]); 145 } else { 146 var fractionValue = +part1 + divider[0] / divider[1]; 147 self.addClass('fraction-control').attr('data-value', fractionValue); 148 } 149 } else { 150 self.removeClass('fraction-control').removeAttr('data-value'); 151 } 152 /* start ksv нажаÑÑ ÐºÐ½Ð¾Ð¿Ð¾ÑÐºÑ ÐÐ , еÑли она не нажаÑа*/ 153 var proBtn = self.closest('fieldset').parent().siblings().find('.btn-default-success'); 154 if (!proBtn.hasClass('btn-active')){ 155 proBtn.trigger("click"); 156 } 157 /* end ksv*/ 158 } else if (value.length > 0) { 159 setTimeout(function() { 160 instance.voteErrorField(self, VOTE_MESSAGES["error.badValue"]); 161 }, 0); 162 } 163 164 if ($('.fraction-control').length > 1) { 165 setTimeout(function() { 166 instance.voteErrorField(self, VOTE_MESSAGES["error.tail"]); 167 }, 0); 168 } 169 var voteControl = self.closest('.fieldset').find('.vote-control'); 170 171 voteControl.each(function() { 172 var iter = $(this), 173 iterVal = iter.val(); 174 175 if (iter.hasClass('fraction-control')){ 176 iterVal = +iter.data('value'); 177 } 178 179 if (iterVal !== 0){ 180 votSum += +iterVal; 181 } 182 }); 183 var vTotal = 0; 184 var sTotal = self.closest('.fieldset').find('.vote-total').text().split(' ')[0]; 185 if(sTotal) 186 vTotal = parseInt(sTotal, 10); 187 188 if (Math.floor(votSum) > vTotal) { 189 instance.voteErrorField(self, VOTE_MESSAGES["error.question"]); 190 } else { 191 instance.voteResetErrors(); 192 } 193 }); 194 195 instance.$btnEqually.on('click', function(e) { 196 e.preventDefault(); 197 // 198 var self = $(this); 199 var vTotal = 0; 200 var sTotal = self.closest('.fieldset').find('.vote-total').text().split(' ')[0]; 201 if(sTotal) 202 vTotal = parseInt(sTotal, 10); 203 204 205 206 var voteControl = self.closest('.fieldset').find('.vote-control'); 207 var voteControlLength = voteControl.length; 208 var partial = Math.floor(vTotal / voteControlLength); 209 210 voteControl.val(partial).removeClass('fraction-control').removeAttr('data-value'); 211 self.closest('.fieldset').find(':radio').removeAttr('checked'); 212 instance.voteResetErrors(); 213 /* start ksv нажаÑÑ ÐºÐ½Ð¾Ð¿Ð¾ÑÐºÑ ÐÐ , еÑли она не нажаÑа*/ 214 var proBtn = self.closest('fieldset').parent().siblings().find('.btn-default-success'); 215 if (!proBtn.hasClass('btn-active')){ 216 proBtn.trigger("click"); 217 } 218 /* end ksv*/ 219 }); 220 221 instance.$btnReset.on('click', function(e) { 222 e.preventDefault(); 223 var self = $(this); 224 225 var voteControl = self.closest('.fieldset').find('.vote-control'); 226 227 voteControl.val('').removeClass('fraction-control').removeAttr('data-value'); 228 229 self.closest('.fieldset').find(':radio').removeAttr('checked'); 230 instance.voteResetErrors(); 231 /* start ksv оÑжаÑÑ ÐºÐ½Ð¾Ð¿Ð¾ÑÐºÑ ÐÐ , еÑли она нажаÑа - ÑоÑÑв ÑиÑÑа*/ 232 var proBtn = self.closest('fieldset').parent().siblings().find('.btn-default-success'); 233 if (!self.closest('fieldset').attr('disabled') && proBtn.hasClass('btn-active')){ 234 proBtn.trigger("click"); 235 } 236 /* end ksv*/ 237 }); 238 239 $allVotes.on('click', function() { 240 var self = $(this), 241 row = self.closest('tr'), 242 $rowControl = row.find('.vote-control'); 243 244 if (self.closest('fieldset').attr('disabled')){ 245 return false; 246 } 247 var voteControl = self.closest('.fieldset').find('.vote-control'); 248 249 voteControl.val('').removeClass('fraction-control').removeAttr('data-value'); 250 var vTotalValue = 0; 251 var sTotal = self.closest('.fieldset').find('.vote-total').text(); 252 if(sTotal) 253 vTotalValue = sTotal; 254 255 $rowControl.val(vTotalValue); 256 instance.voteResetErrors(); 257 /* start ksv нажаÑÑ ÐºÐ½Ð¾Ð¿Ð¾ÑÐºÑ ÐÐ , еÑли она не нажаÑа*/ 258 var proBtn = self.closest('fieldset').parent().siblings().find('.btn-default-success'); 259 if (!proBtn.hasClass('btn-active')){ 260 proBtn.trigger("click"); 261 } 262 /* end ksv*/ 263 }); 264 }, 265 266 voteErrorField: function(el, msg){ 267 var instance = this; 268 269 if (el) { 270 el.parent().addClass('has-error'); 271 } 272 instance.$voteValidation.html(msg).show(); 273 }, 274 275 voteResetErrors: function(el) { 276 var instance = this; 277 278 if (el) { 279 el.parent().removeClass('has-error'); 280 } else { 281 var self = $(this); 282 var voteControl = self.closest('.fieldset').find('.vote-control'); 283 voteControl.parent().removeClass('has-error'); 284 285 286 } 287 instance.$voteValidation.hide(); 288 } 289 }; 290 291 $.fn[pluginName] = function (options) { 292 return this.each(function () { 293 if (!$.data(this, "plugin_" + pluginName)) { 294 $.data(this, "plugin_" + pluginName, 295 new Plugin(this, options)); 296 } 297 }); 298 }; 299})(jQuery, window, document); 300 301$(document).ready(function() { 302 $('body').VTB(); 303}); 304/* NEW 10/08/2016 */ 305$(function () { 306 $('[data-toggle="tooltip"]').tooltip(); 307 $(window).scroll(function() 308 { 309 //ÑкÑÑваем/показÑваем ÑÑÑÐµÐ»ÐºÑ Ð²Ð½Ð¸Ð· пÑи ÑкÑолле и не показÑваем ÑÑÑÐµÐ»ÐºÑ Ð²Ð½Ð¸ÑÐ·Ñ ÑкÑана 310 if($(this).scrollTop() != 0 && ($(this).scrollTop() <= $(d
310ocument).height() - $(this).height() -100)) 311 { 312 $("#toBottom").fadeIn() 313 } 314 else 315 { 316 $("#toBottom").fadeOut() 317 } 318 if($(this).scrollTop() != 0 && ($(this).scrollTop() >= $(this).height() - 100)) 319 { 320 $("#toTop").fadeIn() 321 } 322 else 323 { 324 $("#toTop").fadeOut() 325 } 326 }); 327 //пеÑемаÑÑваем вниз пÑи клике на ÑÑÑÐµÐ»ÐºÑ 328 $(document).on("click", "#toBottom", function() 329 { 330 $("body,html").animate({scrollTop: $(document).outerHeight(true)}, 800); 331 }); 332 //пеÑемаÑÑваем ввеÑÑ Ð¿Ñи клике на ÑÑÑÐµÐ»ÐºÑ 333 $(document).on("click", "#toTop", function() 334 { 335 $("body,html").animate({scrollTop: 0}, 800); 336 }); 337 338 //менÑем placeholder пÑи акÑиваÑии textarea 339 $(document).on("click", ".pencil-wrapper", function() 340 { 341 var clf = $(this).closest(".fieldset").find(".form-clarification"); 342 clf.toggleClass("show"); 343 if(clf.hasClass("show")) 344 clf.find(".form-control").focus(); 345 }); 346 $(document).on("click", ".form-clarification .form-control", function() 347 { 348 if($(".form-clarification").not(".active")){ 349 $(".form-clarification").addClass("active"); 350 $(this).attr("placeholder", VOTE_MESSAGES["opinion.placeholder"]); 351 } 352 }); 353 // изÑÑÐºÐ°Ð½Ð¸Ñ 354 $(".form-clarification input").on("input", function(){ 355 console.log("form-clarification input input"); 356 }); 357 // Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ ÐºÐ°ÑандаÑа пÑи пÑавке ÑекÑÑового оÑобого Ð¼Ð½ÐµÐ½Ð¸Ñ 358 $(".form-clarification textarea").on("change", function(){ 359 console.log("form-clarification textarea change start"); 360 var input = $(this); 361 var form = $(this).closest(".form-clarification"); 362 if(input.val()){ 363 if(!form.hasClass("file-added")) 364 form.addClass("file-disabled"); 365 form.find(".form-upload-label").attr("for", ""); 366 form.closest(".fieldset").find(".pencil-wrapper").addClass("complete"); 367 }else { 368 form.removeClass("file-disabled"); 369 if(!form.find(".opinionFileName").val()){ 370 form.find(".form-upload-label").removeAttr("for"); 371 form.closest(".fieldset").find(".pencil-wrapper").removeClass("complete"); 372 } 373 } 374 375 console.log("form-clarification textarea change end"); 376 }); 377 378 //менÑем placeholder пÑи клике, добавлÑем клаÑÑ active 379 $(document).click(function(event) 380 { 381 if($(event.target).closest(".form-clarification.active").length) 382 return; 383 $(".form-clarification.active").removeClass("active"); 384 $(".form-clarification .form-control").attr("placeholder", VOTE_MESSAGES["opinion"]); 385 event.stopPropagation(); 386 }); 387 388 //добавлÑем Ð¸Ð¼Ñ Ð¿ÑикÑеплленного Ñайла 389 $(".form-clarification input").on("change", function(){ 390 console.log("form-clarification input change start"); 391 var input = $(this); 392 var files = input.get(0).files; 393 if(!files || files.length == 0) 394 return; 395 var form = $(this).closest(".form-clarification"); 396 var file = files[0]; 397 input.replaceWith(input.val('').clone(true)); 398 var ms = input.attr("data-max-size"); 399 if(ms && parseInt(ms) < file.size){ 400 alert(VOTE_MESSAGES["error.fileSize"]+" "+ms); 401 return; 402 } 403 404 var reader = new FileReader(); 405 reader.onload = function (e) { 406 if(!e.target.result) 407 return; 408 var re = /data:([^,]*);base64,(.*)/gmi; 409 var mm = re.exec(e.target.result); 410 if(mm){ 411 form.find(".opinionFileBody").val(mm[2]); 412 } 413 }; 414 reader.readAsDataURL(file); 415 416 417 //form.find("textarea").attr("readonly", "true"); 418 form.find(".form-upload-label-file-name").text(file.name); 419 form.find(".form-upload-label-text").hide(); 420 form.find(".opinionFileName").val(file.name); 421 422 form.addClass("file-added"); 423 form.find(".form-upload-label").attr("for", ""); 424 form.closest(".fieldset").find(".pencil-wrapper").addClass("complete"); 425 426 console.log("form-clarification input change end"); 427 428 });
429 $(document).on("click", ".form-clarification-file--del", function(event) 430 { 431 console.log("form-clarification-file--del.click start"); 432 event.stopPropagation(); 433 event.cancelBubble = true; 434 var form = $(this).closest(".form-clarification"); 435 form.find(".form-upload-label-file-name").text(""); 436 form.find(".opinionFileBody").val(""); 437 form.find(".opinionFileName").val(""); 438 //form.find("textarea").removeAttr("readonly"); 439 440 //form.find(".form-upload-label-text").show(); 441 form.removeClass("file-added"); 442 if(!form.find(".form-control").val()) 443 form.closest(".fieldset").find(".pencil-wrapper").removeClass("complete"); 444 setTimeout(function(){ console.log("removeAttr(for)"); form.find(".form-upload-label").removeAttr("for");}, 10); 445 console.log("form-clarification-file--del.click end"); 446 }); 447 448 //показÑваем поле пеÑеÑаÑкивание Ñайла пÑи наведении на него 449 $(".form-clarification").on("dragover", function(e) { 450 console.log("dragover"); 451 $(this).addClass("hover"); 452 console.log($(e.target).parent()); 453 }); 454 $("input.form-upload").on("dragleave", function(e) { 455 console.log("dragleave"); 456 $(".form-clarification").removeClass("hover"); 457 }); 458 459 $(".form-clarification").on("change", function(e) { 460 console.log("change!"); 461 $(".form-clarification").removeClass("hover"); 462 }); 463 464 //показÑваем ÑÑлÑип в ÑоÑме подÑвеÑÐ¶Ð´ÐµÐ½Ð¸Ñ 465 resize_window(); 466 $(window).on("resize", function () 467 { 468 resize_window(); 469 }); 470 function resize_window() 471 { 472 try { 473 if(window.innerWidth > 1400){ 474 $(".pencil-wrapper").tooltip("enable"); 475 } 476 else 477 { 478 $(".pencil-wrapper").tooltip("disable"); 479 } 480 } catch (err) { 481 console.error(err); 482 } 483 } 484}); 485 486function butDisable(){ 487 if($('#butReg').hasClass('disabled')) { 488 $('#butReg').removeClass('disabled'); 489 $('#butReg').addClass('active'); 490 } else { 491 $('#butReg').addClass('disabled'); 492 $('#butReg').addClass('disabled'); 493 $('#butReg').removeClass('active'); 494 } 495}; 496 497/*NEW 07/03/2017 */ 498$(document).ready(function() { 499 $('.collapse').on('shown.bs.collapse', function(){ 500 $(this).parent().find(".fa-angle-down").removeClass("fa-angle-down").addClass("fa-angle-up"); 501 }).on('hidden.bs.collapse', function(){ 502 $(this).parent().find(".fa-angle-up").removeClass("fa-angle-up").addClass("fa-angle-down"); 503 }); 504}); 505$('.myModal').on('shown.bs.modal', function () { 506 $(this).find('#myInput').focus(); 507}); 508 509 510/* ÑекбокÑÑ */ 511var count = 0; 512$(function() { 513 $('.ksaSection').each( function(){ 514 var section = $(this); 515 var listSize = parseInt(section.find(".listValue").val(),10); 516 section.find('input[type=checkbox]').change(function(){ 517 var proElement = $(this).closest('div').parent().parent().find('.proElement'); 518 if ($(this).is(':checked')){ 519 proElement.val("1"); 520 if(section.find('input[type=checkbox]:checked').length >listSize){ 521 $(this).removeAttr("checked"); 522 proElement.val(""); 523 showEr(section); 524 } else{ 525 section.find('input[type=checkbox]:disabled').removeAttr('disabled'); 526 } 527 } else { 528 proElement.val(""); 529 section.find('input[type=checkbox]:not(:checked)').removeAttr('disabled', "disabled"); 530 } 531 }); 532 }); 533 function showEr(section){ 534 section.find('input[type=checkbox]:not(:checked)').attr('disabled', "disabled"); 535 var err = section.find(".error").removeClass("hidden").addClass("show").html(); 536 var mb = $("#myModalBox"); 537 mb.find(".fsbig").html(err); 538 mb.find(".btn-confirm").hide(); 539 mb.modal('show'); 540 setTimeout(rew, 5000); 541 } 542 function rew(){ 543 $(".error").removeClass("show").addClass("hidden"); 544 } 545}); 546 547function checkVoiteForm(){ 548 // оÑобÑаÑÑ Ð²Ñе ÑекÑии по вопÑоÑам 549 var hasErrors = false; 550 var hasFatalErrors = false; 551 var hasComplexErrors = false; 552 var hasSimpleErrors = false; 553 var fatalMessage = ""; 554 var complexMessage = ""; 555 var simpleMessage = ""; 556 $('.questionSection').each( function(){ 557 var hasQuestyinError = false; 558 var groupDiv = $(this); 559 if (groupDiv.hasClass('ksaSection')){ 560 var listSize = parseInt(groupDiv.find(".listValue").val(),10); 561 //еÑли кÑа - должно ÑоÑно ÑооÑвеÑÑÑвоваÑÑ 562 var ksaChecked = groupDiv.find('input[type=checkbox]:checked'); 563 if(ksaChecked.length != listSize){ 564 hasQuestyinError = true; 565 if(ksaChecked.length === 0) { 566 hasSimpleErrors = true; 567 simpleMessage = VOTE_MESSAGES["kandidats.1"] + " " + listSize + " " + VOTE_MESSAGES["kandidats.2"]; 568 } else { 569 hasFatalErrors = true; 570 fatalMessage = VOTE_MESSAGES["kandidats.1"] + " " + listSize + " " + VOTE_MESSAGES["kandidats.2"]; 571 } 572 } 573 }else if (groupDiv.hasClass('otherSection')){ 574 //еÑли обÑÑнÑй - должна бÑÑÑ Ð½Ð°Ð¶Ð°Ñа Ñ Ð¾ÑÑ Ð¾Ð´Ð½Ð° кнопка
575 if(groupDiv.find(".btn-active").length == 0){ 576 hasQuestyinError = true; 577 hasSimpleErrors = true; 578 simpleMessage = VOTE_MESSAGES["error.emptyQuestions"]; 579 } 580 }else if (groupDiv.hasClass('complexSection')){ 581 //еÑли кÑмÑлÑÑивнÑй - должна бÑÑÑ Ð½Ð°Ð¶Ð°Ñа Ñ Ð¾ÑÑ Ð¾Ð´Ð½Ð° кнопка и еÑли ÑÑо ÐÐ - обÑее колиÑеÑÑво должно ÑовпаÑÑÑ 582 var allCount = $("#allSecurQuantity").val(); 583 var mul = null; 584 var st = parseInt($("#accStatus").val(),10); 585 if((st & 2048) == 0)//not purpose 586 mul = parseInt(groupDiv.find(".listValue").val(),10); 587 if (!mul) 588 mul=1; 589 var complexCount = new VoitePortion(allCount).multiply(mul); 590 var complexCountQTY = complexCount.toString(); 591 var questionCount = new VoitePortion(0); 592 groupDiv.find(".voiteElement").each( function(){ 593 var vl = $(this).val(); 594 if(vl){ 595 questionCount = questionCount.add(new VoitePortion(vl)); 596 } 597 }); 598 if(complexCountQTY != questionCount.toString()){ 599 hasQuestyinError = true; 600 var diff = questionCount.substract(complexCount); 601 if(diff.numerator > 0 || diff.value > 0){ 602 hasFatalErrors = true; 603 fatalMessage = VOTE_MESSAGES["error.questionMax"]; 604 } else { 605 hasComplexErrors = true; 606 complexMessage = VOTE_MESSAGES["warning.complex"]; 607 } 608 } 609 }else if (groupDiv.hasClass('mostSection')){ 610 //еÑли пÑоÑÑое болÑÑинÑÑво - должна бÑÑÑ Ð½Ð°Ð¶Ð°Ñа Ñ Ð¾ÑÑ Ð¾Ð´Ð½Ð° кнопка по ÐºÐ°Ð¶Ð´Ð¾Ð¼Ñ ÐºÐ°Ð½Ð´Ð¸Ð´Ð°ÑÑ, колиÑеÑÑво ÐРдолжно бÑÑÑ Ð½Ðµ болÑÑе 611 var maxListSize = parseInt(groupDiv.find(".listValue").val(),10); 612 var currPro = 0; 613 var hasNoSelection = false; 614 groupDiv.find(".form-group").each(function(){ 615 var personDiv = $(this); 616 if(personDiv.find(".btn-active").length == 0) 617 hasNoSelection = true; 618 currPro += personDiv.find(".btn-default-success.btn-active").length ; 619 }); 620 if(currPro > maxListSize ){ 621 hasQuestyinError = true; 622 hasSimpleErrors = true; 623 simpleMessage = VOTE_MESSAGES["error.person"]; 624 } else if(hasNoSelection ){ 625 hasQuestyinError = true; 626 hasSimpleErrors = true; 627 simpleMessage = VOTE_MESSAGES["error.emptyPerson"]; 628 } 629 } 630 if(hasQuestyinError){ 631 hasErrors = true; 632 var scrollTop = groupDiv.offset().top; 633 $(document).scrollTop(scrollTop); 634 groupDiv.find(".error").removeClass("hidden").addClass("show"); 635 setTimeout(rewErr, 5000); 636 } 637 }); 638 if(hasErrors ){ 639 var mb = $("#myModalBox"); 640 mb.find(".btn-confirm").show(); 641 if(hasFatalErrors){ 642 mb.find(".fsbig").html(fatalMessage); 643 mb.find("#confinmBtnContinue").hide(); 644 } else if(hasComplexErrors){ 645 mb.find(".fsbig").html(complexMessage); 646 } else if(hasSimpleErrors){ 647 mb.find(".fsbig").html(simpleMessage); 648 } 649 mb.modal('show'); 650 return false; 651 } 652// alert("OK"); 653// return false; 654 return true; 655} 656 657function rewErr(){ 658 $(".error").removeClass("show").addClass("hidden"); 659} 660 661function hideModalErrors(){ 662 var mb = $("#myModalBox"); 663 mb.modal('close'); 664} 665function submitErrors(){ 666 var frm = $("#voiteDialogForm")[0]; 667 var el = $("#formError"); 668 el.val("submitErrors"); 669 frm.submit(); 670} 671function submitWithErrors(){ 672 var frm = $("#voiteDialogForm")[0]; 673 var el = $("#formError"); 674 el.val("submitWithErrors"); 675 frm.submit(); 676} 677 678/* custom */ 679$(document).ready(function() { 680 $('.anketa-note a').html('<u>>>></u>').attr("target", "_blank"); 681 $('.input-file-custom input').change(function(e){
682 if(this.files.length) { 683 fileName = e.target.value.split( '\\' ).pop(); 684 $(this).parents('.input-file-custom').find('label').text(fileName); 685 } 686 }); 687});
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.