1/** 2 * æ²¢ãã³ã¯ã®è¨æ¸¬ã 3 * GA4ãèªã¿è¾¼ã¾ãã¦ããªãã¨ãã¯ä½ãããªãï¼gtagã®æç¡ã§å¤å®ï¼ã 4 * å人ãç¹å®ããæ å ±ã¯ä¸åéããªãã 5 */ 6(() => { 7 'use strict'; 8 const send = (name, params) => { 9 if (typeof window.gtag !== 'function') return; 10 try { window.gtag('event', name, params || {}); } catch (e) { /* è¨æ¸¬ã®å¤±æã§ãã¼ã¸ãå£ããªã */ } 11 }; 12 13 // ç©ä»¶ãã¼ã¸ã§åç §ã§ãããããdata屿§ããæ å ±ãæ¾ã 14 const meta = document.getElementById('sb-track'); 15 const ctx = meta ? { 16 listing_id: meta.dataset.id || '', 17 pref: meta.dataset.pref || '', 18 agent: meta.dataset.agent || '', 19 rel: meta.dataset.rel || '', 20 } : {}; 21 22 document.addEventListener('click', (e) => { 23 const a = e.target.closest('a'); 24 if (!a) return; 25 const href = a.getAttribute('href') || ''; 26 27 // â æ²è¼å ã¸ã®ã¯ãªãã¯ï¼ãã®äºæ¥ã§æãéè¦ãªè¡åï¼ 28 if (a.dataset.track === 'agent') { 29 // ã©ãããæ¼ããããï¼æ¬æããä¸é¨åºå®ãï¼ãæ®ããå°ç·ã®æ¹åã«ä½¿ã 30 send('outbound_agent', { ...ctx, link_url: href, place: a.dataset.place || 'body' }); 31 return; 32 } 33 // â¡ ææè ã®é£çµ¡å 34 if (a.dataset.track === 'owner') { 35 send('owner_contact', { ...ctx, method: a.dataset.method || '' }); 36 return; 37 } 38 // ⢠å°å³ã®ãã³ããç©ä»¶ã¸ 39 if (a.classList.contains('pin-card')) { 40 send('map_pin_open', { link_url: href }); 41 return; 42 } 43 // ⣠ã¡ã¼ã«ã»é»è©± 44 if (href.startsWith('mailto:')) { send('contact_mail', { location: location.pathname }); return; } 45 if (href.startsWith('tel:')) { send('contact_tel', { location: location.pathname }); return; } 46 // ⤠ãã®ä»ã®å¤é¨ãªã³ã¯ 47 if (/^https?:\/\//.test(href) && !href.includes(location.host)) { 48 send('outbound_other', { link_url: href }); 49 } 50 }, { passive: true }); 51 52 // ⥠ãã©ã¼ã ã®éä¿¡å®äºï¼å®äºç»é¢ã«ç½®ãããå°ãèªãï¼ 53 const done = document.getElementById('sb-form-done'); 54 if (done) { 55 const f = done.dataset.form || ''; 56 send('form_complete', { form: f }); 57 // ææã«ç´çµãã3ã¤ã¯ãGA4ã§ãã¼ã¤ãã³ãã«ç»é²ããããããç¬ç«ãã¦éã 58 const key = { 59 register: 'lead_register', // 叿æ¡ä»¶ã®ç»é² 60 owner_submit: 'lead_listing', // ææè ããã®æ²è¼ç³è¾¼ 61 agents: 'lead_listing', // æ²è¼ä¼ç¤¾ããã®ç³è¾¼ 62 sawa_inquiry: 'lead_business', // äºæ¥è ããã®ãã¼ã¿ç¸è« 63 }[f]; 64 if (key) send(key, { form: f }); 65 } 66 67 // ⦠æ¤ç´¢ã®çµãè¾¼ã¿ï¼ä½ã§çµããã¦ããããç¥ãï¼ 68 if (location.pathname === '/search.php' && location.search) { 69 const q = new URLSearchParams(location.search); 70 const used = ['pref','city','rel','area','price_max','tags','sort'] 71 .filter(k => q.get(k) || q.getAll(k + '[]').length); 72 if (used.length) send('search_filter', { filters: used.join(','), pref: q.get('pref') || '' }); 73 } 74})(); 75 76/* é½éåºçãé¸ã³ç´ããããå¸çºæã®é¸æãè§£é¤ãã¦ããçµãè¾¼ã */ 77(() => { 78 const pref = document.getElementById('f-pref'); 79 if (!pref) return; 80 pref.addEventListener('change', () => { 81 const city = document.getElementById('f-city'); 82 if (city) city.value = ''; 83 const page = document.querySelector('input[name="page"]'); 84 if (page) page.value = '1'; 85 pref.form && pref.form.submit(); 86 }); 87})(); 88 89/* ããã®ç¬¬2é層ããã¼ãã¼ãã§ãéããããã«ããï¼ãã¦ã¹ã¯CSSã®hoverã§åãï¼ */ 90(() => { 91 const btns = [...document.querySelectorAll('.nav-btn')]; 92 if (!btns.length) return; 93 const closeAll = (except) => btns.forEach(b => { 94 if (b === except) return; 95 b.setAttribute('aria-expanded', 'false'); 96 document.getElementById(b.getAttribute('aria-controls'))?.classList.remove('open'); 97 }); 98 btns.forEach(b => { 99 b.addEventListener('click', (e) => { 100 if (window.matchMedia('(max-width:980px)').matches) return; // ã¹ããã¯å¸¸æå±é 101 e.preventDefault(); 102 const sub = document.getElementById(b.getAttribute('aria-controls')); 103 const open = b.getAttribute('aria-expanded') === 'true'; 104 closeAll(b); 105 b.setAttribute('aria-expanded', String(!open)); 106 sub?.classList.toggle('open', !open); 107 }); 108 }); 109 document.addEventListener('keydown', (e) => { if (e.key === 'Escape') closeAll(); }); 110 document.addEventListener('click', (e) => { if (!e.target.closest('.nav-grp')) closeAll(); }); 111})();
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.