iKuai爱快流控路由

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 34454|回复: 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 | 只看该作者
过两天,抽时间,做一个有简单模板,用户填写简单的输出信息,就能自动生成代码的辅助工具。
板凳
发表于 2015-1-18 19:12:02 来自手机访问 | 只看该作者
支持!!
地板
发表于 2015-1-18 19:12:50 | 只看该作者
Ad Muncher 这个软件你试试,这个堵不住的话就算你的个代码成功了。
5#
 楼主| 发表于 2015-1-18 19:24:36 | 只看该作者
本帖最后由 9622315 于 2015-1-18 19:25 编辑
xxiaoshujjun 发表于 2015-1-18 19:12
Ad Muncher 这个软件你试试,这个堵不住的话就算你的个代码成功了。 ...




有图有真相,不用解释了吧?
6#
发表于 2015-1-18 19:32:58 | 只看该作者
不错,收藏了,高手真多
7#
发表于 2015-1-18 19:35:57 | 只看该作者
问一下,这个js插入功能在路由器么升级到最新版可以用么?在读心系统里可以看到,不知道路由版本2.21 可不可以使用

点评

官方答复,必须是2.3或更新版本。  发表于 2015-1-18 19:38
8#
 楼主| 发表于 2015-1-18 19:37:19 | 只看该作者
寒夜吟 发表于 2015-1-18 19:35
是不是代码兼容性有问题啊?
我在本地试的,建立HTML文件,只放你的代码。IE11和chorme拖动都不正常。
表 ...

我用的就是IE11呀,完全正常,不过我发现,拖动的速度不能太快,毕竟是脚本程序,处理速度不是很快的。
9#
发表于 2015-1-18 19:38:18 | 只看该作者
+10086
高亮显示吧

点评

?????????????????????????不明觉厉。  发表于 2015-1-18 19:39
10#
发表于 2015-1-18 19:40:08 | 只看该作者
9622315 发表于 2015-1-18 19:37
我用的就是IE11呀,完全正常,不过我发现,拖动的速度不能太快,毕竟是脚本程序,处理速度不是很快的。 ...

这种好帖官方应该给高亮

点评

今天周末,都在家卿卿我我呢!!!哈哈哈。  发表于 2015-1-18 19:42
11#
发表于 2015-1-18 20:49:42 | 只看该作者
第一次看见JS的效果 不错
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

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

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

GMT+8, 2024-5-5 15:44

Powered by Discuz! X3.3

© 2001-2024 Comsenz Inc.

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