1 2$(document).ready(function(){ 3 4 5}); 6 7/* 8function obtainNewsByCategory(){ 9 //recuperamos la siguiente categoria a buscar y la quitamos del id 10 var categories_to_load_ajax = $('#categories_to_load_ajax').val().split("-"); 11 if (categories_to_load_ajax.length == 0){ 12 $('#load_data_message').html("<label class='btn btn-warning'>No hay más datos</label>"); 13 $('#load_data_message').fadeOut(2000); 14 return; 15 } else if (categories_to_load_ajax.length == 1){ 16 $('#categories_to_load_ajax').val($('#categories_to_load_ajax').val().replace(categories_to_load_ajax[0], "")); 17 } else { 18 $('#categories_to_load_ajax').val($('#categories_to_load_ajax').val().replace(categories_to_load_ajax[0]+"-", "")); 19 } 20 var category = categories_to_load_ajax[0]; 21 if (category == "" && category == 0){ 22 $('#load_data_message').html("<label class='btn btn-warning'>No hay más datos</label>"); 23 $('#load_data_message').fadeOut(2000); 24 return; 25 } 26 $.ajax({ 27 type: 'GET', 28 url:'ajax/getListNewsCategory', 29 datatype: 'json' , 30 data: {'category': category}, 31 success:function(data){ 32 if (data != undefined && data != "") { 33 data = JSON.parse(data); 34 list = data.list; 35 if (data.list != undefined && data.list != "" && data.list.length > 0) { 36 var txt = ""; 37 //se ponen las tarjetas 38 txt += '<div class="col s12 pt-3" style="margin: 0; padding: 0;">'; 39 40 //la categoria 0 es las ultimas ofertas 41 var category_name = 'Ãltimas noticias de ' + list[0].category_name; 42 txt += '<h6 style="font-weight:bold;">' + category_name + ' en ' + data.platform.name + '</h6>'; 43 txt += '</div>'; 44 45 txt += '<div class="col s12" style="margin: 0; padding: 0;">'; 46 txt += '<div id="cards_'+category+'" class="splide">'; 47 txt += '<div class="splide__track">'; 48 txt += '<ul class="splide__list">'; 49 50 for (var i = 0; i < list.length; i++) { 51 var link = 'window.location.href=\'noticias/' + list[i].slug + '/' + list[i].category_slug + '-en-' + data.platform.slug + '\''; 52 53 txt += '<li class="splide__slide" style="cursor:pointer; text-align: center; margin-bottom: 0.5rem; margin-top: 0.5rem;" onclick="' + link + '">'; 54 txt += '<div class="card" style="padding: 0; margin: 0 0.2rem 0 0.2rem; height: 100%;">'; 55 txt += '<div style="cursor:pointer; position: relative; width: 100%; padding-top: 65%;" onclick="' + link + '">'; 56 if (list[i].file_img != "" && list[i].file_img != null) { 57 txt += '<img style="position: absolute;top: 0;left:0; right:0; bottom: 0; margin: auto; max-width: 100%; max-height:100%;" src="resources/uploads/news/' + list[i].id + '/' + list[i].file_img + '">'; 58 } else { 59 txt += '<img style="position: absolute;top: 0;left:0; right:0; bottom: 0; margin: auto; max-width: 100%; max-height:100%;" src="resources/img/sin_foto_fachada.jpg">'; 60 } 61 txt += '</div>'; 62 txt += '<div class="card-content" style="">'; 63 txt += '<h6 style="cursor:pointer;" onclick="' + link + '">' + list[i].title + '</h6>'; 64 txt += '</div>'; 65 txt += '</div>'; 66 txt += '</li>'; 67 68 } 69 click_ver = 'window.location.href=\'noticias/' + list[0].category_slug + '-en-' + data.platform.slug + '\''; 70 txt += '<li class="splide__slide" style="text-align: center; margin-bottom: 0.5rem; margin-top: 0.5rem;" onclick="'+click_ver+'">'; 71 txt += '<div class="card" style="padding: 0; margin: 0 0.2rem 0 0.2rem; height: 100%;">'; 72 txt += '<div style="width: 100%;text-align: center;">'; 73 if (category == 0) { 74 txt += '<img src="resources/img/all_categories.jpg" style="max-width: 100%">'; 75 } else { 76 txt += '<img src="resources/uploads/offers_category/' + list[0].category_id + '/' + list[0].category_photo + '" style="max-width: 100%">'; 77 } 78 txt += '</div>'; 79 txt += '<div class="card-content" style="text-align: center;">'; 80 txt += '<br>'; 81 txt += '<a class="waves-effect waves-light btn blue lighten-2 box-shadow-none border-round mr-1 mb-5">VER MÃS</a>'; 82 txt += '<br><br>'; 83 txt += '<p>'; 84 if (category == 0) { 85 txt += 'Ãltimas ofertas en la zona de<br>' + data.platform.name; 86 } else { 87 txt += 'Ver más noticias de<br>' + list[0].category_name + '<br>en la zona<br>' + data.platform.name; 88 } 89 txt += '</p>'; 90 txt += '</div>'; 91 txt += '</div>'; 92 txt += '</li>'; 93 94 txt += '</ul>'; 95 txt += '</div>'; 96 txt += '</div>'; 97 txt += '</div>'; 98 $('#list').append(txt); 99 100 //para las cartas 101 var windowsize = window.innerWidth; 102 var perPage = 4; 103 if (windowsize < 602) {perPage = 2} 104 new Splide( '#cards_'+category ,{ 105 pagination: false, 106 perPage: perPage, 107 } ).mount(); 108 } 109 action = 'inactive'; 110 } 111 }, 112 error:function(data){ 113 action = 'inactive'; 114 } 115 }); 116} 117*/
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.