diff --git a/index.php b/index.php
index 1b42aa2..8d8adb2 100644
--- a/index.php
+++ b/index.php
@@ -53,6 +53,8 @@
+
Copied!
+
Failed to copy
Batch Color Converter
diff --git a/js/app.js b/js/app.js
index 7ab3e44..59597ad 100644
--- a/js/app.js
+++ b/js/app.js
@@ -12,7 +12,8 @@ let app = new Vue({
],
inputBox: "ccc\n#4f46e5\n#db2777aa\n",
- copyInput: "",
+ showStatusMessage: false,
+ showErrorMessage: false,
hexRegex: /^\#?[a-f0-9]{3,9}/i,
rgbRegex: /^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)/i,
@@ -375,8 +376,20 @@ console.error('hexa to HSLa not implemented yet');
},
updateClipboard: function (text) {
+ let _this = this;
clipboard.writeText(text).then(() => {
- console.log('text copied!');
+ _this.showErrorMessage = false;
+ _this.showStatusMessage = true;
+ setTimeout(() => {
+ _this.showStatusMessage = false;
+ }, 1000);
+ })
+ .catch(() => {
+ _this.showStatusMessage = false;
+ _this.showErrorMessage = true;
+ setTimeout(() => {
+ _this.showErrorMessage = false;
+ }, 1000);
});
},
},