1/* 2Dynamic advert rotation for AdRotate 3Arnan de Gans (https://www.arnan.me) 4Version: 1.0.1 5With help from: Mathias Joergensen, Fraser Munro 6Original code: Arnan de Gans 7*/ 8 9/* ------------------------------------------------------------------------------------ 10* COPYRIGHT AND TRADEMARK NOTICE 11* Copyright 2008-2019 Arnan de Gans. All Rights Reserved. 12* ADROTATE is a trademark of Arnan de Gans. 13 14* COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT. 15* By using this code you agree to indemnify Arnan de Gans from any 16* liability that might arise from it's use. 17------------------------------------------------------------------------------------ */ 18 19/* == Settings == 20groupid : PHP Group ID [integer, defaults to 0] 21speed : Time each slide is shown [integer: milliseconds, defaults to 3000] 22repeat_impressions : Stop counting impressions? [switch, defaults to Y] 23*/ 24 25(function($) { 26 $.fn.gslider = function(settings) { 27 var config = {groupid:0,speed:3000,repeat_impressions:'Y'}; 28 if(settings) $.extend(true, config, settings) 29 30 this.each(function(i) { 31 var $cont = $(this); 32 var gallery = $(this).children(); 33 var length = gallery.length; 34 var timer = 0; 35 var counter = 1; 36 var repeat = 1; 37 38 if(length == 1) { 39 // Impression tracker (Single ad) 40 var tracker = $cont.find(".c-1 a").attr("data-track"); 41 if(typeof tracker !== 'undefined') { 42 impressiontracker(tracker); 43 } 44 } 45 46 if(length > 1) { 47 $cont.find(".c-1").show(); 48 for(n = 2; n <= length; n++) { 49 $cont.find(".c-" + n).hide(); 50 } 51 52 timer = setInterval(function(){ play(); }, config.speed); 53 } 54 55 function transitionTo(gallery, index) { 56 if((counter >= length) || (index >= length)) { 57 counter = 1; 58 repeat = 2; 59 } else { 60 counter++; 61 } 62 $cont.find(".c-" + counter).show(); 63 64 // Impression tracker (Multiple ads) 65 var tracker = $cont.find(".c-" + counter + ' a').attr("data-track"); 66 if(typeof tracker !== 'undefined') { 67 if((repeat == 1 && config.repeat_impressions == 'N') || config.repeat_impressions == 'Y') { 68 impressiontracker(tracker); 69 } 70 } 71 $cont.find(".c-" + index).hide(); 72 } 73 74 function play() { 75 transitionTo(gallery, counter); 76 } 77 78 function impressiontracker(tracker) { 79 admeta = atob(tracker).split(','); 80 var name = escape('adrotate-'+admeta[0]); 81 var now = Math.round(Date.now()/1000); 82 var expired = now - admeta[3]; 83 var session = sessionStorage.getItem(name); // Get session data 84 85 if(session == null) { // New session, no previous data 86 session = 0; 87 } 88 89 if(session <= expired) { // Count new impression? 90 $.post(impression_object.ajax_url, {'action': 'adrotate_impression','track': tracker}); 91 sessionStorage.setItem(name, now); 92 delete tracker; 93 } 94 } 95 }); 96 return this; 97 }; 98}(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.