20180813:如果今天有时间的话咱打算把剩下的功能补一下……如果有时间的话……
嗯,完美!steam,启动!
工作原理是给_ajaxget()加上遇到ccdefend修改cookie时用eval()代替evalscript()并重新装填请求。
存在并且不准备修复的问题- 重载窗体时会有表单重复提交的警告
- 会重载许多次
- 模拟真实浏览器所以没限制请求频率,有概率被服务器认为是
doss和docc攻击 - 这边并不清楚悬浮的回复窗口需要重新获取哪些关键字,并未修复,需要回复指定楼层依旧推荐右键在新标签页打开
- 这段改动对其他功能的附带影响都属于意外,这段脚本只修评分的功能……
- 附件预览图没修复,因为这不是这段脚本需要完成的任务
使用的时机
源代码- // {
- // "date": "2018-08-10-v1",
- // "desc": "往_ajaxget函数多塞了一段判断ccdefend出现时的处理逻辑,改动过的地方应该都加上了注释,原始的_ajaxget代码来自discuz"
- // }
- function _ajaxget(url, showid, waitid, loading, display, recall) {
- waitid = typeof waitid == 'undefined' || waitid === null ? showid : waitid;
- var x = new Ajax();
- x.setLoading(loading);
- x.setWaitId(waitid);
- x.display = typeof display == 'undefined' || display == null ? '' : display;
- x.showId = $(showid);
- if (url.substr(strlen(url) - 1) == '#') {
- url = url.substr(0, strlen(url) - 1);
- x.autogoto = 1;
- }
- var __url = url; // save original url
- var url = url + '&inajax=1&ajaxtarget=' + showid;
- x.get(url, function(s, x) {
- var evaled = false;
- if (s.indexOf('; document.cookie=\'ccdefend=\'+v+\'; path=/\'; window.location.reload();') != -1) {
- s = s.replace(' window.location.reload();',''); // prevent redirecting
- // console.log(s); // debug only
- eval(s); // to be optimized
- _ajaxget(__url, showid, waitid, loading, display, recall); // reload window
- }
- if (s.indexOf('ajaxerror') != -1) {
- evalscript(s);
- evaled = true;
- }
- if (!evaled && (typeof ajaxerror == 'undefined' || !ajaxerror)) {
- if (x.showId) {
- x.showId.style.display = x.display;
- ajaxinnerhtml(x.showId, s);
- ajaxupdateevents(x.showId);
- if (x.autogoto) scroll(0, x.showId.offsetTop);
- }
- }
- ajaxerror = null;
- if (recall && typeof recall == 'function') {
- recall();
- } else if (recall) {
- eval(recall);
- }
- if (!evaled) evalscript(s);
- });
- }
- function checkpostrule(showid, extra) {
- var x = new Ajax();
- x.get('forum.php?mod=ajax&action=checkpostrule&inajax=yes&' + extra, function(s) {
- if (s.indexOf('; document.cookie=\'ccdefend=\'+v+\'; path=/\'; window.location.reload();') != -1) {
- s = s.replace(' window.location.reload();', ''); // prevent redirecting
- eval(s); // to be optimized
- checkpostrule(showid, extra); // reload window
- }
- ajaxinnerhtml($(showid), s);
- evalscript(s);
- });
- }
- function checkpostrule_post(theform) {
- if (!seccodecheck && !secqaacheck && !theform.sechash) {
- var x = new Ajax();
- x.get('forum.php?mod=ajax&action=checkpostrule&ac=' + postaction + '&inajax=yes', function (s) {
- if (s) {
- if (s.indexOf('; document.cookie=\'ccdefend=\'+v+\'; path=/\'; window.location.reload();') != -1) {
- s = s.replace(' window.location.reload();', ''); // prevent redirecting
- eval(s); // to be optimized
- checkpostrule_post(theform); // reload window
- }
- ajaxinnerhtml($('seccheck'), s);
- evalscript(s);
- seccodecheck = true;
- } else {
- postsubmit(theform);
- }
- });
- } else {
- postsubmit(theform);
- }
- }
复制代码 压缩过的书签- javascript:function _ajaxget(url,showid,waitid,loading,display,recall){waitid=typeof waitid=='undefined'||waitid===null?showid:waitid;var x=new Ajax();x.setLoading(loading);x.setWaitId(waitid);x.display=typeof display=='undefined'||display==null?'':display;x.showId=$(showid);if(url.substr(strlen(url)-1)=='#'){url=url.substr(0,strlen(url)-1);x.autogoto=1}var __url=url;var url=url+'&inajax=1&ajaxtarget='+showid;x.get(url,function(s,x){var evaled=false;if(s.indexOf('; document.cookie=\'ccdefend=\'+v+\'; path=/\'; window.location.reload();')!=-1){s=s.replace(' window.location.reload();','');eval(s);_ajaxget(__url,showid,waitid,loading,display,recall)}if(s.indexOf('ajaxerror')!=-1){evalscript(s);evaled=true}if(!evaled&&(typeof ajaxerror=='undefined'||!ajaxerror)){if(x.showId){x.showId.style.display=x.display;ajaxinnerhtml(x.showId,s);ajaxupdateevents(x.showId);if(x.autogoto)scroll(0,x.showId.offsetTop)}}ajaxerror=null;if(recall&&typeof recall=='function'){recall()}else if(recall){eval(recall)}if(!evaled)evalscript(s)})}
复制代码 |