fixure.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. function PCMSAD(PID) {
  2. this.ID = PID;
  3. this.PosID = 0;
  4. this.ADID = 0;
  5. this.ADType = "";
  6. this.ADName = "";
  7. this.ADContent = "";
  8. this.PaddingLeft = 0;
  9. this.PaddingTop = 0;
  10. this.Width = 0;
  11. this.Height = 0;
  12. this.IsHitCount = "Y";
  13. this.Scroll = "N";
  14. this.Align = "N";
  15. this.UploadFilePath = "";
  16. this.URL = "";
  17. this.SiteID = 0;
  18. this.ShowAD = showADContent;
  19. this.Stat = statAD;
  20. }
  21. function statAD() {
  22. var new_element = document.createElement("script");
  23. new_element.type = "text/javascript";
  24. new_element.src="{APP_PATH}index.php?m=poster&c=index&a=show&siteid="+this.SiteID+"&id="+this.ADID+"&spaceid="+this.PosID;
  25. document.body.appendChild(new_element);
  26. }
  27. var delta=0.08
  28. function showADContent() {
  29. var content = this.ADContent;
  30. var str = "<div id='PCMSAD_"+this.PosID+"' style='left:"+this.PaddingLeft+"px;top:"+this.PaddingTop+"px;width:"+this.Width+"px; height:"+this.Height+"px; position: absolute;visibility: visible;z-index:999998;'>";
  31. var AD = eval('('+content+')');
  32. if (this.ADType == "images") {
  33. if (AD.Images[0].imgADLinkUrl) str += "<a href='"+this.URL+"?m=poster&c=index&a=poster_click&siteid="+this.SiteID+"&id="+this.ADID+"&url="+AD.Images[0].imgADLinkUrl+"' target='_blank'>";
  34. str += "<img title='"+AD.Images[0].imgADAlt+"' src='"+this.UploadFilePath+AD.Images[0].ImgPath+"' width='"+this.Width+"' height='"+this.Height+"' style='border:0px;'>";
  35. if (AD.Images[0].imgADLinkUrl) str += "</a>";
  36. }else if(this.ADType == "flash"){
  37. str += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='"+this.Width+"' height='"+this.Height+"' id='FlashAD_"+this.PosID+"' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'>";
  38. str += "<param name='movie' value='"+this.UploadFilePath+AD.Images[0].ImgPath+"' />";
  39. str += "<param name='quality' value='autohigh' />";
  40. str += "<param name='wmode' value='opaque'/>";
  41. str += "<embed wmode='opaque' src='"+this.UploadFilePath+AD.Images[0].ImgPath+"' quality='autohigh' name='flashad' swliveconnect='TRUE' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='"+this.Width+"' height='"+this.Height+"'></embed>";
  42. str += "</object>";
  43. }
  44. str += "<div style='text-align:right;'><a href='#;' onclick='javascript:document.getElementById(\"PCMSAD_"+this.PosID+"\").style.display=\"none\"'>关闭</a></div>";
  45. str += "</div>";
  46. document.write(str);
  47. setInterval("playFixureAD(\""+this.Align+"\",\"PCMSAD_"+this.PosID+"\")",10);
  48. }
  49. function playFixureAD(Align,ADID){
  50. var followObj = document.getElementById(ADID);
  51. var followObj_x = 0;
  52. var followObj_y = 0;
  53. var Cwidth = document.compatMode == "BackCompat" ? document.body.clientWidth : document.documentElement.clientWidth;
  54. var CHeight = document.compatMode == "BackCompat" ? document.body.clientHeight : document.documentElement.clientHeight;
  55. if(Align=="Y"){
  56. followObj_x = parseInt((Cwidth/2)-(followObj.clientWidth/2));
  57. followObj_y = parseInt((CHeight/2)-(followObj.clientHeight/2));
  58. if(followObj.offsetLeft!=(document.documentElement.scrollLeft+followObj_x)) {
  59. var dx=(document.documentElement.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
  60. dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
  61. followObj.style.left=(followObj.offsetLeft+dx)+"px";
  62. }
  63. if(followObj.offsetTop!=(document.documentElement.scrollTop+followObj_y)) {
  64. var dy=(document.documentElement.scrollTop+followObj_y-followObj.offsetTop)*delta;
  65. dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
  66. followObj.style.top=(followObj.offsetTop+dy)+"px";
  67. }
  68. }
  69. }
  70. var cmsAD_{$spaceid} = new PCMSAD('cmsAD_{$spaceid}');
  71. cmsAD_{$spaceid}.PosID = {$spaceid};
  72. cmsAD_{$spaceid}.ADID = {$p_id};
  73. cmsAD_{$spaceid}.ADType = "{$p_type}";
  74. cmsAD_{$spaceid}.ADName = "{$p_name}";
  75. cmsAD_{$spaceid}.ADContent = "{'Images':[{'imgADLinkUrl':'{urlencode($p_setting[1]['linkurl'])}','imgADAlt':'{$p_setting[1]['alt']}','ImgPath':'<?php echo $p_type=='images' ? $p_setting[1]['imageurl'] : $p_setting[1]['flashurl'];?>'}],'imgADLinkTarget':'New','Count':'1','showAlt':'Y'}";
  76. cmsAD_{$spaceid}.URL = "{APP_PATH}index.php?m=poster&c=index";
  77. cmsAD_{$spaceid}.SiteID = {$siteid};
  78. cmsAD_{$spaceid}.PaddingLeft = {if $space_setting['paddleft']} {$space_setting['paddleft']} {else}0{/if};
  79. cmsAD_{$spaceid}.PaddingTop = {if $space_setting['paddtop']} {$space_setting['paddtop']} {else}0{/if};
  80. cmsAD_{$spaceid}.Scroll = '{if $space_setting['align']}Y{else}N{/if}';
  81. cmsAD_{$spaceid}.Align = '{if $space_setting['align']}Y{else}N{/if}';
  82. cmsAD_{$spaceid}.Width = {$width};
  83. cmsAD_{$spaceid}.Height = {$height};
  84. cmsAD_{$spaceid}.UploadFilePath = "";
  85. cmsAD_{$spaceid}.ShowAD();
  86. var isIE=!!window.ActiveXObject;
  87. if (isIE){
  88. if (document.readyState=="complete"){
  89. cmsAD_{$spaceid}.Stat();
  90. } else {
  91. document.onreadystatechange=function(){
  92. if(document.readyState=="complete") cmsAD_{$spaceid}.Stat();
  93. }
  94. }
  95. } else {
  96. cmsAD_{$spaceid}.Stat();
  97. }