diff --git a/.eslintrc.json b/.eslintrc.json index f36bdfd..9a30e78 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,10 +1,6 @@ { "extends": [ - "eslint:recommended", - "plugin:vue/recommended" - ], - "plugins": [ - "vue" + "eslint:recommended" ], "parserOptions": { "ecmaVersion": 2017 @@ -144,33 +140,6 @@ "prefer-template": "error", "rest-spread-spacing": "error", "template-curly-spacing": "error", - "yield-star-spacing": "error", - - "vue/html-closing-bracket-newline": ["error", { - "multiline": "always" - }], - "vue/html-indent": ["error", "tab", { - "attribute": 1, - "closeBracket": 0, - "alignAttributesVertically": true, - "ignores": [] - }], - "vue/max-attributes-per-line": ["error", { - "singleline": 5, - "multiline": { - "max": 1, - "allowFirstLine": false - } - }], - "vue/html-self-closing": ["error", { - "html": { - "void": "always", - "normal": "never", - "component": "never" - }, - "svg": "always", - "math": "always" - }], - "vue/require-default-prop": ["off"] + "yield-star-spacing": "error" } } diff --git a/package.json b/package.json index e1fc45d..1296a85 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ToL-Mod-Utility", - "version": "1.8.2", + "version": "1.9.0", "productName": "ToL-Mod-Utility", "description": "Moderation utility for Throne of Lies player reports.", "main": "./src/client", @@ -10,10 +10,8 @@ "electron-packager": "^12.1.0", "electron-winstaller": "^2.6.4", "eslint": "^4.19.1", - "eslint-plugin-vue": "^4.5.0", "htmlhint": "^0.9.13", - "vue-devtools": "^3.1.9", - "vue-eslint-parser": "^2.0.3" + "vue-devtools": "^3.1.9" }, "scripts": { "test": "eslint src && htmlhint", diff --git a/src/index.js b/src/index.js index 77a9c1b..a41e857 100644 --- a/src/index.js +++ b/src/index.js @@ -52,8 +52,20 @@ const app = new Vue({ player.lastJournalLeft = player.lastJournalLeft.split('\n').filter(line => line).map(line => line.trim()); player.lastJournalRight = player.lastJournalRight.split('\n').filter(line => line).map(line => line.trim()); }); - this.parsedChatLogs = this.chatLogsInput.split('[,]').filter(line => line).map(line => line.trim()); - // parse chatlogs (character sequence is line seperator) and assign it as base chatlogs "backup" to work with + this.parsedChatLogs = this.chatLogsInput.split('[,]').filter(line => line) + // character sequence in above split is line seperator, filter used to remove empty + .map(line => { + const colorTagStartRegex = /\[color=#[a-fA-F0-9]{6}\]\s?/; + const colorTagEndRegex = /\s?\[\/color]/; + const formattingTagRegex = /<\/?[bius]>/gm; + + if (colorTagStartRegex.test(line)) line.match(colorTagStartRegex).forEach(match => line = line.replace(match, '')); + if (colorTagEndRegex.test(line)) line.match(colorTagEndRegex).forEach(match => line = line.replace(match, '')); + // check log lines for color tags like "[color=#fffff]" and "[/color]", then remove them if found + if (formattingTagRegex.test(line)) line.match(formattingTagRegex).forEach(match => line = line.replace(match, '')); + // check lines for formatting tags like ".." etc and remove them + return line.trim(); + }); this.savedChatLogs = this.parsedChatLogs; this.days = this.savedChatLogs.filter(line => /\(Day\) Day \d+/.test(line)).length; this.nights = this.savedChatLogs.filter(line => /\(Day\) Night \d+/.test(line)).length;