diff --git a/media/system/js/core-uncompressed.js b/media/system/js/core-uncompressed.js index c75dc6fde2340..63295dceec165 100644 --- a/media/system/js/core-uncompressed.js +++ b/media/system/js/core-uncompressed.js @@ -6,450 +6,497 @@ // Only define the Joomla namespace if not defined. Joomla = window.Joomla || {}; -Joomla.editors = {}; -// An object to hold each editor instance on page -Joomla.editors.instances = {}; +// Only define editors if not defined +Joomla.editors = Joomla.editors || {}; -/** - * Generic submit form - */ -Joomla.submitform = function(task, form, validate) { - if (!form) { - form = document.getElementById('adminForm'); - } - - if (task) { - form.task.value = task; - } - - // Toggle HTML5 validation - form.noValidate = !validate; - - // Submit the form. - // Create the input type="submit" - var button = document.createElement('input'); - button.style.display = 'none'; - button.type = 'submit'; +// An object to hold each editor instance on page, only define if not defined. +Joomla.editors.instances = Joomla.editors.instances || {}; - // Append it and click it - form.appendChild(button).click(); +(function( Joomla, document ) { + "use strict"; - // If "submit" was prevented, make sure we don't get a build up of buttons - form.removeChild(button); -}; + /** + * Generic submit form + */ + Joomla.submitform = function(task, form, validate) { + if (!form) { + form = document.getElementById('adminForm'); + } -/** - * Default function. Usually would be overriden by the component - */ -Joomla.submitbutton = function(pressbutton) { - Joomla.submitform(pressbutton); -}; + if (task) { + form.task.value = task; + } -/** - * Custom behavior for JavaScript I18N in Joomla! 1.6 - * - * Allows you to call Joomla.JText._() to get a translated JavaScript string pushed in with JText::script() in Joomla. - */ -Joomla.JText = { - strings: {}, - '_': function(key, def) { - return typeof this.strings[key.toUpperCase()] !== 'undefined' ? this.strings[key.toUpperCase()] : def; - }, - load: function(object) { - for (var key in object) { - this.strings[key.toUpperCase()] = object[key]; - } - return this; - } -}; + // Toggle HTML5 validation + form.noValidate = !validate; + + // Submit the form. + // Create the input type="submit" + var button = document.createElement('input'); + button.style.display = 'none'; + button.type = 'submit'; + + // Append it and click it + form.appendChild(button).click(); + + // If "submit" was prevented, make sure we don't get a build up of buttons + form.removeChild(button); + }; + + /** + * Default function. Usually would be overriden by the component + */ + Joomla.submitbutton = function( pressbutton ) { + Joomla.submitform( pressbutton ); + }; + + /** + * Custom behavior for JavaScript I18N in Joomla! 1.6 + * + * Allows you to call Joomla.JText._() to get a translated JavaScript string pushed in with JText::script() in Joomla. + */ + Joomla.JText = { + strings: {}, + '_': function( key, def ) { + return typeof this.strings[ key.toUpperCase() ] !== 'undefined' ? this.strings[ key.toUpperCase() ] : def; + }, + load: function( object ) { + for ( var key in object ) { + if (!object.hasOwnProperty(key)) continue; + this.strings[ key.toUpperCase() ] = object[ key ]; + } + return this; + } + }; -/** - * Method to replace all request tokens on the page with a new one. - */ -Joomla.replaceTokens = function(n) { - var els = document.getElementsByTagName('input'), i; - for (i = 0; i < els.length; i++) { - if ((els[i].type == 'hidden') && (els[i].name.length == 32) && els[i].value == '1') { - els[i].name = n; - } - } -}; + /** + * Method to replace all request tokens on the page with a new one. + * Probably not used anywhere + */ + Joomla.replaceTokens = function( newToken ) { + if (!/^[0-9A-F]{32}$/i.test(newToken)) { return; } -/** - * USED IN: administrator/components/com_banners/views/client/tmpl/default.php - * - * Verifies if the string is in a valid email format - * - * @param string - * @return boolean - */ -Joomla.isEmail = function(text) { - var regex = new RegExp("^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$"); - return regex.test(text); -}; + var els = document.getElementsByTagName( 'input' ), + i, el; -/** - * USED IN: all list forms. - * - * Toggles the check state of a group of boxes - * - * Checkboxes must have an id attribute in the form cb0, cb1... - * - * @param mixed The number of box to 'check', for a checkbox element - * @param string An alternative field name - */ -Joomla.checkAll = function(checkbox, stub) { - if (!stub) { - stub = 'cb'; - } - if (checkbox.form) { - var c = 0, i, e; - for (i = 0, n = checkbox.form.elements.length; i < n; i++) { - e = checkbox.form.elements[i]; - if (e.type == checkbox.type) { - if ((stub && e.id.indexOf(stub) == 0) || !stub) { - e.checked = checkbox.checked; - c += (e.checked == true ? 1 : 0); - } - } - } - if (checkbox.form.boxchecked) { - checkbox.form.boxchecked.value = c; - } - return true; - } - return false; -}; + for ( i = 0, n = els.length; i < n; i++ ) { + el = els[i]; -/** - * Render messages send via JSON - * - * @param object messages JavaScript object containing the messages to render. Example: - * var messages = { - * "message": ["Message one", "Message two"], - * "error": ["Error one", "Error two"] - * }; - * @return void - */ -Joomla.renderMessages = function(messages) { - Joomla.removeMessages(); + if ( el.type == 'hidden' && el.value == '1' && el.name.length == 32 ) { + el.name = newToken; + } + } + }; + + /** + * USED IN: administrator/components/com_banners/views/client/tmpl/default.php + * Actually, probably not used anywhere. Can we deprecate in favor of ? + * + * Verifies if the string is in a valid email format + * + * @param string + * @return boolean + */ + Joomla.isEmail = function( text ) { + var regex = /^[\w.!#$%&’*+\/=?^`{|}~-]+@[a-z0-9-]+(?:\.[a-z0-9-]{2,})+$/i; + return regex.test( text ); + }; + + /** + * USED IN: all list forms. + * + * Toggles the check state of a group of boxes + * + * Checkboxes must have an id attribute in the form cb0, cb1... + * + * @param mixed The number of box to 'check', for a checkbox element + * @param string An alternative field name + */ + Joomla.checkAll = function( checkbox, stub ) { + if (!checkbox.form) return false; + + stub = stub ? stub : 'cb'; + + var c = 0, + i, e, n; + + for ( i = 0, n = checkbox.form.elements.length; i < n; i++ ) { + e = checkbox.form.elements[ i ]; + + if ( e.type == checkbox.type && e.id.indexOf( stub ) === 0 ) { + e.checked = checkbox.checked; + c += e.checked ? 1 : 0; + } + } - var messageContainer = document.getElementById('system-message-container'); + if ( checkbox.form.boxchecked ) { + checkbox.form.boxchecked.value = c; + } - for (var type in messages) { - if (messages.hasOwnProperty(type)) { + return true; + }; + + /** + * Render messages send via JSON + * Used by some javascripts such as validate.js + * + * @param object messages JavaScript object containing the messages to render. Example: + * var messages = { + * "message": ["Message one", "Message two"], + * "error": ["Error one", "Error two"] + * }; + * @return void + */ + Joomla.renderMessages = function( messages ) { + Joomla.removeMessages(); + + var messageContainer = document.getElementById( 'system-message-container' ), + type, typeMessages, messagesBox, title, titleWrapper, i, messageWrapper; + + for ( type in messages ) { + if ( !messages.hasOwnProperty( type ) ) { continue; } // Array of messages of this type - var typeMessages = messages[type]; + typeMessages = messages[ type ]; // Create the alert box - var messagesBox = document.createElement('div'); + messagesBox = document.createElement( 'div' ); messagesBox.className = 'alert alert-' + type; // Title - var title = Joomla.JText._(type); + title = Joomla.JText._( type ); // Skip titles with untranslated strings - if (typeof title != 'undefined') { - var titleWrapper = document.createElement('h4'); + if ( typeof title != 'undefined' ) { + titleWrapper = document.createElement( 'h4' ); titleWrapper.className = 'alert-heading'; - titleWrapper.innerHTML = Joomla.JText._(type); + titleWrapper.innerHTML = Joomla.JText._( type ); - messagesBox.appendChild(titleWrapper); + messagesBox.appendChild( titleWrapper ); } // Add messages to the message box - for (var i = typeMessages.length - 1; i >= 0; i--) { - var messageWrapper = document.createElement('p'); - messageWrapper.innerHTML = typeMessages[i]; - messagesBox.appendChild(messageWrapper); + for ( i = typeMessages.length - 1; i >= 0; i-- ) { + messageWrapper = document.createElement( 'p' ); + messageWrapper.innerHTML = typeMessages[ i ]; + messagesBox.appendChild( messageWrapper ); } - messageContainer.appendChild(messagesBox); + messageContainer.appendChild( messagesBox ); + } + }; + + + /** + * Remove messages + * + * @return void + */ + Joomla.removeMessages = function() { + var messageContainer = document.getElementById( 'system-message-container' ); + + // Empty container with a while for Chrome performance issues + while ( messageContainer.firstChild ) messageContainer.removeChild( messageContainer.firstChild ); + + // Fix Chrome bug not updating element height + messageContainer.style.display = 'none'; + messageContainer.offsetHeight; + messageContainer.style.display = ''; + }; + + /** + * USED IN: administrator/components/com_cache/views/cache/tmpl/default.php + * administrator/components/com_installer/views/discover/tmpl/default_item.php + * administrator/components/com_installer/views/update/tmpl/default_item.php + * administrator/components/com_languages/helpers/html/languages.php + * libraries/joomla/html/html/grid.php + * + * @param isitchecked + * @param form + * @return + */ + Joomla.isChecked = function( isitchecked, form ) { + if ( typeof form === 'undefined' ) { + form = document.getElementById( 'adminForm' ); } - } -}; + form.boxchecked.value += isitchecked ? 1 : -1; -/** - * Remove messages - * - * @return void - */ -Joomla.removeMessages = function() { - var messageContainer = document.getElementById('system-message-container'); + // If we don't have a checkall-toggle, done. + if ( !form.elements[ 'checkall-toggle' ] ) return; - // Empty container with a while for Chrome performance issues - while (messageContainer.firstChild) messageContainer.removeChild(messageContainer.firstChild); + // Toggle main toggle checkbox depending on checkbox selection + var c = true, + i, e, n; - // Fix Chrome bug not updating element height - messageContainer.style.display='none'; - messageContainer.offsetHeight; - messageContainer.style.display=''; -}; + for ( i = 0, n = form.elements.length; i < n; i++ ) { + e = form.elements[ i ]; -/** - * USED IN: administrator/components/com_cache/views/cache/tmpl/default.php - * administrator/components/com_installer/views/discover/tmpl/default_item.php - * administrator/components/com_installer/views/update/tmpl/default_item.php - * administrator/components/com_languages/helpers/html/languages.php - * libraries/joomla/html/html/grid.php - * - * @param isitchecked - * @param form - * @return - */ -Joomla.isChecked = function(isitchecked, form) { - if (typeof(form) === 'undefined') { - form = document.getElementById('adminForm'); - } - - if (isitchecked == true) { - form.boxchecked.value++; - } else { - form.boxchecked.value--; - } - - // Toggle main toggle checkbox depending on checkbox selection - var c = true, i, e; - for (i = 0, n = form.elements.length; i < n; i++) { - e = form.elements[i]; - if (e.type == 'checkbox') { - if (e.name != 'checkall-toggle' && e.checked == false) { - c = false; - break; - } - } - } - if (form.elements['checkall-toggle']) { - form.elements['checkall-toggle'].checked = c; - } -}; + if ( e.type == 'checkbox' && e.name != 'checkall-toggle' && !e.checked ) { + c = false; + break; + } + } -/** - * USED IN: libraries/joomla/html/toolbar/button/help.php - * - * Pops up a new window in the middle of the screen - */ -Joomla.popupWindow = function(mypage, myname, w, h, scroll) { - var winl = (screen.width - w) / 2, wint, winprops, win; - wint = (screen.height - h) / 2; - winprops = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl - + ',scrollbars=' + scroll + ',resizable'; - win = window.open(mypage, myname, winprops); - win.window.focus(); -}; + form.elements[ 'checkall-toggle' ].checked = c; + }; + + /** + * USED IN: libraries/joomla/html/toolbar/button/help.php + * + * Pops up a new window in the middle of the screen + */ + Joomla.popupWindow = function( mypage, myname, w, h, scroll ) { + var winl = ( screen.width - w ) / 2, + wint = ( screen.height - h ) / 2, + winprops = 'height=' + h + + ',width=' + w + + ',top=' + wint + + ',left=' + winl + + ',scrollbars=' + scroll + + ',resizable'; + + window.open( mypage, myname, winprops ) + .window.focus(); + }; + + /** + * USED IN: libraries/joomla/html/html/grid.php + * In other words, on any reorderable table + */ + Joomla.tableOrdering = function( order, dir, task, form ) { + if ( typeof form === 'undefined' ) { + form = document.getElementById( 'adminForm' ); + } -/** - * USED IN: libraries/joomla/html/html/grid.php - */ -Joomla.tableOrdering = function(order, dir, task, form) { - if (typeof(form) === 'undefined') { - form = document.getElementById('adminForm'); - } + form.filter_order.value = order; + form.filter_order_Dir.value = dir; + Joomla.submitform( task, form ); + }; + + /** + * USED IN: administrator/components/com_modules/views/module/tmpl/default.php + * + * Writes a dynamically generated list + * + * @param string + * The parameters to insert into the ', + hasSelection = key == orig_key, + i = 0, + selected, x, item; + + for ( x in source ) { + if (!source.hasOwnProperty(x)) { continue; } + + item = source[ x ]; + + if ( item[ 0 ] != key ) { continue; } + + selected = ''; + + if ( ( hasSelection && orig_val == item[ 1 ] ) || ( !hasSelection && i === 0 ) ) { + selected = 'selected="selected"'; + } - form.filter_order.value = order; - form.filter_order_Dir.value = dir; - Joomla.submitform(task, form); -}; + html += ''; -/** - * USED IN: administrator/components/com_modules/views/module/tmpl/default.php - * - * Writes a dynamically generated list - * - * @param string - * The parameters to insert into the ', i, selected; - i = 0; - for (x in source) { - if (source[x][0] == key) { - selected = ''; - if ((orig_key == key && orig_val == source[x][1]) - || (i == 0 && orig_key != key)) { - selected = 'selected="selected"'; - } - html += '\n '; - } - i++; - } - html += '\n '; - - document.writeln(html); -} + i++; + } + html += ''; + + document.writeln( html ); + }; + + /** + * USED IN: administrator/components/com_content/views/article/view.html.php + * actually, probably not used anywhere. + * + * Changes a dynamically generated list + * + * @param string + * The name of the list to change + * @param array + * A javascript array of list options in the form [key,value,text] + * @param string + * The key to display + * @param string + * The original key that was selected + * @param string + * The original item value that was selected + */ + window.changeDynaList = function ( listname, source, key, orig_key, orig_val ) { + var list = document.adminForm[ listname ], + hasSelection = key == orig_key, + i, x, item; + + // empty the list + while ( list.firstChild ) list.removeChild( list.firstChild ); + + i = 0; + + for ( x in source ) { + if (!source.hasOwnProperty(x)) { continue; } + + item = source[x]; + + if ( item[ 0 ] != key ) { continue; } + + opt = new Option(); + opt.value = item[ 1 ]; + opt.text = item[ 2 ]; + + if ( ( hasSelection && orig_val == opt.value ) || (!hasSelection && i === 0) ) { + opt.selected = true; + } -/** - * USED IN: administrator/components/com_content/views/article/view.html.php - * - * Changes a dynamically generated list - * - * @param string - * The name of the list to change - * @param array - * A javascript array of list options in the form [key,value,text] - * @param string - * The key to display - * @param string - * The original key that was selected - * @param string - * The original item value that was selected - */ -function changeDynaList(listname, source, key, orig_key, orig_val) { - var list = document.adminForm[listname]; - - // empty the list - for (i in list.options.length) { - list.options[i] = null; - } - i = 0; - for (x in source) { - if (source[x][0] == key) { - opt = new Option(); - opt.value = source[x][1]; - opt.text = source[x][2]; - - if ((orig_key == key && orig_val == opt.value) || i == 0) { - opt.selected = true; - } - list.options[i++] = opt; - } - } - list.length = i; -} + list.options[ i++ ] = opt; + } -/** - * USED IN: administrator/components/com_menus/views/menus/tmpl/default.php - * - * @param radioObj - * @return - */ -// return the value of the radio button that is checked -// return an empty string if none are checked, or -// there are no radio buttons -function radioGetCheckedValue(radioObj) { - if (!radioObj) { - return ''; - } - var n = radioObj.length, i; - if (n == undefined) { - if (radioObj.checked) { - return radioObj.value; - } else { - return ''; - } - } - for (i = 0; i < n; i++) { - if (radioObj[i].checked) { - return radioObj[i].value; - } - } - return ''; -} + list.length = i; + }; + + /** + * USED IN: administrator/components/com_menus/views/menus/tmpl/default.php + * Probably not used at all + * + * @param radioObj + * @return + */ + // return the value of the radio button that is checked + // return an empty string if none are checked, or + // there are no radio buttons + window.radioGetCheckedValue = function ( radioObj ) { + if ( !radioObj ) { return ''; } + + var n = radioObj.length, + i; + + if ( n === undefined ) { + return radioObj.checked ? radioObj.value : ''; + } -/** - * USED IN: administrator/components/com_banners/views/banner/tmpl/default/php - * administrator/components/com_categories/views/category/tmpl/default.php - * administrator/components/com_categories/views/copyselect/tmpl/default.php - * administrator/components/com_content/views/copyselect/tmpl/default.php - * administrator/components/com_massmail/views/massmail/tmpl/default.php - * administrator/components/com_menus/views/list/tmpl/copy.php - * administrator/components/com_menus/views/list/tmpl/move.php - * administrator/components/com_messages/views/message/tmpl/default_form.php - * administrator/components/com_newsfeeds/views/newsfeed/tmpl/default.php - * components/com_content/views/article/tmpl/form.php - * templates/beez/html/com_content/article/form.php - * - * @param frmName - * @param srcListName - * @return - */ -function getSelectedValue(frmName, srcListName) { - var form = document[frmName], - srcList = form[srcListName]; - - i = srcList.selectedIndex; - if (i != null && i > -1) { - return srcList.options[i].value; - } else { - return null; - } -} + for ( i = 0; i < n; i++ ) { + if ( radioObj[ i ].checked ) { + return radioObj[ i ].value; + } + } -/** - * USED IN: all over :) - * - * @param id - * @param task - * @return - */ -function listItemTask(id, task) { - var f = document.adminForm, i, cbx, - cb = f[id]; - if (cb) { - for (i = 0; true; i++) { - cbx = f['cb'+i]; - if (!cbx) - break; - cbx.checked = false; - } // for - cb.checked = true; - f.boxchecked.value = 1; - submitbutton(task); - } - return false; -} + return ''; + }; + + /** + * USED IN: administrator/components/com_users/views/mail/tmpl/default.php + * Let's get rid of this and kill it + * + * @param frmName + * @param srcListName + * @return + */ + window.getSelectedValue = function ( frmName, srcListName ) { + var srcList = document[ frmName ][ srcListName ], + i = srcList.selectedIndex; + + if ( i !== null && i > -1 ) { + return srcList.options[ i ].value; + } else { + return null; + } + }; -/** - * Default function. Usually would be overriden by the component - * - * @deprecated 12.1 This function will be removed in a future version. Use Joomla.submitbutton() instead. - */ -function submitbutton(pressbutton) { - Joomla.submitform(pressbutton); -} + /** + * USED IN: all over :) + * + * @param id + * @param task + * @return + */ + window.listItemTask = function ( id, task ) { + var f = document.adminForm, + i = 0, cbx, + cb = f[ id ]; -/** - * Submit the admin form - * - * @deprecated 12.1 This function will be removed in a future version. Use Joomla.submitform() instead. - */ -function submitform(pressbutton) { - Joomla.submitform(pressbutton); -} + if ( !cb ) return false; -// needed for Table Column ordering -/** - * USED IN: libraries/joomla/html/html/grid.php - */ -function saveorder(n, task) { - checkAll_button(n, task); -} - -function checkAll_button(n, task) { - if (!task) { - task = 'saveorder'; - } - var j, box; - for (j = 0; j <= n; j++) { - box = document.adminForm['cb'+j]; - if (box) { - if (box.checked == false) { - box.checked = true; - } - } else { - alert("You cannot change the order of items, as an item in the list is `Checked Out`"); - return; - } - } - submitform(task); -} + while ( true ) { + cbx = f[ 'cb' + i ]; + + if ( !cbx ) break; + + cbx.checked = false; + + i++; + } + + cb.checked = true; + f.boxchecked.value = 1; + submitform( task ); + + return false; + }; + + /** + * Default function. Usually would be overriden by the component + * + * @deprecated 12.1 This function will be removed in a future version. Use Joomla.submitbutton() instead. + */ + window.submitbutton = function ( pressbutton ) { + Joomla.submitbutton( pressbutton ); + }; + + /** + * Submit the admin form + * + * @deprecated 12.1 This function will be removed in a future version. Use Joomla.submitform() instead. + */ + window.submitform = function ( pressbutton ) { + Joomla.submitform(pressbutton); + }; + + // needed for Table Column ordering + /** + * USED IN: libraries/joomla/html/html/grid.php + * There's a better way to do this now, can we try to kill it? + */ + window.saveorder = function ( n, task ) { + checkAll_button( n, task ); + }; + + /** + * Checks all the boxes unless one is missing then it assumes it's checked out. + * Weird. Probably only used by ^saveorder + * + * @param integer n The total number of checkboxes expected + * @param string task The task to perform + * + * @return void + */ + window.checkAll_button = function ( n, task ) { + task = task ? task : 'saveorder'; + + var j, box; + + for ( j = 0; j <= n; j++ ) { + box = document.adminForm[ 'cb' + j ]; + + if ( box ) { + box.checked = true; + } else { + alert( "You cannot change the order of items, as an item in the list is `Checked Out`" ); + return; + } + } + + Joomla.submitform( task ); + }; + +}( Joomla, document )); diff --git a/media/system/js/core.js b/media/system/js/core.js index 8f4f483e205ae..7f4ef29b68ec0 100644 --- a/media/system/js/core.js +++ b/media/system/js/core.js @@ -1 +1 @@ -function writeDynaList(e,t,n,r,i){var s="\n ",document.writeln(s)}function changeDynaList(e,t,n,r,s){var o=document.adminForm[e];for(i in o.options.length)o.options[i]=null;i=0;for(x in t)if(t[x][0]==n){opt=new Option,opt.value=t[x][1],opt.text=t[x][2];if(r==n&&s==opt.value||i==0)opt.selected=!0;o.options[i++]=opt}o.length=i}function radioGetCheckedValue(e){if(!e)return"";var t=e.length,n;if(t==undefined)return e.checked?e.value:"";for(n=0;n-1?r.options[i].value:null}function listItemTask(e,t){var n=document.adminForm,r,i,s=n[e];if(s){for(r=0;!0;r++){i=n["cb"+r];if(!i)break;i.checked=!1}s.checked=!0,n.boxchecked.value=1,submitbutton(t)}return!1}function submitbutton(e){Joomla.submitform(e)}function submitform(e){Joomla.submitform(e)}function saveorder(e,t){checkAll_button(e,t)}function checkAll_button(e,t){t||(t="saveorder");var n,r;for(n=0;n<=e;n++){r=document.adminForm["cb"+n];if(!r){alert("You cannot change the order of items, as an item in the list is `Checked Out`");return}r.checked==0&&(r.checked=!0)}submitform(t)}Joomla=window.Joomla||{},Joomla.editors={},Joomla.editors.instances={},Joomla.submitform=function(e,t,n){t||(t=document.getElementById("adminForm")),e&&(t.task.value=e),t.noValidate=!n;var r=document.createElement("input");r.style.display="none",r.type="submit",t.appendChild(r).click(),t.removeChild(r)},Joomla.submitbutton=function(e){Joomla.submitform(e)},Joomla.JText={strings:{},_:function(e,t){return typeof this.strings[e.toUpperCase()]!="undefined"?this.strings[e.toUpperCase()]:t},load:function(e){for(var t in e)this.strings[t.toUpperCase()]=e[t];return this}},Joomla.replaceTokens=function(e){var t=document.getElementsByTagName("input"),n;for(n=0;n=0;u--){var a=document.createElement("p");a.innerHTML=r[u],i.appendChild(a)}t.appendChild(i)}},Joomla.removeMessages=function(){var e=document.getElementById("system-message-container");while(e.firstChild)e.removeChild(e.firstChild);e.style.display="none",e.offsetHeight,e.style.display=""},Joomla.isChecked=function(e,t){typeof t=="undefined"&&(t=document.getElementById("adminForm")),e==1?t.boxchecked.value++:t.boxchecked.value--;var r=!0,i,s;for(i=0,n=t.elements.length;in;n++)o=e.form.elements[n],o.type==e.type&&0===o.id.indexOf(t)&&(o.checked=e.checked,r+=o.checked?1:0);return e.form.boxchecked&&(e.form.boxchecked.value=r),!0},e.renderMessages=function(n){e.removeMessages();var o,i,r,a,l,s,c,d=t.getElementById("system-message-container");for(o in n)if(n.hasOwnProperty(o)){for(i=n[o],r=t.createElement("div"),r.className="alert alert-"+o,a=e.JText._(o),"undefined"!=typeof a&&(l=t.createElement("h4"),l.className="alert-heading",l.innerHTML=e.JText._(o),r.appendChild(l)),s=i.length-1;s>=0;s--)c=t.createElement("p"),c.innerHTML=i[s],r.appendChild(c);d.appendChild(r)}},e.removeMessages=function(){for(var e=t.getElementById("system-message-container");e.firstChild;)e.removeChild(e.firstChild);e.style.display="none",e.offsetHeight,e.style.display=""},e.isChecked=function(e,n){if("undefined"==typeof n&&(n=t.getElementById("adminForm")),n.boxchecked.value+=e?1:-1,n.elements["checkall-toggle"]){var o,i,r,a=!0;for(o=0,r=n.elements.length;r>o;o++)if(i=n.elements[o],"checkbox"==i.type&&"checkall-toggle"!=i.name&&!i.checked){a=!1;break}n.elements["checkall-toggle"].checked=a}},e.popupWindow=function(e,t,n,o,i){var r=(screen.width-n)/2,a=(screen.height-o)/2,l="height="+o+",width="+n+",top="+a+",left="+r+",scrollbars="+i+",resizable";window.open(e,t,l).window.focus()},e.tableOrdering=function(n,o,i,r){"undefined"==typeof r&&(r=t.getElementById("adminForm")),r.filter_order.value=n,r.filter_order_Dir.value=o,e.submitform(i,r)},window.writeDynaList=function(e,n,o,i,r){var a,l,s,c="",t.writeln(c)},window.changeDynaList=function(e,n,o,i,r){for(var a,l,s,c=t.adminForm[e],d=o==i;c.firstChild;)c.removeChild(c.firstChild);a=0;for(l in n)n.hasOwnProperty(l)&&(s=n[l],s[0]==o&&(opt=new Option,opt.value=s[1],opt.text=s[2],(d&&r==opt.value||!d&&0===a)&&(opt.selected=!0),c.options[a++]=opt));c.length=a},window.radioGetCheckedValue=function(e){if(!e)return"";var t,n=e.length;if(void 0===n)return e.checked?e.value:"";for(t=0;n>t;t++)if(e[t].checked)return e[t].value;return""},window.getSelectedValue=function(e,n){var o=t[e][n],i=o.selectedIndex;return null!==i&&i>-1?o.options[i].value:null},window.listItemTask=function(e,n){var o,i=t.adminForm,r=0,a=i[e];if(!a)return!1;for(;;){if(o=i["cb"+r],!o)break;o.checked=!1,r++}return a.checked=!0,i.boxchecked.value=1,submitform(n),!1},window.submitbutton=function(t){e.submitbutton(t)},window.submitform=function(t){e.submitform(t)},window.saveorder=function(e,t){checkAll_button(e,t)},window.checkAll_button=function(n,o){o=o?o:"saveorder";var i,r;for(i=0;n>=i;i++){if(r=t.adminForm["cb"+i],!r)return void alert("You cannot change the order of items, as an item in the list is `Checked Out`");r.checked=!0}e.submitform(o)}}(Joomla,document);