Enables right-click functionality to open links in a new tab on HyperWriteAI Personal Assistant.
目前為
// ==UserScript==
// @namespace https://greasyfork.org/zh-CN/users/106222-qxin-i
// @name HyperWriteAI Right-Click Fix
// @author KweenAsh
// @description Enables right-click functionality to open links in a new tab on HyperWriteAI Personal Assistant.
// @version 1.0
// @license MIT
// @match https://app.hyperwriteai.com/personalassistant
// @grant GM_addStyle
// ==/UserScript==
(function() {
'use strict';
// Add CSS to override right-click restrictions
GM_addStyle(`
body {
-webkit-user-select: auto !important;
-moz-user-select: auto !important;
-ms-user-select: auto !important;
user-select: auto !important;
}
a {
cursor: pointer !important;
}
`);
// Override right-click restrictions
document.addEventListener('contextmenu', function(e) {
e.preventDefault();
// Create a new link element
const link = document.createElement('a');
link.href = e.target.href;
link.target = '_blank';
// Create a new tab
const tab = window.open(link.href, '_blank');
// Focus on the new tab
tab.focus();
});
})();