1var _____WB$wombat$assign$function_____=function(name){return (globalThis._wb_wombat && globalThis._wb_wombat.local_init && globalThis._wb_wombat.local_init(name))||globalThis[name];};if(!globalThis.__WB_pmw){globalThis.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opener = _____WB$wombat$assign$function_____("opener"); 10// <?php !! This fools phpdocumentor into parsing this file 11/** 12* @version $Id: joomla.javascript.js 14401 2010-01-26 14:10:00Z louis $ 13* @package Joomla 14* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 15* @license GNU/GPL 16* Joomla! is Free Softw
16are 17*/ 18 19/** 20 * Overlib Styling Declarations to allow CSS class override of styles 21 * 22 */ 23var ol_fgclass='ol-foreground'; 24var ol_bgclass='ol-background'; 25var ol_textfontclass='ol-textfont'; 26var ol_captionfontclass='ol-captionfont'; 27var ol_closefontclass='ol-closefont'; 28 29// general utility for browsing a named array or object 30function xshow(o) { 31 s = ''; 32 for(e in o) {s += e+'='+o[e]+'\n';} 33 alert( s ); 34} 35 36/** 37* Writes a dynamically generated list 38* @param string The parameters to insert into the <select> tag 39* @param array A javascript array of list options in the form [key,value,text] 40* @param string The key to display for the initial state of the list 41* @param string The original key that was selected 42* @param string The original item value that was selected 43*/ 44function writeDynaList( selectParams, source, key, orig_key, orig_val ) { 45 var html = '\n <select ' + selectParams + '>'; 46 var i = 0; 47 for (x in source) { 48 if (source[x][0] == key) { 49 var selected = ''; 50 if ((orig_key == key && orig_val == source[x][1]) || (i == 0 && orig_key != key)) { 51 selected = 'selected="selected"'; 52 } 53 html += '\n <option value="'+source[x][1]+'" '+selected+'>'+source[x][2]+'</option>'; 54 } 55 i++; 56 } 57 html += '\n </select>'; 58 59 document.writeln( html ); 60} 61 62/** 63* Changes a dynamically generated list 64* @param string The name of the list to change 65* @param array A javascript array of list options in the form [key,value,text] 66* @param string The key to display 67* @param string The original key that was selected 68* @param string The original item value that was selected 69*/ 70function changeDynaList( listname, source, key, orig_key, orig_val ) { 71 var list = eval( 'document.adminForm.' + listname ); 72 73 // empty the list 74 for (i in list.options.length) { 75 list.options[i] = null; 76 } 77 i = 0; 78 for (x in source) { 79 if (source[x][0] == key) { 80 opt = new Option(); 81 opt.value = source[x][1]; 82 opt.text = source[x][2]; 83 84 if ((orig_key == key && orig_val == opt.value) || i == 0) { 85 opt.selected = true; 86 } 87 list.options[i++] = opt; 88 } 89 } 90 list.length = i; 91} 92 93/** 94* Adds a select item(s) from one list to another 95*/ 96function addSelectedToList( frmName, srcListName, tgtListName ) { 97 var form = eval( 'document.' + frmName ); 98 var srcList = eval( 'form.' + srcListName ); 99 var tgtList = eval( 'form.' + tgtListName ); 100 101 var srcLen = srcList.length; 102 var tgtLen = tgtList.length; 103 var tgt = "x"; 104 105 //build array of target items 106 for (var i=tgtLen-1; i > -1; i--) { 107 tgt += "," + tgtList.options[i].value + "," 108 } 109 110 //Pull selected resources and add them to list 111 //for (var i=srcLen-1; i > -1; i--) { 112 for (var i=0; i < srcLen; i++) { 113 if (srcList.options[i].selected && tgt.indexOf( "," + srcList.options[i].value + "," ) == -1) { 114 opt = new Option( srcList.options[i].text, srcList.options[i].value ); 115 tgtList.options[tgtList.length] = opt; 116 } 117 } 118} 119 120function delSelectedFromList( frmName, srcListName ) { 121 var form = eval( 'document.' + frmName ); 122 var srcList = eval( 'form.' + srcListName ); 123 124 var srcLen = srcList.length; 125 126 for (var i=srcLen-1; i > -1; i--) { 127 if (srcList.options[i].selected) { 128 srcList.options[i] = null; 129 } 130 } 131} 132 133function moveInList( frmName, srcListName, index, to) { 134 var form = eval( 'document.' + frmName ); 135 var srcList = eval( 'form.' + srcListName ); 136 var total = srcList.options.length-1; 137 138 if (index == -1) { 139 return false; 140 } 141 if (to == +1 && index == total) { 142 return false; 143 } 144 if (to == -1 && index == 0) { 145 return false; 146 } 147 148 var items = new Array; 149 var values = new Array; 150 151 for (i=total; i >= 0; i--) { 152 items[i] = srcList.options[i].text; 153 values[i] = srcList.options[i].value; 154 } 155 for (i = total; i >= 0; i--) { 156 if (index == i) { 157 srcList.options[i + to] = new Option(items[i],values[i], 0, 1); 158 srcList.options[i] = new Option(items[i+to], values[i+to]); 159 i--; 160 } else { 161 srcList.options[i] = new Option(items[i], values[i]); 162 } 163 } 164 srcList.focus(); 165 return true; 166} 167 168function getSelectedOption( frmName, srcListName ) { 169 var form = eval( 'document.' + frmName ); 170 var srcList = eval( 'form.' + srcListName ); 171 172 i = srcList.selectedIndex; 173 if (i != null && i > -1) { 174 return srcList.options[i]; 175 } else { 176 return null; 177 } 178} 179 180function setSelectedValue( frmName, srcListName, value ) { 181 var form = eval( 'document.' + frmName ); 182 var srcList = eval( 'form.' + srcListName ); 183 184 var srcLen = srcList.length; 185 186 for (var i=0; i < srcLen; i++) { 187 srcList.options[i].selected = false;
188 if (srcList.options[i].value == value) { 189 srcList.options[i].selected = true; 190 } 191 } 192} 193 194function getSelectedRadio( frmName, srcGroupName ) { 195 var form = eval( 'document.' + frmName ); 196 var srcGroup = eval( 'form.' + srcGroupName ); 197 198 return radioGetCheckedValue( srcGroup ); 199} 200 201// return the value of the radio button that is checked 202// return an empty string if none are checked, or 203// there are no radio buttons 204function radioGetCheckedValue(radioObj) { 205 if (!radioObj) { 206 return ''; 207 } 208 var n = radioObj.length; 209 if (n == undefined) { 210 if (radioObj.checked) { 211 return radioObj.value; 212 } else { 213 return ''; 214 } 215 } 216 for (var i = 0; i < n; i++) { 217 if(radioObj[i].checked) { 218 return radioObj[i].value; 219 } 220 } 221 return ''; 222} 223 224function getSelectedValue( frmName, srcListName ) { 225 var form = eval( 'document.' + frmName ); 226 var srcList = eval( 'form.' + srcListName ); 227 228 i = srcList.selectedIndex; 229 if (i != null && i > -1) { 230 return srcList.options[i].value; 231 } else { 232 return null; 233 } 234} 235 236function getSelectedText( frmName, srcListName ) { 237 var form = eval( 'document.' + frmName ); 238 var srcList = eval( 'form.' + srcListName ); 239 240 i = srcList.selectedIndex; 241 if (i != null && i > -1) { 242 return srcList.options[i].text; 243 } else { 244 return null; 245 } 246} 247 248function chgSelectedValue( frmName, srcListName, value ) { 249 var form = eval( 'document.' + frmName ); 250 var srcList = eval( 'form.' + srcListName ); 251 252 i = srcList.selectedIndex; 253 if (i != null && i > -1) { 254 srcList.options[i].value = value; 255 return true; 256 } else { 257 return false; 258 } 259} 260 261/** 262* Toggles the check state of a group of boxes 263* 264* Checkboxes must have an id attribute in the form cb0, cb1... 265* @param The number of box to 'check' 266* @param An alternative field name 267*/ 268 269function listItemTask( id, task ) { 270 var f = document.adminForm; 271 cb = eval( 'f.' + id ); 272 if (cb) { 273 for (i = 0; true; i++) { 274 cbx = eval('f.cb'+i); 275 if (!cbx) break; 276 cbx.checked = false; 277 } // for 278 cb.checked = true; 279 f.boxchecked.value = 1; 280 submitbutton(task); 281 } 282 return false; 283} 284 285function hideMainMenu() { 286 if (document.adminForm.hidemainmenu) { 287 document.adminForm.hidemainmenu.value=1; 288 } 289} 290 291function isChecked(isitchecked){ 292 if (isitchecked == true){ 293 document.adminForm.boxchecked.value++; 294 } 295 else { 296 document.adminForm.boxchecked.value--; 297 } 298} 299 300/** 301* Default function. Usually would be overriden by the component 302*//* 303function submitbutton(pressbutton) { 304 submitform(pressbutton); 305} 306*/ 307/** 308* Submit the admin form 309*/ 310function submitform(pressbutton){ 311 if (pressbutton) { 312 document.adminForm.task.value=pressbutton; 313 } 314 if (typeof document.adminForm.onsubmit == "function") { 315 document.adminForm.onsubmit(); 316 } 317 document.adminForm.submit(); 318} 319 320/** 321* Submit the control panel admin form 322*/ 323function submitcpform(sectionid, id){ 324 document.adminForm.sectionid.value=sectionid; 325 document.adminForm.id.value=id; 326 submitbutton("edit"); 327} 328 329/** 330* Getting radio button that is selected. 331*/ 332function getSelected(allbuttons){ 333 for (i=0;i<allbuttons.length;i++) { 334 if (allbuttons[i].checked) { 335 return allbuttons[i].value 336 } 337 } 338 return null; 339} 340 341// JS Calendar 342var calendar = null; // remember the calendar object so that we reuse 343// it and avoid creating another 344 345// This function gets called when an end-user clicks on some date 346function selected(cal, date) { 347 cal.sel.value = date; // just update the value of the input field 348} 349 350// And this gets called when the end-user clicks on the _selected_ date, 351// or clicks the "Close" (X) button. It just hides the calendar without 352// destroying it. 353function closeHandler(cal) { 354 cal.hide(); // hide the calendar 355 356 // don't check mousedown on document anymore (used to be able to hide the 357 // calendar when someone clicks outside it, see the showCalendar function). 358 Calendar.removeEvent(document, "mousedown", checkCalendar); 359} 360 361// This gets called when the user presses a mouse button anywhere in the 362// document, if the calendar is shown. If the click was outside the open 363// calendar this function closes it. 364function checkCalendar(ev) { 365 var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); 366 for (; el != null; el = el.parentNode) 367 // FIXME: allow end-user to click some link without closing the 368 // calendar. Good to see real-time stylesheet change :) 369 if (el == calendar.element || el.tagName == "A") break; 370 if (el == null) { 371 // calls closeHandler which should hide the calendar. 372 calendar.callCloseHandler(); Calendar.stopEvent(ev); 373 } 374} 375 376// This function shows the calendar under the element having the given id. 377// It takes care of catching "mousedown" signals on document and hiding the 378// calendar if the click was outside. 379function showCalendar(id, dateFormat) { 380 var el = document.getElementById(id); 381 if (calendar != null) { 382 // we already have one created, so just update it. 383 calendar.hide(); // hide the existing calendar 384 calendar.parseDate(el.value); // set it to a new date 385 } else { 386 // first-time call, create the calendar 387 var cal = new Calendar(true, null, selected, closeHandler); 388 calendar = cal; // remember the calendar in the global 389 cal.setRange(1900, 2070); // min/max year allowed 390 391 if ( dateFormat ) // optional date format 392 { 393 cal.setDateFormat(dateFormat); 394 } 395 396 calendar.create(); // create a popup calendar 397 calendar.parseDate(el.value); // set it to a new date 398 } 399 calendar.sel = el; // inform it about the input field in use 400 calendar.showAtElement(el); // show the calendar next to the input field 401 402 // catch mousedown on the document 403 Calendar.addEvent(document, "mousedown", checkCalendar); 404 return false;
405} 406 407/** 408* Pops up a new window in the middle of the screen 409*/ 410function popupWindow(mypage, myname, w, h, scroll) { 411 var winl = (screen.width - w) / 2; 412 var wint = (screen.height - h) / 2; 413 winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable' 414 win = window.open(mypage, myname, winprops) 415 if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } 416} 417 418// LTrim(string) : Returns a copy of a string without leading spaces. 419function ltrim(str) 420{ 421 var whitespace = new String(" \t\n\r"); 422 var s = new String(str); 423 if (whitespace.indexOf(s.charAt(0)) != -1) { 424 var j=0, i = s.length; 425 while (j < i && whitespace.indexOf(s.charAt(j)) != -1) 426 j++; 427 s = s.substring(j, i); 428 } 429 return s; 430} 431 432//RTrim(string) : Returns a copy of a string without trailing spaces. 433function rtrim(str) 434{ 435 var whitespace = new String(" \t\n\r"); 436 var s = new String(str); 437 if (whitespace.indexOf(s.charAt(s.length-1)) != -1) { 438 var i = s.length - 1; // Get length of string 439 while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) 440 i--; 441 s = s.substring(0, i+1); 442 } 443 return s; 444} 445 446// Trim(string) : Returns a copy of a string without leading or trailing spaces 447function trim(str) { 448 return rtrim(ltrim(str)); 449} 450 451function mosDHTML(){ 452 this.ver=navigator.appVersion 453 this.agent=navigator.userAgent 454 this.dom=document.getElementById?1:0 455 this.opera5=this.agent.indexOf("Opera 5")<-1 456 this.ie5=(this.ver.indexOf("MSIE 5")<-1 && this.dom && !this.opera5)?1:0; 457 this.ie6=(this.ver.indexOf("MSIE 6")<-1 && this.dom && !this.opera5)?1:0; 458 this.ie4=(document.all && !this.dom && !this.opera5)?1:0; 459 this.ie=this.ie4||this.ie5||this.ie6 460 this.mac=this.agent.indexOf("Mac")<-1 461 this.ns6=(this.dom && parseInt(this.ver) <= 5) ?1:0; 462 this.ns4=(document.layers && !this.dom)?1:0; 463 this.bw=(this.ie6||this.ie5||this.ie4||this.ns4||this.ns6||this.opera5); 464 465 this.activeTab = ''; 466 this.onTabStyle = 'ontab'; 467 this.offTabStyle = 'offtab'; 468 469 this.setElemStyle = function(elem,style) { 470 document.getElementById(elem).className = style; 471 } 472 this.showElem = function(id) { 473 if ((elem = document.getElementById(id))) { 474 elem.style.visibility = 'visible'; 475 elem.style.display = 'block'; 476 } 477 } 478 this.hideElem = function(id) { 479 if ((elem = document.getElementById(id))) { 480 elem.style.visibility = 'hidden'; 481 elem.style.display = 'none'; 482 } 483 } 484 this.cycleTab = function(name) { 485 if (this.activeTab) { 486 this.setElemStyle( this.activeTab, this.offTabStyle ); 487 page = this.activeTab.replace( 'tab', 'page' ); 488 this.hideElem(page); 489 } 490 this.setElemStyle( name, this.onTabStyle ); 491 this.activeTab = name; 492 page = this.activeTab.replace( 'tab', 'page' ); 493 this.showElem(page); 494 } 495 return this; 496} 497var dhtml = new mosDHTML(); 498 499// needed for Table Column ordering 500function tableOrdering( order, dir, task ) { 501 var form = document.adminForm; 502 503 form.filter_order.value = order; 504 form.filter_order_Dir.value = dir; 505 submitform( task ); 506} 507 508function saveorder( n, task ) { 509 checkAll_button( n, task ); 510} 511 512//needed by saveorder function 513function checkAll_button( n, task ) { 514 515 if (!task ) { 516 task = 'saveorder'; 517 } 518 519 for ( var j = 0; j <= n; j++ ) { 520 box = eval( "document.adminForm.cb" + j ); 521 if ( box ) { 522 if ( box.checked == false ) { 523 box.checked = true; 524 } 525 } else { 526 alert("You cannot change the order of items, as an item in the list is `Checked Out`"); 527 return; 528 } 529 } 530 submitform(task); 531} 532/** 533* @param object A form element 534* @param string The name of the element to find 535*/ 536function getElementByName( f, name ) { 537 if (f.elements) { 538 for (i=0, n=f.elements.length; i < n; i++) { 539 if (f.elements[i].name == name) { 540 return f.elements[i]; 541 } 542 } 543 } 544 return null; 545} 546 547function go2( pressbutton, menu, id ) { 548 var form = document.adminForm; 549 550 if (form.imagelist && form.images) { 551 // assemble the images back into one field 552 var temp = new Array; 553 for (var i=0, n=form.imagelist.options.length; i < n; i++) { 554 temp[i] = form.imagelist.options[i].value; 555 } 556 form.images.value = temp.join( '\n' ); 557 } 558 559 if (pressbutton == 'go2menu') { 560 form.menu.value = menu; 561 submitform( pressbutton ); 562 return; 563 } 564 565 if (pressbutton == 'go2menuitem') { 566 form.menu.value = menu; 567 form.menuid.value = id; 568 submitform( pressbutton ); 569 return; 570 } 571} 572/** 573 * Verifies if the string is in a valid email format 574 * @param string 575 * @return boolean 576 */ 577function isEmail( text ) 578{ 579 var pattern = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$"; 580 var regex = new RegExp( pattern ); 581 return regex.test( text ); 582} 583}
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.