正文
增加 4 行删除 3 行
12345678910113 行未改动15161718192021222324现在不是 ```AI``` 写的了,并且我修了个 ```BUG``````javascript// ==UserScript==// @name NFLSOJ Comment Helper// @namespace none// @version 0.0.2// @description NFLSOJ Comment Helper// @author Allen123456hello// @match http://www.nfls.com.cn:20035/article/*// @match http://192.168.188.77/article/*3 行未改动(function() {'use strict';const cur=window.location.pathname.split('/');var id=undefined;for (let i=1;i<cur.length;++i){if (cur[i]=='article'){if (cur.length>i+1){id=cur[i+1];}break;}}console.log(id);const replyhtml=`<form class="ui reply form" method="post" action="/article/${id}/comment"><div class="field"><textarea name="comment" class="markdown-edit"></textarea></div><div style="text-align: center; "><button id="submit_button" type="submit" class="ui labeled submit icon button"><i class="icon edit"></i> 回复</button></div></form>`;if (id){document.querySelector(".padding").insertAdjacentHTML("beforeend",replyhtml);}else{console.log("Unknown Error");}})();```12345678910113 行未改动1516171819202122232425把一个循环改了一下```javascript// ==UserScript==// @name NFLSOJ Comment Helper// @namespace none// @version 0.0.5// @description NFLSOJ Comment Helper// @author Allen123456hello// @match http://www.nfls.com.cn:20035/article/*// @match http://192.168.188.77/article/*3 行未改动(function() {'use strict';const cur=window.location.pathname.split('/');var id=undefined;for (let i=cur.length-1;i;--i){if ((i^1)&&(cur[i-1]=='article')){id=cur[i];break;}else if (cur[i]!=''){break;}}console.log(id);if (id=="0"||id==undefined){return;}const replyhtml=`<form class="ui reply form" method="post" action="/article/${id}/comment"><div class="field"><textarea name="comment" class="markdown-edit"></textarea></div><div style="text-align: center; "><button id="submit_button" type="submit" class="ui labeled submit icon button"><i class="icon edit"></i> 回复</button></div></form>`;if (id){document.querySelector(".padding").insertAdjacentHTML("beforeend",replyhtml);}else{console.log("Unknown Error");}})();```