1$(document).ready(function(){ 2 //menú lateral del home en fixed 3 4 var sidebarHeigth = 1945; 5 var width_sidebar = $(".banner-aside-home").width(); 6 var documentHeigth = $(document).height(); 7 var headerHeigth = $("#pcuba-main-menu").height(); 8 9 //Barra fija al hacer scroll 10 $(window).scroll(function(){ 11 var margin = 10; 12 var sidebar_offset = documentHeigth - sidebarHeigth; //- margin*2 13 if($(document).width()>=1200 && $(document).width()<=1400 ){ 14 if($(window).scrollTop() > headerHeigth + sidebarHeigth-window.screen.height + 1230 && $(window).scrollTop() < sidebar_offset + 650){ 15 //$("#right-col-home").addClass("gray"); 16 $("#right-col-home").css({"width": width_sidebar, 'float':'left', 'left':'71.6%','right':'auto', 'bottom': sidebarHeigth - (headerHeigth)+550, 'top': 'auto', 'position': 'fixed', 'height':'100%'}); 17 18 } 19 else if($(window).scrollTop()<=headerHeigth + sidebarHeigth-window.screen.height + 1230){ 20 $("#right-col-home").css({'top': '', "width": width_sidebar, 'position':'relative', 'left':'', 'top':'','right':'', 'bottom':''}); 21 } 22 else{ 23 $("#right-col-home").css({"top": documentHeigth - sidebarHeigth - 1950, "width": width_sidebar, 'position':'relative', 'left':'','right':'', 'bottom':''}); //-margin 24 //$("#twitter-widget-0").css({'display':'none'}); 25 } 26 } 27 28 if($(document).width()>1400 && $(document).width()<=1580 ){ 29 if($(window).scrollTop() > headerHeigth + sidebarHeigth-window.screen.height + 1230 && $(window).scrollTop() < sidebar_offset + 450){ 30 //$("#right-col-home").addClass("gray"); 31 $("#right-col-home").css({"width": width_sidebar, 'float':'left', 'left':'71.1%','right':'auto', 'bottom': sidebarHeigth - (headerHeigth)+450, 'top': 'auto', 'position': 'fixed', 'height':'100%'}); 32 33 } 34 else if($(window).scrollTop()<=headerHeigth + sidebarHeigth-window.screen.height + 1230){ 35 $("#right-col-home").css({'top': '', "width": width_sidebar, 'position':'relative', 'left':'', 'top':'','right':'', 'bottom':''}); 36 } 37 else{ 38 $("#right-col-home").css({"top": documentHeigth - sidebarHeigth - 1950, "width": width_sidebar, 'position':'relative', 'left':'','right':'', 'bottom':''}); //-margin 39 //$("#twitter-widget-0").css({'display':'none'}); 40 } 41 } 42 if($(document).width()>1580 && $(document).width()<=1750 ){ 43 if($(window).scrollTop() > headerHeigth + sidebarHeigth-window.screen.height + 1230 && $(window).scrollTop() < sidebar_offset + 370){ 44 //$("#right-col-home").addClass("gray"); 45 $("#right-col-home").css({"width": width_sidebar, 'float':'left', 'left':'68.5%','right':'auto', 'bottom': sidebarHeigth - (headerHeigth)+425, 'top': 'auto', 'position': 'fixed', 'height':'100%'}); 46 47 } 48 else if($(window).scrollTop()<=headerHeigth + sidebarHeigth-window.screen.height + 1230){ 49 $("#right-col-home").css({'top': '', "width": width_sidebar, 'position':'relative', 'left':'', 'top':'','right':'', 'bottom':''}); 50 } 51 else{ 52 $("#right-col-home").css({"top": documentHeigth - sidebarHeigth - 1950, "width": width_sidebar, 'position':'relative', 'left':'','right':'', 'bottom':''}); //-margin 53 //$("#twitter-widget-0").css({'display':'none'}); 54 } 55 } 56 if($(document).width()>1750){ 57 if($(window).scrollTop() > headerHeigth + sidebarHeigth-window.screen.height + 1230 && $(window).scrollTop() < sidebar_offset + 370){ 58 //$("#right-col-home").addClass("gray"); 59 $("#right-col-home").css({"width": width_sidebar, 'float':'left', 'left':'65.4%','right':'auto', 'bottom': sidebarHeigth - (headerHeigth)+265, 'top': 'auto', 'position': 'fixed', 'height':'100%'}); 60 61 } 62 else if($(window).scrollTop()<=headerHeigth + sidebarHeigth-window.screen.height + 1230){ 63 $("#right-col-home").css({'top': '', "width": width_sidebar, 'position':'relative', 'left':'', 'top':'','right':'', 'bottom':''}); 64 } 65 else{ 66 $("#right-col-home").css({"top": documentHeigth - sidebarHeigth - 1950, "width": width_sidebar, 'position':'relative', 'left':'','right':'', 'bottom':''}); //-margin 67 //$("#twitter-widget-0").css({'display':'none'}); 68 } 69 } 70 }); 71 //Agregar sm al pagination 72 if($(document).width() < 768 ){ 73 $(".pagination").removeClass('pagination-lg'); 74 $(".pagination").addClass('pagination-sm'); 75 } 76 else{ 77 $(".pagination").removeClass('pagination-sm'); 78 $(".pagination").addClass('pagination-lg'); 79 } 80 81 82 /*Megamenu Function for with of the menu Category*/ 83 $('#category-megamenu .section-megamenu .category-list .category-row').hover( 84 function(){ 85 var category = $(this).data('category'); 86 var category_megamenu = $('#category-megamenu .dropdown-megamenu'); 87 $('#category-megamenu .summary-megamenu > ul > li').each(function(){ 88 if($(this).data('category')==category) 89 { 90 $(this).removeClass('hidden'); 91 if($(this).data('item-count')==0) 92 { 93 category_megamenu.removeClass('one-col'); 94 category_megamenu.addClass('none-col'); 95 } 96 if($(this).data('item-count')>0 && $(this).data('item-count')<3) 97 { 98 category_megamenu.removeClass('none-col'); 99 category_megamenu.addClass('one-col'); 100 } 101 if($(this).data('item-count')>2) 102 { 103 category_megamenu.removeClass('none-col'); 104 category_megamenu.removeClass('one-col'); 105 } 106 } 107 else 108 { 109 $(this).addClass('hidden'); 110 } 111 }); 112 }, 113 function(){ 114 }); 115 /*Megamenu Function for with of the menu Site*/ 116 $('#site-megamenu .section-megamenu .category-list .category-row').hover( 117 function(){ 118 var category = $(this).data('category'); 119 var site_megamenu = $('#site-megamenu .dropdown-megamenu'); 120 $('#site-megamenu .summary-megamenu > ul > li.show-menu').addClass('hidden').removeClass('show-menu'); 121 $('#site-megamenu .summary-megamenu > ul > li.hidden[data-category="'+category+'"]').addClass('show-menu').removeClass('hidden'); 122 var li_showed = $('#site-megamenu .summary-megamenu > ul > li.show-menu'); 123 if(li_showed.data('site-count')==0) 124 { 125 site_megamenu.removeClass('one-col'); 126 site_megamenu.addClass('none-col'); 127 } 128 if(li_showed.data('site-count')>0 && li_showed.data('site-count')<3) 129 { 130 site_megamenu.removeClass('none-col'); 131 site_megamenu.addClass('one-col'); 132 } 133 if(li_showed.data('site-count')>2) 134 { 135 site_megamenu.removeClass('none-col'); 136 site_megamenu.removeClass('one-col'); 137 } 138 }, 139 function(){ 140 }); 141 /**/ 142 $('#service-megamenu .section-megamenu .category-list .category-row').hover( 143 function(e){ 144 $(this).parent().children().removeClass('pointed'); 145 $(this).addClass('pointed'); 146 147 var service_id = $(this).data('service-id'); 148 var list_abstract_service = $('#service-megamenu .service-list .wrapper-abstract-service'); 149 list_abstract_service.each(function(i){ 150 if($(this).data('service-id')==service_id) 151 { 152 $(this).removeClass('hidden'); 153 }else 154 { 155 $(this).addClass('hidden'); 156 } 157 }); 158 }, 159 function(){ 160 }); 161 //setCategoryMegamenuWidth(); 162 $('#pcuba-main-menu ul.nav > li > a > span.home-active, #logo.home-active').on('click', function(e){ 163 e.preventDefault(); 164 }); 165 /*Carousel multiple*/ 166 $('#pcuba-banner-carousel').carousel({ 167 interval: 50000 168 }); 169 var window_width = $(window).width(); 170 var short_carousel_count_item; 171 var large_carousel_count_item; 172 if(window_width >= 1200) 173 { 174 short_carousel_count_item = 3; 175 large_carousel_count_item = 4; 176 } 177 else if(window_width < 1200 && window_width>=992) 178 { 179 short_carousel_count_item = 3; 180 large_carousel_count_item = 4; 181 } 182 else if(window_width < 992 && window_width>=768) 183 { 184 short_carousel_count_item = 2; 185 large_carousel_count_item = 3; 186 } 187 else if(window_width < 768) 188 { 189 short_carousel_count_item = 1; 190 large_carousel_count_item = 2; 191 } 192 var short_carousel_item; 193 short_carousel_item = $('#pcuba-banner-carousel.short-carousel').find('.carousel-inner .item'); 194 for(i = 0; i < short_carousel_item.length; i++) 195 { 196 if(i%short_carousel_count_item == 0) 197 { 198 var nexts = [];
199 nexts.push($(short_carousel_item[i]).next()); 200 for(j = 0; j <short_carousel_count_item-1; j++) 201 { 202 nexts[j].children(':first-child').clone().appendTo($(short_carousel_item[i])); 203 nexts.push(nexts[j].next()); 204 } 205 }else 206 { 207 $(short_carousel_item[i]).remove(); 208 } 209 } 210 var large_carousel_item = $('#pcuba-banner-carousel.large-carousel .carousel-inner .item'); 211 for(var i = 0; i < large_carousel_item.length; i++) 212 { 213 if(i%large_carousel_count_item == 0) 214 { 215 var nexts = []; 216 nexts.push($(large_carousel_item[i]).next()); 217 for(var j = 0; j <large_carousel_count_item-1; j++) 218 { 219 nexts[j].children(':first-child').clone().appendTo($(large_carousel_item[i])); 220 nexts.push(nexts[j].next()); 221 } 222 }else 223 { 224 $(large_carousel_item[i]).remove(); 225 } 226 } 227 /*End Carousel multiple*/ 228 /*Carousel Main Menu*/ 229 var clickCustomeHandler = function(){ 230 return false; 231 } 232 $(document) 233 .on('click.bs.carousel.data-api', '[data-slide]', clickCustomeHandler) 234 .on('click.bs.carousel.data-api', '[data-slide-to]', clickCustomeHandler); 235 /*End Carousel Main Menu*/ 236 /*Shopping Menu*/ 237 $('#shopping-megamenu .dropdown-megamenu .category-list .category-row > a').hover( 238 function () 239 { 240 if(!$(this).hasClass('pointed')) 241 { 242 var pointed = $('#shopping-megamenu .dropdown-megamenu .category-list .category-row > a.pointed') 243 var shoppingItemToggle = $('#shopping-megamenu article[data-position="'+pointed.attr('data-position')+'"].shopping-item'); 244 pointed.removeClass('pointed'); 245 shoppingItemToggle.removeClass('shopping-toggled'); 246 $(this).addClass('pointed'); 247 248 var shoppingItem = $('#shopping-megamenu article[data-position="'+$(this).attr('data-position')+'"].shopping-item'); 249 console.log(shoppingItem); 250 if(!shoppingItem.hasClass('shopping-toggled')) 251 { 252 shoppingItem.addClass('shopping-toggled'); 253 } 254 } 255 }, 256 function (){} 257 ); 258 /*End Shopping Menu*/ 259 /*Isotope plugin*/ 260 $('.grid').isotope({ 261 itemSelector: '.grid-item' 262 }); 263 /*END Isotope plugin*/ 264 /*Datepiker plujin*/ 265 $('#wrapper-datepiker .input-daterange').datepicker({ 266 format: "dd/mm/yy", 267 todayBtn: "linked", 268 language: "es", 269 todayHighlight: true, 270 endDate: "0d" 271 }); 272 $('#wrapper-datepiker .input-daterange').datepicker() 273 .on('changeDate', function(e) 274 { 275 $('.datepicker').css('display','none'); 276 }); 277 /*END Datepiker plujin*/ 278 /*Ajax for news of Home*/ 279 function change_page_or_category(category, per_page, page) 280 { 281 $.get( 282 baseURI+'home/news_by_category/'+category+'/'+per_page+'/'+page, 283 {}, 284 function (data) 285 { 286 $('#main-section-home .section-newsy .section-news').html(data); 287 }, 288 'html' 289 ); 290 } 291 $('#main-section-home .section-newsy .section-news').on('click','nav .newsy-dropdownMenu .dropdown-menu > :not(li.disabled) > a',function(e) 292 { 293 e.preventDefault(); 294 var category = $(this).data('category'); 295 var per_page=$(this).data('per-page'); 296 var page=1; 297 change_page_or_category(category, per_page, page); 298 }); 299 /*Paginador*/ 300 $('#main-section-home .section-newsy .section-news').on('click','nav ul.pcuba-pagination > li > a',function(e){ 301 e.preventDefault(); 302 var per_page = $(this).parent().data('per-page'); 303 var category = $(this).parent().data('category'); 304 var page = $(this).data('ci-pagination-page'); 305 change_page_or_category(category, per_page, page); 306 $('html,body').animate({ 307 scrollTop: $(".section-news").offset().top-$('#pcuba-main-menu').height() 308 }, 0); 309 }); 310 /*Para evitar que se ejecute*/ 311 $('#main-section-home .section-newsy .section-news').on('click','nav .newsy-dropdownMenu .dropdown-menu > li.disabled > a',function(e) 312 { 313 e.preventDefault(); 314 }); 315 /*END Ajax for news of Home*/ 316 /*Ajax for Weather and Rate in Home*/ 317 function change_province_summary_weather(province_id) 318 { 319 $.get( 320 baseURI+'weather/summary/'+province_id, 321 {}, 322 function (data) 323 { 324 $('.weather-forecast').html(data); 325 }, 326 'html' 327 ); 328 } 329 function change_rate_coin(rate_id) 330 { 331 $.get( 332 baseURI+'rate/change/'+rate_id, 333 {}, 334 function (data) 335 { 336 $('.rate-change').html(data); 337 }, 338 'html' 339 ); 340 } 341 $('.weather-forecast').on('click','form .dropdown-menu > li > a',function(e){ 342 e.preventDefault(); 343 var province_id = $(this).data('province-id'); 344 change_province_summary_weather(province_id); 345 }); 346 $('.weather-menu').on('click',function(e) 347 { 348 e.preventDefault(); 349 $('#pcuba-weather').removeClass('hidden'); 350 }); 351 $('#pcuba-weather .btn-close').on('click',function(){ 352 $('#pcuba-weather').addClass('hidden'); 353 }); 354 $('.rate-change').on('click','form .dropdown-menu > li > a',function(e){ 355 e.preventDefault(); 356 var rate_id = $(this).data('rate-id'); 357 change_rate_coin(rate_id); 358 }); 359 $('.rate-menu').on('click',function(e) 360 { 361 e.preventDefault(); 362 $('#pcuba-rate').removeClass('hidden'); 363 }); 364 $('#pcuba-rate .btn-close').on('click',function(){ 365 $('#pcuba-rate').addClass('hidden'); 366 }); 367 /*END Ajax for Weather and Rate in Home*/ 368 /*Post by AJAX for news filter limiter*/ 369 function change_news_per_page(per_page,category) 370 { 371 $.get( 372 baseURI+'news/by_category/'+category+'/'+per_page+'/'+'1', 373 {}, 374 function (data) 375 { 376 $('#pcuba-news section.news-by-category').html(data); 377 }, 378 'html' 379 ); 380 } 381 function change_news_page(page,per_page,category) 382 { 383 $.get( 384 baseURI+'news/by_category/'+category+'/'+per_page+'/'+page, 385 {}, 386 function (data) 387 { 388 $('#pcuba-news section.news-by-category').html(data); 389 }, 390 'html' 391 ); 392 } 393 function change_hot_news_category(hot_news_category,selector) 394 { 395 $.get( 396 baseURI+'news/hot_news/'+hot_news_category, 397 {}, 398 function (data) 399 { 400 $(selector+' section.news-today').html(data); 401 }, 402 'html' 403 ); 404 } 405 $('#pcuba-news .news-by-category').on('click','.form-news-limiter .limiter-filter > ul > li > a',function(e){ 406 e.preventDefault(); 407 var per_page = $(this).text(); 408 var category = $(this).data('category'); 409 change_news_per_page(per_page,category); 410 }); 411 $('#pcuba-news .news-by-category').on('click','nav ul.pcuba-pagination > li > a',function(e){ 412 e.preventDefault(); 413 var per_page = $(this).parent().data('per-page'); 414 var category = $(this).parent().data('category'); 415 var page = $(this).data('ci-pagination-page'); 416 change_news_page(page,per_page,category); 417 $('html,body').animate({ 418 scrollTop: $(".news-by-category").offset().top-$('#pcuba-main-menu').height() 419 }, 0); 420 421 }); 422 $('#pcuba-news aside').on('click','.news-today > nav .news-filter-category > ul > li > a',function(e){ 423 e.preventDefault(); 424 var hot_news_category = $(this).data('category'); 425 var selector = '#pcuba-news aside'; 426 change_hot_news_category(hot_news_category,selector); 427 }); 428 $('#pcuba-news-article aside').on('click','.news-today > nav .news-filter-category > ul > li > a',function(e){ 429 e.preventDefault(); 430 var hot_news_category = $(this).data('category'); 431 var selector = '#pcuba-news-article aside'; 432 change_hot_news_category(hot_news_category,selector); 433 }); 434 /*END Post by AJAX for news filter limiter*/ 435 /*AJAX for category filter limiter*/ 436 function change_filter_subcategory(category_slug,subcategory_id,per_page,page) 437 { 438 $.get( 439 baseURI+'category/site_by_subcat/'+category_slug+'/'+subcategory_id+'/'+per_page+'/'+page, 440 {}, 441 function (data) 442 { 443 $('#pcuba-category .site-by-category').html(data); 444 }, 445 'html' 446 ); 447 } 448 $('#pcuba-category .site-by-category').on('click','.filter-subcategory ul.dropdown-menu > li > a',function(e){ 449 e.preventDefault(); 450 var category_slug = $(this).data('category-slug'); 451 var subcategory_id = $(this).data('subcategory-id'); 452 var per_page = $(this).data('per-page'); 453 var page = 1; 454 change_filter_subcategory(category_slug,subcategory_id,per_page,page); 455 }); 456 $('#pcuba-category .site-by-category').on('click','.site-limiter ul.dropdown-menu > li > a',function(e){ 457 e.preventDefault(); 458 var category_slug = $(this).data('category-slug'); 459 var subcategory_id = $(this).data('subcategory-id'); 460 var per_page = $(this).data('per-page'); 461 var page = 1; 462 change_filter_subcategory(category_slug,subcategory_id,per_page,page); 463 }); 464 $('#pcuba-category .site-by-category').on('click','nav ul.pcuba-pagination > li > a',function(e){ 465 e.preventDefault(); 466 var category_slug = $(this).parent().data('category-slug'); 467 var subcategory_id = $(this).parent().data('subcategory-id'); 468 var per_page = $(this).parent().data('per-page'); 469 var page = $(this).data('ci-pagination-page'); 470 change_filter_subcategory(category_slug,subcategory_id,per_page,page); 471 $('html,body').animate({ 472 scrollTop: $(".site-by-category").offset().top-$('#pcuba-main-menu').height() 473 }, 0); 474 }); 475 /*END AJAX for category filter limiter*/ 476 /*AJAX for Site filter*/ 477 /*$('#pcuba-site .site-filter-category').on('click','.dropdown-menu > li > a',function(e){ 478 var subcategory = $('#pcuba-site .site-filter-category .btn > span:first-child'); 479 subcategory.text($(this).text()); 480 });*/ 481 /*END AJAX for Site filter*/ 482 /*Select Dropdown News Archive*/ 483 function change_news_category_filter(category_name, category_slug) 484 { 485 $('#pcuba-news-archive #news-archive-category span.category-name').html(category_name); 486 $('#pcuba-news-archive .form-news-archive-searcher .form-searcher-filter-top .wrapper-news-archive-category input.news-archive-category-name').val(category_name); 487 $('#pcuba-news-archive .form-news-archive-searcher .form-searcher-filter-top .wrapper-news-archive-category input.news-archive-category-slug').val(category_slug); 488 $('#pcuba-news-archive .form-news-archive-searcher .form-searcher-filter-top .wrapper-news-archive-category .dropdown-menu li.disabled').removeClass('disabled'); 489 $('#pcuba-news-archive .form-news-archive-searcher .form-searcher-filter-top .wrapper-news-archive-category .dropdown-menu li.clicked').addClass('disabled').removeClass('clicked'); 490 } 491 $('#pcuba-news-archive .form-news-archive-searcher .form-searcher-filter-top .wrapper-news-archive-category .dropdown-menu li a').on('click',function(e){ 492 e.preventDefault(); 493 var category_name = $(this).html(); 494 var category_slug = $(this).data('category-slug'); 495 496 $(this).parent().addClass('clicked'); 497 change_news_category_filter(category_name, category_slug); 498 }); 499 500 function change_news_source_filter(source_name, source_id) 501 { 502 $('#pcuba-news-archive #news-archive-source span.source-name').html(source_name); 503 $('#pcuba-news-archive .form-news-archive-searcher .form-searcher-filter-top .wrapper-news-archive-source input.news-archive-source-id').val(source_id); 504 $('#pcuba-news-archive .form-news-archive-searcher .form-searcher-filter-top .wrapper-news-archive-source input.news-archive-source-name').val(source_name); 505 $('#pcuba-news-archive .form-news-archive-searcher .wrapper-news-archive-source .dropdown-menu li.disabled').removeClass('disabled'); 506 $('#pcuba-news-archive .form-news-archive-searcher .wrapper-news-archive-source .dropdown-menu li.clicked').addClass('disabled').removeClass('clicked'); 507 } 508 $('#pcuba-news-archive .form-news-archive-searcher .wrapper-news-archive-source .dropdown-menu li a').on('click',function(e){ 509 e.preventDefault(); 510 var source_name = $(this).html(); 511 var source_id = $(this).data('source-id') ; 512 513 $(this).parent().addClass('clicked'); 514 change_news_source_filter(source_name, source_id) 515 }); 516 /*End Select Dropdown News Archive*/ 517 /*AJAX for Newsarchive filter*/ 518 function change_newsarchive_limit(news_limit, pattern, category_id, source_id, date_start, date_end, csrf_hidden_value) 519 { 520 $.get( 521 baseURI+'newsarchive/search_limit', 522 {'news_limit' : news_limit, 'pattern': pattern, 'category_id' : category_id, 'source_id' : source_id, 'date_start' : date_start , 'date_end' : date_end, 'csrf_test_name' : csrf_hidden_value}, 523 function (data) 524 { 525 $('#pcuba-news-archive .news-archive-list-result').html(data); 526 }, 527 'html' 528 ); 529 } 530 531 function change_item_selected(news_limit) 532 { 533 $('#pcuba-news-archive .news-archive-header .form-news-archive-limiter .dropdown-menu > li.disabled').removeClass('disabled') 534 $('#pcuba-news-archive .news-archive-header .form-news-archive-limiter .dropdown-menu > li.clicked').addClass('disabled').removeClass('clicked'); 535 $('#pcuba-news-archive .news-archive-header .form-news-archive-limiter .news-archive-limiter span:not(".fontAwesomeCaret")').html(news_limit); 536 } 537 538 $('#pcuba-news-archive .news-archive-header .form-news-archive-limiter .dropdown-menu > li > a').on('click',function(e){ 539 e.preventDefault(); 540 if(!$(this).parent().hasClass('disabled')) 541 { 542 $(this).parent().addClass('clicked'); 543 var news_limit = $(this).html(); 544 var pattern = $(this).data('pattern'); 545 var category_id = $(this).data('category-id'); 546 var source_id = $(this).data('source-id'); 547 var date_start = $(this).data('date-start'); 548 var date_end = $(this).data('date-end'); 549 var csrf_hidden = $('#pcuba-news-archive .news-archive-header .form-news-archive-limiter > input[type="hidden"]'); 550 var csrf_hidden_value = csrf_hidden.attr('value'); 551 552 change_newsarchive_limit(news_limit, pattern, category_id, source_id, date_start, date_end, csrf_hidden_value); 553 change_item_selected(news_limit); 554 } 555 }); 556 /*END AJAX for Newsarchive filter*/ 557 /*AJAX for Newsarchive Paginator*/ 558 function change_newsarchive_page(pattern, category_id, source_id, date_start, date_end, news_limit, page) 559 { 560 $.get(
561 baseURI+'newsarchive/search_page/'+(pattern==''?'all':pattern)+'/'+(category_id==''?'all':category_id)+'/'+(source_id==''?'all':source_id)+'/'+(date_start==''?'all':date_start)+'/'+(date_end==''?'all':date_end)+'/'+(news_limit==''?'10':news_limit)+'/'+(page==''?'0':page), 562 {}, 563 function (data) 564 { 565 $('#pcuba-news-archive .news-archive-list-result').html(data); 566 }, 567 'html' 568 ); 569 } 570 571 $('#pcuba-news-archive .news-archive-list-result').on('click', 'nav .pcuba-pagination li > a', function(e){ 572 e.preventDefault(); 573 574 if(!$(this).parent().hasClass('active')) 575 { 576 var page = $(this).data('ci-pagination-page'); 577 var pattern = $(this).parent().data('pattern'); 578 var category_id = $(this).parent().data('category-id'); 579 var source_id = $(this).parent().data('source-id'); 580 var date_start = $(this).parent().data('date-start'); 581 var date_end = $(this).parent().data('date-end'); 582 var news_limit = $(this).parent().data('news-limit'); 583 change_newsarchive_page(pattern,category_id,source_id,date_start,date_end, news_limit, page); 584 $('html,body').animate({ 585 scrollTop: $("#pcuba-news-archive").offset().top-$('#pcuba-main-menu').height() 586 }, 0); 587 } 588 }); 589 /*END for Newsarchive Paginator*/ 590 591 /*AJAX for Tag filter*/ 592 function change_tag_limit(tag_slug, per_page) 593 { 594 $.get( 595 baseURI+'tag/change_limit/'+tag_slug+'/'+per_page+'/1', 596 {}, 597 function (data) 598 { 599 $('#pcuba-news-tag .news-archive-list-result').html(data); 600 }, 601 'html' 602 ); 603 } 604 605 function change_tag_item_selected(per_page) 606 { 607 $('#pcuba-news-tag .news-archive-header .form-news-archive-limiter .dropdown-menu > li.disabled').removeClass('disabled') 608 $('#pcuba-news-tag .news-archive-header .form-news-archive-limiter .dropdown-menu > li.clicked').addClass('disabled').removeClass('clicked'); 609 $('#pcuba-news-tag .news-archive-header .form-news-archive-limiter .news-archive-limiter span:not(".fontAwesomeCaret")').html(per_page); 610 } 611 612 $('#pcuba-news-tag .news-archive-header .form-news-archive-limiter .dropdown-menu > li > a').on('click',function(e){ 613 e.preventDefault(); 614 if(!$(this).parent().hasClass('disabled')) 615 { 616 $(this).parent().addClass('clicked'); 617 var per_page = $(this).html(); 618 var tag_slug = $(this).data('tag-slug'); 619 change_tag_limit(tag_slug, per_page); 620 change_tag_item_selected(per_page); 621 } 622 }); 623 /*END AJAX for Tag filter*/ 624 /*AJAX for Tag Paginator*/ 625 function change_tag_page(tag_slug, per_page, page) 626 { 627 $.get( 628 baseURI+'tag/change_page/'+tag_slug+'/'+per_page+'/'+page, 629 {}, 630 function (data) 631 { 632 $('#pcuba-news-tag .news-archive-list-result').html(data); 633 }, 634 'html' 635 ); 636 } 637 638 $('#pcuba-news-tag .news-archive-list-result').on('click', 'nav .pcuba-pagination li > a', function(e){ 639 e.preventDefault(); 640 641 if(!$(this).parent().hasClass('active')) 642 { 643 var page = $(this).data('ci-pagination-page'); 644 var tag_slug = $(this).parent().data('tag-slug'); 645 var per_page = $(this).parent().data('per-page'); 646 change_tag_page(tag_slug, per_page, page); 647 $('html,body').animate({ 648 scrollTop: $("#pcuba-news-tag").offset().top-$('#pcuba-main-menu').height() 649 }, 0); 650 } 651 }); 652 /*END for Tag Paginator*/ 653 /*Searcher event*/ 654 function resetFormSearch() 655 { 656 /*$('#pcuba-searcher .searcher-dropdown #itemDropdownMenu span:not(".fontAwesomeCaret")').addClass('place-holder');*/ 657 $('#pcuba-searcher .searcher-dropdown #itemDropdownMenu span:not(".fontAwesomeCaret")').html('Todas las secciones'); 658 $('#pcuba-searcher .searcher-dropdown ul.dropdown-menu > li.disabled').removeClass('disabled'); 659 $('#pcuba-searcher .searcher-dropdown ul.dropdown-menu > li:nth-child(1)').addClass('disabled'); 660 $('#pcuba-searcher #patternInput').val(''); 661 $('#pcuba-searcher .searcher-dropdown #itemSelected').val(''); 662 $('#pcuba-searcher .searcher-form #patternInput').removeClass('search-has-error'); 663 $('#pcuba-searcher .searcher-form #patternInput').attr("placeholder", "Buscar..."); 664 $('#itemDropdownMenu').removeClass('search-has-error'); 665 666 } 667 $('#pcuba-searcher .btn-close').on('click',function(){ 668 $('#pcuba-searcher').addClass('hidden'); 669 resetFormSearch() 670 }); 671 $(document).keyup(function(e){ 672 if(e.which==27) 673 { 674 $('#pcuba-searcher').addClass('hidden'); 675 $('#pcuba-rate').addClass('hidden'); 676 $('#pcuba-weather').addClass('hidden'); 677 resetFormSearch(); 678 } 679 }); 680 /*Mostrar Buscador*/ 681 $('.menu-searcher, #pcuba-main-menu a.searcher-toggle').on('click',function(){ 682 $('#pcuba-searcher').removeClass('hidden'); 683 $('#pcuba-searcher #patternInput').focus(); 684 return false;
685 }); 686 function change_item_searche(item_name,item_slug) 687 { 688 $('#pcuba-searcher .searcher-dropdown ul.dropdown-menu > li.disabled').removeClass('disabled'); 689 $('#pcuba-searcher .searcher-dropdown ul.dropdown-menu > li.clicked').addClass('disabled').removeClass('clicked'); 690 $('#pcuba-searcher .searcher-dropdown #itemDropdownMenu span:not(".fontAwesomeCaret")').removeClass('place-holder'); 691 $('#pcuba-searcher .searcher-dropdown #itemDropdownMenu span:not(".fontAwesomeCaret")').html(item_name); 692 $('#pcuba-searcher .searcher-dropdown #itemSelected').val(item_slug); 693 } 694 $('.searcher-dropdown ul.dropdown-menu > li > a').on('click',function(e){ 695 e.preventDefault(); 696 if(!$(this).parent().hasClass('disabled')) 697 { 698 $(this).parent().addClass('clicked'); 699 var item_slug = $(this).data('item-slug'); 700 var item_name = $(this).html(); 701 change_item_searche(item_name,item_slug); 702 } 703 }); 704 $('#pcuba-searcher .searcher-form').on('submit', function(e){ 705 var patternInput = $('#pcuba-searcher .searcher-form #patternInput'); 706 var itemSelected = $('#pcuba-searcher .searcher-form #itemSelected'); 707 708 if((patternInput.val()=='' || patternInput.val().match(/^( )*$/)) && itemSelected.val()=='') 709 { 710 e.preventDefault(); 711 patternInput.addClass('search-has-error'); 712 patternInput.attr("placeholder", "Debe introducir un criterio de búsqueda"); 713 $('#itemDropdownMenu').addClass('search-has-error'); 714 $('#itemDropdownMenu span.place-holder').text("Debe seleccionar una sección"); 715 } 716 if((patternInput.val()=='' || patternInput.val().match(/^( )*$/)) && !(itemSelected.val()=='')) 717 { 718 e.preventDefault(); 719 patternInput.addClass('search-has-error'); 720 patternInput.attr("placeholder", "Debe introducir un criterio de búsqueda"); 721 $('#itemDropdownMenu').removeClass('search-has-error'); 722 } 723 if(!(patternInput.val()=='' || patternInput.val().match(/^( )*$/)) && itemSelected.val()=='') 724 { 725 e.preventDefault(); 726 $('#itemDropdownMenu').addClass('search-has-error'); 727 $('#itemDropdownMenu span.place-holder').text("Debe seleccionar una sección"); 728 patternInput.removeClass('search-has-error'); 729 } 730 }); 731 /*AJAX for Search filter*/ 732 function change_search_limit(item, pattern_slug, per_page) 733 { 734 $.get( 735 baseURI+'search/change_limit_page/'+item+'/'+pattern_slug+'/'+per_page+'/1', 736 {}, 737 function (data) 738 { 739 $('#pcuba-search-result .news-archive-list-result').html(data); 740 }, 741 'html' 742 ); 743 } 744 745 function change_search_item_selected(per_page) 746 { 747 $('#pcuba-search-result .news-archive-header .form-news-archive-limiter .dropdown-menu > li.disabled').removeClass('disabled') 748 $('#pcuba-search-result .news-archive-header .form-news-archive-limiter .dropdown-menu > li.clicked').addClass('disabled').removeClass('clicked'); 749 $('#pcuba-search-result .news-archive-header .form-news-archive-limiter .news-archive-limiter span:not(".fontAwesomeCaret")').html(per_page); 750 } 751 752 $('#pcuba-search-result .news-archive-header .form-news-archive-limiter .dropdown-menu > li > a').on('click',function(e){ 753 e.preventDefault(); 754 if(!$(this).parent().hasClass('disabled')) 755 { 756 $(this).parent().addClass('clicked'); 757 var item = $(this).data('item'); 758 var pattern_slug = $(this).data('pattern-slug'); 759 var per_page = $(this).html(); 760 change_search_limit(item, pattern_slug, per_page); 761 change_search_item_selected(per_page); 762 } 763 }); 764 /*END AJAX for Search filter*/ 765 /*AJAX for Search Paginator*/ 766 function change_search_page(item, pattern_slug, per_page, page) 767 { 768 $.get( 769 baseURI+'search/change_limit_page/'+item+'/'+pattern_slug+'/'+per_page+'/'+page, 770 {}, 771 function (data) 772 { 773 $('#pcuba-search-result .news-archive-list-result').html(data); 774 }, 775 'html' 776 ); 777 } 778 779 $('#pcuba-search-result .news-archive-list-result').on('click', 'nav .pcuba-pagination li > a', function(e){ 780 e.preventDefault(); 781 782 if(!$(this).parent().hasClass('active')) 783 { 784 var page = $(this).data('ci-pagination-page'); 785 var item = $(this).parent().data('item'); 786 var pattern_slug = $(this).parent().data('pattern-slug'); 787 var per_page = $(this).parent().data('per-page'); 788 change_search_page(item, pattern_slug, per_page, page); 789 $('html,body').animate({ 790 scrollTop: $("#pcuba-search-result").offset().top-$('#pcuba-main-menu').height() 791 }, 0); 792 } 793 }); 794 /*END for Search Paginator*/ 795 /*END Searcher event*/ 796 /*Arrow event*/
797 /*$(document).scrollTop(100)*/ 798 /*END Arrow event*/ 799}); 800 801/* bottom top */ 802function scroll() { 803 if ($(window).scrollTop() > 5) { 804 $('.scrollup').fadeIn(500); 805 } else { 806 $('.scrollup').fadeOut(500); 807 } 808} 809 810function scrollUp() { 811 $("html, body").animate({ 812 scrollTop: 0 813 }, 1000); 814} 815 816document.onscroll = scroll;
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.