您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Vocabulary to Anki Cards.
当前为
// ==UserScript== // @name Vocabulary Builder // @namespace derjoker // @version 0.0.1 // @description Vocabulary to Anki Cards. // @author Feng Ya // @match https://www.duden.de/rechtschreibung/* // @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js // ==/UserScript== ;(function () { 'use strict' // Your code here... /* global $ */ const host = window.location.host console.log(host) let stem, word if (host === 'www.duden.de') { const names = window.location.pathname.split('/') stem = names[names.length - 1] word = $('section#block-system-main > h1') .text() .replace(/\u00AD/g, '') const section = $('h2:contains("Bedeutungsübersicht")').parents('section') section.find('ol > li > a').each((_, a) => { const definition = $(a) .text() .trim() const href = $(a).attr('href') // $(href).prepend('<input type="checkbox" />') $(href) .find('.term-section') .each((_, el) => { const b = $(el).find('h3:contains("Beispiel") + span') b.prepend( $('<input type="checkbox" />').data('kvb', { definition, example: b.text().trim() }) ) const w = $(el).find( 'h3:contains("Wendungen, Redensarten, Sprichwörter") + span' ) const clone = w.parent().clone() clone.find('h3').remove() w.prepend( $('<input type="checkbox" />').data('kvb', { definition, example: clone.text().trim() }) ) $(el) .find('ul > li') .each((_, li) => { const example = $(li) .text() .trim() $(li).prepend( $('<input type="checkbox" />').data('kvb', { definition, example }) ) }) }) }) } $('input:checkbox').click(event => { const data = $(event.target).data('kvb') console.log(host, stem, word, data) if (event.target.checked) { // Add } else { // Remove } }) })()