1/*Function for fetching state on basis of country */ 2var rootDir = 'https://mybharat.gov.in/'; 3 4// Language 5$("#changeLang").on("change", function () { 6 // console.log(this.value); 7 $.ajax({ 8 type: "POST", 9 // contentType: "application/json; charset=utf-8", 10 url: rootDir + "pages/language", 11 data: { language: this.value }, 12 success: function (result) { 13 if (result) { 14 val = JSON.parse(result); 15 $.each(val, function (key, value) { 16 // console.log(key, value); 17 $("." + key).html(value); 18 }); 19 location.reload(); 20 } else { 21 return false; 22 } 23 }, 24 }); 25}); 26 27$(".changeLang_mobile a").on("click", function () { 28 // console.log(this.value); 29 var language_mobile = $(this).attr("attr"); 30 $.ajax({ 31 type: "POST", 32 // contentType: "application/json; charset=utf-8", 33 url: rootDir + "pages/language", 34 data: { language: language_mobile }, 35 success: function (result) { 36 if (result) { 37 val = JSON.parse(result); 38 $.each(val, function (key, value) { 39 // console.log(key, value); 40 $("." + key).html(value); 41 }); 42 location.reload(); 43 } else { 44 return false; 45 } 46 }, 47 }); 48}); 49 50// Language MMMMD 51$(".changeLangMeriMatiMeraDesh").on("click", function () { 52 $.ajax({ 53 type: "POST", 54 url: rootDir + "pages/languageMeriMatiMeraDesh", 55 data: { language: this.value }, 56 success: function (result) { 57 if (result) { 58 val = JSON.parse(result); 59 $.each(val, function (key, value) { 60 $("." + key).html(value); 61 }); 62 } else { 63 return false; 64 } 65 }, 66 }); 67}); 68 69function fetchCountry(country_id) { 70 if (country_id == "") { 71 return false; 72 } else { 73 var rand_no = Math.random() * (9999 - 100) + 100; 74 $.ajax({ 75 url: rootDir + "cities/fetch_country", 76 data: "country_id=" + country_id + "&rand_no=" + rand_no, 77 type: "post", 78 async: false, 79 before: function() { 80 $('div.ajaxloder').show(); 81 }, 82 success: function(result) { 83 if (result) { 84 $('select#state_id').html(result); 85 $('select#city_id').html("<option value='' selected> - - - Select District - - - </option>"); 86 $('select#block_id').html("<option value='' selected> - - - Select Block - - - </option>"); 87 $('select#panchayat_id').html("<option value='' selected> - - - Select Panchayat - - - </option>"); 88 89 } 90 }, 91 complete: function() { 92 $('div.ajaxloder').hide(); 93 } 94 }); 95 } 96 97} 98 99/*Function for fetching city on basis of state */ 100function fetchState(state_id, city_id=null, block_id=null, panchayat_id=null, selected_district=null) { 101 if (state_id == "") { 102 return false; 103 } else { 104 var rand_no = Math.random() * (9999 - 100) + 100; 105 $.ajax({ 106 url: rootDir + "cities/fetch_state", 107 data: "state_id=" + state_id + "&rand_no=" + rand_no + "&selected_district=" + selected_district, 108 type: "post", 109 async: false, 110 beforeSend: function () { 111 $("div.ajaxloder").css('display','block'); 112 }, 113 success: function (result) { 114 if (result) { 115 console.log(city_id) 116 if(city_id) { 117 $("select#"+city_id).html(result); 118 } else { 119 $("select#city_id").html(result); 120 } 121 122 if(block_id) { 123 $("select#"+block_id).html( 124 "<option value='' selected> - - - Select Block - - - </option>" 125 ); 126 } else { 127 $("select#block_id").html( 128 "<option value='' selected> - - - Select Block - - - </option>" 129 ); 130 } 131 132 if(block_id) { 133 $("select#"+panchayat_id).html( 134 "<option value='' selected> - - - Select Panchayat - - - </option>" 135 ); 136 } else { 137 $("select#panchayat_id").html( 138 "<option value='' selected> - - - Select Panchayat - - - </option>" 139 ); 140 } 141 } 142 },
143 complete: function () { 144 $("div.ajaxloder").hide(); 145 }, 146 }); 147 } 148} 149/*function fetchState(state_id, city_id=null, block_id=null, panchayat_id=null) { 150 if (state_id == "") { 151 return false; 152 } else { 153 var rand_no = Math.random() * (9999 - 100) + 100; 154 $.ajax({ 155 url: rootDir + "cities/fetch_state", 156 data: "state_id=" + state_id + "&rand_no=" + rand_no, 157 type: "post", 158 async: false, 159 beforeSend: function () { 160 $("div.ajaxloder").css('display','block'); 161 }, 162 success: function (result) { 163 if (result) { 164 if(city_id) { 165 $("select#"+city_id).html(result); 166 } else { 167 $("select#city_id").html(result); 168 } 169 170 if(block_id) { 171 $("select#"+block_id).html( 172 "<option value='' selected> - - - Select Block - - - </option>" 173 ); 174 } else { 175 $("select#block_id").html( 176 "<option value='' selected> - - - Select Block - - - </option>" 177 ); 178 } 179 180 if(block_id) { 181 $("select#"+panchayat_id).html( 182 "<option value='' selected> - - - Select Panchayat - - - </option>" 183 ); 184 } else { 185 $("select#panchayat_id").html( 186 "<option value='' selected> - - - Select Panchayat - - - </option>" 187 ); 188 } 189 } 190 }, 191 complete: function () { 192 $("div.ajaxloder").hide(); 193 }, 194 }); 195 } 196}*/ 197 198//Code for Cv builder redirection 199 200$(document).ready(function(){ 201$(".cvbuilder_anch").click(function(event){ 202 event.preventDefault(); // Prevents the default link action 203 $('#loaderSpinner').removeClass('hidden'); 204 $.ajax({ 205 url: rootDir + "tasks/redirectToCvBuilder", 206 method: 'POST', 207 data: {}, 208 success: function(response) { 209 $('#loaderSpinner').addClass('hidden'); 210 if (response) { 211 //console.log(response); 212 //localStorage.setItem('cv_user_Data', response); 213 var Cv_builder_link = JSON.parse(response); 214 //console.log(Cv_builder_link); 215 window.location.href = Cv_builder_link.redirect_link; 216 217 } 218 } 219 }); 220}); 221}); 222 223/*Function for fetching city on basis of state */ 224/*function fetchState(state_id) { 225 if (state_id == "") { 226 return false; 227 } else { 228 var rand_no = Math.random() * (9999 - 100) + 100; 229 $.ajax({ 230 url: rootDir + "cities/fetch_state", 231 data: "state_id=" + state_id + "&rand_no=" + rand_no, 232 type: "post", 233 async: false, 234 before: function() { 235 $('div.ajaxloder').show(); 236 }, 237 success: function(result) { 238 if (result) { 239 $('select#city_id').html(result); 240 $('select#block_id').html("<option value='' selected> - - - Select Block - - - </option>"); 241 $('select#panchayat_id').html("<option value='' selected> - - - Select Panchayat - - - </option>"); 242 243 } 244 }, 245 complete: function() { 246 $('div.ajaxloder').hide(); 247 } 248 }); 249 } 250 251}*/ 252 253 254/*Function for fetching block on basis of state */ 255function fetchBlock(dist_id) { 256 if (dist_id == "") { 257 return false; 258 } else { 259 var rand_no = Math.random() * (9999 - 100) + 100; 260 $.ajax({ 261 url: rootDir + "cities/fetch_block", 262 data: "dist_id=" + dist_id + "&rand_no=" + rand_no, 263 type: "post", 264 async: false, 265 before: function() { 266 $('div.ajaxloder').show(); 267 }, 268 success: function(result) { 269 if (result) { 270 $('select#block_id').html(result); 271 $('select#panchayat_id').html("<option value='' selected> - - - Select Panchayat - - - </option>"); 272 } 273 }, 274 complete: function() { 275 $('div.ajaxloder').hide(); 276 } 277 }); 278 } 279 280} 281 282function checkPincode(pincode) { 283 if (pincode == "") { 284 return false; 285 } 286 var zip = document.getElementById("pincode"); // add/edit Internship 287 var dist_id = $("#city_id").val(); 288 if (dist_id == "") { 289 zip.value = ""; 290 $("#city_id").css("border-color", "red"); 291 } else { 292 $("#city_id").css("border-color", "#d1cbcb"); 293 } 294 if (/^\d{6}$/.test(pincode)) { 295 $.ajax({ 296 url: rootDir + "cities/check_pincode", 297 data: "pincode=" + pincode + "&dist_id=" + dist_id, 298 type: "post", 299 async: false, 300 before: function () { 301 $("div.ajaxloder").show(); 302 }, 303 success: function (result) { 304 if (result == "FALSE") { 305 //zip.value = ""; 306 $("#pincode-error-id").css("display", "block"); 307 $("#notEmptyZip").css("display", "none"); 308 } else { 309 $("#pincode-error-id").css("display", "none"); 310 } 311 },
312 complete: function () { 313 $("div.ajaxloder").hide(); 314 }, 315 }); 316 } else { 317 return false; 318 } 319} 320 321//Fix slug for events mega events experiential learning page 322function convertToSlug(text) { 323 return text 324 .replace(/ /g, '-') 325 .replace(/"/g, '') 326 .replace(/>/g, '') 327 .replace(/</g, '') 328 .replace(/#/g, '') 329 .replace(/'/g, '') 330 .replace(/--+/g, '-'); 331} 332 333/*Function for fetching block on basis of state */ 334function fetchPanch(block_id) { 335 if (block_id == "") { 336 return false; 337 } else { 338 var rand_no = Math.random() * (9999 - 100) + 100; 339 $.ajax({ 340 url: rootDir + "cities/fetch_panchayat", 341 data: "block_id=" + block_id + "&rand_no=" + rand_no, 342 type: "post", 343 async: false, 344 before: function() { 345 $('div.ajaxloder').show(); 346 }, 347 success: function(result) { 348 if (result) { 349 $('select#panchayat_id').html(result); 350 351 } 352 }, 353 complete: function() { 354 $('div.ajaxloder').hide(); 355 } 356 }); 357 } 358 359} 360 361/*Function for fetching ministry on basis of organization type */ 362 363function fetchMinistryByOrg(min_typ, stateArr) { 364 365 if (min_typ == "") { 366 return false; 367 } else { 368 var rand_no = Math.random() * (9999 - 100) + 100; 369 $.ajax({ 370 url: rootDir + "ministries/fetch_ministries_by_org", 371 data: "min_typ=" + min_typ + "&rand_no=" + rand_no, 372 type: "post", 373 async: false, 374 before: function () { 375 $("div.ajaxloder").show(); 376 }, 377 success: function (result) { 378 379 $("#addressnew").val(''); 380 $("#zip").val(''); 381 $("#alternate_no").val(''); 382 383 $('#state_id').empty(); 384 $('#state_id').append('<option selected disabled>- - - - Select State - - - -</option>'); 385 $.each(stateArr, function(key, value) { 386 $('#state_id').append('<option value="' + key + '">' + value + '</option>'); 387 }); 388 389 $('#city_id').empty(); 390 // Add a default option to the select element 391 $('#city_id').append('<option selected disabled>- - - - Select District - - - -</option>'); 392 //get ministry information from ajax load 393 $("select#ministry_id").html(result); 394 if(min_typ == "Academic Institution"){ 395 $("#dept_id").prop( "disabled", true ); 396 }else{ 397 $("#dept_id").prop( "disabled", false ); 398 } 399 400 if(min_typ == "District Youth Officer"){ 401 $("#dept_id").prop( "disabled", true ); 402 // document.getElementById('input select').style.display = 'none'; 403 $("#ministry_select").hide(); 404 }else{ 405 $("#dept_id").prop( "disabled", false ); 406 $("#ministry_select").show(); 407 } 408 409 }, 410 411 }); 412 413 } 414} 415 416 417/*Function for fetching department on basis of ministry */ 418function fetchMinistry(min_id) { 419 420 if (min_id == "") { 421 return false; 422 } else { 423 var rand_no = Math.random() * (9999 - 100) + 100; 424 $.ajax({ 425 url: rootDir + "ministries/fetch_ministries", 426 data: "min_id=" + min_id + "&rand_no=" + rand_no, 427 type: "post", 428 async: false, 429 before: function() { 430 $('div.ajaxloder').show(); 431 }, 432 success: function(result) { 433 if (result) { 434 435 //if function is call from ministry registration 436 if ($("form#MinistryRegForm").length > 0) { 437 438 var options = result + '<option value="Others">Others</option>'; 439 $('select#dept_id').html(options); 440 441 $.ajax({ 442 url: rootDir + "ministries/fetch_ministries_name", 443 data: "min_id=" + min_id + "&rand_no=" + rand_no, 444 type: "post", 445 async: false, 446 success: function(result) { 447 if (result) { 448 //get ministry name from aja
448x load 449 $("#ministry_name").val(result); 450 $("#deparment_name").val(""); 451 } 452 } 453 }); 454 } else { 455 $('select#dept_id').html(result); 456 } 457 458 } 459 }, 460 complete: function() { 461 $('div.ajaxloder').hide(); 462 } 463 }); 464 } 465 466} 467 468/*Function for fetching department & taskowner on basis of ministry */ 469function fetchDeptUser(min_id) { 470 471 var ctr = $('input#hidnctr').val(); 472 if (min_id == "") { 473 return false; 474 } else { 475 var rand_no = Math.random() * (9999 - 100) + 100; 476 $.ajax({ 477 url: rootDir + "ministries/fetchDeptUser", 478 data: "min_id=" + min_id + "&ctr=" + ctr + "&rand_no=" + rand_no, 479 type: "post", 480 async: false, 481 before: function() { 482 $('div.ajaxloder').show(); 483 }, 484 success: function(result) { 485 if (result) { 486 var arrData = result.split('@@@@'); 487 $('select#dept_id').html(arrData[0]); 488 $('div#sub_owner').html(arrData[1]); 489 } 490 }, 491 complete: function() { 492 $('div.ajaxloder').hide(); 493 var values = []; 494 $(".cbx").change(function() { 495 if ($(this).is(":checked")) 496 values.push($(this).val()); 497 else { 498 var x = values.indexOf($(this).val()); 499 values.splice(x, 1); 500 } 501 502 }); 503 $("button#addingSubOwner").click(function() { 504 var rand_val = Math.random() * (9999 - 100) + 100; 505 $.ajax({ 506 url: rootDir + "tasks/fetchsubowner", 507 data: "u_id=" + values + "&rand_val=" + rand_val, 508 type: "post", 509 async: false, 510 before: function() { 511 $('a.show_interest').attr('disabled', 'disabled'); 512 $('div.ajaxloder').show(); 513 }, 514 success: function(result) { 515 if (result) { 516 var listData = result.split('@@@'); 517 $('ol#listingOwner').append(listData[0]); 518 $('div#addOwner').html(listData[1]); 519 } 520 }, 521 complete: function() { 522 $('div.ajaxloder').hide(); 523 $('#subtaskModal').modal('hide'); 524 } 525 }); 526 }); 527 } 528 }); 529 } 530 531} 532 533/*Function for fetching taskowner & subowner on basis of department */ 534function fetchSubUser(dept_id) { 535 536 var ctr = $('input#hidnctr').val(); 537 if (dept_id == "") { 538 return false; 539 } else { 540 var rand_no = Math.random() * (9999 - 100) + 100; 541 $.ajax({ 542 url: rootDir + "ministries/fetchSubUser", 543 data: "dept_id=" + dept_id + "&ctr=" + ctr + "&rand_no=" + rand_no, 544 type: "post", 545 async: false, 546 before: function() { 547 $('div.ajaxloder').show(); 548 }, 549 success: function(result) { 550 if (result) { 551 $('div#sub_owner').html(result); 552 553 } 554 }, 555 complete: function() { 556 $('div.ajaxloder').hide(); 557 var values = []; 558 $(".cbx").change(function() { 559 if ($(this).is(":checked")) 560 values.push($(this).val()); 561 else { 562 var x = values.indexOf($(this).val()); 563 values.splice(x, 1); 564 } 565 //$('div#addOwner').html(values); 566 }); 567 $("button#addingSubOwner").click(function() { 568 var rand_val = Math.random() * (9999 - 100) + 100; 569 $.ajax({ 570 url: rootDir + "tasks/fetchsubowner", 571 data: "u_id=" + values + "&rand_val=" + rand_val, 572 type: "post", 573 async: false, 574 before: function() { 575 $('a.show_interest').attr('disabled', 'disabled'); 576 $('div.ajaxloder').show(); 577 }, 578 success: function(result) { 579 if (result) { 580 var listData = result.split('@@@'); 581 $('ol#listingOwner').append(listData[0]); 582 $('div#addOwner').html(listData[1]); 583 // $('div.ajaxappend div.row').append(result); 584 //$(result).appendTo("div.tiles-body div.row").slideToggle(500); 585 586 } 587 }, 588 complete: function() { 589 $('div.ajaxloder').hide(); 590 $('#subtaskModal').modal('hide'); 591 } 592 }); 593 }); 594 } 595 }); 596 } 597 598} 599 600 601/*read notifications*/ 602function notificationRead(noti_id) { 603 604 if (noti_id == "" || noti_id === undefined) { 605 return false;
606 } else { 607 //$('#notification-remove-' + noti_id).fadeOut(500).remove(); 608 $('#notification-remove-' + noti_id).addClass('read'); 609 var redirect_url = $("#notify" + noti_id).val(); 610 $.ajax({ 611 url: rootDir + "notifications/read_notification", 612 data: "noti_id=" + noti_id, 613 type: "post", 614 success: function(result) { 615 616 if (result == 'yes') { 617 var cal = Number($('.username span.badge-important').html()); 618 cal--; 619 if (cal >= 1) { 620 $('.username span.badge-important').html(cal); 621 } else { 622 $('.username span.badge-important').remove(); 623 } 624 } 625 window.location.href = redirect_url; 626 } 627 }); 628 } 629 630} 631 632function allnotificationRead(noti_id) { 633 634 if (noti_id == "" || noti_id === undefined) { 635 return false; 636 } else { 637 //$('#notification-remove-' + noti_id).fadeOut(500).remove(); 638 $('#notification-remove-' + noti_id).addClass('read'); 639 var redirect_url = $("#notify" + noti_id).val(); 640 $.ajax({ 641 url: rootDir + "notifications/read_notification", 642 data: "noti_id=" + noti_id, 643 type: "post", 644 success: function(result) { 645 if (result == 'yes') { 646 var cal = Number($('.username span.badge-important').html()); 647 cal--; 648 if (cal >= 1) { 649 $('.username span.badge-important').html(cal); 650 } else { 651 $('.username span.badge-important').remove(); 652 } 653 } 654 window.location.href = redirect_url; 655 } 656 }); 657 } 658 659} 660/*This function is used for showing popup box */ 661if ($('#modelPledgeDashboard').length > 0) { 662 663 $('#modelPledgeDashboard').modal('show'); 664 //click on disagree button 665 $(document).on('click', '#btndisagree', function(e) { 666 $('#modelPledgeDashboard').modal('hide'); 667 }); 668 669 //click on agree button 670 $(document).on('click', '#btnagree', function(e) { 671 672 //update users table 673 $.ajax({ 674 url: rootDir + "users/update_pladge", 675 data: "pladge=agree", 676 type: "post", 677 success: function(result) { 678 if (result == 'yes') { 679 $('#modelPledgeDashboard').modal('hide'); 680 } 681 } 682 }); 683 684 685 }); 686} 687 688 689 690var endads; 691var dataload; 692$('div.Expand a.show_more').click(function(e) { 693 694 e.preventDefault(); 695 var pg = $("input#hid_pg").val(); 696 var hashtag = $("input#hid_hashtag").val(); 697 698 var oldpg = Number(pg); 699 pg = Number(pg) + 1; 700 $("input#hid_pg").val(pg); 701 var show_records = $("input#hid_show_records").val(); 702 var show = $('input#hid_show').val(); 703 var totalPages = $("input#hid_tot_page").val(); 704 totalPages = Number(totalPages); 705 //var rand = Math.floor(Math.random() * 999999); 706 if (endads == 1) { 707 $("div.Expand").html('<span>No more posts to show.</span>'); 708 } 709 if (dataload) { 710 $(dataload).css({"display": "none"}).appendTo("ul.cbp_tmtimeline").slideToggle(500); 711 dataload = ''; 712 } 713 if (show_records == "true") { 714 $.ajax({ 715 url: rootDir + controller + "/allpostdata", 716 data: "pg=" + pg + "&show=" + show + "&totalPages=" + totalPages + "&hashtag=" + hashtag, 717 type: "post", 718 async: false, 719 success: function(html) { 720 if (html) { 721 $("ul.cbp_tmtimeline").append(html); 722 //dataload = html; 723 } 724 } 725 }); 726 } 727 if (totalPages <= pg) { 728 $("input#hid_show_records").val("false"); 729 endads = 1; 730 $("div.Expand").html('<span>No more posts to show.</span>'); 731 } 732 733}); 734 735 736/*Coding for showing calender */ 737if ($('#TaskAddtaskForm #start_date, #TaskEdittaskForm #start_date').length > 0) { 738 $('#TaskAddtaskForm #start_date, #TaskEdittaskForm #start_date').datetimepicker().datetimepicker({value: '', step: 10, minDate: 0}); 739} 740 741if ($('#TaskAddtaskForm #end_date, #TaskEdittaskForm #end_date').length > 0) { 742 $('#TaskAddtaskForm #end_date, #TaskEdittaskForm #end_date').datetimepicker().datetimepicker({value: '', step: 10, minDate: 0}); 743} 744 745if ($('#TaskAddtaskForm #interest_date, #TaskEdittaskForm #interest_date').length > 0) { 746 $('#TaskAddtaskForm #interest_date, #TaskEdittaskForm #interest_date').datetimepicker().datetimepicker({value: '', step: 10, minDate: 0}); 747} 748 749if ($('#VolunteerAddvolunteerForm #dob, #UserVolunteereditForm #dob, #UserAddusersForm #dob, #UserEditusersForm #dob, #VolunteerVolunteerlistForm #start_date, #VolunteerVolunteerlistForm #end_date, #ReportsVolunteerlistForm #start_date, #ReportsVolunteerlistForm #end_date').length > 0) { 750 $('#VolunteerAddvolunteerForm #dob, #UserVolunteereditForm #dob, #UserAddusersForm #dob, #UserEditusersForm #dob, #VolunteerVolunteerlistForm #start_date, #VolunteerVolunteerlistForm #end_date, #ReportsVolunteerlistForm #start_date, #ReportsVolunteerlistForm #end_date').datepicker({ 751 format: "yyyy-mm-dd", 752 autoclose: true, 753 todayHighlight: true 754 });// 755} 756 757// datepicker in tasks update page in search panel 758if ($('#TasksTaskupdatesForm #TasksUpdateDate').length > 0) { 759 $('#TasksTaskupdatesForm #TasksUpdateDate').datepicker({ 760 format: "yyyy-mm-dd", 761 autoclose: true, 762 todayHighlight: true 763 }); 764} 765 766if ($('#ReportSurveysForm #start_date, #ReportPollsForm #start_date, #PollAddForm #start_date, #PollEditForm #start_date, #SurveyAddForm #start_date, #SurveyEditForm #start_date, #gam
766ification_form #start_date, #ReportActivityListForm #start_date, #TaskupdateVolupdateForm #start_date, #TasksTaskupdatesForm #start_date').length > 0) { 767 $('#ReportSurveysForm #start_date, #ReportPollsForm #start_date, #PollAddForm #start_date, #PollEditForm #start_date, #SurveyAddForm #start_date, #SurveyEditForm #start_date, #gamification_form #start_date, #ReportActivityListForm #start_date, #TaskupdateVolupdateForm #start_date, #TasksTaskupdatesForm #start_date').datepicker({ 768 format: "yyyy-mm-dd", 769 autoclose: true, 770 todayHighlight: true 771 });// 772} 773if ($('#ReportSurveysForm #end_date, #ReportPollsForm #end_date, #PollAddForm #end_date, #PollEditForm #end_date, #SurveyAddForm #end_date, #SurveyEditForm #end_date, #gamification_form #end_date, #ReportActivityListForm #end_date, #TaskupdateVolupdateForm #end_date, #TasksTaskupdatesForm #end_date').length > 0){ 774 $('#ReportSurveysForm #end_date, #ReportPollsForm #end_date, #PollAddForm #end_date, #PollEditForm #end_date, #SurveyAddForm #end_date, #SurveyEditForm #end_date, #gamification_form #end_date, #ReportActivityListForm #end_date, #TaskupdateVolupdateForm #end_date, #TasksTaskupdatesForm #end_date').datepicker({ 775 format: "yyyy-mm-dd", 776 autoclose: true, 777 todayHighlight: true 778 });// 779} 780if ($('#SocialActivityAddForm #start_date, #SocialActivityAddForm #end_date, #SocialActivityEditForm #start_date,#SocialActivityEditForm #end_date').length > 0) { 781 782 //start date 783 $('#SocialActivityAddForm #start_date, #SocialActivityEditForm #start_date').datetimepicker().datetimepicker({value: '', step: 10, minDate: 0}); 784 785 //end date 786 $('#SocialActivityAddForm #end_date,#SocialActivityEditForm #end_date').datetimepicker().datetimepicker({value: '', step: 10, minDate: 0}); 787} 788 789/*Function for fetching state on basis of country */ 790function fetchCountryman(country_id) { 791 if (country_id == "") { 792 return false; 793 } else { 794 var rand_no = Math.random() * (9999 - 100) + 100; 795 $.ajax({ 796 url: rootDir + "cities/fetch_country_data", 797 data: "country_id=" + country_id + "&rand_no=" + rand_no, 798 type: "post", 799 async: false, 800 before: function() { 801 $('div.ajaxloder').show(); 802 }, 803 success: function(result) { 804 if (result) { 805 $('select#state_id').html(result); 806 $('select#city_id').html("<option value='' selected> - - - Select City - - - </option>"); 807 808 809 } 810 }, 811 complete: function() { 812 813 } 814 }); 815 } 816 817} 818 819//on tab click in index page of task 820$(".show_task").click(function() { 821 var stats = $(this).attr('rel'); 822 setTimeout( 823 function() 824 { 825 $.ajax({ 826 url: rootDir + "tasks/taskListing", 827 data: "stats=" + stats, 828 type: "post", 829 async: false, 830 before: function() { 831 }, 832 success: function(result) { 833 834 $('div#' + stats + ' .load').delay(2000).hide(0); 835 if (result) { 836 $('div#' + stats).html(result); 837 } 838 }, 839 complete: function() { 840 $('[data-toggle="popover"]').popover(); 841 842 //END Task Submit 843 } 844 }); 845 }, 1000); 846 847}); 848 849 850//on tab click in index page of assignment 851$(".show_task_assignment").click(function () { 852 var stats = $(this).attr("rel"); 853 // var result1 = 854 // "<img class='loading'src='" + 855 // rootDir + 856 // "images/ajax-loader.gif' alt='Loading...' />"; 857 // $("div#" + stats + " .load").html(result1); 858 setTimeout(function () { 859 $.ajax({ 860 url: rootDir + "assignment/taskListing", 861 data: "stats=" + stats, 862 type: "post", 863 async: false, 864 before: function () {}, 865 success: function (result) { 866 $("div#" + stats + " .load") 867 .delay(2000) 868 .hide(0); 869 if (result) { 870 $("div#" + stats).html(result); 871 } 872 },
873 complete: function () { 874 $('[data-toggle="popover"]').popover(); 875 876 //END Task Submit 877 }, 878 }); 879 }, 1000); 880}); 881 882//Volunteer showing interest for task (index page) 883$(".show_interest").click(function() { 884 var stats = $(this).attr('rel'); 885 $.ajax({ 886 url: rootDir + "tasks/taskSubmHistory", 887 data: "stats=" + stats, 888 type: "post", 889 async: false, 890 before: function() { 891 $('a.show_interest').attr('disabled', 'disabled'); 892 }, 893 success: function(result) { 894 if (result) { 895 if (result == 'Interested') { 896 $('div#' + stats) 897 .fadeOut(3000, function() { 898 $('div#' + stats).remove(); 899 }); 900 } 901 902 } 903 }, 904 complete: function() { 905 } 906 }); 907 908}); 909 910function show_interest(val){ 911 var stats = val; 912 $.ajax({ 913 url: rootDir + "tasks/taskSubmHistory", 914 data: "stats=" + stats, 915 type: "post", 916 async: false, 917 before: function() { 918 $('a.show_interest').attr('disabled', 'disabled'); 919 }, 920 success: function(result) { 921 /* alert(result+stats); */ 922 if (result) { 923 if (result == 'Interested') { 924 $('div #'+stats).delay(100).remove(); 925 } 926 927 } 928 }, 929 complete: function() { 930 $('div #'+stats).delay(100).fadeOut(3000, function(){ 931 $(this).remove(); 932 }); 933 934 } 935 }); 936} 937 938//on tab click in task detail page for admin 939$(".show_volunteer").click(function() { 940 941 var request, timeout; 942 var processing = false; 943 var stats = $(this).attr('rel'); 944 var arr = stats.split('/'); 945 946 var result1 = "<img class='loading'src='" + rootDir + "images/ajax-loader.gif' alt='Loading...' />"; 947 $('div#' + arr[0] + ' .load').html(result1); 948 $('div#' + arr[0] + ' .load').delay(2000).hide(0); 949 setTimeout( 950 function() 951 { 952 //do something special 953 $.ajax({ 954 url: rootDir + "tasks/showVolunteer/" + stats, 955 data: "stats=" + stats, 956 type: "post", 957 async: false, 958 before: function() { 959 $('div.ajaxloder').show(); 960 }, 961 success: function(result) { 962 if (result) { 963 $('div#' + arr[0]).html(result); 964 //$('.load').css('visibility','hidden'); 965 } 966 }, 967 complete: function() { 968 969 //Start function assigning task to volunteer by admin 970 $("a.assign_task").click(function() { 971 var valuess = $(this).attr('rel'); 972 var objCurr = $(this); 973 974 $.ajax({ 975 url: rootDir + "tasks/taskAssign", 976 data: "stats=" + valuess, 977 type: "post", 978 async: false, 979 before: function() { 980 //$('div.ajaxloder').show(); 981 }, 982 success: function(result) { 983 if (result) { 984 $(objCurr).parent().parent().parent() 985 .fadeOut(3000, function() { 986 $(objCurr).parent().parent().parent().remove(); 987 }); 988 } 989 }, 990 complete: function() { 991 } 992 }); 993 994 }); 995 //END function for assigning 996 997 //Start function reassigning/completing task to volunteer by admin 998 if ($("a.reassign_complete").length > 0) { 999 $("div.taskreassign").on("click", "a.reassign_complete", function(e) { 1000 1001 e.preventDefault(); 1002 var randnum = Math.floor((Math.random() * 10000000) + 10000); 1003 var url = $(this).attr("href"); 1004 var currObj = $(this); 1005 1006 $.colorbox({width: "30%", height: "5
10065%", href: url, 1007 onComplete: function() { 1008 $("input#submit_rsn").click(function() { 1009 var submstats = $(this).attr("rel"); 1010 var taskid = $(this).attr("rev"); 1011 var str = $("form#accept-reason").serialize(); 1012 var randNumber = Math.floor((Math.random() * 10000000) + 10000); 1013 $.ajax({ 1014 url: rootDir + 'tasks/reassign', 1015 data: str + "&status=" + submstats + "&rand=" + randNumber, 1016 type: "POST", 1017 beforeSend: function() { 1018 $('div.showStatus') 1019 .html('<img src= "' + rootDir + 'img/loading.gif" />') 1020 .show(200); 1021 }, 1022 success: function(result1) { 1023 if (result1 == 'noremarks') { 1024 $('<div class="alert alert-danger">noremarks</div>').insertAfter('input#remks'); 1025 } else { 1026 $.colorbox.close(); 1027 $('div#' + taskid) 1028 .fadeOut(3000, function() { 1029 $('div#' + taskid).remove(); 1030 }); 1031 } 1032 } 1033 }); 1034 }); 1035 } 1036 }); 1037 }); 1038 } 1039 //END function for reassigning/completing 1040 } 1041 }); 1042 1043 }, 1000); 1044 1045 1046}); 1047 1048if ($("a.approve_vol").length > 0) { 1049 $("div.moderatevol").on("click", "a.approve_vol", function(e) { 1050 1051 e.preventDefault(); 1052 var randnum = Math.floor((Math.random() * 10000000) + 10000); 1053 var url = $(this).attr("href"); 1054 var currObj = $(this); 1055 1056 $.colorbox({width: "30%", height: "55%", href: url, 1057 onComplete: function() { 1058 $("input#submit_rsn").click(function() { 1059 1060 1061 var str = $("form#accept-reason").serialize(); 1062 var str = "&" + str; 1063 /* alert(str); */ 1064 var randNumber = Math.floor((Math.random() * 10000000) + 10000); 1065 1066 $.ajax({ 1067 url: rootDir + 'tasks/volapproved', 1068 data: "rand=" + randNumber + str + "&form#accept-reason", 1069 type: "POST", 1070 beforeSend: function() { 1071 $('div.showStatus') 1072 .html('<img src= "' + rootDir + 'img/loading.gif" />') 1073 .show(200); 1074 }, 1075 success: function(result) { 1076 1077 $.colorbox.close(); 1078 $(currObj).parent().parent() 1079 .fadeOut(2000, function() { 1080 $(currObj).parent().parent().remove(); 1081 }); 1082 } 1083 }); 1084 }); 1085 } 1086 }); 1087 }); 1088} 1089 1090$(document).ready(function() { 1091 1092 $("input#UserSecurityCode").addClass("form-control"); 1093 $("a#redeem_now").click(function() { 1094 1095 $("#popupModal").modal('show'); 1096 var pid = $(this).attr('rel'); 1097 $.ajax({ 1098 url: rootDir + "redeemrewards/redeemmodal", 1099 data: "rid=" + pid, 1100 type: "POST", 1101 beforeSend: function() { 1102 $('#modal_product').html('<img src= "' + rootDir + 'img/loading.gif" height="60"/>'); 1103 }, 1104 success: function(result) { 1105 $("#modal_product").html(result); 1106 }, complete: function() { 1107 } 1108 }); 1109 }); 1110 1111 1112}); 1113 1114$("a#advancesearch").click(function() { 1115 1116 var sid = $(this).attr('href'); 1117 if (sid == "#adv_search") { 1118 $('a#advancesearch').html('<i class="fa fa-minus"></i> Hide'); 1119 $('div#adv_search').show(); 1120 $("a#advancesearch").attr("href", "#hide_search"); 1121 } else { 1122 $('a#advancesearch').html('<i class="fa fa-plus"></i> Advanced'); 1123 $('div#adv_search').hide(); 1124 $("a#advancesearch").attr("href", "#adv_search"); 1125 } 1126 1127}); 1128 1129$("#TaskSubmissionTasksubmitForm #peer_review").click(function() { 1130 if ($('#peer_review').is(':checked')) { 1131 $('div#peerReq').fadeIn(); 1132 } else { 1133 $('div#peerReq').fadeOut(); 1134 } 1135}); 1136 1137//peer review of task which sent 1138$(".peer_task").click(function() { 1139 1140 var stats = $(this).attr('rel'); 1141 $.ajax({ 1142 url: rootDir + "peerreviews/peerTask", 1143 data: "stats=" + stats, 1144 type: "post", 1145 async: false, 1146 before: function() { 1147 //$('div.ajaxloder').show(); 1148 }, 1149 success: function(result) { 1150 if (result) { 1151 $('div#' + stats).html(result); 1152 } 1153 }, 1154 complete: function() { 1155 //$('div.ajaxloder').hide(); 1156 } 1157 }); 1158 1159}); 1160 1161if ($("a.peerReply").length > 0) { 1162 $("a.peerReply").on("click", function(e) { 1163 1164 e.preventDefault(); 1165 var randnum = Math.floor((Math.random() * 10000000) + 10000); 1166 var reviewID = $(this).attr("rel"); 1167 // var rcID = $(this).attr("rev"); 1168 //var usrID = usID; 1169 // var recID = rcID; 1170 var url = $(this).attr("href"); 1171 var currObj = $(this); 1172
1173 $.colorbox({width: "30%", height: "55%", href: url, 1174 onComplete: function() { 1175 $("input#submit_rsn").click(function() { 1176 var str = $("form#reply-reason").serialize(); 1177 1178 var randNumber = Math.floor((Math.random() * 10000000) + 10000); 1179 $.ajax({ 1180 url: rootDir + 'peerreviews/peer_reply', 1181 data: str + "&reviewID=" + reviewID + "&rand=" + randNumber, 1182 type: "POST", 1183 beforeSend: function() { 1184 $('div.showStatus') 1185 .html('<img src= "' + rootDir + 'img/loading.gif" />') 1186 .show(200); 1187 }, 1188 success: function(result) { 1189 1190 $.colorbox.close(); 1191 window.location.reload(); 1192 } 1193 }); 1194 }); 1195 } 1196 }); 1197 }); 1198} 1199 1200/*Function for fetching state on basis of country */ 1201function setFields(values) { 1202 if (values == "") { 1203 return false; 1204 } else { 1205 var value = values; 1206 if (value == "State" || value == "Union Territory") { 1207 $('div#state_id').hide(); 1208 } 1209 if (value == "District") { 1210 $('div#state_id').show(); 1211 } 1212 } 1213 1214} 1215 1216 1217/*Function for hiding div of banner title and discription on basis of banner type */ 1218 1219if ($('#BannerAddForm').length > 0) { 1220 var value = window.location.hash.substr(1); 1221 if (value == "footer") { 1222 $('div#display_fields').hide(); 1223 $('div#showMultiTask').show(); 1224 $('div#showTask').hide(); 1225 } 1226 if (value == "carousel") { 1227 $('div#display_fields').show(); 1228 $('div#showTask').show(); 1229 } 1230} 1231 1232 1233 1234function hideFields(values) { 1235 if (values == "") { 1236 return false; 1237 } else { 1238 var value = values; 1239 if (value == "footer") { 1240 $('div#display_fields').hide(); 1241 $('div#showMultiTask').show(); 1242 $('div#showTask').hide(); 1243 } 1244 if (value == "carousel") { 1245 $('div#display_fields').show(); 1246 $('div#showTask').show(); 1247 $('div#showMultiTask').hide(); 1248 } 1249 } 1250 1251} 1252 1253$("#task_type").change(function() { 1254 var task_type = $(this).val(); 1255 if(task_type == 'Offline'){ 1256 $("#area_specific").attr("checked", true); 1257 $("#area_specific").attr("readonly", true); 1258 $("div#bind_location").show(); 1259 } 1260 else { 1261 $("#area_specific").attr("checked", false); 1262 $("#area_specific").attr("readonly", true); 1263 $("div#bind_location").hide(); 1264 } 1265}); 1266 1267$(document).ready(function() { 1268 if ($('#peer_review').is(':checked')) { 1269 $('div#peerReq').show(); 1270 } 1271}); 1272 1273$(document).ready(function() { 1274 if ($('#area_specific').is(':checked')) { 1275 $('div#bind_location').show(); 1276 } 1277}); 1278 1279$("#TaskAddtaskForm #area_specific, #TaskEdittaskForm #area_specific").click(function() { 1280 if ($('#area_specific').is(':checked')) { 1281 $('div#bind_location').fadeIn(); 1282 } else { 1283 if (confirm('Your all location set data will remove')) { 1284 $('div#bind_location').fadeOut(); 1285 } else { 1286 $('#area_specific').attr('checked', true); 1287 //$('div#bind_location').fadeIn(); 1288 } 1289 1290 } 1291}); 1292 1293 1294$("input#submit_reply").click(function() { 1295 1296 var submstats = $(this).attr("rel"); 1297 var str = $("form#rep_discuss" + submstats).serialize(); 1298 1299 var randNumber = Math.floor((Math.random() * 10000000) + 10000); 1300 $.ajax({ 1301 url: rootDir + 'discussions/discuss_reply', 1302 data: str + "&rand=" + randNumber, 1303 type: "POST", 1304 beforeSend: function() { 1305 $('div.showStatus') 1306 .html('<img src= "' + rootDir + 'img/loading.gif" />') 1307 .show(200); 1308 }, 1309 success: function(result1) { 1310 if (result1) { 1311 $("div#reply_body" + submstats).html(result1); 1312 $('form#rep_discuss' + submstats + ' textarea#description').val(''); 1313 $("div#query_reply_msg" + submstats).html('<div class="col-md-11"><div class="alert alert-success">Query has been successfully replied.</div></div>'); 1314 } 1315 }, 1316 complete: function() { 1317 1318 // edit reply for ajax data 1319 $("a.editRep").click(function() { 1320 1321 var replyID = $(this).attr("rel"); 1322 var parentID = $(this).attr("href"); 1323 var replyDesc = $(this).attr("rev");
1324 var formID = 'form#rep_discuss' + parentID; 1325 var str4 = formID + " textarea#description"; 1326 1327 $(str4).val(replyDesc); 1328 $(formID).append('<input type="hidden" name="replyID" id="replyID" value="' + replyID + '" />'); 1329 }); 1330 1331 // delete reply for ajax data 1332 $("a.delRep").click(function() { 1333 1334 var reply_id = $(this).attr("rel"); 1335 var currObj = $(this); 1336 var randNumber = Math.floor((Math.random() * 10000000) + 10000); 1337 if (confirm('Are you sure?')) { 1338 $.ajax({ 1339 url: rootDir + 'discussions/delete_reply/' + reply_id, 1340 data: reply_id + "&rand=" + randNumber, 1341 type: "POST", 1342 beforeSend: function() { 1343 $('div.showStatus') 1344 .html('<img src= "' + rootDir + 'img/loading.gif" />') 1345 .show(200); 1346 }, 1347 success: function(result1) { 1348 if (result1 == 'deleted') { 1349 $(currObj).parent().parent() 1350 .fadeOut(2000, function() { 1351 $(currObj).parent().parent().remove(); 1352 }); 1353 } 1354 }, 1355 complete: function() { 1356 //$('div.ajaxloder').hide(); 1357 } 1358 }); 1359 } 1360 }); 1361 } 1362 }); 1363}); 1364 1365//edit reply for direct data 1366$("a.editRep").click(function() { 1367 1368 var replyID = $(this).attr("rel"); 1369 var parentID = $(this).attr("href"); 1370 var replyDesc = $(this).attr("rev"); 1371 var formID = 'form#rep_discuss' + parentID; 1372 var str4 = formID + " textarea#description"; 1373 $(str4).val(replyDesc); 1374 $(formID).append('<input type="hidden" name="replyID" id="replyID" value="' + replyID + '" />'); 1375 1376}); 1377 1378// delete reply for direct data 1379$("a.delRep").click(function() { 1380 1381 var reply_id = $(this).attr("rel"); 1382 var currObj = $(this); 1383 var randNumber = Math.floor((Math.random() * 10000000) + 10000); 1384 if (confirm('Are you sure?')) { 1385 $.ajax({ 1386 url: rootDir + 'discussions/delete_reply/' + reply_id, 1387 data: reply_id + "&rand=" + randNumber, 1388 type: "POST", 1389 beforeSend: function() { 1390 $('div.showStatus') 1391 .html('<img src= "' + rootDir + 'img/loading.gif" />') 1392 .show(200); 1393 }, 1394 success: function(result1) { 1395 if (result1 == 'deleted') { 1396 $(currObj).parent().parent() 1397 .fadeOut(2000, function() { 1398 $(currObj).parent().parent().remove(); 1399 }); 1400 } 1401 }, 1402 complete: function() { 1403 //$('div.ajaxloder').hide(); 1404 } 1405 }); 1406 } 1407}); 1408 1409// delete discussion 1410$("a.deldiscuss").click(function() { 1411 1412 var discuss_id = $(this).attr("rel"); 1413 var randNumber = Math.floor((Math.random() * 10000000) + 10000); 1414 if (confirm('Are you sure?')) { 1415 $.ajax({ 1416 url: rootDir + 'discussions/delete_discuss/' + discuss_id, 1417 data: "&rand=" + randNumber, 1418 type: "POST", 1419 beforeSend: function() { 1420 $('div.showStatus') 1421 .html('<img src= "' + rootDir + 'img/loading.gif" />') 1422 .show(200); 1423 }, 1424 success: function(result1) { 1425 if (result1 == 'deleted') { 1426 window.location.reload(); 1427 } else { 1428 window.location.reload(); 1429 } 1430 }, 1431 complete: function() { 1432 } 1433 }); 1434 } 1435}); 1436 1437// peer review description expand n close in index page 1438$("a.peer-desc").click(function() { 1439 var sid = $(this).attr('href'); 1440 if (sid == "#plus") { 1441 $('a.peer-desc').html('<i class="fa fa-minus-square"></i>'); 1442 $('div#peer-lngdesc').show(); 1443 $("a.peer-desc").attr("href", "#minus"); 1444 } else { 1445 $('a.peer-desc').html('<i class="fa fa-plus-square"></i>'); 1446 $('div#peer-lngdesc').hide(); 1447 $("a.peer-desc").attr("href", "#plus"); 1448 } 1449}); 1450 1451//direct approve & assign task to volunteer 1452$("a.approve_assign_task").click(function() { 1453 var valuess = $(this).attr('rel'); 1454 var objCurr = $(this); 1455/* alert(valuess); */ 1456 $.ajax({ 1457 url: rootDir + "tasks/taskAssign", 1458 data: "stats=" + valuess + "&approveAssign=1", 1459 type: "post", 1460 async: false, 1461 before: function() { 1462 }, 1463 success: function(result) { 1464 if (result) { 1465 window.location.reload(); 1466 1467 } 1468 }, 1469 complete: function() { 1470 1471 } 1472 }); 1473 1474}); 1475 1476/* Text counter */ 1477function textCounter(field, cntfield, maxlimit) { 1478 if (field.value.length > maxlimit) { // if too long...trim it! 1479 field.value = field.value.substring(0, maxlimit); 1480 } else { // otherwise, update 'characters left' counter 1481 cntfield.innerHTML = maxlimit - field.value.length; 1482 } 1483} 1484 1485/* Text counter */ 1486function thankstextCounter(field, cntfield, maxlimit) { 1487 if (field.value.length > maxlimit) { // if too long...trim it! 1488 field.value = field.value.substring(0, maxlimit); 1489 } else { // otherwise, update 'characters left' counter 1490 cntfield.innerHTML = maxlimit - field.value.length; 1491 } 1492} 1493 1494/* Text counter */ 1495function error_textCounter(field, cntfield, maxlimit) { 1496 if (field.value.length > maxlimit) { // if too long...trim it! 1497 field.value = field.value.substring(0, maxlimit); 1498 } else { // otherwise, update 'characters left' counter 1499 cntfield.innerHTML = maxlimit - field.value.length; 1500 } 1501} 1502 1503/* jquery validation on outer minister registrations */ 1504 1505 1506if ($("form#MinistryRegForm").length > 0) { 1507 1508 if ($('#dob').length > 0) { 1509 $('#dob').datepicker({ 1510 format: "dd-mm-yyyy", 1511 autoclose: true, 1512 todayHighlight: true 1513 }); 1514 $('.creload').on('click', function() { 1515 var mySrc = $(this).prev().attr('src'); 1516 var glue = '?'; 1517 if (mySrc.indexOf('?') != -1) { 1518 glue = '&'; 1519 }
1520 $(this).prev().attr('src', mySrc + glue + new Date().getTime()); 1521 return false; 1522 }); 1523 } 1524 1525 //other text validation 1526 $.validator.addMethod("otherstextval", function(value, element) { 1527 var dept_id = $('#dept_id').val(); 1528 if (dept_id == "Others") { 1529 var val = $('input#others').val(); 1530 if (val == "") { 1531 return false; 1532 } else { 1533 return true; 1534 } 1535 } else { 1536 return true; 1537 } 1538 }, "Plase enter department/organization name."); 1539 1540 $("#MinistryRegForm").validate({ 1541 //errorClass: 'error alert alert-danger', 1542 rules: { 1543 organization_type: { 1544 required: true, 1545 }, 1546 ministry_id: { 1547 required: true, 1548 }, 1549 others: { 1550 otherstextval: true 1551 }, 1552 first_name: { 1553 required: true, 1554 minlength: 3, 1555 maxlength: 100 1556 }, 1557 last_name: { 1558 required: true, 1559 minlength: 3, 1560 maxlength: 100 1561 }, 1562 user_email: { 1563 required: true, 1564 email: true 1565 }, 1566 user_phone: { 1567 required: true, 1568 digits: true, 1569 minlength: 10, 1570 maxlength: 10 1571 }, 1572 employee_id: { 1573 required: true, 1574 }, 1575 aadhar_no: { 1576 required: true, 1577 digits: true, 1578 minlength: 12, 1579 maxlength: 12 1580 }, 1581 authority_designation: { 1582 required: true, 1583 minlength: 3, 1584 maxlength: 100 1585 }, 1586 authority_name: { 1587 required: true, 1588 minlength: 3, 1589 maxlength: 100 1590 }, 1591 authority_email: { 1592 required: true, 1593 email: true 1594 }, 1595 authority_mobile: { 1596 digits: true, 1597 minlength: 10, 1598 maxlength: 10 1599 }, 1600 address: { 1601 required: true, 1602 minlength: 3, 1603 maxlength: 100 1604 }, 1605 state_id: { 1606 required: true 1607 }, 1608 zip: { 1609 required: true, 1610 digits: true, 1611 minlength: 6, 1612 maxlength: 6 1613 }, 1614 user_password: { 1615 required: true, 1616 minlength: 5, 1617 maxlength: 35 1618 }, 1619 confirm_password: { 1620 required: true, 1621 minlength: 5, 1622 maxlength: 35, 1623 equalTo: "#user_password" 1624 }, 1625 'data[User][security_code]': { 1626 required: true 1627 } 1628 }, 1629 messages: { 1630 organization_type: { 1631 required: "Please select organization type." 1632 }, 1633 ministry_id: { 1634 required: "Please select ministry." 1635 }, 1636 first_name: { 1637 required: "Please enter first name.", 1638 minlength: "First name should be 3 - 100 characters long.", 1639 maxlength: "First name should be 3 - 100 characters long." 1640 }, 1641 last_name: { 1642 required: "Please enter last name.", 1643 minlength: "Last name should be 3 - 100 characters long.", 1644 maxlength: "Last name should be 3 - 100 characters long." 1645 }, 1646 user_email: { 1647 required: "Please enter email.", 1648 email: "Please enter a valid email address." 1649 }, 1650 user_phone: { 1651 required: "Please enter mobile.", 1652 digits: "Mobile Number should be numeric.", 1653 minlength: "Mobile Number should be 10 digits long.", 1654 maxlength: "Mobile Number should be 10 digits long." 1655 }, 1656 employee_id: { 1657 required: "Please enter employee id.", 1658 }, 1659 aadhar_no: { 1660 required: "Please enter aadhar no.", 1661 digits: "Please enter valid aadhar no.", 1662 minlength: "Aadhar no must be 12 digit long.", 1663 maxlength: "Aadhar no must be 12 digit long." 1664 }, 1665 authority_designation: { 1666 required: "Please enter authority designation.", 1667 minlength: "Authority Designation should be 3 - 100 characters long.", 1668 maxlength: "Authority Designation should be 3 - 100 characters long." 1669 }, 1670 authority_name: { 1671 required: "Please enter authority name.", 1672 minlength: "Authority name should be 3 - 100 characters long.", 1673 maxlength: "Authority name should be 3 - 100 characters long." 1674 }, 1675 authority_email: { 1676 required: "Please enter authority email.", 1677 email: "Please enter a valid authority email address." 1678 }, 1679 authority_mobile: { 1680 digits: "Mobile Number should be numeric.", 1681 minlength: "Mobile Number should be 10 digits long.", 1682 maxlength: "Mobile Number should be 10 digits long." 1683 }, 1684 address: { 1685 required: "Please enter address.", 1686 minlength: "address should be 3 - 100 characters long.", 1687 maxlength: "address should be 3 - 100 characters long." 1688 }, 1689 state_id: { 1690 required: "Please select state." 1691 }, 1692 zip: { 1693 required: "Please enter pin code.", 1694 digits: "Pin code should be numeric.", 1695 minlength: "Pin code should be 6 digits long.", 1696 maxlength: "Pin code should be 6 digits long." 1697 }, 1698 user_password: { 1699 required: "Please enter password.", 1700 minlength: "Password should be 5 - 35 characters long.", 1701 maxlength: "Password should be 5 - 35 characters long." 1702 }, 1703 confirm_password: { 1704 required: "Please enter confirm password.", 1705 minlength: "Confirm Password should be 5 - 35 characters long.", 1706 maxlength: "Confirm Password should be 5 - 35 characters long.", 1707 equalTo: "Password does not matched with confirm password." 1708 }, 1709 'data[User][security_code]': { 1710 required: "Please enter security code.", 1711 } 1712 } 1713 }); 1714 1715 //fetch department name 1716 $("#dept_id").change(function() { 1717 var dept_id = $("#dept_id").val(); 1718 1719 if (dept_id == "Others") {
1720 //get department name from ajax load 1721 $("#regothers").show(); 1722 } else if (dept_id != "" && dept_id != "Others") { 1723 1724 $("#regothers").hide(); 1725 var rand_no = Math.random() * (9999 - 100) + 100; 1726 $.ajax({ 1727 url: rootDir + "ministries/fetch_ministries_name", 1728 data: "min_id=" + dept_id + "&rand_no=" + rand_no, 1729 type: "post", 1730 async: false, 1731 success: function(result) { 1732 if (result) { 1733 //get department name from ajax load 1734 $("#deparment_name").val(result); 1735 } 1736 } 1737 }); 1738 } else { 1739 $("#deparment_name").val(""); 1740 $("#regothers").hide(); 1741 } 1742 }); 1743 //onblure function in others text 1744 $("input#others").blur(function() { 1745 var otherstext = $("input#others").val(); 1746 $("input#deparment_name").val(otherstext); 1747 }); 1748} 1749 1750/* display task details on website */ 1751$('.task_details_link').click(function(e) { 1752 1753 var task_id = $(this).attr('rel'); 1754 var rand_no = Math.random() * (9999 - 100) + 100; 1755 $.ajax({ 1756 url: "/taskupdates/task_details", 1757 data: "task_id=" + task_id + "&rand_no=" + rand_no, 1758 type: "post", 1759 async: false, 1760 success: function(result) { 1761 if (result) { 1762 $('#taskdetailModal').modal(); 1763 1764 $('.modal-content').html(result); 1765 } 1766 } 1767 }); 1768}); 1769 1770$("#MinistriesForm #skill_id").click(function() { 1771 $('#area_interest_id').get(0).selectedIndex = 0; 1772 $('#state_id').get(0).selectedIndex = 0; 1773}); 1774$("#MinistriesForm #area_interest_id").click(function() { 1775 $('#skill_id').get(0).selectedIndex = 0; 1776 $('#state_id').get(0).selectedIndex = 0; 1777}); 1778$("#MinistriesForm #state_id").click(function() { 1779 $('#skill_id').get(0).selectedIndex = 0; 1780 $('#area_interest_id').get(0).selectedIndex = 0; 1781}); 1782 1783$("#PagesVolunteerListForm #skill_id").click(function() { 1784 $('#area_interest_id').get(0).selectedIndex = 0; 1785 $('#state_id').get(0).selectedIndex = 0; 1786}); 1787$("#PagesVolunteerListForm #area_interest_id").click(function() { 1788 $('#skill_id').get(0).selectedIndex = 0; 1789 $('#state_id').get(0).selectedIndex = 0; 1790}); 1791$("#PagesVolunteerListForm #state_id").click(function() { 1792 $('#skill_id').get(0).selectedIndex = 0; 1793 $('#area_interest_id').get(0).selectedIndex = 0; 1794}); 1795 1796/* coding for start new comments */ 1797$("#btnaskques").click(function() { 1798 1799 var description = $("textarea#description").val(); 1800 if (description.trim() == "") { 1801 $("div#query_msg").html('<div class="alert alert-danger">Please enter a question.</div>'); 1802 return false; 1803 } else { 1804 var str = $("form#queryfrom").serialize(); 1805 var randNumber = Math.floor((Math.random() * 10000000) + 10000); 1806 $.ajax({ 1807 url: rootDir + 'discussions/askaques', 1808 data: str + "&rand=" + randNumber, 1809 type: "POST", 1810 beforeSend: function() { 1811 //$('div.showStatus').html('<img src= "' + rootDir + 'img/loading.gif" />').show(200); 1812 }, 1813 success: function(result1) { 1814 if (result1) { 1815 if (result1 == "success") { 1816 $('textarea#description').val(''); 1817 $("div#query_msg").html('<div class="alert alert-success">Query has been successfully submitted.</div>'); 1818 } else { 1819 $("div#query_msg").html('<div class="alert alert-danger">Query has not been submitted.</div>'); 1820 } 1821 } 1822 } 1823 }); 1824 } 1825}); 1826/* display task details on website */ 1827$('.task_details_polls').click(function(e) { 1828 var task_id = $(this).attr('rel'); 1829 $('#taskdetailModal').modal(); 1830 var rand_no = Math.random() * (9999 - 100) + 100; 1831 $.ajax({ 1832 url: rootDir + "polls/task_details", 1833 data: "task_id=" + task_id + "&rand_no=" + rand_no, 1834 type: "post", 1835 async: false, 1836 success: function(result) { 1837 if (result) { 1838 $('.modal-content').html(result); 1839 } 1840 } 1841 }); 1842}); 1843 1844function task_details_polls(val){ 1845 var task_id = 'poll_option'+val; 1846 $('#taskdetailModal').modal(); 1847 var rand_no = Math.random() * (9999 - 100) + 100; 1848 $.ajax({ 1849 url: rootDir + "polls/task_details",
1850 data: "task_id=" + task_id + "&rand_no=" + rand_no, 1851 type: "post", 1852 async: false, 1853 success: function(result) { 1854 if (result) { 1855 $('.modal-content').html(result); 1856 } 1857 } 1858 }); 1859} 1860 1861 1862//on tab click in index page of task 1863 $(".show_user").click(function() { 1864 var stats = $(this).attr('rel'); 1865 //alert(stats); 1866 if(stats=='Reject'){ 1867 window.location = rootDir+"users/ministryrequestlistreject"; 1868 } 1869 if(stats=='Accept'){ 1870 window.location = rootDir+"users/ministryrequestlistaccept"; 1871 } 1872 if(stats=='Request'){ 1873 window.location = rootDir+"users/ministryrequestlist"; 1874 } 1875 if(stats=='Deleted'){ 1876 window.location = rootDir+"users/ministryrequestlistdelete"; 1877 } 1878 1879}); 1880 1881function verify_email(){ 1882 $.ajax({ 1883 url: rootDir + "pages/resendemail", 1884 type: "post", 1885 success: function (result) { 1886 var dataobj = $.parseJSON(result); 1887 console.log(dataobj); 1888 if (dataobj.status===true) { 1889 1890 $('#verfylink').parent().before('<p class="m-t-10 text-center text-success">Email send Successfully<p>'); 1891 setTimeout(function () { 1892 location.reload(true); 1893 }, 3000); 1894 }else{ 1895 $('#verfylink').parent().before('<p class="m-t-10 text-center text-danger">'+dataobj.message+'<p>'); 1896 setTimeout(function () { 1897 location.reload(true); 1898 }, 3000); 1899 } 1900 } 1901 }); 1902} 1903 1904function authorityverify_email(){ 1905 $.ajax({ 1906 url: rootDir + "pages/authority_resendemail", 1907 type: "post", 1908 success: function (result) { 1909 if (result) { 1910 $('#verfylink1').parent().before('<p class="m-t-10 text-center text-success">Email send Successfully<p>'); 1911 setTimeout(function () { 1912 location.reload(true); 1913 }, 2000); 1914 } 1915 } 1916 }); 1917} 1918 1919window.addEventListener("load", function () { 1920 var loader = document.getElementById("loader"); 1921 if(typeof loader !== 'undefined' && loader !== null) { 1922 loader.style.display =Â "none"; 1923 } 1924}); 1925 1926 1927//on tab click in index page of interjship 1928$(".show_task_internship").click(function () { 1929 var stats = $(this).attr("rel"); 1930 setTimeout(function () { 1931 $.ajax({ 1932 url: rootDir + "internship/taskListing", 1933 data: "stats=" + stats, 1934 type: "post", 1935 async: false, 1936 before: function () {}, 1937 success: function (result) { 1938 $("div#" + stats + " .load") 1939 .delay(2000) 1940 .hide(0); 1941 if (result) { 1942 $("div#" + stats).html(result); 1943 } 1944 }, 1945 complete: function () { 1946 $('[data-toggle="popover"]').popover(); 1947 1948 //END Task Submit 1949 }, 1950 }); 1951 }, 1000); 1952}); 1953 1954 1955function fetchUdyamData(udyam_contact, udyam_no) { 1956 $.ajax({ 1957 url: rootDir + "ministries/fetch_udyam_data", 1958 data: "mobileNumber=" + udyam_contact + "&udyamNumber=" + udyam_no, 1959 type: "post", 1960 async: false, 1961 success: function (result) { 1962 $('#loader2').hide(); 1963 $('#overlay').hide(); 1964 1965 var responseObject = JSON.parse(result); 1966 if(responseObject.res_status == 200){ 1967 1968 $("#organization_name").val(responseObject.res_data.IssuedTo.Enterprise['@attributes'].name); 1969 $("#organization_name").prop( "readonly", true ); 1970 1971 // Get address fields 1972 var flatDoorBlockNo = responseObject.res_data.IssuedTo.Enterprise.Address['@attributes'].flatDoorBlockNo; 1973 var nameOfPremisesBuilding = responseObject.res_data.IssuedTo.Enterprise.Address['@attributes'].nameOfPremisesBuilding;
1974 var roadStreetLane = responseObject.res_data.IssuedTo.Enterprise.Address['@attributes'].roadStreetLane; 1975 var block = responseObject.res_data.IssuedTo.Enterprise.Address['@attributes'].block; 1976 1977 // Concatenate non-empty address fields 1978 var address = [flatDoorBlockNo, nameOfPremisesBuilding, roadStreetLane, block] 1979 .filter(Boolean) 1980 .join(", "); 1981 1982 $("#addressnew").val(address); 1983 $("#addressnew").prop( "readonly", true ); 1984 1985 $("#zip").val(responseObject.res_data.IssuedTo.Enterprise.Address['@attributes'].pin); 1986 $("#zip").prop( "readonly", true ); 1987 1988 var org_state = $.trim(responseObject.res_data.IssuedTo.Enterprise.Address['@attributes'].state.toLowerCase()); 1989 var state = ''; 1990 1991 $('#state_id option').each(function() { 1992 state = $.trim($(this).text().toLowerCase()); 1993 if (state == org_state) { 1994 $(this).prop('selected', true); 1995 fetchState($(this).val()); 1996 } else { 1997 $(this).prop('disabled', true); 1998 } 1999 }); 2000 } else { 2001 if(responseObject.desc == ''){ 2002 $('#loader2').hide(); 2003 $('#overlay').hide(); 2004 2005 $("#organization_name").val(''); 2006 $("#organization_name").prop( "readonly", false); 2007 2008 $("#addressnew").val(''); 2009 $("#addressnew").prop( "readonly", false); 2010 2011 $("#zip").val(''); 2012 $("#zip").prop( "readonly", false); 2013 2014 document.getElementById('udyam_contact-error').style.display = 'none'; 2015 $('#organization_name-error').html('The Udyam service is down. Please try again later!'); 2016 document.getElementById('organization_name-error').style.display = 'block'; 2017 } else { 2018 $('#loader2').hide(); 2019 $('#overlay').hide(); 2020 $('#udyam_org').hide(); 2021 2022 $("#organization_name").val(''); 2023 $("#organization_name").prop( "readonly", false); 2024 2025 $("#addressnew").val(''); 2026 $("#addressnew").prop( "readonly", false); 2027 2028 $("#zip").val(''); 2029 $("#zip").prop( "readonly", false); 2030 2031 document.getElementById('udyam_contact-error').style.display = 'none'; 2032 $('#organization_name-error').html(responseObject.desc); 2033 document.getElementById('organization_name-error').style.display = 'block'; 2034 } 2035 } 2036 }, 2037 error: function() { 2038 $('#loader2').hide(); 2039 $('#overlay').hide(); 2040 } 2041 }); 2042} 2043 2044 2045function addTaskState(val){ 2046 var task_type = $("#task_type").val(); 2047 if(task_type == 'Offline'){ 2048 $("#area_specific").attr("checked", true); 2049 $("#area_specific").attr("readonly", true); 2050 2051 fetchState(val); 2052 } 2053 else { 2054 $("#area_specific").attr("checked", false); 2055 $("#area_specific").attr("readonly", true); 2056 2057 fetchState(val); 2058 } 2059} 2060 2061/*function withdraw_interest($task_id,$user_id){ 2062 $.ajax({ 2063 url: rootDir + "Internship/withdrawinterest", 2064 data: "user_id=" + $user_id + "&task_id=" + $task_id, 2065 type: "post", 2066 async: false, 2067 before: function() { 2068 $('a.withdraw_interest').attr('disabled', 'disabled'); 2069 }, 2070 success: function(result) { 2071 console.log(result); 2072 button.disabled = true; 2073 } 2074 }); 2075}*/ 2076 2077/*Function for setting flag for yuva registration */ 2078function update_reg_state(reg_state, reg_transaction, code_challenge, code_verifier) { 2079 code_challenge = code_challenge || ''; 2080 code_verifier = code_verifier || ''; 2081 if (reg_state == "" || reg_transaction == "") { 2082 return false; 2083 } else { 2084 $('div#loader2').css('display','block'); 2085 $('div#overlay').css('display','block'); 2086 /*$.ajax({ 2087 url: rootDir + "pages/update_reg_state", 2088 data: "state=" + reg_state + "&transactionId=" + reg_transaction + "&code_challenge=" + code_challenge + "&code_verifier=" + code_verifier, 2089 type: "post", 2090 async: false, 2091 success: function() { 2092 return true; 2093 } 2094 });*/ 2095 } 2096} 2097 2098/*Function for loading profile picture */ 2099function load_profile_pic(custom_default_image = 'https://img1.digitallocker.gov.in/digiyua/assets/img/yuva/profile_new_design1.png'){ 2100 2101 $('.profileimage').each(function (i, obj) { 2102 var imgname = $(obj).attr('imgname'); 2103 if (imgname != '') { 2104 $.ajax({ 2105 type: "POST", 2106 url: rootDir + "pages/getS3Image", 2107 data: { filename: imgname, dir: 'users', custom_default_image: custom_default_image }, 2108 success: function (response) { 2109 // $(obj).css('width', '100%'); 2110 $(obj).attr('src', response) 2111 }, 2112 error: function (xhr, status, error) { 2113 console.error("Error: " + error); 2114 } 2115 }); 2116 } else { 2117 $(obj).attr('src', custom_default_image); 2118 } 2119 }); 2120} 2121// JavaScript library for WebSocket connection and handling 2122function connect_websocket(transaction_id, websocketUrl) { 2123 let socket; 2124 let isReconnecting = false; // Flag to track reconnection attempts 2125 let isConnected = false; // Flag to track if the socket is connected 2126 2127 // Create a promise that resolves when the notification is received 2128 const notificationPromise = new Promise((resolve, reject) => { 2129 // Function to initialize the WebSocket connection 2130 function initializeSocket() { 2131 socket = io(websocketUrl, { 2132 query: { transaction_id: transaction_id }, 2133 reconnection: false, // Disable automatic reconnection by socket.io 2134 }); 2135 2136 // Handle successful connection 2137 socket.on('connect', () => { 2138 console.log('Connected to WebSocket server'); 2139 isReconnecting = false; // Reset the reconnection flag on successful connection 2140 isConnected = true; // Set the connected flag 2141 }); 2142 2143 // Handle incoming notifications 2144 socket.on('notification', (data) => { 2145 console.log('RECEIVED SOCKET NOTIFICATION:', data); 2146 if (data && data.data) { 2147 resolve(data.data); // Resolve the promise with the notification data 2148 } else { 2149 reject('Invalid data received');
2149 // Reject if the data is invalid 2150 } 2151 }); 2152 2153 // Handle disconnection and initiate reconnection logic 2154 socket.on('disconnect', (reason) => { 2155 console.log('Disconnected from server:', reason); 2156 isConnected = false; // Reset the connected flag 2157 if (!isReconnecting) { 2158 isReconnecting = true; // Set the reconnection flag 2159 if (reason === 'io client disconnect') { 2160 console.log('WebSocket connection closed from client'); 2161 } else { 2162 setTimeout(() => { 2163 if (!isConnected) { // Check if still disconnected before reconnecting 2164 socket.connect(); // Attempt to reconnect after a delay 2165 } 2166 }, 1000); // Adjust the delay as needed 2167 } 2168 } 2169 }); 2170 2171 // Handle errors and initiate reconnection logic 2172 socket.on('error', (error) => { 2173 console.error('WebSocket error:', error); 2174 if (!isReconnecting) { 2175 isReconnecting = true; // Set the reconnection flag 2176 reconnectSocket(); 2177 } 2178 reject(error); // Reject the promise with the error 2179 }); 2180 2181 // Handle connection errors and initiate reconnection logic 2182 socket.on('connect_error', (error) => { 2183 console.log('Connection error:', error); 2184 if (!isReconnecting && !isConnected) { // Only attempt to reconnect if not connected 2185 isReconnecting = true; // Set the reconnection flag 2186 setTimeout(() => { 2187 if (!isConnected) { // Check if still disconnected before reconnecting 2188 socket.connect(); // Attempt to reconnect after a delay 2189 } 2190 }, 1000); // Adjust the delay as needed 2191 } 2192 }); 2193 2194 // Handle reconnection attempts 2195 socket.on('reconnect_attempt', () => { 2196 console.log('Attempting to reconnect to WebSocket server'); 2197 }); 2198 } 2199 2200 // Initial connection attempt 2201 initializeSocket(); 2202 }); 2203 2204 return { socket, notificationPromise }; 2205} 2206 2207// Function to disconnect WebSocket 2208function disconnect_websocket(socket) { 2209 if (socket && socket.connected) { 2210 socket.io.opts.reconnection = false; // Disable automatic reconnection 2211 socket.disconnect(); 2212 console.log('WebSocket connection closed'); 2213 } 2214} 2215 2216 2217/** 2218 * @author Anjali Bhatt 2219 * @desc This function compresses an image file using HTML5 Canvas. 2220 * It reads the file, creates an image object, resizes the image if necessary, 2221 * draws it on a canvas, and compresses it to a specified quality. 2222 * The function then converts the compressed image to a Blob and returns it via a callback. 2223 * This is useful for reducing image file sizes before upload or processing. 2224 * @param {File} file - The image file to be compressed 2225 * @param {number} maxWidth - The maximum width allowed for the compressed image 2226 * @param {number} maxHeight - The maximum height allowed for the compressed image 2227 * @param {number} quality - The quality of the compressed image (0 to 1) 2228 * @param {function} complete - Callback function to handle the compressed image file 2229 * @returns {void} 2230 * 2231 */ 2232function compressImageInCanvas(file,maxWidth,maxHeight,quality,complete) { 2233 // Create a FileReader to read the input file 2234 var reader = new FileReader(); 2235 // Set up the FileReader onload event handler 2236 reader.onload = function(e) { 2237 // Create an Image object to hold the loaded image data 2238 var img = new Image(); 2239 img.src = URL.createObjectURL(file); 2240 img.name = file.name; 2241 // Set up the image onload event handler 2242 img.onload = function() { 2243 // Create a canvas element for image manipulation 2244 const canvas = document.createElement('canvas'); 2245 let newWidth = img.width;
2246 let newHeight = img.height; 2247 // Resize the image if it exceeds maxWidth or maxHeight 2248 if (newWidth > maxWidth || newHeight > maxHeight) { 2249 const aspectRatio = newWidth / newHeight; 2250 if (aspectRatio > 1) { 2251 newWidth = maxWidth; 2252 newHeight = maxWidth / aspectRatio; 2253 } else { 2254 newHeight = maxHeight; 2255 newWidth = maxHeight * aspectRatio; 2256 } 2257 } 2258 // Set canvas dimensions to the new image size 2259 canvas.width = newWidth; 2260 canvas.height = newHeight; 2261 // Draw the resized image on the canvas 2262 const ctx = canvas.getContext('2d'); 2263 ctx.drawImage(img, 0, 0, canvas.width, canvas.height); 2264 // Convert the canvas content to a data URL with specified quality 2265 var dataUrl = canvas.toDataURL('image/jpeg', quality); 2266 // Convert the data URL to a Blob 2267 var arr = dataUrl.split(','), mime = arr[0].match(/:(.*?);/)[1], 2268 bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n); 2269 while(n--){ 2270 u8arr[n] = bstr.charCodeAt(n); 2271 } 2272 var dataBlob = new Blob([u8arr], {type:mime}); 2273 // Create a new File object from the Blob 2274 let compressedFile = new File([dataBlob], img.name, { type: 'image/jpeg' }); 2275 // Call the complete callback with the compressed file 2276 complete(compressedFile); 2277 }; 2278 } 2279 // Start reading the file as a data URL 2280 reader.readAsDataURL(file); 2281} 2282//defence 2283function setSessionAndRedirectOnBannerclick() { 2284 sessionStorage.setItem("defence_banner", "clicked"); 2285 window.location.href = "/pages/yuva_register"; 2286} 2287 2288function sanitizeString(s, html = false) { 2289 s = String(s ?? ''); 2290 if (html) { 2291 const a = /^(p|br|strong|b|em|i|u|s|strike|a|ol|ul|li|h1|h2|h3|h4|h5|h6|blockquote|pre|code|span)$/i; 2292 const d = new DOMParser().parseFromString(s, 'text/html'); 2293 d.body.querySelectorAll('*').forEach(e => { 2294 if (!a.test(e.tagName)) return e.remove(); 2295 [...e.attributes].forEach(t => { 2296 const n = t.name.toLowerCase(), v = t.value.trim(); 2297 if (n.startsWith('on') || (n === 'href' && !/^(https?:|mailto:|tel:)/i.test(v)) || (n !== 'href' && n !== 'class' && n !== 'style')) e.removeAttribute(t.name); 2298 }); 2299 }); 2300 return d.body.innerHTML; 2301 } 2302 return s 2303 .replace(/&/g, '&') 2304 .replace(/</g, '<') 2305 .replace(/>/g, '>') 2306 .replace(/"/g, '"') 2307 .replace(/'/g, '''); 2308} 2309 2310// Firebase 2311 2312if (typeof encodeIdentifier === "undefined") { 2313 function encodeIdentifier(value) { 2314 if (value === undefined || value === null || value === "") return ""; 2315 return btoa(`ID-${value}`); 2316 } 2317} 2318//quize_dashboard 2319 2320function fetchDistrict(state_id) { 2321 if (state_id == "") { 2322 return false; 2323 } else { 2324 $.ajax({ 2325 url: rootDir + "cities/fetch_district", 2326 data: "state_id=" + state_id, 2327 type: "post", 2328 async: false, 2329 beforeSend: function () { 2330 $("div.ajaxloder").css('display', 'block'); 2331 }, 2332 success: function (result) { 2333 if (result) { 2334 $("select#ulb").html( 2335 "<option value='' selected> - - - Select Local Body - - - </option>" 2336 ); 2337 2338 $("select#block").html( 2339 "<option value='' selected> - - - Select Block - - - </option>" 2340 ); 2341 2342 $("select#panchayat").html( 2343 "<option value='' selected> - - - Select Panchayat - - - </option>" 2344 ); 2345 2346 $("select#village").html( 2347 "<option value='' selected> - - - Select Village - - - </option>" 2348 ); 2349 2350 $("select#district").html(result); 2351 } 2352 }, 2353 complete: function () { 2354 $("div.ajaxloder").hide(); 2355 }, 2356 }); 2357 } 2358}
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.