sashanew

КОД

Feb 25th, 2020
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="authoring-tool" content="Adobe_Animate_CC">
  6. <meta name="ad.size" content="width=728,height=90">
  7. <title>728X90</title>
  8. <script src="https://code.createjs.com/createjs-2015.11.26.min.js"></script>
  9. <script src="728X90.js"></script>
  10. <script>
  11. var canvas, stage, exportRoot;
  12. function init() {
  13. canvas = document.getElementById("canvas");
  14. images = images||{};
  15. var loader = new createjs.LoadQueue(false);
  16. loader.addEventListener("fileload", handleFileLoad);
  17. loader.addEventListener("complete", handleComplete);
  18. loader.loadManifest(lib.properties.manifest);
  19. }
  20. function handleFileLoad(evt) {
  21. if (evt.item.type == "image") { images[evt.item.id] = evt.result; }
  22. }
  23. function handleComplete(evt) {
  24. //This function is always called, irrespective of the content. You can use the variable "stage" after it is created in token create_stage.
  25. var queue = evt.target;
  26. var ssMetadata = lib.ssMetadata;
  27. for(i=0; i<ssMetadata.length; i++) {
  28. ss[ssMetadata[i].name] = new createjs.SpriteSheet( {"images": [queue.getResult(ssMetadata[i].name)], "frames": ssMetadata[i].frames} )
  29. }
  30. exportRoot = new lib._728X90();
  31. stage = new createjs.Stage(canvas);
  32. stage.addChild(exportRoot);
  33. stage.enableMouseOver();
  34. //Registers the "tick" event listener.
  35. createjs.Ticker.setFPS(lib.properties.fps);
  36. createjs.Ticker.addEventListener("tick", stage);
  37. //Code to support hidpi screens and responsive scaling.
  38. (function(isResp, respDim, isScale, scaleType) {
  39. var lastW, lastH, lastS=1;
  40. window.addEventListener('resize', resizeCanvas);
  41. resizeCanvas();
  42. function resizeCanvas() {
  43. var w = lib.properties.width, h = lib.properties.height;
  44. var iw = window.innerWidth, ih=window.innerHeight;
  45. var pRatio = window.devicePixelRatio, xRatio=iw/w, yRatio=ih/h, sRatio=1;
  46. if(isResp) {
  47. if((respDim=='width'&&lastW==iw) || (respDim=='height'&&lastH==ih)) {
  48. sRatio = lastS;
  49. }
  50. else if(!isScale) {
  51. if(iw<w || ih<h)
  52. sRatio = Math.min(xRatio, yRatio);
  53. }
  54. else if(scaleType==1) {
  55. sRatio = Math.min(xRatio, yRatio);
  56. }
  57. else if(scaleType==2) {
  58. sRatio = Math.max(xRatio, yRatio);
  59. }
  60. }
  61. canvas.width = w*pRatio*sRatio;
  62. canvas.height = h*pRatio*sRatio;
  63. canvas.style.width = w*sRatio+'px';
  64. canvas.style.height = h*sRatio+'px';
  65. stage.scaleX = pRatio*sRatio;
  66. stage.scaleY = pRatio*sRatio;
  67. lastW = iw; lastH = ih; lastS = sRatio;
  68. }
  69. })(false,'both',false,1);
  70. }
  71. </script>
  72. </head>
  73. <body onload="init();" style="margin:0px;">
  74. <canvas id="canvas" width="728" height="90" style="display: block; background-color:rgba(255, 255, 255, 1.00)"></canvas>
  75. <a id="click1_area" href="#" target="_blank" style="width: 728px; height: 90px;></a>
  76. <script>
  77. document.getElementById("click_area").href = yandexHTML5BannerApi.getClickURLNum(1);
  78. </script>
  79. </body>
  80. </html>
Add Comment
Please, Sign In to add comment