1var ITM_Gallery = window.ITM_Gallery || {}; //the way we have for banners..... 2ITM_Gallery.ITM_Gallery_Load = false; 3ITM_Gallery.ITM_Gallery_Load_Flag = ''; 4 5"use strict"; 6 7jQuery(document).ready(function( $ ){ 8 readyFn_GalleryAjax( $ , 'document.ready' ); 9 ITM_Gallery.ITM_Gallery_Load_Flag = 'document.ready'; 10}); 11 12 13//(function ($) { 14 //$(document).ready(function () 15 function readyFn_GalleryAjax( $ , flagCheck = ''){ 16 17 if (ITM_Gallery.ITM_Gallery_Load) { 18 window.console.log('ITM_Gallery_Load return : '+flagCheck); 19 window.console.log('ITM_Gallery_Load_Flag : '+ITM_Gallery.ITM_Gallery_Load_Flag); 20 21 //donot want to call this func again..... from pjax.... 22 return; 23 } 24 25 //we need to call only once. if pjax and or document.ready above. 26 ITM_Gallery.ITM_Gallery_Load = true; 27 28 window.console.log('readyFn_GalleryAjax func code called.....'); 29 30 var after_vote_modal_controller = (function () { 31 var module = {}; 32 var selector = jQuery("#after-vote-modal"); 33 var modal_title = jQuery("#after-vote-modal h1"); 34 var modal_body = jQuery("#after-vote-modal p"); 35 36 module.show = function () { 37 selector.modal(); 38 return this; 39 }; 40 41 module.setMessage = function (title_text, body_text) { 42 modal_title.text(title_text); 43 modal_body.text(body_text); 44 this.show(); 45 return this; 46 }; 47 48 return module; 49 })(); 50 51 try { //added try catch to stop one error during issue : WPB-4249 52 53 jQuery("#wpbg-voting-results-modal").on(jQuery.modal.BEFORE_BLOCK, function ( 54 event, 55 modal 56 ) { 57 jQuery("figure.wpbg-gallery-item").css("z-index", "0"); 58 }); 59 60 jQuery("#wpbg-voting-results-modal").on(jQuery.modal.CLOSE, function (event, modal) { 61 jQuery("figure.wpbg-gallery-item").css("z-index", "20"); 62 }); 63 64 jQuery("#after-vote-modal").on(jQuery.modal.BEFORE_BLOCK, function (event, modal) { 65 jQuery("figure.wpbg-gallery-item").css("z-index", "0"); 66 }); 67 68 jQuery("#after-vote-modal").on(jQuery.modal.CLOSE, function (event, modal) { 69 jQuery("figure.wpbg-gallery-item").css("z-index", "20"); 70 }); 71 72 }catch(e) { window.console.log('Opps ! readyFn_GalleryAjax catch things............'); } 73 74}//End of function readyFn_GalleryAjax 75 76 77 jQuery(document).on("change", ".target-change", function (ev) { 78 if (ev.handled !== undefined) { 79 ev.handled = true; 80 return; 81 } 82 ev.preventDefault(); 83 //console.log(this); 84 var itemid = jQuery(this).attr("name"); 85 // alert(itemid) 86 var inputBoxId = jQuery(this).attr("id"); 87 var enable_voting_type = jQuery("#enable_voting_type").val(); 88 var formData = { 89 gallery_id: jQuery("#gallery_id").val(), 90 item_id: jQuery(this).attr("name"), 91 votes: jQuery(this).val() 92 }; 93 94 var fp2s = jQuery("#fingerprint2_signature").val(); 95 if (fp2s == "") { 96 getSignature(itemid, inputBoxId, enable_voting_type, formData, fp2s); 97 } 98 else { 99 saveVotes(itemid, inputBoxId, enable_voting_type, formData, fp2s); 100 } 101 }); 102 103 function getSignature(itemid, inputBoxId, enable_voting_type, formData, fp2s) { 104 //console.log("Signature Start inside..."); 105 var hasConsole = typeof console !== "undefined" 106 var fingerprintReport = function () { 107 var options = { 108 excludes: { 109 availableScreenResolution: true, 110 enumerateDevices: true, 111 doNotTrack: true, 112 adBlock: true, 113 indexedDb: true, 114 font: true 115 } 116 } 117 118 Fingerprint2.get(options, function (components) { 119 var signature = Fingerprint2.x64hash128(components.map(function (pair) { 120 return pair.value 121 }).join(), 31) 122 console.log("User Fingerprint Inside: ", signature); 123 jQuery('#fingerprint2_signature').val(signature); 124 fp2s = signature; 125 saveVotes(itemid, inputBoxId, enable_voting_type, formData, fp2s); 126 }) 127 } 128 var cancelId 129 var cancelFunction 130 if (window.requestIdleCallback) { 131 //console.log("requestIdleCallback true"); 132 cancelId = requestIdleCallback(fingerprintReport) 133 cancelFunction = cancelIdleCallback 134 } else { 135 //console.log("requestIdleCallback false"); 136 cancelId = setTimeout(fingerprintReport, 500) 137 cancelFunction = clearTimeout 138 } 139 console.log("Signature End inside..."); 140 } 141 142 function saveVotes(itemid, inputBoxId, enable_voting_type, formData, fp2s) { 143 //alert(jQuery(this).parent().parent().parent().attr('id')); 144 //jQuery(this).closest(".voting-control").find(".loading-spin").show(); 145 jQuery(".voting-" + itemid + " .loading-spin").show(); 146 jQuery(".voting-" + itemid + " .gallery-item-voting").hide(); 147 148 if ( 149 jQuery(".wpb_shared_site_url").val() == "" || 150 jQuery(".wpb_shared_site_url").val() === undefined 151 ) { 152 var call_action = "wpb_gallery_save_votes"; 153 } else { 154 var call_action = "wpb_gallery_save_votes_with_rest_api"; 155 } 156 //console.log(call_action); 157 var siteid = jQuery(".wpb_shared_site_id").val(); 158 //console.log(siteid); 159 if (Object.keys(formData).length) { 160 //console.log("wpb_gallery_user_ip_address:", wpb_gallery_user_ip_address); 161 var signature = fp2s + '_' + wpb_gallery_user_ip_address; 162 console.log("signature:", fp2s + '_' + wpb_gallery_user_ip_address); 163 jQuery.ajax(wpobj.ajax_url, { 164 data: { 165 action: call_action, 166 votes: formData["votes"], 167 gallery_id: formData["gallery_id"], 168 item_id: formData["item_id"], 169 siteid: siteid, 170 user_ip_address: signature // gallery-public.php line 311 function enqueue_scripts 171 }, 172 success: function (response) { 173 ("response:"); 174 console.log(response); 175 jQuery(".voting-" + itemid + " .loading-spin").hide(); 176 if (response.hasOwnProperty("status")) { 177 var voting_status_gallery_items = {}; 178 if (response.status === "success") { 179 voting_status_gallery_items = response.results.items; 180 for (var item_id in voting_status_gallery_items) { 181 var item = voting_status_gallery_items[item_id]; 182 var voteresult = item.votes_result[0]; 183 console.log("item"); 184 console.log(item); 185 var vote_total1 = voteresult.vote_total; 186 var like_count = item.like_count; 187 var dislike_count = item.dislike_count; 188 var vote_num1 = voteresult.num_votes; 189 var item_avg = parseFloat(vote_total1 / vote_num1).toFixed(1); 190 if (response.view_results === true) { 191 jQuery(".voting-" + itemid + " .gallery-item-voting").show(); 192 //console.log(inputBoxId) 193 194 //var rating_val = Math.round(item_avg); 195 var clickID = Math.round(formData["votes"] / 2); 196 var selectID = Math.round(item_avg / 2); 197 //console.log(selectID); 198 /*if(Math.abs(selectID % 2) !=0) 199 var selectID = selectID+1;*/ 200 //console.log('rating'+clickID+'_'+itemid); 201 if ("rating" + clickID + "_" + itemid == inputBoxId) { 202 //console.log('yes-'+'#rating'+selectID+'_'+itemid); 203 jQuery( 204 ".voting-" + 205 itemid + 206 " .gallery-item-voting .target-change" 207 ); 208 jQuery(".rating" + selectID + "_" + itemid).attr( 209 "checked", 210 true 211 ); 212 jQuery( 213 ".voting-" + 214 itemid + 215 " .gallery-item-voting .target-change" 216 ).prop("disabled", "disabled"); 217 } else if ( 218 "like_image_" + itemid == inputBoxId || 219 "dislike_image_" + itemid == inputBoxId 220 ) { 221 if (item_avg > 5) 222 jQuery("#like_image_" + itemid).attr("checked", true); 223 else jQuery("#dislike_image_" + itemid).attr("checked", true); 224 jQuery(".like_image_" + itemid).html(like_count); 225 jQuery(".dislike_image_" + itemid).html(dislike_count); 226 jQuery( 227 ".voting-" + 228 itemid + 229 " .gallery-item-voting .target-change" 230 ).prop("disabled", "disabled"); 231 } else if ("image_" + itemid == inputBoxId) { 232 if (item_avg > 5) 233 jQuery("#image_" + itemid).attr("checked", true); 234 jQuery( 235 ".voting-" + 236 itemid + 237 " .gallery-item-voting .target-change" 238 ).prop("disabled", "disabled"); 239 jQuery(".image_" + itemid).html(like_count); 240 } else { 241 //jQuery(".voting-"+itemid+" .gallery-item-voting .target-change").val(Math.round(item_avg)).prop('disabled', 'disabled'); 242 jQuery(".voting-" + itemid).html( 243 "<p><strong>AR</strong> " + item_avg + "/10 </p>" 244 ); 245 } 246 //jQuery(".voting-"+itemid).append('<p><strong>AR</strong> '+item_avg+'/10 <strong>#Vote</strong> '+vote_num1+'</p>'); 247 } else { 248 if (item.saved === true) { 249 jQuery(".voting-" + itemid).html( 250 "<p>Thank you for voting.</p>" 251 ); 252 } else if (item.saved === false) { 253 if (item.limit_reached === true) { 254 jQuery(".voting-" + itemid).html( 255 "<p>Voting limit reached</p>" 256 ); 257 } 258 } 259 } 260 } 261 //console.log(response); 262 } else if (response.status === "error") { 263 // don't hide voting options. add message 264 // jQuery("<p class='alert alert-warning error-lable'>Votes not saved, please contact the administrator for this website</p>").insertBefore("#wpb-gallery"); 265 // jQuery('html, body').animate({ 266 // scrollTop: jQuery("#wpb-gallery").offset().top-50 267 // }, 1000); 268 jQuery(".voting-" + itemid).html("<p>" + response.error + "</p>"); 269 //console.log(response.error); 270 } else if (response.status === "all_limits_reached") { 271 for (var item_id in response.results.items) { 272 jQuery(".voting-" + itemid + " .gallery-item-voting").show(); 273 var message = response.results.items[item_id]['message']; 274 // jQuery(".voting-" + item_id + " .gallery-item-voting").show(); 275 // jQuery(".image_" + item_id).html(number_votes + ' (Voting limit reached)'); 276 // jQuery(".image_-" + item_id + ".gallery-item-voting .target-change").prop("disabled", "disabled"); 277 jQuery("#voting-" + item_id) 278 .empty() 279 .append("<p>" + message + "</p>"); 280 jQuery("#voting-" + item_id + " .gallery-item-voting") 281 .empty() 282 .append("<p>" + message + "</p>"); 283 //.append("<p>Voting limit reached (Max " + number_votes + " per Day)</p>"); 284 console.log("Done:", message); 285 } 286 } 287 } 288 }, 289 error: function (textStatus, errorThrown) { 290 //console.log("error"); 291 //console.log(textStatus); 292 //console.log(errorThrown); 293 }, 294 dataType: "json", 295 method: "POST" 296 }); 297 } else { 298 jQuery( 299 "<p class='alert alert-warning error-lable'>Vote on at least one item before clicking submit</p><br/>" 300 ).insertBefore("#wpb-gallery"); 301 } 302 } 303 304 // }); 305//})(jQuery); 306 307function getUrlVars() { 308 var vars = [], 309 hash; 310 var hashes = window.location.href 311 .slice(window.location.href.indexOf("?") + 1) 312 .split("&"); 313 for (var i = 0; i < hashes.length; i++) { 314 hash = hashes[i].split("="); 315 vars.push(hash[0]); 316 vars[hash[0]] = hash[1]; 317 } 318 return vars; 319} 320 321function callGalleryAction(pageNo, galleryId, postType, sharedUrl, galid, limit) { 322 console.log('callGalleryAction'); 323 var siteid = jQuery(".wpb_shared_site_id").val(); 324 console.log(siteid); 325 if (sharedUrl != "") { 326 shared_call_action_pagi = "rander_gallery_with_pagination_shared"; 327 } else { 328 shared_call_action_pagi = "rander_gallery_with_pagination"; 329 } 330 console.log(shared_call_action_pagi); 331 jQuery("#wpb-gallery-" + galleryId).html( 332 '<div class="alert alert-info" style="padding: 5px 10px;"><i class="fa fa-refresh fa-spin fa-fw"></i> <span>Loading Gallery...</span></div>' 333 ); 334 console.log(galleryId); 335 jQuery.ajax(wpobj.ajax_url, { 336 data: { 337 action: shared_call_action_pagi, 338 pageNo: pageNo, 339 galleryId: galleryId, 340 postType: postType, 341 sharedUrl: sharedUrl, 342 galid: galid, 343 siteid: siteid, 344 limit:limit 345 }, 346 success: function (response) { 347 console.log("sucess"); 348 jQuery("#wpb-gallery-" + galleryId).html(response); 349 if (getUrlVars().length > 0) { 350 if (getUrlVars()["galid"] !== undefined) { 351 var galids = getUrlVars()["galid"].split("#"); 352 if (galids.length > 0) { 353 jQuery("#wpbg-gallery-item-col-" + galids[0]).addClass("divAddBorder"); 354 } 355 } 356 } 357 } 358 }); 359 return false
vendor: 4 bytes, lines 359-360
359; 360}
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.