var footer_config = {
買屋: [
{
url: "https://www.sinyi.com.tw/buy/list", title: "區域找屋", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/map", title: "地圖找屋", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/mrt", title: "捷運找屋", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/theme", title: "主題找屋", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/mortgages", title: "自備款找屋", target: "_self", crossdomain: 1
},
{
url: "https://www.sinyi.com.tw/buy", title: "買屋攻略", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/loan", title: "房貸專區", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/rema", title: "新建案", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/jp", title: "日本置產", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/sinyicare/?sinfrom=sinyi_footer_buy", title: "買屋服務保障", target: "_blank", crossdomain: 1
},
{
url: "https://www.sinyi.com.tw/member/myepaper", title: "訂閱電子報", target: "_blank", crossdomain: 0
},
{
第三方物件來源:[
{
url: "https://www.sinyi.com.tw/buy/list/hb-realty", title: "住商不動產", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/list/ct-realty", title: "中信房屋", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/list/pa-realty", title: "太平洋房屋", target: "_self", crossdomain: 0
},
]
}
],
賣屋:[
{
url: "https://www.sinyi.com.tw/sell", title: "賣屋攻略", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/sell/househeat", title: "我家有多夯", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/sell/insight", title: "賣屋透視鏡", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/sell/tax", title: "賣屋要繳什麼稅", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/sinyicare/?sinfrom=sinyi_footer_sell", title: "賣屋服務保障", target: "_blank", crossdomain: 1
},
],
租屋:[
{
url: "https://www.sinyi.com.tw/rent/", title: "條件搜尋", target: "_blank", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/rent/map/", title: "地圖搜尋", target: "_blank", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/rent/mrt/", title: "捷運搜尋", target: "_blank", crossdomain: 0
},
{
url: "https://www.sinyinews.com.tw/sinyipedia/rentlist", title: "租屋知識", target: "_blank", crossdomain: 1
},
],
實登與房訊知識:[
{
url: "https://www.sinyi.com.tw/tradeinfo/list", title: "實價登錄", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyinews.com.tw/dailynews", title: "每日新聞", target: "_blank", crossdomain: 1
},
{
url: "https://www.sinyinews.com.tw/s_channel", title: "影音房市", target: "_blank", crossdomain: 1
},
{
url: "https://www.sinyinews.com.tw/monthly", title: "房價指數/不動產評論", target: "_blank", crossdomain: 1
},
{
url: "https://www.sinyinews.com.tw/sinyipedia", title: "百科知識", target: "_blank", crossdomain: 1
},
{
url: "https://www.sinyinews.com.tw/sinyipedia/buylist", title: "買屋知識", target: "_blank", crossdomain: 1
},
{
url: "https://www.sinyinews.com.tw/sinyipedia/salelist", title: "賣屋知識", target: "_blank", crossdomain: 1
},
{
新聞媒體夥伴:[
{
image_src: "https://res.sinyi.com.tw/img/web/img-myhousing-logo.png", style: "width:60px;padding-bottom:25px"
},
]
}
],
居家服務:[
{
url: "https://livinglife.com.tw/interior-design?utm_source=sinyiweb&utm_medium=referral&utm_campaign=livinglife-home&utm_content=footer", title: "室內設計", target: "_blank", crossdomain: 1
},
{
url: "https://livinglife.com.tw/service/partial-decoration?utm_source=sinyiweb&utm_medium=referral&utm_campaign=livinglife-home&utm_content=footer", title: "統包工程", target: "_blank", crossdomain: 1
},
{
url: "https://livinglife.com.tw/service/waterproof2?utm_source=sinyiweb&utm_medium=referral&utm_campaign=livinglife-home&utm_content=footer", title: "滲漏防水", target: "_blank", crossdomain: 1
},
{
url: "https://livinglife.com.tw/service/partial-decoration?utm_source=sinyiweb&utm_medium=referral&utm_campaign=livinglife-home&utm_content=footer", title: "油漆粉刷", target: "_blank", crossdomain: 1
},
{
url: "https://livinglife.com.tw/move-place?utm_source=sinyiweb&utm_medium=referral&utm_campaign=livinglife-home&utm_content=footer", title: "搬家倉儲", target: "_blank", crossdomain: 1
},
{
url: "https://livinglife.com.tw/home-cleaning?utm_source=sinyiweb&utm_medium=referral&utm_campaign=livinglife-home&utm_content=footer", title: "家事清潔", target: "_blank", crossdomain: 1
},
{
url: "https://livinglife.com.tw/album?page=1?utm_source=sinyiweb&utm_medium=referral&utm_campaign=livinglife-home&utm_content=footer", title: "嚴選案例", target: "_blank", crossdomain: 1
}
],
集團與永續發展:[
{
url: "https://www.sinyicity.com", title: "信義城市/了解信義", target: "_blank", crossdomain: 0
},
/*{
url: "https://www.sinyi.com.tw/aboutsinyigroup/", title: "了解信義企業集團", target: "_blank", crossdomain: 0
},*/
{
url: "https://hr.sinyi.com.tw/", title: "人才招募", target: "_blank", crossdomain: 1
},
{
投資人專區:[
{
url: "https://www.sinyi.com.tw/investors/", title: "投資人關係", target: "_blank", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/investors/investors-en_mainpage-en", title: "investor relations", target: "_blank", crossdomain: 0
},
/*{
url: "https://csr.sinyi.com.tw/sd/major-topics.php", title: "利害關係人專區", target: "_blank", crossdomain: 1
},*/
]
},
{
企業永續發展專區:[
{
url: "https://csr.sinyi.com.tw/", title: "企業永續發展", target: "_blank", crossdomain: 1
},
{
url: "//www.sinyicharity.org.tw/", title: "信義公益基金會", target: "_blank", crossdomain: 1
},
{
url: "https://www.sinyischool.org.tw/", title: "信義學堂", target: "_blank", crossdomain: 1
},
{
url: "https://www.taiwan4718.tw/", title: "社區一家", target: "_blank", crossdomain: 1
},
{
url: "https://www.cbeea.org.tw/", title: "中華企業倫理教育協進會", target: "_blank", crossdomain: 1
},
{
url: "https://twrr.org.tw/zh-TW/origin", title: "台灣地方創生基金會", target: "_blank", crossdomain: 1
},
{
url: "https://www.sinyiculture.org.tw", title: "信義文化基金會", target: "_blank", crossdomain: 1
}
]
},
{
關係企業:[
{
url: "https://www.sinyi-rema.com.tw/", title: "信義代銷", target: "_blank", crossdomain: 1
},
{
url: "https://www.xinyikf.com.tw/", title: "信義開發", target: "_blank", crossdomain: 1
},
{
url: "http://www.sinyiglobal.com/", title: "信義全球資產", target: "_blank", crossdomain: 1
},
{
url: "https://app.sinyi.com.tw/", title: "信義鑑定", target: "_blank", crossdomain: 1
},
{
url: "https://www.an-sin.com.tw/", title: "安信建經", target: "_blank", crossdomain: 1
},
{
url: "https://www.sinyijapan.com/tw/", title: "信義日本", target: "_blank", crossdomain: 1
},
{
url: "https://malaysia.sinyi.com.tw/", title: "信義大馬", target: "_blank", crossdomain: 1
},
{
url: "http://www.sinyi.com.cn/", title: "中國信義", target: "_blank", crossdomain: 1
},
{
url: "http://www.sinyizy.com/", title: "信義置業", target: "_blank", crossdomain: 1
},
{
url: "https://www2.sinyi.com.tw/finance/finance-application.aspx/", title: "金融機構專區", target: "_blank", crossdomain: 1
},
]
}
]
};
var pc_header_title_config =
[
{
"買屋": [
{
url: "https://www.sinyi.com.tw/buy/list", title: "找好屋", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy", title: "買方攻略", label: "new", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/loan", title: "房貸專區", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/recommend", title: "智慧推薦", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/theme", title: "主題找屋", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/rema", title: "新建案", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/jp", title: "日本置產", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/sinyicare/?sinfrom=sinyi_header_buy", title: "買屋服務保障", target: "_self", crossdomain: 0
},
],
},
{
"賣屋": [
{
url: "https://www.sinyi.com.tw/sell", title: "賣屋攻略", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/sell/househeat", title: "我家有多夯", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/sell/insight", title: "賣屋透視鏡", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/sell/tax", title: "賣屋要繳什麼稅", label: "new", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/sinyicare/?sinfrom=sinyi_header_sell", title: "賣屋服務保障", target: "_self", crossdomain: 0
},
],
},
{
url: "https://www.sinyi.com.tw/rent", title: "租屋", target: "_blank", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/communitylist", title: "社區/商辦", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/tradeinfo/list", title: "實價登錄", target: "_self", crossdomain: 0
},
{
"房訊知識": [
{
url: "https://www.sinyinews.com.tw/", title: "房訊首頁", target: "_blank", crossdomain: 1
},
{
url: "https://www.sinyinews.com.tw/sinyipedia/buylist", title: "買屋知識", target: "_blank", crossdomain: 1
},
{
url: "https://www.sinyinews.com.tw/sinyipedia/salelist", title: "賣屋知識", target: "_blank", crossdomain: 1
}
],
},
{
url: "https://link.livinglife.com.tw/gQQIbn", title: "居家服務", target: "_blank", crossdomain: 1
},
];
var mobile_header_title_config =
[
{
"買屋": [
{
url: "https://www.sinyi.com.tw/buy/list", title: "區域找屋", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/map", title: "地圖找屋", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/mrt", title: "捷運找屋", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/theme", title: "主題找屋", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/mortgages", title: "自備款找屋", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy", title: "買屋攻略", label: "new", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/loan", title: "房貸專區", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/rema", title: "新建案", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/buy/jp", title: "日本置產", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/sinyicare/?sinfrom=sinyi_header_buy", title: "買屋服務保障", target: "_blank", crossdomain: 1
},
],
},
{
"賣屋":[
{
url: "https://www.sinyi.com.tw/sell", title: "賣屋攻略", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/sell/househeat", title: "我家有多夯", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/sell/insight", title: "賣屋透視鏡", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/sell/tax", title: "賣屋要繳什麼稅", label: "new", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/sinyicare/?sinfrom=sinyi_header_sell", title: "賣屋服務保障", target: "_blank", crossdomain: 1
},
],
},
{
url: "https://www.sinyi.com.tw/rent", title: "租屋", target: "_blank", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/communitylist", title: "社區/商辦", target: "_self", crossdomain: 0
},
{
url: "https://www.sinyi.com.tw/tradeinfo/list", title: "實價登錄", target: "_self", crossdomain: 0
},
{
"房訊知識":[
{
url: "https://www.sinyinews.com.tw/", title: "房訊首頁", target: "_blank", crossdomain: 1
},
{
url: "https://www.sinyi.com.tw/sell/househeat", title: "買屋知識", target: "_blank", crossdomain: 1
},
{
url: "https://www.sinyinews.com.tw/sinyipedia/salelist", title: "賣屋知識", target: "_blank", crossdomain: 1
},
],
},
{
url: "https://link.livinglife.com.tw/gQQIbn", title: "搬家裝修", target: "_blank", crossdomain: 1
},
];
var header_logo = [{url: "https://www.sinyi.com.tw/", image: "https://res.sinyi.com.tw/img/web/img-sinyi-logo-white.png", target: "_self", crossdomain: 0}]
var header ='
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
';
var component_header_userAgent;
var component_header_queryList;
var component_header_sat = "";
var webapi_component_header = "";
document.addEventListener("DOMContentLoaded", function(event) {
$('.sinyi_header').css('width','100%');
$('.sinyi_header').css('position','fixed');
$('.sinyi_header').css('top','0');
$('.sinyi_header').css('z-index','998');
$('.sinyi_header').css('padding-right','40px');
if('white' == 'green'){
$('.sinyi_header').css('background-image','linear-gradient(273deg,#73ce59,#01ab59 58%,#008652)');
}
window.onresize = function(event) {
header_css()
};
function header_css(){
if(window.matchMedia("(min-width: 992px)").matches){
$('.sinyi_header-space').css('height','64px');
$('.sinyi_header').css('height','64px');
$('.sinyi_header').css('box-shadow','0 2px 6px 0 rgba(0, 0, 0, .1)');
}
if(window.matchMedia("(max-width: 991px)").matches){
$('.sinyi_header-space').css('height','50px');
$('.sinyi_header').css('height','50px');
//$('.sinyi_header').css('padding','15px 0 15.2px');
$('.sinyi_header').css('box-shadow','0 2px 4px 0 rgba(0, 0, 0, .1)');
}
}
header_css();
var elementExists = document.querySelector("#sinyi_softmobile-header .sinyi_header");
if(elementExists){
elementExists.classList.add("sinyi_header-white");
}else{
var header_ready = '';
document.body.insertAdjacentHTML("afterbegin", header_ready);
}
var preconnect_link = document.createElement( 'link' );
preconnect_link.rel = 'preconnect';
preconnect_link.href = "https://fonts.gstatic.com";
document.head.appendChild( preconnect_link );
var preload_link = document.createElement( 'link' );
preload_link.rel = 'preload';
preload_link.href = "https://fonts.googleapis.com/css?family=Noto+Sans+TC&subset=chinese-traditional,japanese";
preload_link.as = "style"
document.head.appendChild( preload_link );
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.href = "https://fonts.googleapis.com/css?family=Noto+Sans+TC&subset=chinese-traditional,japanese";
document.head.appendChild( link );
var preload_hflink = document.createElement( 'link' );
preload_hflink.rel = 'preload';
preload_hflink.href = "https://res.sinyi.com.tw/css/hf.css";
preload_hflink.as = "style"
document.head.appendChild( preload_hflink );
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.href = "https://res.sinyi.com.tw/css/hf.css";
document.head.appendChild( link );
link.onload = function() {
document.querySelector("#sinyi_softmobile-header .sinyi_header").insertAdjacentHTML("afterbegin", header);
//$("#sinyi_softmobile-header .sinyi_header").append(header);
var pc_header_content = '';
var pc_header_title = '';
Object.keys(pc_header_title_config).forEach(function eachKey(key) {
if(pc_header_title_config[key]['url'] != undefined){//單層
if(pc_header_title_config[key]['crossdomain'] == 1 && localStorage.getItem("memberId") != null){
pc_header_title_config[key]['url'] += '?sid='+localStorage.getItem("sid")+'&memberId='+localStorage.getItem("memberId")+'&nickName='+localStorage.getItem("nickName");
}
pc_header_title += '';
pc_header_title += ''+pc_header_title_config[key]['title']+'';
pc_header_title += '';
var stringLength = pc_header_title_config[key]['title'].length;
if(stringLength>2){
var sinyi_fake_function_link_width = stringLength*18;
}else{
var sinyi_fake_function_link_width = stringLength*20;
}
pc_header_content += '';
}else{
Object.keys(pc_header_title_config[key]).forEach(function eachKey(second_key) {
var stringLength = second_key.length;
if(stringLength>2){
var sinyi_fake_function_link_width = stringLength*18;
}else{
var sinyi_fake_function_link_width = stringLength*20;
}
pc_header_title += ''+second_key+'';
pc_header_content += '';
pc_header_content += '
';
pc_header_content += '
';
pc_header_content += '
';
}
});
//document.getElementsByClassName("sinyi_function-bar")[0].insertAdjacentHTML("afterbegin", pc_header_title);
//document.querySelector(".sinyi_fake-title-bar .sinyi_fake-main-icon").insertAdjacentHTML("afterend", pc_header_content);
// pc_header 結束處理
// mobile_header 開始處理
var mobile_header_content = '';
var mobile_header_title = '';
Object.keys(mobile_header_title_config).forEach(function eachKey(key) {
if(mobile_header_title_config[key]['url'] != undefined){//單層
if(mobile_header_title_config[key]['crossdomain'] == 1 && localStorage.getItem("memberId") != null){
mobile_header_title_config[key]['url'] += '?sid='+localStorage.getItem("sid")+'&memberId='+localStorage.getItem("memberId")+'&nickName='+sessionStorage.getItem("nickName");
}
mobile_header_content += ''
mobile_header_content += '';
mobile_header_content += '';
}else{
Object.keys(mobile_header_title_config[key]).forEach(function eachKey(second_key) {
mobile_header_content += '';
if (second_key === '賣屋' || second_key === '買屋') {
mobile_header_content += '
'
+second_key
+'
'
+'
';
} else {
mobile_header_content += '
'+second_key+'
';
}
mobile_header_content += '
';
mobile_header_content += '';
}
});
//document.querySelector(".sinyi_mobile_bm_list").insertAdjacentHTML("beforeend", mobile_header_content);
var js = document.createElement( 'script' );
js.src = "https://cdn.rawgit.com/ricmoo/aes-js/e27b99df/index.js";
document.head.appendChild( js );
js.onload = function() {
document.getElementsByClassName("sinyi_function-bar")[0].insertAdjacentHTML("beforeend", pc_header_title);
document.querySelector(".sinyi_fake-title-bar .sinyi_fake-main-icon").insertAdjacentHTML("afterend", pc_header_content);
// pc_header 結束處理
document.querySelector(".sinyi_mobile_bm_list").insertAdjacentHTML("beforeend", mobile_header_content);
var query = window.location.search.substring(1);
var qs = parse_query_string(query);
if("sid" in qs){
// if (localStorage.getItem("sid") === null) {
localStorage.setItem("sid",aes_encrypt(qs.sid));
// }
}
if("memberId" in qs){
// if (localStorage.getItem("memberId") === null) {
localStorage.setItem("memberId",aes_encrypt(qs.memberId));
// }
}
if("nickName" in qs){
// if (localStorage.getItem("nickName") === null) {
localStorage.setItem("nickName",aes_encrypt(qs.nickName));
// }
}
// mobile_header 結束處理
if (localStorage.getItem("memberId") === null) {
var returnPath = window.location.pathname;
var locationHostname= window.location.host
$(".sinyi_notLogin").attr('href',"https://www.sinyi.com.tw/sso/login?site=aboutsinyi&returnPath="+encodeURIComponent(returnPath+window.location.search));
$(".sinyi_isLogin").hide();
$(".sinyi_nickName").text("");
$(".sinyi_notLogin").show();
}else{
$(".sinyi_isLogin").show();
$(".sinyi_nickName").text(aes_decrypt(localStorage.getItem("nickName")));
$(".sinyi_notLogin").hide();
}
//document.getElementsByClassName("sinyi_bm-member-list")[0].style.display = "none";
}
//$('.sinyi_bm-member-list').hide();
};
wpd_script = document.createElement("SCRIPT");
wpd_script.src = "https://www.sinyi.com.tw/component/wpd.js.php?siteid=42373264&sname=sinyiwebapi";
wpd_script.type = 'text/javascript';
wpd_script.onload = function() {
component_header_sat = wpd();
}
document.getElementsByTagName("head")[0].appendChild(wpd_script);
// JavaScript-based User-Agent string parser BY Alan Pan 20211004
ua_parser = document.createElement("SCRIPT");
ua_parser.src = "https://www.sinyi.com.tw/component/js/ua-parser.js";
ua_parser.type = 'text/javascript';
ua_parser.onload = function() {
component_header_userAgent = ComponentHeaderGetUserAgent();
component_header_queryList = ComponentHeaderGetQuery();
}
document.getElementsByTagName("head")[0].appendChild(ua_parser);
});
function aes_decrypt(text){
var encryptedBytes = aesjs.utils.hex.toBytes(text);
var aesCbc = new aesjs.ModeOfOperation.cbc([1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8], [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]);
var decryptedBytes = aesCbc.decrypt(encryptedBytes);
decryptedBytes = aesjs.padding.pkcs7.strip(decryptedBytes);
decryptedText = aesjs.utils.utf8.fromBytes(decryptedBytes);
return decryptedText;
}
function aes_encrypt(text){
var textBytes = aesjs.utils.utf8.toBytes(text);
textBytes = aesjs.padding.pkcs7.pad(textBytes);
var aesCbc = new aesjs.ModeOfOperation.cbc([1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8], [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]);
var encryptedBytes = aesCbc.encrypt(textBytes);
var encryptedHex = aesjs.utils.hex.fromBytes(encryptedBytes);
return encryptedHex;
}
function parse_query_string(query) {
var vars = query.split("&");
var query_string = {};
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
var key = decodeURIComponent(pair[0]);
var value = decodeURIComponent(pair[1]);
// If first entry with this name
if (typeof query_string[key] === "undefined") {
// query_string[key] = decodeURIComponent(value);
// If second entry with this name
} else if (typeof query_string[key] === "string") {
var arr = [query_string[key], decodeURIComponent(value)];
query_string[key] = arr;
// If third or later entry with this name
} else {
query_string[key].push(decodeURIComponent(value));
}
}
return query_string;
}
//登出
function logout(){
localStorage.removeItem("memberId");
localStorage.removeItem("nickName");
localStorage.removeItem("phoneNumber");
window.location.assign(window.location.href);
}
//小網會員專區彈開
function sinyi_bm_menu_wrap(){
var element = document.getElementsByClassName("sinyi_bm-menu-wrap");
element[0].classList.add("sinyi_open");
}
//小網會員專區收起
function bm_cross_button(){
var element = document.getElementsByClassName("sinyi_bm-menu-wrap");
element[0].classList.remove("sinyi_open");
}
function bm_list_content(a){
a.nextElementSibling.classList.toggle("sinyi_in");
//if(a.classList.contains("sinyi_bm-list-content-member")){
// document.getElementsByClassName("sinyi_bm-member-list")[0].style.display = "block";
// document.getElementsByClassName("sinyi_bm-list")[0].style.display = "none";
//}else{
if(a.firstElementChild.classList.contains('sinyi_showHideBarArrowDown')){
a.firstElementChild.classList.remove("sinyi_showHideBarArrowDown");
a.firstElementChild.classList.add("sinyi_showHideBarArrowUp");
}else{
a.firstElementChild.classList.remove("sinyi_showHideBarArrowUp");
a.firstElementChild.classList.add("sinyi_showHideBarArrowDown");
}
//a.classList.toggle("sinyi_showHideBarArrowDown");
//a.classList.toggle("sinyi_showHideBarArrowUp");
//$(a).children[0].classList.toggle("sinyi_showHideBarArrowDown sinyi_showHideBarArrowUp");
//}
}
function sinyi_member_sub_function_link(a){
if( a.classList.contains('sinyi_showHideBarArrowUp') || a.classList.contains('sinyi_showHideBarArrowDown') ){
a.nextElementSibling.classList.toggle("sinyi_in");
a.classList.toggle("sinyi_showHideBarArrowUp");
a.classList.toggle("sinyi_showHideBarArrowDown");
}
}
function sinyi_member_in(){
document.getElementById("sinyi_subListMember").style.display = "block";
}
function sinyi_member_out(){
document.getElementById("sinyi_subListMember").style.display = "none";
}
function sinyi_bm_back(){
document.getElementsByClassName("sinyi_bm-member-list")[0].style.display = "none";
document.getElementsByClassName("sinyi_bm-list")[0].style.display = "block";
}
function ComponentHeaderGetUserAgent(){
var parser = new UAParser();
var result = parser.getResult();
var deviceVersion;
var appVersion;
var deviceType;
switch (result.os.name) {
case 'Android':
osTypeValue = 1;
break;
case 'iOS':
osTypeValue = 2;
break;
case 'Windows':
osTypeValue = 3;
break;
case 'MAC':
osTypeValue = 4;
break;
case 'Linux':
osTypeValue = 5;
break;
default:
osTypeValue = 6;
break;
}
switch (result.browser.name) {
case 'Chrome':
browserValue = 1;
break;
case 'IE':
browserValue = 2;
break;
case 'Firefox':
browserValue = 3;
break;
case 'Safari':
browserValue = 4;
break;
case 'Opera':
browserValue = 5;
break;
case 'Edge':
browserValue = 6;
break;
default:
browserValue = 7;
break;
}
switch (result.device.type) {
case 'mobile':
deviceType = 1;
break;
case 'table':
deviceType = 2;
break;
default:
deviceType = 3;
break;
}
deviceVersion = result.os.name + result.os.version;
appVersion = result.browser.version;
return {
'osTypeValue': osTypeValue,
'browserValue':browserValue,
'browserName':result.browser.name,
'deviceVersion': deviceVersion,
'appVersion': appVersion,
'deviceType': deviceType
}
}
function ComponentHeaderGetQuery() {
var query = {};
var search = location.search;
var searchSplit = search.split('?');
if (searchSplit[1] !== undefined) {
var items = searchSplit[1].split('&');
items.forEach(function (currentItem) {
var indexof = currentItem.indexOf("=");
query[currentItem.substring(0,indexof)] = currentItem.substring(indexof+1);
});
}
return query;
}
function ComponentHeaderCommonObj(ip, userAgent, query) {
this.machineNo = "";
this.ipAddress = ip;
this.osType = userAgent.osTypeValue;
this.model = "web";
this.deviceVersion = userAgent.deviceVersion;
this.appVersion = userAgent.appVersion;
this.deviceType = userAgent.deviceType;
this.apType = 3;
this.browser = userAgent.browserValue;
this.memberId = "";
this.domain = location.hostname;
this.utmSource = query['utm_source'] ||'';
if (this.utmSource==='' && query['gclid']) this.utmSource="gclid";
this.utmMedium = query['utm_medium'] || '';
this.utmCampaign = query['utm_campaign'] || '';
this.utmCode = query['utm_code'] || '';
this.requestor = 7;
this.utmContent = query['utm_content'] || '';;
this.utmTerm = query['utm_term'] || '';;
this.sinyiGroup = 1;
}
// 點擊居家生活通
function livinglife(){
var commonbody = new ComponentHeaderCommonObj(" ", component_header_userAgent, component_header_queryList);
var component_header_sid = aes_decrypt(localStorage.getItem("sid"));
var memberid = aes_decrypt(localStorage.getItem("memberId"));
var redirect_url = "https://livinglife.com.tw/?webview=sinyiWeb&utm_source=sinyiweb&utm_medium=menu&utm_content=sinyi-pc&to=";
commonbody.memberId = btoa(memberid);
commonbody.requestor = 1;
commonbody.receiver = 2;
var http = new XMLHttpRequest();
var url = "https://sinyiwebapi.sinyi.com.tw/getSinyiToken.php"
var params = JSON.stringify(commonbody);
http.open('POST', url, true);
//Send the proper header information along with the request
http.setRequestHeader('sid', component_header_sid);
http.setRequestHeader('code', 0);
http.setRequestHeader('Content-Type', 'application/json');
http.setRequestHeader('sat', component_header_sat);
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4) {
if(component_header_userAgent.browserName != "Line"){
var windowOpen = window.open('', '_blank');
}
if(http.status == 200){
var result = JSON.parse(http.responseText);
if(result.retResult){
if(result.content.token){
redirect_url += result.content.token + '&so=' + component_header_sid;
}else{
redirect_url += '&so=' + component_header_sid;
}
}else{
redirect_url += '&so=' + component_header_sid;
}
}else{
redirect_url += '&so=' + component_header_sid;
}
if(component_header_userAgent.browserName != "Line" && component_header_userAgent.browserName != "Mobile Safari"){
windowOpen.location = redirect_url;
}else{
window.open(redirect_url, '_self');
}
}
}
http.send(params);
}