[CLEANUP] Reformat IRRE JS code 33/29833/6
authorAndreas Wolf <andreas.wolf@typo3.org>
Sat, 3 May 2014 16:14:05 +0000 (18:14 +0200)
committerAndreas Wolf <andreas.wolf@typo3.org>
Fri, 11 Jul 2014 10:47:04 +0000 (12:47 +0200)
This is an automatic reformat performed by PhpStorm, to get rid of some
ugly constructs like one-line inline methods.

Change-Id: Id24666c673b3822916f9c5233c0b34ce7d38e7aa
Related: #58475
Releases: 6.3
Reviewed-on: https://review.typo3.org/29833
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Andreas Wolf
Tested-by: Andreas Wolf
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js

index b869f71..95989dd 100644 (file)
@@ -30,18 +30,18 @@ var inline = {
        data: {},
        isLoading: false,
 
-       addToDataArray: function(object) {
-               $H(object).each(function(pair) {
+       addToDataArray: function (object) {
+               $H(object).each(function (pair) {
                        inline.data[pair.key] = $H(inline.data[pair.key]).merge(pair.value).toObject();
                });
        },
-       setPrependFormFieldNames: function(value) {
+       setPrependFormFieldNames: function (value) {
                this.prependFormFieldNames = value;
        },
-       setNoTitleString: function(value) {
+       setNoTitleString: function (value) {
                this.noTitleString = value;
        },
-       toggleEvent: function(event) {
+       toggleEvent: function (event) {
                var triggerElement = TYPO3.jQuery(event.target);
                if (triggerElement.parents('.t3-form-field-header-inline-ctrl').length == 1) {
                        return;
@@ -54,18 +54,18 @@ var inline = {
                        recordHeader.attr('data-returnURL')
                );
        },
-       expandCollapseRecord: function(objectId, expandSingle, returnURL) {
+       expandCollapseRecord: function (objectId, expandSingle, returnURL) {
                var currentUid = this.parseObjectId('none', objectId, 1);
                var objectPrefix = this.parseObjectId('full', objectId, 0, 1);
                var escapedObjectId = this.escapeObjectId(objectId);
 
                var currentObject = TYPO3.jQuery('#' + escapedObjectId + '_div');
-                       // if content is not loaded yet, get it now from server
-               if((TYPO3.jQuery('#' + escapedObjectId + '_fields') && $("irre-loading-indicator" + objectId)) || inline.isLoading) {
+               // if content is not loaded yet, get it now from server
+               if ((TYPO3.jQuery('#' + escapedObjectId + '_fields') && $("irre-loading-indicator" + objectId)) || inline.isLoading) {
                        return false;
-               } else if ($(objectId + '_fields') && $(objectId + '_fields').innerHTML.substr(0,16) == '<!--notloaded-->') {
+               } else if ($(objectId + '_fields') && $(objectId + '_fields').innerHTML.substr(0, 16) == '<!--notloaded-->') {
                        inline.isLoading = true;
-                               // add loading-indicator
+                       // add loading-indicator
                        if (TYPO3.jQuery('#' + escapedObjectId + '_loadingbar').length === 0) {
                                var loadingBar = '<div id="' + escapedObjectId + '_loadingbar" class="t3-form-header-inline-loadingbar loadingbar"><div class="expand"></div></div>';
                                TYPO3.jQuery('#' + escapedObjectId + '_header').after(loadingBar);
@@ -77,8 +77,8 @@ var inline = {
                var collapse = new Array();
                var expand = new Array();
 
-                       // if only a single record should be visibly for that set of records
-                       // and the record clicked itself is no visible, collapse all others
+               // if only a single record should be visibly for that set of records
+               // and the record clicked itself is no visible, collapse all others
                if (expandSingle && currentObject.hasClass(this.classCollapsed)) {
                        collapse = this.collapseAllRecords(objectId, objectPrefix, currentUid);
                }
@@ -98,7 +98,7 @@ var inline = {
                return false;
        },
 
-       toggleElement: function(objectId) {
+       toggleElement: function (objectId) {
                var escapedObjectId = this.escapeObjectId(objectId);
                var jQueryObject = TYPO3.jQuery('#' + escapedObjectId + '_div');
 
@@ -110,18 +110,18 @@ var inline = {
                        jQueryObject.find('#' + escapedObjectId + '_header .t3-icon-irre-expanded').addClass('t3-icon-irre-collapsed').removeClass('t3-icon-irre-expanded');
                }
        },
-       collapseAllRecords: function(objectId, objectPrefix, callingUid) {
-                       // get the form field, where all records are stored
-               var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectId, 3, 2, true);
+       collapseAllRecords: function (objectId, objectPrefix, callingUid) {
+               // get the form field, where all records are stored
+               var objectName = this.prependFormFieldNames + this.parseObjectId('parts', objectId, 3, 2, true);
                var formObj = document.getElementsByName(objectName);
                var collapse = [];
 
                if (formObj.length) {
-                               // the uid of the calling object (last part in objectId)
+                       // the uid of the calling object (last part in objectId)
                        var recObjectId = '', escapedRecordObjectId;
 
                        var records = formObj[0].value.split(',');
-                       for (var i=0; i<records.length; i++) {
+                       for (var i = 0; i < records.length; i++) {
                                recObjectId = objectPrefix + this.structureSeparator + records[i];
                                escapedRecordObjectId = this.escapeObjectId(recObjectId);
 
@@ -140,21 +140,21 @@ var inline = {
                return collapse;
        },
 
-       updateExpandedCollapsedStateLocally: function(objectId, value) {
-               var ucName = 'uc[inlineView]'+this.parseObjectId('parts', objectId, 3, 2, true);
+       updateExpandedCollapsedStateLocally: function (objectId, value) {
+               var ucName = 'uc[inlineView]' + this.parseObjectId('parts', objectId, 3, 2, true);
                var ucFormObj = document.getElementsByName(ucName);
                if (ucFormObj.length) {
                        ucFormObj[0].value = value;
                }
        },
 
-       getRecordDetails: function(objectId, returnURL) {
+       getRecordDetails: function (objectId, returnURL) {
                var context = this.getContext(this.parseObjectId('full', objectId, 0, 1));
                inline.makeAjaxCall('getRecordDetails', [inline.getNumberOfRTE(), objectId, returnURL], true, context);
                return false;
        },
 
-       createNewRecord: function(objectId, recordUid) {
+       createNewRecord: function (objectId, recordUid) {
                if (this.isBelowMax(objectId)) {
                        var context = this.getContext(objectId);
                        if (recordUid) {
@@ -167,40 +167,46 @@ var inline = {
                return false;
        },
 
-       synchronizeLocalizeRecords: function(objectId, type) {
+       synchronizeLocalizeRecords: function (objectId, type) {
                var context = this.getContext(objectId);
                var parameters = [this.getNumberOfRTE(), objectId, type];
                this.makeAjaxCall('synchronizeLocalizeRecords', parameters, true, context);
        },
 
-       setExpandedCollapsedState: function(objectId, expand, collapse) {
+       setExpandedCollapsedState: function (objectId, expand, collapse) {
                var context = this.getContext(objectId);
                this.makeAjaxCall('setExpandedCollapsedState', [objectId, expand, collapse], false, context);
        },
 
-       makeAjaxCall: function(method, params, lock, context) {
-               var max, url='', urlParams='', options={};
+       makeAjaxCall: function (method, params, lock, context) {
+               var max, url = '', urlParams = '', options = {};
                if (method && params && params.length && this.lockAjaxMethod(method, lock)) {
                        url = TBE_EDITOR.getBackendPath() + TYPO3.settings.ajaxUrls['t3lib_TCEforms_inline::' + method];
                        urlParams = '';
-                       for (var i=0, max=params.length; i<max; i++) {
+                       for (var i = 0, max = params.length; i < max; i++) {
                                urlParams += '&ajax[' + i + ']=' + encodeURIComponent(params[i]);
                        }
                        if (context) {
                                urlParams += '&ajax[context]=' + encodeURIComponent(Object.toJSON(context));
                        }
                        options = {
-                               method:         'post',
-                               parameters:     urlParams,
-                               onSuccess:      function(xhr) { inline.isLoading = false; inline.processAjaxResponse(method, xhr); },
-                               onFailure:      function(xhr) { inline.isLoading = false; inline.showAjaxFailure(method, xhr); }
+                               method: 'post',
+                               parameters: urlParams,
+                               onSuccess: function (xhr) {
+                                       inline.isLoading = false;
+                                       inline.processAjaxResponse(method, xhr);
+                               },
+                               onFailure: function (xhr) {
+                                       inline.isLoading = false;
+                                       inline.showAjaxFailure(method, xhr);
+                               }
                        };
 
                        new Ajax.Request(url, options);
                }
        },
 
-       lockAjaxMethod: function(method, lock) {
+       lockAjaxMethod: function (method, lock) {
                if (!lock || !inline.lockedAjaxMethod[method]) {
                        inline.lockedAjaxMethod[method] = true;
                        return true;
@@ -209,36 +215,36 @@ var inline = {
                }
        },
 
-       unlockAjaxMethod: function(method) {
+       unlockAjaxMethod: function (method) {
                inline.lockedAjaxMethod[method] = false;
        },
 
-       processAjaxResponse: function(method, xhr, json) {
-               var addTag=null, restart=false, processedCount=0, element=null, errorCatch=[], sourcesWaiting=[];
+       processAjaxResponse: function (method, xhr, json) {
+               var addTag = null, restart = false, processedCount = 0, element = null, errorCatch = [], sourcesWaiting = [];
                if (!json && xhr) {
                        json = xhr.responseJSON;
                }
-                       // If there are elements the should be added to the <HEAD> tag (e.g. for RTEhtmlarea):
+               // If there are elements the should be added to the <HEAD> tag (e.g. for RTEhtmlarea):
                if (json.headData) {
                        var head = inline.getDomHeadTag();
                        var headTags = inline.getDomHeadChildren(head);
-                       $A(json.headData).each(function(addTag) {
+                       $A(json.headData).each(function (addTag) {
                                if (!restart) {
                                        if (addTag && (addTag.innerHTML || !inline.searchInDomTags(headTags, addTag))) {
-                                               if (addTag.name=='SCRIPT' && addTag.innerHTML && processedCount) {
+                                               if (addTag.name == 'SCRIPT' && addTag.innerHTML && processedCount) {
                                                        restart = true;
                                                        return false;
                                                } else {
-                                                       if (addTag.name=='SCRIPT' && addTag.innerHTML) {
+                                                       if (addTag.name == 'SCRIPT' && addTag.innerHTML) {
                                                                try {
                                                                        eval(addTag.innerHTML);
-                                                               } catch(e) {
+                                                               } catch (e) {
                                                                        errorCatch.push(e);
                                                                }
                                                        } else {
                                                                element = inline.createNewDomElement(addTag);
-                                                                       // Set onload handler for external JS scripts:
-                                                               if (addTag.name=='SCRIPT' && element.src) {
+                                                               // Set onload handler for external JS scripts:
+                                                               if (addTag.name == 'SCRIPT' && element.src) {
                                                                        element.onload = inline.sourceLoadedHandler(element);
                                                                        sourcesWaiting.push(element.src);
                                                                }
@@ -252,23 +258,27 @@ var inline = {
                        });
                }
                if (restart || processedCount) {
-                       window.setTimeout(function() { inline.reprocessAjaxResponse(method, json, sourcesWaiting); }, 40);
+                       window.setTimeout(function () {
+                               inline.reprocessAjaxResponse(method, json, sourcesWaiting);
+                       }, 40);
                } else {
                        if (method) {
                                inline.unlockAjaxMethod(method);
                        }
                        if (json.scriptCall && json.scriptCall.length) {
-                               $A(json.scriptCall).each(function(value) { eval(value); });
+                               $A(json.scriptCall).each(function (value) {
+                                       eval(value);
+                               });
                        }
                        TYPO3.TCEFORMS.convertDateFieldsToDatePicker();
                }
        },
 
-               // Check if dynamically added scripts are loaded and restart inline.processAjaxResponse():
+       // Check if dynamically added scripts are loaded and restart inline.processAjaxResponse():
        reprocessAjaxResponse: function (method, json, sourcesWaiting) {
                var sourcesLoaded = true;
                if (sourcesWaiting && sourcesWaiting.length) {
-                       $A(sourcesWaiting).each(function(source) {
+                       $A(sourcesWaiting).each(function (source) {
                                if (!inline.sourcesLoaded[source]) {
                                        sourcesLoaded = false;
                                        return false;
@@ -276,29 +286,33 @@ var inline = {
                        });
                }
                if (sourcesLoaded) {
-                       $A(sourcesWaiting).each(function(source) {
+                       $A(sourcesWaiting).each(function (source) {
                                delete(inline.sourcesLoaded[source]);
                        });
-                       window.setTimeout(function() { inline.processAjaxResponse(method, null, json); }, 80);
+                       window.setTimeout(function () {
+                               inline.processAjaxResponse(method, null, json);
+                       }, 80);
                } else {
-                       window.setTimeout(function() { inline.reprocessAjaxResponse(method, json, sourcesWaiting); }, 40);
+                       window.setTimeout(function () {
+                               inline.reprocessAjaxResponse(method, json, sourcesWaiting);
+                       }, 40);
                }
        },
 
-       sourceLoadedHandler: function(element) {
+       sourceLoadedHandler: function (element) {
                if (element && element.src) {
                        inline.sourcesLoaded[element.src] = true;
                }
        },
 
-       showAjaxFailure: function(method, xhr) {
+       showAjaxFailure: function (method, xhr) {
                inline.unlockAjaxMethod(method);
-               alert('Error: '+xhr.status+"\n"+xhr.statusText);
+               alert('Error: ' + xhr.status + "\n" + xhr.statusText);
        },
 
-               // foreign_selector: used by selector box (type='select')
-       importNewRecord: function(objectId) {
-               var selector = $(objectId+'_selector');
+       // foreign_selector: used by selector box (type='select')
+       importNewRecord: function (objectId) {
+               var selector = $(objectId + '_selector');
                if (selector.selectedIndex != -1) {
                        var context = this.getContext(objectId);
                        var selectedValue = selector.options[selector.selectedIndex].value;
@@ -310,40 +324,41 @@ var inline = {
                return false;
        },
 
-               // foreign_selector: used by element browser (type='group/db')
-       importElement: function(objectId, table, uid, type) {
+       // foreign_selector: used by element browser (type='group/db')
+       importElement: function (objectId, table, uid, type) {
                var context = this.getContext(objectId);
                inline.makeAjaxCall('createNewRecord', [inline.getNumberOfRTE(), objectId, uid], true, context);
        },
 
-       importElementMultiple: function(objectId, table, uidArray, type) {
-               uidArray.each(function(uid) {
+       importElementMultiple: function (objectId, table, uidArray, type) {
+               uidArray.each(function (uid) {
                        inline.delayedImportElement(objectId, table, uid, type);
                });
        },
-       delayedImportElement: function(objectId, table, uid, type) {
+       delayedImportElement: function (objectId, table, uid, type) {
                if (inline.lockedAjaxMethod['createNewRecord'] == true) {
-                       window.setTimeout("inline.delayedImportElement('" + objectId + "','" + table + "'," +  uid + ", null );", 300);
+                       window.setTimeout("inline.delayedImportElement('" + objectId + "','" + table + "'," + uid + ", null );",
+                                         300);
                } else {
                        inline.importElement(objectId, table, uid, type);
                }
        },
-               // Check uniqueness for element browser:
-       checkUniqueElement: function(objectId, table, uid, type) {
+       // Check uniqueness for element browser:
+       checkUniqueElement: function (objectId, table, uid, type) {
                if (this.checkUniqueUsed(objectId, uid, table)) {
-                       return {passed: false,message: 'There is already a relation to the selected element!'};
+                       return {passed: false, message: 'There is already a relation to the selected element!'};
                } else {
                        return {passed: true};
                }
        },
 
-               // Checks if a record was used and should be unique:
-       checkUniqueUsed: function(objectId, uid, table) {
+       // Checks if a record was used and should be unique:
+       checkUniqueUsed: function (objectId, uid, table) {
                if (this.data.unique && this.data.unique[objectId]) {
                        var unique = this.data.unique[objectId];
                        var values = $H(unique.used).values();
 
-                               // for select: only the uid is stored
+                       // for select: only the uid is stored
                        if (unique['type'] == 'select') {
                                if (values.indexOf(uid) != -1) {
                                        return true;
@@ -351,9 +366,9 @@ var inline = {
 
                                // for group/db: table and uid is stored in a assoc array
                        } else if (unique.type == 'groupdb') {
-                               for (var i=values.length-1; i>=0; i--) {
-                                               // if the pair table:uid is already used:
-                                       if (values[i].table==table && values[i].uid==uid) {
+                               for (var i = values.length - 1; i >= 0; i--) {
+                                       // if the pair table:uid is already used:
+                                       if (values[i].table == table && values[i].uid == uid) {
                                                return true;
                                        }
                                }
@@ -362,20 +377,20 @@ var inline = {
                return false;
        },
 
-       setUniqueElement: function(objectId, table, uid, type, elName) {
+       setUniqueElement: function (objectId, table, uid, type, elName) {
                var recordUid = this.parseFormElementName('none', elName, 1, 1);
                // alert(objectId+'/'+table+'/'+uid+'/'+recordUid);
                this.setUnique(objectId, recordUid, uid);
        },
-               // Remove all select items already used
-               // from a newly retrieved/expanded record
-       removeUsed: function(objectId, recordUid) {
+       // Remove all select items already used
+       // from a newly retrieved/expanded record
+       removeUsed: function (objectId, recordUid) {
                if (this.data.unique && this.data.unique[objectId]) {
                        var unique = this.data.unique[objectId];
                        if (unique.type == 'select') {
-                               var formName = this.prependFormFieldNames+this.parseObjectId('parts', objectId, 3, 1, true);
+                               var formName = this.prependFormFieldNames + this.parseObjectId('parts', objectId, 3, 1, true);
                                var formObj = document.getElementsByName(formName);
-                               var recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+recordUid+']['+unique.field+']');
+                               var recordObj = document.getElementsByName(this.prependFormFieldNames + '[' + unique.table + '][' + recordUid + '][' + unique.field + ']');
                                var values = $H(unique.used).values();
                                if (recordObj.length) {
                                        if (recordObj[0].hasOwnProperty('options')) {
@@ -390,33 +405,33 @@ var inline = {
                        }
                }
        },
-               // this function is applied to a newly inserted record by AJAX
-               // it removes the used select items, that should be unique
-       setUnique: function(objectId, recordUid, selectedValue) {
+       // this function is applied to a newly inserted record by AJAX
+       // it removes the used select items, that should be unique
+       setUnique: function (objectId, recordUid, selectedValue) {
                if (this.data.unique && this.data.unique[objectId]) {
                        var unique = this.data.unique[objectId];
                        if (unique.type == 'select') {
                                if (!(unique.selector && unique.max == -1)) {
-                                       var formName = this.prependFormFieldNames+this.parseObjectId('parts', objectId, 3, 1, true);
+                                       var formName = this.prependFormFieldNames + this.parseObjectId('parts', objectId, 3, 1, true);
                                        var formObj = document.getElementsByName(formName);
-                                       var recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+recordUid+']['+unique.field+']');
+                                       var recordObj = document.getElementsByName(this.prependFormFieldNames + '[' + unique.table + '][' + recordUid + '][' + unique.field + ']');
                                        var values = $H(unique.used).values();
-                                       var selector = $(objectId+'_selector');
+                                       var selector = $(objectId + '_selector');
                                        if (selector.length) {
-                                                       // remove all items from the new select-item which are already used in other children
+                                               // remove all items from the new select-item which are already used in other children
                                                if (recordObj.length) {
-                                                       for (var i=0; i<values.length; i++) {
+                                                       for (var i = 0; i < values.length; i++) {
                                                                this.removeSelectOption(recordObj[0], values[i]);
                                                        }
-                                                               // set the selected item automatically to the first of the remaining items if no selector is used
+                                                       // set the selected item automatically to the first of the remaining items if no selector is used
                                                        if (!unique.selector) {
                                                                selectedValue = recordObj[0].options[0].value;
                                                                recordObj[0].options[0].selected = true;
                                                                this.updateUnique(recordObj[0], objectId, formName, recordUid);
-                                                               this.handleChangedField(recordObj[0], objectId+'['+recordUid+']');
+                                                               this.handleChangedField(recordObj[0], objectId + '[' + recordUid + ']');
                                                        }
                                                }
-                                               for (var i=0; i<values.length; i++) {
+                                               for (var i = 0; i < values.length; i++) {
                                                        this.removeSelectOption(selector, values[i]);
                                                }
                                                if (typeof this.data.unique[objectId].used.length != 'undefined') {
@@ -424,11 +439,11 @@ var inline = {
                                                }
                                                this.data.unique[objectId].used[recordUid] = selectedValue;
                                        }
-                                               // remove the newly used item from each select-field of the child records
+                                       // remove the newly used item from each select-field of the child records
                                        if (formObj.length && selectedValue) {
                                                var records = formObj[0].value.split(',');
-                                               for (var i=0; i<records.length; i++) {
-                                                       recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+records[i]+']['+unique.field+']');
+                                               for (var i = 0; i < records.length; i++) {
+                                                       recordObj = document.getElementsByName(this.prependFormFieldNames + '[' + unique.table + '][' + records[i] + '][' + unique.field + ']');
                                                        if (recordObj.length && records[i] != recordUid) {
                                                                this.removeSelectOption(recordObj[0], selectedValue);
                                                        }
@@ -436,20 +451,20 @@ var inline = {
                                        }
                                }
                        } else if (unique.type == 'groupdb') {
-                                       // add the new record to the used items:
-                               this.data.unique[objectId].used[recordUid] = {'table':unique.elTable, 'uid':selectedValue};
+                               // add the new record to the used items:
+                               this.data.unique[objectId].used[recordUid] = {'table': unique.elTable, 'uid': selectedValue};
                        }
 
-                               // remove used items from a selector-box
+                       // remove used items from a selector-box
                        if (unique.selector == 'select' && selectedValue) {
-                               var selector = $(objectId+'_selector');
+                               var selector = $(objectId + '_selector');
                                this.removeSelectOption(selector, selectedValue);
                                this.data.unique[objectId]['used'][recordUid] = selectedValue;
                        }
                }
        },
 
-       domAddNewRecord: function(method, insertObject, objectPrefix, htmlData) {
+       domAddNewRecord: function (method, insertObject, objectPrefix, htmlData) {
                if (this.isBelowMax(objectPrefix)) {
                        if (method == 'bottom') {
                                new Insertion.Bottom(insertObject, htmlData);
@@ -458,10 +473,10 @@ var inline = {
                        }
                }
        },
-       domAddRecordDetails: function(objectId, objectPrefix, expandSingle, htmlData) {
+       domAddRecordDetails: function (objectId, objectPrefix, expandSingle, htmlData) {
                var hiddenValue, formObj, valueObj;
                var objectDiv = $(objectId + '_fields');
-               if (!objectDiv || objectDiv.innerHTML.substr(0,16) != '<!--notloaded-->') {
+               if (!objectDiv || objectDiv.innerHTML.substr(0, 16) != '<!--notloaded-->') {
                        return;
                }
 
@@ -472,43 +487,43 @@ var inline = {
                formObj = $$('[name="' + elName + '[hidden]_0"]');
                valueObj = $$('[name="' + elName + '[hidden]"]');
 
-                       // It might be the case that a child record
-                       // cannot be hidden at all (no hidden field)
+               // It might be the case that a child record
+               // cannot be hidden at all (no hidden field)
                if (formObj.length && valueObj.length) {
                        hiddenValue = formObj[0].checked;
                        formObj[0].remove();
                        valueObj[0].remove();
                }
 
-                       // Update DOM
+               // Update DOM
                objectDiv.update(htmlData);
 
                formObj = document.getElementsByName(elName + '[hidden]_0');
                valueObj = document.getElementsByName(elName + '[hidden]');
 
-                       // Set the hidden value again
+               // Set the hidden value again
                if (formObj.length && valueObj.length) {
                        valueObj[0].value = hiddenValue ? 1 : 0;
                        formObj[0].checked = hiddenValue;
                }
 
-                       // remove loading-indicator
+               // remove loading-indicator
                TYPO3.jQuery('#' + escapeSelectorObjectId + '_loadingbar').remove();
 
-                       // now that the content is loaded, set the expandState
+               // now that the content is loaded, set the expandState
                this.expandCollapseRecord(objectId, expandSingle);
        },
 
-               // Get script and link elements from head tag:
-       getDomHeadChildren: function(head) {
+       // Get script and link elements from head tag:
+       getDomHeadChildren: function (head) {
                var headTags = [];
-               $$('head script', 'head link').each(function(tag) {
+               $$('head script', 'head link').each(function (tag) {
                        headTags.push(tag);
                });
                return headTags;
        },
 
-       getDomHeadTag: function() {
+       getDomHeadTag: function () {
                if (document && document.head) {
                        return document.head;
                } else {
@@ -520,19 +535,19 @@ var inline = {
                return false;
        },
 
-               // Search whether elements exist in a given haystack:
-       searchInDomTags: function(haystack, needle) {
+       // Search whether elements exist in a given haystack:
+       searchInDomTags: function (haystack, needle) {
                var result = false;
-               $A(haystack).each(function(element) {
-                       if (element.nodeName.toUpperCase()==needle.name) {
+               $A(haystack).each(function (element) {
+                       if (element.nodeName.toUpperCase() == needle.name) {
                                var attributesCount = $H(needle.attributes).keys().length;
                                var attributesFound = 0;
-                               $H(needle.attributes).each(function(attribute) {
-                                       if (element.getAttribute && element.getAttribute(attribute.key)==attribute.value) {
+                               $H(needle.attributes).each(function (attribute) {
+                                       if (element.getAttribute && element.getAttribute(attribute.key) == attribute.value) {
                                                attributesFound++;
                                        }
                                });
-                               if (attributesFound==attributesCount) {
+                               if (attributesFound == attributesCount) {
                                        result = true;
                                        return true;
                                }
@@ -541,48 +556,48 @@ var inline = {
                return result;
        },
 
-               // Create a new DOM element:
-       createNewDomElement: function(addTag) {
+       // Create a new DOM element:
+       createNewDomElement: function (addTag) {
                var element = document.createElement(addTag.name);
                if (addTag.attributes) {
-                       $H(addTag.attributes).each(function(attribute) {
+                       $H(addTag.attributes).each(function (attribute) {
                                element[attribute.key] = attribute.value;
                        });
                }
                return element;
        },
 
-       changeSorting: function(objectId, direction) {
-               var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectId, 3, 2, true);
+       changeSorting: function (objectId, direction) {
+               var objectName = this.prependFormFieldNames + this.parseObjectId('parts', objectId, 3, 2, true);
                var objectPrefix = this.parseObjectId('full', objectId, 0, 1);
                var formObj = document.getElementsByName(objectName);
 
                if (formObj.length) {
-                               // the uid of the calling object (last part in objectId)
+                       // the uid of the calling object (last part in objectId)
                        var callingUid = this.parseObjectId('none', objectId, 1);
                        var records = formObj[0].value.split(',');
                        var current = records.indexOf(callingUid);
                        var changed = false;
 
-                               // move up
+                       // move up
                        if (direction > 0 && current > 0) {
-                               records[current] = records[current-1];
-                               records[current-1] = callingUid;
+                               records[current] = records[current - 1];
+                               records[current - 1] = callingUid;
                                changed = true;
 
                                // move down
-                       } else if (direction < 0 && current < records.length-1) {
-                               records[current] = records[current+1];
-                               records[current+1] = callingUid;
+                       } else if (direction < 0 && current < records.length - 1) {
+                               records[current] = records[current + 1];
+                               records[current + 1] = callingUid;
                                changed = true;
                        }
 
                        if (changed) {
                                formObj[0].value = records.join(',');
                                var cAdj = direction > 0 ? 1 : 0; // adjustment
-                               $(objectId+'_div').parentNode.insertBefore(
-                                       $(objectPrefix + this.structureSeparator + records[current-cAdj] + '_div'),
-                                       $(objectPrefix + this.structureSeparator + records[current+1-cAdj] + '_div')
+                               $(objectId + '_div').parentNode.insertBefore(
+                                       $(objectPrefix + this.structureSeparator + records[current - cAdj] + '_div'),
+                                       $(objectPrefix + this.structureSeparator + records[current + 1 - cAdj] + '_div')
                                );
                                this.redrawSortingButtons(objectPrefix, records);
                        }
@@ -591,24 +606,24 @@ var inline = {
                return false;
        },
 
-       dragAndDropSorting: function(element) {
-               require(['jquery'], function($) {
+       dragAndDropSorting: function (element) {
+               require(['jquery'], function ($) {
                        var objectId = element.getAttribute('id').replace(/_records$/, '');
-                       var objectName = inline.prependFormFieldNames+inline.parseObjectId('parts', objectId, 3, 0, true);
+                       var objectName = inline.prependFormFieldNames + inline.parseObjectId('parts', objectId, 3, 0, true);
                        var formObj = document.getElementsByName(objectName);
-                       var $element = $( element );
+                       var $element = $(element);
 
                        if (formObj.length) {
                                var checked = new Array();
                                var order = [];
-                               $element.find('.sortableHandle').each(function(i,e) {
+                               $element.find('.sortableHandle').each(function (i, e) {
                                        order.push($(e).data('id').toString());
                                });
                                var records = formObj[0].value.split(',');
 
-                                       // check if ordered uid is really part of the records
-                                       // virtually deleted items might still be there but ordering shouldn't saved at all on them
-                               for (var i=0; i<order.length; i++) {
+                               // check if ordered uid is really part of the records
+                               // virtually deleted items might still be there but ordering shouldn't saved at all on them
+                               for (var i = 0; i < order.length; i++) {
                                        if (records.indexOf(order[i]) != -1) {
                                                checked.push(order[i]);
                                        }
@@ -624,8 +639,8 @@ var inline = {
                });
        },
 
-       createDragAndDropSorting: function(objectId) {
-               require(['jquery','jquery-ui/jquery-ui-1.10.4.custom.min'], function($) {
+       createDragAndDropSorting: function (objectId) {
+               require(['jquery', 'jquery-ui/jquery-ui-1.10.4.custom.min'], function ($) {
                        var $sortingContainer = $('#' + objectId);
 
                        if ($sortingContainer.hasClass('ui-sortable')) {
@@ -641,7 +656,7 @@ var inline = {
                                        zIndex: '4000',
                                        axis: 'y',
                                        tolerance: 'pointer',
-                                       stop: function() {
+                                       stop: function () {
                                                inline.dragAndDropSorting($sortingContainer[0]);
                                        }
                                }
@@ -649,8 +664,8 @@ var inline = {
                });
        },
 
-       destroyDragAndDropSorting: function(objectId) {
-               require(['jquery','jquery-ui/jquery-ui-1.10.4.custom.min'], function($) {
+       destroyDragAndDropSorting: function (objectId) {
+               require(['jquery', 'jquery-ui/jquery-ui-1.10.4.custom.min'], function ($) {
                        var $sortingContainer = $('#' + objectId);
                        if (!$sortingContainer.hasClass('ui-sortable')) {
                                return;
@@ -659,22 +674,22 @@ var inline = {
                });
        },
 
-       redrawSortingButtons: function(objectPrefix, records) {
+       redrawSortingButtons: function (objectPrefix, records) {
                var i;
                var headerObj;
                var sortingObj = new Array();
 
-                       // if no records were passed, fetch them from form field
+               // if no records were passed, fetch them from form field
                if (typeof records == 'undefined') {
                        records = new Array();
-                       var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectPrefix, 3, 1, true);
+                       var objectName = this.prependFormFieldNames + this.parseObjectId('parts', objectPrefix, 3, 1, true);
                        var formObj = document.getElementsByName(objectName);
                        if (formObj.length) {
                                records = formObj[0].value.split(',');
                        }
                }
 
-               for (i=0; i<records.length; i++) {
+               for (i = 0; i < records.length; i++) {
                        if (!records[i].length) {
                                continue;
                        }
@@ -687,23 +702,25 @@ var inline = {
                                sortingObj[0][0].style.visibility = (i == 0 ? 'hidden' : 'visible');
                        }
                        if (sortingObj[1].length) {
-                               sortingObj[1][0].style.visibility = (i == records.length-1 ? 'hidden' : 'visible');
+                               sortingObj[1][0].style.visibility = (i == records.length - 1 ? 'hidden' : 'visible');
                        }
                }
        },
 
-       memorizeAddRecord: function(objectPrefix, newUid, afterUid, selectedValue) {
+       memorizeAddRecord: function (objectPrefix, newUid, afterUid, selectedValue) {
                if (this.isBelowMax(objectPrefix)) {
-                       var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectPrefix, 3, 1, true);
+                       var objectName = this.prependFormFieldNames + this.parseObjectId('parts', objectPrefix, 3, 1, true);
                        var formObj = document.getElementsByName(objectName);
 
                        if (formObj.length) {
                                var records = new Array();
-                               if (formObj[0].value.length) records = formObj[0].value.split(',');
+                               if (formObj[0].value.length) {
+                                       records = formObj[0].value.split(',');
+                               }
 
                                if (afterUid) {
                                        var newRecords = new Array();
-                                       for (var i=0; i<records.length; i++) {
+                                       for (var i = 0; i < records.length; i++) {
                                                if (records[i].length) {
                                                        newRecords.push(records[i]);
                                                }
@@ -726,11 +743,11 @@ var inline = {
                        }
                }
 
-                       // if we reached the maximum off possible records after this action, hide the new buttons
+               // if we reached the maximum off possible records after this action, hide the new buttons
                if (!this.isBelowMax(objectPrefix)) {
-                       var objectParent = this.parseObjectId('full', objectPrefix, 0 , 1);
+                       var objectParent = this.parseObjectId('full', objectPrefix, 0, 1);
                        var md5 = this.getObjectMD5(objectParent);
-                       this.hideElementsWithClassName('.inlineNewButton'+(md5 ? '.'+md5 : ''), objectParent);
+                       this.hideElementsWithClassName('.inlineNewButton' + (md5 ? '.' + md5 : ''), objectParent);
                }
 
                if (TBE_EDITOR) {
@@ -738,7 +755,7 @@ var inline = {
                }
        },
 
-       memorizeRemoveRecord: function(objectName, removeUid) {
+       memorizeRemoveRecord: function (objectName, removeUid) {
                var formObj = document.getElementsByName(objectName);
                if (formObj.length) {
                        var parts = new Array();
@@ -755,13 +772,13 @@ var inline = {
                return false;
        },
 
-       updateUnique: function(srcElement, objectPrefix, formName, recordUid) {
+       updateUnique: function (srcElement, objectPrefix, formName, recordUid) {
                if (this.data.unique && this.data.unique[objectPrefix]) {
                        var unique = this.data.unique[objectPrefix];
                        var oldValue = unique.used[recordUid];
 
                        if (unique.selector == 'select') {
-                               var selector = $(objectPrefix+'_selector');
+                               var selector = $(objectPrefix + '_selector');
                                this.removeSelectOption(selector, srcElement.value);
                                if (typeof oldValue != 'undefined') {
                                        this.readdSelectOption(selector, oldValue, unique);
@@ -773,8 +790,8 @@ var inline = {
                                if (unique && formObj.length) {
                                        var records = formObj[0].value.split(',');
                                        var recordObj;
-                                       for (var i=0; i<records.length; i++) {
-                                               recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+records[i]+']['+unique.field+']');
+                                       for (var i = 0; i < records.length; i++) {
+                                               recordObj = document.getElementsByName(this.prependFormFieldNames + '[' + unique.table + '][' + records[i] + '][' + unique.field + ']');
                                                if (recordObj.length && recordObj[0] != srcElement) {
                                                        this.removeSelectOption(recordObj[0], srcElement.value);
                                                        if (typeof oldValue != 'undefined') {
@@ -788,10 +805,10 @@ var inline = {
                }
        },
 
-       revertUnique: function(objectPrefix, elName, recordUid) {
+       revertUnique: function (objectPrefix, elName, recordUid) {
                if (this.data.unique && this.data.unique[objectPrefix]) {
                        var unique = this.data.unique[objectPrefix];
-                       var fieldObj = elName ? document.getElementsByName(elName+'['+unique.field+']') : null;
+                       var fieldObj = elName ? document.getElementsByName(elName + '[' + unique.field + ']') : null;
 
                        if (unique.type == 'select') {
                                if (fieldObj && fieldObj.length) {
@@ -799,20 +816,21 @@ var inline = {
 
                                        if (unique.selector == 'select') {
                                                if (!isNaN(fieldObj[0].value)) {
-                                                       var selector = $(objectPrefix+'_selector');
+                                                       var selector = $(objectPrefix + '_selector');
                                                        this.readdSelectOption(selector, fieldObj[0].value, unique);
                                                }
                                        }
 
                                        if (!(unique.selector && unique.max == -1)) {
-                                               var formName = this.prependFormFieldNames+this.parseObjectId('parts', objectPrefix, 3, 1, true);
+                                               var formName = this.prependFormFieldNames + this.parseObjectId('parts', objectPrefix, 3, 1,
+                                                                                                              true);
                                                var formObj = document.getElementsByName(formName);
                                                if (formObj.length) {
                                                        var records = formObj[0].value.split(',');
                                                        var recordObj;
-                                                               // walk through all inline records on that level and get the select field
-                                                       for (var i=0; i<records.length; i++) {
-                                                               recordObj = document.getElementsByName(this.prependFormFieldNames+'['+unique.table+']['+records[i]+']['+unique.field+']');
+                                                       // walk through all inline records on that level and get the select field
+                                                       for (var i = 0; i < records.length; i++) {
+                                                               recordObj = document.getElementsByName(this.prependFormFieldNames + '[' + unique.table + '][' + records[i] + '][' + unique.field + ']');
                                                                if (recordObj.length) {
                                                                        this.readdSelectOption(recordObj[0], fieldObj[0].value, unique);
                                                                }
@@ -827,7 +845,7 @@ var inline = {
                }
        },
 
-       enableDisableRecord: function(objectId) {
+       enableDisableRecord: function (objectId) {
                var elName = this.parseObjectId('full', objectId, 2, 0, true) + '[hidden]';
                var formObj = document.getElementsByName(elName + '_0');
                var valueObj = document.getElementsByName(elName);
@@ -835,7 +853,7 @@ var inline = {
 
                var $container = TYPO3.jQuery('#' + objectId + '_div');
 
-                       // It might be the case that there's no hidden field
+               // It might be the case that there's no hidden field
                if (formObj.length && valueObj.length) {
                        formObj[0].click();
                        valueObj[0].value = formObj[0].checked ? 1 : 0;
@@ -844,11 +862,11 @@ var inline = {
 
                if (icon) {
                        if (icon.hasClassName('t3-icon-edit-hide')) {
-                               icon.removeClassName ('t3-icon-edit-hide');
+                               icon.removeClassName('t3-icon-edit-hide');
                                icon.addClassName('t3-icon-edit-unhide');
                                $container.addClass('t3-form-field-container-inline-hidden');
                        } else {
-                               icon.removeClassName ('t3-icon-edit-unhide');
+                               icon.removeClassName('t3-icon-edit-unhide');
                                icon.addClassName('t3-icon-edit-hide');
                                $container.removeClass('t3-form-field-container-inline-hidden');
                        }
@@ -857,79 +875,79 @@ var inline = {
                return false;
        },
 
-       deleteRecord: function(objectId, options) {
+       deleteRecord: function (objectId, options) {
                var i, j, inlineRecords, records, childObjectId, childTable;
-               var objectPrefix = this.parseObjectId('full', objectId, 0 , 1);
+               var objectPrefix = this.parseObjectId('full', objectId, 0, 1);
                var elName = this.parseObjectId('full', objectId, 2, 0, true);
                var shortName = this.parseObjectId('parts', objectId, 2, 0, true);
                var recordUid = this.parseObjectId('none', objectId, 1);
                var beforeDeleteIsBelowMax = this.isBelowMax(objectPrefix);
 
-                       // revert the unique settings if available
+               // revert the unique settings if available
                this.revertUnique(objectPrefix, elName, recordUid);
 
-                       // Remove from TBE_EDITOR (required fields, required range, etc.):
+               // Remove from TBE_EDITOR (required fields, required range, etc.):
                if (TBE_EDITOR && TBE_EDITOR.removeElement) {
                        var removeStack = [];
                        // Iterate over all child records:
-                       inlineRecords = Element.select(objectId+'_div', '.inlineRecord');
-                               // Remove nested child records from TBE_EDITOR required/range checks:
-                       for (i=inlineRecords.length-1; i>=0; i--) {
+                       inlineRecords = Element.select(objectId + '_div', '.inlineRecord');
+                       // Remove nested child records from TBE_EDITOR required/range checks:
+                       for (i = inlineRecords.length - 1; i >= 0; i--) {
                                if (inlineRecords[i].value.length) {
                                        records = inlineRecords[i].value.split(',');
                                        childObjectId = this.data.map[inlineRecords[i].name];
                                        childTable = this.data.config[childObjectId].table;
-                                       for (j=records.length-1; j>=0; j--) {
-                                               removeStack.push(this.prependFormFieldNames+'['+childTable+']['+records[j]+']');
+                                       for (j = records.length - 1; j >= 0; j--) {
+                                               removeStack.push(this.prependFormFieldNames + '[' + childTable + '][' + records[j] + ']');
                                        }
                                }
                        }
-                       removeStack.push(this.prependFormFieldNames+shortName);
+                       removeStack.push(this.prependFormFieldNames + shortName);
                        TBE_EDITOR.removeElementArray(removeStack);
                }
 
-                       // Mark this container as deleted
+               // Mark this container as deleted
                var deletedRecordContainer = $(objectId + '_div');
                if (deletedRecordContainer) {
                        deletedRecordContainer.addClassName('inlineIsDeletedRecord');
                }
 
-                       // If the record is new and was never saved before, just remove it from DOM:
+               // If the record is new and was never saved before, just remove it from DOM:
                if (this.isNewRecord(objectId) || options && options.forceDirectRemoval) {
-                       this.fadeAndRemove(objectId+'_div');
+                       this.fadeAndRemove(objectId + '_div');
                        // If the record already exists in storage, mark it to be deleted on clicking the save button:
                } else {
-                       document.getElementsByName('cmd'+shortName+'[delete]')[0].disabled = false;
-                       new Effect.Fade(objectId+'_div');
+                       document.getElementsByName('cmd' + shortName + '[delete]')[0].disabled = false;
+                       new Effect.Fade(objectId + '_div');
                }
 
                var recordCount = this.memorizeRemoveRecord(
-                       this.prependFormFieldNames+this.parseObjectId('parts', objectId, 3, 2, true),
+                       this.prependFormFieldNames + this.parseObjectId('parts', objectId, 3, 2, true),
                        recordUid
                );
 
                if (recordCount <= 1) {
-                       this.destroyDragAndDropSorting(this.parseObjectId('full', objectId, 0 , 2)+'_records');
+                       this.destroyDragAndDropSorting(this.parseObjectId('full', objectId, 0, 2) + '_records');
                }
                this.redrawSortingButtons(objectPrefix);
 
-                       // if the NEW-button was hidden and now we can add again new children, show the button
+               // if the NEW-button was hidden and now we can add again new children, show the button
                if (!beforeDeleteIsBelowMax && this.isBelowMax(objectPrefix)) {
-                       var objectParent = this.parseObjectId('full', objectPrefix, 0 , 1);
+                       var objectParent = this.parseObjectId('full', objectPrefix, 0, 1);
                        var md5 = this.getObjectMD5(objectParent);
-                       this.showElementsWithClassName('.inlineNewButton'+(md5 ? '.'+md5 : ''), objectParent);
+                       this.showElementsWithClassName('.inlineNewButton' + (md5 ? '.' + md5 : ''), objectParent);
                }
                return false;
        },
 
-       parsePath: function(path) {
+       parsePath: function (path) {
                var backSlash = path.lastIndexOf('\\');
                var normalSlash = path.lastIndexOf('/');
 
                if (backSlash > 0) {
-                       path = path.substring(0,backSlash+1);
+                       path = path.substring(0, backSlash + 1);
                } else if (normalSlash > 0) {
-                       path = path.substring(0,normalSlash+1);
+                       path = path.substring(0, normalSlash + 1);
                } else {
                        path = '';
                }
@@ -937,7 +955,7 @@ var inline = {
                return path;
        },
 
-       parseFormElementName: function(wrap, formElementName, rightCount, skipRight) {
+       parseFormElementName: function (wrap, formElementName, rightCount, skipRight) {
                var idParts = this.splitFormElementName(formElementName);
 
                if (!wrap) {
@@ -948,16 +966,16 @@ var inline = {
                }
 
                var elParts = new Array();
-               for (var i=0; i<skipRight; i++) {
+               for (var i = 0; i < skipRight; i++) {
                        idParts.pop();
                }
 
                if (rightCount > 0) {
-                       for (var i=0; i<rightCount; i++) {
+                       for (var i = 0; i < rightCount; i++) {
                                elParts.unshift(idParts.pop());
                        }
                } else {
-                       for (var i=0; i<-rightCount; i++) {
+                       for (var i = 0; i < -rightCount; i++) {
                                idParts.shift();
                        }
                        elParts = idParts;
@@ -968,30 +986,31 @@ var inline = {
                return elReturn;
        },
 
-       splitFormElementName: function(formElementName) {
+       splitFormElementName: function (formElementName) {
                // remove left and right side "data[...|...]" -> '...|...'
-               formElementName = formElementName.substr(0, formElementName.lastIndexOf(']')).substr(formElementName.indexOf('[')+1);
+               formElementName = formElementName.substr(0,
+                                                        formElementName.lastIndexOf(']')).substr(formElementName.indexOf('[') + 1);
                var parts = objectId.split('][');
 
                return parts;
        },
 
-       splitObjectId: function(objectId) {
-               objectId = objectId.substr(objectId.indexOf(this.structureSeparator)+1);
+       splitObjectId: function (objectId) {
+               objectId = objectId.substr(objectId.indexOf(this.structureSeparator) + 1);
                objectId = objectId.split(this.flexFormSeparator).join(this.flexFormSubstitute);
                var parts = objectId.split(this.structureSeparator);
 
                return parts;
        },
 
-       constructFormElementName: function(wrap, parts) {
+       constructFormElementName: function (wrap, parts) {
                var elReturn;
 
                if (wrap == 'full') {
-                       elReturn = this.prependFormFieldNames+'['+parts.join('][')+']';
+                       elReturn = this.prependFormFieldNames + '[' + parts.join('][') + ']';
                        elReturn = elReturn.split(this.flexFormSubstitute).join('][');
                } else if (wrap == 'parts') {
-                       elReturn = '['+parts.join('][')+']';
+                       elReturn = '[' + parts.join('][') + ']';
                        elReturn = elReturn.split(this.flexFormSubstitute).join('][');
                } else if (wrap == 'none') {
                        elReturn = parts.length > 1 ? parts : parts.join('');
@@ -1000,14 +1019,14 @@ var inline = {
                return elReturn;
        },
 
-       constructObjectId: function(wrap, parts) {
+       constructObjectId: function (wrap, parts) {
                var elReturn;
 
                if (wrap == 'full') {
-                       elReturn = this.prependFormFieldNames+this.structureSeparator+parts.join(this.structureSeparator);
+                       elReturn = this.prependFormFieldNames + this.structureSeparator + parts.join(this.structureSeparator);
                        elReturn = elReturn.split(this.flexFormSubstitute).join(this.flexFormSeparator);
                } else if (wrap == 'parts') {
-                       elReturn = this.structureSeparator+parts.join(this.structureSeparator);
+                       elReturn = this.structureSeparator + parts.join(this.structureSeparator);
                        elReturn = elReturn.split(this.flexFormSubstitute).join(this.flexFormSeparator);
                } else if (wrap == 'none') {
                        elReturn = parts.length > 1 ? parts : parts.join('');
@@ -1016,7 +1035,7 @@ var inline = {
                return elReturn;
        },
 
-       parseObjectId: function(wrap, objectId, rightCount, skipRight, returnAsFormElementName) {
+       parseObjectId: function (wrap, objectId, rightCount, skipRight, returnAsFormElementName) {
                var idParts = this.splitObjectId(objectId);
 
                if (!wrap) {
@@ -1027,16 +1046,16 @@ var inline = {
                }
 
                var elParts = new Array();
-               for (var i=0; i<skipRight; i++) {
+               for (var i = 0; i < skipRight; i++) {
                        idParts.pop();
                }
 
                if (rightCount > 0) {
-                       for (var i=0; i<rightCount; i++) {
+                       for (var i = 0; i < rightCount; i++) {
                                elParts.unshift(idParts.pop());
                        }
                } else {
-                       for (var i=0; i<-rightCount; i++) {
+                       for (var i = 0; i < -rightCount; i++) {
                                idParts.shift();
                        }
                        elParts = idParts;
@@ -1051,7 +1070,7 @@ var inline = {
                return elReturn;
        },
 
-       handleChangedField: function(formField, objectId) {
+       handleChangedField: function (formField, objectId) {
                var formObj;
                if (typeof formField == 'object') {
                        formObj = formField;
@@ -1069,12 +1088,12 @@ var inline = {
                        } else {
                                value = formObj.value;
                        }
-                       $(objectId+'_label').innerHTML = value.length ? value : this.noTitleString;
+                       $(objectId + '_label').innerHTML = value.length ? value : this.noTitleString;
                }
                return true;
        },
 
-       arrayAssocCount: function(object) {
+       arrayAssocCount: function (object) {
                var count = 0;
                if (typeof object.length != 'undefined') {
                        count = object.length;
@@ -1086,9 +1105,9 @@ var inline = {
                return count;
        },
 
-       isBelowMax: function(objectPrefix) {
+       isBelowMax: function (objectPrefix) {
                var isBelowMax = true;
-               var objectName = this.prependFormFieldNames+this.parseObjectId('parts', objectPrefix, 3, 1, true);
+               var objectName = this.prependFormFieldNames + this.parseObjectId('parts', objectPrefix, 3, 1, true);
                var formObj = document.getElementsByName(objectName);
 
                if (this.data.config && this.data.config[objectPrefix] && formObj.length) {
@@ -1106,22 +1125,22 @@ var inline = {
                return isBelowMax;
        },
 
-       getOptionsHash: function(selectObj) {
+       getOptionsHash: function (selectObj) {
                var optionsHash = {};
-               for (var i=0; i<selectObj.options.length; i++) {
+               for (var i = 0; i < selectObj.options.length; i++) {
                        optionsHash[selectObj.options[i].value] = i;
                }
                return optionsHash;
        },
 
-       removeSelectOption: function(selectObj, value) {
+       removeSelectOption: function (selectObj, value) {
                var optionsHash = this.getOptionsHash(selectObj);
                if (optionsHash[value] != undefined) {
                        selectObj.options[optionsHash[value]] = null;
                }
        },
 
-       readdSelectOption: function(selectObj, value, unique) {
+       readdSelectOption: function (selectObj, value, unique) {
                var index = null;
                var optionsHash = this.getOptionsHash(selectObj);
                var possibleValues = $H(unique.possible).keys();
@@ -1140,50 +1159,54 @@ var inline = {
                } else if (index < selectObj.options.length) {
                        index++;
                }
-                       // recreate the <option> tag
+               // recreate the <option> tag
                var readdOption = document.createElement('option');
                readdOption.text = unique.possible[value];
                readdOption.value = value;
-                       // add the <option> at the right position
+               // add the <option> at the right position
                selectObj.add(readdOption, document.all ? index : selectObj.options[index]);
        },
 
-       hideElementsWithClassName: function(selector, parentElement) {
+       hideElementsWithClassName: function (selector, parentElement) {
                this.setVisibilityOfElementsWithClassName('hide', selector, parentElement);
        },
 
-       showElementsWithClassName: function(selector, parentElement) {
+       showElementsWithClassName: function (selector, parentElement) {
                this.setVisibilityOfElementsWithClassName('show', selector, parentElement);
        },
 
-       setVisibilityOfElementsWithClassName: function(action, selector, parentElement) {
+       setVisibilityOfElementsWithClassName: function (action, selector, parentElement) {
                var domObjects = Selector.findChildElements($(parentElement), [selector]);
                if (action == 'hide') {
-                       $A(domObjects).each(function(domObject) { new Effect.Fade(domObject); });
+                       $A(domObjects).each(function (domObject) {
+                               new Effect.Fade(domObject);
+                       });
                } else if (action == 'show') {
-                       $A(domObjects).each(function(domObject) { new Effect.Appear(domObject); });
+                       $A(domObjects).each(function (domObject) {
+                               new Effect.Appear(domObject);
+                       });
                }
        },
 
-       fadeOutFadeIn: function(objectId) {
-               var optIn = { duration:0.5, transition:Effect.Transitions.linear, from:0.50, to:1.00 };
-               var optOut = { duration:0.5, transition:Effect.Transitions.linear, from:1.00, to:0.50 };
-               optOut.afterFinish = function() {
+       fadeOutFadeIn: function (objectId) {
+               var optIn = { duration: 0.5, transition: Effect.Transitions.linear, from: 0.50, to: 1.00 };
+               var optOut = { duration: 0.5, transition: Effect.Transitions.linear, from: 1.00, to: 0.50 };
+               optOut.afterFinish = function () {
                        new Effect.Opacity(objectId, optIn);
                };
                new Effect.Opacity(objectId, optOut);
        },
 
-       isNewRecord: function(objectId) {
-               return $(objectId+'_div') && $(objectId+'_div').hasClassName('inlineIsNewRecord')
+       isNewRecord: function (objectId) {
+               return $(objectId + '_div') && $(objectId + '_div').hasClassName('inlineIsNewRecord')
                        ? true
                        : false;
        },
 
-               // Find and fix nested of inline and tab levels if a new element was created dynamically (it doesn't know about its nesting):
-       findContinuedNestedLevel: function(nested, objectId) {
+       // Find and fix nested of inline and tab levels if a new element was created dynamically (it doesn't know about its nesting):
+       findContinuedNestedLevel: function (nested, objectId) {
                if (this.data.nested && this.data.nested[objectId]) {
-                               // Remove the first element from the new nested stack, it's just a hint:
+                       // Remove the first element from the new nested stack, it's just a hint:
                        nested.shift();
                        nested = this.data.nested[objectId].concat(nested);
                        return nested;
@@ -1192,29 +1215,31 @@ var inline = {
                }
        },
 
-       getNumberOfRTE: function() {
+       getNumberOfRTE: function () {
                var number = 0;
                if (typeof RTEarea != 'undefined' && RTEarea.length > 0) {
-                       number = RTEarea.length-1;
+                       number = RTEarea.length - 1;
                }
                return number;
-       },
+       },
 
-       getObjectMD5: function(objectPrefix) {
-               var md5 = false;
-               if (this.data.config && this.data.config[objectPrefix] && this.data.config[objectPrefix].md5) {
-                       md5 = this.data.config[objectPrefix].md5;
-               }
-               return md5
-       },
+       getObjectMD5: function (objectPrefix) {
+               var md5 = false;
+               if (this.data.config && this.data.config[objectPrefix] && this.data.config[objectPrefix].md5) {
+                       md5 = this.data.config[objectPrefix].md5;
+               }
+               return md5
+       },
 
-       fadeAndRemove: function(element) {
-               if ($(element)) {
-                       new Effect.Fade(element, { afterFinish: function() { Element.remove(element); } });
+       fadeAndRemove: function (element) {
+               if ($(element)) {
+                       new Effect.Fade(element, { afterFinish: function () {
+                               Element.remove(element);
+                       }    });
                }
-       },
+       },
 
-       getContext: function(objectId) {
+       getContext: function (objectId) {
                var result = null;
 
                if (objectId !== '' && typeof this.data.config[objectId] !== 'undefined' && typeof this.data.config[objectId].context !== 'undefined') {
@@ -1230,7 +1255,7 @@ var inline = {
         * @param string objectId
         * @return string
         */
-       escapeObjectId: function(objectId) {
+       escapeObjectId: function (objectId) {
                var escapedObjectId;
                escapedObjectId = objectId.replace(/:/g, '\\:');
                escapedObjectId = escapedObjectId.replace(/\./g, '\\.');
@@ -1243,7 +1268,7 @@ var inline = {
         * @param string objectId
         * @return string
         */
-       escapeSelectorObjectId: function(objectId) {
+       escapeSelectorObjectId: function (objectId) {
                var escapedSelectorObjectId;
                var escapedObjectId = this.escapeObjectId(objectId);
                escapedSelectorObjectId = escapedObjectId.replace(/\\:/g, '\\\\\\:');
@@ -1253,11 +1278,13 @@ var inline = {
 }
 
 Object.extend(Array.prototype, {
-       diff: function(current) {
+       diff: function (current) {
                var diff = new Array();
                if (this.length == current.length) {
-                       for (var i=0; i<this.length; i++) {
-                               if (this[i] !== current[i]) diff.push(i);
+                       for (var i = 0; i < this.length; i++) {
+                               if (this[i] !== current[i]) {
+                                       diff.push(i);
+                               }
                        }
                }
                return diff;
@@ -1265,8 +1292,8 @@ Object.extend(Array.prototype, {
 });
 
 /*]]>*/
-(function($) {
-       $(function() {
+(function ($) {
+       $(function () {
                $(document).delegate('div.t3-form-field-header-inline', 'click', inline.toggleEvent);
        });
 })(TYPO3.jQuery);