AI 生成: 一个仿 aptv.pro 的视频站点,使用 Python Flask 构建,包含视频列表、分类、搜索和视频播放页面。
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// 前端交互脚本
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// 卡片点击时添加轻微反馈
|
||||
document.addEventListener('click', function (e) {
|
||||
const card = e.target.closest('.card');
|
||||
if (!card) return;
|
||||
card.style.transform = 'scale(0.98)';
|
||||
setTimeout(function () { card.style.transform = ''; }, 150);
|
||||
});
|
||||
|
||||
// 搜索框自动聚焦(当 URL 带 q 参数时)
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
if (params.get('q')) {
|
||||
const input = document.querySelector('.search-form input');
|
||||
if (input) {
|
||||
input.focus();
|
||||
input.setSelectionRange(input.value.length, input.value.length);
|
||||
}
|
||||
}
|
||||
|
||||
// 视频播放错误提示
|
||||
const player = document.querySelector('.player');
|
||||
if (player) {
|
||||
player.addEventListener('error', function () {
|
||||
console.warn('视频加载失败,请检查视频源。');
|
||||
});
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user