HyperWriteAI Right-Click Fix

Enables right-click functionality to open links in a new tab on HyperWriteAI Personal Assistant.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==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.2
// @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();
        // Get the link element
        const linkElement = e.target.closest('a');
        if (!linkElement) return;
        // Get the link URL
        const linkUrl = linkElement.href;
        // Open the link in a new tab
        chrome.tabs.create({ url: linkUrl, active: true });
    });
})();