1var headlines = headlines != null ? headlines : new Array(); 2 3if (typeof(rollHeadlines) == "undefined") 4 function rollHeadlines() { 5 for ( var i = 0; i < headlines.length; i++ ) { 6 headlines[i].init(); 7 headlines[i].id = i; 8 } 9 startRoll(); 10 } 11 12if (typeof(startRoll) == "undefined") 13 function startRoll() { 14 for ( var i = 0; i < headlines.length; i++ ) 15 setTimeout("headlines[ " + i + "].run()", eval("headlines[i].C_Speed")); 16 } 17 18 19 20 21/** Class Headline 22* 23*/ 24function Headline(layerId) { 25 this.C_TopOffset = 0; 26 this.C_LeftOffset = 0; 27 this.C_Speed = 0 28 this.C_Height = 0; 29 this.C_Width = 0; 30 this.C_Spacing = 0; 31 this.C_EndSpace = 0; // TODO : implement this 32 this.C_Wait = 0; 33 34 this.layerId = layerId; 35 this.layer = null; 36 this.quotes = new Array(); 37 this.direction = null; 38 this.id = 0; // The position in headlines global array 39 this.initialNrOfQuotes = 0; 40 41 this.init = function init() { 42 this.layer = this.getLayer(); 43 44 var pOfL = document.getElementById(this.layerId).parentNode; 45 var nn = pOfL.nodeName.toLowerCase(); 46 var lyr = null; 47 48 if (nn == "a") { 49 lyr = pOfL.parentNode; 50 } else if (nn == "div") { 51 lyr = pOfL; 52 } 53 if (lyr && (lyr.id.indexOf("NOFNewsTicker") == 0)) { 54 try { 55 var pname = 'position'; 56 var ret = ""; 57 if ( document.defaultView && document.defaultView.getComputedStyle ) { 58 var computedStyle = document.defaultView.getComputedStyle( lyr, null ); 59 ret = computedStyle.getPropertyValue( pname ); 60 } else if ( lyr.currentStyle ) { 61 ret = lyr.currentStyle[ pname ]; 62 } 63 if (ret == 'relative') { 64 setObjectStyleProperty(lyr, 'position','static'); 65 } 66 } catch(e) { 67 //trace(e.message); 68 } 69 } 70 71 this.C_Height = isNaN(parseInt(this.layer.style.height))?parseInt(this.layer.scrollHeight)+0:parseInt(this.layer.style.height) + 0; 72 this.C_Width = isNaN(parseInt(this.layer.style.height))?parseInt(this.layer.scrollWidth)+0:parseInt(this.layer.style.width) + 0; 73 this.C_Speed = Math.pow(10-getDivCustomProperty(this.layer, "speed", true) + 1, 2); 74 this.C_Spacing = getDivCustomProperty(this.layer, "spacing", true); 75 this.C_Wait = getDivCustomProperty(this.layer, "wait", true); 76 this.C_EndSpace = getDivCustomProperty(this.layer, "endSpace", true); 77 this.direction = getDivCustomProperty(this.layer, "drct", false); 78 79 this.initPosition(); 80 this.initContent(); 81 } 82 83 /** 84 * Duplicate quotes to fill in headline content 85 */ 86 this.initContent = function initContent() { 87 var initialNrOfQuotes = this.layer.getElementsByTagName("div").length; 88 eval("this.initForRoll" + this.direction + "()"); 89 var linesList = this.layer.getElementsByTagName("div"); 90 if (linesList && linesList.length) 91 for (var i = 0; i < linesList.length; i++) { 92 var quote = linesList.item(i); 93 if (quote) { 94 this.quotes[i] = eval("new Quote" + this.direction + "(quote, this)"); 95 } 96 97 // Inspect space after all initial quotes are rolled 98 if ( ( i + 1 ) % initialNrOfQuotes == 0) 99 this.quotes[i].C_EndSpace = this.C_EndSpace; 100 else 101 this.quotes[i].C_EndSpace = 0; 102 103 this.quotes[i].init(); 104 } 105 106 this.quotes[0].isRolling = true; 107 } 108 109 this.initForRollUp = function() { 110 var imgList = this.layer.getElementsByTagName("img"); 111 var imgLgt = imgList.length; 112 var pos1 = findObjectTopOffset(imgList.item(0)); 113 var pos2 = imgLgt >
113 1 ? findObjectTopOffset(imgList.item(imgLgt - 1)) : 114 this.C_TopOffset; 115 116 var diff = imgLgt > 1 ? (pos2 - pos1) : (pos1 - pos2); 117 118 // Duplicate the lines to ensure that no white spaces will appear 119 var content = this.layer.innerHTML; 120 121 if (diff < this.C_Height) { 122 var x = this.C_Height/diff; 123 for (var i = 0; i < parseInt(x) + 1; i++) 124 this.layer.innerHTML += content; 125 } else if (!(diff < 1)) 126 this.layer.innerHTML += content; 127 } 128 129 this.initForRollLeft = function() { 130 var imgList = this.layer.getElementsByTagName("img"); 131 var imgLgt = imgList.length; 132 var pos1 = findObjectLeftOffset(imgList.item(0)); 133 var pos2 = imgLgt > 1 ? findObjectLeftOffset(imgList.item(imgLgt - 1)) : 134 this.C_LeftOffset; 135 136 var diff = imgLgt > 1 ? (pos2 - pos1) : (pos1 - pos2); 137 var content = this.layer.innerHTML; 138 139 if (diff < this.C_Width) { 140 var x = parseInt(this.C_Width/diff) + 1; 141 for (var i = 0; i <= x ; i++) 142 this.layer.innerHTML += content; 143 } else 144 this.layer.innerHTML += content; 145 } 146 147 this.initPosition = function initPosition() { 148 this.C_TopOffset = findObjectTopOffset(this.getReperTop()); 149 this.C_LeftOffset = findObjectLeftOffset(this.getReperTop()); 150 151 setObjectStyleProperty(this.layer, "width", this.C_Width); 152 setObjectStyleProperty(this.layer, "height", this.C_Height); 153 } 154 155 156 this.run = function run() { 157 var quotes = this.quotes; 158 var length = quotes.length; 159 160 var quoteOnTop = false; 161 if (quotes[0].isRolling) { 162 quotes[0].rollLine(); 163 164 if (!quoteOnTop) 165 quoteOnTop = quotes[0].isOnTop(); 166 } 167 168 if (length > 1) { 169 var rollFirstQuote = false; 170 for (var i = 1; i < length; i++) { 171 if (quotes[i - 1].isAbove() || quotes[i].isRolling) { 172 quotes[i].rollLine(); 173 174 if (!quoteOnTop) 175 quoteOnTop = quotes[i].isOnTop(); 176 } 177 } 178 179 if (quotes[length - 1].isAbove()) 180 quotes[0].rollLine(); 181 } 182 183 this.quotes = quotes; 184 185 if (!quoteOnTop) 186 setTimeout("headlines[ " + this.id + "].run()", eval("headlines[this.id].C_Speed")) 187 else 188 setTimeout("headlines[ " + this.id + "].run()", eval("this.C_Wait * 1000")); 189 } 190 191 this.getReperTop = function getReperTop() { 192 return document.getElementById("reperTop_" + this.layerId); 193 } 194 195 this.getReperBottom = function getReperBottom() { 196 return document.getElementById("reperBottom_" + this.layerId); 197 } 198 199 this.getDirection = function getDirection() { 200 return this.direction; 201 } 202 203 this.getLayer = function getLayer() { 204 return document.getElementById(this.layerId); 205 } 206 207 208 // Add this headline to gloabal Array of headlines 209 headlines[headlines.length] = this; 210}// End Headline class
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.