Greasy Fork

Greasy Fork is available in English.

修复NGA论坛shift+方向键失效的bug

Fix the bug that prevents users from selecting text with Shift and arrow keys on NGA forum

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         修复NGA论坛shift+方向键失效的bug
// @namespace    通过微软new bing AI实现,对话见https://sl.bing.net/jevLvKdJjNs
// @version      1.0
// @description  Fix the bug that prevents users from selecting text with Shift and arrow keys on NGA forum
// @match        *://bbs.nga.cn/*
// @match        *://ngabbs.com/*
// @match        *://nga.178.com/*
// @grant        none
// ==/UserScript==

//获取原来的postfunc.inputchar函数
var originalInputChar = postfunc.inputchar;

//重写postfunc.inputchar函数
postfunc.inputchar = function(e,o) {
  //如果用户按下的是Shift或者Ctrl或者Alt键,就不执行后面的操作
  if (e.shiftKey || e.ctrlKey || e.altKey) return;

  //如果用户按下的是方向键,也不执行后面的操作
  if (e.keyCode >= 37 && e.keyCode <= 40) return;

  //调用原来的postfunc.inputchar函数
  originalInputChar.call(this, e, o);
}