Files
WebServer/static/js/terms-modal.js
2025-08-30 19:51:53 +08:00

137 lines
5.0 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Terms and Conditions Modal functionality
document.addEventListener('DOMContentLoaded', function() {
// Modal element
const modal = document.createElement('div');
modal.id = 'terms-modal';
modal.style.cssText = `
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
display: none;
justify-content: center;
align-items: center;
z-index: 1000;
`;
// Modal content
const modalContent = document.createElement('div');
modalContent.style.cssText = `
background-color: white;
padding: 30px;
border-radius: 10px;
max-width: 600px;
width: 90%;
max-height: 80vh;
overflow-y: auto;
position: relative;
`;
// Close button
const closeButton = document.createElement('button');
closeButton.textContent = '×';
closeButton.style.cssText = `
position: absolute;
top: 10px;
right: 15px;
background: none;
border: none;
font-size: 24px;
cursor: pointer;
color: #666;
`;
closeButton.onclick = closeModal;
// Title
const modalTitle = document.createElement('h2');
modalTitle.style.marginBottom = '20px';
// Content
const modalText = document.createElement('div');
modalText.style.lineHeight = '1.6';
modalContent.appendChild(closeButton);
modalContent.appendChild(modalTitle);
modalContent.appendChild(modalText);
modal.appendChild(modalContent);
document.body.appendChild(modal);
// Message content for each item
const messages = {
'免责声明': {
title: '免责声明',
content: `本网站提供的信息仅供参考,不构成任何投资建议。富泽证券(国际)有限公司不对信息的准确性、完整性或及时性作出任何保证。投资者应自行承担投资风险,并在做出投资决策前咨询专业顾问。\n\n市场有风险,投资需谨慎。`
},
'服务条款': {
title: '服务条款',
content: `欢迎使用富泽证券(国际)有限公司的服务。在使用我们的服务前,请仔细阅读以下条款:\n\n1. 用户同意遵守所有适用的法律法规\n2. 用户应对其账户安全和交易活动负责\n3. 公司保留修改服务条款的权利\n4. 任何争议应通过友好协商解决`
},
'隐私政策': {
title: '隐私政策',
content: `我们高度重视您的隐私保护:\n\n1. 我们仅收集必要的个人信息用于提供服务\n2. 您的信息将受到严格保密\n3. 我们不会向第三方出售或出租您的个人信息\n4. 您有权访问、修改或删除您的个人信息\n\n如有任何隐私相关问题,请联系我们的客服团队。`
},
'更多': {
title: '更多信息',
content: `如需了解更多关于我们的服务信息,请联系我们:\n\n- 电话:+852 35856298\n- 邮箱Sec.Info@fuzsec.com\n- 地址香港中环德辅道中71号永安集团大厦19楼\n\n我们的客服团队将竭诚为您服务。`
}
};
// Add click event listeners to the terms links
// Target the specific footer section that contains the terms links
const footerLinksSections = document.querySelectorAll('.footer-links');
let termsLinks = [];
footerLinksSections.forEach(section => {
const heading = section.querySelector('h4');
if (heading && (heading.textContent.includes('条款') ||
heading.textContent.includes('Terms') ||
heading.textContent.includes('声明') ||
heading.textContent.includes('Policy'))) {
termsLinks = termsLinks.concat(Array.from(section.querySelectorAll('ul li a')));
}
});
termsLinks.forEach(link => {
link.addEventListener('click', function(e) {
e.preventDefault();
const linkText = this.textContent.trim();
if (messages[linkText]) {
showModal(messages[linkText].title, messages[linkText].content);
}
});
});
// Close modal when clicking outside
modal.addEventListener('click', function(e) {
if (e.target === modal) {
closeModal();
}
});
// Close modal with Escape key
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
closeModal();
}
});
function showModal(title, content) {
modalTitle.textContent = title;
modalText.textContent = content;
modal.style.display = 'flex';
document.body.style.overflow = 'hidden';
}
function closeModal() {
modal.style.display = 'none';
document.body.style.overflow = 'auto';
}
// Helper function to check if element contains text
function containsText(element, text) {
return element.textContent.includes(text);
}
});