/** * head.js */ var twpId; (function (window) { /** * * 1つ目の条件 * 配列内のページのURLはあるか * **/ var spPages = [ '/news/' ]; var isExistence = (function() { var flag = false; var l = location.pathname; for (var i = 0; i < spPages.length; i++) { if (l === spPages[i]) { flag = true; break; } if (l + 'index.html' === spPages[i] + 'index.html') { flag = true; break; } } return flag; }()); /** * * 2つ目の条件 * exclusionParamのパラメータを所持しているか * **/ var hasExclusionParam = location.search.indexOf('viewPC') > 0 ? true : false; /** * * 3つ目の条件 * デバイスがSPか * **/ var ua = navigator.userAgent; var isSP = ua.indexOf('iPhone') > 0 || ua.indexOf('Android') > 0 && ua.indexOf('Mobile') > 0 ? true : false; if (isExistence && !hasExclusionParam && isSP) { var settingParam = window.location.search; var transitionHref = window.location.pathname; transitionHref = transitionHref.split('/') transitionHref.splice(1, 0, 'smp'); transitionHref = transitionHref.join('/'); transitionHref = transitionHref + settingParam; if(location.pathname === "/news/" || location.pathname === "/") { return; } else { location.href = transitionHref; } } }(window)); // FONTPLUS (function() { if (window.FONTPLUS) return; document.write(""); }()); (function() { var pathname = location.pathname; if (pathname.match('\/magazine\/')) { //Facebook Pixel Tag !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, document,'script','https://connect.facebook.net/en_US/fbevents.js'); fbq('init', '120990251782652'); // Insert your pixel ID here. fbq('track', 'PageView'); } }()); // LEXUS TOKYO対応 (function() { var hibiyaHeader = `
`; var hibiyaFooter = '' + ' '; //URLパラメータを取得 var param = new Object; var paramUrl = location.search.substring(1).split('&'); var paramRef = '', paramsymbol = '?p=', link, addParam; if (paramUrl !== undefined) { for (var i = 0; paramUrl[i]; i++) { var k = paramUrl[i].split('='); param[k[0]] = k[1]; } paramRef = param.p; } var flag = (paramRef === 'hibiya' || paramRef === 'l-tokyo'); window.addEventListener('load', function(){ flag = (flag && !document.querySelector('.hibiya-header')); if (flag) { document.querySelectorAll('a').forEach((el) => { link = el.getAttribute('href'); if(link !== undefined && link !== null) { (link.indexOf('?') != -1) ? paramsymbol = '&p=' : paramsymbol = '?p='; addParam = link + paramsymbol + paramRef; if(link.slice(0,1) !== '#' && !(link.match('javascript'))) { if(link.match('#')) { if (!(link.match('p='))) { hashHref = link.split('#'); el.setAttribute('href', hashHref[0] + paramsymbol + paramRef + '#' + hashHref[1]); } } else { el.setAttribute('href', addParam); } } } }) if(document.querySelector('html body header').classList.contains('st-header')) { if (document.querySelector('.topics-head')) { document.querySelector('.topics-head').remove(); } if (document.querySelector('.brand-head')) { document.querySelector('.brand-head').remove(); } } //ヘッダー,フッター分岐処理 if (document.querySelector('.st-header + nav')) { document.querySelector('.st-header + nav').classList.add('none'); } if (document.querySelector('.rq-head')) { document.querySelector('.rq-head').classList.add('none'); } document.querySelector('.st-footer').classList.add('hibiya-footer'); document.querySelector('.st-header').innerHTML = hibiyaHeader; document.querySelector('.st-footer').innerHTML = hibiyaFooter; } }); }()); // v5 css 読み込み (function() { let headerCss = document.querySelector('[href="/common/v5/css/header.css"]'); if (headerCss != null) { return; } var cssFiles = ['/common/v5/css/header.css', '/common/v5/css/footer.css']; var nextEle = document.querySelector('[href*="common/v3/css/app.css"]'); if (!nextEle) { var nextEle = document.querySelector('[href*="common/v2/css/import.css"]'); } var fileHost = ''; if (location.hostname === 'site-search.lexus.jp' || location.hostname === 'l-nenpi.jp' || location.hostname === 'stg.l-nenpi.jp') { fileHost = 'https://lexus.jp'; } for(var i = 0; i < cssFiles.length; i++){ var css = document.createElement("link"); css.setAttribute("rel", "stylesheet"); css.setAttribute("type", "text/css"); css.setAttribute("href", fileHost + cssFiles[i]); nextEle.parentNode.insertBefore(css, nextEle); } }());