您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Mở liên kết tại vị trí con trỏ chuột hiện tại trong thẻ mới bằng Ctrl + Shift + Z
- // ==UserScript==
- // @name Open Link Under Mouse - Ctrl+Shift+Z
- // @namespace http://tampermonkey.net/
- // @version 1.0
- // @description Mở liên kết tại vị trí con trỏ chuột hiện tại trong thẻ mới bằng Ctrl + Shift + Z
- // @author Bạn
- // @match *://*/*
- // @grant none
- // ==/UserScript==
- (function () {
- 'use strict';
- let currentElement = null;
- // Cập nhật phần tử dưới chuột
- document.addEventListener('mousemove', function (e) {
- currentElement = document.elementFromPoint(e.clientX, e.clientY);
- });
- // Lắng nghe tổ hợp phím Ctrl + Shift + Z
- document.addEventListener('keydown', function (e) {
- if (e.ctrlKey && e.shiftKey && e.code === 'KeyZ') {
- if (!currentElement) return;
- // Tìm phần tử là link gần nhất từ vị trí chuột
- let el = currentElement;
- while (el && el !== document.body) {
- if (el.tagName === 'A' && el.href) {
- window.open(el.href, '_blank');
- break;
- }
- el = el.parentElement;
- }
- }
- });
- })();