diff --git a/README.md b/README.md index 2bb90e9..7578fff 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ This is a standalone web application designed to clear sensitive data from text. - Clear sensitive data from text: The application provides a simple and intuitive interface for clearing sensitive data from any text input. - Auto copy to clipboard: The cleared text is automatically copied to the clipboard for easy use. - Customizable filters: The application comes with a set of predefined filters for common types of sensitive data, and users can enable or disable these filters as needed. +- **NEW**: Multiline to Singleline: Convert multiline text to singleline text with a single click. ## Compatibility @@ -33,4 +34,11 @@ This project is licensed under the MIT License. See the `LICENSE` file for more - animate.css - A cross-browser library of CSS animations. [animate.css GitHub](https://github.com/animate-css/animate.css) - NeutralinoJS - The lightweight and portable framework used to build this application. [NeutralinoJS GitHub](https://github.com/neutralinojs/neutralinojs) - Bootstrap icons - Used for the icons in the application. [Bootstrap icons GitHub](https://github.com/twbs/icons) -- DALL-E3 by OpenAI - Used for generating all visible images/graphics. [DALL-E3 GitHub](https://github.com/openai/DALL-E) \ No newline at end of file +- DALL-E3 by OpenAI - Used for generating all visible images/graphics. [DALL-E3 GitHub](https://github.com/openai/DALL-E) + +### Dev notes + +Init dev env +1. run `neu update` +2. run `neu build` +3. run `neu run` \ No newline at end of file diff --git a/neutralino.config.json b/neutralino.config.json index 09f81b0..2b32cad 100644 --- a/neutralino.config.json +++ b/neutralino.config.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/neutralinojs/neutralinojs/main/schemas/neutralino.config.schema.json", "applicationId": "de.walzen665.clearapp", - "version": "1.0.1", + "version": "1.1.0", "defaultMode": "window", "port": 0, "documentRoot": "/src/", diff --git a/src/icons/lineconv.webp b/src/icons/lineconv.webp new file mode 100644 index 0000000..e80b673 Binary files /dev/null and b/src/icons/lineconv.webp differ diff --git a/src/views/cleaner/cleaner.html b/src/views/cleaner/cleaner.html index b4df831..8161605 100644 --- a/src/views/cleaner/cleaner.html +++ b/src/views/cleaner/cleaner.html @@ -9,7 +9,7 @@ Back -
+

Cooperate Cleaner

Enter your text, clear, done

@@ -25,6 +25,7 @@

Output:

+

XX matches replaced.

diff --git a/src/views/cleaner/cleaner.js b/src/views/cleaner/cleaner.js index 6b6bbe4..4364608 100644 --- a/src/views/cleaner/cleaner.js +++ b/src/views/cleaner/cleaner.js @@ -56,20 +56,31 @@ console.log("Cleaning..."); let outputText = $("#input-textarea").val(); + let totalMatches = 0; config.rules.forEach(rule => { if (rule.enabled) { const searchValue = rule.ignoreCase ? new RegExp(rule.strToReplace, 'gi') : new RegExp(rule.strToReplace, 'g'); - outputText = outputText.replace(searchValue, rule.replaceStr); + let matchCount = 0; + + outputText = outputText.replace(searchValue, (match) => { + matchCount++; + return rule.replaceStr; + }); + + totalMatches += matchCount; } }); $("#output-textarea").val(outputText); $("#output-container-div").removeClass("visually-hidden"); - if($("#enable-auto-copy").prop("checked")) { + $("#replace-count").text(totalMatches); + + if ($("#enable-auto-copy").prop("checked")) { console.log("Copying result to clipboard...") await Neutralino.clipboard.writeText(outputText); } } + })(); \ No newline at end of file diff --git a/src/views/home/home.html b/src/views/home/home.html index 09bfba8..c4569f2 100644 --- a/src/views/home/home.html +++ b/src/views/home/home.html @@ -23,6 +23,18 @@ +
+
+ App 1 +
+
Multiline to single line
+

Convert multiline text to singleline

+
+
+
+ + +
App 3 @@ -32,7 +44,6 @@
-
diff --git a/src/views/home/home.js b/src/views/home/home.js index c3748b9..09135c1 100644 --- a/src/views/home/home.js +++ b/src/views/home/home.js @@ -16,6 +16,10 @@ function init(){ console.log("About button clicked"); loadView("about"); }); + $("#home-btn-sl").click(function(){ + console.log("Singleline converter button clicked"); + loadView("slconv"); + }); $("#exit-btn").click(function(){ console.log("Quit button clicked"); quit(); diff --git a/src/views/slconv/slconv.css b/src/views/slconv/slconv.css new file mode 100644 index 0000000..e69de29 diff --git a/src/views/slconv/slconv.html b/src/views/slconv/slconv.html new file mode 100644 index 0000000..47cd7bd --- /dev/null +++ b/src/views/slconv/slconv.html @@ -0,0 +1,34 @@ +
+
+
+
+ +
+
+
+

Singleline Converter

+

Enter your text, convert, done

+ +

Input:

+ + +
+

Output:

+ +

XX line breaks removed.

+
+
+
+
+
+
diff --git a/src/views/slconv/slconv.js b/src/views/slconv/slconv.js new file mode 100644 index 0000000..486a430 --- /dev/null +++ b/src/views/slconv/slconv.js @@ -0,0 +1,24 @@ +(function () { + $(document).ready(function () { + console.log("Initialization of slconv.js finished."); + $("#slconv-btn-convert").click(function () { + console.log("Convert button clicked"); + convert(); + }); + }); + + async function convert() { + console.log("Converting..."); + const inputText = $("#input-textarea").val(); + console.log(inputText); + const matches = inputText.match(/\n/g); + const matchCount = matches ? matches.length : 0; + console.log("Number of matches (newlines):", matchCount); + const outputText = inputText.replace(/\n/g, ' '); + console.log(outputText); + $("#output-textarea").val(outputText); + $("#output-container-div").removeClass("visually-hidden"); + $("#rm-count").text(matchCount); + await Neutralino.clipboard.writeText(outputText); + } +})(); \ No newline at end of file