1jQuery(document).ready(function() { 2 3/* ********************** Admin *********************** */ 4 5/////add new page 6 7 8/////slideToggle create page block 9 $('.add-pages').click(function() { 10 11 $('.new-page').stop(true, true).slideToggle(); 12 }); 13 14///////add db 15 16 $('.add, .save').click(function() { 17 var pageTitle = $('.page-title').val(); 18 var pageContent = CKEDITOR.instances.page_content.getData(); 19 20 if (pageTitle != '' && pageContent != '') { 21 22 return true; 23 } else { 24 alert('Fill all fields'); 25 return false; 26 } 27 }); 28 29/////// page delete 30 $('body').on('click','.page-delete', function() { 31 var pageId = $(this).closest('.page_cols').find('td:eq(0) span').text(); 32 33 if(confirm('Delete page?')) 34 window.location.href = baseUrl + 'admin/pages/delete/' + pageId; 35 }); 36 37///// serie delete 38 39 $('body').on('click', '.serie-delete-btn', function() { 40 41 var serieId = $(this).attr('rel'); 42 43 if(confirm('By removing a serie, it will remove all its episodes as well \n\nAre you sure you want to proceed this operation?')) 44 window.location.href = baseUrl + 'admin/series/delete/' + serieId ; 45 }); 46 47///// episode delete 48 49 $('body').on('click', '.delete-episode', function() { 50 51 var episodeId = $(this).attr('rel'); 52 var url = window.location.href; 53 url = url.split('/'); 54 //console.log(url[6] + ' ' + url[7]) 55 56 if(confirm('Delete episode?')) 57 window.location.href = baseUrl + 'admin/episodes/delete/' + episodeId + '/' + url[6] + '/' + url[7] ; 58 }); 59 60 /////episode actors slideToggle 61 62 63 $('.actors-toggle').click(function() { 64 65 if($(this).hasClass('glyphicon-chevron-down')) { 66 67 $(this).removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up'); 68 $('.actor-content').slideDown(); 69 } else { 70 var actorVal = true; 71 $('.actor-name').each(function() { 72 if($(this).val() == '') { 73 alert('Actor name can not be empty!'); 74 actorVal = false; 75 return false; 76 } else { 77 actorVal = true; 78 } 79 }); 80 81 if (actorVal) { 82 $(this).removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down'); 83 $('.actor-content').slideUp(); 84 } 85 } 86 }); 87 88 $('.save-episode').click(function() { 89 var episodeName = $('.episode-name').val(); 90 var actor = $('.actor-name').val(); 91 92 if(episodeName == '') { 93 94 alert('Episode name can not be empty!'); 95 return false; 96 } 97 98 $('.actor-name').each(function() { 99 if($(this).val() == '') { 100 alert('Actor name can not be empty!'); 101 return false; 102 } 103 104 }); 105 return true; 106 }); 107 108 $('.add-actor-btn').click(function() { 109 110 $('.actorName').val(''); 111 $('.airDate').val(''); 112 $('.actorAbout').val(''); 113 }); 114 115 ////add actor 116 actors_stringify = {}; 117 $('.addActor').click(function() { 118 119 var actorName = $(this).closest('#myModal').find('.actorName').val(); 120 var airDate = $(this).closest('#myModal').find('.airDate').val(); 121 var actorAbout = $(this).closest('#myModal').find('.actorAbout').val(); 122 123 if (actorName != '') { 124 console.log(actorName + ' | ' + airDate + ' | ' + actorAbout); 125 var html = ''; 126 127 html += '<div style="margin-bottom: 10px;" class="actor-parent"><span class="label label-primary actor-block" data-actor="' + actorName + '" data-airdate="' + airDate + '" data-about="' + actorAbout + '">' + actorName + '<button type="button" class="close"><span style="padding-left: 10px;">Ã</span></button></span></div>'; 128 129 $('.actor-content').append(html); 130 actors_stringify[(actorName + '|' + airDate + '|' + actorAbout).trim()] = (actorName + '|' + airDate + '|' + actorAbout).trim(); 131 $('.no-actor').hide(); 132 $('.actors-string').val(JSON.stringify(actors_stringify)); 133 $('#myModal').modal('hide'); 134 } 135 else { 136 alert('Please fill "Actor Name" field'); 137 } 138 }); 139 140 ////pares actors 141 142 $('.parse-btn').click(function() { 143 144 $('.actors-text').val(''); 145 }); 146 147 148 $('.parse-actors').click(function() { 149 150 var actorsText = $(this).closest('.modal-content').find('.actors-text').val(); 151 152 if (actorsText != '') { 153
154 var actors = actorsText.match(/[\w\s\.]+(\((.*?)\))*/g); 155 console.log(actors) 156 // alert(actors.indexOf('.')) 157 158 // if(actors.indexOf('.') != -1) { 159 // alert(); 160 // } 161 162 var html = ''; 163 164 for(var i = 0; i < actors.length; i++) { 165 166 if(actors[i].indexOf('.') != -1) { 167 actors[i] = actors[i].replace('.', ''); 168 } 169 170 html += '<div style="margin-bottom: 10px;" class="actor-parent"><span class="label label-primary actor-block" data-actor="' + actors[i] + '" data-airdate="" data-about="">' + actors[i] + '<button type="button" class="close"><span style="padding-left: 10px;">Ã</span></button></span></div>'; 171 actors_stringify[(actors[i] + '||').trim()] = (actors[i] + '||').trim(); 172 } 173 174 $('.actor-content').append(html); 175 176 $('.actors-string').val(JSON.stringify(actors_stringify)); 177 178 $('.no-actor').hide(); 179 180 $('#myModal2').modal('hide'); 181 } 182 else { 183 alert('"Actors" field not be empty'); 184 } 185 }); 186 187 /////delete new actor 188 189 $('body').on('click', '.close', function(e) { 190 191 var actor = $(this).closest('.actor-parent').find('.actor-block').attr('data-actor'); 192 var airDate = $(this).closest('.actor-parent').find('.actor-block').attr('data-airdate'); 193 var about = $(this).closest('.actor-parent').find('.actor-block').attr('data-about'); 194 195 var index = (actor + '|' + airDate + '|' + about).trim(); 196 197 delete actors_stringify[index]; 198 199 $(this).closest('.actor-parent').remove(); 200 201 $('.actors-string').val(JSON.stringify(actors_stringify)); 202 203 if($('.actor-parent').length == 0) { 204 $('.no-actor').show(); 205 } 206 console.log(actors_stringify); 207 }); 208 209 ////////actor delete 210 211 $('body').on('click', '.actor-delete', function() { 212 var actorId = $(this).next('.row').attr('data-id'); 213 var url = window.location.href; 214 url = url.split('/'); 215 216 if(confirm('Detach actor?')) 217 window.location.href = baseUrl + 'admin/episodes/delete_actor/' + actorId + '/' + url[6] + '/' + url[7] + '/' + url[8]; 218 }); 219 220 221 //////show actor otrcat 222 223 $('body').on('click', '.avatar-checkbox', function(e){ 224 225 if($(this).hasClass('actor-checked')) { 226 $('.actor-label-avatar').hide(); 227 $('.actor-label-otrcat').show(); 228 $(this).removeClass('actor-checked'); 229 } 230 else { 231 $('.actor-label-avatar').show(); 232 $('.actor-label-otrcat').hide(); 233 $(this).addClass('actor-checked'); 234 } 235 }); 236 237 $('body').on('click', '.img-actors', function() { 238 239 $('.img-actors').removeClass('checked'); 240 $(this).addClass('checked'); 241 }); 242 243 $('.save-cover-img').click(function() { 244 var imgSrc = $('.checked').val(); 245 246 if(imgSrc) { 247 $('.actor-cover-img').val(imgSrc); 248 } 249 250 $('#cover-img').modal('hide'); 251 }); 252 253 ///////display page 254 $('.display-page').change(function() { 255 var url = window.location.href; 256 if(url.indexOf('?') == -1) { 257 if(url.indexOf('display') == -1) { 258 url = url + '?display=' + $(this).val(); 259 } else { 260 url = url.replace(/display=[0-9]{2,3}/, 'display=' + $(this).val()); 261 } 262 } else { 263 if(url.indexOf('display') == -1) { 264 url = url + '&display=' + $(this).val(); 265 } else { 266 url = url.replace(/display=[0-9]{2,3}/, 'display=' + $(this).val()); 267 } 268 } 269 270 window.location.href = url; 271 }); 272 273 $('.filter-page').change(function() { 274 var url = window.location.href; 275 if(url.indexOf('?') == -1) {console.log(111) 276 if(url.indexOf('filter') == -1) { 277 url = url + '?filter=' + $(this).val(); 278 } else { 279 url = url.replace(/filter=[0-9]{1,3}/, 'filter=' + $(this).val()); 280 } 281 } else { 282 if(url.indexOf('filter') == -1) { 283 url = url + '&filter=' + $(this).val(); 284 } else { 285 url = url.replace(/filter=[0-9]{1,3}/, 'filter=' + $(this).val()); 286 } 287 } 288 289 window.location.href = url; 290 }); 291 292 // Set in use 293 $('.radio_use').click(function(){ 294 var radio = $(this).attr('rel'); 295 var series_id = $(this).attr('name').split('_').pop(); 296 297 $(this).attr('disabled', 'disabled'); 298 299 var _this = $(this); 300 301 $.ajax({ 302 url: baseUrl + 'admin/series/set_in_use', 303 type: 'post', 304 data: { 305 series_id: series_id, 306 radio: radio 307 }, 308 success: function(response) { 309 if(response == 'success') { 310 _this.removeAttr('disabled'); 311 _this.closest('tr').removeClass('danger'); 312 } 313 } 314 }); 315 316 }); 317 318 //////change user status 319 320 $('body').on('click', '.activated', function() { 321 322 var user_id = $(this).closest('.user_cols').find('.user_id').text(); 323 var activated = $(this).attr('rel'); 324 var message = ''; 325 if(activated == 1) { 326 message = 'active'; 327 328 } else { 329 message = 'inactive'; 330 } 331
332 if(confirm('This action will make user account ' + message + '\nAre you sure you want to continue?')) { 333 334 window.location.href = baseUrl + 'admin/users/status/' + user_id + '/' + activated; 335 } else { 336 return false; 337 } 338 339 }); 340 //////change user blacklist status 341 342 $('body').on('click', '.blacklisted', function() { 343 344 var user_id = $(this).closest('.user_cols').find('.user_id').text(); 345 var blacklisted = $(this).attr('rel'); 346 var message = ''; 347 if(blacklisted == 1) { 348 message = 'add user to'; 349 350 } else { 351 message = 'remove user from'; 352 } 353 354 if(confirm('This action will ' + message + ' blacklist \nAre you sure you want to continue?')) { 355 356 window.location.href = baseUrl + 'admin/users/blacklist/' + user_id + '/' + blacklisted; 357 } else { 358 return false; 359 } 360 361 }); 362 363 $('.covers-btn, .actor-covers-btn').click(function(e) { 364 e.preventDefault(); 365 if($(this).hasClass('covers-btn')) { 366 var otrcatLink = $('.otrcat-link').val(); 367 var segm = 'series'; 368 } 369 else { 370 var otrcatLink = $('.actor-otrcat-link').val(); 371 var segm = 'actors'; 372 } 373 374 $.ajax({ 375 376 url: baseUrl + 'admin/' + segm + '/get_cover_images', 377 type: 'post', 378 data: { 379 'otrcat_link': otrcatLink, 380 }, 381 success: function(data) { 382 383 var html = ''; 384 385 if(data != '') { 386 387 var coverSrc = data.split('|||'); 388 coverSrc.pop(); 389 390 if(coverSrc.length > 0) { 391 392 for(var i = 0; i < coverSrc.length; i++) { 393 394 html += '<div class="cover-img-block"><img src="' + coverSrc[i] + '" style="width: 250px; height: 250px;" /><input type="radio" name="cover_img" value="' + coverSrc[i] + '" class="form-control img-' + segm + '" style="margin: 0 auto; box-shadow: none"></div>' 395 } 396 } 397 } 398 else { 399 html += 'No cover images'; 400 } 401 402 $('#cover-img').modal({ 403 backdrop: 'static' 404 }); 405 406 $('.cover-img-body').html(html); 407 } 408 409 }); 410 }); 411 412 $('body').on('click', '.img-series', function() { 413 414 $('.img-series').removeClass('checked'); 415 $(this).addClass('checked'); 416 }); 417 418 $('.save-cover-img').click(function() { 419 var imgSrc = $('.checked').val(); 420 421 if(imgSrc) { 422 $('.series-cover-img').val(imgSrc); 423 } 424 425 $('#cover-img').modal('hide'); 426 }); 427 428 // $('.assistant-email').bind('change', function() { 429 430 // if($(this).val().indexOf('@') != -1) 431 // return; 432 433 // $('.assistant-name').val($(this).val()); 434 435 // if($('.assistant-password').val() == '') { 436 // $('.assistant-password').val(generatePassword()); 437 // } 438 439 // }); 440 441 $('.assistant-email').bind('paste', function() { 442 var element = this; 443 setTimeout(function () { 444 var email = $(element).val(); 445 console.log(email); 446 var position = email.indexOf('@'); 447 console.log(position); 448 if(position != -1) { 449 $('.assistant-name').val(email.substr(0, position)); 450 451 if($('.assistant-password').val() == '') { 452 $('.assistant-password').val(generatePassword()); 453 } 454 } 455 }, 100); 456 457 }); 458 459 $('.generate-password').click(function() { 460 461 $('.assistant-password').val(generatePassword()); 462 }); 463 464 $('.permission input[type=checkbox]').click(function() { 465 466 if($(this).hasClass('checked')) { 467 468 $(this).removeClass('checked'); 469 } 470 else { 471 472 $(this).addClass('checked'); 473 } 474 }); 475 476 $('.add-assistant').click(function() { 477 478 if($('.permission input.checked').length == 0) { 479 480 alert('At least one permission need to be given'); 481 return false; 482 } 483 484 return true; 485 }); 486 487 $('body').on('click', '.assistant-delete', function() { 488 489 var assistantId = $(this).closest('.page_cols').find('.as_id').text(); 490 491 if(confirm('Delete Assistant?')) { 492 493 window.location.href = baseUrl + 'admin/assistants/delete/' + assistantId; 494 } 495 496 }); 497 498 $('.save-actor-btn').click(function() { 499 500 if($('.save-actor-name').val() == '') { 501 502 alert('Actor name not be empty!'); 503 504 return false; 505 } 506 507 return true; 508 }); 509 510 $('body').on('click','.delete-actor-btn', function() { 511 512 var actor_id = $(this).closest('.actor_cols').find('.actor_id').text(); 513 514 if(confirm('Delete actor?')) { 515 516 window.location.href = baseUrl + 'admin/actors/delete/' + actor_id; 517 } 518 }); 519 520 $('body').on('click', '.mark-delete-actor input', function() { 521 522 if($(this).closest('.jumbotron').hasClass('jambatron-delete')) { 523 524 $(this).closest('.jumbotron').removeClass('jambatron-delete'); 525 } 526 else { 527 528 $(this).closest('.jumbotron').addClass('jambatron-delete'); 529 } 530 }); 531 532 533///// audit 534 $('#startAudit').click(function(){ 535 $(this).addClass('disabled'); 536 537 $('.progress-bar').fadeIn(); 538 539 var serie = allSeries.shift(); 540 541 startAudit(serie); 542 543 }); 544 545//////// prophylactics 546 547 $('#startProcess').click(function(){ 548 //console.log(seriesIds) 549 $(this).addClass('disabled'); 550 551 $('.progress').fadeIn(); 552 553 serieId = seriesIds.shift(); 554 //console.log(seriesIds) 555 proStart(serieId['series_id']); 556 }); 557 558 $('.all-series').click(function() { 559 $('tr.success').fadeIn(); 560 $('tr.danger').fadeIn(); 561 $('.resolve').fadeOut(); 562 }); 563 564 $('.good-series').click(function() { 565 $('tr.danger').fadeOut(); 566 $('tr.success').fadeIn(); 567 $('.resolve').fadeOut(); 568 }); 569 570 $('.bad-series').click(function() { 571 $('tr.success').fadeOut(); 572 $('tr.danger').fadeIn(); 573 $('.resolve').fadeIn(); 574 }); 575 576 $('.resolve').click(function() { 577 $('.danger').each(function() { 578 var row = $(this).find('.serie-row'); 579 var table = row.attr('data-table'); 580 var id = row.text(); 581 var _this = $(this); 582 $.ajax({ 583 url: baseUrl + 'admin/prophylactics/resolve', 584 type: 'post', 585 dataType: 'json', 586 data: { 587 'serie_id': id, 588 'table': table 589 }, 590 success: function(data) { 591 _this.removeClass('danger').addClass('success'); 592 } 593 }); 594 }); 595 }); 596 597 ///////////// comments 598 599 var comments_url = window.location.href; 600 601 if((comments_url.search('#serie') > 0) || (comments_url.search('#series') >
601 0)) { 602 603 setTimeout(function() { 604 $('.active').removeClass('active'); 605 $('.series').addClass('active'); 606 $('#series').addClass('active'); 607 }, 400); 608 } 609 610 if((comments_url.search('#episode') > 0) || (comments_url.search('#episodes') > 0)) { 611 612 setTimeout(function() { 613 $('.active').removeClass('active'); 614 $('.episodes').addClass('active'); 615 $('#episodes').addClass('active'); 616 }, 400); 617 } 618 619 //////////// serie/episode search 620 621 $('.term-type').click(function() { 622 $('.term-type').removeClass('active'); 623 $(this).addClass('active'); 624 $('.term-type-input').val($(this).attr('rel')); 625 }); 626 627 628 ////// reject report 629 630 $('.reject').click(function() { 631 632 var reportId = $(this).attr('rel'); 633 if(confirm('Reject report?')) { 634 window.location.href = baseUrl + 'admin/reports/reject/' + reportId; 635 } 636 return false; 637 }); 638 639/************************************* Front end ******************************************/ 640 641 var htmlWidth = $('html').width(); 642 643 if(htmlWidth <= 700) 644 $('.device-table tr').addClass('device-tr'); 645 else { 646 $('.device-table tr').removeClass('device-tr'); 647 } 648 649////////home btn 650 651 $('.home-btx').mouseover(function() { 652 if($('.homedet').css('display') == 'none') { 653 $('.linkcont').hide(); 654 $('.homedet').slideDown(200); 655 } 656 }); 657 658 ///////radio programs btn 659 660 $('.radio-pro-btn').mouseover(function() { 661 if($('.radiopro').css('display') == 'none') { 662 $('.linkcont').hide(); 663 $('.radiopro').slideDown(200); 664 } 665 }); 666 667 //////shows btn 668 669 $('.holiday-show-btn').mouseover(function() { 670 if($('.holidayshow').css('display') == 'none') { 671 $('.linkcont').hide(); 672 $('.holidayshow').slideDown(200); 673 } 674 }); 675 676 $( '.mobileRadioProgramsBtn' ).click(function() { 677 $( '.mobileRadioPrograms' ).toggle(); 678 }); 679 680 //////google search 681 682 $('.google-search').focus(function() { 683 $(this).css('background', 'none') 684 }); 685 686 $('.google-search').blur(function() { 687 if($(this).val() == '') { 688 $(this).css('background', 'url(https://www.google.com/cse/intl/en/images/google_custom_search_watermark.gif) 0% 50% no-repeat rgb(255, 255, 255)'); 689 } 690 }); 691 692 //////modal 693 $('.account-modal').click(function() { 694 $("#custom-modal").modal({ 695 fadeDuration: 150, 696 escapeClose: false, 697 clickClose: false, 698 }); 699 }); 700 701 $('.reg-btn').click(function() { 702 703 $('.modal-block').hide(); 704 $('.register').fadeIn(); 705 $('.footer-text, .close-text').removeClass('footer-text, close-text').addClass('footer-reg-text').html('<i class="fa fa-reply-all"></i> Back'); 706 $('.no-account-text').hide(); 707 }); 708 709 $('body').on('click', '.footer-reg-text', function() { 710 $('.modal-block').hide(); 711 $('.accounts').fadeIn(); 712 $(this).removeClass('footer-reg-text').addClass('footer-text').html(''); 713 }); 714 715 $('.reg').click(function() { 716 717 $("#custom-modal").modal({ 718 fadeDuration: 150, 719 escapeClose: false, 720 clickClose: false, 721 }); 722 }); 723 724 $('body').on('click', '.signin-btn', function() { 725 726 $('.accounts').hide(); 727 $('.signin').fadeIn(); 728 $('.footer-text, .close-text').removeClass('footer-text, close-text').addClass('footer-reg-text').html('<i class="fa fa-reply-all"></i> Back'); 729 $('.no-account-text').hide(); 730 731 }); 732 733 /////dropdown menu 734 $('.user-name').click(function() { 735 736 $('.dropdown-menu').stop(true, true).slideToggle(); 737 }); 738 739 $('html').click(function(e) { 740 // if($('.dropdown-menu').css('display') == "block") { 741 742 if (!$(e.target).hasClass('user-name') && !$(e.target).hasClass('accoun-dropdown')) { 743 $('.dropdown-menu').slideUp(); 744 } 745 // } 746 }); 747 748 $('.playlist-item-layout').click(function(e) { 749 e.stopPropagation(); 750 }); 751 752 $('body').on('click', '.playlist-remove', function() { 753 754 var playlist_id = $(this).attr('rel'); 755 var _this = $(this); 756 757 if(confirm('Remove playlist?')) { 758 759 $.ajax({ 760 url: baseUrl + 'myplaylists/remove/' + playlist_id, 761 type: 'get', 762 success: function() { 763 _this.closest('tr').fadeOut().remove(); 764 } 765 }); 766 } 767 }); 768 769 $('body').on('click', '.item-remove', function() { 770 var item_id = $(this).attr('rel'); 771 var _this = $(this); 772 773 if(confirm('Remove from playlist?')) { 774 775 $.ajax({ 776 url: baseUrl + 'myplaylists/remove_item/' + item_id, 777 type: 'get', 778 success: function() { 779 _this.closest('tr').fadeOut().remove(); 780 } 781 }); 782 } 783 }); 784 785 ////////////////////////////////////////// playlist end 786 787 788 $('body').on('click', '.gsc-search-button', function() { 789 if($('#gsc-i-id1').val() != '') { 790 $('#dewplayer').hide(100); 791 $('.stickybox').css('display', 'none'); 792 $('#gcse_input').hide(); 793 } 794 }); 795 796 /*$('body').on('keydown', '#gsc-i-id1', function(e) { 797 e.stopPropagation(); 798 if(e.which == 13) { console.log(111) 799 if($(this).val() != '') { 800 $('#dewplayer').hide(100); 801 $('.stickybox').css('display', 'none'); 802 } 803 } 804 });*/ 805 806 $('#gcse_input').on('blur', function(){ 807 if($(this).val() != '') { 808 $(this).css('background-image', 'inherit'); 809 } 810 else { 811 $(this).css('background', 'url("https://www.google.com/cse/static/en/google_custom_search_watermark.gif") 0% 50% no-repeat rgb(255, 255, 255)'); 812 } 813 }); 814 815 $('#gcse_input').on('focus', function(){ 816 $(this).css('background-image', 'inherit'); 817 }); 818 819 $('#gcse_input').on('keyup', function(e){ 820 if(e.which != 13) { 821 $('#gsc-i-id1').val($(this).val()); 822 } 823 else { 824 $('.gsc-search-button').trigger('click'); 825 } 826 }); 827
828 $('body').on('click', '.gsc-modal-background-image, .gsc-results-close-btn', function() { 829 $('#dewplayer').show(); 830 $('.stickybox').show(); 831 $('#gcse_input').show().val(''); 832 }); 833 834 $('.querys-btn').click(function() { 835 if($(this).closest('.benchmarking').height() == 160) { 836 $(this).closest('.benchmarking').height(30); 837 $('.querys').hide(); 838 $(this).find('span').removeClass('active-query'); 839 } 840 else { 841 $(this).closest('.benchmarking').height(160); 842 $('.querys').show(); 843 $(this).find('span').addClass('active-query'); 844 } 845 846 }); 847 848 $('.front-end-display-page').change(function() { 849 $('.front-end-display').submit(); 850 setCookie('display', $(this).val(), 1, '/'); 851 }); 852 853 $('body').on('click', '.device-tr', function() { 854 var link = $(this).find('.device-a').attr('href'); 855 if(link) 856 window.location.href = link; 857 return false; 858 }); 859 860 $('body').on('click', ".reply-comment", function(){ 861 var content = $(this).closest('.cmt').find('.reply-form_content'); 862 if(content.html() == '') { 863 $('.reply-form_content').html(''); 864 $('#comment_id').val($(this).data('commentid')) 865 content.html($('#replyForm').html()); 866 867 if ( $('#recaptcha2').length ) { 868 grecaptcha.render('recaptcha2', { 869 'sitekey' : '6LeWbn4UAAAAAG0SKoE3tjP5qKhGftglDHBSpGTb' 870 }); 871 } 872 873 } 874 else { 875 content.html(''); 876 } 877 }); 878}); 879 880function setCookie(cname, cvalue, exdays, sPath) { 881 var d = new Date(); 882 d.setTime(d.getTime() + (exdays*24*60*60*1000)); 883 var expires = "expires="+d.toUTCString(); 884 document.cookie = cname + "=" + cvalue + "; " + expires + (sPath ? "; path=" + sPath : ""); 885} 886 887function getCookie(cname) { 888 var name = cname + "="; 889 var ca = document.cookie.split(';'); 890 for(var i=0; i<ca.length; i++) { 891 var c = ca[i]; 892 while (c.charAt(0)==' ') c = c.substring(1); 893 if (c.indexOf(name) != -1) return c.substring(name.length,c.length); 894 } 895 return ""; 896} 897 898function generatePassword() { 899 var length = 8, 900 charset = "abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", 901 retVal = ""; 902 for (var i = 0, n = charset.length; i < length; ++i) { 903 retVal += charset.charAt(Math.floor(Math.random() * n)); 904 } 905 return retVal; 906} 907 908function proStart(serieId) { 909 //console.log(serieId) 910 $.ajax({ 911 url: baseUrl + 'admin/prophylactics/compare', 912 type: 'post', 913 dataType: 'json', 914 data: { 915 'serie_id': serieId, 916 }, 917 success: function(data) { 918 proCount++; 919 920 $percent = Math.round(( proCount / totalCount ) * 100); 921 922 $('.progress-bar').text($percent + '%'); 923 $('.progress-bar').css('width', $percent + '%'); 924 $('.progress-bar').attr('aria-valuenow', $percent); 925 926 $('.prophylactics_tbl tbody').append('<tr class="' + (data.state == 'good' ? 'success' : 'danger') + '"><td class="serie-row" data-table="' + data.table + '">' + data.serie.series_id + '</td><td>' + data.serie.name + '</td><td>' + data.state + '</td></tr>'); 927 928 proCycle(); 929 930 } 931 }); 932} 933 934function proCycle() { 935 if(seriesIds.length > 0){ 936 serieId = seriesIds.shift(); 937 proStart(serieId['series_id']); 938 } 939 else { 940 941 $('.prophylactics-btns').fadeIn(); 942 $('.prophylactics-series-count').html('<h4>Good: <strong>' + $('tr.success').length + '</strong> Bad: <strong>' + $('tr.danger').length + '</strong></h4>'); 943 } 944} 945 946function startAudit(serie) { 947 948 $.ajax({ 949 url: baseUrl + 'admin/audit/check', 950 data: { 951 serie_id: serie.series_id, 952 in_use: serie.in_use 953 }, 954 type: 'post', 955 dataType: 'json', 956 success: function(data) { 957 proCount++; 958 959 percent = Math.ceil(( proCount / totalCount ) * 100); 960 961 $('.progress-bar').text(percent + '%'); 962 $('.progress-bar').css('width', percent + '%'); 963 $('.progress-bar').attr('aria-valuenow', percent); 964 965 if(data.episode_id) { 966 $('.audit_tbl tbody').append( 967 '<tr>' + 968 '<td>' + data.episode_id + '</td>' + 969 '<td style="word-break: break-all"><a href="' + baseUrl + serie.genre + '/' + serie.serie_url + '/' + data.episode_url + '" target="_blank">' + data.episode_name + '</a></td>' + 970 '<td style="word-break: break-all">' + data.audio_path + '</td>' + 971 '<td><a href="' + data.file_url + '" target="_blank">' + data.file_url + '</a></td>' + 972 '<td>Not Found</td>' + 973 '</tr>' 974 ); 975 } 976 977 if(allSeries.length > 0) { 978 serie = allSeries.shift(); 979 startAudit(serie); 980 } else { 981 $('.progress-bar').removeClass('progress-bar-striped active').addClass('progress-bar-success'); 982 $('#startAudit').removeClass('disabled'); 983 } 984 }, 985 error: function (request, status, error) { 986 if(allSeries.length > 0) { 987 serie = allSeries.shift(); 988 startAudit(serie); 989 } else { 990 $('.progress-bar').removeClass('progress-bar-striped active').addClass('progress-bar-success'); 991 $('#startAudit').removeClass('disabled'); 992 } 993 } 994 }); 995} 996 997 998
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.