html 多行替换 Greasemonkey

问题描述

试图替换页面中的部分 html 代码。不幸的是,这些部分是多行的,我不能使用特定的 div ids/class,因为它们在其他地方的同一页面中使用(无法更改,不是我的错)

例如:

<div class="c2c" style="display: none;">
  <div class="left" style="height:12px;">
    <span >A test</span>
  </div>

即有中断和空格..

我已经试过了

document.body.innerHTML= document.body.innerHTML.replace(/<div class=\"c2c\" style=\"display: none;\">(\r\n|\r|\n)?\s*<div class=\"left\" style=\"height:12px;\">(\r\n|\r|\n)?\s*<span >A test<\/span>/g,"<div class=\"c2c\" style=\"display: block !important;\"><div class=\"left\" style=\"height:12px;\"><span >A test<\/span>");

还有一些其他的变化,但没有结果..

有什么想法吗?

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)