微信文章编辑器查看源码

在微信图文编辑器里面加入直接查看和编辑HTML的功能

  1. // ==UserScript==
  2. // @name 微信文章编辑器查看源码
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description 在微信图文编辑器里面加入直接查看和编辑HTML的功能
  6. // @author Rika
  7. // @match https://mp.weixin.qq.com/cgi-bin/appmsg*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. 'use strict';
  13.  
  14. let fixed_frame = '<textarea style="position: fixed;left:0;bottom: 0;z-index: 1000;" id="code-area"></textarea>'
  15. $('body').append($(fixed_frame))
  16. fixed_frame = $('#code-area')
  17. let last_refresh = new Date(), last_edit = new Date()
  18. fixed_frame[0].oninput = () => {
  19. last_edit = new Date()
  20. }
  21. setInterval(() => {
  22. try {
  23. if (last_edit > last_refresh)
  24. UE.instants["ueditorInstant0"].setContent(fixed_frame.val())
  25. else
  26. fixed_frame.val(UE.instants["ueditorInstant0"].getContent())
  27. last_refresh = new Date()
  28. } catch (e) {
  29. }
  30. }, 500)
  31. })();

QingJ © 2025

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