1/*! fluxPost v1.0 */ 2/*! fluxAtt v1.0 */ 3 4 5/** 6 * init flux 7 * @param array args 8 * args.posts_per_page 9 * args.load_more_is_activated 10 * args.hash random useful to have many flux in the same page - hash is a part of IDs in dom 11 * args.query_args wp query args 12 * @return void 13 */ 14function init_flux_image(args) { 15 16 var scriptElement = document.getElementById('fluxImgString'); 17 var urlParams = new URLSearchParams(scriptElement.src.split('?')[1]); 18 var paramsOnce = urlParams.get('param').split('='); 19 20 if (paramsOnce) { 21 var nonce = paramsOnce[1]; 22 }else { 23 var nonce = ajaxurlPostNonce.nonce; 24 } 25 26 27 load_download_all_img(args.hash, args.load_more_is_activated, args.query_args,nonce); 28 //console.log(posts_per_page); 29 print_first_row_img(args,nonce); 30 31 if (args.load_more_is_activated) { 32 load_more_img({ 33 posts_per_page: args.posts_per_page, 34 hash: args.hash, 35 query_args: args.query_args, 36 type: args.type, 37 total: args.total, 38 load_more_is_activated: args.load_more_is_activated, 39 prev: args.prev, 40 next: args.next, 41 show_total_page: args.show_total_page, 42 number_page_to_show: args.number_page_to_show, 43 },nonce); 44 } 45} 46 47 48/** 49 * Display the button download 50 * @param int hash 51 * @param bool load_more_is_activated 52 * @param json query_args 53 * @return void 54 */ 55function load_download_all_img(hash, load_more_is_activated, query_args,nonce) { 56 jQuery.post( 57 ajaxurlIMG, 58 { 59 'action': 'downloadAll', // action in lib/modules/flux_data/models/ft_imagesAjax.php 60 'query_args': query_args, 61 'security': nonce, 62 }, 63 function(response){ 64 if(response){ 65 jQuery('#download_all_' + hash).append( response ); 66 //console.log("fluxImg->0"); 67 }else{ 68 if(load_more_is_activated) { 69 jQuery('#load_more_flux_' + hash).hide(); // if no response we hide the load-more 70 } 71 72 jQuery('#download_all_' + hash).hide(); // and download button 73 } 74 } 75 ); 76} 77 78/** 79 * Displays the first row 80 * @param array args 81 * args.posts_per_page 82 * args.load_more_is_activated 83 * args.hash 84 * args.query_args 85 * @return void 86 */ 87function print_first_row_img(args,nonce) { 88 jQuery.post( 89 ajaxurlIMG, 90 { 91 'action': 'mon_action', // action in lib/modules/flux_data/models/ft_imagesAjax.php 92 'query_args': args.query_args, 93 'posts_per_page': args.posts_per_page, 94 'type': args.type, 95 'load_more_is_activated': args.load_more_is_activated, 96 'hash': args.hash, 97 'total': args.total, 98 'prev': args.prev, 99 'next': args.next, 100 'show_total_page': args.show_total_page, 101 'number_page_to_show': args.number_page_to_show, 102 'security': nonce, 103 }, 104 function (response) { 105 //console.log(response); 106 if (response) { 107 jQuery('#row_img_' + args.hash).append( response ); 108 } else if(args.load_more_is_activated) { 109 jQuery('#load_more_flux_' + args.hash).hide(); //if no response we hide load more button 110 } 111 112 if(args.load_more_is_activated) { 113 jQuery('#loading_more_spin_' + args.hash).hide(); //We hide spin loader 114 } 115 116 } 117 ); 118} 119 120/** 121 * Displays the second row after clicking on load more 122 * @param array args 123 * args.posts_per_page 124 * args.hash 125 * args.query_args 126 * @return void 127 */ 128function load_more_img(args,nonce) { 129 var offset = 0; 130 131 jQuery('body').on('change', '.select-number-element', function () { 132 var self = jQuery(this); 133 offset = 0; 134 args.posts_per_page = parseInt(self.val(), 10); 135 136 jQuery.post( 137 ajaxurlPost, 138 { 139 'action': 'load_more', //action in lib/modules/flux_data/models/ft_postAjax.php 140 'offset': offset, // 'offset' after clicking load more 141 'query_args': args.query_args, 142 'posts_per_page': args.posts_per_page, 143 'type': args.type, 144 'load_more_is_activated': args.load_more_is_activated, 145 'hash': args.hash, 146 'total': args.total, 147 'prev': args.prev, 148 'next': args.next, 149 'show_total_page': args.show_total_page, 150 'number_page_to_show': args.number_page_to_show, 151 'security': nonce, 152 //'post_id': args.post_id 153 }, 154 function (response) { 155 if (response) { 156 jQuery('.row_img').html(response); 157 jQuery('#load_more_flux_' + args.hash).show(); //if no response we hide "load-more" button 158 jQuery('#no_more_flux_' + args.hash).hide(); 159 } else { 160 if (args.type == 'loadmore') { 161 jQuery('#load_more_flux_' + args.hash).hide(); //We hide spin loader 162 } else { 163 jQuery('.paginate_div_' + args.hash).hide(); 164 } 165 } 166 167 if (args.load_more_is_activated) { 168 if (args.type == 'loadmore') { 169 jQuery('#loading_more_spin_' + args.hash).hide(); //We hide spin loader 170 } 171 } 172 } 173 ); 174 }); 175 176 jQuery('body').on('click', '#load_more_flux_' + args.hash, function() { 177 offset = offset + args.posts_per_page; 178 179 jQuery('#loading_more_spin_' + args.hash ).show(); //We show spin loader on click 180 jQuery('#no_more_flux_' + args.hash).hide(); //and we hide 'no-more' all the time 181 jQuery('#load_more_flux_' + args.hash).removeClass("load-more"); //and we remove Class "load-more" to avoid clicking 182 jQuery.post( 183 ajaxurlIMG, 184 { 185 'action': 'load_more', // action in lib/modules/flux_data/models/ft_imagesAjax.p
185hp 186 'offset': offset, // 'offset' after clicking load more 187 'query_args': args.query_args, 188 'posts_per_page': args.posts_per_page, 189 'type': args.type, 190 'load_more_is_activated': args.load_more_is_activated, 191 'hash': args.hash, 192 'total': args.total, 193 'prev': args.prev, 194 'next': args.next, 195 'show_total_page': args.show_total_page, 196 'number_page_to_show': args.number_page_to_show, 197 'security': nonce, 198 199 }, 200 function(response){ 201 //console.log(response); 202 if(response){ 203 jQuery('#row_img_' + args.hash).append( response ); 204 jQuery('#load_more_flux_' + args.hash).addClass("load-more"); //we add Class "load-more" to re-activate clicking 205 }else{ 206 jQuery('#load_more_flux_' + args.hash).hide(); //if no response we hide "load-more" button 207 jQuery('#no_more_flux_' + args.hash).show(); //and we show "no-more" button 208 } 209 jQuery('#loading_more_spin_' + args.hash).hide(); //We hide spin loader 210 } 211 ); 212 }); 213 214 jQuery('body').on('click', '.page-link', function (e) { 215 e.preventDefault(); 216 var self = jQuery(this); 217 var page = parseInt(self.attr('data-page')); 218 offset = (page - 1) * args.posts_per_page; 219 220 221 var device = $(this).parent().parent().parent().parent().parent() 222 // console.log(device) 223 var device_class = "." + device[Object.keys(device)[0]].className; 224 225 if(!isNaN(page)) { 226 jQuery.post( 227 ajaxurlPost, 228 { 229 'action': 'load_more', //action in lib/modules/flux_data/models/ft_postAjax.php 230 'offset': offset, // 'offset' after clicking load more 231 'query_args': args.query_args, 232 'posts_per_page': args.posts_per_page, 233 'type': args.type, 234 'load_more_is_activated': args.load_more_is_activated, 235 'hash': args.hash, 236 'total': args.total, 237 'prev': args.prev, 238 'next': args.next, 239 'show_total_page': args.show_total_page, 240 'number_page_to_show': args.number_page_to_show, 241 'security':nonce, 242 243 //'post_id': args.post_id 244 }, 245 function (response) { 246 if (response) { 247 var target = device_class + ' .row_img'; 248 jQuery(target).html(response); 249 } 250 } 251 ); 252 } 253 }); 254}
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.