Skip to content

Linux下指定网站禁用鼠标中键粘贴 | Disable middle mouse button paste for a specified website on Linux.

License

Notifications You must be signed in to change notification settings

wearzdk/middle-button-no-paste

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

middle-button-no-paste

Linux下指定网站禁用鼠标中键粘贴 | Disable middle mouse button paste for a specified website on Linux.

简体中文 / English

鼠标中键粘贴是非常实用的功能,我们无需因为一两个应用的兼容性问题而禁用它。

这个项目的目的是在浏览器中禁用指定网站上的鼠标中键粘贴功能,例如即时设计、MasterGo等设计类应用。

这是一个浏览器脚本,你可以使用油猴脚本猫等来安装运行它。

代码如下:

// ==UserScript==
// @name         禁用鼠标中键粘贴
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Linux下指定网站禁用鼠标中键粘贴
// @author       Wear_lz
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  // 在此处设定你要禁用中键粘贴的网站
  const targetWebsites = ['example.com', 'mastergo.com', 'js.design'];

  const currentWebsite = window.location.hostname;

  if (targetWebsites.includes(currentWebsite)) {
      document.addEventListener('mouseup', function(event){
          if(event.button === 1){
              event.preventDefault();
              return false;
          }
      });
  }
})();

复制上面的代码,在油猴/脚本猫中新建粘贴,修改你要禁用的网站即可。

About

Linux下指定网站禁用鼠标中键粘贴 | Disable middle mouse button paste for a specified website on Linux.

Topics

Resources

License

Stars

Watchers

Forks