1/* 2Dynamic advert rotation for AdRotate 3Version: 1.0.2 4Original code: Arnan de Gans 5Copyright: (c) 2020-2026 Arnan de Gans 6== Settings == 7groupid : PHP Group ID [integer, defaults to 0] 8speed : Time each slide is shown [integer: milliseconds, defaults to 3000] 9repeat_impressions : Stop counting impressions? [switch, defaults to Y] 10*/ 11(function($) { 12 $.fn.gslider = function(settings) { 13 var config = {groupid:0,speed:3000}; 14 if(settings) $.extend(true, config, settings) 15 16 this.each(function(i) { 17 var $cont = $(this); 18 var gallery = $(this).children(); 19 var length = gallery.length; 20 var timer = 0; 21 var counter = 1; 22 23 if(length == 1) { 24 // Impression tracker (Single ad) 25 var tracker = $cont.find(".c-1 a").attr("data-track"); 26 if(typeof tracker !== 'undefined') { 27 impressiontracker(tracker); 28 } 29 } 30 31 if(length > 1) { 32 $cont.find(".c-1").show(); 33 for(n = 2; n <= length; n++) { 34 $cont.find(".c-" + n).hide(); 35 } 36 37 timer = setInterval(function(){ play(); }, config.speed); 38 } 39 40 function transitionTo(gallery, index) { 41 if((counter >= length) || (index >= length)) { 42 counter = 1; 43 } else { 44 counter++; 45 } 46 $cont.find(".c-" + counter).show(); 47 48 // Impression tracker (Multiple ads) 49 var tracker = $cont.find(".c-" + counter + ' a').attr("data-track"); 50 if(typeof tracker !== 'undefined') { 51 impressiontracker(tracker); 52 } 53 $cont.find(".c-" + index).hide(); 54 } 55 56 function play() { 57 transitionTo(gallery, counter); 58 } 59 60 function impressiontracker(tracker) { 61 admeta = atob(tracker).split(','); 62 var name = escape('adrotate-'+admeta[0]); 63 var now = Math.round(Date.now()/1000); 64 var expired = now - admeta[2]; 65 var session = sessionStorage.getItem(name); // Get session data 66 67 if(session == null) { // New session, no previous data 68 session = 0; 69 } 70 71 if(session <= expired) { // Count new impression? 72 $.post(impression_object.ajax_url, {'action': 'adrotate_impression','track': tracker}); 73 sessionStorage.setItem(name, now); 74 delete tracker; 75 } 76 } 77 }); 78 return this; 79 }; 80}(jQuery));
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.