/** * Booking Evolution V2 widget * This code is for bookingevolution registered accounts only. * This code is for website use only, every other usage like copying, use, re-use, modify or similar is strictly prohibited. * * @author: Tosom s.r.l. * @version: 1.05 * @uses: jQuery * */ (function(window){ // Get previous "onload" Handler var winLoadHandler = window.onload ; var jqf = false ; // Perform BE operations for "window.onload" window.onload = function() { if( typeof jQuery == "undefined" ) { this.jqf = true ; var e = document.createElement("script") ; e.setAttribute("type","text/javascript") ; e.setAttribute("src",'//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js') ; document.body.appendChild(e) ; } tsmbe_initBE2(); // LOAD BE2 if( winLoadHandler ) // LOAD ANY PREVIOUSLY CONFIGURED FUNCTIONS { winLoadHandler(); } } function tsmbe_initBE2(i) { if( isNaN(i) ){i=0;} if( typeof jQuery == "undefined" ) { if( i>=25 ) { if(window.console){ console.error("BOOKINGEVOLUTION, unable to initialize, jQuery not loaded") } } else{ window.setTimeout( function(){ tsmbe_initBE2(++i); } , 250 ); } } else // JQUERY LOADED -> initialize widget { console.log("") if( this.jqf ) { jQuery.noConflict(); console.log("jQuery Forced, use noConflict Mode"); } var elems = false // GET QUICK SEARCH BOX BY SINGLE ID elems = jQuery("#bookingevolution-tsmbe") ; if( elems && elems.length ) { tsmbe_addWidget(elems[0],0); } // GET QUICK SEARCH BOX BY CLASSES elems = jQuery(".bookingevolution-tsmbe") ; for( var i=0 ; i "+qs) jQuery(box).html("") ; e = document.createElement("script"); e.setAttribute("type","text/javascript") ; e.setAttribute("src","https://secure.bookingevolution.com/be2secure/widgets/be2/tsmbe/tsmbe_be2.php"+qs) ; jQuery(box).append(e); // If custom css is loaded remove the style from the node once loaded (500ms should be enough) if(css){window.setTimeout( function(){ console.log( jQuery("#tsmbe-container" ).removeAttr("style") ) ; }, 500 ) ;} // ADD EXCEPTIONS /* */ if( attrs["data-hotel"] == "callas" ) { window.setTimeout( function(){ var el = jQuery("#tsmbe-button-book") ; el.click( function(){ // console.log("gtag call"); gtag('event', 'conversion', { 'send_to': 'AW-10787680133/GKpACKG3kocYEIXf-5co', 'event_callback': callback }); }); } , 750 ); }/* */ if( attrs["data-hotel"]=="sancassiano" ) { var el = jQuery(".be2-book-link a") ; var langs = [] ; langs["it"] = 1 ; langs["en"] = 2 ; langs["fr"] = 3 ; langs["es"] = 4 ; langs["de"] = 5 ; if( el && el.length ) { el.attr("href","javascript:openbe2('"+attrs["data-hotel"]+"' , "+( langs[ attrs["data-lang"] ] )+" )"); } } } /* PAGE FUNCTION:: setup a single reservation button */ function tsmbe_setupButton(elem,i) { // CHECK FOR BE2.js to be ready if( typeof i == "undefined" || isNaN(i) ){i=0;} if( i>100 ){ if(window.console){ console.error("TSMBE ERROR: unable to load load the reservation button routines.") } } if( typeof openbe2 !="function" ){ window.setTimeout( function(){ tsmbe_setupButton(elem,++i) },250 ) } else { console.log("BUTTON SETUP") var data = tsmbe_getAttrs(elem) ; console.log(data) console.log(data["data-hotel"]) elem = jQuery(elem) ; // PREPARE BUTTON CLASS if( !elem.hasClass("tsmbe-button") ){ elem.addClass("tsmbe-button"); } elem.on("click",function(){ openbe2( data["data-hotel"] , tsmbe_langISO2BE(data["data-lang"]) ) }) ; } } })(window);