Advertisement.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. 广告使用区域
  3. */
  4. Namespace.register("U.UF.DL.C.AD"); //桌面广告命名空间
  5. //#region 百度广告
  6. /*
  7. * 百度异步加载
  8. *
  9. * @param {string} 广告id
  10. */
  11. U.UF.DL.C.AD.onloadBaiduJs = function (baiduid) {
  12. U.UF.DL.asynLoadJs({ "src": "//hm.baidu.com/hm.js?" + baiduid }); //加载广告
  13. }
  14. /*
  15. * 百度异步加载
  16. *
  17. * @param {string} 广告位置id
  18. * @param {string} 广告id
  19. */
  20. U.UF.DL.C.AD.baidu = function (elementid, baiduid) {
  21. if (baiduid) { //异步加载
  22. U.UF.DL.asynLoadJs({ type: "text/javascript", src: "http://cbjs.baidu.com/js/m.js" },
  23. function () {
  24. U.UF.DL.C.AD.asynBaidu(elementid, baiduid);
  25. }); //异步加载
  26. }
  27. }
  28. /*
  29. * 异步广告
  30. *
  31. * @param {string} 广告位置id
  32. * @param {string} 广告id
  33. */
  34. U.UF.DL.C.AD.asynBaidu = function (elementid, code) {
  35. BAIDU_CLB_fillSlotAsync(code, elementid);
  36. }
  37. //#endregion
  38. //#region
  39. /*
  40. * 异步阿里妈妈广告
  41. *
  42. * @param {string} 广告位置id
  43. */
  44. U.UF.DL.C.AD.alimama = function (obj) {
  45. //阿里巴巴官网实例
  46. var i,
  47. _aliobj = window.alimamatk_onload = window.alimamatk_onload || [];
  48. if (Array.isArray(obj)) {
  49. for (i = 0; i < obj.length; i++) {
  50. U.UF.DL.C.AD.alimama(obj[i]);
  51. }
  52. }
  53. else {
  54. _aliobj.push(U.UF.C.isObject(obj) ? obj : (obj = { pid: obj, appkey: "", unid: "", type: "click" }));
  55. } //加载广告
  56. if (!window.alimamatk_show) {
  57. U.UF.DL.asynLoadJs({ type: "text/javascript", id: obj.pid, charset: "gbk", async: true, src: "http://a.alimama.cn/tkapi.js" });
  58. }
  59. }
  60. /*
  61. * 阿里妈妈广告异步
  62. *
  63. * @param {string} 广告位置id
  64. */
  65. U.UF.DL.C.AD.asynAlimama = function (el, id) {
  66. $$("a", { style: { "display": "none!important" }, id: "tanx-a-" + id }, el); //显示元素
  67. U.UF.DL.asynLoadJs({ type: "text/javascript", id: "tanx-s-" + id, async: true,
  68. charset: "gbk", async: true, src: "http://p.tanx.com/ex?i=" + id
  69. }); //加载广告
  70. }
  71. //#endregion