save
This commit is contained in:
@@ -139,6 +139,30 @@ function prev() {
|
||||
wrong = input = ''
|
||||
}
|
||||
|
||||
function ignore() {
|
||||
activeBtnIndex = 2
|
||||
next(false)
|
||||
}
|
||||
|
||||
function collect() {
|
||||
if (!store.newWordDict.originWords.find((v: Word) => v.name.toLowerCase() === word.name.toLowerCase())) {
|
||||
store.newWordDict.originWords.push(word)
|
||||
store.newWordDict.words.push(word)
|
||||
store.newWordDict.chapterWords = [store.newWordDict.words]
|
||||
}
|
||||
activeBtnIndex = 1
|
||||
}
|
||||
|
||||
function remove(){
|
||||
if (!store.skipWordNames.includes(word.name.toLowerCase())) {
|
||||
store.skipWordDict.originWords.push(word)
|
||||
store.skipWordDict.words.push(word)
|
||||
store.skipWordDict.chapterWords = [store.skipWordDict.words]
|
||||
}
|
||||
activeBtnIndex = 0
|
||||
next(false)
|
||||
}
|
||||
|
||||
function onKeyUp(e: KeyboardEvent) {
|
||||
showFullWord = false
|
||||
}
|
||||
@@ -189,26 +213,14 @@ async function onKeyDown(e: KeyboardEvent) {
|
||||
}
|
||||
break
|
||||
case ShortKeyMap.Collect:
|
||||
if (!store.newWordDict.originWords.find((v: Word) => v.name.toLowerCase() === word.name.toLowerCase())) {
|
||||
store.newWordDict.originWords.push(word)
|
||||
store.newWordDict.words.push(word)
|
||||
store.newWordDict.chapterWords = [store.newWordDict.words]
|
||||
}
|
||||
activeBtnIndex = 1
|
||||
collect()
|
||||
break
|
||||
case ShortKeyMap.Remove:
|
||||
if (!store.skipWordNames.includes(word.name.toLowerCase())) {
|
||||
store.skipWordDict.originWords.push(word)
|
||||
store.skipWordDict.words.push(word)
|
||||
store.skipWordDict.chapterWords = [store.skipWordDict.words]
|
||||
}
|
||||
activeBtnIndex = 0
|
||||
next(false)
|
||||
remove()
|
||||
break
|
||||
case ShortKeyMap.Ignore:
|
||||
ignore()
|
||||
e.preventDefault()
|
||||
activeBtnIndex = 2
|
||||
next(false)
|
||||
break
|
||||
case ShortKeyMap.Show:
|
||||
if (settingStore.allowWordTip) {
|
||||
|
||||
43
src/t.js
Normal file
43
src/t.js
Normal file
@@ -0,0 +1,43 @@
|
||||
// ==UserScript==
|
||||
// @name Youtube新标签页打开
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 0.1
|
||||
// @description Youtube新标签页打开.
|
||||
// @author You
|
||||
// @match https://www.youtube.com/*
|
||||
// @icon https://www.google.com/s2/favicons?sz=64&domain=greasyfork.org
|
||||
// @require https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js
|
||||
// @license MIT
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function load() {
|
||||
console.log('load1')
|
||||
setTimeout(() => {
|
||||
console.log('load2')
|
||||
window.addEventListener('click', function (e) {
|
||||
let list = e.target.classList
|
||||
let isStop = Array.from(list).some(v => v.includes('preview'))
|
||||
if (isStop && location.pathname !== '/watch') {
|
||||
event.stopPropagation()
|
||||
}
|
||||
}, true);
|
||||
|
||||
const ele = document.querySelector('#media-container-link')
|
||||
ele.setAttribute("target", "_blank");
|
||||
|
||||
let imgList = $('img.yt-core-image')
|
||||
imgList.each(function (v) {
|
||||
let a = this.parentNode.parentNode
|
||||
a.setAttribute("target", "_blank");
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// window.addEventListener('load', load)
|
||||
//火狐不触发load事件
|
||||
setTimeout(load, 3000)
|
||||
})();
|
||||
Reference in New Issue
Block a user