Force same tab for Feishu-强制飞书当前标签打开文档

Force the document to be opened on the current tab

目前为 2022-06-07 提交的版本。查看 最新版本

// ==UserScript==
// @name         Force same tab for Feishu-强制飞书当前标签打开文档
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  Force the document to be opened on the current tab
// @author       JasonLamv-t
// @match        *://*.feishu.cn/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @require      http://code.jquery.com/jquery-latest.js
// @grant        none
// ==/UserScript==

/*
强制在当前标签页打开文档,对于飞书文档网页App用处比较大
*/

(function () {
  console.log('Force same tab work for ');

  document.addEventListener(
    'click',
    (e) => {
      const anchorElements = [...document.getElementsByTagName('a')];
      anchorElements.forEach((a) => {
        a.target = '_self';
      });
      if (e.path.some((p) => anchorElements.includes(p))) {
        console.log('work');
        e.stopPropagation();
      }
    },
    true
  );
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址