Add url encode/decode tool

This commit is contained in:
Illya Marchenko 2023-12-04 11:58:44 +02:00
parent 932a8250b6
commit 336b13ef2d
Signed by: stuzer05
GPG Key ID: A6ABAAA9268F9F4F
3 changed files with 58 additions and 0 deletions

View File

@ -34,6 +34,7 @@ export default {
'str_sort_lines': 'Str sort lines',
'str_to_lower_upper': 'Str to lower/upper',
'str_remove_duplicate_lines': 'Str remove duplicate lines',
'url_encode_decode': 'URL encode/decode',
},
'SQL': {
'sql_split_in': 'SQL split IN',

View File

@ -40,6 +40,11 @@ const router = createRouter({
name: 'fix_ru_en_keyboard',
component: () => import('../views/FixRuEnKeyboard.vue'),
},
{
path: '/url_encode_decode',
name: 'url_encode_decode',
component: () => import('../views/UrlEncodeDecode.vue'),
},
/**
* SQL manipulation

View File

@ -0,0 +1,52 @@
<template>
<h2 class="tool-title">URL encode/decode</h2>
<hr class="mt-5 mb-5">
<div class="input-group">
<label for="data">Data</label>
<textarea id="data" v-model="toolData.data" style="height: 150px"></textarea>
</div>
<div class="input-group">
<label>Mode</label>
<div>
<input id="encode_mode_encode" value="encode" name="encode_mode" v-model="toolData.encodeMode" type="radio"> <label for="encode_mode_encode">endode</label><br>
<input id="encode_mode_decode" value="decode" name="encode_mode" v-model="toolData.encodeMode" type="radio"> <label for="encode_mode_decode">decode</label>
</div>
</div>
<hr class="mt-5 mb-5">
<div class="input-group">
<label for="result">Result</label>
<textarea id="result" v-model="toolResult" style="height: 150px"></textarea>
</div>
</template>
<script>
export default {
data() {
return {
toolData: {
data: '',
encodeMode: 'decode',
},
};
},
computed: {
toolResult() {
switch (this.toolData.encodeMode) {
case 'encode':
return this.toolData.data.split('\n').map(encodeURIComponent).join('\n');
case 'decode':
return this.toolData.data.split('\n').map(decodeURIComponent).join('\n');
}
},
},
}
</script>
<style lang="scss">
</style>