Index: typo3/js/backend.js =================================================================== --- typo3/js/backend.js (revision 7559) +++ typo3/js/backend.js (working copy) @@ -36,7 +36,7 @@ */ function jump(url, modName, mainModName) { // clear information about which entry in nav. tree that might have been highlighted. - top.fsMod.navFrameHighlightedID = new Array(); + top.fsMod.navFrameHighlightedID = []; if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { top.content.nav_frame.refresh_nav(); @@ -56,13 +56,13 @@ * central entry point to create a shortcut, delegates the call to correct endpoint */ createShortcut: function(confirmQuestion, backPath, moduleName, url) { - if(confirm(confirmQuestion)) { - if(typeof TYPO3BackendShortcutMenu != 'undefined') { + if (confirm(confirmQuestion)) { + if (typeof TYPO3BackendShortcutMenu !== undefined) { // backend.php TYPO3BackendShortcutMenu.createShortcut('', moduleName, url); } - if(top.shortcutFrame) { + if (top.shortcutFrame) { // alt_main.php var location = backPath + 'alt_shortcut.php?modName=' + moduleName + '&URL=' + url; shortcutFrame.location.href = location; @@ -102,7 +102,7 @@ var output = ""; var pointer=0; var pos = input.indexOf(matchStr); - while (pos!=-1) { + while (pos !== -1) { output+=""+input.substr(pointer, pos-pointer)+replace; pointer=pos+matchStr.length; pos = input.indexOf(match,pos+1); @@ -129,7 +129,10 @@ * Opens plain window with url */ function openUrlInWindow(url,windowName) { // - regularWindow = window.open(url,windowName,"status=1,menubar=1,resizable=1,location=1,directories=0,scrollbars=1,toolbar=1"); + regularWindow = window.open( + url, + windowName, + "status=1,menubar=1,resizable=1,location=1,directories=0,scrollbars=1,toolbar=1"); regularWindow.focus(); return false; } @@ -138,8 +141,8 @@ * Loads a page id for editing in the page edit module: */ function loadEditId(id,addGetVars) { // - top.fsMod.recentIds["web"]=id; - top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_0"; // For highlighting + top.fsMod.recentIds.web = id; + top.fsMod.navFrameHighlightedID.web = "pages" + id + "_0"; // For highlighting if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { top.content.nav_frame.refresh_nav(); @@ -169,7 +172,7 @@ */ function debugObj(obj,name) { // var acc; - for (i in obj) { + for (var i in obj) { if (obj[i]) { acc+=i+": "+obj[i]+"\n"; } @@ -185,7 +188,7 @@ var currentSubNavScript = ""; // Used for tab-panels: -var DTM_currentTabs = new Array(); +var DTM_currentTabs = []; // status of WS FE preview var WorkspaceFrontendPreviewEnabled = TYPO3.configuration.workspaceFrontendPreviewEnabled; Index: typo3/js/backendsearch.js =================================================================== --- typo3/js/backendsearch.js (revision 7559) +++ typo3/js/backendsearch.js (working copy) @@ -44,17 +44,17 @@ $('search-query').observe('keypress', function(event) { var keyCode; - if(!event) { + if (!event) { var event = window.event; } - if(event.keyCode) { + if (event.keyCode) { keyCode = event.keyCode; - } else if(event.which) { + } else if (event.which) { keyCode = event.which; } - if(keyCode == Event.KEY_RETURN) { + if (keyCode === Event.KEY_RETURN) { TYPO3BackendSearchMenu.invokeSearch(); } }); @@ -79,7 +79,7 @@ // -1 to compensate for the margin-right -1px of the list items, // which itself is necessary for overlaying the separator with the active state background - if(toolbarItem.down().hasClassName('no-separator')) { + if (toolbarItem.down().hasClassName('no-separator')) { calculatedOffset -= 1; } }); @@ -103,7 +103,7 @@ var menu = $$('#backend-search-menu .toolbar-item-menu')[0]; toolbarItem.blur(); - if(!toolbarItem.hasClassName('toolbar-item-active')) { + if (!toolbarItem.hasClassName('toolbar-item-active')) { toolbarItem.addClassName('toolbar-item-active'); Effect.Appear(menu, {duration: 0.2}); TYPO3BackendToolbarManager.hideOthers(toolbarItem); @@ -171,7 +171,7 @@ jump: function(url, modName, mainModName) { // Clear information about which entry in nav. tree that might have been highlighted. top.fsMod.navFrameHighlightedID = new Array(); - if(top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { + if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) { top.content.nav_frame.refresh_nav(); } Index: typo3/js/browse_links.js =================================================================== --- typo3/js/browse_links.js (revision 7559) +++ typo3/js/browse_links.js (working copy) @@ -40,18 +40,17 @@ parent.close(); } } -} +}; BrowseLinks.File = { insertElement: function(index, close) { var result = false; - if (typeof BrowseLinks.elements[index] != 'undefined') { + if (typeof BrowseLinks.elements[index] !== undefined) { var element = BrowseLinks.elements[index]; result = insertElement( '', element.md5, element.type, element.fileName, element.filePath, element.fileExt, - element.fileIcon, '', close - ); + element.fileIcon, '', close); } return result; } Index: typo3/js/clearcachemenu.js =================================================================== --- typo3/js/clearcachemenu.js (revision 7559) +++ typo3/js/clearcachemenu.js (working copy) @@ -65,7 +65,7 @@ // -1 to compensate for the margin-right -1px of the list items, // which itself is necessary for overlaying the separator with the active state background - if(toolbarItem.down().hasClassName('no-separator')) { + if (toolbarItem.down().hasClassName('no-separator')) { calculatedOffset -= 1; } }); @@ -90,7 +90,7 @@ var menu = $$('#clear-cache-actions-menu .toolbar-item-menu')[0]; toolbarItem.blur(); - if(!toolbarItem.hasClassName('toolbar-item-active')) { + if (!toolbarItem.hasClassName('toolbar-item-active')) { toolbarItem.addClassName('toolbar-item-active'); Effect.Appear(menu, {duration: 0.2}); TYPO3BackendToolbarManager.hideOthers(toolbarItem); @@ -117,14 +117,14 @@ // activate the spinner toolbarItemIcon.src = 'gfx/spinner.gif'; - if (clickedElement.tagName == 'IMG') { + if (clickedElement.tagName === 'IMG') { url = clickedElement.up('a').href; } else { url = clickedElement.href; } if (url) { - new Ajax.Request(url, { + var call = new Ajax.Request(url, { 'method': 'get', 'onComplete': function() { toolbarItemIcon.src = this.toolbarItemIcon; Index: typo3/js/clickmenu.js =================================================================== --- typo3/js/clickmenu.js (revision 7559) +++ typo3/js/clickmenu.js (working copy) @@ -38,12 +38,12 @@ * @return nothing */ show: function(table, uid, listFr, enDisItems, backPath, addParams) { - var params = 'table=' + encodeURIComponent(table) - + '&uid=' + uid - + '&listFr=' + listFr - + '&enDisItems=' + enDisItems - + '&backPath=' + backPath - + '&addParams=' + addParams; + var params = 'table=' + encodeURIComponent(table) + + '&uid=' + uid + + '&listFr=' + listFr + + '&enDisItems=' + enDisItems + + '&backPath=' + backPath + + '&addParams=' + addParams; this.callURL(params); }, @@ -58,12 +58,14 @@ callURL: function(params) { if (this.ajax && Ajax.getTransport()) { // run with AJAX params += '&ajax=1'; - new Ajax.Request(this.clickURL, { + var call = new Ajax.Request(this.clickURL, { method: 'get', parameters: params, onComplete: function(xhr) { var response = xhr.responseXML; - if (!response.getElementsByTagName('data')[0]) return; + if (!response.getElementsByTagName('data')[0]) { + return; + } var menu = response.getElementsByTagName('data')[0].getElementsByTagName('clickmenu')[0]; var data = menu.getElementsByTagName('htmltable')[0].firstChild.data; var level = menu.getElementsByTagName('cmlevel')[0].firstChild.data; @@ -81,11 +83,13 @@ * @param level the depth of the clickmenu */ populateData: function(data, level) { - if (!$('contentMenu0')) this.addClickmenuItem(); - level = parseInt(level) || 0; + if (!$('contentMenu0')) { + this.addClickmenuItem(); + } + level = parseInt(level, 10) || 0; var obj = $('contentMenu' + level); - if (obj && (level == 0 || Element.visible('contentMenu' + (level-1)))) { + if (obj && (level === 0 || Element.visible('contentMenu' + (level-1)))) { obj.innerHTML = data; var x = this.mousePos.X; var y = this.mousePos.Y; @@ -153,7 +157,7 @@ obj = $(obj); if (obj && Element.visible(obj) && !Position.within(obj, this.mousePos.X, this.mousePos.Y)) { this.hide(obj); - if (/MSIE5/.test(navigator.userAgent) && obj.id == 'contentMenu0') { + if (/MSIE5/.test(navigator.userAgent) && obj.id === 'contentMenu0') { this._toggleSelectorBoxes('visible'); } } @@ -186,8 +190,8 @@ * @result nothing */ _toggleSelectorBoxes: function(action) { - for (i = 0; i < document.forms.length; i++) { - for (j = 0; j < document.forms[i].elements.length; j++) { + for (var i = 0; i < document.forms.length; i++) { + for (var j = 0; j < document.forms[i].elements.length; j++) { if (document.forms[i].elements[j].type == 'select-one') { document.forms[i].elements[j].style.visibility = action; } @@ -203,7 +207,7 @@ */ addClickmenuItem: function() { var code = '
'; - new Insertion.Bottom(document.getElementsByTagName('body')[0], code); + var insert = new Insertion.Bottom(document.getElementsByTagName('body')[0], code); } } @@ -218,7 +222,7 @@ function showClickmenu_raw(url) { var parts = url.split('?'); - if (parts.length == 2) { + if (parts.length === 2) { Clickmenu.clickURL = parts[0]; Clickmenu.callURL(parts[1]); } else { @@ -236,7 +240,7 @@ return false; } function hideSpecific(level) { - if (level == 0 || level == 1) { + if (level === 0 || level === 1) { Clickmenu.hide('contentMenu'+level); } } Index: typo3/js/common.js =================================================================== --- typo3/js/common.js (revision 7559) +++ typo3/js/common.js (working copy) @@ -31,7 +31,7 @@ // if the TYPO3 AJAX backend is used, // the onSuccess & onComplete callbacks are hooked - if (request.url.indexOf("ajax.php") == -1) { + if (request.url.indexOf("ajax.php") === -1) { return; } @@ -58,23 +58,23 @@ } else { origComplete(xhr, json); } - } + }; } } }); } -var T3AJAX = new Object(); +var T3AJAX = {}; T3AJAX.showError = function(xhr, json) { - if (typeof xhr.responseText != 'undefined' && xhr.responseText) { - if (typeof Ext.MessageBox != 'undefined') { + if (typeof xhr.responseText !== undefined && xhr.responseText) { + if (typeof Ext.MessageBox !== undefined) { Ext.MessageBox.alert('TYPO3', xhr.responseText); } else { alert(xhr.responseText); } } -} +}; // common storage and global object, could later hold more information about the current user etc. var TYPO3 = { @@ -91,7 +91,7 @@ helpers: { // creates an array by splitting a string into parts, taking a delimiter split: function(str, delim) { - var res = new Array(); + var res = []; while (str.indexOf(delim) > 0) { res.push(str.substr(0, str.indexOf(delim))); str = str.substr(str.indexOf(delim) + delim.length); Index: typo3/js/constantEditor.js =================================================================== --- typo3/js/constantEditor.js (revision 7559) +++ typo3/js/constantEditor.js (working copy) @@ -57,13 +57,13 @@ var userDiv = $('userTS-'+paramName); var checkBox = $('check[' + paramName + ']'); - if(editIcon.hasClassName('editIcon')) { + if (editIcon.hasClassName('editIcon')) { $(defaultDiv).hide(); $(userDiv).show().setStyle({backgroundColor: '#fdf8bd'}); $(checkBox).enable().setValue('checked'); } - if(editIcon.hasClassName('undoIcon')) { + if (editIcon.hasClassName('undoIcon')) { $(userDiv).hide(); $(defaultDiv).show(); $(checkBox).setValue('').disable(); @@ -93,7 +93,7 @@ $(colorBox).setStyle({backgroundColor: colorValue}); $(colorSelect).childElements().each(function(option) { - if(option.value == colorValue) { + if (option.value === colorValue) { option.selected = true; } else { option.selected = false; Index: typo3/js/extjs/backendsizemanager.js =================================================================== --- typo3/js/extjs/backendsizemanager.js (revision 7559) +++ typo3/js/extjs/backendsizemanager.js (working copy) @@ -39,11 +39,11 @@ var consoleHeight = debugConsole.isVisible() ? 0 : debugConsole.getHeight() + debugConsole.getHeight(); var styles = { height: (viewportHeight - topHeight - consoleHeight) + 'px' - } + }; Ext.get('typo3-side-menu').setStyle(styles); Ext.get('content').setStyle(styles); - } + }; Ext.EventManager.onWindowResize(resizeBackend); Ext.onReady(function() { Index: typo3/js/extjs/viewportConfiguration.js =================================================================== --- typo3/js/extjs/viewportConfiguration.js (revision 7559) +++ typo3/js/extjs/viewportConfiguration.js (working copy) @@ -97,11 +97,11 @@ activate: function(tab) { var i, id = [], tabCount = tab.ownerCt.items.getCount(); // get tab id's - for (var i = 1; i < tabCount; i++) { + for (i = 1; i < tabCount; i++) { id.push(tab.ownerCt.items.keys[i]); } // remove all tabs except first - for (var i = 0; i < id.length; i++) { + for (i = 0; i < id.length; i++) { tab.ownerCt.remove(id[i]); } tab.ownerCt.hide(); Index: typo3/js/flashupload.js =================================================================== --- typo3/js/flashupload.js (revision 7559) +++ typo3/js/flashupload.js (working copy) @@ -131,7 +131,7 @@ ] }; // set the default options, if not set yet by the application from outside - Ext.applyIf(this, initialConfig); + Ext.applyif(this, initialConfig); // set default options that cannot be overriden from outside var staticConfig = { @@ -248,7 +248,7 @@ if (swfConfig.file_upload_limit) { txt += String.format(TYPO3.LLL.fileUpload.infoComponentFileUploadLimit, swfConfig.file_upload_limit) + '
'; } - if (swfConfig.file_types != '*.*') { + if (swfConfig.file_types !== '*.*') { txt += String.format(TYPO3.LLL.fileUpload.infoComponentFileTypeLimit, swfConfig.file_types); } this.insert(0, new Ext.Panel({ @@ -290,11 +290,11 @@ * SWFupload needs it to be (*.jpg;*.gif) and also adds deny file patterns */ setFileTypeRestrictions: function(typo3FileTypes) { - if (typo3FileTypes.allow && typo3FileTypes.allow != '' && typo3FileTypes.allow != '*') { + if (typo3FileTypes.allow && typo3FileTypes.allow !== '' && typo3FileTypes.allow !== '*') { var allowedFiles = TYPO3.helpers.split(typo3FileTypes.allow, ','); this.swfDefaultConfig.file_types = '*.' + allowedFiles.join(';*.'); } - if (typo3FileTypes.deny && typo3FileTypes.deny != '') { + if (typo3FileTypes.deny && typo3FileTypes.deny !== '') { this.deniedFileTypes = typo3FileTypes.deny; } }, @@ -311,7 +311,7 @@ denyTypes += (denyTypes.length ? ',' : '') + TS.denyFileTypes; denyTypes = ',' + denyTypes + ','; var reg = new RegExp(',' + ext + ',', 'i'); - if (denyTypes.search(reg) == -1) { + if (denyTypes.search(reg) === -1) { return true; } } @@ -434,7 +434,7 @@ // private // this handler is only called by totalComplete, not by swfupload itself totalError: function() { - if (this.lastError == null) { + if (this.lastError === null) { return; } @@ -500,12 +500,12 @@ TYPO3.addInstance('FileUploadWindow', instance); } return instance; - } + }; // This function checks through the SWFObject if the required flash player is available TYPO3.FileUploadWindow.isFlashAvailable = function() { return swfobject.hasFlashPlayerVersion(TYPO3.FileUploadWindow.prototype.swfDefaultConfig.minimum_flash_version); - } + }; /** * This class includes one instance of an upload Index: typo3/js/iecompatibility.js =================================================================== --- typo3/js/iecompatibility.js (revision 7559) +++ typo3/js/iecompatibility.js (working copy) @@ -31,7 +31,7 @@ var transparentGifPath = 'clear.gif'; // If there is valid element, it is an image and the image file ends with png: - if (Object.isElement(element) && element.tagName == 'IMG' && element.src.endsWith('.png')) { + if (Object.isElement(element) && element.tagName === 'IMG' && element.src.endsWith('.png')) { var alphaImgSrc = element.src; var sizingMethod = 'scale'; element.src = transparentGifPath; @@ -62,7 +62,7 @@ Event.observe(window, 'load', function() { if (Prototype.Browser.IE) { var version = parseFloat(navigator.appVersion.split(';')[1].strip().split(' ')[1]); - if (version == 6) { + if (version === 6) { $$('img').each(function(img){ img.pngHack(); }); @@ -72,6 +72,6 @@ } }); -if(Prototype.Browser.IE) { +if (Prototype.Browser.IE) { var TYPO3IECompatibilty = new IECompatibility(); } Index: typo3/js/loginrefresh.js =================================================================== --- typo3/js/loginrefresh.js (revision 7559) +++ typo3/js/loginrefresh.js (working copy) @@ -49,7 +49,7 @@ method: "GET", success: function(response, options) { var result = Ext.util.JSON.decode(response.responseText); - if(result.login.locked) { + if (result.login.locked) { this.locked = 1; Ext.MessageBox.show({ title: TYPO3.LLL.core.please_wait, @@ -178,7 +178,7 @@ buttons: [{ text: TYPO3.LLL.core.refresh_login_refresh_button, handler: function() { - refresh = Ext.Ajax.request({ + var refresh = Ext.Ajax.request({ url: "ajax.php", params: { "ajaxID": "BackendLogin::isTimedOut" @@ -229,7 +229,7 @@ }); progressControl.on('update', function(control, value, text) { - var rest = 30-(parseInt(value*30)); + var rest = 30-(value * 30); if (rest === 1) { control.updateText(String.format(TYPO3.LLL.core.refresh_login_countdown_singular, rest)); } else { @@ -244,7 +244,7 @@ showLoginPopup: function() { Ext.getCmp("loginRefreshWindow").hide(); - vHWin=window.open("login_frameset.php","relogin_"+TS.uniqueID,"height=450,width=700,status=0,menubar=0,location=1"); + var vHWin = window.open("login_frameset.php","relogin_" + TS.uniqueID,"height=450,width=700,status=0,menubar=0,location=1"); vHWin.focus(); }, @@ -262,10 +262,10 @@ if (fields.p_field === "") { Ext.Msg.alert(TYPO3.LLL.core.refresh_login_failed, TYPO3.LLL.core.refresh_login_emptyPassword); } else { - if (TS.securityLevel == "superchallenged") { + if (TS.securityLevel === "superchallenged") { fields.p_field = MD5(fields.p_field); } - if (TS.securityLevel == "superchallenged" || TS.securityLevel == "challenged") { + if (TS.securityLevel === "superchallenged" || TS.securityLevel === "challenged") { fields.challenge = challenge; fields.userident = MD5(fields.username + ":" + fields.p_field + ":" + challenge); } else { @@ -303,7 +303,7 @@ }, triggerSubmitForm: function() { - if (TS.securityLevel == 'superchallenged' || TS.securityLevel == 'challenged') { + if (TS.securityLevel === 'superchallenged' || TS.securityLevel === 'challenged') { Ext.Ajax.request({ url: 'ajax.php', params: { Index: typo3/js/modulemenu.js =================================================================== --- typo3/js/modulemenu.js (revision 7559) +++ typo3/js/modulemenu.js (working copy) @@ -53,7 +53,7 @@ */ registerEventListeners: function() { $$('#typo3-menu li.menuSection div').invoke('observe', 'click', this.toggleMenu); - if(Prototype.Browser.IE) { + if (Prototype.Browser.IE) { //mouseenter and mouseleave are only available but thats our target $$('#typo3-menu li.menuSection li').invoke('observe', 'mouseenter', this.toggleHoverClass); $$('#typo3-menu li.menuSection li').invoke('observe', 'mouseleave', this.toggleHoverClass); @@ -76,15 +76,17 @@ var mainMenuId = mainModuleHeader.up().identify(); var subModulesMenu = mainModuleHeader.next('ul'); - if (!subModulesMenu) return; + if (!subModulesMenu) { + return; + } var state = subModulesMenu.visible(); // save state - new Ajax.Request('ajax.php', { + var save = new Ajax.Request('ajax.php', { parameters : 'ajaxID=ModuleMenu::saveMenuState&menuid=' + mainMenuId + '&state=' + state }); - if(state) { + if (state) { Effect.BlindUp(subModulesMenu, {duration : 0.1}); $(mainModuleHeader).removeClassName('expanded'); $(mainModuleHeader).addClassName('collapsed'); @@ -99,7 +101,7 @@ * refreshes the complete module menu */ refreshMenu: function() { - new Ajax.Updater('typo3-menu', TS.PATH_typo3 + 'ajax.php', { + var refresh = new Ajax.Updater('typo3-menu', TS.PATH_typo3 + 'ajax.php', { parameters : 'ajaxID=ModuleMenu::render', asynchronous : false, evalScripts : true @@ -123,7 +125,7 @@ $(moduleId).addClassName('highlighted'); } - if(undefined != mainModule) { + if (undefined !== mainModule) { this.currentlyHighLightedMainModule = mainModule; } this.currentlyHighlightedModuleId = moduleId; Index: typo3/js/shortcutmenu.js =================================================================== --- typo3/js/shortcutmenu.js (revision 7559) +++ typo3/js/shortcutmenu.js (working copy) @@ -57,7 +57,7 @@ var shortcutId = element.up('tr.shortcut').identify().slice(9); // map InPlaceEditor to edit icons - new Ajax.InPlaceEditor('shortcut-label-' + shortcutId, 'ajax.php?ajaxID=ShortcutMenu::saveShortcut', { + var edit = new Ajax.InPlaceEditor('shortcut-label-' + shortcutId, 'ajax.php?ajaxID=ShortcutMenu::saveShortcut', { externalControl : 'shortcut-edit-' + shortcutId, externalControlOnly : true, highlightcolor : '#f9f9f9', @@ -78,7 +78,6 @@ // follow/execute shortcuts element.observe('click', function(event) { - Event.stop(event); this.toggleMenu(); }.bind(this)); @@ -87,11 +86,11 @@ // activate delete icon $$('.shortcut-delete img').each(function(element) { element.observe('click', function(event) { - if(confirm('Do you really want to remove this shortcut?')) { + if (confirm('Do you really want to remove this shortcut?')) { var deleteControl = event.element(); var shortcutId = deleteControl.up('tr.shortcut').identify().slice(9); - new Ajax.Request('ajax.php', { + var del = new Ajax.Request('ajax.php', { parameters : 'ajaxID=ShortcutMenu::delete&shortcutId=' + shortcutId, onComplete : this.reRenderMenu.bind(this) }); @@ -107,7 +106,7 @@ positionMenu: function() { var calculatedOffset = 0; var parentWidth = $('shortcut-menu').getWidth(); - var currentToolbarItemLayer = $$('#shortcut-menu .toolbar-item-menu')[0]; + var currentToolbarItemLayer = $$('#shortcut-menu .toolbar-item-menu')[0]; var ownWidth = currentToolbarItemLayer.getWidth(); var parentSiblings = $('shortcut-menu').previousSiblings(); @@ -116,7 +115,7 @@ // -1 to compensate for the margin-right -1px of the list items, // which itself is necessary for overlaying the separator with the active state background - if(toolbarItem.down().hasClassName('no-separator')) { + if (toolbarItem.down().hasClassName('no-separator')) { calculatedOffset -= 1; } }); @@ -140,7 +139,7 @@ var menu = $$('#shortcut-menu .toolbar-item-menu')[0]; toolbarItem.blur(); - if(!toolbarItem.hasClassName('toolbar-item-active')) { + if (!toolbarItem.hasClassName('toolbar-item-active')) { toolbarItem.addClassName('toolbar-item-active'); Effect.Appear(menu, {duration: 0.2}); TYPO3BackendToolbarManager.hideOthers(toolbarItem); @@ -148,8 +147,6 @@ toolbarItem.removeClassName('toolbar-item-active'); Effect.Fade(menu, {duration: 0.1}); } - - Event.stop(event); }, /** @@ -166,13 +163,13 @@ var firstInGroup = null; var shortcutGroupId = 0; - if(shortcut.hasClassName('first-row')) { + if (shortcut.hasClassName('first-row')) { firstInGroup = shortcut; } else { firstInGroup = shortcut.previous('.first-row'); } - if(undefined != firstInGroup) { + if (undefined !== firstInGroup) { shortcutGroupId = firstInGroup.previous().identify().slice(15); } @@ -186,12 +183,12 @@ // first create an option for "no group" option = document.createElement('option'); option.value = 0; - option.selected = (shortcutGroupId == 0 ? true : false); + option.selected = (shortcutGroupId === 0 ? true : false); option.appendChild(document.createTextNode('No Group')); selectField.appendChild(option); // get the groups - new Ajax.Request('ajax.php', { + var getGroups = new Ajax.Request('ajax.php', { method: 'get', parameters: 'ajaxID=ShortcutMenu::getGroups', asynchronous: false, // needs to be synchronous to build the options before adding the selectfield @@ -204,7 +201,7 @@ shortcutGroups.each(function(group) { option = document.createElement('option'); option.value = group.key - option.selected = (shortcutGroupId == group.key ? true : false); + option.selected = (shortcutGroupId === group.key ? true : false); option.appendChild(document.createTextNode(group.value)); selectField.appendChild(option); }); @@ -223,7 +220,7 @@ */ reRenderMenu: function(transport, element, backPath) { var container = $$('#shortcut-menu .toolbar-item-menu')[0]; - if(!backPath) { + if (!backPath) { var backPath = ''; } @@ -233,7 +230,7 @@ }); container.update('LOADING'); - new Ajax.Updater( + var render = new Ajax.Updater( container, backPath + 'ajax.php', { @@ -258,7 +255,7 @@ // synchrous call to wait for it to complete and call the render // method with backpath _afterwards_ - new Ajax.Request(backPath + 'ajax.php', { + var call = new Ajax.Request(backPath + 'ajax.php', { parameters : 'ajaxID=ShortcutMenu::create&module=' + moduleName + '&url=' + url, asynchronous : false }); Index: typo3/js/tabmenu.js =================================================================== --- typo3/js/tabmenu.js (revision 7559) +++ typo3/js/tabmenu.js (working copy) @@ -21,22 +21,22 @@ * ***************************************************************/ -var DTM_array = new Array(); -var DTM_origClass = new String(); +var DTM_array = []; +var DTM_origClass =''; // if tabs are used in a popup window the array might not exists -if(!top.DTM_currentTabs) { - top.DTM_currentTabs = new Array(); +if (!top.DTM_currentTabs) { + top.DTM_currentTabs = []; } function DTM_activate(idBase,index,doToogle) { // Hiding all: if (DTM_array[idBase]) { - for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) { - if (DTM_array[idBase][cnt] != idBase+'-'+index) { + for(var cnt = 0; cnt < DTM_array[idBase].length ; cnt++) { + if (DTM_array[idBase][cnt] !== idBase + '-' + index) { document.getElementById(DTM_array[idBase][cnt]+'-DIV').style.display = 'none'; // Only Overriding when Tab not disabled - if (document.getElementById(DTM_array[idBase][cnt]+'-MENU').attributes.getNamedItem('class').nodeValue != 'disabled') { + if (document.getElementById(DTM_array[idBase][cnt]+'-MENU').attributes.getNamedItem('class').nodeValue !== 'disabled') { document.getElementById(DTM_array[idBase][cnt]+'-MENU').attributes.getNamedItem('class').nodeValue = 'tab'; } } @@ -45,9 +45,9 @@ // Showing one: if (document.getElementById(idBase+'-'+index+'-DIV')) { - if (doToogle && document.getElementById(idBase+'-'+index+'-DIV').style.display == 'block') { + if (doToogle && document.getElementById(idBase+'-'+index+'-DIV').style.display === 'block') { document.getElementById(idBase+'-'+index+'-DIV').style.display = 'none'; - if(DTM_origClass=='') { + if (DTM_origClass === '') { document.getElementById(idBase+'-'+index+'-MENU').attributes.getNamedItem('class').nodeValue = 'tab'; } else { DTM_origClass = 'tab'; @@ -55,7 +55,7 @@ top.DTM_currentTabs[idBase] = -1; } else { document.getElementById(idBase+'-'+index+'-DIV').style.display = 'block'; - if(DTM_origClass=='') { + if (DTM_origClass === '') { document.getElementById(idBase+'-'+index+'-MENU').attributes.getNamedItem('class').nodeValue = 'tabact'; } else { DTM_origClass = 'tabact'; @@ -67,9 +67,9 @@ function DTM_toggle(idBase,index,isInit) { // Showing one: if (document.getElementById(idBase+'-'+index+'-DIV')) { - if (document.getElementById(idBase+'-'+index+'-DIV').style.display == 'block') { + if (document.getElementById(idBase+'-'+index+'-DIV').style.display === 'block') { document.getElementById(idBase+'-'+index+'-DIV').style.display = 'none'; - if(isInit) { + if (isInit) { document.getElementById(idBase+'-'+index+'-MENU').attributes.getNamedItem('class').nodeValue = 'tab'; } else { DTM_origClass = 'tab'; @@ -77,7 +77,7 @@ top.DTM_currentTabs[idBase+'-'+index] = 0; } else { document.getElementById(idBase+'-'+index+'-DIV').style.display = 'block'; - if(isInit) { + if (isInit) { document.getElementById(idBase+'-'+index+'-MENU').attributes.getNamedItem('class').nodeValue = 'tabact'; } else { DTM_origClass = 'tabact'; Index: typo3/js/toolbarmanager.js =================================================================== --- typo3/js/toolbarmanager.js (revision 7559) +++ typo3/js/toolbarmanager.js (working copy) @@ -34,7 +34,7 @@ var sibling = toolbarItem.next(); // check whether it is a toolbar item with menu - if(sibling.hasClassName('toolbar-item-menu')) { + if (sibling.hasClassName('toolbar-item-menu')) { // hide all $$('#typo3-toolbar a.toolbar-item + .toolbar-item-menu').invoke('hide'); $$('#typo3-toolbar a.toolbar-item').each(function(element) { Index: typo3/js/tree.js =================================================================== --- typo3/js/tree.js (revision 7559) +++ typo3/js/tree.js (working copy) @@ -30,6 +30,93 @@ * * @author Benjamin Mack */ + +// new object-oriented drag and drop - code, +// tested in IE 6, Firefox 2, Opera 9 +var DragDrop = { + dragID: null, + + // options needed for doing the changes when dropping + table: null, // can be "pages" or "folders" + changeURL: null, + backPath: null, + + + dragElement: function(event, elementID) { + Event.stop(event); // stop bubbling + this.dragID = this.getIdFromEvent(event); + if (!this.dragID) { + return false; + } + + if (!elementID) { + elementID = this.dragID; + } + if (!$('dragIcon')) { + this.addDragIcon(); + } + + $('dragIcon').innerHTML = $('dragIconID_'+elementID).innerHTML + + $('dragTitleID_'+elementID).firstChild.innerHTML; + + document.onmouseup = function(event) { DragDrop.cancelDragEvent(event); }; + document.onmousemove = function(event) { DragDrop.mouseMoveEvent(event); }; + return false; + }, + + dropElement: function(event) { + var dropID = this.getIdFromEvent(event); + if ((this.dragID) && (this.dragID !== dropID)) { + var url = this.changeURL + + '?dragDrop=' + this.table + + '&srcId=' + this.dragID + + '&dstId=' + dropID + + '&backPath=' + this.backPath; + showClickmenu_raw(url); + } + this.cancelDragEvent(); + return false; + }, + + + cancelDragEvent: function(event) { + this.dragID = null; + if ($('dragIcon') && $('dragIcon').style.visibility === 'visible') { + $('dragIcon').style.visibility = 'hidden'; + } + + document.onmouseup = null; + document.onmousemove = null; + }, + + mouseMoveEvent: function(event) { + if (!event) { + event = window.event; + } + $('dragIcon').style.left = (Event.pointerX(event) + 5) + 'px'; + $('dragIcon').style.top = (Event.pointerY(event) - 5) + 'px'; + $('dragIcon').style.visibility = 'visible'; + return false; + }, + + + // -- helper functions -- + getIdFromEvent: function(event) { + var obj = Event.element(event); + while (obj.id == false && obj.parentNode) { + obj = obj.parentNode; + } + return obj.id.substring(obj.id.indexOf('_') + 1); + }, + + // dynamically manipulates the DOM to add the div needed for drag&drop at the bottom of the -tag + addDragIcon: function() { + var code = ''; + var insert = new Insertion.Bottom(document.getElementsByTagName('body')[0], code); + } +}; + + var Tree = { thisScript: 'ajax.php', ajaxID: 'SC_alt_db_navframe::expandCollapse', // has to be either "SC_alt_db_navframe::expandCollapse" or "SC_alt_file_navframe::expandCollapse" @@ -41,7 +128,7 @@ // reloads a part of the page tree (useful when "expand" / "collapse") load: function(params, isExpand, obj) { // fallback if AJAX is not possible (e.g. IE < 6) - if (typeof Ajax.getTransport() != 'object') { + if (typeof Ajax.getTransport() !== 'object') { window.location.href = this.thisScript + '?ajaxID=' + this.ajaxID + '&PM=' + params; return; } @@ -63,7 +150,7 @@ obj.style.cursor = 'wait'; } - new Ajax.Request(this.thisScript, { + var call = new Ajax.Request(this.thisScript, { method: 'get', parameters: 'ajaxID=' + this.ajaxID + '&PM=' + params, onComplete: function(xhr) { @@ -91,7 +178,9 @@ // attaches the events to the elements needed for the drag and drop (for the titles and the icons) registerDragDropHandlers: function() { - if (!this.activateDragDrop) return; + if (!this.activateDragDrop) { + return; + } this._registerDragDropHandlers('dragTitle'); this._registerDragDropHandlers('dragIcon'); }, @@ -107,7 +196,7 @@ // selects the activated item again, in case it collapsed and got expanded again reSelectActiveItem: function() { - obj = $(top.fsMod.navFrameHighlightedID[this.frameSetModule]); + var obj = $(top.fsMod.navFrameHighlightedID[this.frameSetModule]); if (obj) { Element.addClassName(obj, this.highlightClass); this.extractPageIdFromTreeItem(obj.id); @@ -121,7 +210,7 @@ this.extractPageIdFromTreeItem(highlightID); // Remove all items that are already highlighted - obj = $(top.fsMod.navFrameHighlightedID[frameSetModule]); + var obj = $(top.fsMod.navFrameHighlightedID[frameSetModule]); if (obj) { var classes = $w(this.highlightClass); for (var i = 0; i < classes.length; i++) @@ -130,7 +219,9 @@ // Set the new item top.fsMod.navFrameHighlightedID[frameSetModule] = highlightID; - if ($(highlightID)) Element.addClassName(highlightID, this.highlightClass); + if ($(highlightID)) { + Element.addClassName(highlightID, this.highlightClass); + } }, //extract pageID from the given id (pagesxxx_y_z where xxx is the ID) @@ -143,85 +234,7 @@ -// new object-oriented drag and drop - code, -// tested in IE 6, Firefox 2, Opera 9 -var DragDrop = { - dragID: null, - // options needed for doing the changes when dropping - table: null, // can be "pages" or "folders" - changeURL: null, - backPath: null, - - - dragElement: function(event, elementID) { - Event.stop(event); // stop bubbling - this.dragID = this.getIdFromEvent(event); - if (this.dragID == 0) return false; - - if (!elementID) elementID = this.dragID; - if (!$('dragIcon')) this.addDragIcon(); - - $('dragIcon').innerHTML = $('dragIconID_'+elementID).innerHTML - + $('dragTitleID_'+elementID).firstChild.innerHTML; - - document.onmouseup = function(event) { DragDrop.cancelDragEvent(event); }; - document.onmousemove = function(event) { DragDrop.mouseMoveEvent(event); }; - return false; - }, - - dropElement: function(event) { - var dropID = this.getIdFromEvent(event); - if ((this.dragID) && (this.dragID != dropID)) { - var url = this.changeURL - + '?dragDrop=' + this.table - + '&srcId=' + this.dragID - + '&dstId=' + dropID; - + '&backPath=' + this.backPath; - showClickmenu_raw(url); - } - this.cancelDragEvent(); - return false; - }, - - - cancelDragEvent: function(event) { - this.dragID = null; - if ($('dragIcon') && $('dragIcon').style.visibility == 'visible') { - $('dragIcon').style.visibility = 'hidden'; - } - - document.onmouseup = null; - document.onmousemove = null; - }, - - mouseMoveEvent: function(event) { - if (!event) { - event = window.event; - } - $('dragIcon').style.left = (Event.pointerX(event) + 5) + 'px'; - $('dragIcon').style.top = (Event.pointerY(event) - 5) + 'px'; - $('dragIcon').style.visibility = 'visible'; - return false; - }, - - - // -- helper functions -- - getIdFromEvent: function(event) { - var obj = Event.element(event); - while (obj.id == false && obj.parentNode) { obj = obj.parentNode; } - return obj.id.substring(obj.id.indexOf('_')+1); - }, - - // dynamically manipulates the DOM to add the div needed for drag&drop at the bottom of the -tag - addDragIcon: function() { - var code = ''; - new Insertion.Bottom(document.getElementsByTagName('body')[0], code); - } -}; - - - /** * * @author Ingo Renner Index: typo3/js/workspacemenu.js =================================================================== --- typo3/js/workspacemenu.js (revision 7559) +++ typo3/js/workspacemenu.js (working copy) @@ -68,7 +68,7 @@ // -1 to compensate for the margin-right -1px of the list items, // which itself is necessary for overlaying the separator with the active state background - if(toolbarItem.down().hasClassName('no-separator')) { + if (toolbarItem.down().hasClassName('no-separator')) { calculatedOffset -= 1; } }); @@ -92,7 +92,7 @@ var menu = $$('#workspace-selector-menu .toolbar-item-menu')[0]; toolbarItem.blur(); - if(!toolbarItem.hasClassName('toolbar-item-active')) { + if (!toolbarItem.hasClassName('toolbar-item-active')) { toolbarItem.addClassName('toolbar-item-active'); Effect.Appear(menu, {duration: 0.2}); TYPO3BackendToolbarManager.hideOthers(toolbarItem); @@ -110,13 +110,13 @@ * toggles the workspace frontend preview */ toggleFrontendPreview: function(event) { - new Ajax.Request('ajax.php', { + var toggle = new Ajax.Request('ajax.php', { parameters: 'ajaxID=WorkspaceMenu::toggleWorkspacePreview', onSuccess: function(transport, response) { var stateActiveIcon = $$('#workspace-selector-menu img.state-active')[0].cloneNode(true); var stateInactiveIcon = $$('#workspace-selector-menu img.state-inactive')[0].cloneNode(true); - if (response.newWorkspacePreviewState == 1) { + if (response.newWorkspacePreviewState === 1) { TYPO3.configuration.workspaceFrontendPreviewEnabled = 1; Event.element(event).previous().replace(stateActiveIcon); top.WorkspaceFrontendPreviewEnabled = true; @@ -146,7 +146,7 @@ switchWorkspace: function(event) { var workspaceId = Event.element(event).identify().substring(3); - new Ajax.Request('ajax.php', { + var switchRequest = new Ajax.Request('ajax.php', { parameters: 'ajaxID=WorkspaceMenu::setWorkspace&workspaceId=' + workspaceId, onSuccess: function(transport, response) { TYPO3.configuration.inWorkspace = response.setWorkspaceId === 0 ? 0 : 1;