1var currentPage = 1; 2var itemsPerPage = 5; 3var footerSubscribe = false; 4 5$.ajaxSetup({ 6 headers: { 7 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 8 } 9}); 10 11function showPage(page){ 12 $("#res-page .mypagepa").each(function(i, elem){ 13 if(i >= (page-1)*itemsPerPage && i < page*itemsPerPage) //If item is in page, show it 14 $(this).show(); 15 else 16 $(this).hide(); 17 }); 18 $("#currentPage").text(currentPage); 19} 20 21function _initpaging() { 22// showPage(currentPage); 23// $("#next").click(function(){ 24// showPage(++currentPage); 25// }); 26// $("#prev").click(function(){ 27// showPage(--currentPage); 28// }); 29 30 $("div.holder").jPages({ 31 containerID : "res-page" 32 }); 33 34} 35 36function _manageAlertProfile(response, $element) { 37 if(response && $element.length) { 38 // Display the alert message 39 var $alert = $('.alert', $element); 40 41 if($alert.length) { 42 $alert.fadeOut('fast', function() { 43 $alert.remove(); 44 45 $element.prepend(response.message); 46 }); 47 } else { 48 $element.prepend(response.message); 49 } 50 51 // Hide alert message after some time 52 $('.alert', $element).delay(3500).queue(function() { 53 $(this).alert('close').dequeue(); 54 }); 55 } 56} 57 58 59$( document ).ready(function() { 60 BindSearch(); 61 BindLoadMore(); 62 buttonactivate(); 63 64 // Init news display 65 ShowNews(); 66 67 // Init panel information tooltip 68 initPanelTooltip(); 69 70 // National profile view reports 71 initViewProfileReports(); 72 73 // National profile view team 74 initViewProfileTeam(); 75 76 hoverTooltip(); 77 showHideData(); 78 79 _initpaging(); 80}); 81 82function BindLoadMore() { 83 84 $( ".load-more-teams" ).unbind('click').bind( "click", function() { 85 var url = $('#baseurl').val(); 86 var offset = $(".table-hover > tbody").children().length; 87 $.ajax({ 88 type: 'POST', 89 url: url+'/nationalteamssite@getNextData', 90 data: 'offset='+offset, 91 beforeSend: function() { 92 $('#loader').fadeIn('fast'); 93 }, 94 success: function(response){ 95 $('#loader').fadeOut('fast'); 96 97 if (response.status == 'success') { 98 $('.table-hover tbody tr:last').after(response.content); 99 100 // Init team information tooltip 101 initPanelTooltip(); 102 buttonactivate(); 103 // Update Tablesorter 104 var resort = true; 105 $('.tablesorter').trigger('update', [resort]); 106 } 107 if (!response.loadmore) { 108 $('.load-more').hide(); 109 } 110 }, 111 error: function() { 112 $('#loader').fadeOut('fast'); 113 } 114 }); 115 116 }); 117} 118 119function BindSearch() { 120 121$("form").bind("keypress", function (e) { 122 if (e.keyCode == 13) { 123 return false; 124 } 125}); 126 127 $('.search-report') 128// .unbind('keypress keyup') 129 .bind('keypress keyup', function(e){ 130 if(e.keyCode == 8 && $(this).val().length == 0) { 131 serach_report('%'); 132 } else { 133 if ($(this).val().length < 3 && e.keyCode != 13) return; 134 serach_report($(this).val()); 135 } 136 }); 137 $('.search-report-close').bind( "click", function() { 138 serach_report('%'); 139 }); 140 141 $('.search-teams') 142// .unbind('keypress keyup') 143 .bind('keypress keyup', function(e){ 144 if(e.keyCode != 13) { 145 if(e.keyCode == 8 && $(this).val().length == 0) { 146 serach_teams('%'); 147 } else { 148 if ($(this).val().length < 3 && e.keyCode != 13) return; 149 serach_teams($(this).val()); 150 } 151 } 152 }); 153 $('.search-teams-close').bind( "click", function() { 154 serach_teams('%'); 155 }); 156 157 $('.search-data') 158// .unbind('keypress keyup') 159 .bind('keypress keyup', function(e){ 160 if(e.keyCode == 8 && $(this).val().length == 0) { 161 $('.search-data-close').hide(); 162 serach_data('%'); 163 } else { 164 $('.search-data-close').show(); 165 if ($(this).val().length < 3 && e.keyCode != 13) return; 166 serach_data($(this).val()); 167 } 168 }); 169 $('.search-data-close').bind( "click", function() { 170 serach_data('%'); 171 }); 172 173} 174 175function serach_report(q) { 176 var url = $('#baseurl').val(); 177 var kind = $('#serach-kind').val(); 178 $.ajax({ 179 type: 'POST', 180 url: url+'/reports@search', 181 data: 'q='+q+'&kind='+kind, 182 beforeSend: function() { 183 $('.no-result').hide(); 184 }, 185 success: function(response){ 186 187 if( response.status == 'norow' ) { 188 $('.table-hover tbody').html(response.message); 189 $('.load-more').hide(); 190 $('.table-hover').hide(); 191 $('.no-result').show(); 192 } else { 193 if (response.status == 'success') { 194 $('.table-hover tbody').html(response.message); 195 initPanelTooltip(); 196 buttonactivate(); 197 // Update Tablesorter 198 var resort = true; 199 $('.tablesorter').trigger('update', [resort]); 200 201 if(response.loadmore) { 202 $('.load-more').show(); 203 } else { 204 $('.load-more').hide(); 205 } 206 $('.table-hover').show(); 207 } 208 } 209 }, 210 error: function() { 211// $('#loader').fadeOut('fast'); 212 } 213 }); 214} 215 216function serach_teams(q) { 217 var url = $('#baseurl').val(); 218 $.ajax({ 219 type: 'POST', 220 url: url+'/nationalteamssite@search', 221 data: 'q='+q, 222 beforeSend: function() { 223 $('.no-result').hide(); 224 }, 225 success: function(response){ 226 if( response.status == 'norow' ) { 227 $('.table-hover tbody').html(response.message); 228 $('.load-more').hide(); 229 $('.table-hover').hide(); 230 $('.no-result').show(); 231 } else { 232 if (response.status == 'success') { 233 $('.table-hover tbody').html(response.message); 234 initPanelTooltip(); 235 236 // Update Tablesorter 237 var resort = true; 238 $('.tablesorter').trigger('update', [resort]); 239 240 if(response.loadmore) { 241 $('.load-more').show(); 242 } else { 243 $('.load-more').hide(); 244 } 245 $('.table-hover').show(); 246 } 247 } 248 }, 249 error: function() { 250// $('#loader').fadeOut('fast'); 251 } 252 }); 253} 254 255function serach_data(q) { 256 var url = $('#baseurl').val(); 257 var kind = $('#serach-kind').val(); 258 $.ajax({ 259 type: 'POST', 260 url: url+'/data@publicSearch', 261 data: 'q='+q+'&kind='+kind, 262 beforeSend: function() { 263 $('.no-result').hide(); 264 }, 265 success: function(response){ 266 if( response.status == 'norow' ) { 267 $('.table-hover tbody').html(response.message); 268 $('.load-more').hide(); 269 $('.table-hover').hide(); 270 $('.no-result').show(); 271 } else { 272 if (response.status == 'success') { 273 $('.table-hover tbody').html(response.message); 274 initPanelTooltip(); 275 buttonactivate(); 276 // Update Tablesorter 277 var resort = true; 278 $('.tablesorter').trigger('update', [resort]); 279 280 if(response.loadmore) { 281 $('.load-more').show(); 282 } else { 283 $('.load-more').hide(); 284 } 285 $('.table-hover').show(); 286 } 287 } 288 }, 289 error: function() { 290// $('#loader').fadeOut('fast'); 291 } 292 }); 293} 294 295 296function buttonactivate() { 297 // Init news display 298 ShowNews(); 299 300 // Init show page 301 ShowPage(); 302 303 _initpaging(); 304 305// DOWNLOAD WIKI 306 $( ".downloadactionwiki" ).unbind('click').bind( "click", function() { 307 url = $('#baseurl').val()+'/download@wiki'; 308 id = $(this).attr('file');
309 $.download(url,'id='+id); 310 }); 311 312// DOWNLOAD DATA & REPORTS 313 $( ".downloadaction" ).unbind('click').bind( "click", function() { 314 url = $('#baseurl').val()+'/download@file'; 315 id = $(this).attr('file'); 316 $.download(url,'id='+id); 317 }); 318 319// DATA 320 $( ".buttontabData" ).unbind('click').bind( "click", function() { 321 url = $('#baseurl').val()+'/data@getPublicData'; 322 kind = $(this).attr('aria-controls'); 323 324 $.ajax({ 325 type: 'POST', 326 url: url, 327 data: 'kind='+kind, 328 beforeSend: function() { 329 // $('#loader').fadeIn('fast'); 330 $('.toclear').html(''); 331 332 }, 333 success: function(msg){ 334 // $('#loader').fadeOut('fast'); 335 336 if (msg) { 337 $('#serach-kind').val(kind); 338 $('#'+kind).html(msg); 339// BindSearch(); 340 buttonactivate(); 341 342 // Initialize Tablesorter 343 $('.tablesorter').tablesorter(); 344 } 345 }, 346 error: function() { 347 // $('#loader').fadeOut('fast'); 348 } 349 }); 350 351 }); 352 353} 354 355$( ".buttontababout" ).unbind('click').bind( "click", function() { 356 var $self = $(this); 357 var id = $self.data('id'); 358 var kind = $(this).attr('aria-controls'); 359 var url = $('#baseurl').val()+'/about@getAbout'; 360 361 if(kind == 'gem') { 362 kind = 'what-is-gem'; 363 } 364 365 // Remove the data-id attribute 366 $self.removeAttr('data-id'); 367 368 $.ajax({ 369 type: 'POST', 370 url: url, 371 data: { 372 id: id, 373 kind: kind 374 }, 375 beforeSend: function() { 376 $('.expanded').html(''); 377 }, 378 success: function(response){ 379 if(response) { 380 if(kind == 'what-is-gem') { 381 kind = 'gem'; 382 } 383 384 $('#'+kind).html(response.content); 385 buttonactivate(); 386 387 if(response.metaTags) { 388 $('meta[name="keywords"]').attr('content', response.metaTags.keywords); 389 $('meta[name="description"]').attr('content', response.metaTags.description); 390 } 391 392 // Update Facebook meta data 393 if(response.facebookMeta) { 394 var metaData = response.facebookMeta; 395 396 $('meta[property="og:type"]').attr('content', metaData.ogType); 397 $('meta[property="og:title"]').attr('content', metaData.ogTitle); 398 $('meta[property="og:description"]').attr('content', metaData.ogDescription); 399 $('meta[property="og:url"]').attr('content', metaData.ogUrl); 400 $('meta[property="article:section"]').attr('content', metaData.articleSection); 401 $('meta[property="og:image"]').attr('content', metaData.ogImage); 402 } 403 404 // Initialize share panel 405 _initializeSharePanel(); 406 } 407 }, 408 error: function() { 409 } 410 }); 411}); 412 413 414function _insubmitsingup() { 415 416 $('#form-singup').on('submit', function (event) { 417 event.preventDefault(); 418 var $form = $(this); 419 var url = $form.attr('action'); 420 var formData = $form.serialize(); 421 422 $.ajax({ 423 type: 'POST', 424 url: url, 425 data: formData, 426 beforeSend: function() { 427 $('#loader').fadeIn('fast'); 428 }, 429 success: function(response, status, xhr) { 430 $('#loader').fadeOut('fast'); 431 432 if(response) { 433 if(!response.status || response.status == 'error') { 434 var $alert = $('.alert', $form); 435 436 // Display the error message 437 if($alert.length) { 438 $alert.fadeOut('fast', function() { 439 $alert.remove(); 440 441 $form.prepend(response.message); 442 }); 443 } else { 444 $form.prepend(response.message); 445 } 446 447 $('#modal').animate({ 448 scrollTop: 0 449 }, 400); 450 451 452 // Hide alert after some time 453 $('.alert', $form).delay(3500).queue(function() { 454 $(this).alert('close').dequeue(); 455 }); 456 } else if(response.status == 'pending') { 457 var $alert = $('.alert', $form); 458 459 if($alert.length) { 460 $alert.fadeOut('fast', function() { 461 $alert.remove(); 462 }); 463 } 464 465 466 if(modalDropzone.getQueuedFiles().length > 0) { 467 modalDropzone.processQueue(); 468 469 $('#loader').fadeIn('fast'); 470 } 471 } else if(response.status == 'success') { 472 // Hide modal 473// $('#modal').modal('hide'); 474 475 var $alert = $('.alert', $form); 476 477 // Display the error message 478 if($alert.length) { 479 $alert.fadeOut('fast', function() { 480 $alert.remove(); 481 482 $form.prepend(response.message); 483 }); 484 } else { 485 $form.prepend(response.message); 486 } 487 488 $('#modal').animate({ 489 scrollTop: 0 490 }, 400); 491 492 493 $('#form-singup')[0].reset(); 494 495 // Hide alert after some time 496 $('.alert', $form).delay(3500).queue(function() { 497 $(this).alert('close').dequeue(); 498 }); 499 500// _manageAddNationalTeam(response); 501 } 502 } 503 }, 504 error: function() { 505 $('#loader').fadeOut('fast'); 506 } 507 }); 508 }); 509} 510 511$(document).on('click', '.footer-subscribe', function() { 512 footerSubscribe = true; 513}); 514 515$(document).on('submit', '#mc-embedded-subscribe-form', function(e) { 516 if (!footerSubscribe) {
517 window.my_iframe.src = $('.report-download').attr('href'); 518 } 519 footerSubscribe = false; 520 $('#signupModal').modal('hide'); 521}); 522 523 524 525 526jQuery.download = function(url, data, method){ 527 //url and data options required 528 if( url && data ){ 529 //data can be string of parameters or array/object 530 data = typeof data == 'string' ? data : jQuery.param(data); 531 //split params into form inputs 532 var inputs = ''; 533 jQuery.each(data.split('&'), function(){ 534 var pair = this.split('='); 535 inputs+='<input type="hidden" name="'+ pair[0] +'" value="'+ pair[1] +'" />'; 536 }); 537 //send request 538 jQuery('<form action="'+ url +'" method="'+ (method||'post') +'">'+inputs+'</form>') 539 .appendTo('body').submit().remove(); 540 }; 541}; 542 543 544function ShowNews() { 545 $('.list-group-news a').unbind('click').on('click', function(event) { 546 event.preventDefault(); 547 548 var $self = $(this); 549 var url = $self.attr('href'); 550 var $parent = $self.parents('.list-group-item'); 551 var $activeTab = $self.parents('.tab-pane.active'); 552 553 if($parent.hasClass('active')) { 554 return false; 555 } 556 557 $.ajax({ 558 type: 'POST', 559 url: url, 560 beforeSend: function() { 561 $('#loader').fadeIn('fast'); 562 }, 563 success: function(response, status, xhr) { 564 $('#loader').fadeOut('fast'); 565 566 if(response) { 567 var $columnNewsArticle = $('.column-news-article'); 568 var $article = $('article', $columnNewsArticle); 569 570 if(!response.status || response.status == 'error') { 571 var $alert = $('.alert', $article); 572 573 // Display the error message 574 if($alert.length) { 575 $alert.fadeOut('fast', function() { 576 $alert.remove(); 577 578 $article.prepend(response.message); 579 }); 580 } else { 581 $article.prepend(response.message); 582 } 583 584 585 var topPosition = $activeTab.position().top; 586 587 $('html, body').finish().animate({ 588 scrollTop: topPosition 589 }, 400); 590 591 592 // Hide alert after some time 593 $('.alert', $article).delay(3500).queue(function() { 594 $(this).alert('close').dequeue(); 595 }); 596 } else if(response.status == 'success') { 597 // Manage active list item 598 $parent.addClass('active'); 599 $parent.siblings().removeClass('active'); 600 601 $article.fadeOut('fast', function() { 602 $(this).remove; 603 $columnNewsArticle.html(response.content); 604 605 if(response.metaTags) { 606 $('meta[name="keywords"]').attr('content', response.metaTags.keywords); 607 $('meta[name="description"]').attr('content', response.metaTags.description); 608 } 609 610 // Update Facebook meta data 611 if(response.facebookMeta) { 612 var metaData = response.facebookMeta; 613 614 $('meta[property="og:type"]').attr('content', metaData.ogType); 615 $('meta[property="og:title"]').attr('content', metaData.ogTitle); 616 $('meta[property="og:description"]').attr('content', metaData.ogDescription); 617 $('meta[property="og:url"]').attr('content', metaData.ogUrl); 618 $('meta[property="article:section"]').attr('content', metaData.articleSection); 619 $('meta[property="og:image"]').attr('content', metaData.ogImage); 620 } 621 622 623 624 // Initialize share panel 625 _initializeSharePanel(); 626 }); 627 } 628 } 629 }, 630 error: function() { 631 $('#loader').fadeOut('fast'); 632 } 633 }); 634 }); 635 636 637 $('.pagination a').unbind('click').on('click', function(event) { 638 event.preventDefault(); 639 640 var $self = $(this); 641 var url = $self.attr('href'); 642 var $activeTab = $self.parents('.tab-pane.active'); 643 644 $.ajax({ 645 type: 'POST', 646 url: url, 647 beforeSend: function() { 648 $('#loader').fadeIn('fast'); 649 }, 650 success: function(response, status, xhr) { 651 $('#loader').fadeOut('fast'); 652 if(response) { 653 var $columnNewsArticle = $('.column-news-article'); 654 var $article = $('article', $columnNewsArticle); 655 656 if(!response.status || response.status == 'error') { 657 var $alert = $('.alert', $article); 658 659 // Display the error message 660 if($alert.length) { 661 $alert.fadeOut('fast', function() { 662 $alert.remove(); 663
664 $article.prepend(response.message); 665 }); 666 } else { 667 $article.prepend(response.message); 668 } 669 670 671 var topPosition = $activeTab.position().top; 672 673 $('html, body').finish().animate({ 674 scrollTop: topPosition 675 }, 400); 676 677 678 // Hide alert after some time 679 $('.alert', $article).delay(3500).queue(function() { 680 $(this).alert('close').dequeue(); 681 }); 682 } else if(response.status === 'success') { 683 var $activeTab = $('#news'); 684 685 // Update page content 686 $activeTab.html(response.content); 687 688 // Update Facebook meta data 689 if(response.facebookMeta) { 690 var metaData = response.facebookMeta; 691 692 $('meta[property="og:type"]').attr('content', metaData.ogType); 693 $('meta[property="og:title"]').attr('content', metaData.ogTitle); 694 $('meta[property="og:description"]').attr('content', metaData.ogDescription); 695 $('meta[property="og:url"]').attr('content', metaData.ogUrl); 696 $('meta[property="article:section"]').attr('content', metaData.articleSection); 697 $('meta[property="og:image"]').attr('content', metaData.ogImage); 698 } 699 700 // Initialize share panel 701 _initializeSharePanel(); 702 703 704 // Reinitialize self 705 ShowNews(); 706 } 707 } 708 }, 709 error: function() { 710 $('#loader').fadeOut('fast'); 711 } 712 }); 713 }); 714} 715 716 717function ShowPage() { 718 $('.list-group-page a').unbind('click').on('click', function(event) { 719 event.preventDefault(); 720 721 var $self = $(this); 722 var id = $self.data('id'); 723 var tag = $self.data('tag'); 724 var kindtag = $self.data('kindtag'); 725 var url = $('#baseurl').val() + '/cms@showcmspageajax'; 726 var $parent = $self.parents('.list-group-item'); 727 var $activeTab = $self.parents('.tab-pane.active'); 728 729 if($parent.hasClass('active')) { 730 return false; 731 } 732 733 $.ajax({ 734 type: 'POST', 735 url: url, 736 data: { 737 id: id, 738 tag: tag, 739 kindtag: kindtag, 740 }, 741 beforeSend: function() { 742 $('#loader').fadeIn('fast'); 743 }, 744 success: function(response, status, xhr) { 745 $('#loader').fadeOut('fast'); 746 747 if(response) { 748 var $columnPageArticle = $('.column-page-article'); 749 var $article = $('article', $columnPageArticle); 750 751 if(!response.status || response.status == 'error') { 752 var $alert = $('.alert', $article); 753 754 // Display the error message 755 if($alert.length) { 756 $alert.fadeOut('fast', function() { 757 $alert.remove(); 758 759 $article.prepend(response.message); 760 }); 761 } else { 762 $article.prepend(response.message); 763 } 764 765 var topPosition = $activeTab.position().top; 766 767 $('html, body').finish().animate({ 768 scrollTop: topPosition 769 }, 400); 770 771 772 // Hide alert after some time 773 $('.alert', $article).delay(3500).queue(function() { 774 $(this).alert('close').dequeue(); 775 }); 776 } else if(response.status == 'success') { 777 if(response.menu) { 778 $('.list-group').html(response.menu); 779 ShowPage(); 780 _initpaging(); 781 } 782 783 // Manage active list item 784 $parent.addClass('active'); 785 $parent.siblings().removeClass('active'); 786 787 var topPosition = $('.column-page-article').offset().top; 788 $('html, body').finish().animate({ 789 scrollTop: topPosition 790 }, 400); 791 792 $article.fadeOut('fast', function() { 793 $(this).remove; 794 $columnPageArticle.html(response.content); 795 796 // Update Facebook meta data 797 if(response.facebookMeta) { 798 var metaData = response.facebookMeta; 799 800 $('meta[property="og:type"]').attr('content', metaData.ogType); 801 $('meta[property="og:title"]').attr('content', metaData.ogTitle); 802 $('meta[property="og:description"]').attr('content', metaData.ogDescription); 803 $('meta[property="og:url"]').attr('content', metaData.ogUrl); 804 $('meta[property="article:section"]').attr('content', metaData.articleSection); 805 $('meta[property="og:image"]').attr('content', metaData.ogImage); 806 } 807 808 _insubmitsingup(); 809 810 // Initialize share panel 811 _initializeSharePanel(); 812 }); 813 814 } 815 } 816 }, 817 error: function() { 818 $('#loader').fadeOut('fast'); 819 } 820 }); 821 }); 822} 823 824 825//REPORT 826 827$( ".buttontab" ).bind( "click", function() { 828 url = $('#baseurl').val()+'/reports@getTable'; 829 kind = $(this).attr('aria-controls'); 830 831 $.ajax({ 832 type: 'POST', 833 url: url, 834 data: 'kind='+kind, 835 beforeSend: function() { 836// $('#loader').fadeIn('fast'); 837 $('.tab-pane').html(''); 838 839 }, 840 success: function(msg){ 841// $('#loader').fadeOut('fast'); 842 843 if (msg) { 844 $('#'+kind).html(msg); 845 BindSearch(); 846 buttonactivate(); 847 848 // Init report information tooltip 849 initPanelTooltip(); 850 851 // Initialize Tablesorter 852 $('.tablesorter').tablesorter(); 853 } 854 }, 855 error: function() { 856// $('#loader').fadeOut('fast'); 857 } 858 }); 859 860}); 861 862function GetNextPublictReport(kind) { 863 var url = $('#baseurl').val(); 864 var offset = $(".table-hover > tbody").children().length; 865 $.ajax({ 866 type: 'POST', 867 url: url+'/reports@getNextData', 868 data: 'kind='+kind+'&offset='+offset, 869 beforeSend: function() { 870 $('#loader').fadeIn('fast'); 871 }, 872 success: function(response){ 873 $('#loader').fadeOut('fast'); 874 875 if (response.status == 'success') { 876 $('.table-hover tbody tr:last').after(response.content); 877 878 // Init report information tooltip 879 initPanelTooltip(); 880 buttonactivate(); 881 // Update Tablesorter 882 var resort = true; 883 $('.tablesorter').trigger('update', [resort]); 884 } 885 886 if (!response.loadmore) { 887 $('.load-more').hide(); 888 } 889 }, 890 error: function() { 891 $('#loader').fadeOut('fast'); 892 } 893 }); 894} 895 896function GetNextProfileReport(id) { 897 var url = $('#baseurl').val(); 898 var offset = $(".table-hover > tbody").children().length; 899 $.ajax({ 900 type: 'POST', 901 url: url+'/nationalteamssite@getNextProfileData', 902 data: 'id='+id+'&offset='+offset, 903 beforeSend: function() { 904 $('#loader').fadeIn('fast'); 905 }, 906 success: function(response){ 907 $('#loader').fadeOut('fast'); 908 909 if (response.status == 'success') { 910 $('.table-hover tbody tr:last').after(response.content); 911 912 // Init report information tooltip 913 initPanelTooltip(); 914 buttonactivate(); 915 916 // Update Tablesorter 917 var resort = true; 918 $('.tablesorter').trigger('update', [resort]); 919 } 920 if (!response.loadmore) { 921 $('.load-more').hide(); 922 } 923 }, 924 error: function() { 925 $('#loader').fadeOut('fast'); 926 } 927 }); 928} 929 930//DATA 931 932//$( ".buttontabNESAPS" ).bind( "click", function() { 933// url = $('#baseurl').val()+'/data@getNESAPS'; 934// kind = $(this).attr('aria-controls'); 935// 936// $.ajax({ 937// type: 'POST', 938// url: url, 939// data: 'kind='+kind, 940// beforeSend: function() { 941//// $('#loader').fadeIn('fast'); 942// $('.tab-pane').html(''); 943// 944// }, 945// success: function(msg){ 946//// $('#loader').fadeOut('fast'); 947// 948// if (msg) { 949// $('#'+kind).html(msg); 950// BindSearch(); 951// buttonactivate(); 952// 953// // Initialize Tablesorter 954// $('.tablesorter').tablesorter(); 955// } 956// }, 957// error: function() { 958//// $('#loader').fadeOut('fast'); 959// } 960// }); 961// 962//}); 963 964function GetNextPublicData(kind) { 965 var url = $('#baseurl').val(); 966 var offset = $(".table-hover > tbody").children().length; 967 $.ajax({ 968 type: 'POST', 969 url: url+'/data@getNextPublicData', 970 data: 'kind='+kind+'&offset='+offset, 971 beforeSend: function() { 972 $('#loader').fadeIn('fast'); 973 }, 974 success: function(response){ 975 $('#loader').fadeOut('fast'); 976 977 if (response.status == 'success') { 978 $('.table-hover tbody tr:last').after(response.content); 979 980 // Update Tablesorter 981 var resort = true; 982 $('.tablesorter').trigger('update', [resort]); 983 buttonactivate(); 984 } 985 986 if (!response.loadmore) { 987 $('.load-more').hide(); 988 } 989 }, 990 error: function() { 991 $('#loader').fadeOut('fast'); 992 } 993 }); 994} 995 996 997 998 999function initPanelTooltip() { 1000 var openTooltip = function($parent) { 1001 if($parent.length) { 1002 var $tooltipInformation = $('.tooltip-information', $parent); 1003 1004 $tooltipInformation.finish().fadeIn('fast'); 1005 } 1006 }; 1007 1008 1009 var closeTooltip = function($parent) { 1010 if($parent.length) { 1011 var $tooltipInformation = $('.tooltip-information', $parent); 1012 1013 $tooltipInformation.finish().fadeOut('fast'); 1014 } 1015 }; 1016 1017 1018 var closeOtherTooltips = function() { 1019 var $tooltipInformation = $('.tooltip-information'); 1020 1021 if($tooltipInformation.is(':visible')) { 1022 $('.tooltip-close', $tooltipInformation).click(); 1023 } 1024 }; 1025 1026 1027 1028 1029 if($('.tooltip-panel-information .open-panel-tooltip').length) { 1030 $('.tooltip-panel-information .open-panel-tooltip').unbind('click').on('click', function(event) { 1031 event.preventDefault(); 1032 1033 1034 var $self = $(this); 1035 var $gemicon = $('.gemicon', $self); 1036 var $parent = $self.parents('.tooltip-panel-information'); 1037 1038 if($self.hasClass('is-open')) { 1039 // Close tooltip information panel 1040 closeTooltip($parent); 1041 } else { 1042 // Close other tooltips if are open 1043 closeOtherTooltips(); 1044 1045 // Open tooltip information panel 1046 openTooltip($parent); 1047 } 1048 1049 // Toggle active state of the icon 1050 $gemicon.toggleClass('green'); 1051 1052 // Toggle active state 1053 $self.toggleClass('is-open'); 1054 }); 1055 1056 1057 $('.tooltip-panel-information .tooltip-close').unbind('click').on('click', function(event) { 1058 event.preventDefault(); 1059 1060 var $self = $(this); 1061 var $parent = $self.parents('.tooltip-panel-information'); 1062 var $openPanelTooltip = $('.open-panel-tooltip', $parent); 1063 var $gemicon = $('.gemicon', $openPanelTooltip); 1064 1065 // Close tooltip information panel 1066 closeTooltip($parent); 1067 1068 // Remove the active state of the icon 1069 $gemicon.removeClass('green'); 1070 1071 // Remove the active state 1072 $openPanelTooltip.removeClass('is-open'); 1073 }); 1074 } 1075} 1076 1077 1078function initViewProfileReports() { 1079 $('.view-profile-reports').on('click', function(event) { 1080 event.preventDefault(); 1081 1082 1083 var $profileReports = $('.profile-reports'); 1084 var topPosition = $profileReports.position().top; 1085 1086 $('html, body').finish().animate({ 1087 scrollTop: topPosition 1088 }, 600); 1089 }); 1090} 1091 1092 1093function initViewProfileTeam() { 1094 $('.toggle-profile').on('click', function(event) { 1095 event.preventDefault(); 1096 1097 1098 var $self = $(this); 1099 var type = $self.data('type'); 1100 1101 var data = { 1102 'type': type 1103 }; 1104 1105 1106 $.ajax({ 1107 type: 'POST', 1108 data: data, 1109 beforeSend: function() { 1110 $('#loader').fadeIn('fast'); 1111 }, 1112 success: function(response) { 1113 $('#loader').fadeOut('fast'); 1114 1115 if(response) { 1116 if(!response.status || response.status == 'error') { 1117 var $element; 1118 1119 if(type == 'team') { 1120 $element = $('.profile-details'); 1121 } else if(type == 'profile') { 1122 $element = $('.profile-team'); 1123 } 1124 1125 // Handle error 1126 _manageAlertProfile(response, $element); 1127 } else if(response.status == 'success') { 1128 var $profileInfo = $('.profile-info'); 1129 var $profileFlag = $('.pflag-logo img', $profileInfo); 1130 var $profileFlagMap = $('.pflag-logo-map img', $profileInfo); 1131 1132 var $profileDetails = $('.profile-details'); 1133 var $profileTeam = $('.profile-team'); 1134 1135 // Change button status 1136 if(type == 'team') { 1137 $self.text('View Profile'); 1138 $self.data('type', 'profile'); 1139 1140 $profileTeam.html(response.content); 1141 } else if(type == 'profile') { 1142 $self.text('Contact'); 1143 $self.data('type', 'team'); 1144 } 1145 1146 // Display content 1147 $profileDetails.toggleClass('hide'); 1148 $profileTeam.toggleClass('hide'); 1149 1150 // Update profile image 1151 if(response.logo) { 1152 $profileFlag.attr('src', response.logo); 1153 } 1154 1155 if(response.logo_map) { 1156 $profileFlagMap.attr('src', response.logo_map); 1157 } 1158 } 1159 } 1160 }, 1161 error: function() { 1162 $('#loader').fadeOut('fast'); 1163 } 1164 }); 1165 }); 1166} 1167 1168 1169//research papers 1170 1171function rpShowTags(tag) { 1172 var url = $('#baseurl').val(); 1173// var offset = $(".table-hover > tbody").children().length; 1174 $.ajax({ 1175 type: 'POST', 1176 url: url+'/about@getRPTagsData', 1177 data: 'tag='+tag, 1178 beforeSend: function() { 1179 $('#loader').fadeIn('fast'); 1180 }, 1181 success: function(response){ 1182 $('#loader').fadeOut('fast'); 1183 1184 if (response.status == 'success') { 1185 $('.list-group').html(response.content_menu); 1186// 1187// 1188// $('.table-hover tbody tr:last').after(response.content); 1189 1190 // Update Tablesorter 1191// var resort = true; 1192// $('.tablesorter').trigger('update', [resort]); 1193// buttonactivate(); 1194 } 1195 1196 if (!response.loadmore) { 1197 $('.load-more').hide(); 1198 } 1199 }, 1200 error: function() { 1201 $('#loader').fadeOut('fast'); 1202 } 1203 }); 1204} 1205function hoverTooltip(){ 1206 $('.grid-2').click(function(){ 1207 document.addEventListener('mousemove', function(ev){ 1208 document.getElementById('tooltip').style.transform = 'translateY('+(ev.clientY-30)+'px)'; 1209 document.getElementById('tooltip').style.transform += 'translateX('+(ev.clientX +50)+'px)'; 1210 },false); 1211 $('.chart').find('rect').mouseenter(function () { 1212 var color = $(this).attr('fill'); 1213 switch (color){ 1214 case '#1f77b4': 1215 $('#tooltip').find('.colour-one').parent().fadeIn(100).siblings().fadeOut(100); 1216 break; 1217 case '#aec7e8': 1218 $('#tooltip').find('.colour-two').parent().fadeIn(100).siblings().fadeOut(100); 1219 break; 1220 case '#ff7f0e': 1221 $('#tooltip').find('.colour-three').parent().fadeIn(100).siblings().fadeOut(100); 1222 break; 1223 case '#ffbb78': 1224 $('#tooltip').find('.colour-four').parent().fadeIn(100).siblings().fadeOut(100); 1225 break; 1226 case '#2ca02c': 1227 $('#tooltip').find('.colour-five').parent().fadeIn(100).siblings().fadeOut(100); 1228 break; 1229 } 1230 }).mouseleave(function () { 1231 $('#tooltip').find('li').fadeOut(); 1232 }); 1233 1234 }) 1235 1236} 1237function showHideData(){ 1238 $('.clickable>li').click(function(){ 1239 $(this).toggleClass('strike'); 1240 what = $(this).attr('data-trigger'); 1241 var rects = $('rect'); 1242 if (what == 'marker'){ 1243 rects = $('line'); 1244 } 1245 for(i=0; i<rects.length; i++){ 1246 var check = $(rects[i]).attr('data-label'); 1247 if (check) 1248 check = check.replace(/\s+/g, '').toLowerCase(); 1249 what = what.replace(/\s+/g, '').toLowerCase(); 1250 if(check == what){ 1251 $(rects[i]).fadeToggle(); 1252 } 1253 } 1254 1255 }) 1256} 1257
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.