1$(document).ready(function() { 2 $.each($('.adserver'), function(index, offer) { 3 registerPrint(offer); 4 $(offer).find('a').click(registerClick); 5 $(offer).find('embed').click(registerClick); 6 $(offer).find('object').click(registerClick); 7 }); 8 $('#bg_ad_left').click(registerClickSkin); 9 $('#bg_ad_right').click(registerClickSkin); 10 $('.evento-agenda').click(clickEntrada); 11 $('#myModal').css({'margin-top':'-' + ($('#myModal').height() / 2) + 'px'}) 12}); 13 14 15function csrfSafeMethod(method) { 16 // these HTTP methods do not require CSRF protection 17 return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); 18} 19 20function getCookie(name) { 21 var cookieValue = null; 22 if (document.cookie && document.cookie != '') { 23 var cookies = document.cookie.split(';'); 24 for (var i = 0; i < cookies.length; i++) { 25 var cookie = jQuery.trim(cookies[i]); 26 // Does this cookie string begin with the name we want? 27 if (cookie.substring(0, name.length + 1) == (name + '=')) { 28 cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); 29 break; 30 } 31 } 32 } 33 return cookieValue; 34} 35 36function registerClick(e){ 37 var csrftoken = getCookie('csrftoken'); 38 $.ajaxSetup({ 39 crossDomain: false, // obviates need for sameOrigin test 40 beforeSend: function(xhr, settings) { 41 if (!csrfSafeMethod(settings.type)) { 42 xhr.setRequestHeader("X-CSRFToken", csrftoken); 43 } 44 } 45 }); 46 var tipo = $(this).parents('.adserver').attr('data-type'); 47 var campaign = $(this).parents('.adserver').attr('data-campaign'); 48 console.error(tipo+":"+campaign); 49 $.ajax('/register_ad/', { 50 data: { 51 tipo: tipo, 52 campaign: campaign, 53 evento: 'click' 54 }, 55 type: 'POST' 56 }); 57} 58 59function registerClickSkin(e){ 60 var csrftoken = getCookie('csrftoken'); 61 $.ajaxSetup({ 62 crossDomain: false, // obviates need for sameOrigin test 63 beforeSend: function(xhr, settings) { 64 if (!csrfSafeMethod(settings.type)) { 65 xhr.setRequestHeader("X-CSRFToken", csrftoken); 66 } 67 } 68 }); 69 var tipo = $('#adserver-background').attr('data-type'); 70 var campaign = $('#adserver-background').attr('data-campaign'); 71 console.error(tipo+":"+campaign); 72 $.ajax('/register_ad/', { 73 data: { 74 tipo: tipo, 75 campaign: campaign, 76 evento: 'click' 77 }, 78 type: 'POST' 79 }); 80} 81 82function getCookie(cname){ 83 var name = cname + "="; 84 var ca = document.cookie.split(';'); 85 for(var i=0; i<ca.length; i++){ 86 var c = ca[i].trim(); 87 if (c.indexOf(name)==0) return c.substring(name.length,c.length); 88 } 89 return ""; 90} 91 92function setCookie(cname,cvalue,exhours,secure){ 93 var d = new Date(); 94 var secure_t = ""; 95 d.setTime(d.getTime()+(exhours*60*60*1000)); 96 var expires = "expires="+d.toGMTString(); 97 if (secure) secure_t = "; secure" 98 document.cookie = cname + "=" + cvalue + "; " + expires + secure; 99} 100 101 102function registerPrint(e){ 103 var csrftoken = getCookie('csrftoken'); 104 $.ajaxSetup({ 105 crossDomain: false, // obviates need for sameOrigin test 106 beforeSend: function(xhr, settings) { 107 if (!csrfSafeMethod(settings.type)) { 108 xhr.setRequestHeader("X-CSRFToken", csrftoken); 109 } 110 } 111 }); 112 var times = parseInt($(e).attr('data-times')); 113 var timer = parseInt($(e).attr('data-timer')); 114 var tipo = $(e).attr('data-type'); 115 var campaign = $(e).attr('data-campaign'); 116 if (times > 0){ 117 var numberaux = parseInt(getCookie("cromosoma_"+campaign)); 118 var numbera = 0; 119 if (numberaux){ numbera = numberaux; } 120 if (numbera <= timer){ 121 setCookie("cromosoma_"+campaign,numbera+1,timer,false); 122 } 123 } 124 $.ajax('/register_ad/', { 125 data: { 126 tipo: tipo, 127 campaign: campaign, 128 evento: 'print' 129 }, 130 type: 'POST' 131 }); 132} 133 134 135function addTimestamp(urls){ 136 var timest = String(new Date().getTime()); 137 // var timest = parseInt(Math.random() * 1000000); 138 var res = urls.replace('[timestamp]',timest); 139 return res 140} 141 142 143function clickEntrada(e){ 144 var click_out = $(this).attr('data-click'); 145 var click_url = $(this).attr('data-url'); 146 $.ajax('/register_click_agenda/', { 147 data: { 148 id_data: click_out, 149 }, 150 type: 'POST' 151 }); 152 window.open(click_url); 153 154}
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.