飞书伴侣

Force the document to be opened on the current tab

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

// ==UserScript==
// @name         飞书伴侣
// @name:en      Feishu Partner
// @namespace    https://jasonlam.cc
// @version      0.1.4
// @description:    目前支持强制当前页面打开文档
// @description:en    Force the document to be opened on the current tab
// @author       JasonLamv-t
// @match        *://*.feishu.cn/*
// @icon         https://image-lake.oss-cn-hangzhou.aliyuncs.com/feishu_logo.svg
// @require      http://code.jquery.com/jquery-latest.js
// @grant        none
// @home-url   https://gf.qytechs.cn/zh-TW/scripts/14178
// @home-url2  https://github.com/langren1353/GM_script
// @homepageURL  https://gf.qytechs.cn/zh-TW/scripts/14178
// @copyright  2015-2022, AC
// @lastmodified  2022-04-08
// @feedback-url  https://github.com/langren1353/GM_script
// @description Force the document to be opened on the current tab
// ==/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))) {
        e.stopPropagation();
      }
    },
    true
  );
})();

QingJ © 2025

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