1 2jQuery.getClient = function(e) 3{ 4 if (e) { 5 w = e.clientWidth; 6 h = e.clientHeight; 7 } else { 8 w = (window.innerWidth) ? window.innerWidth : (document.documentElement && document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.offsetWidth; 9 h = (window.innerHeight) ? window.innerHeight : (document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.offsetHeight; 10 } 11 return {w:w,h:h}; 12}; 13 14//20120105 ç°å£è¿½å 15//tableã®trè¦ç´ ãå ¨é¸æã§ããããã«ãã 16//Ticket 9337 to remark keyword search 17//$(function(){ 18// 19// 20// // ãããã¼ã®ãµã¸ã§ã¹ã 21// $('#kw').ajaxSuggest( 22// '/tr_json/header_suggest/', 23// {'database':($("select[name='data[area]']").length) ? $("select[name='data[area]']").children(':selected').val() : $("#area").val(), 'bind_to':'master_ajax'} 24// ); 25// 26// 27// $('tbody tr[data-href]').addClass('clickable').click( function() { 28// window.location = $(this).attr('data-href'); 29// }).find('a').hover( function() { 30// $(this).parents('tr').unbind('click'); 31// 32// }, function() { 33// $(this).parents('tr').click( function() { 34// window.location = $(this).attr('data-href'); 35// }); 36// }); 37//}); 38 39 40// description_move 41$(function(){ 42 if($("#H1Title").length > 0 && $("#FooterH1Title").length > 0) { 43 $("#H1Title").prependTo("#FooterH1Title"); 44 $("#FooterH1Title").height($("#H1Title").show().height()); 45 } 46}); 47 48 49$(document).ready(function(){ 50 51 if (!$.support.opera) { 52 53 $('select.select_adv_search').each(function(){ 54 var title = $(this).attr('title'); 55 if( $('option:selected', this).val() != '' ) title = $('option:selected',this).text(); 56 $(this) 57 .css({'z-index':10,'opacity':0,'-khtml-appearance':'none'}) 58 .after('<span class="select_adv_search">' + title + '</span>') 59 .on('change', function(){ 60 val = $('option:selected',this).text(); 61 $(this).next().text(val); 62 }) 63 }); 64 65 }; 66 67}); 68 69$(document).ready(function(){ 70 71 if (!$.support.opera) { 72 73 $('select.select_destination').each(function(){ 74 var title = $(this).attr('title'); 75 if( $('option:selected', this).val() != '' ) title = $('option:selected',this).text(); 76 $(this) 77 .css({'z-index':10,'opacity':0,'-khtml-appearance':'none'}) 78 .after('<span class="select_destination">' + title + '</span>') 79 .on('change', function(){ 80 val = $('option:selected',this).text(); 81 $(this).next().text(val); 82 }) 83 }); 84 85 }; 86 87}); 88 89////////////////////////////// Form Label ////////////////////////////// 90function ShowFormGuide(obj,GuideSentence) { 91 if( obj.value == '' ) { 92 obj.value = GuideSentence; 93 obj.style.color = '#999999'; 94 } 95} 96function HideFormGuide(obj,GuideSentence) { 97 if( obj.value == GuideSentence ) { 98 obj.value=''; 99 obj.style.color = '#333333'; 100 } 101} 102 103/* 104Infomation 105========================================================================================== 106jQuery Plugin 107 Name : jquery.ajaxSuggest 108 Version : 1.5 109 Update : 2010-12-12 110 Author : sutara_lumpur 111 Author-URI : http://d.hatena.ne.jp/sutara_lumpur/20100718/1279420832 112 License : MIT License (http://www.opensource.org/licenses/mit-license.php) 113 Based-on : Uses code and techniques from following libraries... 114 * jquery.suggest 1.1 115 Author : Peter Vulgaris 116 Author-URI : http://www.vulgarisoip.com/ 117========================================================================================== 118 119Contents 120========================================================================================== 121 01. 夿°ã»é¨åã®å®ç¾© 122 02. ã¤ãã³ããã³ãã© 123 03. Suggestç¨ã¡ã½ãã - æªåé¡ 124 04. Suggestç¨ã¡ã½ãã - Ajaxé¢é£ 125 05. Suggestç¨ã¡ã½ãã - åè£ãªã¹ãé¢é£
126 06. å¦çã®å§ã¾ã 127========================================================================================== 128*/ 129(function($) { 130 $.ajaxSuggest = function(input_obj, source, options) { 131 132 //Ajaxã«ããããã£ãã·ã¥ãç¡å¹ã«ãã 133 $.ajaxSetup({cache: false}); 134 135 //================================================================================ 136 // 01. 夿°ã»é¨åã®å®ç¾© 137 //-------------------------------------------------------------------------------- 138 //********************************************** 139 //夿°ã®åæå 140 //********************************************** 141 var show_hide = false; //åè£ããã¿ã¤ãã¼å¦çã§è¡¨ç¤ºãããã©ããã®äºç´ 142 var timer_show_hide = false; //ã¿ã¤ãã¼ããã©ã¼ã«ã¹ãå¤ããå¾ãåè£ãé表示ã«ããã 143 var timer_val_change = false; //ã¿ã¤ãã¼å¤æ°(ä¸å®æéãã¨ã«å ¥åå¤ã®å¤åãç£è¦) 144 var reserve_click = false; //ãã¦ã¹ã®ãã¼ãæ¼ãç¶ããæä½ã«å¯¾å¿ããããmousedownãæ¤ç¥ 145 var $xhr = false; //XMLHttpãªãã¸ã§ã¯ããæ ¼ç´ 146 var prev_value = ''; //Suggestã®ã以åã®å¤ 147 var user_value = ''; //ã¦ã¼ã¶ãå ¥åãããã¨ãã¨ã®å¤ 148 var is_select = false; //ãã¼å ¥åã§ã¯ãªããåè£é¸æã§$input_objã®å¤ãå¤ãã£ããï¼ 149 var key_select = false; //ãã¼ã§åè£ç§»åãããï¼ï¼ 150 151 //********************************************** 152 //é¨åã®å®ç¾© 153 //********************************************** 154 $(input_obj).attr('autocomplete','off'); 155 156 var $results = $('<ul></ul>') 157 .addClass(options.results_class) 158 .appendTo('body'); 159 160 //================================================================================ 161 // 02. ã¤ãã³ããã³ãã© 162 //-------------------------------------------------------------------------------- 163 //********************************************** 164 //ããã¹ãå ¥åã¨ãªã¢ 165 //********************************************** 166 //åå¦ç(ã¯ãã¹ãã©ã¦ã¶ç¨) 167 if($.support.checkOn && $.support.cssFloat){ 168 $(input_obj).keypress(processKey); 169 }else{ 170 $(input_obj).keydown(processKey); 171 } 172 $(input_obj).on('focus', function() { 173 show_hide = true; 174 checkValChange(); 175 }); 176 $(input_obj).blur(function(ev) { 177 //å ¥åå¤ã®ç£è¦ã䏿¢ 178 clearTimeout(timer_val_change); 179 180 //åè£æ¶å»ãäºç´ 181 show_hide = false;
182 183 //æ¶å»äºç´ã¿ã¤ãã¼ãã»ãã 184 checkShowHide(); 185 }); 186 $(input_obj).on('mousedown', function(ev) { 187 reserve_click = true; 188 189 //æ¶å»äºç´ã¿ã¤ãã¼ã䏿¢ 190 clearTimeout(timer_show_hide); 191 192 ev.stopPropagation(); 193 }); 194 $(input_obj).on('mouseup', function(ev) { 195 $(input_obj).trigger('focus'); 196 reserve_click = false; 197 ev.stopPropagation(); 198 }); 199 200 //********************************************** 201 //bodyå ¨ä½ 202 //********************************************** 203 $('body').on('mouseup', function() { 204 //æ¶å»äºç´ã¿ã¤ãã¼ã䏿¢ 205 clearTimeout(timer_show_hide); 206 207 //åè£ãæ¶å»ãã 208 show_hide = false; 209 hideResult(); 210 }); 211 212 //================================================================================ 213 // 03. Suggestç¨ã¡ã½ãã - æªåé¡ 214 //-------------------------------------------------------------------------------- 215 //********************************************** 216 //ã¿ã¤ãã¼ã«ããå ¥åå¤å¤åç£è¦ 217 //********************************************** 218 function checkValChange() { 219 timer_val_change = setTimeout(isChange,500); 220 221 function isChange() { 222 var now_value = $(input_obj).val(); 223 if(!now_value){ 224 hideResult(); 225 }else if(now_value != prev_value && !is_select) { 226 suggest(); 227 } 228 is_select = false; 229 prev_value = now_value; 230 231 //ã¦ã¼ã¶ããã¨ãã¨å ¥åãã¦ããå¤ãæ ¼ç´ 232 if(!getCurrentResult()) user_value = $(input_obj).val(); 233 234 //ä¸å®æéãã¨ã®ç£è¦ãåé 235 checkValChange(); 236 } 237 } 238 239 //********************************************** 240 //åè£ã®æ¶å»ãæ¬å½ã«å®è¡ããã夿 241 //********************************************** 242 function checkShowHide() { 243 timer_show_hide = setTimeout(function() { 244 if (show_hide == false && reserve_click == false){ 245 hideResult(); 246 } 247 },500); 248 } 249 250 //********************************************** 251 //ãã¼å ¥åã¸ã®å¯¾å¿ 252 //********************************************** 253 function processKey(e) { 254 if ( 255 (/27$|38$|40$|^9$/.test(e.keyCode) && $results.is(':visible')) || 256 (/^13$|^9$/.test(e.keyCode) && getCurrentResult()) 257 ) { 258 if (e.preventDefault) e.preventDefault(); 259 if (e.stopPropagation) e.stopPropagation(); 260 261 e.cancelBubble = true; 262 e.returnValue = false; 263 264 switch(e.keyCode) { 265 case 38: // up 266 key_select = true; 267 prevResult(); 268 break; 269 270 case 40: // down 271 key_select = true; 272 nextResult(); 273 break; 274 275 case 9: // tab 276 hideResult(); 277 break; 278 279 case 13: // return 280 selectCurrentResult(true); 281 break; 282 283 case 27: // escape 284 hideResult(); 285 break; 286 } 287 } else { 288 checkValChange(); 289 } 290 } 291 292 //================================================================================ 293 // 04. Suggestç¨ã¡ã½ãã - Ajaxé¢é£ 294 //-------------------------------------------------------------------------------- 295 //********************************************** 296 //Ajaxã®ä¸æ 297 //********************************************** 298 function abortAjax() { 299 if ($xhr){ 300 $xhr.abort(); 301 $xhr = false;
302 } 303 } 304 305 //********************************************** 306 //Ajaxéä¿¡ 307 //********************************************** 308 function suggest(){ 309 if($(input_obj).val().search(/^[ ã\n\r\t]*$/) > -1) return; 310 311 //Ajaxéä¿¡ããã£ã³ã»ã« 312 abortAjax(); 313 314 315 //ããã§Ajaxéä¿¡ãè¡ã£ã¦ãã 316 $xhr = $.getJSON( 317 options.source, 318 { 319 'q_word' : $(input_obj).val(), 320 'database' : options.database, 321 'sub_info' : options.sub_info, 322 'and_or' : options.and_or, 323 'limit' : options.limit, 324 'order_by' : options.order_by, 325 'origin' : $('#area').val() 326 }, 327 function(json_data){ 328 if(!json_data || json_data.length < 1){ 329 hideResult(); 330 }else{ 331 displayItems(json_data); 332 } 333 } 334 ); 335 } 336 337 //================================================================================ 338 // 05. Suggestç¨ã¡ã½ãã - åè£ãªã¹ãé¢é£ 339 //-------------------------------------------------------------------------------- 340 //********************************************** 341 //åè£ä¸è¦§ã®<ul>æå½¢ã表示 342 //********************************************** 343 // @params array arr_candidate DBããæ¤ç´¢ã»åå¾ããå¤ã®é å 344 // 345 //arr_candidateããããã®å¤ã<li>ã§å²ãã§è¡¨ç¤ºã 346 //åæã«ãã¤ãã³ããã³ãã©ãè¨è¿°ã 347 function displayItems(arr_candidate) { 348 349 //åè£ãªã¹ããã䏿¦ãªã»ãã 350 $results.empty(); 351 352 for (var i = 0; i < arr_candidate.length; i++) { 353 354 if(arr_candidate[i][0].id==0){continue;} 355 356 //åè£ãªã¹ã 357 if(options.sub_info !== false){ 358 var $li = $('<li>' + arr_candidate[i][0] + '</li>'); 359 //ãµãæ å ±ãæ ¼ç´ããç¬èªã®å±æ§"sub_info"ãè¨å® 360 $li.attr('sub_info',arr_candidate[i][1]); 361 362 }else{ 363 //var $li = $('<li><a href="'+arr_candidate[i][0].url+'">' + arr_candidate[i][0].name + '</a></li>'); 364 var $li = $('<li>' + arr_candidate[i][0].name + '<span style=\"display:none;\">:'+ arr_candidate[i][0].url + '</span></li>'); 365 } 366 $results.append($li); 367 } 368 369 $results.append($li); 370 371 //---------------------------------------------- 372 //åè£ãªã¹ãã®ä½ç½®ãæå® 373 //---------------------------------------------- 374 var offset = $(input_obj).offset(); 375 376 offset.top += 377 parseInt($(input_obj).height(), 10) + 378 parseInt($(input_obj).css('border-top-width'), 10) + 379 parseInt($(input_obj).css('padding-top'), 10) + 380 parseInt($(input_obj).css('padding-bottom'), 10); 381 if($.support.msie){ 382 //IEã¯ç¸å¯¾åº§æ¨ã§offsetãåå¾ããã 383 //ãã®ãããç»é¢ã¹ã¯ãã¼ã«åãè¶³ãåãããå¿ è¦ãããã 384 offset.top += parseInt($results.scrollTop(), 10); 385 } 386 387 offset.left += parseInt($(input_obj).css('padding-left'), 10) - 5; 388 if($.support.msie || $.support.opera){ 389 offset.left -= parseInt($(input_obj).css('border-left-width'), 10) - 5; 390 } 391 392 //ç»é¢ã«è¡¨ç¤º 393 $results 394 .show() 395 .css({'top':offset.top, 'left':offset.left}) 396 .width( 397 parseInt($(input_obj).width() * 2) + 398 parseInt($(input_obj).css('padding-left'), 10) + 399 parseInt($(input_obj).css('padding-right'), 10) 400 ); 401 402 $results 403 .children('li') 404 .mouseover(function() { 405 406 //Firefoxã§ã¯ãåè£ä¸è¦§ã®ä¸ã«ãã¦ã¹ã«ã¼ã½ã«ãä¹ã£ã¦ãã㨠407 //ãã¾ãã¹ã¯ãã¼ã«ããªãããã®ããã®å¯¾çãã¤ãã³ã䏿ã 408 if (key_select) { 409 key_select = false;
410 return; 411 } 412 413 $results.children('li').removeClass(options.select_class); 414 $(this).addClass(options.select_class); 415 setSubInfo(this); //ãµãæ å ± 416 417 }) 418 .on('mousedown', function(e) { 419 reserve_click = true; 420 421 //æ¶å»äºç´ã¿ã¤ãã¼ã䏿¢ 422 clearTimeout(timer_show_hide); 423 //ev.stopPropagation(); 424 }) 425 .on('mouseup', function(e) { 426 reserve_click = false; 427 428 //Firefoxã§ã¯ãåè£ä¸è¦§ã®ä¸ã«ãã¦ã¹ã«ã¼ã½ã«ãä¹ã£ã¦ãã㨠429 //ãã¾ãã¹ã¯ãã¼ã«ããªãããã®ããã®å¯¾çãã¤ãã³ã䏿ã 430 if (key_select) { 431 key_select = false; 432 return; 433 } 434 e.preventDefault(); 435 e.stopPropagation(); 436 selectCurrentResult(false); 437 }); 438 } 439 440 //********************************************** 441 //ç¾å¨é¸æä¸ã®åè£ãåå¾ 442 //********************************************** 443 // @return object current_result ç¾å¨é¸æä¸ã®åè£ã®ãªãã¸ã§ã¯ã(<li>è¦ç´ ) 444 function getCurrentResult() { 445 446 if (!$results.is(':visible')) return false; 447 448 var $current_result = $results.children('li.' + options.select_class); 449 450 if (!$current_result.length) $current_result = false;
451 452 453 return $current_result; 454 } 455 //********************************************** 456 //ç¾å¨é¸æä¸ã®åè£ã«æ±ºå®ãã 457 //********************************************** 458 function selectCurrentResult(type) { 459 460 var $current_result = getCurrentResult(); 461 if ($current_result) { 462 463 // urlã®åå¾ 464 var texts = $current_result.text().split(":"); 465 466 // url 467 var url = texts[(texts.length-2)]+":"+texts[(texts.length-1)]; 468 469 // é·ç§» 470 location.href=url; 471 472 473 hideResult(); 474 475 //added 476 prev_value = $(input_obj).val(); 477 } 478 $(input_obj).trigger('focus'); //ããã¹ãããã¯ã¹ã«ãã©ã¼ã«ã¹ãç§»ã 479 //åè£é¸æãå¼ãéã«ãã¤ãã³ããçºç«ãã 480 if(options.bind_to) $(input_obj).trigger(options.bind_to, type); 481 } 482 //********************************************** 483 //鏿åè£ã次ã«ç§»ã 484 //********************************************** 485 function nextResult() { 486 var $current_result = getCurrentResult(); 487 488 if ($current_result) { 489 $current_result 490 .removeClass(options.select_class) 491 .next() 492 .addClass(options.select_class); 493 }else{ 494 $results.children('li:first-child').addClass(options.select_class); 495 } 496 //ããã¹ãããã¯ã¹ã®å¤ã夿´ 497 //åè£ãªã¹ãããããã¯ã¹ã¸æ»ããªããå ã ã®å¤ã表示 498 is_select = true; 499 if($current_result && $current_result.is('li:last-child')){ 500 $(input_obj).val(user_value); 501 if(options.sub_info !== false) $sub_info.hide(); 502 }else{ 503 var $selected = $results.children('.'+options.select_class); 504 var sel_val= $selected.text().replace(/\:http.+$/,""); 505 $(input_obj).val(sel_val); 506 setSubInfo($selected); //ãµãæ å ± 507 } 508 } 509 //********************************************** 510 //鏿åè£ãåã«ç§»ã 511 //********************************************** 512 function prevResult() { 513 var $current_result = getCurrentResult(); 514 515 if ($current_result) { 516 $current_result 517 .removeClass(options.select_class) 518 .prev() 519 .addClass(options.select_class); 520 }else{ 521 $results.children('li:last-child').addClass(options.select_class); 522 } 523 //ããã¹ãããã¯ã¹ã®å¤ã夿´ 524 //åè£ãªã¹ãããããã¯ã¹ã¸æ»ããªããå ã ã®å¤ã表示 525 is_select = true; 526 if($current_result && $current_result.is('li:first-child')){ 527 $(input_obj).val(user_value); 528 if(options.sub_info !== false) $sub_info.hide(); 529 }else{ 530 var $selected = $results.children('.'+options.select_class); 531 var sel_val= $selected.text().replace(/\:http.+$/,""); 532 $(input_obj).val(sel_val); 533 setSubInfo($selected); //ãµãæ å ± 534 } 535 } 536 //********************************************** 537 //åè£ã¨ãªã¢ãæ¶å» 538 //********************************************** 539 function hideResult() { 540 $results.hide(); 541 if(options.sub_info !== false) $sub_info.hide(); 542 543 //Ajaxéä¿¡ããã£ã³ã»ã« 544 abortAjax(); 545 } 546 547 //================================================================================ 548 // 09. ComboBoxç¨ã¡ã½ãã - ãµãæ å ±é¢é£ 549 //-------------------------------------------------------------------------------- 550 var $sub_info = $('<div class="sub_info"></div>').hide().appendTo('body'); 551 552 //********************************************** 553 //ãµãæ å ±ã®ä½ç½®è¨å® 554 //********************************************** 555 function setSubInfo(obj){ 556 if(options.sub_info === false) return; 557 var offset = $(obj).offset(); 558 $sub_info 559 .css({ 560 'top' : offset.top + 'px', 561 'left' : offset.left + $results.width() + 'px' 562 }); 563 var html = $(obj).attr('sub_info'); 564 //æçµçã«ããµãæ å ±ã空ãªã表示ããªã 565 if(html == ''){ 566 $sub_info.html(html).hide(); 567 }else{ 568 $sub_info.html(html).show(); 569 } 570 } 571 //********************************************** 572 //ãµãæ å ±ã®ã¤ãã³ããã³ãã© 573 //********************************************** 574 $sub_info.on('mousedown', function(ev) { 575 reserve_click = true; 576 577 //æ¶å»äºç´ã¿ã¤ãã¼ã䏿¢ 578 clearTimeout(timer_show_hide); 579 ev.stopPropagation(); 580 }); 581 $sub_info.on('mouseup', function(ev) { 582 reserve_click = false;
583 584 //æ¶å»äºç´ã¿ã¤ãã¼ã䏿¢ 585 clearTimeout(timer_show_hide); 586 ev.stopPropagation(); 587 }); 588 589 }; 590 591 //================================================================================ 592 // 06. å¦çã®å§ã¾ã 593 //-------------------------------------------------------------------------------- 594 $.fn.ajaxSuggest = function(source, options) { 595 if (!source) return; 596 597 //************************************************************ 598 //ãªãã·ã§ã³ 599 //************************************************************ 600 options = $.extend({ 601 //åºæ¬è¨å® 602 source : source, 603 database : 0, //æ¥ç¶ããDBã®è¨å®(é åã®çªå·) 604 and_or : 'AND', //ANDæ¤ç´¢ããORæ¤ç´¢ã? 605 limit : 10, //åè£ãªã¹ãã¨ãã¦è¡¨ç¤ºããæå¤§ä»¶æ° 606 order_by : 'ASC', //ORDER BY(SQL) ã§ãä¸¦ãæ¿ããã®ã¯æé ãéé ã 607 bind_to : false, //åè£ã鏿ãããã¨ãã«çºç«ããã¤ãã³ãå 608 sub_info : false, //ãµãæ å ±ã表示ããã?ã©ã®ãã£ã¼ã«ãã? 609 results_class : 'as_results', //åè£ä¸è¦§ãå²ã<ul> 610 select_class : 'as_over' //鏿ä¸ã®<li> 611 }, options); 612 this.each(function() { 613 new $.ajaxSuggest(this, source, options); 614 }); 615 return this; 616 }; 617})(jQuery); 618 619/* Ticket #7126 Sticky Header Banner start */ 620$(document).ready(function() { 621 ReadCookie("alan1Banner"); 622 ReadCookie("floated_bottom_campaign_banner"); 623 var alan1BannerValue; 624 var floated_bottom_campaign_banner; 625 ValidateCookieExist(); 626 627 function ReadCookie(cookieName) { 628 var allcookies = document.cookie; 629 cookiearray = allcookies.split(';'); 630 for(var i=0; i<cookiearray.length; i++){ 631 var cookie0 = cookiearray[i].split('=')[0]; 632 var cookie1 = cookiearray[i].split('=')[1]; 633 name = cookie0.trim(); //use trim function to trim out white space 634 value = cookie1.trim(); 635 if(name == "alan1Banner") { 636 alan1BannerValue = value; 637 } else if(name == "floated_bottom_campaign_banner") { 638 floated_bottom_campaign_banner = value; 639 } 640 } 641 } 642 643 function WriteCookie(cookieName, expire_month) { 644 var expireDate = new Date(); 645 expireDate.setMonth(expireDate.getMonth() + parseInt(expire_month)); 646 var cookievalue= "closed;"; 647 document.cookie=cookieName+"=" + cookievalue + ';expires=' + expireDate.toUTCString() + ';path=/'; 648 } 649 650 function WriteSessionCookie(cookieName) { 651 var cookievalue= "closed;"; 652 document.cookie=cookieName+"=" + cookievalue + ';expires=;path=/'; 653 } 654 655 function ValidateCookieExist() { 656 if (alan1BannerValue == "closed") { 657 //If user has close the banner before, then never shows it anymore 658 $('.sticky_header_banner').remove(); 659 } 660 661 //Show it. If floated campaign banner don't have cookie yet. 662 if (floated_bottom_campaign_banner != "closed" && $('#floated_bottom_campaign_banner').length > 0) { 663 $('#floated_bottom_campaign_banner').show(); 664 $('#Footer').addClass('showing_bottom_floated_banner'); 665 } 666 } 667 668 //if sticky banner exist 669 if ($('.sticky_header_banner').length > 0) { 670 $(".sticky_header_banner a.close_banner" ).on("click", function(e) { 671 e.preventDefault(); 672 $('.sticky_header_banner').remove(); 673 WriteCookie("alan1Banner", 3); 674 }); 675 } 676 677 if ($('.mail_alert_wrapper').length > 0) { 678 $(".mail_alert_wrapper a.close_banner_en" ).on("click", function(e) { 679 e.preventDefault(); 680 $('.mail_alert_wrapper').remove(); 681 WriteCookie("email_restriction_message", 1); 682 }); 683 $(".mail_alert_wrapper a.close_banner_jp" ).on("click", function(e) { 684 e.preventDefault(); 685 $('.mail_alert_wrapper').remove(); 686 WriteCookie("email_restriction_message", 1); 687 }); 688 } 689 690 //if floated campaign banner exist 691 if ($('#floated_bottom_campaign_banner').length > 0) { 692 $("#floated_bottom_campaign_banner_close" ).on("click", function(e) { 693 e.preventDefault(); 694 $('#floated_bottom_campaign_banner').remove(); 695 $('#Footer').removeClass('showing_bottom_floated_banner'); 696 WriteCookie("floated_bottom_campaign_banner"); 697 }); 698 } 699}) 700/* Ticket #7126 Sticky Header Banner end */ 701 702 703// ä¼å¡ç»é²ï¼ééä¿¡é²æ¢ 704var up_cnt = 0; 705function update_account(b) 706{ 707 up_cnt++; 708 if(up_cnt > 1) 709 { 710 return false;
711 } 712 return true; 713} 714 715// #7831 start 716// Special Deals' browse by category filter 717$(document).ready(function() { 718 if($('.filter_wrapper').length > 0){ 719 $('.filter_wrapper .category_list_link_btn').on("click", function(e) { 720 e.preventDefault(); 721 e.stopPropagation(); // make it ignore $(document).click, when clicking on the 'browse by category' dropdown itself 722 if($('.filter_wrapper #CategoryList').is(':visible')) { 723 $('.filter_wrapper #CategoryList').hide(); 724 } else { 725 $('.filter_wrapper #CategoryList').show(); 726 } 727 }); 728 729 // hide when user click on the dropdown list 730 $('.filter_wrapper #CategoryList a').on("click", function() { 731 $('.filter_wrapper #CategoryList').hide(); 732 }); 733 734 // hide when user click outside the dropdown list 735 $(document).on("click", function(){ 736 if($('.filter_wrapper #CategoryList').is(':visible')) { 737 $('.filter_wrapper #CategoryList').hide(); 738 }; 739 }); 740 } 741}); 742// #7831 end 743 744 745// #8109 start 746// trim down the description for theme_child_disp in category page 747$(function(){ 748 if($('.cat_info_img_wrapper').length > 0) { 749 if($('.area_promotions_item_list').length > 0) { 750 var $setElm = $('ul.area_promotions_item_list .item_name'); 751 var cutFigure = '33'; // ã«ããããæåæ° 752 var afterTxt = ' â¦'; // æåã«ããå¾ã«è¡¨ç¤ºããããã¹ã 753 754 if(LANG_CODE == 'en'){ // #8267, en page has different length 755 cutFigure = '160'; 756 } 757 758 $setElm.each(function(){ 759 var textLength = $(this).text().length; 760 var textTrim = $(this).text().substr(0,(cutFigure)) 761 762 if(cutFigure < textLength) { 763 $(this).html(textTrim + afterTxt).css({visibility:'visible'}); 764 } else if(cutFigure >= textLength) { 765 $(this).css({visibility:'visible'}); 766 } 767 }); 768 } 769 } 770}); 771// #8109 end 772 773 774/****************** 775#8252 776Renewal Design for EN, CN & TW Page Start 777******************/ 778$(document).ready(function() { 779 if(LANG_CODE != 'jp') { 780 if($('#EnRenewal').length > 0 && $('.en_home').length == 0 && $('#crowdriff').length == 0) { 781 var $contents_wrapper; 782 783 if($('#contents_wrapper').length > 0){ 784 $contents_wrapper = $('#contents_wrapper'); 785 } 786 else if($('#contents_wrapper_border').length > 0){ 787 $contents_wrapper = $('#contents_wrapper_border'); 788 } 789 790 $total_document_height = $('#HeaderWrapper').height() + $contents_wrapper.height() + $('#Footer').height(); 791 $contents_wrapper_padding = (($(document).height() - $total_document_height)) + 'px'; 792 if($("#CONTENTS_ID").hasClass("cdPasswordReminder")){ 793 return false; 794 } 795 $contents_wrapper.css('padding-bottom', $contents_wrapper_padding); 796 } 797 } 798}); 799/****************** 800#8252 END 801******************/ 802 803 804/****************** 805#8705 806Lazy load image for PC - EN & JP 807******************/ 808 809/****************** 810#58453 811combine lazyload from review.js and category.js 812check whether if class lazy or lazy_reviews_photo is found 813added new spinner, replaced gif. 814******************/ 815$(document).ready(function() { 816 var img_lazy_load = $("img.lazy"); 817 if(img_lazy_load.length > 0){ 818 var _img = []; 819 820 for ( var ri = 0; ri < img_lazy_load.length; ri++ ) { 821 _img.push(img_lazy_load[ri]); 822 } 823 824 for (var i = 0; i < _img.length; i++) { 825 $(_img[i]).lazyload({ 826 load : function(elements_left, settings){ 827 $(this).siblings(".loader-background").remove(); 828 }, 829 effect : "fadeIn", 830 skip_invisible : false, 831 threshold: 600, 832 }).parent().addClass('load_spinner_style').prepend('<div class="loader-background">\ 833 <div class="loader">\ 834 <div></div>\ 835 <div></div>\ 836 <div></div>\ 837 <div></div>\ 838 </div>\ 839 </div>'); 840 } 841 } 842 843 // lazy load for ac review page 844 var ac_review_lazy_image = $(".lazy_reviews_photo"); 845 if(ac_review_lazy_image.length > 0){ 846 var _img = []; 847 848 for ( var ri = 0; ri < ac_review_lazy_image.length; ri++ ) { 849 _img.push(ac_review_lazy_image[ri]); 850 } 851 852 for (var i = 0; i < _img.length; i++) { 853 $(_img[i]).lazyload({ 854 load : function(elements_left, settings){ 855 $(this).siblings(".loader-background").remove(); 856 }, 857 effect : "fadeIn", 858 skip_invisible : true, 859 }).parent().addClass('load_spinner_style').prepend('<div class="loader-background">\ 860 <div class="loader">\ 861 <div></div>\ 862 <div></div>\ 863 <div></div>\ 864 <div></div>\ 865 </div>\ 866 </div>'); 867 } 868 } 869 870 // lazy load for 5 star review page 871 var review_lazy_image = $(".review-lazy-img"); 872 if( review_lazy_image.length > 0 ){ 873 var _img = []; 874 875 for ( var ri = 0; ri < review_lazy_image.length; ri++ ) { 876 _img.push(review_lazy_image[ri]); 877 } 878 879 for (var i = 0; i < _img.length; i++) { 880 $(_img[i]).lazyload({ 881 load : function(elements_left, settings){ 882 $(this).siblings(".loader-background").remove(); 883 }, 884 effect : "fadeIn", 885 skip_invisible : true 886 }).parent().addClass('load_spinner_style').prepend('<div class="loader-background">\ 887 <div class="loader">\ 888 <div></div>\ 889 <div></div>\ 890 <div></div>\ 891 <div></div>\ 892 </div>\ 893 </div>'); 894 } 895 896 $(".slider10 .review_images_left a.buttons, .slider10 .review_images_right a.buttons").on("click", function(e){ 897 var currentPosition = $(window).scrollTop(); 898 $(window).scrollTop(currentPosition + 10).scrollTop(currentPosition); 899 }); 900 } 901 902 // Global Top Page only. header's Lazy Load country flag 903 var loadCurrencyIcon = true; 904 905 $('#facelift_en_2016 .currency_switcher').on("mouseenter", function(){ 906 if ( loadCurrencyIcon ) { 907 if ( $('.currency_switcher .dropdown_currency').length > 0 ) { 908 var allCurrency = $('.currency_switcher .dropdown_currency').children('li'); 909 for (var i = 0; i < allCurrency.length; i++) { 910 var currency_img = $(allCurrency[i]).find('.currency_change_js').children('.currency-icon').find('img'); 911 var currency_icon = currency_img.attr('data-original'); 912 currency_img.attr('src', currency_icon); 913 } 914 } 915 loadCurrencyIcon = false;
916 } 917 }).on("mouseleave", function(){ 918 loadCurrencyIcon = true; 919 }); 920}); 921/****************** 922#8705 END 923******************/ 924 925 926/****************** 927#8254 928Renewal Area Top EN, CN & TW Page Start 929******************/ 930$(document).ready(function() { 931 if(LANG_CODE != 'jp') { 932 if($('#EnRenewal').length > 0) { 933 934 /******* Area Top Renewal Page ******/ 935 var $max_responsive_width = 1220; 936 937 // optimized_design popular categories tour 938 $popular_cat_slider = $('.popular_cat_slider').length; 939 $campaign_slider = $('.campaign_slider').length; 940 941 if($popular_cat_slider > 0) { 942 var pop_carousel = $('.popular_cat_slider').show().bxSlider({ 943 useCSS: false, // disable use of CSS animation, to prevent IE10 - 11 error 944 oneToOneTouch: false, // mobile / tablet need this 945 slideWidth: 294, 946 infiniteLoop: false, 947 hideControlOnEnd: true, 948 pager: false, 949 adaptiveHeight : true, 950 minSlides: 2, 951 maxSlides: 4, 952 moveSlides: 0, 953 slideMargin: 10, 954 /*onSliderLoad: function(){ 955 $(".popular_cat_slider").css("visibility", "visible"); // prevent broken layout on slow machine. Hide everything 1st, then only visible slider when slider is fully loaded 956 }*/ 957 }); 958 959 // reload the slider to avoid responsive issue 960 $(window).on('resize', function() { 961 pop_carousel.reloadSlider(); 962 }); 963 } 964 965 if($campaign_slider > 0) { 966 var camp_carousel = $('.campaign_slider').bxSlider({ 967 useCSS: false, // disable use of CSS animation, to prevent IE10 - 11 error 968 oneToOneTouch: false, // mobile / tablet need this 969 slideWidth: 170, 970 infiniteLoop: false, 971 hideControlOnEnd: true, 972 pager: false, 973 adaptiveHeight : true, 974 minSlides: 4, 975 maxSlides: 6, 976 moveSlides: 4, 977 slideMargin: 5 978 }); 979 980 // reload the slider to avoid responsive issue 981 $(window).on('resize', function() { 982 camp_carousel.reloadSlider(); 983 }); 984 } 985 986 987 //make equals height to every div in 5 star reviews section 988 //set the starting bigestHeight variable 989 if($('#FiveStar .w_294 .info').length > 0){ 990 var biggestHeight = 0; 991 //check each of them 992 $('#FiveStar .w_294 .info').each(function(){ 993 //if the height of the current element is 994 //bigger then the current biggestHeight value 995 if($(this).height() > biggestHeight){ 996 //update the biggestHeight with the 997 //height of the current elements 998 biggestHeight = $(this).height(); 999 } 1000 }); 1001 //when checking for biggestHeight is done set that 1002 //height to all the elements 1003 $('#FiveStar .w_294 .info').height(biggestHeight); 1004 } 1005 1006 if($('#FiveStar .w_294').length > 0){ 1007 var fivestar_ac_block = 0; 1008 $('#FiveStar .w_294').each(function(){ 1009 fivestar_ac_block++; 1010 }); 1011 } 1012 1013 1014 //Override for the new design page that has common element / class name as old design 1015 if($('.page_content').length > 0){ 1016 if($('.container.crumbarea').length == 0) { 1017 if($('.tree').length > 0) { 1018 $('.tree').wrap('<div class="container crumbarea">'); // wrap .tree with breadcrumb container 1019 } 1020 } 1021 } 1022 1023 1024 /******* HUB Page ********/ 1025 $is_HUB_page = false; // var to detect is HUB area top page 1026 1027 if($('#HUB').length > 0) { 1028 $is_HUB_page = true; 1029 } 1030 1031 //when init load in smaller screen 1032 if($(window).width() < $max_responsive_width) { 1033 if($is_HUB_page != true) { 1034 if(fivestar_ac_block == 4) { 1035 $('#FiveStar .w_294:last-child').hide(); 1036 } 1037 } 1038 } 1039 1040 //when resize down 1041 $(window).on('resize', function() { 1042 if($is_HUB_page != true) { 1043 if(fivestar_ac_block == 4) { 1044 if($(window).width() < $max_responsive_width) { 1045 $('#FiveStar .w_294:last-child').hide(); 1046 } else { 1047 $('#FiveStar .w_294:last-child').show(); 1048 } 1049 } 1050 } 1051 }); 1052 1053 // HUB Area Top page custom script 1054 if($is_HUB_page == true) { 1055 if($('#PromoTheme').length > 0) { 1056 $banner_count = 0; 1057 $('#PromoTheme ul.banner_list li').each(function() { 1058 $banner_count++; 1059 if($banner_count == 4) { 1060 $banner_count = 0; 1061 $(this).addClass('last'); 1062 } 1063 }); 1064 } 1065 } // end $is_HUB_page == true 1066 1067 1068 // Fix HA map issue in 3 columns layout 1069 if($('.main_right').length > 0 && $('.ha_map_wrapper').length > 0) { 1070 $('.ha_map_wrapper img').css("background", "url(/_tr/vt/2/img/v2/ha_map_seawave_bg.jpg) repeat left 0 #aadbec"); 1071 1072 $('.ha_map_wrapper, .ha_map_wrapper img').css({ 1073 height: "207px", 1074 width: "238px" 1075 }); 1076 1077 var ratio = 0.768; 1078 var valueArray = []; 1079 var groupArray = []; 1080 1081 $('.ha_map_wrapper #Map area').each(function(index) { 1082 var attr = $(this).attr('coords'); 1083 valueArray[index] = attr.split(','); 1084 }); 1085 1086 for(j=0;j<valueArray.length;j++){ 1087 var newChildValue = new Array(); 1088 for(i=0;i<4;i++){ 1089 newChildValue.push(Math.floor(valueArray[j][i]*ratio)); 1090 } 1091 1092 groupArray.push(newChildValue); 1093 } 1094 1095 $('.ha_map_wrapper #Map area').each(function(index) { 1096 $(this).attr('coords', groupArray[index]); 1097 }); 1098 } 1099 // end fix HA map issue 1100 1101 } // END if($('#EnRenewal').length > 0) 1102 } 1103}); 1104/****************** 1105#8254 END 1106******************/ 1107 1108 1109/****************** 1110#8121 start 1111******************/ 1112$(document).ready(function() { 1113 if($('#faq_category_api_data_field').length > 0) { 1114 $('.faq_category_api_content').hide(); 1115 1116 $('.faq_category_api_title').on('mouseenter', function(){ 1117 $(this).css('cursor','pointer'); 1118 }); 1119 1120 $('.faq_category_api_title').on('click touchstart', function() { 1121 $(this).toggleClass('nowOpen'); 1122 $(this).next('.faq_category_api_content').slideToggle(500); 1123 }); 1124 } 1125}); 1126/****************** 1127#8121 END 1128******************/ 1129 1130/****************** 1131#8344 start 1132******************/ 1133$(document).ready(function() { 1134 if($('#hotel_hub').length > 0) { 1135 var biggestHeight = 0; 1136 $('.featured_wrapper .block_content_txt').each(function(){ 1137 if($(this).height() > biggestHeight){ 1138 biggestHeight = $(this).height(); 1139 } 1140 }); 1141 $('.featured_wrapper .block_content_txt').height(biggestHeight); 1142 } 1143}); 1144/****************** 1145#8344 END 1146******************/ 1147 1148 1149/****************** 1150#9262 start 1151******************/ 1152$(document).ready(function() { 1153 if(LANG_CODE == 'jp'){ 1154 var premium_keyword = "ããã¬ãã¢ã "; 1155 $('ol.activity .activity_item').each(function(index){ 1156 var current_ac_item = $(this); 1157 var find_keyword = $(this).find('.activity_item_title').text(); 1158 var keyword_search_result = find_keyword.indexOf(premium_keyword); 1159 if(keyword_search_result != -1){ 1160 current_ac_item.find('.sale_item').addClass('premium'); 1161 } 1162 }); 1163 } 1164}); 1165/****************** 1166#9262 END 1167******************/ 1168 1169/****************** 1170#8159 start 1171******************/ 1172$(document).ready(function() { 1173 if($('#comparision_table_content').length > 0) { 1174 // Record the initial loaded viewport & table width 1175 var tableViewport_initial_val = $('.table_wrapper').width(); 1176 var comparisonTable_initial_val = $('#comparisonTable').width(); 1177 1178 var scrollRightEnd = false;
1179 var scrollLeftEnd = true; 1180 var cur_pos = 0; 1181 1182 var comparisonTable_height = $('#comparisonTable').height(); 1183 1184 $('#comparision_table_content .scroller_left').height(comparisonTable_height); 1185 $('#comparision_table_content .scroller_right').height(comparisonTable_height); 1186 1187 // If comparison table is smaller than viewport, then disabled left right button. 1188 check_enabled_left_right_init = function(table_width, viewport_width) { 1189 if(table_width <= viewport_width) { 1190 $('#comparision_table_content .scroller_left').removeClass('active'); 1191 $('#comparision_table_content .scroller_right').removeClass('active'); 1192 scrollLeftEnd = true; 1193 scrollRightEnd = true; 1194 } else { 1195 $('#comparision_table_content .scroller_right').addClass('active'); 1196 scrollRightEnd = false; 1197 1198 $('#comparision_table_content .scroller_left').on("click", function(){ 1199 scrollTable('scroll_left'); 1200 }); 1201 1202 $('#comparision_table_content .scroller_right').on("click", function(){ 1203 scrollTable('scroll_right'); 1204 }); 1205 } 1206 } 1207 check_enabled_left_right_init(comparisonTable_initial_val, tableViewport_initial_val); 1208 1209 // Make the left right arrow button image align vertically center as user scroll 1210 $('#comparision_table_content .scroller_left span').css('top',($(window).scrollTop()+($(window).height()/2))); 1211 $('#comparision_table_content .scroller_right span').css('top',($(window).scrollTop()+($(window).height()/2))); 1212 $(window).on('scroll', function() { 1213 var tableViewport = $('.table_wrapper').height()-100; // deduct 100 to prevent the image clash to the bottom of the button's bg color 1214 var newPos = $(window).scrollTop()+($(window).height()/2); 1215 if(newPos >= tableViewport) { 1216 newPos = tableViewport; 1217 } 1218 $('#comparision_table_content .scroller_left span').css('top',newPos); 1219 $('#comparision_table_content .scroller_right span').css('top',newPos); 1220 }); 1221 1222 $(window).on('resize', function() { 1223 scrollTable('scroll_left'); 1224 // check do we need to enable the left right button after window resize. 1225 var tableViewport = $('.table_wrapper').width(); 1226 var comparisonTable = $('#comparisonTable').width(); 1227 check_enabled_left_right_init(comparisonTable, tableViewport); 1228 }); 1229 1230 1231 1232 function scrollTable(direction) { 1233 var dir = direction; 1234 var tableViewport = $('.table_wrapper').width(); 1235 var comparisonTable = $('#comparisonTable').width(); 1236 1237 var movePx = tableViewport; 1238 1239 cur_pos = parseInt($('#comparisonTable').css('margin-left')); 1240 1241 if(dir == 'scroll_right' && !scrollRightEnd){ 1242 //left button enabled 1243 scrollLeftEnd = false; 1244 if (cur_pos == 0){ 1245 //default location 1246 movePx = (tableViewport-50) * 1; //-50 is avoid user unable to view the cut off viewport data 1247 if ((movePx+tableViewport) > comparisonTable){ 1248 movePx = parseInt(comparisonTable)-tableViewport; 1249 scrollRightEnd = true; 1250 $('#comparision_table_content .scroller_right').removeClass('active'); 1251 } 1252 }else{ 1253 movePx = Math.abs(cur_pos) + tableViewport; 1254 if ((movePx+tableViewport) == comparisonTable){ 1255 scrollRightEnd = true; 1256 $('#comparision_table_content .scroller_right').removeClass('active'); 1257 } 1258 if ((movePx+tableViewport) > comparisonTable){ 1259 movePx = (parseInt(comparisonTable)-Math.abs(cur_pos))-50; //-50 is avoid white blank space occur when reach the right end 1260 scrollRightEnd = true; 1261 $('#comparision_table_content .scroller_right').removeClass('active'); 1262 } 1263 } 1264 $('#comparisonTable').css('margin-left', movePx*-1); 1265 $('#comparision_table_content .scroller_left').addClass('active'); 1266 } 1267 1268 if(dir == 'scroll_left' && !scrollLeftEnd){ 1269 scrollRightEnd = false;
1270 $('#comparision_table_content .scroller_right').addClass('active'); 1271 if (Math.abs(cur_pos) > tableViewport){ 1272 movePx = cur_pos+tableViewport; 1273 }else{ 1274 movePx = 0; 1275 scrollLeftEnd = true; 1276 $('#comparision_table_content .scroller_left').removeClass('active'); 1277 } 1278 $('#comparisonTable').css('margin-left', movePx); 1279 } 1280 1281 } 1282 } 1283}); 1284/****************** 1285#8159 END 1286******************/ 1287 1288 //#8378 Start Persistent Placeholders 1289 var parentSelector = '.input-wrapper', 1290 inputSelectors = [parentSelector + '>input.text', parentSelector + '>textarea'], 1291 len = inputSelectors.length, 1292 i; 1293 1294 function update(force) { 1295 var $input = $(this), 1296 $parent = $input.parent(parentSelector); 1297 return $parent[force === true || $input.val() ? 'addClass' : 'removeClass']('filled'); 1298 } 1299 1300 function focus() { 1301 update.call(this).addClass('focus'); 1302 } 1303 1304 function blur() { 1305 update.call(this).removeClass('focus'); 1306 } 1307 1308 function keydown(evt) { 1309 var c = evt.keyCode; 1310 ((47 < c && c < 91) || (95 < c && c < 112) || (185 < c && c < 223)) && update.call(this, true); 1311 } 1312 1313 $.fn.prepareInput = function() { 1314 return this.each(update); 1315 }; 1316 1317 $(function() { 1318 for (i = 0; i < len; i++) { 1319 $(inputSelectors[i]).on('focus', focus).on('blur', blur).on('keyup', update).on('click', update).on('keydown', keydown); 1320 $(inputSelectors[i]).prepareInput(); 1321 } 1322 }); 1323//#8378 END Persistent Placeholders 1324 1325 1326 1327$(document).ready(function(){ 1328 if($('#en_japan_area_top_sidebar').length > 0) { 1329 $('.other_destinations_title').on("click", function(e){ 1330 $(this).parents('.other_destinations').addClass('hover'); 1331 e.preventDefault(); 1332 $('.other_destinations_dropdown').show(); 1333 }); 1334 1335 $('.menu-close').on("click", function(){ 1336 $('.other_destinations_dropdown').hide(); 1337 $('.other_destinations').removeClass('hover'); 1338 }); 1339 1340 $(document).on('mouseup', function(e){ 1341 var container = $('.other_destinations_dropdown'); 1342 if (!container.is(e.target) // if the target of the click isn't the container... 1343 && container.has(e.target).length === 0) // ... nor a descendant of the container 1344 { 1345 container.hide(); 1346 $('.other_destinations').removeClass('hover'); 1347 } 1348 }); 1349 } 1350 1351 1352 // CN & TW area sidebar navigation 1353 if($('#cntw_japan_area_top_sidebar').length > 0) { 1354 $('.other_destinations_title').on("click", function(e){ 1355 $(this).parents('.other_destinations').addClass('hover'); 1356 e.preventDefault(); 1357 $('.other_destinations_dropdown').show(); 1358 }); 1359 1360 $('.menu-close').on("click", function(){ 1361 $('.other_destinations_dropdown').hide(); 1362 $('.other_destinations').removeClass('hover'); 1363 }); 1364 1365 $(document).on('mouseup', function(e){ 1366 var container = $('.other_destinations_dropdown'); 1367 if (!container.is(e.target) // if the target of the click isn't the container... 1368 && container.has(e.target).length === 0) // ... nor a descendant of the container 1369 { 1370 container.hide(); 1371 $('.other_destinations').removeClass('hover'); 1372 } 1373 }); 1374 } 1375}); 1376 1377 1378/****************** 1379#9904 start 1380******************/ 1381$(document).ready(function() { 1382 if($('.keyword_sort_filter .view_more').length > 0){ 1383 $('.keyword_sort_filter .view_more').on("click", function(e){ 1384 e.preventDefault(); 1385 $(this).hide().siblings('.hide_this').css('display','inline'); 1386 $(this).parents('.sub_group_filter').addClass('add_separator'); 1387 }); 1388 $('.keyword_sort_filter .view_less').on("click", function(e){ 1389 e.preventDefault(); 1390 $(this).hide().siblings('.hide_this').hide(); 1391 $(this).siblings('.view_more').css('display','inline'); 1392 $(this).parents('.sub_group_filter').removeClass('add_separator'); 1393 }); 1394 } 1395}); 1396/****************** 1397#9904 END 1398******************/ 1399 1400/****************** 1401#10369 START 1402******************/ 1403$(document).ready(function() { 1404 $('.activity_item').on("click", function(e){ 1405 var ac_url = $(this).find('.activity_item_title').children('a').attr('href'); 1406 // support ctrl key(window) & command key (mac) open new tab 1407 if(e.metaKey || e.ctrlKey){ 1408 e.stopPropagation(); 1409 window.open(ac_url); 1410 } else { 1411 window.location.href = ac_url; 1412 } 1413 }); 1414 1415 // Prevent the click on the A href will trigger the $('.activity_item').click() function. 1416 $('.activity_item a').on("click", function(e){ 1417 e.stopPropagation(); 1418 }); 1419}); 1420/****************** 1421#10369 END 1422******************/ 1423 1424/****************** 1425Function for VELTRA Modal START 1426******************/ 1427$(window).on('resize', function(){ 1428 // Align modal vertically center for PC 1429 if($('.vt_modal').is(':visible')){ 1430 resizeVtPcModal($('.vt_modal:visible')); 1431 } 1432}); 1433 1434$(document).ready(function(){ 1435 $(".vt_close_modal, .vt_modal .bg_overlay").on("click", function(e){
1436 // prevent modal being closed when click anywhere within the modal 1437 if (e.target !== this){ return; } 1438 1439 vtModalBodyLock(false); 1440 $('.vt_modal:visible').find('.bg_overlay').fadeOut(); 1441 $('.vt_modal:visible').fadeOut(); 1442 }); 1443}); 1444 1445function resizeVtPcModal(modal) { 1446 // reset modal's parameter 1447 modal.find('.vt_modal_content').css('height', ''); 1448 modal.find('.vt_modal_content').css('marginTop', ''); 1449 modal.find('.vt_modal_content').css('marginBottom', ''); 1450 modal.find('.vt_modal_body').css('height', ''); 1451 1452 // the maximum height for the modal after minus minimum 64px margin top and bottom 1453 var new_height = parseInt($(window).height() - 128); 1454 1455 if(new_height < modal.find('.vt_modal_body').outerHeight(true)){ 1456 // if content is longer than viewport 1457 //modal.find('.modal_content').css('height', new_height); 1458 modal.find('.vt_modal_content').css('marginTop', '64px'); 1459 } else { 1460 // if review content is shorter than viewport, align modal vertically center 1461 var modal_margin_top = ($(window).height() - modal.find('.vt_modal_content').outerHeight()) / 2; 1462 modal.find('.vt_modal_content').css('marginTop', modal_margin_top+'px'); 1463 modal.find('.vt_modal_content').css('marginBottom', modal_margin_top+'px'); 1464 } 1465 1466 calcVtModalOverlay(modal); 1467} 1468 1469// For PC only, calculate the height for modal's background overlay 1470function calcVtModalOverlay(modal) { 1471 var set_height_for_bg_overlay = modal.find('.vt_modal_content').outerHeight(true); 1472 modal.find('.bg_overlay').height(set_height_for_bg_overlay); 1473} 1474 1475//When modal is opened, add a freeze body for browser and remember last scroll so that it wont scroll to top. 1476function vtModalBodyLock(status){ 1477 if(status == true){ 1478 last_scroll_position = $(window).scrollTop(); 1479 $('html, body').delay(200).queue(function(next){ 1480 $(this).addClass('vt_modal_freeze_body_scroll'); 1481 $(this).css('top', '-' + last_scroll_position + 'px'); 1482 next(); 1483 }); 1484 }else{ 1485 $('html, body').removeClass('vt_modal_freeze_body_scroll'); 1486 $('html, body').animate({ scrollTop: last_scroll_position}, 0); 1487 } 1488} 1489/****************** 1490Function for VELTRA Modal END 1491******************/ 1492 1493/****************** 1494#11340 START 1495******************/ 1496// Auto enable "Stay Logged In" checkbox for PC login page. 1497$(document).ready(function(){ 1498 if($('#TrUserBasicAutoLoginFlg').length > 0) { 1499 $('#TrUserBasicAutoLoginFlg').attr('checked', true); 1500 } 1501}); 1502/****************** 1503#11340 END 1504******************/ 1505 1506//en winter sale banner function 14885 1507$(document).ready(function(){ 1508 if ($('#en_floating_winter_banner').length > 0) { 1509 $('#en_floating_winter_banner').show(); 1510 $('#Footer').addClass('showing_en_floating_winter_banner'); 1511 1512 $('#en_floating_winter_banner_close').on("click", function(){ 1513 $('#en_floating_winter_banner').hide(); 1514 $('#Footer').removeClass('showing_en_floating_winter_banner'); 1515 }); 1516 } 1517}); 1518 1519 1520/****************** 1521v2018 Category Page's Top Seller Slider START 1522******************/ 1523$(document).ready(function(){ 1524 if($('#category_top_seller_v2018 .slider').length > 0){ 1525 var category_top_seller_slider = $('#category_top_seller_v2018 .slider').bxSlider({ 1526 useCSS: false, // disable use of CSS animation, to prevent IE10 - 11 error 1527 oneToOneTouch: false, // mobile / tablet need this 1528 slideWidth: 178, 1529 infiniteLoop: false, 1530 hideControlOnEnd: true, 1531 pager: false, 1532 adaptiveHeight : false, 1533 minSlides: 5, 1534 maxSlides: 5, 1535 moveSlides: 5, 1536 slideMargin: 10, 1537 preloadImages: 'visible', 1538 onSlideBefore: function(){ 1539 category_top_seller_slider.find('img.lazy').trigger('appear'); 1540 } 1541 }); 1542 1543 // reload the slider to avoid responsive issue 1544 $(window).on('resize', function() { 1545 category_top_seller_slider.redrawSlider(); 1546 }); 1547 } 1548}); 1549/****************** 1550v2018 Category Page's Top Seller Slider END 1551******************/ 1552 1553/****************** 1554#64232 Fix clickable area for Area Top's Recommendation Page START 1555*******************/ 1556$(document).ready(function(){ 1557 if($('#recommender_pc211').length){ 1558 $('.dv_rc_items').on('click',function(e){ 1559 var ac_url = $(this).find('a').attr('href'); 1560 if(e.metaKey || e.ctrlKey){ 1561 e.stopPropagation(); 1562 window.open(ac_url); 1563 }else { 1564 window.location.href = ac_url; 1565 } 1566 }); 1567 1568 $('.dv_rc_items a').on('click',function(e){ 1569 e.stopPropagation(); 1570 }); 1571 } 1572}); 1573/****************** 1574#64232 Fix clickable area for Area Top's Recommendation Page END 1575*******************/ 1576 1577/****************** 1578CS22-408 Overseas Travel Safety Information START 1579*******************/ 1580$(document).ready(function(){ 1581 if($('#btn-kite-travel-safety-modal[data-toggle="modal"]').length > 0){ 1582 $('#btn-kite-travel-safety-modal[data-toggle="modal"]').vmodal(); 1583 } 1584}); 1585/****************** 1586CS22-408 Overseas Travel Safety Information END 1587*******************/
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.