document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); document.write(' '); $(function () { var Host = "www.yp.com.hk"; var Protocol = "http:"; var funcHideDownloadAppFunc = function () { $('#downloadAppSection').slideUp("show", function () { }); var d = new Date(); d.setTime(d.getTime() + (30 * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toUTCString(); document.cookie = "downloadApp" + "=" + "here" + ";" + expires + ";path=/"; }; $('.mainLogo').on('click',function(){ if(url.match(/\/ch\//)!= null){ window.location = "/home/zh"; } else if(url.match(/\/en\//)!= null){ window.location = "/home/en"; } else if(url.match(/\/sc\//)!= null){ window.location = "/home/sc"; } }); $('#downloadAppCloseBtnLeft').on('click', funcHideDownloadAppFunc); $('#downloadAppCloseBtnRight').on('click', funcHideDownloadAppFunc); $("#btnSearch").on('click', function () { var keyword = $("input[name=what]").val().trim(); var hostname = Host==""?window.location.hostname:Host; var protocol = Protocol==""? window.location.protocol: Protocol; //var district = $("input[name=where]").val().trim(); var doamin = protocol + "//" + hostname + (window.location.port ? ':' + window.location.port : ''); var url = ""; if (keyword) { url = doamin + "/Keyword/s-" + encodeURIComponent(keyword) + "/p1/zh"; GoogleAnalytic_SearchBox(keyword); //alert(url); location.href = url; } else { alert('請輸入關鍵字'); return false; } }); $("input[name=what]").keyup(function (e) { if (e.keyCode === 13) { $("#btnSearch").click(); } }); $("#what").autocomplete({ source: function (request, response) { $.ajax({ url: "/Keyword/Suggest", type: "POST", dataType: "json", data: { Prefix: request.term }, success: function (data) { response($.map(data, function (item) { return { label: item.Keyword, value: item.Keyword }; })) } }) }, messages: { noResults: "", results: "" } }); var url = location.href; if(url.match(/\/ch\//)!= null){ $(".divLangCH").addClass("aSelected"); } else if(url.match(/\/en\//)!= null){ $(".divLangEN").addClass("aSelected"); } else if(url.match(/\/sc\//)!= null){ $(".divLangSC").addClass("aSelected"); } $(".divLang a").on('click',function(){ const regex = /\/(ch|en|sc)\//; var url = location.href; if($(this).hasClass('divLangEN')){ location.href = url.replace(regex,'/en/'); } else if($(this).hasClass('divLangSC')){ location.href = url.replace(regex,'/sc/'); } else if($(this).hasClass('divLangCH')){ location.href = url.replace(regex,'/ch/'); } }); }); function GoogleAnalytic_SearchBox(keyword) { ga('send', 'event', { eventCategory: 'keyword_main', eventAction: 'click', eventLabel: keyword, eventValue: 1, }); } var isLangSectionExpanded = false; var isAboutUsExpanded = false; var isAdEquiryExpanded = false;