Skip to content

Latest commit

 

History

History
118 lines (104 loc) · 5.96 KB

index.md

File metadata and controls

118 lines (104 loc) · 5.96 KB
layout title description
default
域名分流
特别适和爱快软路由的域名分流

<style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>

Last Build Time: {{ site.time | date: "%Y-%m-%d %H:%M:%S" }}

Select All
    {% for item in site.data.domain_list %}
  • {{ item.icon | replace_first: "bi", "bi fs-3" }} {{ item.name }}{{ item.domain }}{{ item.update_time }}
  • {% endfor %}
点击一键复制
<textarea id="copyContent" style="height: auto; min-height: 300px;" rows="2" class="col-12" readonly></textarea>
<script type="text/javascript"> // 获取复选框元素和待复制区域元素 const checkboxes = Array.from(document.querySelectorAll('input[type="checkbox"]')); const copyContent = document.getElementById('copyContent'); const selectAllButton = document.getElementById('selectAllButton');

// 定义变量保存手动调整的高度 let textareaHeight = '';

// 为每个复选框添加事件监听器 checkboxes.forEach((checkbox) => { checkbox.addEventListener('change', () => { if (checkbox.checked) { // 复选框被选中时,将文本添加到待复制区域 const text = checkbox.value; const formattedText = text.replace(/
/g, '\n'); copyContent.value += formattedText + '\n'; } else { // 复选框被取消选中时,从待复制区域删除文本 const text = checkbox.value; const formattedText = text.replace(/
/g, '\n'); copyContent.value = copyContent.value.replace(formattedText + '\n', ''); }

    // 调整高度
    autoAdjustTextAreaHeight();
});

// 页面加载时恢复勾选状态
const checkedStatus = localStorage.getItem(checkbox.id);
checkbox.checked = checkedStatus === 'true';

});

// 全选按钮点击事件 let selectAllFlag = false; // 标记全选状态 selectAllButton.addEventListener('click', () => { if (!selectAllFlag) { checkboxes.forEach((checkbox) => { checkbox.checked = true; }); } else { checkboxes.forEach((checkbox) => { checkbox.checked = false; }); }

selectAllFlag = !selectAllFlag; // 切换全选状态

// 清空待复制区域内容
copyContent.value = '';

// 将内容插入待复制区域
checkboxes.forEach((checkbox) => {
    if (checkbox.checked) {
        const text = checkbox.value;
        const formattedText = text.replace(/<br>/g, '\n');
        copyContent.value += formattedText + '\n';
    }
});

// 调整高度
autoAdjustTextAreaHeight();

});

// 调整初始高度和监听复选框变化事件 function autoAdjustTextAreaHeight() { copyContent.style.height = 'auto'; copyContent.style.height = copyContent.scrollHeight + 'px';

// 保存手动调整的高度,仅在高度增加时保存
if (copyContent.style.height > textareaHeight) {
    textareaHeight = copyContent.style.height;
}

}

// 监听用户手动调整 <textarea> 的高度事件,并恢复高度 copyContent.addEventListener('input', () => { copyContent.style.height = textareaHeight; });

// 允许待复制区域文本编辑 copyContent.readOnly = false; // 创建一键复制按钮 const copyButton = document.querySelector('#copyArea button'); const textarea = document.getElementById('copyContent');

copyButton.addEventListener('click', () => { textarea.select(); document.execCommand('copy'); console.log('文本已成功复制到剪贴板'); }); </script>