mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-24 21:36:12 +01:00

[CLEANUP] Adopt .editorconfig settings from the TYPO3 core (#176)

Also drop redundancies and sort the entries.
This commit is contained in:
Oliver Klee 2020-11-29 21:15:29 +01:00 committed by GitHub
parent dee89c5266
commit 373c7965b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 62 additions and 83 deletions

View file

@ -5,66 +5,45 @@ root = true
[*] [*]
charset = utf-8 charset = utf-8
end_of_line = lf end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = 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 files
[*.js] [*.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 indent_size = 2
# JSON files # JSON files
[{*.jsonl}] [*.json]
indent_style = space indent_style = tab
# package.json
[package.json]
indent_size = 2 indent_size = 2
# XML files # ReST files
[*.xml] [*.rst]
indent_style = space indent_size = 3
indent_size = 4 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

View file

@ -2,40 +2,40 @@ var TYPO3 = TYPO3 || {};
TYPO3.tea = {}; TYPO3.tea = {};
TYPO3.tea.makeSortable = function (table) { TYPO3.tea.makeSortable = function (table) {
var th = table.tHead, var th = table.tHead,
i; i;
th && (th = th.rows[0]) && (th = th.cells); th && (th = th.rows[0]) && (th = th.cells);
if (th) i = th.length; if (th) i = th.length;
else return; else return;
while (--i >= 0) while (--i >= 0)
(function (i) { (function (i) {
var dir = 1; var dir = 1;
th[i].addEventListener("click", function () { th[i].addEventListener("click", function () {
TYPO3.tea.sortTable(table, i, (dir = 1 - dir)); TYPO3.tea.sortTable(table, i, (dir = 1 - dir));
}); });
})(i); })(i);
}; };
TYPO3.tea.sortTable = function (table, col, reverse) { TYPO3.tea.sortTable = function (table, col, reverse) {
var tb = table.tBodies[0], var tb = table.tBodies[0],
tr = Array.prototype.slice.call(tb.rows, 0), tr = Array.prototype.slice.call(tb.rows, 0),
i; i;
reverse = -(+reverse || -1); reverse = -(+reverse || -1);
tr = tr.sort(function (a, b) { tr = tr.sort(function (a, b) {
return ( return (
reverse * reverse *
a.cells[col].textContent a.cells[col].textContent
.trim() .trim()
.localeCompare(b.cells[col].textContent.trim()) .localeCompare(b.cells[col].textContent.trim())
); );
}); });
for (i = 0; i < tr.length; ++i) tb.appendChild(tr[i]); for (i = 0; i < tr.length; ++i) tb.appendChild(tr[i]);
}; };
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
var t = document.querySelectorAll(".tx-tea table"), var t = document.querySelectorAll(".tx-tea table"),
i = t.length; i = t.length;
while (--i >= 0) { while (--i >= 0) {
TYPO3.tea.makeSortable(t[i]); TYPO3.tea.makeSortable(t[i]);
} }
}); });