// --- [ 설정 ] --- const TARGET_URL = 'https://abc.com'; // 이동할 웹사이트 주소 const BUTTON_TEXT = 'A 사이트로 이동'; // 버튼에 표시될 텍스트 const OPEN_IN_NEW_TAB = true; // 버튼 클릭 시 새 탭에서 열지 여부 // --- [ 스크립트 실행 ] --- // 페이지가 완전히 로드된 후에 스크립트가 실행되도록 보장 // 1. 버튼을 감싸는 컨테이너(div) 생성 const container = document.createElement('div'); container.style.cssText = ` position: fixed; top: 20px; right: 20px; z-index: 1000; `; // 2. 링크 버튼(a) 생성 const button = document.createElement('a'); button.href = TARGET_URL; button.textContent = BUTTON_TEXT; // 새 탭에서 열도록 설정 if (OPEN_IN_NEW_TAB) { button.target = '_blank'; } // 3. 버튼에 스타일 적용 button.style.cssText = ` display: inline-block; padding: 10px 15px; background-color: #007BFF; color: white; text-decoration: none; border-radius: 5px; font-family: Arial, sans-serif; font-weight: bold; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); transition: background-color 0.3s ease; `; // 마우스 오버 효과 추가 button.addEventListener('mouseenter', () => { button.style.backgroundColor = '#0056b3'; }); button.addEventListener('mouseleave', () => { button.style.backgroundColor = '#007BFF'; }); // 4. 컨테이너에 버튼을 추가 container.appendChild(button); // 5. 생성된 컨테이너를 body의 맨 앞에 삽입 document.body.prepend(container);