1function addEvent(obj, evtType, func, cap) { 2 cap = cap || false; 3 if (obj.addEventListener) { 4 obj.addEventListener(evtType, func, cap); 5 return true; 6 } else if (obj.attachEvent) { 7 if (cap) { 8 obj.setCapture(); 9 return true; 10 } else { 11 return obj.attachEvent("on" + evtType, func); 12 } 13 } else { 14 return false; 15 } 16 } 17 function getPageScroll() { 18 var xScroll, yScroll; 19 if (self.pageXOffset) { 20 xScroll = self.pageXOffset; 21 } else if (document.documentElement && document.documentElement.scrollLeft) { 22 xScroll = document.documentElement.scrollLeft; 23 } else if (document.body) { 24 xScroll = document.body.scrollLeft; 25 } 26 if (self.pageYOffset) { 27 yScroll = self.pageYOffset; 28 } else if (document.documentElement && document.documentElement.scrollTop) { 29 yScroll = document.documentElement.scrollTop; 30 } else if (document.body) { 31 yScroll = document.body.scrollTop; 32 } 33 arrayPageScroll = new Array(xScroll, yScroll); 34 return arrayPageScroll; 35 } 36 function GetPageSize() { 37 var xScroll, yScroll; 38 if (window.innerHeight && window.scrollMaxY) { 39 xScroll = document.body.scrollWidth; 40 yScroll = window.innerHeight + window.scrollMaxY; 41 } else if (document.body.scrollHeight > document.body.offsetHeight) { 42 xScroll = document.body.scrollWidth; 43 yScroll = document.body.scrollHeight; 44 } else { 45 xScroll = document.body.offsetWidth; 46 yScroll = document.body.offsetHeight; 47 } 48 var windowWidth, windowHeight; 49 if (self.innerHeight) { 50 windowWidth = self.innerWidth; 51 windowHeight = self.innerHeight; 52 } else if (document.documentElement && document.documentElement.clientHeight) { 53 windowWidth = document.documentElement.clientWidth; 54 windowHeight = document.documentElement.clientHeight; 55 } else if (document.body) { 56 windowWidth = document.body.clientWidth; 57 windowHeight = document.body.clientHeight; 58 } 59 if (yScroll < windowHeight) { 60 pageHeight = windowHeight; 61 } else { 62 pageHeight = yScroll; 63 } 64 if (xScroll < windowWidth) { 65 pageWidth = windowWidth; 66 } else { 67 pageWidth = xScroll; 68 } 69 arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight) 70 return arrayPageSize; 71 } 72 var AdMoveConfig = new Object(); 73 AdMoveConfig.IsInitialized = false; 74 AdMoveConfig.ScrollX = 0; 75 AdMoveConfig.ScrollY = 0; 76 AdMoveConfig.MoveWidth = 0; 77 AdMoveConfig.MoveHeight = 0; 78 AdMoveConfig.Resize = function () { 79 var winsize = GetPageSize(); 80 AdMoveConfig.MoveWidth = winsize[2]; 81 AdMoveConfig.MoveHeight = winsize[3]; 82 AdMoveConfig.Scroll(); 83 } 84 AdMoveConfig.Scroll = function () { 85 var winscroll = getPageScroll(); 86 AdMoveConfig.ScrollX = winscroll[0]; 87 AdMoveConfig.ScrollY = winscroll[1]; 88 } 89 addEvent(window, "resize", AdMoveConfig.Resize); 90 addEvent(window, "scroll", AdMoveConfig.Scroll); 91 function AdMove(id) { 92 if (!AdMoveConfig.IsInitialized) { 93 AdMoveConfig.Resize(); 94 AdMoveConfig.IsInitialized = true; 95 } 96 var obj = document.getElementById(id); 97 obj.style.position = "absolute"; 98 obj.style.visibility = "visible"; 99 var W = AdMoveConfig.MoveWidth - obj.offsetWidth; 100 var H = AdMoveConfig.MoveHeight - obj.offsetHeight; 101 var x = W * Math.random(), y = H * Math.random(); 102 var rad = (Math.random() + 1) * Math.PI / 6; 103 var kx = Math.sin(rad), ky = Math.cos(rad); 104 var dirx = (Math.random() < 0.5 ? 1 : -1), diry = (Math.random() < 0.5 ? 1 : -1); 105 var step = 1; 106 var interval; 107 this.SetLocation = function (vx, vy) { x = vx; y = vy; } 108 this.SetDirection = function (vx, vy) { dirx = vx; diry = vy; } 109 obj.CustomMethod = function () { 110 obj.style.left = (x + AdMoveConfig.ScrollX) + "px"; 111 obj.style.top = (y + AdMoveConfig.ScrollY) + "px"; 112 rad = (Math.random() + 1) * Math.PI / 6; 113 W = AdMoveConfig.MoveWidth - obj.offsetWidth; 114 H = AdMoveConfig.MoveHeight - obj.offsetHeight; 115 x = x + step * kx * dirx; 116 if (x < 0) { dirx = 1; x = 0; kx = Math.sin(rad); ky = Math.cos(rad); } 117 if (x > W) { dirx = -1; x = W; kx = Math.sin(rad); ky = Math.cos(rad); } 118 y = y + step * ky * diry; 119 if (y < 0) { diry = 1; y = 0; kx = Math.sin(rad); ky = Math.cos(rad); } 120 if (y > H) { diry = -1; y = H; kx = Math.sin(rad); ky = Math.cos(rad); } 121 } 122 this.Run = function () {
123 var delay = 20; 124 interval = setInterval(obj.CustomMethod, delay); 125 obj.onmouseover = function () { clearInterval(interval); } 126 obj.onmouseout = function () { interval = setInterval(obj.CustomMethod, delay); } 127 } 128 }
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.