[DEBUG] 网页内容编辑模式 (DesignMode)

通过右键菜单快速切换 designMode 状态,详见 https://developer.mozilla.org/zh-CN/docs/Web/API/Document/designMode

目前为 2021-09-25 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name [DEBUG] Web Content Editing Mode (DesignMode)
  3. // @name:zh-CN [DEBUG] 网页内容编辑模式 (DesignMode)
  4. // @version 1.1.3.20210925
  5. // @namespace laster2800
  6. // @author Laster2800
  7. // @description Quickly turn designMode on/off via the context menu, see https://developer.mozilla.org/en-US/docs/Web/API/Document/designMode
  8. // @description:zh-CN 通过右键菜单快速切换 designMode 状态,详见 https://developer.mozilla.org/zh-CN/docs/Web/API/Document/designMode
  9. // @homepageURL https://gf.qytechs.cn/zh-CN/scripts/430949
  10. // @supportURL https://gf.qytechs.cn/zh-CN/scripts/430949/feedback
  11. // @license LGPL-3.0
  12. // @include *
  13. // @grant none
  14. // @run-at context-menu
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. 'use strict'
  19.  
  20. const target = top.document.designMode === 'on' ? 'off' : 'on'
  21. const executed = new Set()
  22. const exec = win => {
  23. if (executed.has(win)) return
  24. try {
  25. executed.add(win)
  26. win.document.designMode = target
  27. for (let i = 0; i < win.frames.length; i++) {
  28. exec(win.frames[i])
  29. }
  30. } catch { /* cross-origin frame */ }
  31. }
  32. exec(top)
  33. })()

QingJ © 2025

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