From 373c7965b4edece475798b34ff3083bbbba78b5f Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Sun, 29 Nov 2020 21:15:29 +0100 Subject: [PATCH] [CLEANUP] Adopt .editorconfig settings from the TYPO3 core (#176) Also drop redundancies and sort the entries. --- .editorconfig | 85 +++++++++++------------------ Resources/Public/JavaScript/Main.js | 60 ++++++++++---------- 2 files changed, 62 insertions(+), 83 deletions(-) diff --git a/.editorconfig b/.editorconfig index 2c2b06b..7207e2d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,66 +5,45 @@ root = true [*] charset = utf-8 end_of_line = lf +indent_style = space +indent_size = 4 insert_final_newline = true trim_trailing_whitespace = true -# HTML files -[*.html] -indent_style = space -indent_size = 4 - -# CSS files -[*.css] -indent_style = space -indent_size = 4 - - -# LESS files -[*.less] -indent_style = space -indent_size = 4 - -# SCSS files -[*.scss] -indent_style = tab -indent_size = 2 - # JS files [*.js] -indent_style = space -indent_size = 4 - -# PHP files -[*.php] -indent_style = space -indent_size = 4 - -# MD files -[*.md] -indent_style = space -indent_size = 4 - -# ReST files -[*.rst] -indent_style = space -indent_size = 3 - -# TypoScript files -[*.typoscript] -indent_style = space -indent_size = 4 - -# YML files -[{*.yml,*.yaml}] -indent_style = space indent_size = 2 # JSON files -[{*.jsonl}] -indent_style = space +[*.json] +indent_style = tab + +# package.json +[package.json] indent_size = 2 -# XML files -[*.xml] -indent_style = space -indent_size = 4 +# ReST files +[*.rst] +indent_size = 3 +max_line_length = 80 + +# SQL files +[*.sql] +indent_style = tab +indent_size = 2 + +# TypoScript files +[*.{typoscript,tsconfig}] +indent_size = 2 + +# YAML files +[{*.yml,*.yaml}] +indent_size = 2 + +# XLF files +[*.xlf] +indent_style = tab + +# .htaccess +[.htaccess] +indent_style = tab diff --git a/Resources/Public/JavaScript/Main.js b/Resources/Public/JavaScript/Main.js index fc96c45..dfc0c10 100644 --- a/Resources/Public/JavaScript/Main.js +++ b/Resources/Public/JavaScript/Main.js @@ -2,40 +2,40 @@ var TYPO3 = TYPO3 || {}; TYPO3.tea = {}; TYPO3.tea.makeSortable = function (table) { - var th = table.tHead, - i; - th && (th = th.rows[0]) && (th = th.cells); - if (th) i = th.length; - else return; - while (--i >= 0) - (function (i) { - var dir = 1; - th[i].addEventListener("click", function () { - TYPO3.tea.sortTable(table, i, (dir = 1 - dir)); - }); - })(i); + var th = table.tHead, + i; + th && (th = th.rows[0]) && (th = th.cells); + if (th) i = th.length; + else return; + while (--i >= 0) + (function (i) { + var dir = 1; + th[i].addEventListener("click", function () { + TYPO3.tea.sortTable(table, i, (dir = 1 - dir)); + }); + })(i); }; TYPO3.tea.sortTable = function (table, col, reverse) { - var tb = table.tBodies[0], - tr = Array.prototype.slice.call(tb.rows, 0), - i; - reverse = -(+reverse || -1); - tr = tr.sort(function (a, b) { - return ( - reverse * - a.cells[col].textContent - .trim() - .localeCompare(b.cells[col].textContent.trim()) - ); - }); - for (i = 0; i < tr.length; ++i) tb.appendChild(tr[i]); + var tb = table.tBodies[0], + tr = Array.prototype.slice.call(tb.rows, 0), + i; + reverse = -(+reverse || -1); + tr = tr.sort(function (a, b) { + return ( + reverse * + a.cells[col].textContent + .trim() + .localeCompare(b.cells[col].textContent.trim()) + ); + }); + for (i = 0; i < tr.length; ++i) tb.appendChild(tr[i]); }; document.addEventListener("DOMContentLoaded", function () { - var t = document.querySelectorAll(".tx-tea table"), - i = t.length; - while (--i >= 0) { - TYPO3.tea.makeSortable(t[i]); - } + var t = document.querySelectorAll(".tx-tea table"), + i = t.length; + while (--i >= 0) { + TYPO3.tea.makeSortable(t[i]); + } });