1$(window).load(function() { 2 /*********************************** 3 * Homepage 4 ***********************************/ 5 if ($('.sliderAreas > ul').length) { 6 $('.sliderAreas > ul').carouFredSel({ 7 width: 700, 8 height: 295, 9 scroll: { 10 fx: 'crossfade', 11 easing: 'linear', 12 pauseOnHover: true 13 }, 14 pagination: { 15 container: ".btnSlider > ul", 16 queue: false, 17 anchorBuilder: function(nr) { 18 return '<li><span class="sectionArea iconSmall ' + $(this).find('img').data('area') + '"></span></li>'; 19 } 20 } 21 }); 22 } 23}); 24 25$(document).ready(function() { 26 // Json 27 $.cookie.json = true; 28 29 $("img").error(function () { 30 $(this).css('visibility', 'hidden'); 31 }); 32 33 // SlideShow Navigation 34 $('.btnSlider .triggerButton').bind('click', function() { 35 if (!$(this).parent().hasClass('opened')) { 36 $(this).parent().addClass('opened').find('ul').animate({ 37 height: '265' 38 }, 200, 'linear'); 39 } else { 40 if (!$(this).hasClass('closing')) { 41 $(this).addClass('closing').next('ul').animate({ 42 height: '0' 43 }, 200, 'linear', function() { 44 $(this).closest('.btnSlider').fadeOut(function() { 45 $(this).removeClass('opened').fadeOut(function() { 46 $(this).fadeIn(); 47 $(this).find('.triggerButton').removeClass('closing'); 48 }); 49 }); 50 }); 51 } 52 } 53 }); 54 /*********************************** 55 * Global 56 ***********************************/ 57 bestTables.methods.init(); 58 boxReservations.methods.init(); 59 eventsCalendarWidget.methods.init(); 60 crossSellingBlock.methods.init(); 61 tabsList.methods.init(); 62 mainMenu.methods.init(); 63 ratingsBlock.methods.init(); 64 weather.methods.init(); 65 clock.methods.init($('.currentInformation > .time > .clock'), $('.currentInformation > .time > .date')); 66 67 // Popup 68 utils.widgets.popup.methods.add({ 69 selector: '.fpopup' 70 }); 71 72 // Select Boxes 73 utils.widgets.select.methods.add({ 74 selector: $('.selectBox') 75 }); 76 77 // Select Boxes (Multi) 78 if ($('.multiSelect').length) { 79 $.each($('.multiSelect'), function() { 80 utils.widgets.multiselect.methods.add({ 81 selector: $(this) 82 }); 83 }); 84 } 85 86 // Rating Stars (Read Only) 87 utils.widgets.rating.methods.add({ 88 selector: '.ratingStarsRO', 89 score: function() { 90 return $(this).attr('data-score'); 91 }, 92 readOnly: false 93 }); 94 95 // Rating Stars 96 $.each($('.ratingStars'), function() { 97 $this = $(this); 98 utils.widgets.rating.methods.add({ 99 selector: $this, 100 score: function() { 101 return $(this).attr('data-score'); 102 }, 103 readOnly: $this.data('ronly'), 104 target: $this.data('target'), 105 targetKeep: $this.data('target-keep') 106 }); 107 }); 108 109 //Language Menu 110 if ($("#header .language.menu").length > 0) { 111 $("#header .language.menu").click(function(){ 112 if ($("#menuLang").hasClass("hide")) { 113 $("#menuLang").slideDown("normal", function() { 114 $("#menuLang").removeClass("hide").addClass("show"); 115 }); 116 } 117 }); 118 $("#menuLang .activeLang").click(function(){ 119 if ($("#menuLang").hasClass("show")) { 120 $("#menuLang").slideUp("normal", function() { 121 $("#menuLang").removeClass("show").addClass("hide"); 122 }); 123 } 124 }); 125 } 126}); 127 128var clock = { 129 storage: { 130 pad: "00", 131 dateTimeObj: null 132 }, 133 methods: { 134 init: function(clockSelector, dateSelector) { 135 clock.methods.setTimeDate(clockSelector, dateSelector); 136 }, 137 setTimeDate: function(clockSelector, dateSelector) { 138 139 // Current Date 140 var date = new Date; 141 142 clock.storage.dateTimeObj = { 143 date: { 144 y: date.getFullYear(), 145 m: clock.methods.padNumber(date.getMonth()), 146 d: clock.methods.padNumber(date.getDate()), 147 w: date.getDay() 148 }, 149 dateTxt: { 150 m: utils.methods.getLangTxt('txt_calendario', 'meses_' + (date.getMonth() + 1)), 151 w: utils.methods.getLangTxt('txt_calendario', 'diasemana_' + date.getDay()) 152 }, 153 hour: { 154 h: clock.methods.padNumber(date.getHours()), 155 m: clock.methods.padNumber(date.getMinutes()), 156 s: clock.methods.padNumber(date.getSeconds()) 157 } 158 }; 159 160 $(clockSelector).html(clock.storage.dateTimeObj.hour.h + ':' + clock.storage.dateTimeObj.hour.m); 161 $(dateSelector).html(clock.methods.parseDate(utils.methods.getLangTxt('txt_geral', 'data-formato'))); 162 163 window.setTimeout(function() { 164 clock.methods.setTimeDate(clockSelector, dateSelector); 165 }, 1000); 166 167 return true; 168 }, 169 padNumber: function(number) { 170 return clock.storage.pad.substring(0, clock.storage.pad.length - number.toString().length) + number; 171 }, 172 parseDate: function(dateStr) { 173 for (var format in clock.storage.dateTimeObj) { 174 for (var formatVal in clock.storage.dateTimeObj[format]) {
175 dateStr = dateStr.replace(format + "." + formatVal, clock.storage.dateTimeObj[format][formatVal]); 176 } 177 } 178 return dateStr; 179 } 180 } 181}; 182 183var weather = { 184 storage: { 185 loaderCssClass: 'loader lsmall lblack', 186 isLoaded: false 187 }, 188 methods: { 189 init: function() { 190 191 utils.widgets.select.methods.add({ 192 selector: $('#cbWeather'), 193 minimumResultsForSearch: -1, 194 dropdownCssClass: 'weatherStyle' 195 }); 196 $('#cbWeather').on('change', function(e) { 197 e.preventDefault(); 198 weather.methods.getWeather($(this).val()); 199 }); 200 201 if ($('#cbWeather option:selected').data('hash').length > 0) { 202 weather.methods.setWeatherPlaceHash($('#cbWeather option:selected').data('hash')); 203 } 204 }, 205 getWeather: function (placeID) { 206 $.ajax({ 207 type: "POST", 208 url: "/" + utils.methods.getLang() + "/xhr/xhr.ajax.php", 209 data: { 210 method: "getWeatherPlace", 211 object: "weather", 212 params: { 213 placeID : placeID 214 } 215 }, 216 beforeSend: function() { 217 $('#weatherContainer').addClass(weather.storage.loaderCssClass).html(''); 218 } 219 }).done(function(json) { 220 if (json._status.sucess) { 221 222 // Set weather placeID 223 $.cookie('cWeather', parseInt(placeID), { 224 path: '/' 225 }); 226 227 weather.methods.setWeatherPlaceHash(json.data[0].codigo); 228 } 229 }).fail(function() { 230 console.warn('Não foi possÃvel realizar o pedido'); 231 }); 232 }, 233 setWeatherPlaceHash: function(placeHash) { 234 var weatherHtml = '<div id="c_'+ placeHash +'" class="mini">'; 235 weatherHtml += '<div id="w_'+ placeHash +'" class="mini" style="height:100%"></div>'; 236 weatherHtml += '</div>'; 237 weatherHtml += '<script type="text/javascript" src="http://www.otempo.pt/dados/loader/'+ placeHash +'"><\/script>'; 238 window.setTimeout(function() { 239 $('#weatherContainer').removeClass(weather.storage.loaderCssClass).hide().html(weatherHtml).fadeIn('slow'); 240 }, 1000); 241 } 242 } 243}; 244 245var bestTables = { 246 methods: { 247 init: function() { 248 // BestTables Widget3.0 249 var bt = document.createElement("script"); bt.type = "text/javascript"; bt.async = true; 250 bt.src = ("https:" == document.location.protocol ? "https://" : "http://") + "besttables.com/widget/v0/scripts/bt_widget.js"; 251 var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bt, s); 252 } 253 } 254}; 255 256var boxReservations = { 257 storage: { 258 tabSelected: 'selected', 259 tabPanelActive: 'active' 260 }, 261 methods: { 262 init: function() { 263 264 $('.highlight.one-block.tipo-reservations > .tabs span').bind('click', function() { 265 boxReservations.methods.changeTab($(this).parent().index()); 266 }); 267 268 utils.widgets.datepicker.methods.add({ 269 selector: $('.highlight.one-block.tipo-reservations .checkIn'), 270 minDate: "0", 271 numberOfMonths: 2, 272 onSelect: function(date) { 273 date = $('.highlight.one-block.tipo-reservations .checkIn').datepicker('getDate'); 274 date.setDate(date.getDate() + 1); 275 $('.highlight.one-block.tipo-reservations .checkOut').datepicker('option', 'minDate', date); 276 }, 277 beforeShow: function (input, inst) { 278 setTimeout(function () { 279 inst.dpDiv.css({ 280 top: 425, 281 left: 755 282 }); 283 }, 0); 284 } 285 }); 286 287 utils.widgets.datepicker.methods.add({ 288 selector: $('.highlight.one-block.tipo-reservations .checkOut'), 289 minDate: "+1", 290 numberOfMonths: 2, 291 beforeShow: function (input, inst) { 292 setTimeout(function () { 293 inst.dpDiv.css({ 294 top: 425, 295 left: 755 296 }); 297 }, 0); 298 } 299 }); 300 }, 301 changeTab: function(index) { 302 $('.highlight.one-block.tipo-reservations > .tabs span').removeClass(boxReservations.storage.tabSelected); 303 $('.highlight.one-block.tipo-reservations').find('.panel').removeClass(boxReservations.storage.tabPanelActive); 304 $('.highlight.one-block.tipo-reservations > .tabs li:eq('+ index +') span').addClass(boxReservations.storage.tabSelected); 305 $('.highlight.one-block.tipo-reservations > .tabs').find('.panel:eq('+ index +')').addClass(boxReservations.storage.tabPanelActive); 306 } 307 } 308}; 309 310var eventsCalendarWidget = { 311 storage: { 312 tabSelected: 'selected', 313 tabPanelActive: 'active' 314 }, 315 methods: { 316 init: function() { 317 318 eventsCalendarWidget.calendar.methods.init(); 319 320 utils.widgets.datepicker.methods.add({ 321 selector: $('#eventsCalendarWidget .search .datainicio'), 322 minDate: "0", 323 numberOfMonths: 2, 324 onSelect: function(date) { 325 date = $(this).datepicker('getDate'); 326 date.setDate(date.getDate()); 327 $('#eventsCalendarWidget .search .datafim').datepicker('option', 'minDate', date); 328 } 329 }); 330 331 utils.widgets.datepicker.methods.add({ 332 selector: $('#eventsCalendarWidget .search .datafim'), 333 minDate: "0", 334 numberOfMonths: 2 335 }); 336 337 $('#eventsCalendarWidget .viewMode').on('click', function() { 338 eventsCalendarWidget.calendar.methods.toggleType(); 339 }); 340 341 $('#eventsCalendarWidget .btnClose').on('click', function() { 342 if ($('#eventsCalendarWidget').hasClass('searchVisible')) { 343 $('#content > .eventsCalendar.searchVisible > .search > form .btnClose').fadeOut(); 344 $('#eventsCalendarWidget >
344 .search .searchBlocks').slideUp(); 345 } else { 346 $('#eventsCalendarWidget > .search').slideUp(); 347 } 348 349 if($('#eventsCalendarWidget .weekEvents li.details.selected').length > 0) { 350 $('#eventsCalendarWidget .weekEvents li.details.selected').removeClass('selected'); 351 } 352 }); 353 } 354 }, 355 calendar: { 356 properties: { 357 type: 'weekEvents' // weekEvents / monthEvents 358 }, 359 storage: { 360 navigation: {} 361 }, 362 methods: { 363 init: function() { 364 if ($.cookie('cWidgetType')) { 365 eventsCalendarWidget.calendar.properties.type = unescape($.cookie('cWidgetType')); 366 } 367 368 eventsCalendarWidget.calendar[eventsCalendarWidget.calendar.properties.type].methods.init(); 369 370 // Previous 371 $("#eventsCalendarWidget .navigation .nav.previous").on('click', function() { 372 eventsCalendarWidget.calendar[eventsCalendarWidget.calendar.properties.type].methods.navigation(eventsCalendarWidget.calendar.storage.navigation.previous); 373 }); 374 375 // Next 376 $("#eventsCalendarWidget .navigation .nav.following").on('click', function() { 377 eventsCalendarWidget.calendar[eventsCalendarWidget.calendar.properties.type].methods.navigation(eventsCalendarWidget.calendar.storage.navigation.next); 378 }); 379 }, 380 toggleType: function() { 381 // Reset Navigation 382 eventsCalendarWidget.calendar.storage.navigation = {}; 383 384 // Change View 385 eventsCalendarWidget.calendar.properties.type = (eventsCalendarWidget.calendar.properties.type === 'weekEvents') ? "monthEvents" : "weekEvents"; 386 $.cookie('cWidgetType', unescape(eventsCalendarWidget.calendar.properties.type),{ path: '/' }); 387 eventsCalendarWidget.calendar[eventsCalendarWidget.calendar.properties.type].methods.init(); 388 }, 389 setNavigation: function(navigation) { 390 391 // Navigation Cookie 392 eventsCalendarWidget.calendar.methods.setNavigationCookie(navigation, eventsCalendarWidget.calendar.properties.type); 393 394 eventsCalendarWidget.calendar.storage.navigation = navigation; 395 $('#eventsCalendarWidget .resume').show(); 396 }, 397 getNavigation: function(navigation) { 398 if ($.isEmptyObject(navigation)) { 399 // Check Cookie 400 navigation = eventsCalendarWidget.calendar.methods.getNavigationCookie(eventsCalendarWidget.calendar.properties.type); 401 if ($.isEmptyObject(navigation)) { 402 navigation = { 403 year: 0, 404 week: 0 405 }; 406 } else { 407 navigation = navigation.selected; 408 } 409 } 410 return navigation; 411 }, 412 setNavigationCookie: function(navigation, type) { 413 if (!$.isEmptyObject(navigation)) { 414 $.cookie('cWidget_' + type, navigation, { path: '/' }); 415 } 416 }, 417 getNavigationCookie: function(type) { 418 return $.cookie('cWidget_' + type); 419 } 420 }, 421 weekEvents: { 422 methods: { 423 init: function() { 424 $('#eventsDays').empty().attr('class', 'weekEvents'); 425 eventsCalendarWidget.calendar.weekEvents.methods.navigation(); 426 }, 427 navigation: function(navigation) { 428 429 navigation = eventsCalendarWidget.calendar.methods.getNavigation(navigation); 430 431 $.ajax({ 432 type: "POST", 433 url: "/"+ utils.methods.getLang() +"/eventos/eventos.ajax.php", 434 data: { 435 method: "getWeekCalendar", 436 params: { 437 year: navigation.year, 438 week: navigation.week 439 } 440 } 441 }).done(function(json) { 442 if (json._status.sucess) { 443 eventsCalendarWidget.calendar.methods.setNavigation(json.navigation); 444 445 $('#eventsDays').empty(); 446 447 eventsCalendarWidget.calendar.weekEvents.methods.buildNavigation(json); 448 $.each(json.days, function(index, day) { 449 eventsCalendarWidget.calendar.weekEvents.methods.buildDay(day, json); 450 }); 451 $('#eventsCalendarWidget .viewMode > span').html(utils.methods.getLangTxt('txt_eventos', 'vista-mensal')); 452 } 453 }).fail(function() { 454 console.warn('Não foi possÃvel realizar o pedido'); 455 }).always(function() { 456 eventsCalendarWidget.eventsScroll.methods.init(); 457 }); 458 }, 459 buildNavigation: function(json) { 460 $('#eventsCalendarWidget .navigation .nav.previous').attr({ 461 title: json.navigation.previous.month_name 462 }); 463 464 $('#eventsCalendarWidget .navigation .nav.following').attr({ 465 title: json.navigation.next.month_name 466 }); 467 468 $('#eventsCalendarWidget .navigation .month').html(json.navigation.selected.month_shortname + ". " + json.navigation.selected.year); 469 $('#eventsCalendarWidget .navigation .week').html(" | Sem. " + json.navigation.selected.week); 470 }, 471 buildDay: function(day, json) { 472 var html = ""; 473 var dayCss = ""; 474 475 // Day Status 476 if (day.events.exists) { 477 dayCss += "details"; 478 } 479 480 if (day.date === json.navigation.current.date) { 481 dayCss += " active"; 482 } 483 484 if (day.events.exists) { 485 html = '\ 486 <li class="'+ dayCss +'">\n\ 487 <a href="'+ day.link +'" data-date="'+ day.date +'">\n\ 488 <span class="day">\n\ 489 <span>'+ day.day +'</span> '+ day.dayname +'</span>\n\ 490 <span class="seemore">'+ day.events.txt +'</span>\n\ 491 </a>\n\ 492 </li>'; 493 } else { 494 html = '\ 495 <li class="'+ dayCss +'">\n\ 496 <span class="day">\n\ 497 <span>'+ day.day +'</span> '+ day.dayname +'</span>\n\ 498 <span class="seemore">'+ day.events.txt +'</span>\n\ 499 </li>'; 500 } 501 502 $(html).appendTo($('#eventsCalendarWidget .weekEvents')); 503 } 504 } 505 }, 506 monthEvents: { 507 methods: { 508 init: function() { 509 $('#eventsDays').empty().attr('class', 'monthEvents'); 510 511 if ($('#eventsCalendarWidget.searchVisible > .search').length) { 512 eventsCalendarWidget.calendar.monthEvents.methods.navigation(); 513 } else { 514 $('#eventsCalendarWidget >
514 .search').slideUp(function() { 515 eventsCalendarWidget.calendar.monthEvents.methods.navigation(); 516 }); 517 } 518 519 }, 520 navigation: function(navigation) { 521 522 navigation = eventsCalendarWidget.calendar.methods.getNavigation(navigation); 523 524 $.ajax({ 525 type: "POST", 526 url: "/" + utils.methods.getLang() + "/eventos/eventos.ajax.php", 527 data: { 528 method: "getMonthCalendar", 529 params: { 530 year: navigation.year, 531 month: navigation.month 532 } 533 } 534 }).done(function(json) { 535 if (json._status.sucess) { 536 eventsCalendarWidget.calendar.methods.setNavigation(json.navigation); 537 538 $('#eventsDays').empty(); 539 540 eventsCalendarWidget.calendar.monthEvents.methods.buildNavigation(json); 541 $.each(json.days, function(index, day) { 542 eventsCalendarWidget.calendar.monthEvents.methods.buildDay(day, json); 543 }); 544 $('#eventsCalendarWidget .viewMode > span').html(utils.methods.getLangTxt('txt_eventos', 'vista-semanal')); 545 } 546 }).fail(function() { 547 console.warn('Não foi possÃvel realizar o pedido'); 548 }); 549 }, 550 buildNavigation: function(json) { 551 $('#eventsCalendarWidget .navigation .nav.previous').attr({ 552 title: json.navigation.previous.month_name 553 }); 554 555 $('#eventsCalendarWidget .navigation .nav.following').attr({ 556 title: json.navigation.next.month_name 557 }); 558 559 $('#eventsCalendarWidget .navigation .month').html(json.navigation.selected.month_shortname + ". " + json.navigation.selected.year); 560 $('#eventsCalendarWidget .navigation .week').html(""); 561 }, 562 buildDay: function(day, json) { 563 564 var html = dayCss = ''; 565 566 if (day.date === json.navigation.current.date) { 567 dayCss += " active"; 568 } 569 570 if (day.date === $('#eventsDays').data('selected-date')) { 571 dayCss += " selected"; 572 } 573 574 if (day.events.total) { 575 html = '<li class="'+ dayCss +'"><a href="'+ day.link +'">'+ day.dayname_shortname +'<span>'+ day.day +'</span></a></li>'; 576 } else { 577 html = '<li class="'+ dayCss +'">'+ day.dayname_shortname +'<span>'+ day.day +'</span></li>'; 578 } 579 $(html).appendTo($('#eventsCalendarWidget .monthEvents')); 580 } 581 } 582 } 583 }, 584 eventsScroll: { 585 properties: { 586 global: { 587 atualPath: '#eventsCalendarWidget .searchBlocks' 588 } 589 }, 590 methods: { 591 init: function() { 592 $('#eventsCalendarWidget .weekEvents li.details > a').on('click', function(e) { 593 e.preventDefault(); 594 595 if (!$(this).parent().hasClass('current')) { 596 $('#eventsCalendarWidget .weekEvents li.details > a').parent().removeClass('selected current'); 597 $(this).parent().addClass('selected current'); 598 eventsCalendarWidget.eventsScroll.methods.loadEvents($(this).data('date')); 599 } else { 600 if($(this).parent().hasClass('selected')) { 601 $('#eventsCalendarWidget .btnClose').trigger("click"); 602 } else { 603 $(this).parent().addClass('selected'); 604 $('#content > .eventsCalendar.searchVisible > .search > form .btnClose').fadeIn(); 605 $('#eventsCalendarWidget > .search').slideDown('fast'); 606 $('#eventsCalendarWidget > .search .searchBlocks').slideDown('fast'); 607 } 608 } 609 }); 610 }, 611 loadPane: function() { 612 // Properties 613 eventsCalendarWidget.eventsScroll.properties.global.atualPath = '#eventsCalendarWidget .searchBlocks .jspPane'; 614 615 $('#eventsCalendarWidget .searchBlocks').jScrollPane({ 616 showArrows: true, 617 horizontalArrowPositions: 'os' 618 }); 619 var showHorizontalBar = 0; 620 $("#eventsCalendarWidget .searchBlocks").hover(function() { 621 showHorizontalBar = setTimeout(function() { 622 $(".searchBlocks .jspHorizontalBar").fadeIn(); 623 $(".searchBlocks").bind('mousewheel', function (event, delta, deltaX, deltaY) { 624 var api = $(this).data('jsp'); 625 api.scrollByX(delta * -100); 626 if (api.getIsScrollableH()) { 627 //if (delta > 0 && api.getPercentScrolledX() > 0 || delta < 0 && api.getPercentScrolledX() < 1) { 628 return false; 629 //} 630 } 631 }); 632 }, 150); 633 }, function() { 634 clearTimeout(showHorizontalBar); 635 $(".searchBlocks").unbind('mousewheel'); 636 $(".searchBlocks .jspHorizontalBar").fadeOut(); 637 }); 638 }, 639 loadEvents: function(date) { 640 $.ajax({ 641 type: "POST", 642 url: "/"+ utils.methods.getLang() +"/eventos/eventos.ajax.php", 643 data: { 644 method: "getDayEvents", 645 params: { 646 date: date 647 } 648 }, 649 beforeSend: function() { 650 $('#eventsCalendarWidget > .search .searchBlocks').addClass('loader lsbig lwhite'); 651 $('#eventsCalendarWidget > .search .searchBlocks').slideDown('fast'); 652 } 653 }).done(function(json) { 654 if (json._status.sucess) { 655 $(eventsCalendarWidget.eventsScroll.properties.global.atualPath).empty(); 656 657 setTimeout(function() { 658 $.each(json.events, function(index, event) { 659 eventsCalendarWidget.eventsScroll.methods.buildBlock(event); 660 }); 661 662 if ($('#eventsCalendarWidget.searchVisible > .search').length) { 663 $('#content > .eventsCalendar.searchVisible > .search > form .btnClose').fadeIn(); 664 $('#eventsCalendarWidget > .search > .searchBlocks').slideDown(function() { 665 eventsCalendarWidget.eventsScroll.methods.loadPane(); 666 }); 667 } else { 668 $('#eventsCalendarWidget > .search').slideDown(function() { 669 eventsCalendarWidget.eventsScroll.methods.loadPane(); 670 }); 671 } 672 673 $('#eventsCalendarWidget > .search .searchBlocks').removeClass('loader lsmall lblack'); 674 675 $("#eventsCalendarWidget img").error(function () { 676 $(this).hide(); 677 }); 678 679 }, 500); 680 } 681 }).fail(function() { 682 console.warn('Não foi possÃvel realizar o pedido'); 683 }).always(function() { 684 685 }); 686 }, 687 buildBlock: function(event) { 688 var html = '<div class="block">\n\ 689 <a href="'+ event.link +'">\n\ 690 <span class="localidade">'+ event.nome_localidade +'</span>\n\ 691 <span class="image">\n\ 692 <img src="'+ event.image +'" border="0" alt="#" />\n\ 693 </span>\n\ 694 <span class="title">'+ event.title +'</span>\n\ 695 <span class="date">'+ event.date +'<span>'+ event.place +'</span></span>\n\ 696 <span class="resume">'+ event.resume +'</span>\n\ 697 </a>\n\ 698 </div>'; 699 $(html).appendTo($(eventsCalendarWidget.eventsScroll.properties.global.atualPath)); 700 } 701 } 702 } 703}; 704 705var utils = { 706 methods: { 707 /** 708 * Devolve a lingua actual no site 709 * @returns {String} 710 */ 711 getLang: function() { 712 return $('meta[http-equiv="Content-Language"]').attr('content'); 713 }, 714 getLangTxt: function(tag, nome) { 715 return (typeof traducoes[0][tag][nome] !== "undefined") ? traducoes[0][tag][nome] : ""; 716 } 717 }, 718 widgets: { 719 datepicker: { 720 methods: { 721 add: function(options) { 722 723 var now = new Date(); 724 725 var defaults = { 726 changeMonth: true, 727 changeYear: true, 728 dateFormat: "yy-mm-dd", 729 showOn: "focus", 730 showWeek: false, 731 firstDay: 1, 732 showButtonPanel: false, 733 closeText: "", 734 currentText: $.datepicker.regional.dayNamesShort[now.getDay()] + ", " + now.getDate() + " " + $.datepicker.regional.monthNamesShort[now.getMonth()] + " " + now.getFullYear() 735 }; 736 737 options = $.extend(true, {}, defaults, options); 738 $(options.selector).datepicker(options); 739 } 740 } 741 }, 742 select: { 743 methods: { 744 add: function(options) { 745 746 var defaults = { 747 748 }; 749 750 options = $.extend(true, {}, defaults, options); 751 $(options.selector).select2(options); 752 } 753 } 754 }, 755 multiselect: { 756 methods: { 757 add: function(options) { 758 759 var defaults = { 760 checkAllText: utils.methods.getLangTxt('txt_combos', 'todas'), 761 uncheckAllText: utils.methods.getLangTxt('txt_combos', 'nenhuma'), 762 noneSelectedText: utils.methods.getLangTxt('txt_geral', 'selecione') + ':', 763 selectedText: 'Itens (#)', 764 minWidth: 100, 765 height: '', 766 classes: $(options.selector).attr('class'), 767 filterInput: true, 768 open: function() { 769 // Focus multiselect SearchBox 770 $('.ui-multiselect-menu:visible').find('input[type="search"]').focus(); 771 } 772 }; 773 774 options = $.extend(true, {}, defaults, options); 775 776 if (typeof $(options.selector).data('noneselectedtext') == 'string' && $(options.selector).data('noneselectedtext').length > 0) { 777 options.noneSelectedText = $(options.selector).data('noneselectedtext'); 778 } 779 780 if (defaults.filterInput) { 781 $(options.selector).multiselect(options).multiselectfilter({ 782 label: '', 783 placeholder: '' 784 }); 785 } else { 786 $(options.selector).multiselect(options); 787 } 788 } 789 } 790 }, 791 popup: { 792 methods: { 793 add: function(options) { 794 795 var defaults = { 796 797 }; 798 799 options = $.extend(true, {}, defaults, options); 800 $(options.selector).fancybox(options); 801 } 802 } 803 }, 804 rating: { 805 methods: { 806 add: function(options) { 807 808 var defaults = { 809 path : '/temas/tpnp/imgs/rating/9/', 810 hints : [utils.methods.getLangTxt('txt_rating', 'mau'), utils.methods.getLangTxt('txt_rating', 'pobre'), utils.methods.getLangTxt('txt_rating', 'normal'), utils.methods.getLangTxt('txt_rating', 'bom'), utils.methods.getLangTxt('txt_rating', 'deslumbrante')] 811 }; 812 813 options = $.extend(true, {}, defaults, options); 814 $(options.selector).raty(options); 815 } 816 } 817 } 818 } 819}; 820 821var crossSellingBlock = { 822 storage: { 823 wrapper: '.crossSellingBlock', 824 blockWrapper: '.crossSellingBlock > .crossBlock', 825 tabSelected: 'active' 826 }, 827 methods: { 828 init: function() { 829 830 $(crossSellingBlock.storage.wrapper + " > ul > li").bind('click', function() { 831 if (!$(this).hasClass('active')) { 832 crossSellingBlock.tabs.methods.change($(this)); 833 } 834 }); 835 836 } 837 }, 838 tabs: { 839 methods: { 840 change: function(el) { 841 $(el).closest(crossSellingBlock.storage.wrapper).find('li').removeClass(crossSellingBlock.storage.tabSelected); 842 $(el).closest(crossSellingBlock.storage.wrapper).find(".crossBlock").removeClass(crossSellingBlock.storage.tabSelected); 843 $(el).closest(crossSellingBlock.storage.wrapper).find('li:eq('+ $(el).index() +')').addClass(crossSellingBlock.storage.tabSelected); 844 $(el).closest(crossSellingBlock.storage.wrapper).find('li:eq('+ $(el).index() +')').addClass(crossSellingBlock.storage.tabSelected); 845 $(el).closest(crossSellingBlock.storage.wrapper).find('.crossBlock:eq('+ $(el).index() +')').addClass(crossSellingBlock.storage.tabSelected); 846 } 847 } 848 } 849}; 850 851var tabsList = { 852 storage: { 853 wrapper: '.tabGroup', 854 blockWrapper: '.tabGroup > .content', 855 tabSelected: 'active' 856 }, 857 methods: { 858 init: function() { 859 860 $(document).on("click", tabsList.storage.wrapper + " > ul > li", function(e) { 861 e.preventDefault(); 862 if (!$(this).hasClass('disabled')) { 863 if (!$(this).hasClass('active')) { 864 tabsList.tabs.methods.change($(this).index(), $(this)); 865 } 866 } 867 }); 868 } 869 }, 870 tabs: { 871 methods: { 872 change: function(index, el) { 873 $(el).closest($(tabsList.storage.wrapper + ' > ul')).find('li').removeClass(tabsList.storage.tabSelected); 874 $(el).addClass(tabsList.storage.tabSelected); 875 876 $(el).closest(".tabs").siblings('.content').removeClass(tabsList.storage.tabSelected); 877 $(el).closest(".tabs").siblings('.content:eq('+ index +')').addClass(tabsList.storage.tabSelected); 878 } 879 } 880 } 881}; 882 883var mainMenu = { 884 storage: { 885 prevItemExists: false, 886 timeout: '' 887 }, 888 properties: { 889 container: '.mainMenu', 890 hoverCss: 'active', 891 delay: 250 892 }, 893 methods: { 894 init: function() { 895 896 $('.mainMenu').removeClass('no-js'); 897 898 $('.mainMenu > ul > li.submenu').hover(function() { 899 900 var currentMenu = $(this); 901 902 if (mainMenu.storage.prevItemExists) { 903 904 mainMenu.storage.timeout = setTimeout(function() { 905 mainMenu.methods.showSubmenu(currentMenu); 906 }, mainMenu.properties.delay); 907 908 } else { 909 910 mainMenu.storage.prevItemExists = true; 911 912 mainMenu.storage.timeout = setTimeout(function() { 913 mainMenu.methods.showSubmenu(currentMenu); 914 }, mainMenu.properties.delay); 915 } 916 917 }, function() { 918 mainMenu.methods.hideSubmenu(this); 919 clearTimeout(mainMenu.storage.timeout); 920 }); 921 922 $('header > .mainMenu').bind('mouseleave', function() { 923 mainMenu.storage.prevItemExists = false;
924 }); 925 926 $(window).scroll(function() { 927 mainMenu.methods.toggleScroll(); 928 }).trigger('scroll'); 929 930 }, 931 toggleScroll: function() { 932 if ($(window).scrollTop() >= $('#scrollToMenu').outerHeight()) { 933 if ($('#header > .inner:not(.fixedMenu)').length) { 934 $('#header > .inner').addClass('fixedMenu').find('.mainMenu').hide().fadeIn('fast'); 935 } 936 } else { 937 $('#header > .inner').removeClass('fixedMenu').find('.mainMenu').show(); 938 } 939 }, 940 showSubmenu: function(el) { 941 $(el).closest('.mainMenu').addClass(mainMenu.properties.hoverCss); 942 $(el).addClass(mainMenu.properties.hoverCss); 943 }, 944 hideSubmenu: function(el) { 945 $(el).closest('.mainMenu').removeClass(mainMenu.properties.hoverCss); 946 $(el).removeClass(mainMenu.properties.hoverCss); 947 } 948 } 949}; 950 951var ratingsBlock = { 952 storage: { 953 curCommentsBox: '' 954 }, 955 methods: { 956 init: function() { 957 if ($('.commentsBox').length) { 958 // Comments Click 959 $('.commentsBox .btComments').bind('click', function(e) { 960 if ($(this).hasClass("notLogged")) { 961 return true; 962 } 963 964 ratingsBlock.storage.curCommentsBox = $(this).closest('.commentsBox'); 965 ratingsBlock.methods.showCommentsForm(function() { 966 967 $(ratingsBlock.storage.curCommentsBox).find('.messages').slideUp(); 968 ratingsBlock.methods.setRatingStars(); 969 970 $("body, html").animate({ 971 scrollTop: parseFloat($(ratingsBlock.storage.curCommentsBox).find('.messages').offset().top - $('.mainMenu').outerHeight()) 972 }, '1000', 'easeOutExpo'); 973 974 var options = { 975 url: "/" + utils.methods.getLang() + "/comentarios/comentarios.ajax.php", 976 data: { 977 method: 'insertComment' 978 }, 979 beforeSerialize: function($form, options) { 980 $form.find('input[name="params[score]"]').val($form.find('input[name="score"]').val()); 981 }, 982 beforeSubmit: function(arr, $form, options) { 983 984 }, 985 success: function(response) { 986 if (response.error) { 987 $(ratingsBlock.storage.curCommentsBox).find('.messages').html(response.error).slideDown(); 988 } else if (response.success) { 989 $(ratingsBlock.storage.curCommentsBox).find('.messages').html(response.success).slideDown(); 990 ratingsBlock.methods.hideCommentsForm(true); 991 } 992 }, 993 error: function(response) { 994 console.warning("Error"); 995 } 996 }; 997 $('#commentsForm').ajaxForm(options); 998 }); 999 }); 1000 1001 if (window.location.hash === "#comments") { 1002 $('.commentsBox .btComments').trigger('click'); 1003 } 1004 } 1005 }, 1006 setRatingStars: function() { 1007 $.each($('.ratingStars16'), function() { 1008 $this = $(this); 1009 utils.widgets.rating.methods.add({ 1010 selector: $this, 1011 score: function() { 1012 return $(this).attr('data-score'); 1013 }, 1014 readOnly: $this.data('ronly'), 1015 target: $this.data('target'), 1016 targetKeep: $this.data('target-keep'), 1017 path : '/temas/tpnp/imgs/rating/16/' 1018 }); 1019 }); 1020 }, 1021 showCommentsForm: function(callback) { 1022 1023 $(ratingsBlock.storage.curCommentsBox).find('.header > .status, .header > .btComments').hide(); 1024 $(ratingsBlock.storage.curCommentsBox).find('.form').slideDown(function() { 1025 $form = $(this); 1026 $(ratingsBlock.storage.curCommentsBox).find('.list').stop(true, true).fadeTo('slow', '0.2'); 1027 // Esc Click 1028 $(document).keyup(function(e) { 1029 if ($form.is(':visible')) { 1030 if (e.keyCode === 27) { 1031 ratingsBlock.methods.hideCommentsForm(); 1032 } 1033 } 1034 }); 1035 1036 if (typeof callback === "function") { 1037 callback(); 1038 } 1039 1040 }); 1041 }, 1042 hideCommentsForm: function(clean) { 1043 $(ratingsBlock.storage.curCommentsBox).find('.form').slideUp(function() { 1044 $(ratingsBlock.storage.curCommentsBox).find('.list').stop(true, true).fadeTo('slow', '1'); 1045 }); 1046 1047 $(ratingsBlock.storage.curCommentsBox).find('.header > .status, .header > .btComments').show(); 1048 1049 if (clean) { 1050 ratingsBlock.methods.cleanCommentsForm(); 1051 } 1052 1053 }, 1054 cleanCommentsForm: function() { 1055 $(ratingsBlock.storage.curCommentsBox).find('textarea[name="params[comentario]"]').val(''); 1056 ratingsBlock.methods.setRatingStars(); 1057 } 1058 } 1059}; 1060 1061var objAccessibilities = { 1062 storage: { 1063 xhr: [] 1064 }, 1065 properties: { 1066 options: null 1067 }, 1068 methods: { 1069 init: function(options) { 1070 objAccessibilities.properties.options = $.extend(true, {}, objAccessibilities.properties.options, options); 1071 1072 $(objAccessibilities.properties.options.selector).bind('click', function() { 1073 $this = $(this); 1074 setTimeout(function() { 1075 if (typeof options['mapContainer'] === 'string') { 1076 objAccessibilities.methods.loadMap($(options['mapContainer'])); 1077 } else { 1078 objAccessibilities.methods.loadMap($this.closest(".tabGroup").find('div.accessibilities.active > .gMap')); 1079 } 1080 }, 100); 1081 }); 1082 1083 }, 1084 loadMap: function(el) { 1085 1086 if (typeof objAccessibilities.properties.options.onBefore === "function") { 1087 objAccessibilities.properties.options.onBefore(el); 1088 } 1089 1090 // Init Map 1091 sssGmap.methods.init($(el), { 1092 zoom: 8 1093 }, function(mapInstance) { 1094 1095 if (objAccessibilities.properties.options) { 1096 1097 objAccessibilities.storage.xhr = $.ajax({ 1098 type: "POST", 1099 url: objAccessibilities.properties.options.ajax.url, 1100 data: { 1101 method: objAccessibilities.properties.options.ajax.method, 1102 params: $(el).data() 1103 } 1104 }).done(function(json) { 1105 if (json._status.sucess) { 1106 1107 if (typeof objAccessibilities.properties.options.onSuccess === "function") { 1108 objAccessibilities.properties.options.onSuccess(el); 1109 } 1110 1111 var destRoute = json.data.lat + ", " + json.data.lng; 1112 sssGmap.methods.routes.calc("Portugal, Porto", destRoute); 1113 1114 navigator.geolocation.getCurrentPosition(function(location) { 1115 sssGmap.methods.routes.calc(location.coords.latitude + ", " + location.coords.longitude, destRoute); 1116 }); 1117 1118 } else { 1119 if (typeof objAccessibilities.properties.options.onError === "function") { 1120 objAccessibilities.properties.options.onError(el); 1121 } 1122 } 1123 1124 }).fail(function() { 1125 if (typeof objAccessibilities.properties.options.onError === "function") { 1126 objAccessibilities.properties.options.onError(el); 1127 } 1128 }); 1129 } 1130 1131 }, function() { 1132 if (typeof objAccessibilities.properties.options.onError === "function") { 1133 objAccessibilities.properties.options.onError(el); 1134 } 1135 }); 1136 } 1137 } 1138};
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.