2023-12-04 11:58:44 +02:00
|
|
|
<template>
|
|
|
|
<h2 class="tool-title">URL encode/decode</h2>
|
2024-10-16 11:19:00 +03:00
|
|
|
<hr class="mt-5 mb-5" />
|
2023-12-04 11:58:44 +02:00
|
|
|
|
|
|
|
<div class="input-group">
|
|
|
|
<label for="data">Data</label>
|
2024-03-07 13:41:39 +02:00
|
|
|
<textarea id="data" v-model="toolData.data" v-on:keyup="result"></textarea>
|
2023-12-04 11:58:44 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="input-group">
|
|
|
|
<label>Mode</label>
|
|
|
|
|
|
|
|
<div>
|
2024-10-16 11:19:00 +03:00
|
|
|
<input
|
|
|
|
id="encode_mode_encode"
|
|
|
|
value="encode"
|
|
|
|
name="encode_mode"
|
|
|
|
v-model="toolData.encodeMode"
|
|
|
|
v-on:change="result"
|
|
|
|
type="radio"
|
|
|
|
/>
|
2024-10-28 21:13:08 +02:00
|
|
|
<label for="encode_mode_encode"> encode</label><br />
|
2024-10-16 11:19:00 +03:00
|
|
|
<input
|
|
|
|
id="encode_mode_decode"
|
|
|
|
value="decode"
|
|
|
|
name="encode_mode"
|
|
|
|
v-model="toolData.encodeMode"
|
|
|
|
v-on:change="result"
|
|
|
|
type="radio"
|
|
|
|
/>
|
2024-10-28 21:13:08 +02:00
|
|
|
<label for="encode_mode_decode"> decode</label>
|
2023-12-04 11:58:44 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2024-10-16 11:19:00 +03:00
|
|
|
<hr class="mt-5 mb-5" />
|
2023-12-04 11:58:44 +02:00
|
|
|
|
|
|
|
<div class="input-group">
|
|
|
|
<label for="result">Result</label>
|
2024-10-16 11:19:00 +03:00
|
|
|
<MonacoEditor
|
|
|
|
name="result"
|
|
|
|
language="text"
|
|
|
|
:value="toolResult"
|
|
|
|
></MonacoEditor>
|
2023-12-04 11:58:44 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2024-03-07 13:41:39 +02:00
|
|
|
import MonacoEditor from "@/components/MonacoEditor.vue";
|
|
|
|
|
2023-12-04 11:58:44 +02:00
|
|
|
export default {
|
2024-03-07 13:41:39 +02:00
|
|
|
components: {
|
2024-10-16 11:19:00 +03:00
|
|
|
MonacoEditor,
|
2024-03-07 13:41:39 +02:00
|
|
|
},
|
2023-12-04 11:58:44 +02:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
toolData: {
|
2024-09-28 15:16:10 +03:00
|
|
|
data: "",
|
2024-10-16 11:19:00 +03:00
|
|
|
encodeMode: "decode",
|
2023-12-04 11:58:44 +02:00
|
|
|
},
|
2024-10-16 11:19:00 +03:00
|
|
|
toolResult: "",
|
2023-12-04 11:58:44 +02:00
|
|
|
};
|
|
|
|
},
|
2024-03-07 13:41:39 +02:00
|
|
|
methods: {
|
|
|
|
result() {
|
2023-12-04 11:58:44 +02:00
|
|
|
switch (this.toolData.encodeMode) {
|
2024-09-28 15:16:10 +03:00
|
|
|
case "encode":
|
2024-10-16 11:19:00 +03:00
|
|
|
this.toolResult = this.toolData.data
|
|
|
|
.split("\n")
|
|
|
|
.map(encodeURIComponent)
|
|
|
|
.join("\n");
|
2024-03-07 13:41:39 +02:00
|
|
|
break;
|
2024-09-28 15:16:10 +03:00
|
|
|
case "decode":
|
2024-10-16 11:19:00 +03:00
|
|
|
this.toolResult = this.toolData.data
|
|
|
|
.split("\n")
|
|
|
|
.map(decodeURIComponent)
|
|
|
|
.join("\n");
|
2024-03-07 13:41:39 +02:00
|
|
|
break;
|
2023-12-04 11:58:44 +02:00
|
|
|
}
|
2024-10-16 11:19:00 +03:00
|
|
|
},
|
|
|
|
},
|
2024-09-28 15:16:10 +03:00
|
|
|
};
|
2023-12-04 11:58:44 +02:00
|
|
|
</script>
|
|
|
|
|
2024-10-16 11:19:00 +03:00
|
|
|
<style lang="scss"></style>
|