1/*------------------------------------------------------------------------ 2# JA Teline for Joomla 1.5 - Version 1.4 - Licence Owner JA49953 3# ------------------------------------------------------------------------ 4# Copyright (C) 2004-2008 J.O.O.M Solutions Co., Ltd. All Rights Reserved. 5# @license - Copyrighted Commercial Software 6# Author: J.O.O.M Solutions Co., Ltd 7# Websites: http://www.joomlart.com - http://www.joomlancers.com 8# This file may not be redistributed in whole or significant part. 9-------------------------------------------------------------------------*/ 10var currentFontSize = 4; 11 12function switchTool (ckname, val) { 13 createCookie(ckname, val, 365); 14 window.location.reload(); 15} 16function addMouseOver (className) { 17 objs = getElementsByClass (className, document, 'DIV'); 18 if (objs){ 19 for (i=0; i<objs.length; i++){ 20 objs[i].onmouseover=function() { 21 this.className+=" hover"; 22 } 23 objs[i].onmouseout=function() { 24 this.className=this.className.replace(new RegExp(" hover\\b"), ""); 25 } 26 27 } 28 } 29} 30function switchFontSize (ckname,val){ 31 var bd = $E('BODY'); 32 switch (val) { 33 case 'inc': 34 if (CurrentFontSize+1 < 7) { 35 bd.removeClass('fs'+CurrentFontSize); 36 CurrentFontSize++; 37 bd.addClass('fs'+CurrentFontSize); 38 } 39 break; 40 case 'dec': 41 if (CurrentFontSize-1 > 0) { 42 bd.removeClass('fs'+CurrentFontSize); 43 CurrentFontSize--; 44 bd.addClass('fs'+CurrentFontSize); 45 } 46 break; 47 default: 48 bd.removeClass('fs'+CurrentFontSize); 49 CurrentFontSize = val; 50 bd.addClass('fs'+CurrentFontSize); 51 } 52 Cookie.set(ckname, CurrentFontSize,{duration:365}); 53} 54 55function revertStyles(fontsize){ 56 currentFontSize = fontsize; 57 changeFontSize(0); 58} 59 60function changeFontSize(sizeDifference){ 61 //get css font size 62 var rule = getRuleByName("body.fs" + (currentFontSize + sizeDifference)); 63 if (rule){ 64 document.body.style.fontSize = rule.style.fontSize; 65 currentFontSize = currentFontSize + sizeDifference; 66 createCookie("FontSize", currentFontSize, 365); 67 equalHeight(); 68 } 69 return; 70}; 71 72function getRuleByName(ruleName){ 73 for (i=0; i<document.styleSheets.length; i++){ 74 var style = document.styleSheets[i]; 75 var rules = style.cssRules?style.cssRules:style.rules; 76 if (rules){ 77 for (j = 0; j<rules.length; j++){ 78 if (rules[j].selectorText.trim().toUpperCase() == ruleName.trim().toUpperCase()){ 79 return rules[j]; 80 } 81 } 82 } 83 } 84 return null; 85} 86 87function setActiveStyleSheet(title) { 88 createCookie("ColorCSS", title, 365); 89 //window.location.reload(); 90 window.location.reload(); 91 return; 92} 93 94function createCookie(name,value,days) { 95 if (days) { 96 var date = new Date(); 97 date.setTime(date.getTime()+(days*24*60*60*1000)); 98 var expires = "; expires="+date.toGMTString(); 99 } 100 else expires = ""; 101 document.cookie = name+"="+value+expires+"; path=/"; 102} 103 104function setScreenType(screentype){ 105 bclass = document.body.className.trim(); 106 if (bclass.indexOf(' ') > 0){ 107 bclass = bclass.replace(/^\w+/,screentype); 108 }else{ 109 bclass = screentype + ' ' + bclass; 110 } 111 112 document.body.className = bclass; 113 equalHeightInit(); 114 jatabinit(); 115 createCookie("ScreenType", screentype, 365); 116} 117 118String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); }; 119 120function changeToolHilite(oldtool, newtool) { 121 if (oldtool != newtool) { 122 if (oldtool) { 123 oldtool.src = oldtool.src.replace(/-hilite/,''); 124 } 125 newtool.src = newtool.src.replace(/.gif$/,'-hilite.gif'); 126 } 127} 128 129//addEvent - attach a function to an event 130function jaAddEvent(obj, evType, fn){ 131 if (obj.addEventListener){ 132 obj.addEventListener(evType, fn, false); 133 return true; 134 } else if (obj.attachEvent){ 135 var r = obj.attachEvent("on"+evType, fn); 136 return r; 137 } else { 138 return false; 139 } 140} 141 142function equalHeight (elems, offset){ 143 if (!offset) offset = 0; 144 if (!elems) return; 145 var maxh = 0; 146 for (var i=0; i<elems.length; i++) 147 { 148 if (elems[i] && elems[i].scrollHeight > maxh) maxh = elems[i].scrollHeight; 149 } 150 for (i=0; i<elems.length; i++){ 151 if (elems[i]) elems[i].style.height = (maxh+offset) + "px"; 152 } 153} 154 155function getElem (id) { 156 var obj = document.getElementById (id); 157 if (!obj) return null; 158 var divs = obj.getElementsByTagName ('div'); 159 if (divs && divs.length >= 1) return divs[divs.length - 1]; 160 return null; 161} 162 163function getFirstDiv (id) { 164 var obj = document.getElementById (id); 165 if (!obj) return null; 166 var divs = obj.getElementsByTagName ('div'); 167 if (divs && divs.length >= 1) return divs[0]; 168 return obj;
169} 170 171function getDivElemsByClass (parent, className) { 172 var objs = parent.getElementsByTagName ('div'); 173 var elems = new Array(); 174 var j = 0; 175 for (var i=0; i<objs.length; i++) 176 { 177 if (instr(objs[i].className, className) ) 178 { 179 elems[j++] = objs[i]; 180 } 181 } 182 return elems; 183} 184 185function instr(str, item){ 186 var arr = str.split(" "); 187 for (var i = 0; i < arr.length; i++){ 188 if (arr[i] == item) return true; 189 } 190 return false; 191} 192 193function equalHeightInit (){ 194 var botsl = document.getElementById ('ja-botsl'); 195 if (!botsl) return; 196 var objs = getElementsByClass ('moduletable*', botsl, 'DIV'); 197 equalHeight (objs, -20); 198} 199 200jaAddEvent (window, 'load', equalHeightInit); 201 202jaToolsHover = function() { 203 var jautw = document.getElementById("jausertoolswrap"); 204 if (!jautw) return; 205 206 jautw.onmouseover=function() { 207 this.className="ja-toolswraphover"; 208 } 209 jautw.onmouseout=function() { 210 this.className=""; 211 } 212} 213 214jaAddEvent (window, 'load', jaToolsHover); 215 216headerDuration = 100; 217headerInt = 13; 218headerStep = null; 219headerTimeout = 0; 220headerToggle = 1; //1: Expend, -1: collapse 221tophd = null; 222headerHeight = 0; 223function toggleHeaderInit () { 224 tophd = document.getElementById ('ja-topsl'); 225 tophdleft = document.getElementById ('ja-topsl-left'); 226 tophdright = document.getElementById ('ja-topsl-right'); 227 if (!tophd) return; 228 229 obj = document.getElementById ('ja-topsl-left'); 230 if (obj && headerHeight < obj.scrollHeight) headerHeight = obj.scrollHeight; 231 obj = document.getElementById ('ja-topsl1'); 232 if (obj && headerHeight < obj.scrollHeight) headerHeight = obj.scrollHeight; 233 obj = document.getElementById ('ja-topsl2'); 234 if (obj && headerHeight < obj.scrollHeight) headerHeight = obj.scrollHeight; 235 obj = document.getElementById ('ja-topsl3'); 236 if (obj && headerHeight < obj.scrollHeight) headerHeight = obj.scrollHeight; 237//alert(headerHeight); 238 headerStep = parseInt(headerHeight*headerInt / headerDuration); 239 //headerTimeout = setTimeout (toggleHeaderGo, headerInt); 240 if (headerToggle < 0) { 241 headerToggle = 1; 242 toggleHeader (null); 243 } 244} 245 246function toggleHeader (aobj) { 247 if (!tophd) return; 248 headerToggle = -(headerToggle); 249 if (aobj) 250 { 251 if (headerToggle > 0) 252 { 253 aobj.className = "ja-cb"; 254 aobj.href = "#collapse"; 255 aobj.title = "Collapse Spotlight"; 256 } else { 257 aobj.className = "ja-ob"; 258 aobj.href = "#expend"; 259 aobj.title = "Expend Spotlight"; 260 } 261 } 262 if (headerToggle > 0) { 263 tophd.style.display = "block"; 264 } else { 265 tophd.style.overflow = "hidden"; 266 if (document.getElementById('ja-bigicon')) document.getElementById('ja-bigicon').style.display = "none"; 267 } 268 headerTimeout = setTimeout (toggleHeaderGo, headerInt); 269} 270 271function toggleHeaderGo () { 272 if (headerTimeout) { 273 clearTimeout (headerTimeout); 274 headerTimeout = 0; 275 } 276 if (!tophd) { 277 return; 278 } 279 headerTimeout = setTimeout (toggleHeaderGo, headerInt); 280 var stop = false;
281 var h = tophd.offsetHeight; 282 h += headerStep * headerToggle; 283 //alert(h); 284 if (h <= 0){ 285 h = 0; 286 tophd.style.display = "none"; 287 stop = true; 288 } 289 if (h > headerHeight){ 290 //alert(tophd.scrollHeight); 291 h = headerHeight; 292 stop = true; 293 tophd.style.overflow = ""; 294 tophd.style.display = ""; 295 if (document.getElementById('ja-bigicon')) document.getElementById('ja-bigicon').style.display = ""; 296 } 297 if (tophdleft) tophdleft.style.height = h + "px"; 298 if (tophdright) tophdright.style.height = h + "px"; 299 if (tophd) tophd.style.height = h + "px"; 300 301 if (stop) { 302 clearTimeout (headerTimeout); 303 headerTimeout = 0; 304 createCookie("HeaderToggle", headerToggle, 365); 305 } 306} 307 308function preloadImages () { 309 var imgs = new Array(); 310 for (var i = 0; i < arguments.length; i++) { 311 var imgsrc = arguments[i]; 312 imgs[i] = new Image(); 313 imgs[i].src = imgsrc; 314 } 315} 316 317 318function getElementsByClass(searchClass,node,tag) { 319 var classElements = new Array(); 320 var j = 0; 321 if ( node == null ) 322 node = document; 323 if ( tag == null ) 324 tag = '*'; 325 var els = node.getElementsByTagName(tag); 326 var elsLen = els.length; 327 var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)'); 328 for (var i = 0; i < elsLen; i++) { 329 if ( pattern.test(els[i].className) ) { 330 classElements[j] = els[i]; 331 j++; 332 } 333 } 334 //alert(searchClass + j); 335 return classElements; 336} 337 338function addMouseOver (className) { 339 objs = getElementsByClass (className, document, 'DIV'); 340 if (objs){ 341 for (i=0; i<objs.length; i++){ 342 objs[i].onmouseover=function() { 343 this.className+=" hover"; 344 } 345 objs[i].onmouseout=function() { 346 this.className=this.className.replace(new RegExp(" hover\\b"), ""); 347 } 348 349 } 350 } 351} 352 353//Add span to module title 354function addSpanToTitle () { 355 var colobj = document.getElementById ('ja-colwrap'); 356 if (!colobj) return; 357 var modules = getElementsByClass ('moduletable.*', colobj, "DIV"); 358 if (!modules) return; 359 for (var i=0; i<modules.length; i++) { 360 var module = modules[i]; 361 var title = module.getElementsByTagName ("h3")[0]; 362 if (title) { 363 title.innerHTML = "<span>"+title.innerHTML+"</span>"; 364 module.className = "ja-" + module.className; 365 } 366 } 367} 368 369jaAddEvent (window, 'load', addSpanToTitle); 370 371function jashowtabcontent (obj) { 372 var tabdisplay = document.getElementById ('ja-tab-content'); 373 if (!tabdisplay) return; 374 var tabcontents = getElementsByClass ('ja-tab-content', obj, "DIV"); 375 if (!tabcontents) return; 376 tabdisplay.innerHTML = tabcontents[0].innerHTML; 377 jatabresetclass(obj); 378} 379 380function jatabresetclass (obj) { 381 var jatab = document.getElementById ('ja-tabswrap'); 382 if (jatab) { 383 var lis = getElementsByClass ('ja-tab-li', jatab, "LI"); 384 if (!lis) return; 385 for (var i=0; i<lis.length; i++) { 386 lis[i].className = lis[i].className.replace(new RegExp(" ja-tab-hover\\b"), ""); 387 } 388 obj.className += " ja-tab-hover"; 389 } 390} 391 392function jatabinit (){ 393 var jatab = document.getElementById ('ja-tabswrap'); 394 if (jatab) { 395 var tabcontents = getElementsByClass ('ja-tab-content', jatab, "DIV"); 396 if (tabcontents) { 397 var tabdisplay = document.getElementById ('ja-tab-content'); 398 var divobj = document.createElement ("DIV"); 399 400 divobj.style.display = "block"; 401 divobj.style.position = "absolute"; 402 divobj.style.top = "-1000px"; 403 divobj.style.width = tabdisplay.offsetWidth + "px"; 404 document.body.appendChild (divobj); 405 var maxh = 0; 406 for (var i=0; i<tabcontents.length; i++) { 407 divobj.innerHTML = tabcontents[i].innerHTML; 408 if (maxh < divobj.offsetHeight) maxh = divobj.offsetHeight; 409 } 410 tabdisplay.style.height = (maxh - 20) + "px"; 411 document.body.removeChild (divobj); 412 } 413 var lis = $$('LI.ja-tab-li'); 414 if (!lis) return; 415 jashowtabcontent (lis[0]); 416 417 lis.each(function(li){ 418 li.addEvent('mouseover', jashowtabcontent.pass(li)); 419 li.setStyle('visibility', 'visible'); 420 }); 421 } 422} 423 424jaAddEvent (window, 'load', jatabinit); 425 426function jaInitHover () { 427 addMouseOver ('ja-newsitem-inner'); 428} 429jaAddEvent (window, 'load', jaInitHover);
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.