fixed 弹幕修复 bug
This commit is contained in:
1 parent
a4c74cbb0d
commit
0714b8eb48
11 files changed
+446
-139
No files matched your search
@@ -11,19 +11,21 @@
|
||||
display: none;
|
||||
background: var(--artalk-editer-color, #333);
|
||||
color: #fff;
|
||||
padding: 6px 12px;
|
||||
border-radius: 6px;
|
||||
padding: 8px 16px;
|
||||
border-radius: 50px;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
z-index: 2147483647;
|
||||
transform: translate(-50%, -120%);
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||
box-shadow: 0 4px 20px rgba(0,0,0,0.25);
|
||||
transition: opacity 0.2s, transform 0.2s;
|
||||
pointer-events: auto;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
white-space: nowrap;
|
||||
animation: popIn 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
|
||||
border: 1px solid rgba(255,255,255,0.1);
|
||||
font-weight: 500;
|
||||
}
|
||||
#${POPUP_ID}::after {
|
||||
content: '';
|
||||
@@ -172,7 +174,8 @@
|
||||
// Create Popup Element
|
||||
var popup = document.createElement('div');
|
||||
popup.id = POPUP_ID;
|
||||
popup.innerHTML = '<span class="icon" style="width:14px;height:14px;fill:currentColor;display:inline-block;"><svg viewBox="0 0 1024 1024" width="100%" height="100%"><path d="M576 128v298.666667h298.666667c0 164.906667-133.76 298.666667-298.666667 298.666666v170.666667c259.2 0 469.333333-210.133333 469.333333-469.333333H576zM149.333333 725.333333c0-164.906667 133.76-298.666667 298.666667-298.666666V128C188.8 128 0 338.133333 0 597.333333h469.333333v-298.666666H170.666667A298.666667 298.666667 0 0 0 149.333333 725.333333z"></path></svg></span> 评论';
|
||||
// 使用 Remix Icon 的引用图标
|
||||
popup.innerHTML = '<i class="ri-double-quotes-l" style="font-size:14px;margin-right:4px;"></i> <span>引用评论</span>';
|
||||
document.body.appendChild(popup);
|
||||
|
||||
// Create Modal Element
|
||||
@@ -494,11 +497,60 @@
|
||||
popup.style.opacity = 0;
|
||||
}
|
||||
|
||||
// Custom Smooth Scroll with Easing
|
||||
function smoothScrollTo(targetPosition, duration) {
|
||||
var startPosition = window.scrollY;
|
||||
var distance = targetPosition - startPosition;
|
||||
var startTime = null;
|
||||
|
||||
function animation(currentTime) {
|
||||
if (startTime === null) startTime = currentTime;
|
||||
var timeElapsed = currentTime - startTime;
|
||||
var run = ease(timeElapsed, startPosition, distance, duration);
|
||||
window.scrollTo(0, run);
|
||||
if (timeElapsed < duration) requestAnimationFrame(animation);
|
||||
}
|
||||
|
||||
// Ease-in-out Cubic
|
||||
function ease(t, b, c, d) {
|
||||
t /= d / 2;
|
||||
if (t < 1) return c / 2 * t * t * t + b;
|
||||
t -= 2;
|
||||
return c / 2 * (t * t * t + 2) + b;
|
||||
}
|
||||
|
||||
requestAnimationFrame(animation);
|
||||
}
|
||||
|
||||
function handleQuoteClick() {
|
||||
if (!window.artalk) return;
|
||||
|
||||
var commentsEl = document.getElementById('Comments');
|
||||
if (commentsEl) commentsEl.scrollIntoView({ behavior: 'smooth' });
|
||||
if (commentsEl) {
|
||||
// Target the editor area directly if possible, or the top of comments
|
||||
// Adjust offset to show the editor more clearly (e.g. 100px from top)
|
||||
var targetEl = document.querySelector('.atk-main-editor') || commentsEl;
|
||||
var elementPosition = targetEl.getBoundingClientRect().top + window.scrollY;
|
||||
|
||||
// Align to 1/3 of the screen height (more comfortable for reading/typing)
|
||||
var offsetPosition = elementPosition - (window.innerHeight / 3);
|
||||
|
||||
// Use custom smooth scroll (800ms)
|
||||
smoothScrollTo(offsetPosition, 800);
|
||||
|
||||
// Highlight effect after scroll (Subtle Scale only, no blue border)
|
||||
setTimeout(function() {
|
||||
var editorEl = document.querySelector('.atk-main-editor');
|
||||
if (editorEl) {
|
||||
editorEl.style.transition = 'transform 0.3s ease';
|
||||
editorEl.style.transform = 'scale(1.02)';
|
||||
|
||||
setTimeout(function() {
|
||||
editorEl.style.transform = '';
|
||||
}, 600);
|
||||
}
|
||||
}, 800);
|
||||
}
|
||||
|
||||
var quoteContent = `> ${selectedText}\n\n`;
|
||||
var editor = window.artalk.editor;
|
||||
|
||||
Reference in new issue
Block a user