ad-ms1459.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. var cloudad_type = 'ms1459';
  2. var cloudad_urls = [
  3. 'http://ad.csdn.net/adsrc/ibm-q3-bluemix-bbs-innerpage-banner-475-60-30k.swf'
  4. ];
  5. var cloudad_clks = [
  6. ''
  7. ];
  8. var can_swf = (function () {
  9. if (document.all) swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
  10. else if (navigator.plugins) swf = navigator.plugins["Shockwave Flash"];
  11. return !!swf;
  12. })();
  13. function cloudad_show() {
  14. var rd = Math.random();
  15. var ad_url, log_url;
  16. if (rd < 0.65 && can_swf) {
  17. ad_url = cloudad_urls[0];
  18. log_url = 'http://ad.csdn.net/log.ashx';
  19. log_url += '?t=view&adtype=' + cloudad_type + '&adurl=' + encodeURIComponent(ad_url);
  20. cloudad_doRequest(log_url, true);
  21. }
  22. if (rd < 0) {
  23. ad_url = cloudad_clks[0];
  24. log_url = 'http://ad.csdn.net/log.ashx';
  25. log_url += '?t=click&adtype=' + cloudad_type + '&adurl=' + encodeURIComponent(ad_url);
  26. cloudad_doRequest(log_url, true);
  27. }
  28. }
  29. function cloudad_doRequest(url, useFrm) {
  30. var e = document.createElement(useFrm ? "iframe" : "img");
  31. e.style.width = "1px";
  32. e.style.height = "1px";
  33. e.style.position = "absolute";
  34. e.style.visibility = "hidden";
  35. if (url.indexOf('?') > 0) url += '&r_m=';
  36. else url += '?r_m=';
  37. url += new Date().getMilliseconds();
  38. e.src = url;
  39. document.body.appendChild(e);
  40. }
  41. setTimeout(function () {
  42. cloudad_show();
  43. }, 1000);