Typora无需破解就能去掉弹出的激活框 - junlin623 - 博客园 (cnblogs.com)

一 ,先看这篇文章把开头的弹窗去掉

不过最新版直接去掉会有一个报错,加个延时就行了

<script>

        setTimeout(function () {

            window.close()

}, 10);

</script>

二,去除下面的未激活标签

1,找到window.html

2,在<head>标签下加入下面 的css样式

	<style type="text/css">
		/* 选择 body 下一级的所有具有 role="button" 的 div,但排除那些在 content 内部的 div[role="button"] */
		/* body > div[role="button"]:not(content div[role="button"]) 存在冗余 */
		/* body > div[role="button"] 已经限定了选择 body 的直接子元素 div,并且这些 div 具有 role="button" 属性。 */
		/* :not(content div[role="button"]) 试图排除某些元素,但由于 content div[role="button"] 不是 body 的直接子元素,这部分实际上没有效果。 */
		body>div[role="button"] {
			clip-path: inset(100%);
            transform: scale(0);
		}
	</style>

3, 到此就全部完成了。


三,这一步就不用做了,它和二的作用是一样的,但二更好用。

1,打开安装typora的目录,进去找到window文件夹。

2,打开window文件夹,编辑frame.js文件

3,在最底部添加如下代码

原理是基础的js,通过遍历找到未激活标签,然后隐藏。

延时是为了先加载出标签。

setTimeout(function () {
    console.log('0.6s后消除');
    for (var i = 0; i < document.body.children.length ; i++) {
       // if (document.body.children[i].textContent.includes('未激活 ×')) {
          if (document.body.children[i].textContent == '未激活 ×') {  //评论区同学的建议
            document.body.children[i].style.display = 'none';
            break;
        }
    }
}, 600); 

或者这样写,不过,如果你写的内容里有<div  role="button" >  </div> 这个标签的话,会误删。

setTimeout(function () {
    console.log('0.6s后消除');

    document.querySelector('div[role="button"]').style.display = 'none'; 
    
}, 600); 

更多推荐