// ==UserScript==
// @name Carrd.co编辑器汉化
// @namespace http://tampermonkey.net/
// @version 1.1.2
// @description 使用脚本对网页编辑器的UI英文进行动态汉化
// @author Zola
// @license MIT
// @match https://carrd.co/dashboard/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// 定义汉化词典
const translationDict = {
'My Sites': '我的网站',
'Dashboard': '仪表板',
'Edit': '编辑',
'Container': '容器',
'Type': '类型',
'Columns': '列',
'Left': '左',
'Middle': '中间',
'Width': '宽度',
'Alignment': '对齐',
'Right': '右',
'Options': '选项',
'Use as spacer': '使用间隔',
'Add': '添加',
'Done': '完成',
'Appearance': '外观',
'Height': '高度',
'Padding': '内边距',
'Vertical': '垂直',
'Horizontal': '水平',
'Gutters': '间距',
'Margins': '外边距',
'Top': '上',
'Bottom': '下',
'Corner Rounding': '圆角',
'Top left': '左上',
'Top right': '右上',
'Bottom left': '左下',
'Bottom right': '右下',
'Contents': '内容',
'Position': '位置',
'Auto': '自动',
'Center': '居中',
'Top Left': '左上',
'Top': '顶部',
'Top right': '右上',
'Right': '右侧',
'Bottom Right': '右下',
'Bottom': '底部',
'Bottom Left': '左下',
'Left': '左侧',
'Background': '背景',
'None': '无',
'Color': '颜色',
'Gradient': '渐变',
'Image': '图片',
'Video': '视频',
'Slideshow': '幻灯片',
'Off': '关闭',
'Horizontally': '水平',
'Vertically': '垂直',
'Both': '两者',
'Fill': '填充',
'Fit': '适应',
'Stretch': '拉伸',
'Default': '默认',
'Custom': '自定义',
'Tile': '平铺',
'Size': '大小',
'Parallax': '视差',
'Transparency Color': '透明色',
'Applied to transparent areas within the image (if applicable).': '应用于图像中的透明区域(如果适用)。',
'Overlay': '覆盖',
'Linear': '线性',
'Radial': '径向',
'Conic': '锥形',
'Reverse': '反转',
'Stop #1': '分段 #1',
'Stop #2': '分段 #2',
'Stop #3': '分段 #3',
'Pattern': '图案',
'Angle': '角度',
'Border': '边框',
'Drop Shadow': '投影',
'Distance': '距离',
'Mobile': '移动端',
'Manually adjust this element’s appearance when viewed on mobile screens (advanced).': '在移动屏幕上查看时手动调整此元素的外观(高级设置)。',
'Layout': '布局',
'Optimize': '优化',
'Improve load time by optimizing the image when necessary (recommended).': '通过在必要时优化图像来改善加载时间(推荐)。',
'Blur': '模糊',
'Manual': '手动',
'Publish …': '发布 …',
'View Site': '查看网站',
'Start Over': '重新开始',
'Background …': '背景 …',
'Page …': '页面 …',
'Instructions': '说明',
'Shortcuts': '快捷键',
'Documentation': '文档',
'Exit': '退出',
'List': '列表',
'Buttons': '按钮',
'Links': '链接',
'Icons': '图标',
'Table': '表格',
'Divider': '分隔符',
'Form': '表单',
'Embed': '嵌入',
'Control': '控制',
'Text': '文本',
'Audio': '音频',
'Gallery': '图库',
'Timer': '计时器',
'Widget': '小部件',
'Animation': '动画',
'Add Style': '添加样式',
'On Visible': '可见时',
'Fade In': '淡入',
'Fade Up': '淡出',
'Fade Down': '淡出',
'Fade Left': '淡入左侧',
'Fade Right': '淡入右侧',
'Fade In Background': '背景淡入',
'Blur In': '模糊进入',
'Tilt Left': '左倾斜',
'Tilt Right': '右倾斜',
'Flip Forward': '向前翻转',
'Flip Backward': '向后翻转',
'Flip Left': '左翻转',
'Flip Right': '右翻转',
'Slide Left': '左滑动',
'Slide Right': '右滑动',
'Wipe Up': '向上擦除',
'Wipe Down': '向下擦除',
'Wipe Left': '向左擦除',
'Wipe Right': '向右擦除',
'Wipe Diagonal': '对角擦除',
'Wipe Reverse Diagonal': '反对角擦除',
'Zoom In': '放大',
'Zoom Out': '缩小',
'Duration': '持续时间',
'Delay': '延迟',
'Threshold': '阈值',
'Normal': '正常',
'Replayable': '可重放',
'Automatically replay animation when this element is scrolled back into view.': '当此元素滚动回视图时自动重播动画。',
'Contents: On Visible': '内容:可见时',
'Performed on the contents of this element when it first becomes visible or scrolls into view.': '在此元素首次变得可见或滚动到视图时执行。',
'Apply visibility to contents': '应用可见性到内容',
'Allow the visibility of this element to trigger the "On Visible" animations of its contents.': '允许此元素的可见性触发其内容的“可见时”动画。',
'Performed when this element first becomes visible or scrolls into view.': '当此元素首次变得可见或滚动到视图时执行。',
'Section Break': '分节符',
'Header Marker': '页眉标记',
'Footer Marker': '页脚标记',
'Scroll Point': '滚动点',
'Show in Section View': '在节视图中显示',
'Name': '名称',
'Hide header': '隐藏页眉',
'If a header marker is present, hide all elements before it when this section is visible.': '如果存在页眉标记,当该节可见时隐藏其前面的所有元素。',
'Hide footer': '隐藏页脚',
'If a footer marker is present, hide all elements after it when this section is visible.': '如果存在页脚标记,当该节可见时隐藏其后面的所有元素。',
'Disable auto-scroll': '禁用自动滚动',
'Prevent the browser from scrolling to the top of the page when this section opens.': '防止浏览器在该节打开时滚动到页面顶部。',
'Exclude section': '排除节',
'Exclude this section (and all elements within it) from publishing.': '从发布中排除此节(及其所有元素)。',
'Redirect on open': '打开时重定向',
'Perform a delayed redirect to another section when this section opens.': '在此节打开时执行延迟重定向到另一节。',
'Margin': '边距',
'Behavior': '行为',
'Default behavior. Simply scroll to this point.': '默认行为。简单地滚动到此点。',
'Speed': '速度',
'Speed at which the browser will scroll to this point.': '浏览器滚动到此点的速度。',
'Offset': '偏移',
'Distance to offset the final scroll position.': '偏移最终滚动位置的距离。',
'Invisible': '不可见',
'Prevent this scroll point\'s name from appearing in the browser address bar when visited.': '防止访问时此滚动点的名称出现在浏览器地址栏中。',
'Style': '样式',
'Icon': '图标',
'Hover': '悬停',
'Shape': '形状',
'Square': '方形',
'Circle': '圆形',
'Triangle': '三角形',
'Label Alignment': '标签对齐',
'Pentagon': '五边形',
'Hexagon': '六边形',
'Octagon': '八边形',
'Diamond': '菱形',
'Star': '星形',
'Icons: On Hover': '图标:悬停时',
'Performed when an icon is hovered.': '当图标被悬停时执行。',
'Grow': '放大',
'Shrink': '缩小',
'Raise': '升高',
'Intensity': '强度',
'Lowest': '最低',
'Page': '页面',
'On Load': '加载时',
'Performed on this element when this site finishes loading.': '当此站点加载完成时在此元素上执行。',
'Wait': '等待',
'Until Loaded': '直到加载完成',
'Loader': '加载器',
'Bars': '条',
'Bouncing Dots': '弹跳点',
'Dots': '点',
'Spinner': '旋转器',
'Spinner (bars)': '旋转器(条)',
'Spinner (dots)': '旋转器(点)',
'Spinner (ring)': '旋转器(环)',
'On Section Change': '节更改时',
'Spacing': '间距',
'Center on next': '居中下一个',
'Align to previous': '对齐上一个',
'Settings': '设置',
'No settings available for this Control type.': '此控制类型无可用设置。',
'Border Color': '边框颜色',
'Minimal': '最小',
'Grid': '网格',
'Font': '字体(简体:Zc;Ma)(繁体:Del;Ha,pot,moc)',
'Weight': '粗细',
'Line Spacing': '行距',
'Letter Spacing': '字母间距',
'Lowercase': '小写',
'Uppercase': '大写',
'Small Caps': '小型大写',
'Headings': '标题',
'Rows': '行',
'Digits': '数字',
'Labels': '标签',
'Outline': '轮廓',
'Solid': '实心',
'Delimiters': '分隔符',
'Colons': '冒号',
'Lines': '线',
'Full': '全',
'Abbreviated': '缩写',
'Initialed': '首字母',
'Precision': '精度',
'Countdown': '倒计时',
'Countup': '正计时',
'Zone': '区域',
'Date': '日期',
'Time': '时间',
'Button': '按钮',
'Label': '标签',
'URL': '网址',
'On Click': '点击时',
'Shows a static grid of images.': '显示静态图像网格。',
'Mode': '模式',
'Improve load time by optimizing this gallery\'s images when necessary (recommended).': '通过在必要时优化此图库的图像来改善加载时间(推荐)。',
'Defer loading': '延迟加载',
'Improve load time by deferring or "lazy" loading when necessary (recommended).': '通过在必要时延迟或“懒惰”加载来改善加载时间(推荐)。',
'Protect': '保护',
'Mitigate attempts to copy or download this gallery\'s images.': '减轻复制或下载此图库图像的尝试。',
'Images': '图像',
'Captions': '字幕',
'Below': '下方',
'Fixed': '固定',
'Lightbox': '灯箱',
'Color Scheme': '配色方案',
'Light': '浅色',
'Dark': '深色',
'Allow navigation': '允许导航',
'Allow on mobile': '允许在移动设备上使用',
'Show controls on mobile': '在移动设备上显示控件',
'Show captions': '显示字幕',
'Let users navigate between lightbox images using controls, cursor keys, or swiping.': '让用户使用控件、光标键或滑动在灯箱图像之间导航。',
'Extend lightbox behavior to mobile screens.': '将灯箱行为扩展到移动屏幕。',
'Display captions beneath each lightbox image.': '在每个灯箱图像下方显示字幕。',
'Provide lightbox controls on mobile screens. Disabling this option will still allow swiping.': '在移动屏幕上提供灯箱控件。禁用此选项仍将允许滑动。',
'Shows a grid of thumbnails that enlarge to full size lightbox when clicked.': '显示一个缩略图网格,单击时放大到全尺寸灯箱。',
'Untitled': '无标题',
'Upload': '上传',
'Starting Time': '开始时间',
'Start video at this exact time (in MM:SS format).': '在这个确切时间开始视频(格式为MM:SS)。',
'Automatically play this video on load.': '加载时自动播放此视频。',
'Automatically replay this video when it ends.': '视频结束时自动重播。',
'Mute this video\'s audio track by default.': '默认静音此视频的音轨。',
'Display player controls by default.': '默认显示播放器控件。',
'Show player controls': '显示播放器控件',
'Mute audio': '静音',
'Loop playback': '循环播放',
'Autoplay': '自动播放',
'Accepts videos in MP4 format (up to 64MB). Note: only intended for short clips. Switch to Embed to use longer, higher quality videos.': '接受MP4格式的视频(最大64MB)。注意:仅适用于短片。切换到嵌入以使用更长、更高质量的视频。',
'Alt Text': '替代文本',
'Link URL': '链接网址',
'Scale': '缩放',
'Rectangle': '矩形',
'Automatically optimize this element for viewing on mobile screens (recommended).': '自动优化此元素以便在移动屏幕上查看(推荐)。',
'Zoom In Image': '放大图像',
'Zoom Out Image': '缩小图像',
'Focus Image': '聚焦图像',
'Brighten': '变亮',
'Colorize': '着色',
'Dim': '变暗',
'Monochrome': '单色',
'Unblur': '取消模糊',
'Undim': '取消变暗',
'Code': '代码',
'IFRAME': 'IFRAME',
'Inline': '内联',
'Hidden': '隐藏',
'Items': '项目',
'Bulleted': '项目符号',
'Numbered': '编号',
'Indent': '缩进',
'Max': '最大',
'Bullets': '项目符号',
'Cancel': '取消',
'Cancel (Light)': '取消(浅色)',
'Check': '检查',
'Check (Light)': '检查(浅色)',
'Chevron': '尖头',
'Chevron (Light)': '尖头(浅色)',
'Dash': '破折号',
'Dash (Light)': '破折号(浅色)',
'Dot': '点',
'Heart': '心',
'Plus': '加号',
'Plus (Light)': '加号(浅色)',
'Question': '问题',
'On Hover': '悬停时',
'Performed when this element is hovered.': '当悬停在此元素上时执行。',
'Improve load time by optimizing this image when necessary (recommended).': '通过在必要时优化此图像来改善加载时间(推荐)。',
'Mitigate attempts to copy or download this image.': '减轻复制或下载此图像的尝试。',
'Images: On Hover': '图像:悬停时',
'Single': '单一',
'Double': '双倍',
'Dashed': '虚线',
'Dotted': '点状',
'Waves': '波浪',
'Zigzag': '之字形',
'Diagonal': '对角线',
'Diagonal (reverse)': '反向对角线',
'Spirals': '螺旋',
'Hearts': '心形',
'Stars': '星形',
'Orientation': '方向',
'Thickness': '厚度',
'Link': '链接',
'Dividers': '分隔符',
'Line': '线',
'Row': '行',
'Column': '列',
'Order': '顺序',
'Transition': '过渡',
'Fade': '淡出',
'Crossfade': '交叉淡入淡出',
'Instant': '瞬时',
'Preserve aspect ratios': '保持纵横比',
'Prevent cropping by preserving each slideshow image\'s aspect ratio.': '通过保持每个幻灯片图像的纵横比来防止裁剪。',
'Improve load time by optimizing this slideshow\'s images when necessary (recommended).': '通过在必要时优化此幻灯片的图像来改善加载时间(推荐)。',
'Mitigate attempts to copy or download this slideshow\'s images.': '减轻复制或下载此幻灯片图像的尝试。',
'Aspect Ratio': '纵横比',
'Ignore': '忽略',
'Strict': '严格',
'Ignores this slideshow\'s aspect ratio.': '忽略此幻灯片的纵横比。',
'Strictly maintains this slideshow\'s aspect ratio.': '严格保持此幻灯片的纵横比。',
'Navigation': '导航',
'Circles': '圆形',
'Squares': '方形',
'Thickness': '厚度',
'Recipient Email': '收件人邮箱',
'Filter messages': '过滤消息',
'On Completion': '完成时',
'Displays the above message in an alert.': '在警报中显示上述消息。',
'Autofocus form': '自动对焦表单',
'Protect with reCAPTCHA': '使用reCAPTCHA保护',
'Collect UTM parameters': '收集UTM参数',
'Reset on section change': '在节更改时重置',
'Export variables': '导出变量',
'Enable debug mode': '启用调试模式',
'Contact': '联系',
'Signup ...': '注册 ...',
'Email': '电子邮件',
'Message': '消息',
'Company Name': '公司名称',
'Phone Number': '电话号码',
'Subject': '主题',
'Optional': '可选',
'Require Consent': '需要同意',
'Fields': '字段',
'Inputs': '输入',
'Span multiple lines': '跨多行',
'Allow longer labels to span multiple lines.': '允许较长的标签跨多行。',
'Label Only': '仅标签',
'Icon + Label': '图标 + 标签',
'Label + Icon': '标签 + 图标',
'Icon + Wide Label': '图标 + 宽标签',
'Wide Label + Icon': '宽标签 + 图标',
'Stripe Checkout': 'Stripe (钱包)',
'Gumroad': 'Gumroad(商铺)',
'Facebook Like': 'Facebook Like(社交)',
'PayPal': 'PayPal (钱包)',
'Typeform': 'Typeform(在线填表)',
'Product': '产品',
'Pay': '支付',
'Book': '预订',
'Donate': '捐赠',
'Subscribe': '订阅',
'Price ID': '价格ID',
'Button Label': '按钮标签',
'Require billing address': '需要账单地址',
'Require shipping address': '需要送货地址',
'Success URL': '成功URL',
'API Keys': 'API密钥',
'Publishable Key': '发布密钥',
'Secret Key': '秘密密钥',
'ID': 'ID',
'Classes': '类',
'Additional classes to apply to this element.': '应用于此元素的其他类。',
'Attributes': '属性',
'Visibility': '可见性',
'Stack': '堆叠',
'Stack (reverse)': '反向堆叠',
'Include tablet-sized screens': '包括平板大小的屏幕',
' Stack on top': ' 堆叠在顶部',
'Icon Size': '图标大小',
'Stagger': '错开',
'All': '全部',
'First Line': '第一行',
'Fade Color': '渐变颜色',
'Paragraph Spacing': '段落间距',
'Bold': '加粗',
'Caption': '标题',
'Link Style': '链接样式',
'Underlined': '带下划线的',
'Plain': '纯文本',
'Main Heading': '主标题',
'Subheading': '副标题',
'Element': '元素',
'This element\'s unique ID. Leave blank to use the auto-generated default (shown above).': '此元素的唯一ID。留空以使用自动生成的默认值(如上所示)。',
'Desktop Only': '仅限桌面',
'Mobile Only': '仅限移动设备',
'Exclude': '排除',
'Alignment': '对齐',
'Right': '右',
'Options': '选项',
'Use as spacer': '使用间隔',
'Defer': '延迟 ',
'tags': '标签',
'When placed in a': '当放置在 ',
'section': '独立章节',
', defer': ',延迟 ',
'tags until the section opens (recommended).': '标签直到章节打开(推荐)。',
'Folder': '文件夹',
'Assigns this site to the above folder (': '将此站点分配到上述文件夹(',
'learn more': '了解更多',
'Action': '操作',
'Description': '描述',
'A brief description of this site (and what\'s usually used in bookmarks, search engine listings, etc).': '对该站点的简要描述(通常用于书签、搜索引擎列表等)。',
'This site\'s title (and what gets shown at the top of the browser window).': '此站点的标题(显示在浏览器窗口顶部)。',
'Title': '标题',
'Publish': '发布',
'Serve fonts locally': '本地提供字体',
'Reduce motion if requested': '按需减少动画',
'Meta Tags': '元标签',
'Redirects': '重定向',
'Canonical URL': '规范网址',
'Browser Color': '浏览器颜色',
'Update Frequency': '更新频率',
'Indexing': '索引',
'Google Analytics ID': '谷歌分析ID',
'Password Protection': '密码保护',
'Language': '语言',
'Media': '媒体',
'Share Image': '分享图片',
'Use a backslash to prevent a character from being parsed as Markdown (eg.': '使用反斜杠防止字符被解析为Markdown(例如:',
'Non-Breaking\\sSpace': '不间断\\s',
'Line\\nBreak': '换行\\n',
'[Color text]{#colorcode}': '[颜色文本]{#颜色代码}',
'[Color text]{colorname}': '[颜色文本]{英文的颜色名称}',
'||Spoilers||': '||剧透||',
'^Superscript^': '^上标^',
'~Subscript~': '~下标~',
'==Highlight==': '==高亮==',
'~~Strike~~': '~~删除线~~',
'`Code`': '`代码`',
'[Link text](': '[链接文本](',
'any valid URL': '任何有效的URL',
'__Underline__': '__下划线__',
'***Bold Italic***': '***粗斜体***',
'_Italic_': '_斜体_',
'or': '或',
'*Italic*': '*斜体*',
'**Bold**': '**粗体**',
'Supports the following': '支持以下',
'formatting:': '格式:',
'Justify': '对齐边缘',
'Jan': '一月',
'Feb': '二月',
'Mar': '三月',
'Apr': '四月',
'May': '五月',
'Jun': '六月',
'Jul': '七月',
'Aug': '八月',
'Sep': '九月',
'Oct': '十月',
'Nov': '十一月',
'Dec': '十二月',
'Paragraph': '段落',
'Completion URL': '完成URL',
'Persistent': '持久性',
'Maintains duration between subsequent visits.': '保持后续访问之间的持续时间。',
'Days': '天',
'Hours': '小时',
'Minutes': '分钟',
'Show poster': '显示海报',
'Display this video\'s poster.': '显示此视频的海报。',
'Seconds': '秒',
'(Mobile)': '移动端',
'Buttons: On Hover': '按钮:悬停时',
'Button: On Hover': '按钮:悬停时',
'Return endpoint responses': '返回端点响应',
'Create Contact': '创建联系人',
'Add Contact to List': '添加联系人到列表',
'Add Contact to Automation': '添加联系人到自动化',
'Your ActiveCampaign': '你的 ActiveCampaign',
'The numeric ID of your Brevo list. Carrd will populate the following': '你的 Brevo 列表的数字 ID。Carrd 会填充以下',
'text attributes': '文本属性',
'if present:': '如果存在:',
'with this site\'s URL.': '使用此站点的 URL。',
'with this site\'s title.': '使用此站点的标题。',
'with this form\'s unique ID.': '使用此表单的唯一 ID。',
'Require double opt-in': '需要双重确认',
'Send new contacts a confirmation email before adding them to your list (': '在将新联系人添加到你的列表之前发送确认邮件(',
'Your SendFox account\'s': '你的 SendFox 帐户的',
'Subscriber Groups': '订阅者组',
'to apply to new subscribers (up to 5). If you\'re using MailerLite Classic, only the first group will apply.': '适用于新订阅者(最多 5 个)。如果你使用 MailerLite Classic,只有第一个组适用。',
'Add group …': '添加组...',
'The unique ID of your Beehiiv publication. Located under your Beehiiv account\'s Integrations tab (Publication Id → API V2). Carrd will populate the following': '你的 Beehiiv 出版物的唯一 ID。位于你的 Beehiiv 帐户的集成标签下(出版物 ID → API V2)。Carrd 会填充以下',
'Automation IDs': '自动化 ID',
'Send welcome email': '发送欢迎邮件',
'Company': '公司',
'Full Name': '全名',
'Stack on top': '堆叠在顶部'
};
// 替换函数,将英文文本替换为中文
function translateText(node) {
if (node.nodeType === Node.TEXT_NODE) {
let textContent = node.textContent.trim();
if (translationDict[textContent]) {
node.textContent = translationDict[textContent];
}
} else if (node.nodeType === Node.ELEMENT_NODE) {
node.childNodes.forEach(translateText);
}
}
// 初始翻译页面内容
function initialTranslation() {
document.querySelectorAll('#ui *').forEach(element => {
element.childNodes.forEach(translateText);
});
}
// 监听DOM变化
const observer = new MutationObserver(mutations => {
for (let mutation of mutations) {
mutation.addedNodes.forEach(node => {
if (node.nodeType === Node.ELEMENT_NODE && node.closest('#ui')) {
node.childNodes.forEach(translateText);
} else if (node.nodeType === Node.TEXT_NODE && node.parentNode.closest('#ui')) {
translateText(node);
}
});
}
});
// 配置MutationObserver
observer.observe(document.body, {
childList: true,
subtree: true
});
// 初始翻译页面内容
initialTranslation();
})();