Another 说: 在超展开点主楼两个链接还是会打开新网页,不知道有没有可能解决。
document.querySelectorAll("a.l").forEach((a,i) => { if(a.href.match(/#post_\d+/)){ a.href = a.href.match(/#post_\d+/); a.target = "_self"; } });
Cedar 说: 这样写能支持超展开么? 因为我担心影响别的链接 所以故意加了一堆限制
君寻 说: 能支持超展开 不过我忘了要匹配一下是不是在原页面了,超展开的url还有点不同
if(document.location.href.match(/(group|topic|ep|blog|comments|character)\/(\d+)/)){ document.querySelectorAll("a.l").forEach((a,i) => { if(a.href.match(/#post_\d+/)){ if(a.href.match(/(\d+)#post_/)[1] == document.location.href.match(/(group|topic|ep|blog|comments|character)\/(\d+)/)[2]){ a.href = a.href.match(/#post_\d+/); a.target = "_self"; } } }); }
君寻 说: if(document.location.href.match(/(group|topic|ep|blog|comments|character)\/(\d+)/)){ &nb...
Cedar 说: 什么是mediawiki? 是什么感觉?
OH_toothache 说: 就是。比如说维基百科之类的网站。都是mediawiki的。里面很常见会用到页内跳转链接
Cedar 说: 喔..其实很多网站都会的 页首目录什么的 挺常见的
OH_toothache 说: 不。那些链接很好康。只有维基的像你楼上的一样很简朴
有什么组件能做到影响超展开右侧内容的么? 要是有的话应该就有办法..
原来超展开的bug早就修好了啊..
因为我担心影响别的链接 所以故意加了一堆限制
不过我忘了要匹配一下是不是在原页面了,超展开的url还有点不同
啊..又要改了
这样应该就没问题了
不过我已经弄出来了..想不到这么简单一个组件也能这么复杂..
(另外我不是很喜欢用match..所以没有采用b38)
简单点好 写复杂了占资源多 播放动画效果还浪费时间..