Last active
May 6, 2019 12:32
-
-
Save iplus26/c8f12477548a7d709e1fa45440c96489 to your computer and use it in GitHub Desktop.
一个 Tampermonkey 脚本来防止腾讯视频劫持 Chrome 快捷键
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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) | |
}) | |
})(); |
Author
iplus26
commented
May 6, 2019
- 安装 Tampermonkey
- 👆 点 "Raw" 安装
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment