1//votamos! 2jQuery(document).ready(function($) 3{ 4 var uid; 5 var nick; 6 var ttt_result = true; 7 if( typeof ttt_hashDatos.id.nick != "undefined" && ttt_hashDatos.id.uid != "undefined" && (ttt_result == true) ){ 8 uid = ttt_hashDatos.id.uid; 9 nick = true; 10 } 11 var date = $('#date-check span').data("date"); 12 13 $('.usuario_vota').click(function(e) 14 { 15 e.preventDefault(); 16 17 var options = 18 { 19 theme:"sk-rect", 20 message:'Cargando, espere un momento', 21 textColor:"white" 22 }; 23 24 HoldOn.open(options); 25 26 var enlace = $(this); 27 28 enlace.hide(); 29 30 31 var track_id = enlace.data("track_id"); 32 var cue_title = enlace.data("cue_title"); 33 var track_artist_name = enlace.data("track_artist_name"); 34 var fecha_list = enlace.data("fecha_list"); 35 var nonce = enlace.data("nonce"); 36 37 //votamos 38 //llamada ajax para autenticar (usamos "res") 39 $.ajax({ 40 type : "POST", 41 url : ajax_vars.ajax_url, 42 data : { action: 'is_user_prisa_logged_in', uid: uid, nick: nick }, 43 success : function(data) 44 { 45 var data = JSON.parse(data); 46 47 if (data.log == true) 48 { 49 $.ajax({ 50 type : 'POST', 51 url : ajax_vars.ajax_url, 52 data : { 53 action :'ranking_votacion', 54 uid : uid, 55 track_id : track_id, 56 cue_title : cue_title, 57 track_artist_name : track_artist_name, 58 fecha_list : fecha_list, 59 nonce : nonce 60 }, 61 success: function( response ) 62 { 63 HoldOn.close(); 64 var data = JSON.parse(response); 65 66 if(data.type == "success") 67 { 68 if (data.nvotos > 9) 69 { 70 $('.usuario_vota').hide(); 71 72 var mensaje = data.mensaje + "\n\nPOR HOY YA HAS VOTADO POR TUS 10 CANCIONES FAVORITAS DE ESTA LISTA.\n\nPUEDE SEGUIR VOTANDO HASTA LAS 23:59 HORAS DE CADA VIERNES\n\n¡GRACIAS!"; 73 74 swal("Gracias por votar",mensaje,"success"); 75 } 76 else 77 { 78 swal("Gracias por votar", data.mensaje, "success"); 79 } 80 } 81 else 82 { 83 if (data.type="warning") 84 { 85 usuarioNoLogado(data); 86 enlace.show(); 87 } 88 else 89 { 90 swal("Ha habido algún problema.", data.mensaje , data.type); 91 } 92 } 93 }, 94 error: function(response) 95 { 96 HoldOn.close(); 97 }, 98 fail: function(response) 99 { 100 HoldOn.close(); 101 } 102 }); 103 } 104 else 105 { 106 HoldOn.close(); 107 usuarioNoLogado({type:'warning', mensaje:'No te has identificado.'}); 108 enlace.show() 109 } 110 }, 111 error: function(data) 112 { 113 HoldOn.close(); 114 }, 115 fail: function(data) 116 { 117 HoldOn.close(); 118 } 119 }); 120 }); 121 122 123 function getCookie(cname) { 124 var name = cname + "="; 125 var ca = document.cookie.split(';'); 126 for(var i = 0; i < ca.length; i++) { 127 var c = ca[i]; 128 while (c.charAt(0) == ' ') { 129 c = c.substring(1); 130 } 131 if (c.indexOf(name) == 0) { 132 return c.substring(name.length, c.length); 133 } 134 } 135 return ""; 136 } 137 if( uid != 'undefined' && nick == true ){ 138 $.ajax( 139 { 140 type : "post", 141 dataType : "json", 142 url : ajax_vars.ajax_url, 143 data : 144 { 145 action:'prisa_comprobar_votaciones_lista', uid: uid, date : date 146 }, 147 success : function(data) 148 { 149 var btns_votar = $('.usuario_vota'); 150 jQuery('.usuario_vota').hide(); 151 if (data.length < 10) 152 { 153 for (var i = btns_votar.length-1; i>=0; i--) 154 { 155 if ($.inArray($(btns_votar[i]).attr('data-track_id'), data) == -1) 156 { 157 $(btns_votar[i]).show(); 158 } 159 } 160 } 161 }, 162 error : function(data) 163 { 164 jQuery('.usuario_vota').hide(); 165 } 166 }); 167 } 168 169 170 function usuarioNoLogado(response) { 171 172 swal({ 173 title: "Para votar necesitas estar registrado", 174 text: response.mensaje, 175 type: response.type, 176 showCancelButton: true, 177 confirmButtonText: "RegÃstrate o identifÃcate", 178 cancelButtonText: "Cancelar", 179 closeOnConfirm: false, 180 }, function(isConfirm) { 181 if (isConfirm) { 182 swal({ 183 title: "Para votar necesitas estar registrado", 184 text: response.mensaje, 185 type: response.type, 186 showCancelButton: true, 187 confirmButtonText: "RegÃstrate", 188 cancelButtonText: "IdentifÃcate", 189 }, function(isConfirm) { 190 if (isConfirm) { 191 document.location.href = parametros.registro_url+'?prod=REG51C&o=V51C&backURL='+parametros.back_url; 192 } else { 193 document.location.href = parametros.identificacion_url+'?backURL='+parametros.back_url; 194 } 195 }); 196 } 197 }); 198 } 199 200});
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.