Breaker & Builder

良質ペアを攻略するBreakerと、相棒を広げるBuilderを探す

リーグを選択

指定した相手を崩す候補を探す

既存Breakerの1シールドBRで相手に強い候補を探す

'); const nameMap=new Map(); for(const [a,b] of Object.entries(D.pokemon||{}))if(a&&b)nameMap.set(a.toLowerCase(),b); for(const [a,b] of Object.entries(D.moves||{}))if(a&&b)nameMap.set(a.toLowerCase(),b); // Review league/cup translations separately from species and move names. const leagueNames=new Map(); for(const [english,japanese] of Object.entries(D.leagues||{}))if(english&&japanese)leagueNames.set(english.toLowerCase(),japanese); const moveIds=new Map(); for(const [a,b] of Object.entries(D.moves||{}))if(a&&b)moveIds.set(a.toUpperCase().replaceAll(' ','_'),b); function makeRx(keys,prefix,suffix,flags){const terms=keys.filter(x=>x.length>=2).sort((a,b)=>b.length-a.length).map(esc);return terms.length?new RegExp(prefix+'('+terms.join('|')+')'+suffix,flags):null;} const leaguesRx=makeRx([...leagueNames.keys()],'(^|[^A-Za-z])','(?=$|[^A-Za-z])','gi'); const idsRx=makeRx([...moveIds.keys()],'(^|[^A-Z0-9_])','(?=$|[^A-Z0-9_])','g'); const namesRx=makeRx([...nameMap.keys()],'(^|[^A-Za-z])','(?=$|[^A-Za-z])','gi'); // Prefer the longest matching UI phrase. Otherwise generic keys (e.g. 良質ペア) // can consume part of a longer description before its intended translation matches. const uiRx=makeRx(Object.keys(I),'','','g'); const originals=new WeakMap(),attrOriginals=new WeakMap(); let lang='ja',busy=false; function jaNames(raw){let s=raw;if(leaguesRx)s=s.replace(leaguesRx,(_,before,term)=>before+(leagueNames.get(term.toLowerCase())||term));if(idsRx)s=s.replace(idsRx,(_,before,term)=>before+(moveIds.get(term)||term));if(namesRx)s=s.replace(namesRx,(_,before,term)=>before+(nameMap.get(term.toLowerCase())||term));return s;} const convert=jaNames; // Stable helper name for dictionary tests. // The on-screen names are translated, but ranking rows retain canonical English // names. Search against the chosen language without modifying simulation data. const searchCache=new WeakMap(); function normalizeSearch(raw){return String(raw??'').normalize('NFKC').toLocaleLowerCase().replace(/[\s\u3000_\-・::()()[\]]+/g,'');} function pokemonMatches(p,query){ const q=normalizeSearch(query);if(!q)return true; if(!p||typeof p!=='object')return false; const id=String(p.id??p.speciesId??'');if(normalizeSearch(id).includes(q))return true; let rec=searchCache.get(p);const name=String(p.name??''); if(!rec||rec.name!==name){rec={name,english:normalizeSearch(name),japanese:normalizeSearch(jaNames(name))};searchCache.set(p,rec);} return lang==='en'?rec.english.includes(q):rec.japanese.includes(q); } window.__POGOSCOUT_MATCH_POKEMON__=pokemonMatches; function enUi(raw){ let result=uiRx?raw.replace(uiRx,term=>I[term]||term):raw; // Short counters may be separate text nodes due to or dynamic values. // Translate them only after a number, using the shared JSON vocabulary. for(const unit of ['組','匹','種'])if(I[unit])result=result.replace(new RegExp('([0-9][0-9,]*)'+esc(unit),'g'),(_,n)=>n+I[unit]); if(I['。'])result=result.replaceAll('。',I['。']); return result; } function trans(raw){return lang==='en'?enUi(raw):jaNames(raw);} function textNodes(root){if(!root)return;const walker=document.createTreeWalker(root,NodeFilter.SHOW_TEXT,{acceptNode:n=>{const p=n.parentElement;return !p||/^(SCRIPT|STYLE|NOSCRIPT|TEXTAREA)$/i.test(p.tagName)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});const nodes=[];while(walker.nextNode())nodes.push(walker.currentNode);for(const n of nodes){if(!originals.has(n))originals.set(n,n.nodeValue);const raw=originals.get(n);if(!raw||!raw.trim())continue;const output=trans(raw);if(n.nodeValue!==output)n.nodeValue=output;}} function attrs(){for(const el of document.querySelectorAll('[placeholder],[aria-label],[title]')){let rec=attrOriginals.get(el);if(!rec){rec={};attrOriginals.set(el,rec)}for(const k of ['placeholder','aria-label','title']){if(!el.hasAttribute(k))continue;if(!(k in rec))rec[k]=el.getAttribute(k);const output=trans(rec[k]);if(el.getAttribute(k)!==output)el.setAttribute(k,output)}}} function updateLinks(){// Preserve language in shared URLs without interfering with league selections. for(const a of document.querySelectorAll('a[href]')){ const href=a.getAttribute('href');if(!href||href.startsWith('#')||/^(javascript:|mailto:|tel:)/i.test(href))continue; try{const url=new URL(href,location.href);if(url.origin!==location.origin||!url.pathname.match(/(?:\/|\/index\.html|\/sleeper\/index\.html|\/breaker-builder\/index\.html|\/quick-log\/index\.html)$/))continue; url.searchParams.set('lang',lang);const rawPath=href.split(/[?#]/)[0];const target=rawPath+url.search+url.hash; if(a.getAttribute('href')!==target)a.setAttribute('href',target); }catch(e){} } } function apply(){if(busy||!document.body)return;busy=true;try{document.documentElement.lang=lang;textNodes(document.body);attrs();for(const el of document.querySelectorAll('[data-pogo-language]'))el.value=lang; const pageTitle=document.querySelector('title');if(pageTitle){if(!pageTitle.hasAttribute('data-pogo-original'))pageTitle.setAttribute('data-pogo-original',pageTitle.textContent);pageTitle.textContent=lang==='en'?enUi(pageTitle.getAttribute('data-pogo-original')):pageTitle.getAttribute('data-pogo-original')} const heading=document.querySelector('meta[name="description"]');if(heading){if(!heading.hasAttribute('data-pogo-original'))heading.setAttribute('data-pogo-original',heading.content);heading.content=lang==='en'?enUi(heading.getAttribute('data-pogo-original')):heading.getAttribute('data-pogo-original')} updateLinks();}finally{busy=false}} function changeLanguage(value,broadcast){const next=value==='en'?'en':'ja';const changed=lang!==next;lang=next; if(changed)for(const input of document.querySelectorAll('input[type="search"],input[id$="Search"],input#q')){ if(input.value){input.value='';input.dispatchEvent(new Event('input',{bubbles:true}));} } apply();if(broadcast){try{localStorage.setItem(LANG_KEY,lang)}catch(e){};try{const url=new URL(location.href);url.searchParams.set('lang',lang);history.replaceState(null,'',url)}catch(e){} for(const f of document.querySelectorAll('iframe'))try{f.contentWindow.postMessage({pogoscout:'language',language:lang},TARGET_ORIGIN)}catch(e){} if(window.parent!==window)try{window.parent.postMessage({pogoscout:'language',language:lang},TARGET_ORIGIN)}catch(e){} }} function init(){document.addEventListener('click',event=>{const a=event.target.closest?.('a[href]');if(a)updateLinks()},true);const param=new URLSearchParams(location.search).get('lang');if(param==='ja'||param==='en')lang=param;else try{lang=localStorage.getItem(LANG_KEY)==='en'?'en':'ja'}catch(e){} // Set the remembered language for navigation, but honor an explicit shared ?lang=... URL. try{localStorage.setItem(LANG_KEY,lang)}catch(e){} for(const el of document.querySelectorAll('[data-pogo-language]'))el.addEventListener('change',()=>changeLanguage(el.value,true)); apply(); for(const f of document.querySelectorAll('iframe'))f.addEventListener('load',()=>{try{f.contentWindow.postMessage({pogoscout:'language',language:lang},TARGET_ORIGIN)}catch(e){}}); const observer=new MutationObserver(()=>{if(!busy)apply()});observer.observe(document.body,{childList:true,subtree:true,characterData:true}); window.addEventListener('message',event=>{if((event.origin!==location.origin&&!(location.protocol==='file:'&&event.origin==='null'))||!event.data)return; if(event.data.pogoscout==='language')changeLanguage(event.data.language,false); if(event.data.pogoscout==='language-request'&&event.source)try{event.source.postMessage({pogoscout:'language',language:lang},TARGET_ORIGIN)}catch(e){} }); window.addEventListener('storage',e=>{if(e.key===LANG_KEY)changeLanguage(e.newValue,false)}); if(window.parent!==window)try{window.parent.postMessage({pogoscout:'language-request'},TARGET_ORIGIN)}catch(e){} } if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init(); })();