iKuai爱快流控路由

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 34545|回复: 80
打印 上一主题 下一主题

自己写的JS代码终于OK了,可躲过广告拦截软件的过滤

  [复制链接]
跳转到指定楼层
楼主
发表于 2015-1-18 19:05:42 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式
本帖最后由 9622315 于 2015-1-20 12:09 编辑

2015-01-20 修正了快速移动鼠标导致广告拖动失控的Bug,代码已更新。


折腾了整整三天,原来是转义字符在作怪,读心系统直接将用户提交的数据,发给后台程序做网页代码插入处理,
但JS代码中不免要包含一些特殊字符,对于后台程序来说这些字符需要做转义处理(用转义字符替代相应字符),
否则就是非法指令,但爱快的程序猿偷懒了,没有用代码处理这些字符,而是将相应转义翻译工作转嫁给了用户,
晕死了!!!小小的鄙视一下相关开发人员的工作态度,感觉有些责任心不强,工作明显不到位,代码问题多多。
今天看了技术员的回复,才知道有这个问题,现在手工转义这些字符后,再次提交代码,测试通过。

接下来就是该研究有些页面乱码的问题了,这个问题有些难度,初步分析,也是底层代码的问题,棘手呀!!!

经测试,我的代码可以成功躲过ADSafe、ADByBy等常见广告拦截软件的检查与过滤,并且也不存在元素命名Bug。

你可以用鼠标将广告在屏幕上随意拖动,也可以将其关闭(我挖了个小坑,直接点击x关闭不了,有个小技巧哦!)

本人美工不好,只会写代码,不会做美工设计,广告比较难看,如果强奸了你的眼睛,我在这里先赔个不是。

