1jQuery(document).ready(function($) 2 { 3 4 5 6 $(document).on('click', '.timeline-grid .add-post', function() 7 { 8 var new_post_title = $('.new-post-title').val(); 9 var post_content = $('#new_post_content').text(); 10 11 alert(post_content); 12 13 14 15 $.ajax( 16 { 17 type: 'POST', 18 context: this, 19 url:timeline_grid_ajax.timeline_grid_ajaxurl, 20 data: {"action": "timeline_grid_ajax_add_post", "grid_id":grid_id,}, 21 success: function(data) 22 { 23 24 25 $('.grid-items').html(''); 26 //$('.grid-items').masonry({}); 27 28 29 var $grid = $('.grid-items').masonry({}); 30 31 // append items to grid 32 items = $grid.append( data ) 33 // add and lay out newly appended items 34 .masonry( 'appended', data ); 35 $grid.masonry( 'reloadItems' ); 36 $grid.masonry( 'layout' ); 37 38 $(this).removeClass('loading'); 39 40 }, 41 complete: function () { 42 setTimeout(add_point_and_arrow, 1000); 43 } 44 45 46 }); 47 48 49 50 51 52 }) 53 54 55 56 57 $(document).on('keyup', '.nav-search .search', function() 58 { 59 var keyword = $(this).val(); 60 var grid_id = $(this).attr('grid_id'); 61 62 if(keyword.length>3){ 63 $(this).addClass('loading'); 64 65 $('.pagination').fadeOut(); 66 67 $.ajax( 68 { 69 type: 'POST', 70 context: this, 71 url:timeline_grid_ajax.timeline_grid_ajaxurl, 72 data: {"action": "timeline_grid_ajax_search", "grid_id":grid_id,"keyword":keyword,}, 73 success: function(data) 74 { 75 76 77 $('.grid-items').html(''); 78 //$('.grid-items').masonry({}); 79 80 81 var $grid = $('.grid-items').masonry({}); 82 83 // append items to grid 84 items = $grid.append( data ) 85 // add and lay out newly appended items 86 .masonry( 'appended', data ); 87 $grid.masonry( 'reloadItems' ); 88 $grid.masonry( 'layout' ); 89 90 $(this).removeClass('loading'); 91 92 }, 93 complete: function () { 94 setTimeout(add_point_and_arrow, 1000); 95 } 96 97 98 }); 99 100 101 102 } 103 104 }) 105 106 107 $(document).on('click', '.timeline-grid .load-more', function() 108 { 109 110 var paged = parseInt($(this).attr('paged')); 111 var per_page = parseInt($(this).attr('per_page')); 112 var grid_id = parseInt($(this).attr('grid_id')); 113 114 115 $(this).addClass('loading'); 116 117 $.ajax( 118 { 119 type: 'POST', 120 context: this, 121 url:timeline_grid_ajax.timeline_grid_ajaxurl, 122 data: {"action": "timeline_grid_ajax_load_more", "grid_id":grid_id,"per_page":per_page,"paged":paged,}, 123 success: function(data) 124 { 125 126 //$('.grid-items').append(data); 127 var $grid = $('.grid-items').masonry({}); 128 129 // append items to grid 130 items = $grid.append( data ) 131 // add and lay out newly appended items 132 .masonry( 'appended', data ); 133 $grid.masonry('reloadItems'); 134 $grid.masonry('layout'); 135 136 //add_point_and_arrow(); 137 138 $(this).attr('paged',(paged+1)); 139 140 if($(this).hasClass('loading')) 141 { 142 $(this).removeClass('loading'); 143 } 144 145 146 }, 147 complete: function () { 148 setTimeout(add_point_and_arrow, 1000); 149 } 150 151 152 153 }); 154 155 //add_point_and_arrow(); 156 }) 157 158 159 function add_point_and_arrow(){ 160 161 162 jQuery('.timeline-grid .grid-items .item').each(function(){ 163 164 jQuery(this).removeClass('right-point'); 165 jQuery(this).removeClass('left-point'); 166 jQuery(this).children('span.right-arrow').remove(); 167 jQuery(this).children('span.left-arrow').remove(); 168 jQuery(this).children('span.right-point').remove(); 169 jQuery(this).children('span.left-point').remove(); 170 171 posLeft = jQuery(this).position(); 172 173 posLeft = posLeft.left; 174 175 if(posLeft == 0){ 176 177 html = '<span class=right-arrow></span>'; 178 179 jQuery(this).prepend(html); 180 jQuery(this).addClass('right-point'); 181 182 } 183 else{ 184 html = '<span class=left-arrow></span><span class=left-point></span>'; 185 jQuery(this).prepend(html); 186 jQuery(this).addClass('left-point'); 187 } 188 });
189 190 191 192 } 193 194 }); 195 196 197 198 199 200
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.