Disable artificial selections

Tries to prevent script-initiated selection tweaks.

  1. // ==UserScript==
  2. // @name Disable artificial selections
  3. // @description Tries to prevent script-initiated selection tweaks.
  4. // @namespace http://eldar.cz/myf/
  5. // @license MIT
  6. // @version 1.0.4
  7. // @run-at document-start
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. Selection.prototype.addRange = function () {
  12. console.warn('This Selection method is deliberately disabled by user.');
  13. }
  14.  
  15. HTMLTextAreaElement.prototype.select =
  16. HTMLInputElement.prototype.select =
  17. function(){
  18. console.warn('Forced artificial selection of',this,'value is deliberately disabled by user. Focusing instead.');
  19. this.focus();
  20. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址