源代码如下:

  1. <script language="javascript" type="text/javascript">
  2. var pre_x;
  3. var pre_y;

  4. function do_move(obj)
  5. {
  6.   var offset_x=pre_x-event.screenX;
  7.   var offset_y=pre_y-event.screenY;
  8.   var x=obj.style.right.substr(0,obj.style.right.length-2)-0; x+=offset_x;
  9.   var y=obj.style.bottom.substr(0,obj.style.bottom.length-2)-0; y+=offset_y;
  10.   obj.style.right=x+"px";
  11.   obj.style.bottom=y+"px";
  12.   pre_x=event.screenX;
  13.   pre_y=event.screenY;
  14. }

  15. function do_down(obj)
  16. {
  17.   pre_x=event.screenX;
  18.   pre_y=event.screenY;
  19.   obj.onmousemove=function(){do_move(obj);};
  20.   obj.onmouseup=function(){obj.onmousemove=null;};
  21.   obj.onmouseout=function(){obj.onmousemove=null;};
  22. }

  23. document.writeln("<table style="width: 120px; height: 200px; right: 1px; bottom: 1px; z-index: 10000; background-color: #99CCFF; position: fixed;" cellspacing="0" cellpadding="0"  onmousedown="do_down(this)">");
  24. document.writeln("  <tr><td style="height: 14px; text-align: right;"><font title="关闭" style="font-family:\'CommercialPi BT\'; font-size: 14px; background-color: #FFFFFF; cursor: hand;" onclick="if (event.ctrlKey) this.parentNode.parentNode.parentNode.parentNode.style.display=\'none\';">(</font></td></tr>");
  25. document.writeln("  <tr><td style="height: 43px; background-image: url(\'http://www.ikuai8.com/img/logo-big.png\'); background-repeat: no-repeat; background-color: #FFFFFF;">&nbsp;</td></tr>");
  26. document.writeln("  <tr>");
  27. document.writeln("    <td style="height: 143px; background-color: #99CCFF; vertical-align: middle;">");
  28. document.writeln("      <p style="font-size: 19px; font-weight: bold;">请贵司在一周内结清尾款。</p>");
  29. document.writeln("      <p style="font-size: 14px;">联系电话:1234567<br>联 系 人:北京老九</p>");
  30. document.writeln("    </td>");
  31. document.writeln("  </tr>");
  32. document.writeln("</table>");
  33. </script>
复制代码

发到读心中,需要转义所有特殊字符,并且还要删除所有的回车换行,进行缩排处理,处理后的代码如下
  1. <script language="javascript" type="text/javascript">var pre_x;var pre_y;function do_move(obj){ var offset_x=pre_x-event.screenX; var offset_y=pre_y-event.screenY; var x=obj.style.right.substr(0,obj.style.right.length-2)-0; x+=offset_x; var y=obj.style.bottom.substr(0,obj.style.bottom.length-2)-0; y+=offset_y; obj.style.right=x+"px"; obj.style.bottom=y+"px"; pre_x=event.screenX; pre_y=event.screenY;}function do_down(obj){ pre_x=event.screenX; pre_y=event.screenY; obj.onmousemove=function(){do_move(obj);}; obj.onmouseup=function(){obj.onmousemove=null;};  obj.onmouseout=function(){obj.onmousemove=null;};}document.writeln("<table style=\"width: 120px; height: 200px; right: 1px; bottom: 1px; z-index: 10000; background-color: \#99CCFF; position: fixed;\" cellspacing=\"0\" cellpadding=\"0\"  onmousedown=\"do_down(this)\">");document.writeln("  <tr><td style=\"height: 14px; text-align: right;\"><font title=\"关闭\" style=\"font-family:\\'CommercialPi BT\\'; font-size: 14px; background-color: \#FFFFFF; cursor: hand;\" onclick=\"if (event.ctrlKey) this.parentNode.parentNode.parentNode.parentNode.style.display=\\'none\\';\">(</font></td></tr>");document.writeln("  <tr><td style=\"height: 43px; background-image: url(\\'http://www.ikuai8.com/img/logo-big.png\\'); background-repeat: no-repeat; background-color: \#FFFFFF;\">&nbsp;</td></tr>");document.writeln("  <tr>");document.writeln("    <td style=\"height: 143px; background-color: \#99CCFF; vertical-align: middle;\">");document.writeln("      <p style=\"font-size: 19px; font-weight: bold;\">请贵司在一周内结清尾款。</p>");document.writeln("      <p style=\"font-size: 14px;\">电 话:1234567<br>联系人:北京老九</p>");document.writeln("    </td>");document.writeln("  </tr>");document.writeln("</table>");</script>
复制代码

插入后的效果如下:

这是用鼠标将广告拖动后的效果,页面刚打开时,默认是在屏幕的右下角显示。

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏63 支持支持 反对反对
推荐
 楼主| 发表于 2015-1-19 12:01:32 | 只看该作者
过两天,抽时间,做一个有简单模板,用户填写简单的输出信息,就能自动生成代码的辅助工具。
69#
发表于 2018-6-28 10:55:49 | 只看该作者
给楼主点个赞  
感谢楼主分享哦。收益匪浅啊
68#
发表于 2018-6-28 09:41:55 | 只看该作者
67#
发表于 2018-4-17 13:44:31 | 只看该作者
66#
发表于 2017-12-26 11:14:56 | 只看该作者
对付甲方的一个办法
65#
发表于 2017-12-26 10:58:49 | 只看该作者
写点3.0版本的代码
64#
发表于 2015-10-9 17:05:36 | 只看该作者
期待。。。。。
63#
发表于 2015-10-9 15:40:44 | 只看该作者
我放上之后会有乱码的情况哦,用的是爱快的2.5.6

点评

老早的代码了,只是抛砖引玉。  发表于 2015-10-14 01:02
62#
发表于 2015-10-9 13:34:24 | 只看该作者
这个用在用户到期通知比官方那个强制性的好多了!
61#
发表于 2015-10-9 07:48:46 来自手机访问 | 只看该作者
我只看看,不说话,谢谢楼主,辅助工具开发出来了吗?万众等着呢
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|论坛规章制度|iKuai Inc. ( 京ICP备13042604号 )

GMT+8, 2024-5-30 11:39

Powered by Discuz! X3.3

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表