/* Gold Apple — chip 짧은 폼 자동 변환 (모바일에서 라벨 길어 깨지는 것 방지)
* 적용: .LoginNew-Wrap a, .gonum a 등 일반 chip 영역
* 매핑 사전 — 길라벨 → 짧은 라벨 (모바일 한정 표시)
*/
(function(){
var SHORTEN = {
'sign out': 'Sign out',
'logout': 'Sign out',
'log out': 'Sign out',
'copy referral link': 'Copy link',
'copy referral': 'Copy link',
'my information': 'My info',
'my info': 'My info',
'withdraw information': 'Info',
'more information': 'More',
'unit information': 'Units',
'transfer information': 'Info',
};
function shortenLabel(text){
var key = text.trim().toLowerCase().replace(/\s+/g, ' ');
return SHORTEN[key] || null;
}
function init(){
/* .LoginNew-Wrap, .gonum, .top-nav 안의 chip 텍스트 자동 변환 */
var chips = document.querySelectorAll('.LoginNew-Wrap a, .top-nav a.chip, .ga-chip-auto');
chips.forEach(function(a){
/* 이미 ga-chip-full/short 분기가 있으면 skip */
if (a.querySelector('.ga-chip-full') || a.querySelector('.ga-chip-short')) return;
var span = a.querySelector('span');
var srcEl = span || a;
var orig = srcEl.textContent;
var short = shortenLabel(orig);
if (!short) return;
/* HTML 안전 변환: full + short 두 span 추가 */
srcEl.innerHTML = '' + orig.trim() + '' + short + '';
});
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);
else init();
})();