复制以下代码到 chrome 的 console 。高手勿喷,插件勿喷。
window.location.href = 'https://www.v2ex.com/t/' + (Number(document.location.href.replace(/https:\/\/www\.v2ex\.com\/t\/(\d?)/i, '$1'))+1)
复制以下代码到 chrome 的 console 。高手勿喷,插件勿喷。
window.location.href = 'https://www.v2ex.com/t/' + (Number(document.location.href.replace(/https:\/\/www\.v2ex\.com\/t\/(\d?)/i, '$1'))+1)
回复里有大神,学习他们的,所以也可以用
location.pathname.substring()
|
yhxxOct 25, 2016
1
Number('$1') 是想做什么
|
|
yhxxOct 25, 2016
2
哦看错了
还以为是有一个新的“ theme ” |
|
timorOct 25, 2016
3
404 错误.
|
|
4
@yhxx Number 是 js 里的将 string 转为 数字
$1 是字符转换的时候的正则表达式里的 分开写是 ```javascript var urlBase = 'https://www.v2ex.com/t/'; var urlNow = document.location.href; var nextNum = Number(urlNow.replace(/https:\/\/www\.v2ex\.com\/t\/(\d?)/i, '$1')) + 1; var url = urlBase + nextNum; window.location.href = url ``` |
|
5
@timor 哦哦 因为没有下一个主题了,你可以找一个老一点的主题比如: https://www.v2ex.com/t/1 在这个页面试试。
|
|
6
其实就是想骗点铜币而已,(逃
|
|
ahuOct 25, 2016
7
404: Not Found
|
|
dofyOct 25, 2016
8
简单点可以直接操作 location.pathname
|
|
yhxxOct 25, 2016
11
|
|
imgalaxyOct 25, 2016
13
location.pathname="/t/"+(location.href.split(/[/#]/)[4]-(-1))
|
|
imgalaxyOct 25, 2016
14
第二个 pathname 换成 href 还能再短 4 个字符
|
|
imgalaxyOct 25, 2016
16
location.href=location.href.split(/[/#]/)[4]*1+1
最终版 不摸鱼了 继续写代码 |
|
tpsxiongOct 26, 2016 via iPhone
17
。。为啥不手动改地址栏?
|