Greasy Fork

来自缓存

Greasy Fork is available in English.

Coursera 双语字幕 (覆盖层: 英上中下, 可调行距, 默认大字号)

自建覆盖层显示双语:英文在上中文在下;零/负行距紧贴;独立背景;可调字号与垂直位置与行距;默认更大字号 130%。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

作者
唐无诗
日安装量
0
总安装量
7
评分
0 0 0
版本
2025.9.16
创建于
2025-09-16
更新于
2025-09-16
大小
11.1 KB
许可证
MIT
适用于

Coursera Dual Subtitles Overlay / Coursera 双语字幕覆盖层脚本

A Tampermonkey userscript that enhances the Coursera video player by displaying dual-language subtitles in a highly customizable overlay. It replaces the native subtitle display to provide precise control over layout, font size, vertical position, and the spacing between subtitle lines.

一份油猴(Tampermonkey)脚本,它通过一个高度可定制的覆盖层(Overlay)来增强 Coursera 视频播放器的体验。脚本会接管并隐藏原生字幕,从而实现对字幕布局、字号、垂直位置、以及两行字幕间距的精确控制。


English

Features

  • Custom Subtitle Overlay: Renders subtitles in a custom layer, enabling precise control that the native player doesn't offer.
  • Top/Bottom Language Order: Displays the primary language (default: English) on top and the secondary language (default: Chinese) below.
  • Fully Adjustable Layout:
    • Font Size: Increase or decrease the font size in real-time.
    • Vertical Position: Move the entire subtitle block up or down on the screen.
    • Line Spacing: Fine-tune the gap between the two subtitle lines. Supports negative values for a tighter, overlapping fit.
  • Persistent Settings: Your preferences for font size, position, and line spacing are automatically saved and applied to future videos.
  • Seamless Integration: Adds a clean control panel to the Coursera header bar for easy access.

Installation

  1. Install a userscript manager: You need a browser extension like Tampermonkey (recommended), Violentmonkey, or Greasemonkey.
  2. Install the script: Click on the installation link from the script's homepage (e.g., on Greasy Fork) and follow the prompts from your userscript manager.

Usage

  1. Navigate to any Coursera video page.
  2. A new control panel will appear in the header bar at the top-right of the page.
  3. Use the buttons to control the subtitles:
    • 双语 (Dual): Toggle the dual-language subtitle overlay on or off.
    • 字号 (Font Size): Use + and - to adjust the size.
    • 位置 (Position): Use and to move the subtitles vertically.
    • 行距 (Line Gap): Use + and - to control the space between the two subtitle lines.

Advanced Customization

You can easily change the default settings by editing the script:

/********* 可配置默认 *********/
const PRIMARY_LANG          = 'en';       // Default top language
const SECONDARY_LANG        = 'zh-CN';    // Default bottom language
const DEFAULT_BOTTOM_PERCENT= 8;          // Initial vertical position (percentage from bottom)
const DEFAULT_FONT_SIZE     = 130;        // Initial font size (percentage)
const DEFAULT_LINE_GAP_EM   = -0.05;      // Initial gap between lines (in 'em' units)
/********************************/

Change the language codes (e.g., 'fr' for French, 'es' for Spanish) or numerical values to fit your needs.


中文

功能特性

  • 自定义字幕覆盖层: 在一个独立的图层上渲染字幕,实现原生播放器无法做到的精细控制。
  • 上英下中字幕顺序: 默认显示英文主字幕在上方,中文次字幕在下方。
  • 完全可调节的布局:
    • 字体大小: 实时增大或缩小字幕字号。
    • 垂直位置: 在屏幕上整体上下移动字幕的位置。
    • 字幕行距: 精确调整两行字幕之间的间距,支持负值以实现更紧凑的贴合效果。
  • 持久化设置: 你的字号、位置、行距等偏好设置会被自动保存,并在观看其他视频时生效。
  • 无缝集成: 在 Coursera 页面顶部的工具栏添加一个简洁的控制面板,方便操作。

安装步骤

  1. 安装用户脚本管理器: 你需要先安装一个浏览器扩展,如 Tampermonkey (篡改猴) (推荐)、Violentmonkey (暴力猴) 等。
  2. 安装本脚本: 从脚本发布页(如 Greasy Fork)点击安装链接,你的脚本管理器会自动弹出并提示你安装。

使用方法

  1. 打开任意 Coursera 视频页面。
  2. 在页面右上角的顶部工具栏,你会看到一个新的控制面板。
  3. 使用这些按钮来控制字幕:
    • 双语: 点击开启或关闭双语字幕覆盖层。
    • 字号: 使用 +- 按钮调整字体大小。
    • 位置: 使用 按钮来垂直移动字幕。
    • 行距: 使用 +- 按钮来控制中英文字幕之间的间隙。

高级自定义

你可以通过编辑脚本来轻松修改默认设置:

/********* 可配置默认 *********/
const PRIMARY_LANG          = 'en';       // 默认上方语言
const SECONDARY_LANG        = 'zh-CN';    // 默认下方语言
const DEFAULT_BOTTOM_PERCENT= 8;          // 初始垂直位置 (距底部百分比)
const DEFAULT_FONT_SIZE     = 130;        // 初始字体大小 (百分比)
const DEFAULT_LINE_GAP_EM   = -0.05;      // 初始行距 (单位 'em', 可为负)
/********************************/

只需修改语言代码(例如,'fr' 代表法语, 'es' 代表西班牙语)或数字,即可满足你的个性化需求。


License / 许可协议

This script is released under the MIT License. 本脚本基于 MIT 许可证发布。