1;(function ( $, window, document, undefined ) { 2 'use strict'; 3 4 var $element = null; 5 6 var methods = { 7 /** 8 * __constructor method 9 * @param {} user defined options 10 */ 11 init: function( options ) { 12 13 $element = $(this); 14 15 /** 16 * save options 17 */ 18 options = $.extend( true, {}, $.fn.preisleistung.defaults, options ); 19 20 $element.data('options', options); 21 $('body').append('<div id="arrowTooltip" class="tooltip tooltip-ball tooltip-text fade right" role="tooltip" style="opacity: 0; display: block;"><div class="tooltip-arrow" style="top: 50%;"></div><div class="tooltip-inner"></div></div>'); 22 }, 23 24 /** 25 * Attachs window's scroll event 26 */ 27 attach: function( ) { 28 var w = $(window); 29 w.on( 'scroll', methods._load); 30 31 if( !$element.data('options').lazyLoad ) { 32 methods._load(); 33 } 34 35 return this; 36 }, 37 38 detach: function() { 39 var w = $(window); 40 w.off( 'scroll', methods._load); 41 }, 42 43 /** 44 * Tests it the DIV is within viewport 45 */ 46 _visible: function() { 47 var w = $(window); 48 49 return w.scrollTop() + w.height() >= $element.offset().top; 50 }, 51 52 /** 53 * Load Preise Leistungen 54 */ 55 _load: function() { 56 57 if( methods._visible() || !$element.data('options').lazyLoad ) { 58 59 methods.detach(); 60 61 var options = $element.data('options'); 62 63 $.ajax({
64 url: '/?pm=detail&action=preiseLeistungen&idship=' + options.idShip + 65 '&idobjekt=' + options.idObjekt + 66 '&searchIdCruiseDate=' + options.searchIdCruiseDate + 67 '&searchDateIntervals=' + options.searchDateIntervals + 68 '&searchSpecialOfferIds=' + options.searchSpecialOfferIds , 69 encoding: 'utf-8' 70 }) 71 .done( function( data ) { 72 var options = $element.data('options'); 73 console.log(options) 74 options.data = data; 75 options.data.idSelectedKab = ''; 76 options.data.idSelectedKat = ''; 77 options.data.idSelectedDeck = ''; 78 79 methods.getTableHeader(); 80 }) 81 .complete( function() { 82 if( options.onComplete ) { 83 options.onComplete(); 84 } 85 methods.loadShipQuerschnittSVG(); 86 methods.registerEvents(); 87 if (options.idKat > 0) { 88 methods.showCategory(options.idKat); 89 if(options.idDeck > 0) { 90 $('.change_katDeckplan[data='+options.idDeck+']', $('.collapse-container[id='+options.idKat+']')).click(); 91 } 92 } 93 }); 94 } 95 }, 96 97 priceFormat: function(value) { 98 99 value = value.length <= 3 ? value + ' €' : value.substr(0, value.length-3) + '.' + value.substr(-3) + ' €'; 100 101 return value; 102 }, 103 104 getTableHeader: function() { 105 var options = $element.data('options'), 106 data = options.data, 107 deckData = data.deckData.DATA, 108 aCategories = data.categories.DATA, 109 aBelegung = data.belegungen, 110 html = '', 111 labelList = '', 112 labelFilter = '', 113 belegung = '', 114 rabatt = '', 115 MclassNormPrice = '', 116 MclassFBPrice = '', 117 furtherElem = '', 118 tage = 'Tage'; 119 120 for(var a in deckData) { 121 if (deckData.hasOwnProperty(a)) { 122 labelList = labelList + '<li><span class="ship-label"><span class="label deck-'+deckData[a][3]+'"></span> '+deckData[a][1]+' </span></li>'; 123 } 124 } 125 126 labelFilter = '<li><a id="0" href="Javascript:void(0);" class="labelDeck"><span class="ship-label"><span class="label deck-0"></span> alle Decks </span></a></li>'; 127 for(var b in deckData) { 128 if (deckData.hasOwnProperty(b) && deckData[b][4] == 1) { 129 labelFilter = labelFilter + '<li><a id="'+deckData[b][0]+'" href="Javascript:void(0);" class="labelDeck"><span class="ship-label"><span class="label deck-'+deckData[b][3]+'"></span> '+deckData[b][1]+' </span></a></li>'; 130 } 131 } 132 133 belegung = '<li><a id="0" href="Javascript:void(0);" class="belegungKat">beliebig</a></li>'; 134 for( var i = 0; i < aBelegung.length; i++ ) { 135 var personen = i === 0 ? 'Person' : 'Personen'; 136 belegung = belegung + '<li><a id="'+aBelegung[i]+'" href="Javascript:void(0);" class="belegungKat">'+aBelegung[i]+' '+personen+'</a></li>'; 137 } 138 139 if(data.showRabatt === true){ 140 if(data.restTage == 1){ 141 tage = 'Tag'; 142 } 143 rabatt = 'Frühbucher-Preis p.P. <span class="sub-caption">Noch '+data.restTage+' '+tage+'</span>'; 144 MclassNormPrice = ' '; 145 MclassFBPrice = 'MclassFBPrice'; 146 } 147 if(data.showRabatt !== true){ 148 MclassNormPrice = 'MclassNormPrice'; 149 MclassFBPrice = ''; 150 } 151 /* 152 if(aCategories.length > 3) { 153 furtherElem = '<div class="hidden-lg item-loadmore">'+methods.getShowFurtherKatLink()+'</div>'; 154 }*/ 155 156 html = '<div class="block-ship-decks block-row hidden-xxs">' + 157 '<div class="row">' + 158 '<div class="optional-option ship-col col-lg-3 visible-lg">' + 159 '<div class="optional-inner">' + 160 '<p>'+data.textRes.cabineDirect+'</p>' + 161 '<input type="text" class="form-input grey-input cabine-direct" placeholder="...">' + 162 '</div>' + 163 '</div>' + 164 '<div class="ship-image ship-col col-xs-12 col-lg-7" data="/public/deckplaene/'+options.shipName+'-Querschnitt.svg"></div>' + 165 '<div class="optional-option ship-col col-xs-6 hidden-lg">' + 166 '<div class="optional-inner">' + 167 '<p>'+data.textRes.cabineDirect+'</p>' + 168 '<input type="number" class="form-input grey-input cabine-direct" placeholder="...">' + 169 '</div>' + 170 '</div>' + 171 '<div class="ship-label-list ship-col col-xs-6 col-lg-2">' + 172 '<ul>'+labelList+'</ul>' + 173 '</div>' + 174 '</div>' + 175 '</div>' + 176 '<div class="block-collapse collapse-ship block-row block-content categoryTable" id="block-collapse-ship">' + 177 '<div class="collapse-row-caption">' + 178 '<div class="caption-col">' + 179 '<div class="caption-hover">' + 180 '<span class="hover-title">Deck <span class="icon icon-down"></span></span>' + 181 '<div class="hover-content ship-label-list">' + 182 '<ul>'+labelFilter+'</ul>' + 183 '</div>' + 184 '</div>' + 185 '</div>' + 186 '<div class="caption-col">' + 187 '<div class="caption-hover">' + 188 '<span class="hover-title">Kabinen <span class="icon icon-down"></span>' + 189 ' <span class="sub-caption">Belegung</span>' + 190 '</span>' + 191 '<div class="hover-content standard-list">' + 192 ' <ul>'+belegung+'</ul>' + 193 '</div>' + 194 '</div>' + 195 '</div>' + 196 '<div class="caption-col">Lage</div>' + 197 '<div class="caption-col">Kat.</div>' + 198 '<div class="caption-col '+MclassNormPrice+'">Preis p.P.</div>' + 199 '<div class="caption-col '+MclassFBPrice+'">'+rabatt+'</div>' + 200 '</div>' + 201 '<div class="collapse-inner categoryTableContent">'+methods.getTableData({})+'</div>' + 202 furtherElem + 203 '</div>' + 204 '<div id="tooltipWindow" class="tooltipContainer" style="display:none;"><div></div></div>'; 205 $element.html(html); 206 }, 207 208 updateTableData: function(elem) { 209 var options = $element.data('options'), 210 content = methods.getTableData(elem); 211 212 $('.categoryTableContent').fadeOut( function() { 213 $(this).html(content); 214 }).fadeIn( function() { 215 if( options.onUpdate ) { 216 options.onUpdate(); 217 } 218 if($(elem).attr('id') != 0) { 219 $('.item-loadmore').html(methods.getShowFurtherKatLink()); 220 } else { 221 $('.item-loadmore').html(methods.getHideFurtherKatLink()); 222 } 223 224 $('.collapse-container').removeClass('hidden-xxs'); 225 methods.registerEvents(); 226 }); 227 }, 228 229 getTableData: function(elem) { 230 231 var options = $element.data('options'), 232 data = options.data, 233 aCategories = data.categories.DATA, 234 aKatDecks = '', 235 html = '', 236 content = '', 237 price = '', 238 rabattPrice = '', 239 rabattText = '', 240 rabattTextMobile = '', 241 MclassNormPrice = '', 242 MclassFBPrice = '', 243 classMobile = '', 244 idKat = '', 245 belegung = ''; 246 247 for( var i = 0; i < aCategories.length; i++ ) { 248 idKat = aCategories[i][0]; 249 price = !!aCategories[i][6] === true ? methods.priceFormat(''+aCategories[i][6]) : ''; 250 rabattPrice = !!aCategories[i][7] === true && data.showRabatt == true ? methods.priceFormat(''+aCategories[i][7]) : ''; 251 rabattText = !!aCategories[i][7] === true ? 'Frühbucher-Preis' : ''; 252 rabattTextMobile = !!aCategories[i][7] === true ? 'Preis p.P.' : ''; 253 MclassNormPrice = !!aCategories[i][7] === true ? 'MclassNormPrice' : ''; 254 MclassFBPrice = !!aCategories[i][7] === true ? 'MclassFBPrice' : ''; 255 aKatDecks = data.katDecks[idKat]; 256 /* 257 if(i > 2) { 258 classMobile = 'further-kat hidden-xxs'; 259 } 260 */ 261 if($(elem).hasClass('labelDeck') && $(elem).attr('id') != 0 && (typeof aKatDecks == 'undefined' || aKatDecks.indexOf(parseInt($(elem).attr('id'))) == -1)) { 262 continue; 263 } 264 265 if($(elem).hasClass('belegungKat') && $(elem).attr('id') != 0 && ($(elem).attr('id') < aCategories[i][2] || $(elem).attr('id') > aCategories[i][12])) { 266 continue; 267 } 268 269 if(aCategories[i][2] != aCategories[i][12]) { 270 belegung = aCategories[i][2] + '-' + aCategories[i][12]; 271 } else { 272 belegung = aCategories[i][12]; 273 } 274 275 html = '<div id="' + idKat + '" index="' + i + '" class="collapse-container '+classMobile+'">' + 276 '<div class="deckzeile-mobile">'+'<span class="label-pack multi">' + methods.getDeckData(idKat) + '</span>' + 277 '</div>' + 278 '<div class="collapse-head">' + 279 280 '<div class="head-col">' + 281 '<span class="label-pack multi">' + methods.getDeckData(idKat) + '</span>' + 282 methods.getKatDescription(idKat) + 283 '</div>' + 284 '<div class="head-col">' + 285 '<span>' + aCategories[i][1] + '</span>' + 286 '<span class="small hidden-xxs">' + belegung + ' Pers</span>' + 287 '<span class="small tablet-title">' + belegung + ' Pers - Lage: ' + aCategories[i][3] + '</span>' + 288 '<span class="small mobile-title">' + belegung + ' Pers - Lage: ' + aCategories[i][3] + '</span>' + 289 '</div>' + 290 '<div class="head-col hidden-xxs"><span class="mobile-title">Lage : </span>' + aCategories[i][3] + '</div>' + 291 '<div class="head-col hidden-xxs"><span class="mobile-title">Kategorie : </span><span class="tablet-title">Kat.:</span>' + aCategories[i][5] + '</div>' + 292 '<div class="head-col '+MclassNormPrice+'"><span class="mobile-title">Preis p.P.</span><span class="tablet-title">Preis p.P.</span>' + price + '</div>' + 293 '<div class="head-col '+MclassFBPrice+'"><span class="tablet-title">'+rabattTextMobile+'</span><span class="mobile-title">'+rabattTextMobile+'</span>' + rabattPrice + '</div>' + 294 '<div class="head-col">' + methods.getKatButton(aCategories[i]) + '</div>' + 295 '</div>' + 296 methods.getDeckplanHTML(aCategories[i]) + 297 '</div>'; 298 299 content = content + html; 300 } 301 302 return content; 303 }, 304 305 getDeckData: function(idKat) { 306 var options = $element.data('options'), 307 data = options.data, 308 aDeckplaene = data.katDecks[idKat], 309 deckData = data.deckData.DATA, 310 content = '', 311 idDeckplan = '', 312 html = ''; 313 314 if(typeof aDeckplaene != 'undefined'){ 315 for( var i = 0; i < aDeckplaene.length; i++ ) {
316 idDeckplan = aDeckplaene[i]; 317 318 for(var a in deckData) { 319 if(deckData[a][0] === idDeckplan){ 320 html = '<span class="ship-label"><span class="label deck-' + deckData[a][3] + '"></span>' + deckData[a][1] + '</span>'; 321 content = content + html; 322 } 323 } 324 } 325 } 326 return content; 327 }, 328 329 getKatDescription: function(idKat) { 330 var options = $element.data('options'), 331 data = options.data, 332 aDescription = data.katDesc[idKat], 333 content = '<span class="btn-pack"></span>', 334 html = ''; 335 336 if(typeof aDescription != 'undefined'){ 337 for( var i = 0; i < aDescription.length; i++ ) { 338 html = '<div class="info-hover-container btn-pack remove-hover open"><a class="btn btn-square btn-small kategorie-icon ' + aDescription[i].ACLASS + '" index="'+i+'" href="Javascript:void(0);">' + 339 '<span class="icon ' + aDescription[i].SPANCLASS + '"></span></a><div class="info-hover-content" style="display:none;"></div></div>'; 340 341 content = content + html; 342 } 343 content = content + '<div class="clearfix"></div>'; 344 } 345 return content; 346 }, 347 348 getKatButton: function(aKat) { 349 var options = $element.data('options'), 350 data = options.data, 351 controls = data.controls, 352 html = '', 353 btnAttr = '', 354 span = '', 355 classHide = data.kurzfrist == 1 ? 'hidden' : ''; 356 357 if(aKat[8] == 'ROT_WARTELISTE') { 358 btnAttr = 'class="btn btn-text-icon btn-small btn-green btn-collapse wartelistebutton '+classHide+'"'; 359 span = '<span class="icon icon-right"></span><span class="visible-xxs-block mobile-title">Warteliste</span><span class="hidden-xxs">Warteliste</span>'; 360 }else if(!!aKat[11] && aKat[11].substr(0,1) == '0') { 361 btnAttr = 'class="btn btn-text-icon btn-small btn-green btn-collapse gluecksKabineBuchen '+classHide+'"'; 362 span = '<span class="visible-xxs-block mobile-title">Buchen </span><span class="hidden-xxs">Buchen</span><span class="icon icon-right"></span>'; 363 }else { 364 btnAttr = 'class="btn btn-small btn-green btn-collapse collapse-toggle show_deckplaene '+classHide+'" data-parent="#block-collapse-ship"'; 365 span = '<span class="visible-xxs-block mobile-title">Wählen</span><span class="hidden-xxs">Kabine wählen</span><span class="icon icon-in"></span>'; 366 } 367 368 html = '<span class="' + controls[aKat[8]].CLASSNAME + ' category-info" data="'+controls[aKat[8]].TITLE+'"></span>' + 369 '<a ' + btnAttr + ' href="Javascript:void(0);">' + span + '</a>'; 370 371 return html; 372 }, 373 374 getKatImages: function(aKat) { 375 var options = $element.data('options'), 376 data = options.data, 377 aImages = data.katImages[aKat[0]].Detail, 378 html = '', 379 content = '', 380 videoId = aKat[13], 381 imgLen = !!videoId ? Math.min(aImages.length, 1) : aImages.length, 382 _src=''; 383 384 if(!!aKat[11] && aKat[11].substr(0,1) == 'G') { 385 return methods.getSpecialCabineText(); 386 } 387 388 for( var i = 0; i < imgLen; i++ ) { 389 if(aImages[i].id !== '') { 390 html = '<div class="col-xs-12 col-xm-6 col-lg-12">' + 391 '<a href="'+aImages[i].url+'" class="fancybox-media" ><img class="img-responsive" alt="" src="'+aImages[i].url+'"></a>' + 392 '<p>'+aImages[i].signature1+'</p>' + 393 '</div>'; 394 } 395 content = content + html; 396 } 397 398 399 // Video 400 if( !! videoId ) { 401 if ( isSmartClient ) { 402 _src = "https://www.youtube-nocookie.com/watch?v=" + videoId; 403 html = '<a class="videoWrapperMobile" href="' + _src + '">'; 404 html += '<img src="https://img.youtube.com/vi/' + videoId + '/0.jpg" />'; 405 html += '<div class="play-button"></div>'; 406 html += '</a>'; 407 } else { 408 _src = "https://www.youtube-nocookie.com/embed/" + videoId + "?color1=FFFFFF&color2=FFFFFF&rel=0&loop=1&hd=1&autoplay=1&showsearch=0&controls=0&version=3&modestbranding=1"; 409 410 html = '<div class="videoContainer col-xs-12 col-xm-6 col-lg-12">'; 411 html += '<a href="'+ _src +'" class="fancybox-media" ><img class="img-responsive" alt="" src="https://img.youtube.com/vi/' + videoId + '/0.jpg"></a>'; 412 html += '</div>'; 413 } 414 content = content + html; 415 } 416 417 418 return content; 419 }, 420 421 getSpecialCabineText: function() { 422 var options = $element.data('options'), 423 data = options.data, 424 html = ''; 425 426 html = '<div class="col-xs-12 col-xm-6 col-lg-12"><p>'+data.textRes.guaranteeCabine+'</p></div>'; 427 428 return html; 429 }, 430 431 getDeckplanHTML: function(aKat) { 432 var options = $element.data('options'), 433 data = options.data, 434 idKat = aKat[0], 435 aDeckplaene = data.katDecks[idKat], 436 deckData = data.deckData.DATA, 437 btnClass = 'disabled deckplanKabineBuchen', 438 html = '', 439 linkList = '', 440 bigShipElem = '', 441 smallShipElem = '', 442 idDeckplan = '', 443 iconClass = '', 444 display = '', 445 classHide = ''; 446 447 if(!!aKat[11] && aKat[11].substr(0,1) == 'G') { 448 btnClass = 'garantieKabineBuchen'; 449 classHide = 'mobile-dnone'; 450 } 451 if(typeof aDeckplaene != 'undefined'){ 452 for( var i = 0; i < aDeckplaene.length; i++ ) {
453 idDeckplan = aDeckplaene[i]; 454 display = i === 0 ? 'block' : 'none'; 455 iconClass = i === 0 ? 'icon icon-up' : 'icon icon-down'; 456 457 for(var a in deckData) { 458 if(deckData[a][0] === idDeckplan){ 459 linkList = linkList + '<li><a href="Javascript:void(0);" class="change_katDeckplan" data="' + idDeckplan + '"><span class="icon '+iconClass+'"></span>' + deckData[a][2] + '</a></li>'; 460 bigShipElem = bigShipElem + '<div class="detailDeckplanSVG deckplan-loader" style="display:'+display+'" idDeck="'+idDeckplan+'" data="/public/deckplaene/'+ options.shipName +'-'+deckData[a][1]+'.svg"></div>'; 461 smallShipElem = smallShipElem + '<div class="draggable-target detailSmallDeckplanSVG deckplan-loader '+classHide+'" style="display:'+display+'" idDeck="'+idDeckplan+'" data="/public/deckplaene/'+options.shipName+'-'+deckData[a][1]+'.svg"></div>'; 462 } 463 } 464 } 465 } 466 467 if(aKat[8] != 'ROT_WARTELISTE') { 468 html = '<div class="collapse-content">' + 469 '<div class="row collapse-content-ship with-side draggable-container">' + 470 '<div class="target-drag col-xs-12 col-xm-7 col-sm-6 col-lg-5 '+classHide+'">' + 471 '<div class="ship-big-area ">' + 472 '<p class="title-attr">Bitte wählen Sie eine Kabine</p>' + 473 '<div class="ship-decks-list">' + 474 '<ul>' + linkList + '</ul>' + 475 '</div>' + 476 '<div class="container-space-area">' + 477 '<div class="full-absolute arrow-animation">' + 478 '<div class="icon icon-up"></div>' + 479 '<div class="icon icon-down"></div>' + 480 '</div>' + 481 '<div class="space-area">' + 482 '<div class="ship-zoom draggable-zoom">' + 483 bigShipElem + 484 '</div>' + 485 '</div>' + 486 '</div>' + 487 '</div>' + 488 '</div>' + 489 '<div class="ship-drag-nav col-xs-12 col-xm-5 col-sm-6 col-lg-3 '+classHide+'">' + 490 '<div class="ship-small-area">' + 491 smallShipElem + 492 '<div class="drag-area">' + 493 '<div class="ship-nav draggable-nav">' + 494 '<img alt="" src="/public/img/ship/ship-navi.png">' + 495 '</div>' + 496 '</div>' + 497 '</div>' + 498 '</div>' + 499 '<div class="col-xs-12 col-lg-4">' + 500 '<div class="side-ship row">' + 501 '<div class="col-xs-12">' + 502 '<div class="Kab-Kat-Titel">Kabinen-Kategorie '+aKat[5]+'</div>' + 503 '</div>' + 504 methods.getKatImages(aKat) + 505 '<div class="side-ship-button col-xs-12">' + 506 '<a class="btn btn-text-icon btn-big btn-green '+btnClass+'" href="Javascript:void(0);"><span class="icon icon-right"></span>Jetzt buchen</a>' + 507 '</div>' + 508 '</div>' + 509 '</div>' + 510 '</div>' + 511 '</div>'; 512 } 513 514 return html; 515 }, 516 517 getShowFurtherKatLink: function() { 518 var options = $element.data('options'), 519 data = options.data, 520 html = ''; 521 522 html = '<a id="0" class="showFurtherCategories labelDeck" style="display:inline" href="javascript:void(0);">' + 523 '<span class="text">'+data.textRes.openCategories+'</span>' + 524 '<span class="icon icon-down"></span>' + 525 '</a>'; 526 527 return html; 528 }, 529 530 getHideFurtherKatLink: function() { 531 var options = $element.data('options'), 532 data = options.data, 533 html = ''; 534 535 html = '<a class="hideFurtherCategories" style="display:inline" href="javascript:void(0);">' + 536 '<span class="icon icon-up" style="margin-bottom: 8px"></span>' + 537 '<span class="text">'+data.textRes.closeCategories+'</span>' + 538 '</a>'; 539 540 return html; 541 }, 542 543 saveSelectedCabine: function(idKab, idKat, idDeck) { 544 var options = $element.data('options'), 545 data = options.data; 546 547 data.idSelectedKab = idKab; 548 data.idSelectedKat = idKat; 549 data.idSelectedDeck = idDeck; 550 551 methods.updateSidebar(); 552 }, 553 554 colorSelectedCabines: function() { 555 556 var options = $element.data('options'), 557 data = options.data, 558 parentElement = '', 559 svgDoc = '', 560 smallSvgDoc = ''; 561 562 if(data.idSelectedKat === '') { 563 return; 564 } 565 566 parentElement = $('.collapse-container[id='+data.idSelectedKat+']'); 567 568 if($('.detailDeckplanSVG[idDeck='+data.idSelectedDeck+']', parentElement).is(':visible')) { 569 svgDoc = $('.detailDeckplanSVG:visible', parentElement).svg('get'); 570 smallSvgDoc = $('.detailSmallDeckplanSVG:visible', parentElement).svg('get'); 571 572 $('#'+data.idSelectedKab, svgDoc.root()).css('fill', '#00377a'); 573 if(smallSvgDoc) { 574 $('#'+data.idSelectedKab, smallSvgDoc.root()).attr('fill', '#00377a'); 575 } 576 if(data.kurzfrist != 1) {
577 $('.deckplanKabineBuchen', parentElement).removeClass('disabled'); // Buchenbutton aktivieren 578 } 579 } 580 }, 581 582 colorDeselectedCabines: function() { 583 var options = $element.data('options'), 584 data = options.data, 585 parentElement = '', 586 svgDoc = '', 587 smallSvgDoc = ''; 588 589 if(data.idSelectedKat === '') { 590 return; 591 } 592 593 parentElement = $('.collapse-container[id='+data.idSelectedKat+']'); 594 svgDoc = $('.detailDeckplanSVG[idDeck='+data.idSelectedDeck+']', parentElement).svg('get'); 595 smallSvgDoc = $('.detailSmallDeckplanSVG[idDeck='+data.idSelectedDeck+']', parentElement).svg('get'); 596 597 if(!!svgDoc) { 598 $('#'+data.idSelectedKab, svgDoc.root()).removeAttr('style'); 599 $('#'+data.idSelectedKab, svgDoc.root()).attr('fill', '#009eb4'); 600 } 601 602 if(!!smallSvgDoc) { 603 $('#'+data.idSelectedKab, smallSvgDoc.root()).attr('fill', '#009eb4'); 604 } 605 606 $('.deckplanKabineBuchen', parentElement).addClass('disabled'); 607 }, 608 609 scrollToCabine: function(idKab, idKat, idDeckplan) { 610 var parent = '', 611 svgElement = '', 612 smallSvgDoc = '', 613 svgDoc = '', 614 offsetDiff = ''; 615 616 if(idKat != '') { 617 parent = $('.collapse-container[id='+idKat+']'); 618 svgElement = $('.detailDeckplanSVG:visible', parent); 619 svgDoc = $('.detailDeckplanSVG[idDeck='+idDeckplan+']', parent).svg('get'); 620 smallSvgDoc = $('.detailSmallDeckplanSVG[idDeck='+idDeckplan+']', parent).svg('get'); 621 622 if($('.detailSmallDeckplanSVG[idDeck='+idDeckplan+']').is(':visible')){ 623 624 offsetDiff = $('.draggable-zoom', parent).offset().top-$('#'+idKab, svgDoc.root()).offset().top+245; // +35.55 // +(128*3.555) 625 626 $('.draggable-zoom', parent).css('margin-top', offsetDiff); 627 $('.draggable-nav', parent).offset({top: $('#'+idKab, smallSvgDoc.root()).offset().top-69}); //-10 //-128 628 } else { 629 630 offsetDiff = $('#'+idKab, svgDoc.root()).offset().top-$('.draggable-zoom', parent).offset().top-10; 631 632 $('.space-area', parent).scrollTop(offsetDiff); 633 } 634 return true; 635 } 636 return false; 637 }, 638 639 updateSVGcabines: function() { 640 var options = $element.data('options'), 641 data = options.data, 642 aBookableKabines = data.kabinen, 643 idDeckplan = $(this).attr('idDeck'), 644 idKategorie = $(this).closest('.collapse-container').attr('id'), 645 svgDoc = $(this).svg('get'), 646 smallSvgDoc = $('.detailSmallDeckplanSVG[idDeck='+idDeckplan+']', $(this).closest('.collapse-container')).svg('get'), 647 idSelectedKab = data.idSelectedKab, 648 idSelectedKat = data.idSelectedKat, 649 isSetOffset = false; 650 651 if(aBookableKabines[idDeckplan]) { 652 for(var i=0;i<aBookableKabines[idDeckplan].length;i++) { 653 var cabineNr = aBookableKabines[idDeckplan][i].KAB.substr(2), 654 roomElement = $('#r_'+cabineNr, svgDoc.root()), 655 kabElement = $('#n_'+cabineNr, svgDoc.root()), 656 kabElementSmall = $('#n_'+cabineNr, smallSvgDoc.root()), 657 idRoom = roomElement.attr('id'), 658 toolTipText = ''; 659 660 if(aBookableKabines[idDeckplan][i].IDKAT == idKategorie && roomElement && kabElement && idRoom){ 661 if(idSelectedKab == idRoom && idSelectedKat == idKategorie) { 662 methods.scrollToCabine(idSelectedKab, idSelectedKat, idDeckplan); 663 methods.colorSelectedCabines(); 664 }else { 665 if(!isSetOffset) { 666 isSetOffset = methods.scrollToCabine(idRoom, idKategorie, idDeckplan); 667 } 668 $('#'+idRoom, svgDoc.root()).attr('fill', '#009eb4'); 669 $('#'+idRoom, smallSvgDoc.root()).attr('fill', '#009eb4'); 670 } 671 toolTipText = 'buchbar'; 672 if(data.kurzfrist == 1) { 673 toolTipText = 'nur noch telefonisch buchbar'; 674 } 675 roomElement.attr('class', 'bookableCabine cabine-tooltip'); 676 roomElement.attr('tooltip-text', toolTipText); 677 roomElement.attr('idRoom', idRoom); 678 679 kabElement.attr('class', 'bookableCabine cabine-tooltip'); 680 kabElement.attr('tooltip-text', toolTipText); 681 kabElement.attr('idRoom', idRoom); 682 683 kabElement.find('path, polygon').each(function(){ 684 $(this).attr('fill','#ffffff'); 685 $(this).attr('class', 'bookableCabine'); 686 $(this).attr('idRoom', idRoom); 687 });
688 kabElementSmall.find('path, polygon').each(function(){ 689 $(this).attr('fill','#ffffff'); 690 }); 691 692 } else if(roomElement && kabElement) { 693 roomElement.attr('class', 'selectableCabine cabine-tooltip'); 694 roomElement.attr('idKategorie', aBookableKabines[idDeckplan][i].IDKAT); 695 roomElement.attr('tooltip-text', 'buchbar in anderer Kategorie'); 696 roomElement.attr('idRoom', idRoom); 697 698 kabElement.attr('class', 'selectableCabine cabine-tooltip'); 699 kabElement.attr('idKategorie', aBookableKabines[idDeckplan][i].IDKAT); 700 kabElement.attr('tooltip-text', 'buchbar in anderer Kategorie'); 701 kabElement.attr('idRoom', idRoom); 702 703 kabElement.find('path, polygon').each(function(){ 704 $(this).attr('fill','#000000'); 705 $(this).attr('class', 'selectableCabine'); 706 $(this).attr('idRoom', idRoom); 707 }); 708 kabElementSmall.find('path, polygon').each(function(){ 709 $(this).attr('fill','#000000'); 710 }); 711 } 712 } 713 $('rect[id]:not(.cabine-tooltip)', svgDoc.root()).each(function(){ 714 $(this).attr('class', 'cabine-tooltip'); 715 $(this).attr('tooltip-text', 'ausgebucht'); 716 }); 717 $('polygon[id]:not(.cabine-tooltip)', svgDoc.root()).each(function(){ 718 $(this).attr('class', 'cabine-tooltip'); 719 $(this).attr('tooltip-text', 'ausgebucht'); 720 }); 721 } 722 723 $('.detailDeckplanSVG:visible', $(this).closest('.collapse-container')).removeClass('deckplan-loader'); 724 methods.registerDeckplanEvents(); 725 if($('.cabine-direct:visible').val() != '' || !$('.change_katDeckplan[data='+ idDeckplan +']').is('[clicked]') || (idSelectedKab != '' && idSelectedKat == idKategorie)) { 726 idSelectedKab = idSelectedKab != '' && idSelectedKat == idKategorie ? idSelectedKab.substr(2) : $('.cabine-direct:visible').val(); 727 methods.showDeckByCabineNumber(idSelectedKab, !$('.change_katDeckplan[data='+ idDeckplan +']').is('[clicked]')); 728 }else { 729 $('.change_katDeckplan[data='+ idDeckplan +']').removeAttr('clicked'); 730 } 731 }, 732 733 loadBigShipSVG: function() { 734 var svgElement = $('.detailDeckplanSVG:visible', $(this).closest('.collapse-container')); 735 736 $('.detailSmallDeckplanSVG:visible', $(this).closest('.collapse-container')).removeClass('deckplan-loader'); 737 svgElement.svg({loadURL: svgElement.attr('data'), onLoad: methods.updateSVGcabines}); 738 }, 739 740 loadShipQuerschnittSVG: function() { 741 var svgElement = $('.ship-image'); 742 743 svgElement.svg({loadURL: svgElement.attr('data'), onLoad: methods.updateQuerschnittSVG}); 744 }, 745 746 updateQuerschnittSVG: function() { 747 var svgDoc = $(this).svg('get'); 748 749 if(svgDoc) { 750 svgDoc.root().removeAttribute('width'); 751 svgDoc.root().removeAttribute('height'); 752 } 753 }, 754 755 showFurtherCategories: function(idKat, callback) { 756 $('.showFurtherCategories').click(); 757 758 if (typeof callback === 'function') { 759 setTimeout( function() { 760 callback(idKat); 761 }, 1000 762 ); 763 } 764 }, 765 766 showCategory: function(idKat) { 767 $('.show_deckplaene', $('.collapse-container[id='+idKat+']')).click(); 768 }, 769 770 registerDeckplanEvents: function() { 771 var touchmoved; 772 /** 773 * bookable cabine in another category 774 */ 775 $('.selectableCabine').off('click').on('click', function(){ 776 777 methods.colorDeselectedCabines(); 778 methods.saveSelectedCabine(this.getAttribute('idRoom'), this.getAttribute('idKategorie'), $(this).closest('.detailDeckplanSVG').attr('idDeck')); 779 780 if( $('.showFurtherCategories').is(':visible') ) { 781 methods.showFurtherCategories(this.getAttribute('idKategorie'), methods.showCategory); 782 } else { 783 methods.showCategory(this.getAttribute('idKategorie')) 784 } 785 }); 786 787 $('.selectableCabine').off('touchstart').on('touchstart', function(e){ 788 //e.preventDefault(); 789 touchmoved = false; 790 }).off('touchmove').on('touchmove', function(e){ 791 touchmoved = true; 792 }).off('touchend').on('touchend', function(e){ 793 if(touchmoved != true){ 794 methods.touchmoveOffEvent(); 795 methods.colorDeselectedCabines(); 796 methods.saveSelectedCabine(this.getAttribute('idRoom'), this.getAttribute('idKategorie'), $(this).closest('.detailDeckplanSVG').attr('idDeck')); 797 798 if( $('.showFurtherCategories').is(':visible') ) { 799 methods.showFurtherCategories(this.getAttribute('idKategorie'), methods.showCategory); 800 } else { 801 methods.showCategory(this.getAttribute('idKategorie')) 802 } 803 } 804 }); 805 806 /** 807 * bookable cabine in this category 808 */ 809 $('.bookableCabine').off('click').on('click', function(e){
810 var idKat = $(this).closest('.collapse-container').attr('id'); 811 812 e.preventDefault(); 813 methods.colorDeselectedCabines(); 814 methods.saveSelectedCabine(this.getAttribute('idRoom'), idKat, $(this).closest('.detailDeckplanSVG').attr('idDeck')); 815 methods.colorSelectedCabines(); 816 }); 817 818 $('.bookableCabine').off('touchstart').on('touchstart', function(e) { 819 var options = $element.data('options'), 820 data = options.data, 821 aCategories = data.categories.DATA, 822 index = $(this).closest('.collapse-container').attr('index'), 823 link = '', 824 html = ''; 825 826 // e.preventDefault(); 827 touchmoved = false; 828 829 if(data.kurzfrist == 1) { 830 link = '<a class="btn btn-text-icon btn-big btn-green" href="tel:'+data.hotline+'" rel="external">' + 831 '<span class="icon icon-right"></span>' + 832 'Jetzt anrufen' + 833 '</a>'; 834 } else { 835 link = '<a class="btn btn-text-icon btn-big btn-green deckplanKabineBuchen" href="Javascript:void(0);">' + 836 '<span class="icon icon-right"></span>' + 837 'Jetzt buchen' + 838 '</a>'; 839 } 840 html = '<div class="cabine-tooltip-mobile">' + 841 '<p>'+aCategories[index][9]+'</p>' + 842 '<p class="cabine-tooltip-price">'+ methods.priceFormat(''+aCategories[index][10])+' p.P.</p>' + 843 link + 844 '</div>'; 845 846 $('#tooltipWindow div').html(html); 847 $('#tooltipWindow').css('left', e.originalEvent.touches[0].clientX - 90).css('top', e.originalEvent.touches[0].clientY + 20); 848 849 }).off('touchmove').on('touchmove', function() { 850 touchmoved = true; 851 }).off('touchend').on('touchend', function(e) { 852 if(touchmoved != true){ 853 var idKat = $(this).closest('.collapse-container').attr('id'); 854 855 e.preventDefault(); 856 methods.colorDeselectedCabines(); 857 methods.saveSelectedCabine(this.getAttribute('idRoom'), idKat, $(this).closest('.detailDeckplanSVG').attr('idDeck')); 858 methods.colorSelectedCabines(); 859 860 $('#tooltipWindow').show(); 861 methods.registerEvents(); 862 } 863 }); 864 865 $('.cabine-tooltip').on('mousemove', function (e) { 866 e.preventDefault(); 867 $('#tooltipWindow div').html($(this).attr('tooltip-text')); 868 $('#tooltipWindow').css('left', e.clientX + 15).css('top', e.clientY + 10); 869 $('#tooltipWindow').show(); 870 }); 871 872 $('.cabine-tooltip').on('mouseleave', function (e) { 873 e.preventDefault(); 874 $('#tooltipWindow').hide(); 875 }); 876 877 $('rect.bookableCabine').hover( function () { 878 $(this).attr('fill', '#00377a'); 879 }, function () { 880 $(this).attr('fill', '#009eb4'); 881 }); 882 883 $('g.bookableCabine').find('path, polygon').hover(function () { 884 $('#r_'+ $(this).closest('g[id]').attr('id').substr(2), $(this).closest('svg')).attr('fill', '#00377a'); 885 }, function () { 886 $('#r_'+ $(this).closest('g[id]').attr('id').substr(2), $(this).closest('svg')).attr('fill', '#009eb4'); 887 }); 888 889 $('rect.selectableCabine').hover( function () { 890 $(this).attr('fill', '#00377a'); 891 }, function () { 892 $(this).attr('fill', '#ffffff'); 893 }); 894 895 $('g.selectableCabine').find('path, polygon').hover(function () { 896 $('#r_'+ $(this).closest('g[id]').attr('id').substr(2), $(this).closest('svg')).attr('fill', '#00377a'); 897 }, function () { 898 $('#r_'+ $(this).closest('g[id]').attr('id').substr(2), $(this).closest('svg')).attr('fill', '#ffffff'); 899 }); 900 }, 901 902 loadKatSVGs: function() { 903 904 var options = $element.data('options'), 905 data = options.data, 906 svgElement = $('.detailDeckplanSVG:visible', $(this).closest('.collapse-container')), 907 smallSvgElement = $('.detailSmallDeckplanSVG[idDeck='+svgElement.attr('idDeck')+']', $(this).closest('.collapse-container')); 908 909 methods.touchmoveOffEvent(); 910 // SVG laden und vakante Kabinen markieren, wenn der entsprechende Anzeigebereich geöffnet ist 911 if($(this).closest('.collapse-container').hasClass('open') && !smallSvgElement.hasClass('hasSVG')) { 912 smallSvgElement.svg({loadURL: smallSvgElement.attr('data'), onLoad: methods.loadBigShipSVG});
913 }else { 914 methods.colorSelectedCabines(); 915 methods.showDeckByCabineNumber($('.cabine-direct:visible').val(), true); 916 methods.scrollToCabine(data.idSelectedKab, data.idSelectedKat, data.idSelectedDeck); 917 } 918 }, 919 920 updateSidebar: function() { 921 var options = $element.data('options'), 922 data = options.data, 923 kab = data.idSelectedKab.substr(2, data.idSelectedKab.length), 924 aCategories = data.categories.DATA, 925 index = $('.collapse-container[id='+data.idSelectedKat+']').attr('index'), 926 queryString = '/?pm=kreuzfahrtbuchung&source=detail&searchIDObjekt='+options.searchIdCruiseDate+'&searchIDKategorie='+data.idSelectedKat+'&searchIDDeck='+data.idSelectedDeck+'&searchkabinennummer='+kab; 927 928 $('.selectedCategory').html('<p>'+aCategories[index][9]+'</p><p class="price">'+ methods.priceFormat(''+aCategories[index][10])+' p.P.</p>'); 929 $('.side-book-infos a.detail-button').attr('href', queryString); 930 $('.side-book-infos a.detail-button').data('is-bookinglink', true); 931 }, 932 933 clickOffEvent: function() { 934 $('.info-hover-content').hide(); 935 }, 936 937 touchmoveOffEvent: function() { 938 if($('#tooltipWindow').is(':visible')){ 939 $('#tooltipWindow').hide(); 940 } 941 $('#arrowTooltip').css('opacity', 0); 942 $('#arrowTooltip').hide(); 943 }, 944 touchstartOffEvent: function() { 945 $('.labelDeck, .belegungKat').closest('.hover-content').removeAttr('style'); 946 }, 947 948 registerEvents: function() { 949 var options = $element.data('options'), 950 data = options.data, 951 katDesc = data.katDesc; 952 953 $('html,body').off('click', methods.clickOffEvent).on('click', methods.clickOffEvent); 954 955 $('html,body').off('touchmove', methods.touchmoveOffEvent).on('touchmove', methods.touchmoveOffEvent); 956 $('html,body').off('touchstart', methods.touchstartOffEvent).on('touchstart', methods.touchstartOffEvent); 957 958 $('.showFurtherCategories').off('click').on('click', function() { 959 $('.collapse-container').removeClass('hidden-xxs'); 960 $('.item-loadmore').html(methods.getHideFurtherKatLink()); 961 methods.registerEvents(); 962 }); 963 $('.hideFurtherCategories').off('click').on('click', function() { 964 $('.further-kat').addClass('hidden-xxs'); 965 $('.item-loadmore').html(methods.getShowFurtherKatLink()); 966 $('html, body').animate({ 967 scrollTop: ($('.item-loadmore').offset().top -300) 968 },500); 969 methods.registerEvents(); 970 }); 971 /** 972 * show categories with selected deck 973 */ 974 $('.labelDeck, .belegungKat').off('click').on('click', function() { 975 methods.updateTableData($(this)); 976 $(this).closest('.hover-content').css('opacity', 0); 977 $(this).closest('.hover-content').css('visibility', 'hidden'); 978 }); 979 980 $('.labelDeck, .belegungKat').closest('.hover-content').off('mouseleave').on('mouseleave', function() { 981 $(this).removeAttr('style'); 982 }); 983 /** 984 * show deck view content 985 */ 986 $('.show_deckplaene').off('click', methods.loadKatSVGs).on('click', methods.loadKatSVGs); 987 /** 988 * show icon data 989 */ 990 $('.kategorie-icon').off('click').on('click', function(e) { 991 var html = '', 992 img = '', 993 index = $(this).attr('index'), 994 idKat = $(this).closest('.collapse-container').attr('id'), 995 aImages = data.katImages[idKat].Detail, 996 descr = ''; 997 998 //console.info( aCategories[katIndex] ) 999 1000 if(katDesc[idKat][index].TITEL === 'Kabineninformationen'){ 1001 if(aImages.length > 0 && aImages[0].url !== '') { 1002 img = '<div class="col-sm-4 descr-images">' + 1003 '<div class="info-column image-column">'; 1004 1005 for( var i = 0; i < aImages.length; i++ ) { 1006 if(aImages.length) { 1007 img = img + '<a href="'+aImages[i].url+'" class="fancybox-media" ><img class="img-responsive" alt="" src="'+aImages[i].url+'"></a>' + 1008 '<p>'+aImages[i].signature1+'</p>'; 1009 } 1010 } 1011 1012 img = img + '</div></div>'; 1013 } 1014 } 1015 1016 if($(this).next().is(':visible')) { 1017 $(this).parent().removeClass('open'); 1018 $(this).next().hide(); 1019 } else { 1020 methods.clickOffEvent(); 1021 descr = katDesc[idKat][index].TEXT; 1022 1023 html = '<div class="row custom-grid">' + 1024 img + 1025 '<div class="col-sm-8">' + 1026 '<div class="info-column text-column">'+descr+'</div>' + 1027 '</div>' + 1028 '<div class="search-close-button" onclick="$(this).parent().prev().click();" style="padding-left: 0px;padding-right: 1px;"></div>'+ 1029 '</div>'; 1030 1031 $(this).parent().addClass('open'); 1032 $(this).next().show(); 1033 $(this).next().html(html); 1034 } 1035 1036 e.preventDefault(); 1037 return false; 1038 }); 1039 /** 1040 * show category by cabine number 1041 */ 1042 $('.cabine-direct:visible').off('keypress blur').on('keypress blur', function(e){
1043 var keycode = (e.keyCode ? e.keyCode : e.which), 1044 value = $('.cabine-direct:visible').val(); 1045 1046 1047 if((keycode == '13' || e.type == 'blur') && value !== '') { 1048 methods.showDeckByCabineNumber(value, e); 1049 } 1050 }); 1051 /** 1052 * enter wait list formular 1053 */ 1054 $('.wartelistebutton').off('click').on('click', function(e) { 1055 var idKat = $(this).closest('.collapse-container').attr('id'), 1056 queryString = ''; 1057 1058 queryString = '/?pm=kreuzfahrtbuchung&source=detail&searchIDObjekt='+options.searchIdCruiseDate+'&searchIDKategorie='+idKat+'&searchwarteliste=1'; 1059 location.href = queryString; 1060 1061 e.preventDefault(); 1062 return false; 1063 }); 1064 /** 1065 * change category deck view 1066 */ 1067 $('.change_katDeckplan').off('click').on('click', function(e) { 1068 var idDeck = $(this).attr('data'), 1069 parent = $(this).closest('.collapse-container'); 1070 1071 if(e.originalEvent !== undefined) { 1072 $('.change_katDeckplan[data='+ $(this).attr('data')+']').attr('clicked', true); 1073 } 1074 $('.change_katDeckplan span', parent).each( function() {$(this).attr('class', 'icon icon-down');}); 1075 $(this).children('span').attr('class', 'icon icon-up'); 1076 $('.detailDeckplanSVG', parent).each(function(){ 1077 $(this).hide(); 1078 1079 if($(this).attr('idDeck') == idDeck) { 1080 $(this).show(); 1081 } 1082 }); 1083 1084 $('.detailSmallDeckplanSVG', parent).each(function(){ 1085 $(this).hide(); 1086 1087 if($(this).attr('idDeck') == idDeck) { 1088 $(this).show(); 1089 if(!$(this).hasClass('hasSVG')) { 1090 $(this).svg({loadURL: $(this).attr('data'), onLoad: methods.loadBigShipSVG}); 1091 } else { 1092 methods.showDeckByCabineNumber($('.cabine-direct:visible').val(), e); 1093 } 1094 } 1095 }); 1096 1097 e.preventDefault(); 1098 return false; 1099 }); 1100 /** 1101 * buchen button 1102 */ 1103 $('.deckplanKabineBuchen').off('click').on('click', function(e) { 1104 if(!$(this).hasClass('disabled')) { 1105 var kab = data.idSelectedKab.substr(2, data.idSelectedKab.length), 1106 idKat = data.idSelectedKat, 1107 queryString = ''; 1108 1109 queryString = '/?pm=kreuzfahrtbuchung&source=detail&searchIDObjekt='+options.searchIdCruiseDate+'&searchIDKategorie='+idKat+'&searchIDDeck='+data.idSelectedDeck+'&searchkabinennummer='+kab; 1110 location.href = queryString; 1111 } 1112 1113 e.preventDefault(); 1114 return false; 1115 }); 1116 1117 $('.gluecksKabineBuchen').off('click').on('click', function(e) { 1118 var options = $element.data('options'), 1119 data = options.data, 1120 aCategories = data.categories.DATA, 1121 index = $(this).closest('.collapse-container').attr('index'), 1122 queryString = ''; 1123 1124 queryString = '/?pm=kreuzfahrtbuchung&source=detail&searchIDObjekt='+options.searchIdCruiseDate+'&searchIDKategorie='+aCategories[index][0]+'&searchkabinennummer='+aCategories[index][11].substr(0,aCategories[index][11].length-1); 1125 location.href = queryString; 1126 1127 e.preventDefault(); 1128 return false; 1129 }); 1130 $('.garantieKabineBuchen').off('click').on('click', function(e) { 1131 var options = $element.data('options'), 1132 data = options.data, 1133 aCategories = data.categories.DATA, 1134 index = $(this).closest('.collapse-container').attr('index'), 1135 queryString = ''; 1136 1137 queryString = '/?pm=kreuzfahrtbuchung&source=detail&searchIDObjekt='+options.searchIdCruiseDate+'&searchIDKategorie='+aCategories[index][0]+'&searchkabinennummer='+aCategories[index][11].substr(0,aCategories[index][11].length-1); 1138 location.href = queryString; 1139 1140 e.preventDefault(); 1141 return false; 1142 }); 1143 1144 $('.category-info').off('mouseover touchstart').on('mouseover touchstart', function(e) { 1145 $('#arrowTooltip div.tooltip-inner').html($(this).attr('data')); 1146 $('#arrowTooltip').css('opacity', 1).css('left', $(e.target).offset().left + 50).css('top', $(e.target).offset().top-5); 1147 $('#arrowTooltip').show(); 1148 }).off('mouseout').on('mouseout', function() { 1149 $('#arrowTooltip').css('opacity', 0); 1150 $('#arrowTooltip').hide(); 1151 }); 1152 }, 1153 1154 showDeckByCabineNumber: function (cabineNr, event) { 1155 var options = $element.data('options'), 1156 data = options.data, 1157 abort = false, 1158 aKatDecks = '', 1159 parentElem = '', 1160 svgElem = '', 1161 idKab = '', 1162 idKat = '', 1163 idNextDeck = '', 1164 nextDeck = false, 1165 aBookableKabines = data.kabinen; 1166 1167 if(typeof cabineNr != 'undefined' && cabineNr !== '' && event) { 1168 for(var idDeck in aBookableKabines) { 1169 if (aBookableKabines.hasOwnProperty(idDeck)) { 1170 var aCabines = aBookableKabines[idDeck]; 1171 1172 for(var i=0;i<aCabines.length;i++) { 1173 if(aCabines[i].KAB.substr(2) == cabineNr) { 1174 methods.colorDeselectedCabines(); 1175 idKat = aCabines[i].IDKAT; 1176 idKab = aCabines[i].KAB; 1177 parentElem = $('.collapse-container[id='+idKat+']'); 1178 aKatDecks = data.katDecks[idKat]; 1179 1180 if($(parentElem).hasClass('open')) { 1181 svgElem = $('.detailDeckplanSVG:visible', parentElem); 1182 if($(svgElem).attr('idDeck') == idDeck) { 1183 if($(svgElem).find('#'+idKab).length > 0) { 1184 1185 $('.cabine-direct:visible').val(''); 1186 1187 methods.saveSelectedCabine(idKab, idKat, idDeck); 1188 methods.colorSelectedCabines(); 1189 methods.scrollToCabine(idKab, idKat, idDeck); 1190 abort = true; 1191 } else if(aKatDecks.length > 1) { 1192 if(aKatDecks.length-1 > aKatDecks.indexOf(parseInt(idDeck))) { 1193 idNextDeck = aKatDecks[aKatDecks.indexOf(parseInt(idDeck))+1]; 1194 $('.change_katDeckplan[data='+idNextDeck+']', parentElem).click(); 1195 } else { 1196 $('.change_katDeckplan[data='+aKatDecks[0]+']', parentElem).click(); 1197 } 1198 abort = true; 1199 } 1200 } 1201 } else { 1202 $('.collapse-container[id='+idKat+']').find('.show_deckplaene').click(); 1203 abort = true; 1204 } 1205 1206 $('html, body').animate({ 1207 scrollTop: ($('.collapse-container[id='+idKat+']').offset().top)-80 1208 },500); 1209 } 1210 if(abort) { 1211 break; 1212 } 1213 } 1214 } 1215 if(abort) { 1216 break; 1217 } 1218 } 1219 // could not find the given cabine number 1220 if(!abort) { 1221 $('#arrowTooltip div.tooltip-inner').html('Die Kabine ist leider nicht mehr verfügbar'); 1222 if(event && event.type == 'keypress') { 1223 $('#arrowTooltip').css('opacity', 1).css('left', $(event.target).offset().left +90).css('top', $(event.target).offset().top-7); 1224 } 1225 $('#arrowTooltip').show(); 1226 } 1227 } else if(event && event.type != 'click'){ 1228 1229 parentElem = $('.collapse-container.open'); 1230 idKat = parentElem.attr('id'); 1231 aKatDecks = data.katDecks[idKat]; 1232 svgElem = $('.detailDeckplanSVG:visible', parentElem); 1233 1234 if(aKatDecks) { 1235 for(var idDeck in aBookableKabines) { 1236 if (aBookableKabines.hasOwnProperty(idDeck)) { 1237 var aCabines = aBookableKabines[idDeck]; 1238 for(var k=0;k<aCabines.length;k++) { 1239 idKab = aCabines[k].KAB; 1240 if(aCabines[k].IDKAT == idKat) { 1241 //abort = true; 1242 1243 if($(svgElem).attr('idDeck') == idDeck) { 1244 nextDeck = true; 1245 if($(svgElem).find('#'+idKab).length > 0) { 1246 methods.scrollToCabine(idKab, idKat, idDeck); 1247 abort = true; 1248 } 1249 } 1250 1251 if(abort) { 1252 break; 1253 } 1254 } 1255 if(aKatDecks.length > 1 && k === aCabines.length-1 && nextDeck === true) { 1256 if(aKatDecks.length-1 > aKatDecks.indexOf(parseInt(idDeck))) { 1257 idNextDeck = aKatDecks[aKatDecks.indexOf(parseInt(idDeck))+1]; 1258 $('.change_katDeckplan[data='+idNextDeck+']', parentElem).click(); 1259 } else { 1260 $('.change_katDeckplan[data='+aKatDecks[0]+']', parentElem).click(); 1261 } 1262 abort = true; 1263 } 1264 } 1265 } 1266 if(abort) { 1267 break; 1268 } 1269 } 1270 } 1271 } 1272 } 1273 }; 1274 1275 $.fn.preisleistung = function() { 1276 var _this = $(this); 1277 1278 if(!_this[0]) return _this; // stop here if the container does not exist 1279 1280 methods.init.apply( _this, arguments ); 1281 return methods.attach.apply( _this ); 1282 }; 1283 1284 $.fn.preisleistung.defaults = { 1285 onSuccess: false, 1286 onComplete: false, 1287 onFailure: false, 1288 lazyLoad: false, 1289 data: {} 1290 }; 1291 1292})( window.jQuery, window, document );
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.