簡體   English   中英

保持與 Tampermonkey designMode 的活動鏈接?

[英]Maintain active links with Tampermonkey designMode on?

我在 Tampermonkey 創建了一個腳本,我可以在其中更改任何網站。

這是我的腳本:

    // ==UserScript==
// @name         Edit any Website
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match      *://*/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==
(function() {
    'use strict';
    // javascript:document.body.contentEditable = 'true' ;
    document.designMode='on' ;
    void 0
})();

但我的問題是,當我點擊超鏈接/鏈接時,什么也沒有發生,但輸入字段出現(這實際上是這個腳本的重點),但我希望輸入字段僅在我不點擊鏈接時出現(所以打開我點擊的鏈接應該是正常的)。 這可能嗎?有人可以幫我調整一下嗎?

你已經嘗試過這樣的事情嗎?

    // ==UserScript==
// @name         Edit any Website
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match      *://*/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==
(function () {
    'use strict';
    // javascript:document.body.contentEditable = 'true' ;
    document.designMode = 'on';

    document.querySelectorAll('a').forEach((a) => {
        a.addEventListener('click', (e) => {
            location = e.currentTarget.href;
        })
    })
})();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM