📄 customerdetails.js
字号:
var CustomerDetails = { access_map_window: null, init: function() { //console.log("Appel adapteParentIframeHeight"); CustomerDetails.adapteParentIframeHeight(); if(document.body.id == "detail-clients") { if ($('s_devise')) { Currencies.registerEverythingFromPage(Currencies.CrtCurrency); Currencies.observeSelect($('s_devise')); } } if(document.body.id == "detail-clients" || document.body.id == "confirmation"){ CustomerDetails.setRatesSalesPoliciesRatesDetailsLinks(); } CustomerDetails.setInfoRatesLinks(); CustomerDetails.setAccessMapLink(); CustomerDetails.setEconfirmationDetails(); CustomerDetails.resetSideContent(); CustomerDetails.setPrintButton(); CustomerDetails.bindToggleCBPanel(); }, /** * */ adapteParentIframeHeight: function() { //console.log("adapteParentIframeHeight"); Event.observe( document.getElementsByTagName("body")[0], "load", function() { //console.log("window loaded !"); var height = document.getElementsByTagName("body")[0].clientHeight; //console.log(height+"px"); top.document.getElementById(window.name).style.height = (height + 10)+"px"; } ); }, /** * Adapte le menu de gauche aux exigences de mise en page indiquée par le PSD de référence */ resetSideContent: function() { //$$("li.hotel ul")[0].className = "hide"; for (var i = top.document.getElementsByTagName("li").length - 1; i >= 0; i--) { if( top.document.getElementsByTagName("li")[i].className.search(/hotel/) != -1 && top.document.getElementsByTagName("li")[i].getElementsByTagName("ul").length > 0 ) { top.document.getElementsByTagName("li")[i].getElementsByTagName("ul")[0].className = "hide"; } } }, /** * Accroche l'affichage de l'encart "Traitement en cours" lors de l'envoi du formulaire */ setLoadingScreen: function() { if(document.getElementsByTagName("body")[0].clientHeight) var screenHeight = document.getElementsByTagName("body")[0].clientHeight; else var screenHeight = document.getElementsByTagName("body")[0].style.height; var loading_screen = top.document.createElement("div"); loading_screen.id = "loading-screen"; loading_screen.style.height=screenHeight; loading_screen.innerHTML = "<p> </p><p>" + I18N._('common','You request is being processed.') + "</p><p>" + I18N._('common','Please wait.') + "</p>"+ "<p><img src='/imagerie/reservation/traitement-en-cours.gif' alt='"+ I18N._('common','You request is being processed.') +"' /></p>"; top.document.body.appendChild(loading_screen); for (var i = 0; i<top.document.getElementsByTagName("select").length; i ++) { if(i>1) top.document.getElementsByTagName("select")[i].style.visibility="hidden"; } top.document.body.style.overflow = "hidden"; window.scrollTo(0,0); }, /** * Ajoute et active le bouton d'impression de la page */ setPrintButton: function() { var printButton = $$(".print a"); printButton.each( function(elem) { Event.observe( elem, "click", function() { CustomerDetails.showAllRoomsDetails(); window.print(); } ); } ); }, /** * Accroche les popups "ratesSalesPolicies.jsp" et "ratesDetails.jsp" aux liens correspondant de la page */ setRatesSalesPoliciesRatesDetailsLinks: function() { if(document.body.id == "confirmation"){ if(!$("iframe_confirmation")) { return; } var iframe_document = $("iframe_confirmation").contentWindow.document; var iframe_rates_sales_links_main_parent = $(iframe_document.getElementById('reservation')); var links_containers = iframe_rates_sales_links_main_parent.select('div.details div.conditions'); } else{ var links_containers = $$('#reservation div.details div.conditions'); } if (links_containers!=null) links_containers.each( function(element) { var link0 = element.getElementsByTagName('a')[0]; if (link0!=null) Event.observe( link0, 'click', function(e) {Event.stop(e); DivPopup.openPopup('rates_sales_policies', 500, 400, null, link0); } ); var link1 = element.getElementsByTagName('a')[1]; if (link1!=null){ if($("s_devise")) Event.observe( link1, 'click', function(e) {Event.stop(e); DivPopup.openPopup('rates_sales_policies', 600, 400, null, link1+"¤cyCode="+$("s_devise").value); } ); else Event.observe( link1, 'click', function(e) {Event.stop(e); DivPopup.openPopup('rates_sales_policies', 600, 400, null, link1); } ); } var link2 = element.getElementsByTagName('a')[2]; if (link2!=null){ if($("s_devise")) Event.observe( link2, 'click', function(e) {Event.stop(e); DivPopup.openPopup('rates_sales_policies', 600, 400, null, link2+"¤cyCode="+$("s_devise").value); } ); else Event.observe( link2, 'click', function(e) {Event.stop(e); DivPopup.openPopup('rates_sales_policies', 600, 400, null, link2); } ); } }.bind(this) ); var links_room_policies = $$('#reservation a.roomPolicies'); if (links_room_policies!=null) links_room_policies.each( function(element) { Event.observe( element, 'click', function(e) {Event.stop(e); DivPopup.openPopup('rates_sales_policies', 500, 400, null, element); } ); }.bind(this) ); }, /** * Accroche la popup "internet-sales-conditions.html" */ setInfoRatesLinks: function() { if($("infos-rates-popup-link")){ var link = $("infos-rates-popup-link"); if (link!=null) Event.observe( link, 'click', function(e) { Event.stop(e); DivPopup.openPopup('rates_sales_policies', 500, 400, null, link, cgv_title(), 17); } ); } }, /* * sets the link to open the popup with the access map of the hotel * the hotel code needed in the url is retrieved from the 'hotel_code' attribute of the <a> tag in the page * */ setAccessMapLink: function() { var link = $("access-map-link"); if(link) { var hotel_code = link.readAttribute('hotel_code'); Event.observe( link, 'click', function(e) { Event.stop(e); if(this.access_map_window) { this.access_map_window.close(); } this.access_map_window = window.open("/mod_acces_hotel.svlt?code_hotel=" + hotel_code,'access_map','width=635, height= 350, scrollbars=1'); } ); } }, /** * Accroche la popup "econfirmation" */ setEconfirmationDetails: function() { if($("econfirmationDetails")){ var link = $("econfirmationDetails"); if (link!=null) Event.observe( link, 'click', function(e) { Event.stop(e); DivPopup.openPopup('e-confirmation-details', 500, 400, null, link); } ); } }, /** * Accroche les comportements de toggle sur les input des blocs de paiement par CB */ bindToggleCBPanel: function() { var trigger_elements = $$('.paiement-cb .toggle-panel'); if (trigger_elements!=null) trigger_elements.each( function(element) { element.up('.paiement-cb').down('.optional').hide(); /*if( navigator.appVersion.search(/MSIE/) != -1 && navigator.appVersion.search(/6.0/) != -1 && navigator.appVersion.search(/opera/) == -1 ) { var container = element.up('.paiement-cb'); var extra_bottom_span = container.down(".extra-bottom"); extra_bottom_span.setStyle({bottom: "auto"}); extra_bottom_span.setStyle({top: "2px"}); extra_bottom_span.setStyle({position: "relative"}); extra_bottom_span.setStyle({position: "absolute"}); var top = container.getHeight() - 13; extra_bottom_span.setStyle({top: top+"px"}); }*/ Event.observe( element, 'click', function(e) { this.togglePanel(Event.element(e).up('.paiement-cb').down('.optional')); }.bind(this) ); }.bind(this) ); }, /** * Affiche tous les details de toutes les chambres pour l'impression */ showAllRoomsDetails : function() { var detailsElements = $$('.chambre .details'); if(detailsElements != null) { detailsElements.each( function(element) { element.visible = true; element.setStyle({display: "block"}); } ) } var detailsLinks = $$('.actions .toggle-details'); if(detailsLinks != null) { detailsLinks.each( function(element) { element.down().addClassName('open'); element.down().innerHTML = I18N._('common','Hide details'); } ) } }, /** * Exécute l'effet de toggle sur les input des blocs de paiement par CB */ togglePanel: function(panel) { if(panel.visible()) { panel.hide(); } else { panel.show(); panel.setStyle({display:"block"}); } /*if( navigator.appVersion.search(/MSIE/) != -1 && navigator.appVersion.search(/6.0/) != -1 && navigator.appVersion.search(/opera/) == -1 ) { var container = panel.up('.paiement-cb'); var extra_bottom_span = container.down(".extra-bottom"); extra_bottom_span.setStyle({bottom: "auto"}); extra_bottom_span.setStyle({top: "2px"}); extra_bottom_span.setStyle({position: "relative"}); extra_bottom_span.setStyle({position: "absolute"}); var top = container.getHeight() - 13; extra_bottom_span.setStyle({top: top+"px"}); }*/ }}Event.observe(window, 'load', CustomerDetails.init);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -