解决类名相同的问题
This commit is contained in:
浪子 2025-06-11 17:15:57 +08:00
parent 6f37575943
commit 0ed7e7b5e8
3 changed files with 5 additions and 3 deletions

View File

@ -35,7 +35,7 @@ document.addEventListener('DOMContentLoaded', function() {
});
}
// 给所有复制链接添加点击事件
document.querySelectorAll('.text').forEach(link => {
document.querySelectorAll('.copy').forEach(link => {
link.addEventListener('click', function(e) {
e.preventDefault();
const textToCopy = this.getAttribute('data-copy') || this.textContent;

View File

@ -3,7 +3,7 @@
* 一款单栏主题. 移植自HUGO主题 Farallon 原作者 bigfa
* @package Farallon
* @author 老孙
* @version 0.7.2
* @version 0.7.3
* @link https://www.imsun.org
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>

View File

@ -61,7 +61,9 @@
<?php if($this->options->showshare): ?>
<div class="post--share">
<svg viewBox="0 0 24 24" aria-hidden="true"><g><path d="M18.36 5.64c-1.95-1.96-5.11-1.96-7.07 0L9.88 7.05 8.46 5.64l1.42-1.42c2.73-2.73 7.16-2.73 9.9 0 2.73 2.74 2.73 7.17 0 9.9l-1.42 1.42-1.41-1.42 1.41-1.41c1.96-1.96 1.96-5.12 0-7.07zm-2.12 3.53l-7.07 7.07-1.41-1.41 7.07-7.07 1.41 1.41zm-12.02.71l1.42-1.42 1.41 1.42-1.41 1.41c-1.96 1.96-1.96 5.12 0 7.07 1.95 1.96 5.11 1.96 7.07 0l1.41-1.41 1.42 1.41-1.42 1.42c-2.73 2.73-7.16 2.73-9.9 0-2.73-2.74-2.73-7.17 0-9.9z"></path></g></svg>
<span class="text" data-copy="<?php $this->permalink(); ?>">复制链接</span><span class="link text"><?php $this->permalink(); ?></span><div class="notice--wrapper" id="copyTooltip" style="display: none;">复制成功!</div>
<span class="cpoy" data-copy="<?php $this->permalink(); ?>">复制链接</span>
<span class="link copy"><?php $this->permalink(); ?></span>
<div class="notice--wrapper" id="copyTooltip" style="display: none;">复制成功!</div>
</div>
<?php endif; ?>
<!-- TAG -->