1( function() { 2 // Save current page 3 if(typeof cactus.query_vars !== 'undefined'){ 4 _current_page = cactus.query_vars.paged; 5 } else { 6 _current_page = -1; 7 } 8 if(_current_page == 0) _current_page = 1; 9 // flag to check if an ajax is executing 10 _ajax_loading = false; 11 12 function do_ajax(blog_layout) 13 { 14 15 if(jQuery('#navigation-ajax').length > 0){ 16 jQuery('#navigation-ajax').live('click', function(e){ 17 e.preventDefault(); 18 if(_current_page > -1 && !_ajax_loading){ 19 item_template = jQuery(this).attr('data-template'); 20 icon_loading = jQuery('.navigation-ajax i'); 21 ajax_button = jQuery('#navigation-ajax'); 22 var id_playlist; 23 if(jQuery('#single-playlist').length > 0) { 24 id_playlist=jQuery('#single-playlist').val(); 25 }else{ 26 id_playlist=''; 27 }; 28 data = { 29 action: 'load_more', 30 page: _current_page, 31 template: item_template, 32 vars:cactus.query_vars, 33 blog_layout: blog_layout, 34 id_playlist: id_playlist, 35 36 }; 37 38 content_div = jQuery(this).attr('data-target'); 39 40 _ajax_loading = true; 41 ajax_button.addClass('hidden1-loading'); 42 icon_loading.removeClass('hidden-loading'); 43 44 jQuery.ajax({ 45 type: 'POST', 46 url: cactus.ajaxurl, 47 cache: false, 48 data: data, 49 success: function(data, textStatus, XMLHttpRequest){ 50 if(data != ''){ 51 52 jQuery(content_div).append(data); 53 54 jQuery('.fa-refresh').removeClass("fa-spin"); 55 jQuery('.fa-refresh').addClass("hide"); 56 jQuery('.load-title').removeClass("hidden"); 57 jQuery('#navigation-ajax').removeClass("disabled"); 58 59 // increase current page 60 _current_page = _current_page + 1; 61 62 if(jQuery('.no-posts').length > 0){ 63 // no more post 64 _current_page = -1; 65 jQuery(".navigation-ajax").hide(); 66 } 67 68 icon_loading.addClass('hidden-loading'); 69 ajax_button.removeClass('hidden1-loading'); 70 71 } else { 72 _current_page = -1; 73 // do something else when there is no more results 74 // alert('No more results. You should do something, like hiding this link button. Edit me in /js/ajax.js'); 75 jQuery(".navigation-ajax").hide(); 76 } 77 78 _ajax_loading = false; 79 }, 80 error: function(MLHttpRequest, textStatus, errorThrown){ 81 alert(errorThrown); 82 _ajax_loading = false; 83 icon_loading.addClass('hidden-loading'); 84 ajax_button.removeClass('hidden1-loading'); 85 } 86 }); 87 } 88 89 }); 90 } 91 } 92 93 jQuery(document).ready(function(){ 94 var blog_layout = jQuery('input[name=hidden_blog_layout]').val(); 95 96 jQuery('#navigation-ajax').click(function() { 97 jQuery('.fa-refresh').addClass("fa-spin"); 98 jQuery('.fa-refresh').removeClass("hide"); 99 jQuery('.load-title').addClass("hidden"); 100 jQuery('#navigation-ajax').addClass("disabled"); 101 do_ajax(blog_layout); 102 }); 103 104 }); 105}) ();
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.