Skip to content

Instantly share code, notes, and snippets.

@iplus26
Last active May 6, 2019 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iplus26/c8f12477548a7d709e1fa45440c96489 to your computer and use it in GitHub Desktop.
Save iplus26/c8f12477548a7d709e1fa45440c96489 to your computer and use it in GitHub Desktop.
一个 Tampermonkey 脚本来防止腾讯视频劫持 Chrome 快捷键
// ==UserScript==
// @name tencent-video-give-my-hotkey-back
// @description 一个 Tampermonkey 脚本来防止腾讯视频劫持 Chrome 快捷键
// @include https://v.qq.com/*
// @include http://v.qq.com/*
// @version 0.0.4
// ==/UserScript==
!(function() {
$(function() {
setTimeout(function() {
const evts = $._data(document.body, 'events')
if (evts.keydown && Array.isArray(evts.keydown)) {
evts.keydown.forEach( ev => {
if (typeof ev.handler === 'function') {
const fn = ev.handler.toString()
if (fn.match(/.*inArray.*inArray.*preventDefault/)) {
console.info( "腾讯视频这个函数" + fn + "被我干掉了 :P" )
$('body').off('keydown', ev.handler);
}
}
})
}
}, 1000)
})
})();
@iplus26
Copy link
Author

iplus26 commented May 6, 2019

  1. 安装 Tampermonkey
  2. 👆 点 "Raw" 安装

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment